Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

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


  • 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