Skip to content

Digamma ​

The digamma function ψ(z)=ddzln⁡Γ(z)\psi(z) = \dfrac{d}{dz}\ln\Gamma(z), the logarithmic derivative of Gamma.

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaDigamma functionMathWorldDigammaFunctionWikidataQ905326Encyclopedia of MathematicsPsi-functionDLMF5.2.E2FungrimDigammaFunction✓Fungrim entryWolfram LanguagePolyGamma!
Digamma(z)the digamma function ψ(z)=Γ′(z)/Γ(z)\psi(z) = \Gamma'(z)/\Gamma(z).
SageMathpsi(z)SymPydigamma(z)mpmathdigamma(z)Juliaenumeratio_ball(digamma, z)Rustdigamma(z)
Typed signatures
TypePackageApplies
(complex | infinity) -> numberanalyticreplaces compute-enginealways
(complex | infinity) -> numbercompute-enginealways

Domain: Special functions

Details
  • Digamma is the order-zero polygamma: ψ(z)=ψ(0)(z)\psi(z) = \psi^{(0)}(z). The higher derivatives are PolyGamma.
  • ψ(1)=−γ\psi(1) = -\gamma, the negative Euler-Mascheroni constant.
  • Recurrence inherited from Gamma's functional equation: ψ(z+1)=ψ(z)+1/z\psi(z+1) = \psi(z) + 1/z.
  • ψ(1/2)=−γ−2ln⁡2\psi(1/2) = -\gamma - 2\ln 2.
  • Poles at the nonpositive integers, the same poles as Gamma.
  • compute-engine's plain evaluation would otherwise leave Digamma at an exact integer argument symbolic except at the poles; @enumeratio/analytic overrides it at every positive integer via ψ(n)=Hn−1−γ\psi(n) = H_{n-1} - \gamma, reusing HarmonicNumber. A rational, non-integer argument, or N(), still goes through the numeric path.
  • Differs from Wolfram: Digamma(1/4)Digamma(1/4) reduces to its closed form on evaluation; Wolfram keeps Digamma[1/4] until FunctionExpand. Both agree as identities.

Plot

ComplexPlot
real slice

Examples

1 more kept as data, checked against the oracles
Basic #

A pole of Gamma, shared by its log-derivative

live ↗
InDigamma(0)\mathrm{Digamma}(0)Out∞~\tilde∞
live ↗
InDigamma(−1)\mathrm{Digamma}(-1)Out∞~\tilde∞

A floating-point argument evaluates directly to a high-precision decimal

live ↗
InDigamma(0.5)\mathrm{Digamma}(0.5)Out−1.963 510 026 021 423 479 44-1.963\,510\,026\,021\,423\,479\,44

A machine-precision argument

live ↗
InDigamma(100.5)\mathrm{Digamma}(100.5)Out4.605 174 352 581 845 211 874.605\,174\,352\,581\,845\,211\,87

ψ(5)=H4−γ=2512−γ\psi(5) = H_4 - \gamma = \frac{25}{12} - \gamma

live ↗
InDigamma(5)\mathrm{Digamma}(5)Out2512−γ\frac{25}{12}-γ
Scope #

Threads over a list, reducing each positive-integer element to its closed form in γ\gamma

live ↗
InDigamma([1,2,3])\mathrm{Digamma}(\bigl\lbrack1, 2, 3\bigr\rbrack)Out[−γ,1−γ,32−γ]\bigl\lbrack-γ, 1-γ, \frac{3}{2}-γ\bigr\rbrack

Inexact complex arguments evaluate, as ψ(m)\psi^{(m)} does for m≥1m \geq 1 (see PolyGamma)

live ↗
InDigamma(2.5+3i)\mathrm{Digamma}(2.5+3i)Out1.281 273 919 066 231 4+0.979 805 315 344 559 6i1.281\,273\,919\,066\,231\,4+0.979\,805\,315\,344\,559\,6i

ψ(∞)=∞\psi(\infty) = \infty, growing like ln⁡z\ln z

live ↗
InDigamma(∞)\mathrm{Digamma}(∞)Out∞∞

Gauss's digamma theorem: ψ(1/4)=−γ−π/2−3ln⁡2\psi(1/4) = -\gamma - \pi/2 - 3\ln 2

live ↗
InDigamma(14)\mathrm{Digamma}(\frac{1}{4})Out−3ln⁡(2)−π2−γ-3\ln(2)-\frac{π}{2}-γ

ψ(1/3)=−γ−π23−32ln⁡3\psi(1/3) = -\gamma - \frac{\pi}{2\sqrt3} - \frac32\ln 3

live ↗
InDigamma(13)\mathrm{Digamma}(\frac{1}{3})Out−3ln⁡(3)2−3π6−γ-\frac{3\ln(3)}{2}-\frac{\sqrt{3}π}{6}-γ

Interval arithmetic: ψ\psi is increasing on (0,∞)(0, \infty)

live ↗
InDigamma(Interval(1.23,1.24))\mathrm{Digamma}(\mathrm{Interval}(1.23, 1.24))OutInterval(−0.251 669 430 696 100 1,−0.239 493 679 125 936 8)\mathrm{Interval}(-0.251\,669\,430\,696\,100\,1, -0.239\,493\,679\,125\,936\,8)

To 30 significant digits, every one correctly rounded

live ↗
InN(Digamma(13),30)N(\mathrm{Digamma}(\frac{1}{3}), 30)Out−3.132 033 780 020 806 322 996 419 074 29-3.132\,033\,780\,020\,806\,322\,996\,419\,074\,29
Applications #

Harmonic numbers via Digamma: ψ(n+1)+γ=Hn\psi(n+1) + \gamma = H_n, here H5H_5 at n=5n=5

live ↗
InDigamma(6)+γ=1+12+13+14+15\mathrm{Digamma}(6)+γ=1+\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}OutTrue\mathrm{True}
Properties #

ψ(1)=−γ\psi(1) = -\gamma

live ↗
InDigamma(1)+γ=0\mathrm{Digamma}(1)+γ=0OutTrue\mathrm{True}

Recurrence: ψ(z+1)=ψ(z)+1/z\psi(z+1) = \psi(z) + 1/z, here at z=1z = 1

live ↗
InDigamma(2)=Digamma(1)+1\mathrm{Digamma}(2)=\mathrm{Digamma}(1)+1OutTrue\mathrm{True}

ψ(1/2)=−γ−2ln⁡2\psi(1/2) = -\gamma - 2\ln 2

live ↗
InDigamma(12)+γ+2ln⁡(2)=0\mathrm{Digamma}(\frac{1}{2})+γ+2\ln(2)=0OutTrue\mathrm{True}

ψ′(x)\psi'(x) is the trigamma, ψ(1)(x)\psi^{(1)}(x)

live ↗
IndDigamma(x)dx\frac{\mathrm{d}\mathrm{Digamma}(x)}{\mathrm{d}x}OutTrigamma(x)\mathrm{Trigamma}(x)

Reflection: ψ(1−x)−ψ(x)=πcot⁡(πx)\psi(1-x) - \psi(x) = \pi\cot(\pi x), here πcot⁡(0.3π)=2.2825…\pi\cot(0.3\pi) = 2.2825\ldots

live ↗
InDigamma(0.7)−Digamma(0.3)\mathrm{Digamma}(0.7)-\mathrm{Digamma}(0.3)Out2.282 500 668 502 198 374 212.282\,500\,668\,502\,198\,374\,21
1 / 3

ψ(1)=−γ\psi(1) = -\gamma.

live ↗
InDigamma(1)\mathrm{Digamma}(1)Out−γ-γ
live ↗
InDigamma(13)−Digamma(23)\mathrm{Digamma}(\frac{1}{3})-\mathrm{Digamma}(\frac{2}{3})Out−33π-\frac{\sqrt{3}}{3}π

Known value · Wolfram MathematicalFunctionData, PolyGamma:Digamma, Reflection formula

Neat examples #

Between the poles at 0 and -1, ψ\psi is still finite: ψ(−1/2)≈0.036\psi(-1/2) \approx 0.036

live ↗
InDigamma(−0.5)\mathrm{Digamma}(-0.5)Out0.036 489 973 978 576 520 5590.036\,489\,973\,978\,576\,520\,559
About
Examples24
Checked againstWolfram Language 22 agree1 differSageMath 18 agree2 differ2 errorSymPy 21 agree3 differmpmath 19 agree3 errorJulia 19 agree3 errorRust 14 agree2 error
CrosswalkWikipediaMathWorldWikidataEncyclopedia of MathematicsDLMFFungrimFungrim entry ×45Wolfram LanguageSageMathSymPympmathJuliaRust

Implementation

mappedsympypackages/oracle/src/mappings.ts
mappedmpmathpackages/oracle/src/mappings.ts
mappedsagepackages/oracle/src/mappings.ts
mappedjuliapackages/oracle/src/mappings.ts
mappedrustpackages/oracle/src/mappings.ts

See also: Gamma, Zeta, GammaLn