Log of factorial of large numbers

computes log10 of the factorial
ダウンロード: 1.7K
更新 2007/5/10

ライセンスの表示

This function computes log10 of the factorial. Unlike FACTORIAL, it is not limited to arguments less than 171.

Two methods are implemented, one based on the gamma function (thank you, John), as well as a direct sum. The user can choose between the two methods. The gamma method is superior and is therefore the default choice.

The function returns the log10 of the factorial, the mantissa and the exponent of the factorial, as well as a string representing the factorial.

For instance
[L,M,X,S] = logfactorial(1E6)
yields
L = 5.5657e+006 % log10(N!)
M = 8.2639 % mantissa
X = 5565708 % exponent
S = '8.26393e+5565708' % N! as a string

The function accepts scalars or arrays as inputs.

LOGFACTORIAL is the result of a seqeunce of improvements that were suggested by John D'Errico and Urs Schwarz in their discussion of another FEX file, LARGEFACTORIAL. LOGFACTORIAL is preferrable for two reasons:

1. The gamma-based code is much faster than the direct sum code, which is the only one implemented in LARGEFACTORIAL.

2. LARGEFACTORIAL returns a string as the first argument, which is not very convenient to perform further computations. LOGFACTORIAL returns the log10 as the first argument, so for instance 10.^logfactorial(...) does make sense.

引用

Yvan Lengwiler (2024). Log of factorial of large numbers (https://www.mathworks.com/matlabcentral/fileexchange/14920-log-of-factorial-of-large-numbers), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R14SP3
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersIndustrial Statistics についてさらに検索
謝辞

ヒントを得たファイル: Factorial of large numbers

Community Treasure Hunt

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

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.0

More descriptive title. Correction of typo in the description.