MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Strange timing behavior of Integrate[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg8341] Strange timing behavior of Integrate[]
  • From: carlos at mars.Colorado.EDU (Carlos A. Felippa)
  • Date: Tue, 26 Aug 1997 02:22:34 -0400
  • Organization: University of Colorado, Boulder
  • Sender: owner-wri-mathgroup at wolfram.com

 I am doing an acoustic radiation study with Mma 3.0 in which I have to
 evaluate thousands of trigonometric integrals of the form sin[phi]^m*cos[phi]^n
 over 0->2 Pi for a wide range of integers m and n.  I noticed that some
 combinations took enormous times to evaluate forcing aborts.

 I traced it to the phenomenon exemplified by the equivalent commands

 Print [Integrate[(a+b)^12*Cos[phi]^8*Sin[phi]^8,{phi,0,2*Pi}]//Timing];
 Print [(a+b)^12*Integrate[Cos[phi]^8*Sin[phi]^8,{phi,0,2*Pi}]//Timing];

 The result is obviously the same.  However, On a Mac 8500/120,
 the first form takes 4.85 seconds while the second completes in 0.53 Seconds.
 For more complex factors the time ratio may reach into the thousands.

 What is going on?  It seems as if Integrate[] cannot identify invariant
 expressions.




  • Prev by Date: Re: NonlinearFit and NonlinearRegression
  • Next by Date: Re: Simplifying Sqrt[a^2*d^2] -> a*d
  • Previous by thread: Setting a prettier table
  • Next by thread: Re: Strange timing behavior of Integrate[]