MathGroup Archive 2009

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

Search the Archive

Re: Nested numerical integration

  • To: mathgroup at
  • Subject: [mg99197] Re: Nested numerical integration
  • From: dh <dh at>
  • Date: Wed, 29 Apr 2009 06:40:05 -0400 (EDT)
  • References: <gt6flm$rtj$>


what makes you think that you get a wrong result?

The error message comes from the fact that mathematica first tries to do 

  the inner integral symbolically. You may prevent this by defining a 

function with numerical arguments: f[x_?NumericQ]:=...

However, this is not the way to double integrals. Further, as long as 

you can calculate accurate results you should do so. You should use 

Integrate instead of NIntegrate. Here is your example:

Integrate[w^2 1/(s - w), {s, 1, 5}, {w, -5, -1}]


tsg.moore at wrote:

> Hi, I'd like to compute a nested integral like,


> NIntegrate[ w^2 * NIntegrate[1/(s-w), {s, 1, 5}], {w, -5, -1}]


> Unfortunately, mathematica gives me an error (NIntegrate::inumr) and

> it also outputs the wrong value. Is there a way to do these types of

> integrals?


  • Prev by Date: Re: How to select several cells
  • Next by Date: Re: Nested numerical integration
  • Previous by thread: Re: Nested numerical integration
  • Next by thread: Re: Nested numerical integration