Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #8134

Re: compile a numerical integral

From psycho_dad <s.nesseris@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: compile a numerical integral
Date 2012-01-25 12:01 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jfoqu4$5o2$1@smc.vnet.net> (permalink)
References <jflvvs$jr4$1@smc.vnet.net>

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

compile a numerical integral Ruth Lazkoz Sáez <ruth.lazkoz@ehu.es> - 2012-01-24 10:09 +0000
  Re: compile a numerical integral psycho_dad <s.nesseris@gmail.com> - 2012-01-25 12:01 +0000
  Re: compile a numerical integral danl@wolfram.com - 2012-01-25 12:03 +0000
  Re: compile a numerical integral "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2012-01-25 12:09 +0000
  Re: compile a numerical integral Gabriel Landi <gtlandi@gmail.com> - 2012-01-26 08:25 +0000

csiph-web