To take the quizzes, you must log in.

*Username:***student***Password:***Formulas.1**You can view this site in

the language of your choice.

- fact()
### fact()

# fact()

fact(expr0) ⇒ number

The fact() function returns the factorial of the argument as a number. The corresponding mathematical notation is:

fact(n)

In mathematics, the factorial of a non-negative integer

*n*, denoted by*n*!, is the product of all positive integers less than or equal to*n*. For example,The value of 0! is 1, according to the convention for an empty product. (Reference: Wikipedia).

With the built-in function fact(), the Formulas question calculates factorial values up to (which would correspond to the largest number that can be handled by PHP). For larger values of

*n*, fact() returns INF for the value of*n*!. However input, with {_0}, {_1}, etc., is limited to a maximum value corresponding toUse the calculator at the top right to find the factorial of a number.

## Scientific calculator

## Examples

#### Example

This example illustrates the use of the fact() function.

General Question name! Factorial - simple example Variables Random variables n = {2:8}; m = {2:8}; Global variables x = fact(n)*fact(m); Main question Question text! Factorial Part 1 Part's mark* 1 Answer type Number Answer* x Grading criteria* Absolute error == 0 Part's text Calculate: (answer using integer format) {n}! x {m}! = {_0} Combined feedback For any correct response The correct answer is: {x} For any incorrect response The correct answer is: {x}

The Formulas question should look like this:

#### Example

This example shows that the fact() function can handle large factorials and that calculations with factorials can easily be performed.

General Question name! Large factorials Variables Random variables n = {0:171:1}; nn = {12:171:1}; na = {1:10}; m = {0:103:1}; Global variables x=fact(m); Main question Question text! Factorial Part 1 Part's mark* 1 Answer type Number Answer* x Grading criteria* Relative error < 0.01 Part's text 1. Calculate: (use scientific notation for large numbers) {m}! = {_0} 2. It can easily be shown that {nn}! / {=nn-na}! = {=fact(nn)/fact(nn-na)}. Combined feedback For any correct response The correct answer is: {x} For any incorrect response The correct answer is: {x}

The Formulas question should look like this:

## References