MathGroup Archive 2012

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

Search the Archive

Re: compile a numerical integral

  • To: mathgroup at
  • Subject: [mg124560] Re: compile a numerical integral
  • From: psycho_dad <s.nesseris at>
  • Date: Wed, 25 Jan 2012 07:00:04 -0500 (EST)
  • Delivered-to:
  • References: <jflvvs$jr4$>
  • Reply-to: comp.soft-sys.math.mathematica at

Hi Ruth,
According to the documentation, NIntegrate already uses compile, see

"You should realize that built-in Mathematica functions quite often themselves use Compile. Thus, for example, NIntegrate by default automatically uses Compile on the expression you tell it to integrate."

Actually, you can turn it on by just using Compiled->True, eg (I modified one of the NIntegrate examples in help):

g[x_?NumericQ] := Nest[Sin[# + Sin[2 #]] &, x, 20]
NIntegrate[g[x], {x, 0, 1}, Compiled -> True] // AbsoluteTiming
NIntegrate[g[x], {x, 0, 1}, Compiled -> False] // AbsoluteTiming

I hope it helps.


  • Prev by Date: Re: Infinite Series Error - Bug?
  • Next by Date: NDSolve and DAEs
  • Previous by thread: Re: compile a numerical integral
  • Next by thread: Re: compile a numerical integral