Sum over incomplete Gamma Functions
- From: "ralf.schaa" <Ralf.Schaa@xxxxxxxxx>
- Date: Fri, 27 Mar 2009 21:15:06 -0700 (PDT)
Not really a Fortran specific question, but perhaps you have some
clever hints for me anyway:
The result of an integration leads to an infinite sum over incomplete
Gamma functions:
inf ( Gamma[ 2n, k*z] - Gamma[ 2n, z] )
Sum ---------------------------------------------------------
n=0 n**(2n+1) * n! * (2n+1)!
where 0 < k <= 1 and z > 0, Gamma[.,.] denotes the incomplete Gamma
function in Mathematica notation - the sum is convergent.
However, already for moderate values of k and z, the number of
iterations exceeds the maximum number possible before overflows occurs
and convergence is still far off.
For example z=0.5 and k=1000: convergence in the 11th digit is at
iteration 560 as calculated with Mathematica.
Context: this sum is used in an numerical integration scheme as part
of the integral kernel and called many times.
I consulted some of the usual literature (i.e. Abramowitz&Stegun,
etc.) but there seems to be no specific (semi)closed form for this
sum, or is it?
Has somebody stumbled over this before?
All hints most welcome - Cheers!
The code calls an implementation of the incomplete Gamma function
(Num.Recipes) and for smaller values of kappa and z is equivalent to
Mathematica's output. The factorial is evaluated in double precision.
!------------------------------------------------------------------------------------------------
function GammaSum(kappa,z)
use typedef, only: ft ! double precision
use specfunc, only: Fac, IncGamma ! Factorial and Incomplete Gamma
implicit none
integer , parameter :: GAMMAITR = 80
real( ft ), intent(in) :: kappa,z
real( ft ) :: GammaSum
real( ft ) :: gsm,prv,ord,num,den
integer :: n
gsm = 0
Do n=0,GAMMAITR
prv = gsm
ord = real(2*n,ft)
num = IncGamma(ord,kappa*z) - IncGamma(ord,z)
den = 2.0_ft**(2*n+1) * Fac(n)*Fac(n+1)
gsm = gsm + num/den
! Exit if convergence .... (not shown)
EndDo
GammaSum = gsm
end function GammaSum
!------------------------------------------------------------------------------------------------
.
- Follow-Ups:
- Re: Sum over incomplete Gamma Functions
- From: James Van Buskirk
- Re: Sum over incomplete Gamma Functions
- From: Ian Gay
- Re: Sum over incomplete Gamma Functions
- Prev by Date: Re: Unexpected 15 digits precision from "REAL"
- Next by Date: Re: Unexpected 15 digits precision from "REAL"
- Previous by thread: calling a function that returns a c_char from python
- Next by thread: Re: Sum over incomplete Gamma Functions
- Index(es):
Relevant Pages
|