MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nested numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99172] Re: [mg99138] Nested numerical integration
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Wed, 29 Apr 2009 06:05:37 -0400 (EDT)
  • References: <200904280845.EAA28624@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?

Can use one NIntegrate, to avoid the inner one having a "symbolic" 
parameter w.

In[3]:= NIntegrate[ w^2 * 1/(s-w), {s, 1, 5}, {w, -5, -1}]
Out[3]= 25.8364

Alternatively, define a black box integrand that only is computable for 
numeric input.

In[4]:= f[w_Real] := NIntegrate[1/(s-w), {s, 1, 5}]

In[5]:= NIntegrate[w^2*f[w], {w, -5, -1}]
Out[5]= 25.8364

Daniel Lichtblau
WOlfram Research



  • Prev by Date: Re: text book style sheets
  • Next by Date: Re: Nested numerical integration
  • Previous by thread: Nested numerical integration
  • Next by thread: Re: Nested numerical integration