Factorial
n!
gives the factorial of n.
Details
- Mathematical function, suitable for both symbolic and numerical manipulation.
- For non‐integer n, the numerical value of n! is given by Gamma[1+n].
- For integers and half integers, Factorial automatically evaluates to exact values.
- Factorial can be evaluated to arbitrary numerical precision.
- Factorial automatically threads over lists.
- Factorial can be used with Interval and CenteredInterval objects. »
Background & Context
- Factorial represents the factorial function. In particular, Factorial[n] returns the factorial of a given number , which, for positive integers, is defined as . For n1,2,…, the first few values are therefore 1,2,6,24,120,720,…. The special case is defined as 1, consistent with the combinatorial interpretation of there being exactly one way to arrange zero objects. For a general complex number , , where the Gamma function is defined by for all complex values of except when is a negative integer (in which case is complex infinity). Factorials of half integers are given by rational multiples of .
- Factorials are best known for counting fixed orderings of the elements of a list, known as permutations, which can be generated using Permutations. There are permutations of a list of (distinct) elements, a fact that follows from there being spots to place the first element, spots to place the second element once the first is placed, spots to place the third element once the first two elements are placed and so on until a single spot remains in which to place the last element. There are therefore permutations of , namely , , , , and .
- More generally, for an -element multiset having distinct elements with copies of the distinct element (so ), the number of permutations equals the multinomial coefficient , given by Multinomial. The multinomial coefficient also counts the ways to partition an -element set into labeled subsets of sizes n1,…,nk. Hence the binomial coefficient , given by Binomial and defined to count the -element subsets of an -element set, satisfies .
- The factorial function satisfies the recurrences and . It grows faster than any exponential function, as shown by Stirling's approximation . Factorials also appear in fundamental results in number theory and analysis. Wilson's theorem states that if and only if is prime. If is an infinitely differentiable scalar function, then its Taylor series representation about a point (computable using Series) is given by . Setting and in the Taylor series of the exponential function yields the beautiful identity for E (the base of the natural logarithm) .
- Other functions associated with or generalizing Factorial include Factorial2, FactorialPower, , QFactorial, BarnesG and Pochhammer.
Examples
open allclose allBasic Examples (7)
Compute the factorial for the first few integers:
Plot over a subset of the reals:
Plot over a subset of the complexes:
Series expansion at the origin:
Series expansion at Infinity:
Scope (34)
Numerical Evaluation (6)
The precision of the output tracks the precision of the input:
Evaluate efficiently at high precision:
Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:
Or compute average-case statistical intervals using Around:
Compute the elementwise values of an array:
Or compute the matrix Factorial function using MatrixFunction:
Specific Values (5)
Visualization (2)
Function Properties (10)
Factorial threads elementwise over lists:
The factorial has the mirror property :
Factorial is not an analytic function:
However, it is a meromorphic function in the complex plane:
Factorial is neither nondecreasing nor nonincreasing:
Factorial is not injective:
Factorial is not surjective:
Factorial is neither non-negative nor non-positive:
Factorial has both singularity and discontinuity for negative integers:
Factorial is neither convex nor concave:
Differentiation (2)
Series Expansions (5)
Function Representations (2)
Generalizations & Extensions (4)
The precision of the output tracks the precision of the input:
Infinite arguments give symbolic results:
Factorial allows derivatives:
Applications (6)
Make a table of half-integer factorials:
Number of permutations of 6 elements:
Plot of the absolute value of Factorial in the complex plane:
Find the asymptotic expansion of ratios of factorials:
Volume of an n‐dimensional unit hypersphere:
Low‐dimensional cases:
Plot the volume of the unit hypersphere as a function of dimension:
Properties & Relations (9)
Use FullSimplify to simplify expressions involving Factorial:
Compute a generating function sum involving Factorial:
Compute numerical sums involving Factorial:
The generating function is divergent:
Use regularization to obtain a closed-form generating function:
Generating function as a formal series:
Factorial can be represented as a DifferenceRoot:
FindSequenceFunction can recognize the Factorial sequence:
The exponential generating function for Factorial:
Possible Issues (2)
Neat Examples (3)
Text
Wolfram Research (1988), Factorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Factorial.html (updated 2022).
CMS
Wolfram Language. 1988. "Factorial." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Factorial.html.
APA
Wolfram Language. (1988). Factorial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Factorial.html