FACTORIAL

Purpose:

Calculates the factorial for positive integers.

Syntax:

FACTORIAL(n)

n

-

A scalar or series. Must contain integer values n >= 0.

Returns:

A scalar or series.

Example:

factorial(6)

 

returns 720.

Example:

W1: 0..10

W2: factorial(W1)

 

W2 == {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800}

Remarks:

For integer n, FACTORIAL returns the product of all integer values 1..n, thus:

 

factorial(n) == prod(1..n)

 

For a series, FACTORIAL returns the factorial for each element.

 

Using double precision accuracy, FACTORIAL is precise up to n == 21 and will retain 15 digits of accuracy for n > 21

 

See GAMMA for a generalized factorial function that operates on real or complex input values.

See Also:

BINCOEFF

GAMMA

NCHOOSEK

PARTPROD

PROD