Re: NIntegrate and the number of grid points used
- To: mathgroup at smc.vnet.net
- Subject: [mg72794] Re: NIntegrate and the number of grid points used
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 20 Jan 2007 02:52:34 -0500 (EST)
- References: <eopn5h$rv8$1@smc.vnet.net>
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