Re: Problem with nested NIntegrate[]

• To: mathgroup at smc.vnet.net
• Subject: [mg70228] Re: Problem with nested NIntegrate[]
• From: Bill Rowe <readnewsciv at sbcglobal.net>
• Date: Sun, 8 Oct 2006 02:04:35 -0400 (EDT)

```On 10/7/06 at 7:08 AM, e.schlemm at hotmail.de (Eckhard) wrote:

>I encountered some strange behaviour of NIntegrate when I use a
>somewhat neseted structure of several - in my example of two -
>NIntegrate[] functions

>NIntegrate[NIntegrate[y,{x,-1,1}],{y,-1,1}]

>This gives me the error

>NIntegrate::"num Integrand y is not numerical at {x) = 0

>Why does the inner NIntegrate function not know, what value is
>currently assigned to y...

>I hope someone can shed a little light on that seemingly paradoxical
>behaviour.

NIntegrate is a numerical procedure that works by sampling your
function at specific values. That is for NIntegrate to do its
thing it must substitute numbers for variable of integration and
the function must return a number.

Your function in the inner NIntegrate doesn't meet the above
criteria. It will return y which does not have an assigned
numerical value yet. Hence the error message.

Changing the inner NIntegrate to Integrate solves the issue, i.e.,

In[30]:=
NIntegrate[Integrate[y,{x,-1,1}],{y,-1,1}]

Out[30]=
0.

But, I wonder why you are using the syntax:

NIntegrate[NIntegrate[...

If you want a numerical answer for a double integral, the
appropriate syntax is:

NIntegrate[expr, {var1, low, high}, {var2, low, high}]

which avoids the issue you are having.
--
To reply via email subtract one hundred and four

```

• Prev by Date: Re: Closed-form Integral Solution without Hypergeometric2F1Regularized ! ! !
• Next by Date: Re: Troubles with Integrate
• Previous by thread: Problem with nested NIntegrate[]
• Next by thread: Re: Problem with nested NIntegrate[]