1

I just have a quick question. I'm trying to see if I can get Python to verify some vector identities for me. So I tried it on the BAC-CAB identity like this

from sympy import *
a1, a2, a3 = symbols('a1 a2 a3')
b1, b2, b3 = symbols('b1 b2 b3')
c1, c2, c3 = symbols('c1 c2 c3')
a = Matrix([a1,a2,a3])
b = Matrix([b1,b2,b3])
c = Matrix([c1,c2,c3])
print(a.cross(b.cross(c)) == (a.dot(c))*b - (a.dot(b))*c)

It's giving me False. When I look at the components of a.cross(b.cross(c)) and (a.dot(c))*b - (a.dot(b))*c they appear to be the same other than that (a.dot(c))*b - (a.dot(b))*c isn't cancelling two of the terms in each component.

Why is it doing this and how can I fix my code so that Python will verify this identity (and others)?

got it--thanks
  • 233
  • 2
  • 9
  • 1
    `print(simplify(a.cross(b.cross(c)) - ((a.dot(c))*b - (a.dot(b))*c)))` gives `Matrix([ [0], [0], [0]])` – f5r5e5d Mar 20 '17 at 22:11

0 Answers0