MathGroup Archive 2006

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

Search the Archive

Re: Problem with nested NIntegrate[]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70235] Re: Problem with nested NIntegrate[]
  • From: dimmechan at yahoo.com
  • Date: Sun, 8 Oct 2006 02:05:00 -0400 (EDT)
  • References: <eg83ok$nc3$1@smc.vnet.net>

First the behavior is not paradoxical; you could say it is feature (at
least to me).

Second here is the the analytic result

Integrate[Integrate[y, {x, -1, 1}], {y, -1, 1}]
0

Third see that despite of the presence of these NIntegrate::inum :
messages
you got the right answer

NIntegrate[NIntegrate[y, {x, -1, 1}], {y, -1, 1}]
NIntegrate::inum (...)
General::stop: (...)
NIntegrate::ploss : (...)
0.

I believe when integrating numerically y over {x,-1,1} NIntegrate
samples some
points where the integrand is not numerically.

I can think right now many alternatives in order to avoid the messages.
The first is the most desired.

NIntegrate[y, {x, -1, 1}, {y, -1, 1}]
0.

NIntegrate[NIntegrate[y, {y, -1, 1}], {x, -1, 1}, AccuracyGoal -> 20]
0.

Off[NIntegrate::inum]

NIntegrate[NIntegrate[y, {x, -1, 1}], {y, -1, 1}, AccuracyGoal -> 20]
0.

(*AccuracyGoal ->20 is necessay to supress NIntegrate::ploss :
message.*)

On[NIntegrate::inum]

Block[{Message}, NIntegrate[NIntegrate[y, {x, -1, 1}], {y, -1, 1}]]
0.

Block[{$Messages = {}}, NIntegrate[NIntegrate[y, {x, -1, 1}], {y, -1,
1}]]
0.

Regards

Î?/Î? Eckhard έγÏ?αÏ?ε:
> Hello,
>
> 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.
> 
> thanks in advance
> 
> Eckhard


  • Prev by Date: Re: How to assign the result from NonlinearFit to a function
  • Next by Date: Re: FoourierTransform of a function defined in sections
  • Previous by thread: Re: Problem with nested NIntegrate[]
  • Next by thread: Re: FourierTransform of a function defined in sections