Reputation: 4388
How can I perform the inverse cross product in numpy?
That is, given two numpy arrays b
and c
, how can I find a
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.
Upvotes: 3
Views: 2151
Reputation: 75
There is no function native to numpy that will arrive at the solution you're looking for. You may have better luck asking the question here.
There seems to be a problem with the question as well. From what I know of linear algebra, solving for 'a' wouldn't yield a unique solution unless certain conditions are met.
See this answer over at the math stack exchange for more information.
Upvotes: 1
Reputation: 751
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: https://math.stackexchange.com/questions/32600/whats-the-opposite-of-a-cross-product
Upvotes: 3