Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg99170] Re: [mg99138] Nested numerical integration
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Wed, 29 Apr 2009 06:05:15 -0400 (EDT)
- References: <200904280845.EAA28624@smc.vnet.net>
Hi,
direct 2D integration:
In[1] = NIntegrate[w^2/(s - w), {s, 1, 5}, {w, -5, -1}]
Out[1] = 25.8364
Step-by-step integration:
In[2] =
Clear[int];
int[w_?NumericQ] := NIntegrate[w^2/(s - w), {s, 1, 5}];
NIntegrate[int[w], {w, -5, -1}]
Out[2] = 25.8364
The second method is more flexible since you may use it for
non-rectangular domains.
Regards,
Leonid
On Tue, Apr 28, 2009 at 1:45 AM, <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?
>
- References:
- Nested numerical integration
- From: tsg.moore@googlemail.com
- Nested numerical integration