You can also try this
In [ ]: from sympy.simplify.trigsimp import trigsimp_groebner
In [ ]: trigsimp_groebner(sin(x/2)**2, hints=[2])
Out[ ]:
cos(x) 1
- ────── + ─
2 2
In [ ]: trigsimp_groebner(cos(x/2)**2, hints=[2])
Out[ ]:
cos(x) 1
────── + ─
2 2
--
Shekhar
http://s-hacker.info/
On Tuesday, 31 May 2016 03:43:06 UTC+5:30, chaowen guo wrote:
>
> Hi:
>
> My formula has a lot of square of half angle trigonometric functions. We
> all know that sin(x/2)**2=(1-cos(x))/2 and cos(x/2)**2=(1+cos(x))/2. But
> how to do that in sympy? I try trigsimp and expand_trig, both of them are
> not working.
>
> import sympy
> x=sympy.symbols('x',real=True)
> sympy.expand_trig(sympy.cos(x/2)**2)
> sympy.trigsimp(sympy.sin(x/2)**2)
>
> output is the original half angle formula.
>
> Is there any function like trigreduce in maxima? It does such job.
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/260227fc-b59a-4ea7-b4b1-7a46a5610d9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.