       Re: Re: Expanding powers of cosine

```Of course not.   It has to be an even power of Cos as the poster
wrote. This is obvious from the meaning of GroebnerBasis.

Andrzej Kozlowski

On 14 Dec 2007, at 04:49, Januk wrote:

> Be warned that this method isn't bullet-proof:
>
> f = Cos[x]^3;
> sf = First[GroebnerBasis[{f, 1 - Cos[x]^2 - Sin[x]^2}, {Sin[x]},
> {Cos[x]}]];
> FullSimplify[ sf / f ]
>
> Gives:
> Cos[x]
>
>
> On Dec 13, 1:29 am, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
>> On 13 Dec 2007, at 10:02, michael.p.crouc... at googlemail.com wrote:
>>
>>
>>
>>
>>
>>> Hi
>>
>>> I would like to express even powers of Cos[x] in terms of powers of
>>> Sin[x] using the identity Sin[x]^2+Cos[x]^2 = 1.  For example
>>
>>> Cos[x]^4 = 1 - 2 Sin[x]^2 + Sin[x]^4
>>
>>> I could not get any of Mathematica's built in functions to do this
>>> for
>>> me so I created my own rule:
>>
>>> expandCosn[z_] := Module[{s, res},
>>> s = Cos[x]^n_ :> (1 - Sin[x]^2) Cos[x]^(n - 2) ;
>>> res = z //. s;
>>> Expand[res]
>>> ]
>>
>>> which works fine:
>>
>>> In:= expandCosn[Cos[x]^4]
>>
>>> Out= 1 - 2 Sin[x]^2 + Sin[x]^4
>>
>>> My question is - have I missed something?  Is there an easier way to
>>> do this?
>>
>>> Cheers,
>>> Mike
>>
>> Here is one way. This is how to expand Cos[x]^24:
>>
>> First[GroebnerBasis[{Cos[x]^24, 1 - Cos[x]^2 - Sin[x]^2}, {Sin[x]},
>>      {Cos[x]}]]
>>
>>  Sin[x]^24 - 12*Sin[x]^22 + 66*Sin[x]^20 -
>>    220*Sin[x]^18 + 495*Sin[x]^16 - 792*Sin[x]^14 +
>>    924*Sin[x]^12 - 792*Sin[x]^10 + 495*Sin[x]^8 -
>>    220*Sin[x]^6 + 66*Sin[x]^4 - 12*Sin[x]^2 + 1
>>
>> Andrzej Kozlowski- Hide quoted text -
>>
>> - Show quoted text -
>

```

• Prev by Date: Re: Re: Expanding powers of cosine
• Next by Date: Re: Joining two Tables or something like that.
• Previous by thread: Re: Expanding powers of cosine
• Next by thread: Re: Expanding powers of cosine