Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg99158] Re: [mg99138] Nested numerical integration
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 29 Apr 2009 03:47:39 -0400 (EDT)
- Reply-to: hanlonr at cox.net
$Version 6.0 for Mac OS X PowerPC (32-bit) (June 19, 2007) Integrate[w^2*Integrate[1/(s - w), {s, 1, 5}], {w, -5, -1}] -16-84 log(3)+(250 log(5))/3 % // N 25.8364 f[w_] = Assuming[{w <= 1}, Integrate[1/(s - w), {s, 1, 5}]] log((w-5)/(w-1)) Plot[w^2*f[w], {w, -5, -1}] Visually, the integral is roughly 12*4/2 = 24 Integrate[w^2*Integrate[1/(s - w), {s, 1., 5}], {w, -5, -1}] 25.8364 Integrate[w^2*Integrate[1/(s - w), {s, 1, 5}], {w, -5., -1}] 25.83639373697124 + 0.*I Integrate[w^2*Integrate[1./(s - w), {s, 1, 5}], {w, -5, -1}] 25.83639378805382 + 0.*I NIntegrate[w^2*Integrate[1/(s - w), {s, 1, 5}], {w, -5, -1}] 25.8364 fn[w_?NumericQ] := NIntegrate[1/(s - w), {s, 1, 5}]; NIntegrate[w^2*fn[w], {w, -5, -1}] 25.8364 Off[NIntegrate::inumr] NIntegrate[w^2*NIntegrate[1/(s - w), {s, 1, 5}], {w, -5, -1}] 25.8364 Bob Hanlon On Tue, Apr 28, 2009 at 9:51 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?