Log Factorial of Large Positive Numbers
Version 1.1.0.0 (1.6 KB) by
Andy Huang
This code evaluated log(n!) for all positive values of n with high accuracy.
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 LinuxCategories
Find more on Gamma Functions in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.