Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
 - Subject: [mg99205] Re: Nested numerical integration
 - From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
 - Date: Wed, 29 Apr 2009 06:42:01 -0400 (EDT)
 - References: <gt6flm$rtj$1@smc.vnet.net>
 
The answer seems to be correct, at least, it is the same as when
calculated with the synbolic Integrate instead of Nintegrate. You can
remove the error in the following way:
In[266]:= ni[w_?NumberQ] := NIntegrate[1/(s - w), {s, 1, 5}]
In[268]:= NIntegrate[w^2*ni[w], {w, -5, -1}]
Out[268]= 25.8364
In[270]:= Integrate[w^2*Integrate[1/(s - w), {s, 1, 5}], {w, -5, -1}]
Out[270]= -16 - 84 Log[3] + (250 Log[5])/3
In[250]:= -16 - 84 Log[3] + (250 Log[5])/3 // N
Out[250]= 25.8364
Cheers -- Sjoerd
On Apr 28, 10:44 am, tsg.mo... at googlemail.com 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?