GAMMA
Updated 2024-03-08 14:31:07.503000
Syntax
SELECT [westclintech].[wct].[GAMMA] (
<@Z, float,>)
Description
Use the scalar function GAMMA to calculate Γ(z). The GAMMA function can be defined as a definite integral for ℜ[z] > 0.
\Gamma(z) = \int_0^\infty t^{z-1} e^{-t}\text{ d}t, \ \qquad \Re(z) > 0\
Arguments
@Z
The value of interest.
Return Type
float
Remarks
Gamma is undefined for negative integers.
Gamma is undefined at zero.
Examples
Example #1
SELECT wct.GAMMA(2.5) as Gamma;
This produces the following result.
{"columns":[{"field":"Gamma","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Gamma":"1.32934038817914"}]}
Example #2
SELECT wct.GAMMA(-3.75) as Gamma;
This produces the following result.
{"columns":[{"field":"Gamma","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"Gamma":"0.267866128861417"}]}
Example #3
The following SQL can be run using the SeriesFloat function to create GAMMA values from -4 to 4 which can then be pasted into Excel and graphed.
SELECT z,
wct.GAMMA(z) as Gamma
FROM
(
SELECT SeriesValue as z
FROM wct.SeriesFloat(-4, 4, 0.01, NULL, NULL)
) n;
This produces the following result.
See Also
DIGAMMA - Calculate digamma(z), the logarithmic derivative of the gamma function.
FACTLN - natural logarithm of a factorial
GAMMALN - natural logarithm of the complete gamma function
TRIGAMMA - trigamma function; the second derivative of the gamma function