Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8153
| From | "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: compile a numerical integral |
| Date | 2012-01-25 12:09 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jfordg$616$1@smc.vnet.net> (permalink) |
| References | <jflvvs$jr4$1@smc.vnet.net> |
On Tue, 24 Jan 2012 10:09:00 -0000, Ruth Lazkoz S=E1ez <ruth.lazkoz@ehu.es>
wrote:
> Hi wise people,
>
> I am working to make a code faster using compile and failed at the very
> beginning.
> Is there a way to make a version that works?
>
> f=Compile[{u},NIntegrate[x*u,{x,0.,#}]&/@{1,2,3}]
>
> Best,
>
> Ruth Lazkoz
>
Sorry to disappoint, but no. NIntegrate cannot be compiled and, even if it
could, it wouldn't provide any meaningful performance improvement
(although sometimes the integrand can be compiled; if this is likely to be
beneficial it will be done automatically, but you can try it manually
using the option Compiled->True). However, one can often benefit by
changing the Method option appropriately (see
tutorial/NIntegrateIntegrationRules), although this can be quite involved
and is obviously not a panacea. It is worth persisting, however: in an
example from my own work, optimizing the Method yielded a fourfold
reduction in calculation time versus the default setting when evaluating
some complicated projection integrals, and I was only able to improve on
this slightly (by another 40% or so) by pre-calculating the integration
bounds analytically for special cases of the integrand instead of letting
NIntegrate find the bounds itself.
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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