Polygamma
Method with 2 overloads
Polygamma(PeterO.Numbers.EInteger,AngouriMath.Entity.Number.Complex)
Summary
The polygamma functionpsi^(n)(z) , the(n + 1) -th derivative ofln Gamma(z) , at the
working precision, for a wholen >= 0 and every complexz but its poles0, -1, -2, ... ,
where it isNaN .psi^(0) is the digamma function,Gamma'(z)/Gamma(z) .
Remarks
Left of Re z = 1/2 it is reflected (DLMF 5.15.6),
psi^(n)(z) = (-1)^n psi^(n)(1 - z) - pi^(n + 1) Q_n(cot(pi z)) , whereQ_n is the polynomial
withd^n/dz^n cot(pi z) = pi^n Q_n(cot(pi z)) :Q_0(c) = c and
Q_(k + 1)(c) = -(1 + c^2) Q_k'(c) .
Right of it, the recurrence psi^(n)(z + 1) = psi^(n)(z) + (-1)^n n!/z^(n + 1) (DLMF 5.15.5) moves
the argument toRe w >= R , withR the working digits andn , where the asymptotic
series (DLMF 5.11.2 and 5.15.8) is summed until a term is below the working precision:
ln w - 1/(2 w) - sum B_(2k)/(2k w^(2k)) for the digamma function, and
(-1)^(n + 1) ((n - 1)!/w^n + n!/(2 w^(n + 1)) + sum B_(2k) (2k + n - 1)!/((2k)! w^(2k + n))) for
n >= 1 . Its smallest term is aboute^(-2 pi R) of the sum, so it converges well before
it diverges.
The Bernoulli numbers are exact, from the tangent numbers by Brent and Harvey's recurrence, https://github.com/asc-community/AngouriMath/issues/171
B_(2k) = (-1)^(k - 1) 2k T_k/(4^k (4^k - 1)) , and cached.
Polygamma(System.Int32,PeterO.Numbers.EDecimal,PeterO.Numbers.EDecimal,PeterO.Numbers.EContext)
Summary
psi^(n)(re + i im) , and for each part the sum of the sizes of the terms added to make it, which
is what a cancellation in that part leaves its residual against.
Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6091 pages online