To start with I cannot give a simple example using only sympy. I have only been able to generate this failure using my modules. Below is code and output showing as simple an example as I can generate with some diagnostics. If you could suggest any other diagnostics I would appreciate it.
The problem is that an expressing that should evaluation to zero does not even thought by inspecting the output it should. Demonstration code: from sympy import symbols, sin, cos, simplify, srepr from ga import Ga from mv import Mv from metric import linear_expand from printer import Format xy = symbols('x y',real=True) x = symbols('x',real=True) o2d = Ga('e_x e_y',g=[1,1],coords=xy) o1d = Ga('e',g=[1],coords=[x]) grad2d = o2d.grad grad1d = o1d.grad A = o1d.mv('A','mv',f=True) B = o1d.mv('B','mv',f=True) print(r'\bs{A}=',A) print(r'\bs{B}=',B) print(r'\bs{AB}=',A*B) diff = grad1d*(A*B) - (grad1d*A)*B -(grad1d.odot()*A)*B.odot() print(diff) E = linear_expand(diff.obj) scalar =E[0][0] vector =E[0][1] print('scalar =',simplify(E[0][0])) print('vector =',simplify(E[0][1])) print('srepr =',srepr(scalar)) args = scalar.args print('args =',args) print(simplify(args[1]+args[3])) print(type(args[1])) print(type(args[3])) print(args[1].args) print(args[3].args) Both scalar and vector should be zero. Note that if I use sympy 1.2 zero is output. Output follows: \bs{A}= A+A__x*e_x \bs{B}= B+B__x*e_x \bs{AB}= A*B + A__x*B__x+(A*B__x + A__x*B)*e_x -A*Derivative(B__x, x) + A*Derivative(B__x, x) + A__x*Derivative(B, x) - A__x*Derivative(B, x)+(A*Derivative(B, x) - A*Derivative(B, x) - A__x*Derivative(B__x, x) + A__x*Derivative(B__x, x))*e_x scalar = -A*Derivative(B__x, x) + A*Derivative(B__x, x) + A__x*Derivative(B, x) - A__x*Derivative(B, x) vector = A*Derivative(B, x) - A*Derivative(B, x) - A__x*Derivative(B__x, x) + A__x*Derivative(B__x, x) srepr = Add(Mul(Integer(-1), Function('A')(Symbol('x', real=True)), Derivative(Function('B__x')(Symbol('x', real=True)), Tuple(Symbol('x', real=True), Integer(1)))), Mul(Function('A')(Symbol('x', real=True)), Derivative(Function('B__x')(Symbol('x', real=True)), Tuple(Symbol('x', real=True), Integer(1)))), Mul(Function('A__x')(Symbol('x', real=True)), Derivative(Function('B')(Symbol('x', real=True)), Tuple(Symbol('x', real=True), Integer(1)))), Mul(Integer(-1), Function('A__x')(Symbol('x', real=True)), Derivative(Function('B')(Symbol('x', real=True)), Tuple(Symbol('x', real=True), Integer(1))))) args = (A__x(x)*Derivative(B(x), x), A(x)*Derivative(B__x(x), x), -A__x(x)*Derivative(B(x), x), -A(x)*Derivative(B__x(x), x)) (-Derivative(B__x, x) + Derivative(B__x, x))*A <class 'sympy.core.mul.Mul'> <class 'sympy.core.mul.Mul'> (Derivative(B__x(x), x), A(x)) (-1, Derivative(B__x(x), x), A(x)) -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b61e03d3-9765-4687-98c4-3851791951df%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.