Ferdinando Randisi Ferdinando Randisi - 10 months ago 60
Python Question

How can I compute the inverse cross product of a vector in numpy?

How can I perform the inverse cross product in numpy?

That is, given two numpy arrays

, how can I find
such that

a.cross(b) == c

EDIT: Could whoever downvoted please let me know what they didn't like it, so that I can learn from their opinion? I asked the question because I didn't easily find an answer anywhere. Turns out the question is mathematically ill-defined (as people pointed out), but from now on if people look it up here this answer will show up and they'll know that quickly and easily.

Answer Source

There only exists a solution if a and c are orthogonal, and the solution is not unique.

Then, a = np.cross(b,c)/np.dot(b,b)+t*b is a solution for all t.

See this question on Math SE: http://math.stackexchange.com/questions/32600/whats-the-opposite-of-a-cross-product