MathGroup Archive 2011

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

Search the Archive

SymbolicProcessing and NIntegrate

For my research I often need to evaluate numerical integrals as a
function of an external parameter, for example like

a) int[y_] := NIntegrate[ f[x,y] ,  {x, domain} ].

The question I have is about the 'option' symbolic processing in
NIntegrate.  When i compare

b) Do[NIntegrate[Boole[x > 0], {x, -1, 1}] , {i, 1, 100}] // Timing


c) Do[NIntegrate[Boole[x > 0], {x, -1, 1}, Method -> {Automatic,
"SymbolicProcessing" -> 0}], {i, 1, 100}] // Timing,

I find that b) is much slower than c), which indicates that in this case
Mathematica does not reuse the result of SymbolicProcessing from a previous
integral for the next integral. For each integral in the Do loop, Mathematica
goes through the same "SymbolicProcessing".

My question is whether there is a way to let Mathematica perform the
"SymbolicProcessing" on a function, before giving it to NIntegrate. It would
help me a lot if i am able to perform a single "SymbolicProcessing" of the
integrand f(x,y) in a) and then use that result to perform the integral for
different y values without needing to do the SymbolicProcessing for each y-
value separately.

If you have other suggestions for "my problem" i would of course be very
happy to hear those.

Thanks on beforehand,
Kind regards,
Martijn Mink
PhD-student in Physics
The Netherlands

  • Prev by Date: Re: DiagonalizableQ
  • Next by Date: Re: Plot function with two arguments
  • Previous by thread: Help with manipulate and 3D plotting
  • Next by thread: How to create this kind of list