MathGroup Archive 2007

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

Search the Archive

Re: NIntegrate and the number of grid points used


Thomas Schmelzer schrieb:
> Hoi zame,
> 
> I am using NIntegrate to run a few experiments. I wonder whether there is a 
> possibility to get access to the number of points used by Mathematica? That 
> would be helpful.
> 
> Thomas
> 
> 

Hi Thomas,

NIntegrateWithCount[exp_, rg_, opt___] :=
  Module[{cnt = 0},
    {NIntegrate[exp, rg, EvaluationMonitor :> cnt++, opt], cnt}];

NIntegrateWithCount[Sin[x]/(Pi - x), {x, 0, Pi}]
--> {1.8519370519824667, 11}

NIntegrateWithCount[Sin[x]/(Pi - x), {x, 0, Pi}, WorkingPrecision -> 32]
--> {1.8519370519824661703611, 21}

see http://documents.wolfram.com/mathematica/book/section-3.9.10 or read this
chapter in Mathematica's help browser.


Peter


  • Prev by Date: Re: text equation
  • Next by Date: Re: Re: Re: Re: Re: Limit and Root Objects
  • Previous by thread: Re: NIntegrate and the number of grid points used
  • Next by thread: Re: NIntegrate and the number of grid points used