Neither Mathematica 6 nor anyone here can integrate this:
In[1]:= Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]
Out[1]= Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]
In[2]:= NIntegrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]
Out[2]= 6.72288
I know the exact result:
In[3]:= (1/5^(3/4))*(Sqrt[2]*(10*EllipticE[(1/10)*(5 - Sqrt[5])] -
10*EllipticK[(1/10)*(5 - Sqrt[5])] + (5 + 3*Sqrt[5])*
EllipticPi[(1/10)*(5 - 3*Sqrt[5]), (1/10)*(5 - Sqrt[5])]))//N
Out[3]= 6.72288
but I would like to prove it.
Thanks in advance to the samaritan experts...
V.Astanoff
I am wondering, why the Simplify helps, because
Simplify[Sqrt[5 - 4*Cos[t] + Cos[2*t]]]
just returns
Sqrt[5 - 4 Cos[t] + Cos[2 t]].
Best wishes
Alois
--
Alois Steindl, Tel.: +43 (1) 58801 / 32558
Inst. for Mechanics and Mechatronics Fax.: +43 (1) 58801 / 32598
Vienna University of Technology, A-1040 Wiedner Hauptstr. 8-10
Or even beter
eq = Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi/2}] +
Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, Pi/2, Pi}];
FullSimplify[eq]
Out:
(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]))/
5
In[]=N@%
Out:
6.72288+ 1.05693*10^-14* I
Moreover, you can replace Cos[2t]->Cos[t]^2-Sin[t]^2
so
Integrate[
Sqrt[5 - 4*Cos[t] + Cos[2*t]] /. Cos[2 t] -> Cos[t]^2 - Sin[t]^2, {t,
0, Pi}];
gives result as above
6.72288+ 8.76799*10^-15 I
And the last solution is may be the best one:
Integrate[ TrigExpand/@Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t,0, Pi}];
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])
which evaluates to your numerical answer below,
Actually, we can use Mathematica 6 to integrate that.
In[9]:= indef = Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], t]
Out[9]= ((2/5 + (4*I)/5)*Sqrt[5 - 4*Cos[t] + Cos[2*t]]*((2 + I)*Sqrt[1 -
2*I]* EllipticE[I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]], -(3/5) + (4*I)/5]*(1 +
Tan[t/2]^2)*Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*Sqrt[1 + (1 + 2*I)*Tan[t/2]^2] -
I*((6 - 2*I)*Sqrt[1 - 2*I]*EllipticF[I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]],
-(3/5) + (4*I)/5]*(1 + Tan[t/2]^2)*Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*Sqrt[1 +
(1 + 2*I)*Tan[t/2]^2] - 4*Sqrt[1 - 2*I]*EllipticPi[1/5 + (2*I)/5,
I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]], -(3/5) + (4*I)/5]*(1 +
Tan[t/2]^2)*Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*Sqrt[1 + (1 + 2*I)*Tan[t/2]^2] +
(2 + I)*(Tan[t/2] + 2*Tan[t/2]^3 + 5*Tan[t/2]^5))))/((1 + Cos[t])*Sqrt[(5 -
4*Cos[t] + Cos[2*t])/(1 + Cos[t])^2]*(1 + Tan[t/2]^2)*Sqrt[2 + 4*Tan[t/2]^2
+ 10*Tan[t/2]^4])
In[10]:= FullSimplify[
Limit[indef, t -> Pi, Direction -> 1] - (indef /. t -> 0)]
Out[10]= (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])
In[11]:= N[%]
Out[11]= 6.722879723440325 + 1.0534455252564358*^-14*I
Of course I readily agree that Out[10] is not as nice in appearance as your
In[3] below. (Nobody who works much with Mathematica and elliptic integrals
would be surprised by that.) Nonetheless, Out[10] is a correct answer.
Best regards,
David W. Cantrell
Hello.
You can try to take indefinite integral:
eq=Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], t]
Here Mathematica gives you an answer:
((2/5 + (4*I)/5)*Cos[t/2]^4*((2 + I)*Sqrt[1 - 2*I]*
EllipticE[I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]], -3/5 + (4*I)/5]*
Sec[t/2]^2*Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*
Sqrt[1 + (1 + 2*I)*Tan[t/2]^2] -
I*((6 - 2*I)*Sqrt[1 - 2*I]*EllipticF[
I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]], -3/5 + (4*I)/5]*Sec[t/2]^2*
Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*Sqrt[1 + (1 + 2*I)*Tan[t/2]^2] -
4*Sqrt[1 - 2*I]*EllipticPi[1/5 + (2*I)/5,
I*ArcSinh[Sqrt[1 - 2*I]*Tan[t/2]], -3/5 + (4*I)/5]*Sec[t/2]^2*
Sqrt[1 + (1 - 2*I)*Tan[t/2]^2]*Sqrt[1 + (1 + 2*I)*Tan[t/2]^2] +
(2 + I)*(Tan[t/2] + 2*Tan[t/2]^3 + 5*Tan[t/2]^5))))/
Sqrt[5 - 4*Cos[t] + Cos[2*t]]
Then find Limits:
Limit[eq, t ->0]
gives 0,
Limit[eq, t -> Pi]
gives
(2/5 + I/5)*Sqrt[2/5 + (4*I)/5]*
((1 + 2*I)*Sqrt[5]*EllipticE[-3/5 - (4*I)/5] -
5*EllipticE[-3/5 + (4*I)/5] + (4 - 4*I)*Sqrt[5]*
EllipticK[-3/5 - (4*I)/5] - (10 - 10*I)*EllipticK[8/5 - (4*I)/5] -
(4 + 8*I)*EllipticPi[1/5 + (2*I)/5, -3/5 + (4*I)/5] -
4*Sqrt[5]*EllipticPi[1 - 2*I, -3/5 - (4*I)/5])
so, the result is
N@%
-6.72287972344033 - 9.947771772989*^-15*I
The problem only with the sign of result.
You can use the TrigExpand[] function for the Cos[2t] to get the
equivalent Cos[t]^2 - Sin[t]^2, and if you do this Mathematica 6.0.3
on a Mac comes up with
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])
The equivalence to your expression is left up to you...but this does
evaluate numerically to the same as what you had.
-Bob
expr = 5 - 4*Cos[t] + Cos[2*t] // TrigExpand
Integrate[Sqrt[expr], {t, 0, Pi}]
??
Regards
Jens
Thank you, David (along with Alois, Kevin & Grischka)
for your advice and suggestions.
Though I still wonder why
(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])
doesn't fullsimplifies to
(1/5^(3/4))*(Sqrt[2]*(10*EllipticE[(1/10)*(5-Sqrt[5])]-
10*EllipticK[(1/10)*(5-Sqrt[5])]+(5+3*Sqrt[5])*
EllipticPi[(1/10)*(5-3*Sqrt[5]),(1/10)*(5-Sqrt[5])]))
(I have to say I'm not very familiar with the Elliptics!)
Thanks anyway
Valeri
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.
Best wishes,
Alois
*** my email ***
I have enclosed a nb with a strange integration problem that Alois
Steindl and I have been looking at. As you will see, the first time I
execute the integral, it returns the input after a long time, i.e. no
answer. The second time I evaluate the same integral it again takes a
long time, but then returns an answer. The third time it returns the
same answer as the second, but it is nearly instantaneous. What's going on?
*** response ***
Information is being cached and there are time limits on internal functions
like Simplify which prevent getting an answer on the first try, giving an
answer on the second try and almost nothing happening on the third try.
Here are the timings of these on my Windows:
In[1]:= Timing[Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]]
Out[1]= {62.187,
Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]}
In[2]:= Timing[Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]]
Out[2]= {9.610000000000003, (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])}
In[3]:= Timing[Integrate[Sqrt[5 - 4*Cos[t] + Cos[2*t]], {t, 0, Pi}]]
Out[3]= {0.5460000000000036, (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])}
After working on this issue, I thought that it would be nicer if we had a
warning message generated after the first trial. I have forwarded your
examples to our development group and I filed a suggestion report about
having such a message.
We apologize for any inconvenience caused by this issue.
Sincerely,
Zubeyir Cinkir
Technical Support
Wolfram Research, Inc.
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