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.

Details and Options

  • UnitVector[n,k] is a list of length n with a 1 in position k and 0s elsewhere.
  • UnitVector by default creates a vector containing exact integers.
  • The option WorkingPrecision can be used to specify the precision of vector components.

Examples

open allclose all

Basic Examples  (2)

The unit vector in the direction in two dimensions:

In[1]:=
Click for copyable input
Out[1]=

The unit vector in the direction in three dimensions:

In[1]:=
Click for copyable input
Out[1]=

Scope  (2)

Applications  (3)

Properties & Relations  (1)

Possible Issues  (1)

See Also

AngleVector  IdentityMatrix  KroneckerDelta  Normalize  RotationMatrix  CirclePoints

Introduced in 2007
(6.0)
| Updated in 2008
(7.0)