user9730851
user9730851

Reputation: 86

Sympy does not simplify sine eulers formula

Why does it not simplify to zero? Cosine seems to work. Why?

from sympy import *

 x = Symbol("x")
expr = (1/(2*I)) * (E**(I*x) - E**(-I*x))
print(simplify(expr - sin(x)))

Upvotes: 3

Views: 219

Answers (1)

llf
llf

Reputation: 630

Sympy's simplification routines are necessarily heuristic, so you'll have to give them some hints. In this case, you can tell sympy to rewrite everything in terms of exponentials:

simplify((expr - sin(x)).rewrite(exp)) # 0

Upvotes: 3

Related Questions