Skip to main content
deleted 5 characters in body
Source Link
glS
  • 7.8k
  • 1
  • 24
  • 64

For 2D vectors, computing the vector orthogonal to a given $v$ is straightforwardly done using Cross, as for example shown here.

However, Cross does not seem to work for more than two dimensions, and I couldn't find any function giving a complete set of normal vectors to a given $v$.

For example, I'm looking for a function that, given v={1,0,0}, will give me back {{0,1,0},{0,0,1}}, or some other equivalent set of vectors (that is, I want a basis for the orthogonal space $v^\perp$).

An easy way to do this in 3D is with something like:

normalVecs[v_] := Cross[v, #] & /@ IdentityMatrix @ 3IdentityMatrix@3 // Orthogonalize // DeleteCases @Select[Norm@# {0,> 0, 0};&];
normalVecs @ {1, 0, 0}

but using Cross does not generalize to more than 3 dimensions.

What is the best way to do this?

For 2D vectors, computing the vector orthogonal to a given $v$ is straightforwardly done using Cross, as for example shown here.

However, Cross does not seem to work for more than two dimensions, and I couldn't find any function giving a complete set of normal vectors to a given $v$.

For example, I'm looking for a function that, given v={1,0,0}, will give me back {{0,1,0},{0,0,1}}, or some other equivalent set of vectors (that is, I want a basis for the orthogonal space $v^\perp$).

An easy way to do this in 3D is with something like:

normalVecs[v_] := Cross[v, #] & /@ IdentityMatrix @ 3 // Orthogonalize // DeleteCases @ {0, 0, 0};
normalVecs @ {1, 0, 0}

but using Cross does not generalize to more than 3 dimensions.

What is the best way to do this?

For 2D vectors, computing the vector orthogonal to a given $v$ is straightforwardly done using Cross, as for example shown here.

However, Cross does not seem to work for more than two dimensions, and I couldn't find any function giving a complete set of normal vectors to a given $v$.

For example, I'm looking for a function that, given v={1,0,0}, will give me back {{0,1,0},{0,0,1}}, or some other equivalent set of vectors (that is, I want a basis for the orthogonal space $v^\perp$).

An easy way to do this in 3D is with something like:

normalVecs[v_] := Cross[v, #] & /@ IdentityMatrix@3 // Orthogonalize // Select[Norm@# > 0 &];
normalVecs @ {1, 0, 0}

but using Cross does not generalize to more than 3 dimensions.

What is the best way to do this?

Source Link
glS
  • 7.8k
  • 1
  • 24
  • 64

What is the best way to compute the set of vectors normal to a given one?

For 2D vectors, computing the vector orthogonal to a given $v$ is straightforwardly done using Cross, as for example shown here.

However, Cross does not seem to work for more than two dimensions, and I couldn't find any function giving a complete set of normal vectors to a given $v$.

For example, I'm looking for a function that, given v={1,0,0}, will give me back {{0,1,0},{0,0,1}}, or some other equivalent set of vectors (that is, I want a basis for the orthogonal space $v^\perp$).

An easy way to do this in 3D is with something like:

normalVecs[v_] := Cross[v, #] & /@ IdentityMatrix @ 3 // Orthogonalize // DeleteCases @ {0, 0, 0};
normalVecs @ {1, 0, 0}

but using Cross does not generalize to more than 3 dimensions.

What is the best way to do this?