MathGroup Archive 2009

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

Search the Archive

Re: Nested numerical integration


Mathematica can't do a numerical integration on the inner integral because w
is left as a symbol. So either do a double integral all at once:

NIntegrate[w^2/(s - w), {s, 1, 5}, {w, -5, -1}]
25.8364

Or do a symbolic integration on the inner integral and a numerical integral
on the outer:

Assuming[w <= 1, Integrate[1/(s - w), {s, 1, 5}]]
NIntegrate[w^2 %, {w, -5, -1}]
Log[(-5 + w)/(-1 + w)]
25.8364


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: tsg.moore at googlemail.com [mailto:tsg.moore at googlemail.com] 


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: Inverse function warnings
  • Next by Date: Re: variable initial value in NDSolve
  • Previous by thread: Re: Nested numerical integration
  • Next by thread: Re: Nested numerical integration