Re: compile a numerical integral
- To: mathgroup at smc.vnet.net
- Subject: [mg124560] Re: compile a numerical integral
- From: psycho_dad <s.nesseris at gmail.com>
- Date: Wed, 25 Jan 2012 07:00:04 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <jflvvs$jr4$1@smc.vnet.net>
- Reply-to: comp.soft-sys.math.mathematica at googlegroups.com
Hi Ruth, According to the documentation, NIntegrate already uses compile, see tutorial/CompilingMathematicaExpressions Quoting: "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. Cheers, Savvas