Unfortunately, this simplification is not yet implemented in SymPy (though the 
reverse is, see expand(trig=True)).  See 
http://code.google.com/p/sympy/issues/detail?id=1590.

It shouldn't be too hard to implement, though, you just need to implement the 
series expansions given at 
http://en.wikipedia.org/wiki/Trig_identities#Power-reduction_formula.

Actually, there is another way that you can do it, which involves taking 
advantage of the complex exponential form of sine and cosine.  You would do 
something like this:

In [3]: (cos(x)**5).rewrite(exp).expand().rewrite(cos)
Out[3]: 
cos(5⋅x)   5⋅cos(x)   5⋅cos(3⋅x)
──────── + ──────── + ──────────
   16         8           16    


Aaron Meurer

On Nov 19, 2010, at 6:26 AM, Javier wrote:

> Hi all,
> 
> Anyone knows if there is a simple way of doing an expansion of
> sin(x)**p and cos(x)**p as a sum of cos(ix) or sin(ix) in sympy. I
> currently can do it in maple with the combine command but I want to
> use sympy.
> 
> 
> The idea is that for example:
> 
> sin(x)**5 = 1/16 sin(5 x) - 5/16 sin(3 x) + 5/8 sin(x)
> cos(x)**5 = 1/16 cos(5 x) + 5/16 cos(3 x) + 5/8 cos(x)
> 
> Can anyone help me please?
> 
> Thanks in advance
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sympy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to