Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Nested numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99205] Re: Nested numerical integration
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 29 Apr 2009 06:42:01 -0400 (EDT)
  • References: <gt6flm$rtj$1@smc.vnet.net>

The answer seems to be correct, at least, it is the same as when
calculated with the synbolic Integrate instead of Nintegrate. You can
remove the error in the following way:

In[266]:= ni[w_?NumberQ] := NIntegrate[1/(s - w), {s, 1, 5}]

In[268]:= NIntegrate[w^2*ni[w], {w, -5, -1}]

Out[268]= 25.8364

In[270]:= Integrate[w^2*Integrate[1/(s - w), {s, 1, 5}], {w, -5, -1}]

Out[270]= -16 - 84 Log[3] + (250 Log[5])/3

In[250]:= -16 - 84 Log[3] + (250 Log[5])/3 // N

Out[250]= 25.8364

Cheers -- Sjoerd

On Apr 28, 10:44 am, tsg.mo... 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?



  • Prev by Date: Re: Nested numerical integration
  • Next by Date: Re: variable initial value in NDSolve
  • Previous by thread: Re: Nested numerical integration
  • Next by thread: Re: Nested numerical integration