Re: Re: Another Bug in Mathematica 3.0.0 definite integration
- To: mathgroup at smc.vnet.net
- Subject: [mg9311] Re: [mg9254] Re: Another Bug in Mathematica 3.0.0 definite integration
- From: David Withoff <withoff>
- Date: Mon, 27 Oct 1997 02:47:24 -0500
- Sender: owner-wri-mathgroup at wolfram.com
> >> a=Integrate[1/Sqrt[Sin[x]+Cos[x]], {x,0,Pi/2}]
>
> This is a pattern I have observed in many integrals involving
> trigonometric functions that lead to hypergeometric and/or elliptic
> functions. The time comparison of 2.2 vs 3.0 is interesting.
>
> Results from Mathematica 2.2.1 on above test function:
>
> (Pi^(1/2)*Gamma[1/4])/(2*2^(1/4)*Gamma[3/4]) -
> 2*Hypergeometric2F1[1/2, 1, 5/4, -1] + Hypergeometric2F1[3/4, 1, 3/2,
> -1]
>
> 1.397395299268851
>
> Time: 0.95 seconds on Mac 8500/120.
>
> Results from Mathematica 3.0.1, same machine:
>
> -2*2^(3/4)*HypergeometricPFQ[{1/4, 3/4}, {5/4}, -1]
>
> -3.012362296717479
>
> Time: 10.4 seconds, a factor of 10.
>
> Both 3.0 and 3.0.1 give the warning about convergence.
I have not noticed or seen other reports of a pattern of behavior like
this. A slowdown of a factor of 10 is sufficiently atypical that it
should be reported to Wolfram Research so that it can be investigated.
The only pattern that I have noticed is that Version 3.0 can do more
integrals that Version 2.2, and that the integration packages load much
more quickly.
Just to check that I wasn't making this up, I tried a few integrals just
now in Version 2.2 and in Version 3.0 for Windows 95 on my 100 MHz
Pentium computer. The first elliptic integral that I tried finished
about 18 times faster in Version 3.0 than in Version 2.2, and in
Version 3.0 I didn't need to load any separate packages.
The first time through, Version 2.2 gave up on my integral after 27.736
seconds.
In[1]:= Integrate[1/Sqrt[2 + Cos[x] + Sin[x]], {x, 0, Pi}] //Timing
General::intinit: Loading integration packages -- please wait.
1 Out[1]= {27.736 Second,
Integrate[-------------------------, {x, 0, Pi}]}
Sqrt[2 + Cos[x] + Sin[x]]
The second time through it gave up after 1.982 seconds, which suggests
that it took about 25 seconds to load the integration packages. After
loading the separate Calculus`EllipticIntegrate` package (which took
28.028 seconds) Version 2.2 gave me a correct result in terms of
elliptic integrals in 29.507 seconds.
In Version 3.0 I got a correct result in 3.9 seconds the first time
through, and 1.59 seconds the second time, which suggests that it took
about 2.3 seconds (instead of 25+28 seconds) to load all of the
necessary packages automatically, and that the integral itself takes
1.59 seconds in Version 3.0, about 18 times faster than the 29.507
seconds that I found in Version 2.2.
I also tried some simpler integrals -- just the first trigonometric
integrals that popped into my head and that I guessed that Version 2.2
would be able to do. In Version 2.2 these integrals finished in 12.77
seconds:
In[5]:= Timing[{
Integrate[1/(1 + Sin[b x]), x],
Integrate[Sin[3 a x] + Cos[b x], {x, x1, x2}],
Integrate[Sin[x]^3, {x, 0, Pi}],
Integrate[1/Sin[c x], {x, a, b}],
Integrate[x^3 Sin[x]^2 Cos[x], {x, 1, 2}],
Integrate[Sqrt[x] Sin[x], x]}][[1]]
Out[5]= 12.77 Second
The same integrals took 6.92 seconds in Version 3.0, almost twice as
fast as in Version 2.2.
A speedup of a factor of 18, as in my example, is unusual, but a
slowdown of a factor of 10 is also unusual. Any significant slowdown
like this should be reported to Wolfram Research.
Dave Withoff
Wolfram Research