Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg99167] Re: [mg99138] Nested numerical integration
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 29 Apr 2009 03:49:17 -0400 (EDT)
- References: <189219.1240908982824.JavaMail.root@n11>
Mathematica can't do a numerical integration on the inner integral because w
is left as a symbol. So either do a double integral all at once:
NIntegrate[w^2/(s - w), {s, 1, 5}, {w, -5, -1}]
25.8364
Or do a symbolic integration on the inner integral and a numerical integral
on the outer:
Assuming[w <= 1, Integrate[1/(s - w), {s, 1, 5}]]
NIntegrate[w^2 %, {w, -5, -1}]
Log[(-5 + w)/(-1 + w)]
25.8364
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/
From: tsg.moore at googlemail.com [mailto:tsg.moore at googlemail.com]
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?