title |
---|
specialfunctions_gamma |
[TOC]
Experimental
The gamma function is defined as the analytic continuation of a convergent improper integral function on the whole complex plane except zero and negative integers:
Fortran 2018 standard implements the intrinsic gamma function of real type argument in single and double precisions. Here the gamma function is extended to both integer and complex arguments. The values of the gamma function with integer arguments are exact. The values of the gamma function with complex arguments are approximated in single and double precisions by using Lanczos approximation.
result =
[[stdlib_specialfunctions_gamma(module):gamma(interface)]] (x)
Elemental function
x
: should be a positive integer or a complex type number
The function returns a value with the same type and kind as input argument.
{!example/specialfunctions_gamma/example_gamma.f90!}
Experimental
Mathematically, logarithm of gamma function is a special function with complex arguments by itself. Due to the different branch cut structures and a different principal branch, natural logarithm of gamma function log_gamma(z) with complex argument is different from the ln(Gamma(z)). The two have the same real part but different imaginary part.
Fortran 2018 standard implements intrinsic log_gamma function of absolute value of real type argument in single and double precision. Here the log_gamma function is extended to both integer and complex arguments. The values of log_gamma function with complex arguments are approximated in single and double precisions by using Stirling's approximation.
result =
[[stdlib_specialfunctions_gamma(module):log_gamma(interface)]] (x)
Elemental function
x
: Shall be a positive integer or a complex type number.
The function returns real single precision values for integer input arguments, while it returns complex values with the same kind as complex input arguments.
{!example/specialfunctions_gamma/example_log_gamma.f90!}
Experimental
Compute the natural logarithm of factorial, log(n!)
result =
[[stdlib_specialfunctions_gamma(module):log_factorial(interface)]] (x)
Elemental function
x
: Shall be a positive integer type number.
The function returns real type values with single precision.
{!example/specialfunctions_gamma/example_log_factorial.f90!}
Experimental
The lower incomplete gamma function is defined as:
When x < 0, p must be positive integer.
result =
[[stdlib_specialfunctions_gamma(module):lower_incomplete_gamma(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
{!example/specialfunctions_gamma/example_ligamma.f90!}
Experimental
The upper incomplete gamma function is defined as:
When x < 0, p must be a positive integer.
result =
[[stdlib_specialfunctions_gamma(module):upper_incomplete_gamma(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
{!example/specialfunctions_gamma/example_uigamma.f90!}
Experimental
Compute the natural logarithm of the absolute value of the lower incomplete gamma function.
result =
[[stdlib_specialfunctions_gamma(module):log_lower_incomplete_gamma(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
Experimental
Compute the natural logarithm of the absolute value of the upper incomplete gamma function.
result =
[[stdlib_specialfunctions_gamma(module):log_upper_incomplete_gamma(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
Experimental
The regularized gamma quotient P, also known as normalized incomplete gamma function, is defined as:
The values of regularized gamma P is in the range of [0, 1]
result =
[[stdlib_specialfunctions_gamma(module):regularized_gamma_p(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
{!example/specialfunctions_gamma/example_gamma_p.f90!}
Experimental
The regularized gamma quotient Q is defined as:
The values of regularized gamma Q is in the range of [0, 1]
result =
[[stdlib_specialfunctions_gamma(module):regularized_gamma_q(interface)]] (p, x)
Elemental function
p
: is a positive integer or real type argument.
x
: is a real type argument.
The function returns a real type value with the same kind as argument x.
{!example/specialfunctions_gamma/example_gamma_q.f90!}