All formulas

Special functions

Digamma function

special.digammaAlso called digamma, psi function, psi, polygamma 0

ψ(x)=−γ−1x+∑k=1∞xk(k+x)\psi(x) = -\gamma - \frac{1}{x} + \sum_{k=1}^{\infty} \frac{x}{k (k + x)}

The logarithmic derivative Γ′(x)/Γ(x), written as an absolutely convergent series; γ is the Euler–Mascheroni constant. ψ(n) = Hn−1 − γ for whole n, with H the harmonic numbers.

Notation

xx

the argument

x > 0

ψ(x)\psi(x)

Result: the digamma function

scalar

Worked examples

Each result is solved exactly and confirmed by two independent computations.

  1. Given

    x=1x = 1

    Result

    ψ(x)=−γ\displaystyle \psi(x) = - \gamma

    ≈ -0.577215664902

  2. Given

    x=2x = 2

    Result

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

    ≈ 0.422784335098

  3. Given

    x=1/2x = 1/2

    Result

    ψ(x)=−2log⁡(2)−γ\displaystyle \psi(x) = - 2 \log{\left(2 \right)} - \gamma

    ≈ -1.96351002602

  4. Given

    x=1/3x = 1/3

    Result

    ψ(x)=−3log⁡(3)2−3π6−γ\displaystyle \psi(x) = - \frac{3 \log{\left(3 \right)}}{2} - \frac{\sqrt{3} \pi}{6} - \gamma

    ≈ -3.13203378002

Common mistakes

  • Uses ln x as the value

    ln x is the leading term of the large-x expansion; the next term is −1/(2x), so the error stays visible at every moderate x.

    Fix: Use a library digamma, or apply ψ(x) = ψ(x + 1) − 1/x until x is large and then the asymptotic series.

  • Drops the −γ term

    The series alone is ψ(x) + γ, off by the constant 0.5772….

    Fix: Subtract the Euler–Mascheroni constant.

  • Returns ln Γ(x) instead of its derivative

    ln Γ(x) is the antiderivative of ψ(x), a different function.

    Fix: Differentiate: ψ(x) = d/dx ln Γ(x).

Sources

  • DLMF, eq. 5.7.6

    NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/ Release 1.2.8 of 2026-09-15. F. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds.

    dlmf.nist.gov
  • DLMF, eq. 5.2.2

    NIST Digital Library of Mathematical Functions. https://dlmf.nist.gov/ Release 1.2.8 of 2026-09-15. F. W. J. Olver, A. B. Olde Daalhuis, D. W. Lozier, B. I. Schneider, R. F. Boisvert, C. W. Clark, B. R. Miller, B. V. Saunders, H. S. Cohl, and M. A. McClain, eds.

    dlmf.nist.gov