Personel Information

BSc: Physics Department, Middle East Technical University (METU), Ankara, Turkey
MSc: Physics Department, METU
PhD: Qualified, Physics Department, METU


Monday, July 11, 2016

MINIMUM OF GAMMA FUNCTION

## This string finds the minimum of the Gamma function
## integral(x^(alpha-1)*exp(-x))dx) (x=[0,infinity])
## in the interval 0<alpha<4.
dx=1E-2; ## Increment in x
x=0:dx:100; ## x array
Gamma=[]; ## Empty Gamma function
alpha=0.00:dx:4.00; ## The independent variable of Gamma function
for i=1:length(alpha)
## Call the trapezoid function to
## calculate all entries of Gamma function
## corresponding to entries of alpha
f=x.^(alpha(i)-1).*exp(-x); ## integrand of Gamma function
Gamma(i)=trapezoid(x,f);
endfor
plot(alpha,Gamma);
title('Gamma values vs alpha');
legend('Gamma(alpha)');
xlabel('alpha');
ylabel('Gamma');
## The following 'for loop' finds the minimum value of Gamma
## and the corresponding alpha value.
minimum=Gamma(1);
for n=1:length(Gamma)
if(minimum>Gamma(n))
minimum=Gamma(n);
n; ## The array index where the minimum of Gamma is.
m=alpha(n); ## The alpha value corresponding to the min of Gamma
endif
endfor;
printf('Minimum of the Gamma Function in the interval 0<alpha<4 is %f\n for the alpha=%f\n' ,minimum,m)
print('-dpsc',MINGAMMA.ps');
save -text MINGAMMA.dat

No comments:

Post a Comment