       Re: Nested numerical integration

• To: mathgroup at smc.vnet.net
• Subject: [mg99172] Re: [mg99138] Nested numerical integration
• From: Daniel Lichtblau <danl at wolfram.com>
• Date: Wed, 29 Apr 2009 06:05:37 -0400 (EDT)
• References: <200904280845.EAA28624@smc.vnet.net>

```tsg.moore 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?

Can use one NIntegrate, to avoid the inner one having a "symbolic"
parameter w.

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

Alternatively, define a black box integrand that only is computable for
numeric input.

In:= f[w_Real] := NIntegrate[1/(s-w), {s, 1, 5}]

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

Daniel Lichtblau
WOlfram Research

```

• Prev by Date: Re: text book style sheets
• Next by Date: Re: Nested numerical integration
• Previous by thread: Nested numerical integration
• Next by thread: Re: Nested numerical integration