On Saturday, March 28, 2015 at 2:01:38 AM UTC+2, Jeremy Holleman wrote:
>
> I just mean that if I'm trying to write a script and I want to reduce all 
> of the powers of cos or sin, I'm not sure how I would code that, because I 
> can't tell if there's a pattern of which calls need to be made in which 
> order to reduce an arbitrary polynomial of trig functions.  For my present 
> purpose, I'm doing the analysis interactively, so a little trial-and-error 
> is fine.  For future projects I'm trying to get a clearer understanding of 
> how these functions work.  So for example, why does TR7(cos(x)**7) just 
> return cos(x)**7?
>

It seems that fu does not deal with higher powers of cos and sin, but if 
you are writing a script, you could easily
derive a general formula to reduce the powers.

For example, if you start with Euler's formula

     cos(x) = (exp(I*x) + exp(-I*x))/2

and use the binomial formula to obtain

     cos(x)**n = (exp(I*n*x) + C(n, 1)*exp(I*(n-2)*x) + C(n, 
2)*exp(I*(n-4)*x) + ,,, + exp(-I*n*x)) / 2**n ,

then using  C(n, n-k) = C(n, k) you get

     cos(x)**n = (cos(n*x) + C(n, 1)*cos((n-2)*x) + ...) / 2**(n - 1) .

(If n is even, the last term in the parentheses is  C(n, n/2)/2.)

 Kalevi Suominen

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/87bd2ff5-3522-496f-8b07-a75f74002a09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to