Re: Trivial integral freezes 3.0
- To: mathgroup at smc.vnet.net
- Subject: [mg9888] Re: Trivial integral freezes 3.0
- From: carlos at mars.Colorado.EDU (Carlos A. Felippa)
- Date: Sun, 30 Nov 1997 00:39:37 -0500
- Organization: University of Colorado, Boulder
- References: <65md10$b56@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
> 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!
>
Actually I submitted your expression to FullSimplify, and after about 10
minutes of a valiant effort Mathematica 3.0 came up with the following:
(6*(1 + (-1)^(2/3))*phi - 6*(I + (-1)^(1/6))*Cos[phi] +
6*(-1 + (-1)^(1/3))^2*Sin[phi])/((1 + (-1)^(2/3))*(3*Sqrt[3] +
8*Pi))
Still a worthless answer. Since (-1)^(m/n) has n complex values the
total number of solutions for a given phi is 3 x 6 x 3 x 3 = 162. For
a definite integral the number of combinations (if one assumes that
phi1 and phi2 could be on any branch pair) is 162^2=26244.
If Full Simplify is not applied, the raw number of value combinations of
the original result is 944784. For a definite integral the
combinations reach 944784^2=8.9261 10^11. At 10 tries per second that
would take 2830 years. No wonder it gets stuck.
This example, although admittedly trivial, shows how useful a
variable-typing scheme, e.g.
Declare[phi,{real,positive}];
would be. Not only it gets rid of the branch morass, but it would allow
full mapping of number-crunching, user-written Modules to C or C++,
which can then be further compiled to machine language. Full
competition with Matlab would then be possible.
- Follow-Ups:
- Re: Re: Trivial integral freezes 3.0
- From: Mark Evans <evans@gte.net>
- Re: Re: Trivial integral freezes 3.0