Skip to content
Advertisement

Sympy calculation on tan function

I have a problem when simplifying a symbolic expression in sympy when having a trigonometric function and a complex exponent, namely I just assumed a different definition of tan function, and I have a weird thing going on. So I do:

JavaScript

Symbolic variable sym.simplify(test2) is equal to -tan(a) and normaly test1 variable should be equal to 0, however when I simplify a test1 variable, I do get:

JavaScript

So the question is what do I get wrong, how to tell Python to simplify a text1 expression in order to get 0 which it naturally should be

Advertisement

Answer

Rewriting in terms of exp then simplifying gives 0

JavaScript
Advertisement