gamma(x): Gama¶
Função Gama.
Declaration¶
Sintaxe¶
retval = gamma(x)
elemental real function gamma(x)
Argumentos¶
x the input value must be of type real. It should not be zero or a negative
integer.
Valores de retorno¶
The return value is of same type and kind as of x.
Descrição¶
gamma(x) computes \(\gamma(x)\). For positive, integer value of x, the Gamma
function simplifies to factorial function:
\(\gamma(x) = (x-1)!\)
In general, if \(x > 0\):
\(\gamma(x) = \int_{0}^{\infty} e^{-t} dt\)
and if \(-n-1 < x < -n\) where n is an integer >= 0:
\(\gamma(x) = \int_{0}^{\infty}(e ^{-t} - \sum\limits_{k=0}^n \frac{(-t)^k}{k!} dt)\)
Tipos¶
Supported argument types is real.
interface gamma
module procedure sgamma, dgamma
end interface
contains
elemental real(sp) function sgamma(x)
real(sp), intent(in) :: x
end function
elemental real(dp) function dgamma(x)
real(dp), intent(in) :: x
end function
Exemplos¶
program intrinsics_gamma
print *, gamma(0.5)
print *, gamma(1.0)
end program
Resultado:
1.77245
1.000