How to create a list of six unit vectors in 3D?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I want to have a list 1,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,0,0,-1
. How to generate it smartly?
list-manipulation
add a comment |
up vote
2
down vote
favorite
I want to have a list 1,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,0,0,-1
. How to generate it smartly?
list-manipulation
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I want to have a list 1,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,0,0,-1
. How to generate it smartly?
list-manipulation
I want to have a list 1,0,0,0,1,0,0,0,1,-1,0,0,0,-1,0,0,0,-1
. How to generate it smartly?
list-manipulation
list-manipulation
asked Nov 30 at 15:10
Artificial Stupidity
21219
21219
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
up vote
5
down vote
accepted
Perhaps this
Join[IdentityMatrix[3], -IdentityMatrix[3]]
(* 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1 *)
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
I like the variantJoin[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
add a comment |
up vote
2
down vote
Join@@(Permutations[#]&/@#,-#&@1,0,0)
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
up vote
1
down vote
UnitVector
:
Join[#, -#] &@(UnitVector[3, #] & /@ Range[3])
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Perhaps this
Join[IdentityMatrix[3], -IdentityMatrix[3]]
(* 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1 *)
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
I like the variantJoin[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
add a comment |
up vote
5
down vote
accepted
Perhaps this
Join[IdentityMatrix[3], -IdentityMatrix[3]]
(* 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1 *)
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
I like the variantJoin[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Perhaps this
Join[IdentityMatrix[3], -IdentityMatrix[3]]
(* 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1 *)
Perhaps this
Join[IdentityMatrix[3], -IdentityMatrix[3]]
(* 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1 *)
answered Nov 30 at 15:22
Michael E2
144k11193463
144k11193463
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
I like the variantJoin[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
add a comment |
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
I like the variantJoin[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
+1: Good one! Thanks!
– Artificial Stupidity
Nov 30 at 15:23
1
1
I like the variant
Join[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
I like the variant
Join[#, -#] &@IdentityMatrix[3]
– mikado
Nov 30 at 16:53
1
1
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
@mikado Yeah, I thought of that, but too much top-row-shift typing for my podgy fingers compared to I-d--<kbd>return</kbd>... :)
– Michael E2
Nov 30 at 17:04
add a comment |
up vote
2
down vote
Join@@(Permutations[#]&/@#,-#&@1,0,0)
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
up vote
2
down vote
Join@@(Permutations[#]&/@#,-#&@1,0,0)
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
up vote
2
down vote
up vote
2
down vote
Join@@(Permutations[#]&/@#,-#&@1,0,0)
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
Join@@(Permutations[#]&/@#,-#&@1,0,0)
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
answered Nov 30 at 15:23
J42161217
3,682220
3,682220
add a comment |
add a comment |
up vote
1
down vote
UnitVector
:
Join[#, -#] &@(UnitVector[3, #] & /@ Range[3])
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
up vote
1
down vote
UnitVector
:
Join[#, -#] &@(UnitVector[3, #] & /@ Range[3])
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
add a comment |
up vote
1
down vote
up vote
1
down vote
UnitVector
:
Join[#, -#] &@(UnitVector[3, #] & /@ Range[3])
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
UnitVector
:
Join[#, -#] &@(UnitVector[3, #] & /@ Range[3])
1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 0, 0, -1, 0, 0, 0, -1
answered Dec 1 at 11:31
Αλέξανδρος Ζεγγ
3,7301927
3,7301927
add a comment |
add a comment |
Thanks for contributing an answer to Mathematica Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187043%2fhow-to-create-a-list-of-six-unit-vectors-in-3d%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown