필터 지우기
필터 지우기

Can Matlab Factorial a Large Number?

조회 수: 18 (최근 30일)
Ben Le
Ben Le 2017년 9월 5일
댓글: Ben Le 2017년 9월 6일
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

채택된 답변

James Tursa
James Tursa 2017년 9월 5일
편집: James Tursa 2017년 9월 5일
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.
  댓글 수: 1
Ben Le
Ben Le 2017년 9월 6일
Thank you James! Your answer is very interesting. Wow! There is so many things I need to learn prior to getting the answer. I thought there is a simple function that I can use to factorial a large integer number. Thank you again for pointing me to the right section I want to know. Ben

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2017년 9월 5일
  댓글 수: 1
Ben Le
Ben Le 2017년 9월 6일
Hello Image Analyst, The link is interesting. Wow! There is so many things I need to learn prior to getting the answer. I thought there is a simple function that I can use to factorial a large integer number. Thank you again for pointing me to the right section I want to know. Ben

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Gamma Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by