Re: Trivial integral freezes 3.0
- To: mathgroup at smc.vnet.net
- Subject: [mg9855] Re: Trivial integral freezes 3.0
- From: Bill Bertram <wkb at ansto.gov.au>
- Date: Fri, 28 Nov 1997 05:36:10 -0500
- Organization: ANSTO
- Sender: owner-wri-mathgroup at wolfram.com
Carlos A. Felippa wrote:
>
> The following trivial Integrate statement (from a class example) appears
> to freeze Mathematica 3.0 running under Mac OS 7.5.5.
>
> ClearAll[alpha,phi]; alpha=Pi/3;
> q=(Cos[alpha]-Cos[alpha+phi])/(-alpha+Pi+Cos[alpha]*Sin[alpha]);
> Print["q=",q//InputForm];
> r1=Integrate[q,{phi,0,2*Pi-2*alpha}]; Print["r1=",r1//InputForm];
>
> Same freeze happens for other values of alpha, e.g alpha=Pi/6.
> Mathematica 2.2 has no problems.
>
> I am curious as to whether the freeze happens on non-Mac versions.
It also takes a very long (Infinite ??) time on my PP200 but
replacing Integrate by NIntegrate gives the answer instantaneously.
Of course the problem is that when you ask for "Integrate[",
Mathematica attempts do do the integration analytically. So find
out what it comes up with for indefinite inegral
Integrate[q,phi]
The result is not pretty, after "Simplify"ing the result it looks like
this,
(6*(-(-1)^(1/3)*phi + (I + (-1)^(1/6) + phi + (-1)^(2/3)*phi)*
Cos[phi] - (I + (-1)^(1/6))*Cos[2*phi] + Sin[phi] +
(-1)^(2/3)*Sin[phi] - I*phi*Sin[phi] -
(-1)^(1/6)*phi*Sin[phi] + Sin[2*phi] +
(-1)^(2/3)*Sin[2*phi]))/
((3*Sqrt[3] + 8*Pi)*(-(-1)^(1/3) + (1 + (-1)^(2/3))*Cos[phi] -
(I + (-1)^(1/6))*Sin[phi]))
I don't know how it manages to get all those (-1)^x and complex
expressions but undoubtedly it should simplify to something
much simpler. I guess the evaluation of this is where
Mathematica gets stuck!
See if you can make sense of this:
Integrate[(Cos[a]-Cos[a+x]),x] yields
x Cos[a]-Sin[a+x]
but
a=Pi/3;
Integrate[(Cos[a]-Cos[a+x]),x] gives
1/2*(x - (-1)^(1/6)*Cos[x] + (-1)^(5/6)*Cos[x] -
(-1)^(1/3)*Sin[x] + (-1)^(2/3)*Sin[x])
Cheers,
Bill