Log Factorial of Large Positive Numbers

This code evaluated log(n!) for all positive values of n with high accuracy.
264 Downloads
Updated 9 Nov 2011

View License

Matlab doesn't provide the values of n! when n>170, but this code can evaluate the logarithm of of n! with absolute accuracy of 1e-12 or better, and relative accuracy of 1e-15 or better. The following codes employ Stirling's integration formula of Gamma function.

Cite As

Andy Huang (2025). Log Factorial of Large Positive Numbers (https://www.mathworks.com/matlabcentral/fileexchange/33687-log-factorial-of-large-positive-numbers), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Gamma Functions in Help Center and MATLAB Answers
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.1.0.0

title modified so more easily can be found

1.0.0.0