Skip to Main Content Skip to Search
Product Documentation

factorial - Factorial function

Syntax

factorial(N)

Description

factorial(N), for scalar N, is the product of all the integers from 1 to N, i.e. prod(1:n). When N is an N-dimensional array, factorial(N) is the factorial for each element of N.

Since double precision numbers only have about 15 digits, the answer is only accurate for n <= 21. For larger n, the answer will have the right magnitude, and is accurate for the first 15 digits.

See Also

prod

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS