       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:= ni[w_?NumberQ] := NIntegrate[1/(s - w), {s, 1, 5}]

In:= NIntegrate[w^2*ni[w], {w, -5, -1}]

Out= 25.8364

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

Out= -16 - 84 Log + (250 Log)/3

In:= -16 - 84 Log + (250 Log)/3 // N

Out= 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?

```

• Prev by Date: Re: Nested numerical integration
• Next by Date: Re: variable initial value in NDSolve
• Previous by thread: Re: Nested numerical integration
• Next by thread: Re: Nested numerical integration