baxx
baxx

Reputation: 4705

Trigonometric identities with Python and Sympy, tan(A/2) = (sin A )/(1 + cos A)

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

Answers (1)

Stelios
Stelios

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

Related Questions