Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Numerical integration inside numerical integration

  • To: mathgroup at
  • Subject: [mg48824] Re: [mg48811] Numerical integration inside numerical integration
  • From: Andrzej Kozlowski <akoz at>
  • Date: Fri, 18 Jun 2004 02:12:46 -0400 (EDT)
  • References: <>
  • Sender: owner-wri-mathgroup at

On 17 Jun 2004, at 17:07, blah12 at wrote:

> Hello all,
> I'm trying to solve numerically an integral like,
> A=some_value
> NIntegrate[f[y,u]*Log[1+NIntegrate[g[y,u,s], {s, A, \[Infinity]}]],
>     {u, -\[Infinity],\[Infinity]},{y, -\[Infinity],\[Infinity]}]
> I know I am doing this wrong as the inner integration fails because
> it doesn't have specific numerical values for y and u.
> I guess Mathematica doesn't perform numerical integrations from the
> outside to the inside (and so passing each time values of y,u to
> the inner integration).
> How can this problem be solved with Mathematica please ?
> Thanks.
Just define:

h[u_?NumericQ, y_?NumericQ] := f[y, u]*Log[1 + NIntegrate[g[y,
    u, s], {s, 1, Infinity}]]

and then evaluate

NIntegrate[h[u, y],
     {u, -Infinity, Infinity}, {y, -Infinity, Infinity}]

It will probably be quite slow since NIntegrate can't compile a 
function defined in this way. (It may even be slightly better to use 
the Compiled->False option in the second NIntegrate, though I am not 
sure if it will make any difference.)

Andrzej Kozlowski
Chiba, Japan

  • Prev by Date: Re: Re: Random Matrix of Integers
  • Next by Date: Re: Substitution ignored?
  • Previous by thread: Numerical integration inside numerical integration
  • Next by thread: Re: Numerical integration inside numerical integration