Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sympy does not simplify sine eulers formula

Tags:

sympy

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)))
like image 622
user9730851 Avatar asked Dec 20 '25 09:12

user9730851


1 Answers

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
like image 170
llf Avatar answered Dec 22 '25 07:12

llf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!