Can Matlab Factorial a Large Number?
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ben Le
am 5 Sep. 2017
Kommentiert: Ben Le
am 6 Sep. 2017
Hello, I'm solving a problem of probability and need to calculate a factorial(365), but the factorial function in Matlab gives me a result of Inf. Can anyone know how to use the factorial function to calculate a large number such as factorial(365),factorial(321) ? Thank you! Ben
0 Kommentare
Akzeptierte Antwort
James Tursa
am 5 Sep. 2017
Bearbeitet: James Tursa
am 5 Sep. 2017
You could use one of these FEX submissions by John D'Errico:
https://www.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic
https://www.mathworks.com/matlabcentral/fileexchange/36534-hpf-a-big-decimal-class
Also, consider reformulating your calculation to avoid these large numbers. E.g., I am guessing that this large factorial is part of an expression that has other large factorials as well. Look for ways to "cancel" portions of the calculation so that smaller calculations remain.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Gamma Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!