Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Operations on Vectors >

UnitVector

UnitVector[k]
gives the two-dimensional unit vector in the k^(th) direction.
UnitVector[n, k]
gives the n-dimensional unit vector in the k^(th) direction.
  • UnitVector[n, k] is a list of length n with a 1 in position k and 0s elsewhere.
The unit vector in the x direction in 2 dimensions:
In[1]:=
Click for copyable input
Out[1]=
 
The unit vector in the y direction in 3 dimensions:
In[1]:=
Click for copyable input
Out[1]=
New in 6
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team