ln_gamma

Computes the logarithm of the Gamma function in the entire complex plane.
1 Download
Updated 11 Nov 2025

View License

This function computes the logarithm of the gamma function in the entire complex plane. The algorithm is based on approximating the log(Gamma(z)) in the half-plane Re(z)>1.5 by an algorithm from [1] (with improved coefficients obtained in [2]). This approximation is correct to 10^{-16} (though round-off errors may decrease the accuracy). The approximation in the half-plane Re(z)>1.5 is then used to compute ln(Gamma(z)) in the entire complex plane by the use of reflection formula and the functional equation.
References:
[1] A. Kuznetsov, "Computing the Barnes G-function and the gamma function in the entire complex plane," Journal of Computational and Applied Mathematics, Vol. 411, 2022, 114270. https://doi.org/10.1016/j.cam.2022.114270
[2] A. Kuznetsov, A. Mohammadioroojeh, "Approximating functions on R^+ by exponential sums", 2025, preprint, https://arxiv.org/abs/2508.19095

Cite As

Alexey_Kuznetsov (2025). ln_gamma (https://uk.mathworks.com/matlabcentral/fileexchange/182573-ln_gamma), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2025b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.1

fixed a typo in the preamble

1.0.0