Maxima Operator
!
The factorial operator.
For any complex number x
(including integer, rational, and real numbers) except for
negative integers, x!
is defined as gamma(x+1)
.
For an integer x
, x!
simplifies to the product of the integers from 1 to x
inclusive.
0!
simplifies to 1.
For a floating point number x
, x!
simplifies to the value of gamma (x+1)
.
For x
equal to n/2
where n
is an odd integer,
x!
simplifies to a rational factor times sqrt (%pi)
(since gamma (1/2)
is equal to sqrt (%pi)
).
If x
is anything else,
x!
is not simplified.
The variables
factlim
, minfactorial
, and factcomb
control the simplification
of expressions containing factorials.
The functions gamma
, bffac
, and cbffac
are varieties of the gamma function.
makegamma
substitutes gamma
for factorials and related functions.
The factorial of an integer, half-integer, or floating point argument is simplified
unless the operand is greater than factlim
.
(%i1) factlim : 10; (%o1) 10 (%i2) [0!, (7/2)!, 4.77!, 8!, 20!]; 105 sqrt(%pi) (%o2) [1, -------------, 81.44668037931199, 40320, 20!] 16
The factorial of a complex number, known constant, or general expression is not simplified. Even so it may be possible simplify the factorial after evaluating the operand.
(%i1) [(%i + 1)!, %pi!, %e!, (cos(1) + sin(1))!]; (%o1) [(%i + 1)!, %pi!, %e!, (sin(1) + cos(1))!] (%i2) ev (%, numer, %enumer); (%o2) [(%i + 1)!, 7.188082728976037, 4.260820476357, 1.227580202486819]
The factorial of an unbound symbol is not simplified.
(%i1) kill (foo); (%o1) done (%i2) foo!; (%o2) foo!
Factorials are simplified, not evaluated.
Thus x!
may be replaced even in a quoted expression.
(%i1) '([0!, (7/2)!, 4.77!, 8!, 20!]); 105 sqrt(%pi) (%o1) [1, -------------, 81.44668037931199, 40320, 16 2432902008176640000]