Function

nerdamer.dfactorial

src/index.ts:791
nerdamer.dfactorial(x: Expression): Expression

Computes the double factorial of an expression. For a non-negative integer n, the double factorial is the product of all positive integers up to n that share its parity: - Even:

`n!! = 2 · 4 · 6 · … · n`

- Odd:

`n!! = 1 · 3 · 5 · … · n`

For non-integer arguments when

`Settings.EVALUATE`

is

`true`

, a generalised formula using the gamma function is applied.

throws

UndefinedError If

`x`

is

`-∞`

.

Parameters

NameTypeDescription
xExpressionThe expression to compute the double factorial of.

Returns

Expression — The double factorial of `x`.

Examples

doubleFactorial(Expression.create(6)).text()   // "48"
doubleFactorial(Expression.create(7)).text()   // "105"