Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg99192] Re: Nested numerical integration
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Wed, 29 Apr 2009 06:39:07 -0400 (EDT)
- References: <gt6flm$rtj$1@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? > Mathematica complains, because your inner integral can't be evaluated numerically because it depends on the parameter w in it. You can try this: NIntegrate[w^2/(s - w), {w, -5, -1}, {s, 1, 5}] Out= 25.8364 This value seems to be correct (and will be given with your input) because you can integrate symbolically: Integrate[w^2 Integrate[1/(s - w), {s, 1, 5}], {w, -5, -1}] Out= -16 - 84 Log[3] + (250 Log[5])/3 %//N Out= 25.8364 -- _________________________________________________________________ Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de