Filter löschen
Filter löschen

Lower and upper incomplete gamma function

10 Ansichten (letzte 30 Tage)
Shashibhushan Sharma
Shashibhushan Sharma am 3 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 Kommentare
John D'Errico
John D'Errico am 3 Nov. 2018
Please learn to format your pasted in code so it is readable. I did it for you here.
Shashibhushan Sharma
Shashibhushan Sharma am 3 Nov. 2018
Thank you, sir.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 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 Kommentare
Shashibhushan Sharma
Shashibhushan Sharma am 3 Nov. 2018
Dear David,
A very Very thanks, sir! In your comment, what is G&R? Your given code is correctly working. I also understood the meaning of gammainc(.) in MATLAB.
David Goodmanson
David Goodmanson am 4 Nov. 2018
I was referring to Gradshteyn and Ryzhik, the book you cited.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by