I. Theoretical Analysis

Gamma Function is defined in the following,

Using integration by parts, one sees that:

From the above calculation,and note that

where .

If is a positive integer, one can obtain:

Appendix:

Integral calculus(

If it meets a condition , obviously given that,

Calculate quadratic ,

Using integration by polar coordinates, , and,

then, one sees that

Therefore,

II. Numerical analysis

Evaluate Gamma function in matlab.

1.Evaluate the gamma function with a scalar and a vector.

>> y = gamma(0.5)

y =

    1.7725
    
>> y = gamma(-pi:pi)

y = 

    1.0157   -3.1909    6.8336   -7.8012    1.1046    0.9482    1.7621

2.Plot the gamma function and its inverse.

% PlotGammaFunctionExample.m
fplot(@gamma)
hold on
fplot(@(x) 1./gamma(x))
legend('\Gamma(x)','1/\Gamma(x)')
hold off
grid on

Figure.

alt text

In addition, the domain of the gamma function extends to negative real numbers by analytic continuation, with simple poles at the negative integers. This extension arises from repeated application of the recursion relation

More information see here.

Related article maybe useful to you: