Probability distributions
Gamma probability density
prob.gamma-pdfAlso called gamma pdf, gamma density, gamma distribution
Density of the gamma distribution with shape k and scale θ, for x > 0. The mean is kθ.
Notation
the point, x > 0
x > 0
shape
k > 0
scale
θ > 0
Result: the density at x
scalar
Worked examples
Each result is solved exactly and confirmed by two independent computations.
Given
Result
≈ 0.367879441171
Given
Result
≈ 0.270670566473
Given
Result
≈ 0.541341132946
Given
Result
≈ 0.483941449038
Common mistakes
Uses the rate parameterization
The code treats θ as a rate β = 1/θ. NumPy's gamma and SciPy's gamma take the scale; many texts write the rate.
Fix: Use xk−1 e−x/θ / (Γ(k) θk) with θ the scale, or pass scale=1/β.
Sources
NIST/SEMATECH e-Handbook, §1.3.6.6.11
NIST/SEMATECH e-Handbook of Statistical Methods. https://www.itl.nist.gov/div898/handbook/ Last updated 2022-04-27. doi:10.18434/M32189
DLMF, eq. 5.2.1
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.