MathGroup Archive 2010

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

Search the Archive

Sort of nested NIntegrate

  • To: mathgroup at
  • Subject: [mg107176] Sort of nested NIntegrate
  • From: "g.resta at" <g.resta at>
  • Date: Fri, 5 Feb 2010 03:19:04 -0500 (EST)

I have the following little problem with a function defined by means of NIntegrate.
My function is much more complicated, but the following example suffices.

Suppose I've defined a function in this way

fu[x_] := NIntegrate[ Cos[ x * Sin[t] ],  {t, 0, 1}];

Mathematica can easily compute numerically and plot the function fu.

Now, I want to use the function fu in another NIntegrate, say

NIntegrate[ fu[x]^2, {x,0,2}]

I hoped that was innocuous (maybe slow, since each point of fu require
automatic quadrature) but I got instead this error:
NIntegrate::inumr: The integrand Cos[x Sin[t]] has evaluated to non-
numerical values for all sampling points in the region with boundaries

I also got a number which looks like the right value, but I'm afraid
to trust it because
I do not fully understand the error message. It seems like Mathematica
is trying to do
something symbolic with the guts of fu, even if fu is defined by means
of NIntegrate.
But I'm probably wrong.

Surely I'm missing something. Can anybody show me the light?
(that is, the right way to perform similar computations, maybe the
right option to pass along?)

thank you very much,

  • Prev by Date: Re: DeleteDuplicates is too slow?
  • Next by Date: Re: Bug? Analytical integration of cosines gets the sign wrong
  • Previous by thread: Re: Re: Follow up to mg106646 - Selecting a range of
  • Next by thread: Re: Sort of nested NIntegrate