WLJS LogoWLJS Notebook

UnitVector

UnitVector[n, k] gives the n-dimensional unit vector in the kth direction.

UnitVector[k] gives a 2D unit vector in the kth direction.

Examples

2D unit vectors:

UnitVector[1]
(* {1, 0} *)

UnitVector[2]
(* {0, 1} *)

3D unit vector:

UnitVector[3, 2]
(* {0, 1, 0} *)

Please visit the official Wolfram Language Reference for more details.

On this page