Re: Try it again, Mathematica! Was: Can't integrate sqrt(a+b*cos(t)+c*cos(2t))

*To*: mathgroup at smc.vnet.net*Subject*: [mg90840] Re: Try it again, Mathematica! Was: Can't integrate sqrt(a+b*cos(t)+c*cos(2t))*From*: "David W.Cantrell" <DWCantrell at sigmaxi.net>*Date*: Sat, 26 Jul 2008 04:19:53 -0400 (EDT)*References*: <g6710s$sb6$1@smc.vnet.net> <g6c959$bpg$1@smc.vnet.net>

Alois Steindl <Alois.Steindl at tuwien.ac.at> wrote: > Hello, > I played around a little bit and found the following interesting > behaviour: > > In[1]:= Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}] > Out[1]:= \!\( > \*SubsuperscriptBox[\(\[Integral]\), \(0\), \(\[Pi]\)]\( > SqrtBox[\(5 - 4\ Cos[t] + Cos[2\ t]\)] \[DifferentialD]t\)\) > > In[2]:= Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}] > Out[2]:= 1/5 Sqrt[ > 2 + 4 I] (-5 I EllipticE[-(3/5) - (4 I)/5] + (2 + I) Sqrt[5] > EllipticE[-(3/5) + (4 I)/5] - (12 - 4 I) EllipticK[-(3/5) - ( > 4 I)/5] + (6 - 2 I) Sqrt[5] EllipticK[8/5 - (4 I)/5] + > 4 I Sqrt[5] > EllipticPi[ > 1/5 + (2 I)/5, -(3/5) + (4 I)/5] + (8 + 4 I) EllipticPi[ > 1 - 2 I, -(3/5) - (4 I)/5]) > > So it seems, it helps to ask Mathematica twice. On my system, one must ask Mathematica _three_ times. (The third time's the charm.) The reason Mathematica eventually succeeded is that it remembered work from its previous attempts. If we had done ClearSystemCache[] between attempts, Mathematica would presumably never have succeeded. Is there a parameter which we can change so that Mathematica succeeds on the first try? David