Re: Re: Trigonometric simplification

*To*: mathgroup at smc.vnet.net*Subject*: [mg68939] Re: [mg68921] Re: Trigonometric simplification*From*: "Carl K. Woll" <carlw at wolfram.com>*Date*: Fri, 25 Aug 2006 05:34:51 -0400 (EDT)*References*: <ecbnnc$r29$1@smc.vnet.net><ecek3f$qpu$1@smc.vnet.net> <200608231115.HAA25039@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

carlos at colorado.edu wrote: > Here is a correction to my second post (Thanks to Paul Abbott for > noticing the factor of 2). The reason I need to get 2 + 4*Cos(a)^3 > is to match a published solution in a homework solutions manual. > A while back Maxim gave a nice method to convert Cos[n a] into Cos[a]^_.: d = 2 + 3*Cos[a] + Cos[3*a] First, replace a with ArcCos[x] and use TrigExpand: In[5]:= TrigExpand[d /. a -> ArcCos[x]] Out[5]= 4 x^3 + 2 Then, replace x with Cos[a]. All together we have: In[6]:= TrigExpand[d /. a -> ArcCos[x]] /. x -> Cos[a] Out[6]= 4 (Cos[a])^3 + 2 Carl Woll Wolfram Research > ===================================================== > > Thanks, that works perfectly. Actually Sec[a]>0 as assumption > is sufficient. This is correct from the problem source, since > the angle is in the range (-Pi/2,Pi/2) > > Here is a related question. How can I get Mathematica to pass from > > d = 2 + 3*Cos[a] + Cos[3*a] (* leaf count 10 *) > > to > > 2 + 4*Cos[a]^3 (* leaf count 8 *) > > TrigExpand[d] gives > > 2 + 3*Cos[a] + Cos[a]^3 - 3*Cos[a]*Sin[a]^2 > > Applying Simplify to that yields 2 + 3*Cos[a] + Cos[3*a] so we are > back to the beggining. > > ====================================================== > > Paul Abbott's solution, sent directly by email, is elaborate: > > f[d_] := 10*Plus @@ Cases[{d}, Cos[n_ x_] | Sin[n_ x_] -> n, Infinity] > +LeafCount[d] > > FullSimplify[d, ComplexityFunction -> f] > > 4*Cos[a]^3 + 2 > > Is there a simpler way?

**References**:**Re: Trigonometric simplification***From:*carlos@colorado.edu