MathGroup Archive 2007

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

Search the Archive

Re: poor efficiency of Numerical Integration at 5.2.0 ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74096] Re: poor efficiency of Numerical Integration at 5.2.0 ?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 10 Mar 2007 06:47:24 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <esr118$6lk$1@smc.vnet.net>

shadowfox wrote:
> My system is Mandriva 2007 on K7 sempron 2500+ and I has ram about
> 512MB.
> 
> 1.
> http://amd.streamload.com/sombrazorro/Hosted/z_Ds_tau_test.nb
> 
> When calculating ZmDsTau[1000,1.7] and plotting ZmDsTau[en,1.7] in
> z_Ds_tau_test.nb, it took 138 secs and 2.3 hrs on 5.2 respectly.
> But in 5.0.0 it took only abot 1.5 secs and 73 secs.

Using your notebook as is, I get similar results on my system (note that 
I aborted the plot after 15 minutes).

$Version
--> 5.2 for Microsoft Windows (June 20, 2005)

Timing[ZmDsTau[1000,1.7]]
--> {126.61 Second, 0.0122892}

However, adding the test ?NumericQ to every arguments of every 
functions, so one gets ride of the warning message about "... is not 
numeric at..." and Mathematica is not wasting its time anymore calling 
functions with the wrong arguments, the program yields results in a 
reasonable amount of time:

Timing[ZmDsTau[1000, 1.7]]
--> {0.34400000000000003*Second, 0.012289213054600056}

Timing[Plot[ZmDsTau[en, \[Gamma]], {en, 100, 10^8}]]
--> { 22.531000000000002`Second, - Graphics -}

The following FAQ is a must read: "How do I write a function which 
evaluates only when the argument is a number?", available at 
http://support.wolfram.com/mathematica/kernel/features/evalwhennumber.html


> 2.
> http://amd.streamload.com/sombrazorro/Hosted/testbug.nb
> At version 5.2.0, it caused memory leakage   (needed about 500 MB and
> above) and I can not got /sigma[1].
> Finally, process manager killed the process.
> Then I got /sigma[1] in 1 secs at Version 5.0.0 .

Same remedy here: after correction, I get,

Timing[\[Sigma][1]]

  NIntegrate::"slwcon" : "Numerical integration converging too slowly; 
suspect one of the following: singularity, value of the integration 
being 0, oscillatory integrand, or insufficient WorkingPrecision. If 
your integrand is oscillatory try using the option Method->Oscillatory 
in NIntegrate.

  NIntegrate::"ncvb" : "NIntegrate failed to converge to prescribed 
accuracy after (7) recursive bisections in (y) near (y) = 
0.21788439698124265.

--> {3.7190000000000003*Second, 4.079280336357832*^-29}

Regards,
Jean-Marc


  • Prev by Date: Re: Evaluate a spline function
  • Next by Date: Re: Precision available with NIntegrate {Method -> Oscillatory}
  • Previous by thread: poor efficiency of Numerical Integration at 5.2.0 ?
  • Next by thread: EquationTrekker with long equations