Reputation: 86
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
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