MathGroup Archive 2006

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

Search the Archive

Re: Evaluating integral with varying upper limit?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71074] Re: [mg71035] Evaluating integral with varying upper limit?
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Wed, 8 Nov 2006 06:04:00 -0500 (EST)
  • References: <200611060752.CAA08598@smc.vnet.net>

AES wrote:

>Given a function  f[x]  which happens to be rather messy and not 
>analytically integrable, I want to evaluate the function
>
>   g[y_] := NIntegrate[f[x], {x, ymin, y} ]
>
>with ymin fixed and  ymin < y < Infinity.  
>
>I suppose that FunctionInterpolate is the way to go here (???).
>
>But, are there tricks to tell FunctionInterpolate what I know in 
>advance, namely that f[x] is everywhere positive, and decreases toward 
>zero rapidly enough at large x that g[y] will approach a finite limiting 
>value as y -> Infinity? (which value I'd like to have FI obtain with 
>moderate accuracy -- meaning 3 or 4 significant digits, not 10 or 20)
>
>Thanks . . .
>  
>
I would recommend using NDSolve to invert the NIntegrate operation, 
although handling the range ymin<y<Infinity is problematic. For example:

In[3]:=
f[x_]:=BesselJ[2,x]Exp[-x]
In[4]:=
g[y_]:=NIntegrate[f[x],{x,1,y}]

Then, using NDSolve we have:

In[5]:=
NDSolve[{h'[x] == f[x], h[1] == 0}, h, {x, 1, 100}]
Out[5]=
{{h -> InterpolatingFunction[{{1., 100.}}, <>]}}

A few checks:

g[10]
h[10] /. %5[[1]]
0.102135
0.102135

g[100]
h[100] /. %5[[1]]
0.102141
0.102141


g[Infinity]
0.102141

If you really need an InterpolationFunction whose range is ymin to 
Infinity, then you can try transforming variables, like y->1/y, but 
getting NDSolve to handle the point at Infinity (or 0 in transformed 
coordinates) becomes difficult.

Carl Woll
Wolfram Research


  • Prev by Date: Re: Evaluating integral with varying upper limit?
  • Next by Date: comparing implicit 0 with machine floats
  • Previous by thread: Re: Evaluating integral with varying upper limit?
  • Next by thread: Re: Re: Evaluating integral with varying upper limit?