Logo

TRIGAMMA

Updated 2024-03-13 14:25:37.630000

Syntax

SELECT [westclintech].[wct].[TRIGAMMA](
   <@X, float,>)

Description

Use the scalar function TRIGAMMA to calculate trigamma(z). Abramowitz and Stegun in Handbook of Mathematical Functions (6.4.1, p.260) defined the polygamma function as:

\psi^{(n)}(z) := \frac{\mathrm{d}^n}{\mathrm{d}z^n} \psi(z) = \frac{\mathrm{d}^{n+1}}{\mathrm{d}z^{n+1}} \ln\Gamma(z), n=(1,2,3,\dots)

ψ' is known as the trigamma function and is second derivative of the GAMMA function.

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.TRIGAMMA(5) as trigamma;

This produces the following result.

{"columns":[{"field":"trigamma","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"trigamma":"0.221322955737545"}]}

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.Trigamma(SeriesValue) trigamma
FROM
   wct.SeriesFloat(-4,4,.01,NULL,NULL);

This produces the following result.

http://westclintech.com/Portals/0/images/doc_stats_TRIGAMMA_img1.jpg