Sponsored links: Algebra eBooks ### The Maxima on-line user's manual

Algebra Calculator

#### Search: #### Factorial

Function: factorial (<x>) Represents the factorial function. Maxima treats `factorial (<x>)` the same as `<x>!`. See `!`. -- Operator: ! The factorial operator.

For any complex number `x`, 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 real or complex number in float or bigfloat precision `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)`).`

The option variables `factlim` and `gammalim` control the numerical evaluation of factorials for integer and rational arguments. The functions `minfactorial` and `factcomb` simplifies expressions containing factorials. See `factlim`, `gammalim`, `minfactorial` and `factcomb`.

The functions `gamma`, `bffac`, and `cbffac` are varieties of the gamma function. `bffac` and `cbffac` are called internally by `gamma` to evaluate the gamma function for real and complex numbers in bigfloat precision.

`makegamma` substitutes `gamma` for factorials and related functions.

Maxima knows the derivative of the factorial function and the limits for specific values like negative integers.

The option variable `factorial_expand` controls the simplification of expressions like `(n+x)!`, where `n` is an integer.

See also `binomial`.

The factorial of an integer is simplified to an exact number unless the operand is greater than `factlim`. The factorial for real and complex numbers is evaluated in float or bigfloat precision.

```          (%i1) factlim:10;
(%o1)                                 10
(%i2) [0!, (7/2)!, 8!, 20!];
105 sqrt(%pi)
(%o2)                   [1, -------------, 40320, 20!]
16
(%i3) [4.77!, (1.0+%i)!];
(%o3)    [81.44668037931197,
.3430658398165454 %i + .6529654964201665]
(%i4) [2.86b0!, (1.0b0+%i)!];
(%o4) [5.046635586910012b0,
3.430658398165454b-1 %i + 6.529654964201667b-1]```

The factorial of a known constant, or general expression is not simplified. Even so it may be possible to 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) [.3430658398165454 %i + .6529654964201665,
7.188082728976031,
4.260820476357003, 1.227580202486819]```

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]```

Maxima knows the derivative of the factorial function.

```          (%i1) diff(x!,x);
(%o1)                           x! psi (x + 1)
0```

The option variable `factorial_expand` controls expansion and simplification of expressions with the factorial function.

```          (%i1) (n+1)!/n!,factorial_expand:true;
(%o1)                                n + 1```

There are also some inexact matches for `factorial`. Try `?? factorial` to see them.

```(%o1)                                true
(%i2) ```

### Related Examples

##### factorial

g:0;

(-1)^(g+j) /(factoria...

Calculate

currentN = 5;

currentPx = 0.1;

currentn = 2;

Calculate

##### factorial-plot2d-sin-sum s:sum((-1)^n*x^(2*n+1...

plot2d(s-sin(x),[x,10...

Calculate

##### factorial

factorial (17) / (fac...

Calculate

##### factorial-inf-sum

simplify_sum(sum(1/fa...

Calculate

##### factorial-inf-limit-log-sqrt

limit ( (sqrt(log(n))...

limit ( (log(n)) / (l...

limit ( (log(n)^2) / ...

Calculate

##### factorial-plot2d-sin-sum f(x):=sin(x);

g(n,x):=sum((-1)^i*(-...

plot2d([f(x),g(2,x)],...

Calculate

##### factorial-inf-limit-sum

S : sum(20^k/factoria...

limit(S, n, inf);

Calculate

factorial(20);

Calculate

##### factorial-plot2d-sum s:sum((-1)^n*x^(2*n+1...

plot2d(s,[x,-%pi,%pi]);

Calculate 