Reputation: 4705
I'm not sure how to get Sympy to perform / simplify these types of identities?
It does things like sin(a + b)
, but doesn't seem to do others (like the one in the title)
Upvotes: 2
Views: 791
Reputation: 5521
One approach is to try various combinations of simplification functions/methods such as rewrite
and simplify
. For example, the following gives the result you want:
import sympy as sp
x = sp.var('x', real = True)
f = sp.tan(x/2)
sp.re(f.rewrite(sp.exp).simplify().rewrite(sp.sin)).simplify()
sin(x)/(cos(x) + 1)
Upvotes: 2