Lower and upper incomplete gamma function
7 views (last 30 days)
Show older comments
Shashibhushan Sharma
on 3 Nov 2018
Commented: David Goodmanson
on 4 Nov 2018
In a book, which name is 'Table of integrals series and products' of 'I.S. Gradshteyn and I.M. Ryzhik' Seventh edition, The solution of integration has been given in Eq. (3.351.1) as:
Int = \int\limits_0^u {{x^n}{e^{ - \mu x}}dx} = \frac{{n!}}{{{\mu ^{n + 1}}}} - {e^{ - \mu u}}\sum\limits_{k = 0}^n {\frac{{n!}}{{k!}}\frac{{{u^k}}}{{{\mu ^{n - k + 1}}}} = {\mu ^{ - n - 1}}\gamma \left( {n + 1,\mu u} \right)}. [u>0, Re \mu>0, n=0,1,2,3.....]
In this solution, the integral value of the second part has two solutions, given in the 3rd and 4th part. The integral value of the second part is the exact match with its solution with the 3rd part, but it does not match with the next solution given in the 4th part in terms of the incomplete gamma function. Why does the integral solution of a 2nd part not match with the 4th part, while 4th is also a solution of a 2dn part? Please, someone, help me to solve my problem. I plot in MATLAB as:
The MATLAB code is
clearvars;
close all;
clc;
Al1=1:10;mu=2;n=5;
int1=zeros(1,length(Al1));
int2=zeros(1,length(Al1));
int3=zeros(1,length(Al1));
for a=1:length(Al1)
Al=Al1(a);
f=@(x)((x.^n).*exp(-mu*x));% f(x)=x^n*exp(-mu*x);
int1(a)=integral(f, 0, Al);
int2(a)=mu^(-n-1)*gammainc(n+1,mu*Al);D1=0;
for b=0:n
m=b;
d1=(factorial(n)/factorial(m))*((Al^m)/(mu^(n-m+1)));
D1=D1+d1;
end
int3(a)=factorial(n)/(mu^(n+1))-(exp(-mu*Al)*D1);
end
semilogy(Al1, int1, '-*k');
hold on;grid on;
semilogy(Al1, int2, '-o');
hold on;grid on;
semilogy(Al1, int3, '-^r');
hold on;grid on;
<<
>>
2 Comments
John D'Errico
on 3 Nov 2018
Please learn to format your pasted in code so it is readable. I did it for you here.
Accepted Answer
David Goodmanson
on 3 Nov 2018
Hi Shashibhushan,
A couple of things. First, the calling variable order to gammainc needs to be reversed. Second, Matlab gammainc includes and extra factor of 1/gamma compared to G&R, see doc gammainc. The line
int2(a)=gamma(n+1)*mu^(-n-1)*gammainc(mu*Al,n+1);
works.
2 Comments
More Answers (0)
See Also
Categories
Find more on Gamma Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!