Re: Nested numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg99197] Re: Nested numerical integration
- From: dh <dh at metrohm.com>
- Date: Wed, 29 Apr 2009 06:40:05 -0400 (EDT)
- References: <gt6flm$rtj$1@smc.vnet.net>
Hi, what makes you think that you get a wrong result? The error message comes from the fact that mathematica first tries to do the inner integral symbolically. You may prevent this by defining a function with numerical arguments: f[x_?NumericQ]:=... However, this is not the way to double integrals. Further, as long as you can calculate accurate results you should do so. You should use Integrate instead of NIntegrate. Here is your example: Integrate[w^2 1/(s - w), {s, 1, 5}, {w, -5, -1}] Daniel 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? >