DIGAMMA
Updated 2024-03-07 21:27:04.713000
Syntax
SELECT [westclintech].[wct].[DIGAMMA](
<@X, float,>)
Description
Use the scalar function DIGAMMA to calculate digamma(z). Abramowitz and Stegun in Handbook of Mathematical Functions (6.3.1, p.258) defined the digamma function as:
\psi(z) = \frac{\mathrm{d}}{\mathrm{d}z}\ln\Gamma(z) = \frac{\Gamma'(z)}{\Gamma(z)}
Arguments
@X
The value of interest.
Return Type
float
Remarks
When @X is a negative integer NULL is returned.
When @X = 0 zero is returned
Examples
Example #1
In the example we evaluate the function at x = 5.
SELECT wct.DIGAMMA(5) as psi;
This produces the following result.
{"columns":[{"field":"psi","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"psi":"1.5061176684318"}]}
Example #2
In this example we use the SeriesFloat function from the XLeratorDB math library to generate a series on numbers from -4 to 4 in steps of .01, calculate the psi value for each number in the series, paste the results to Excel and create a simple graph of the function for the range.
SELECT SeriesValue as z,
wct.Digamma(SeriesValue) psi
FROM wct.SeriesFloat(-4, 4, .01, nULL, NULL);
This produces the following result.
See Also
GAMMA - complete gamma function