Special Functions

Factorial

["Factorial", n]

n!
\[ n! \]
["Factorial", 5]
// -> 120

Factorial2

["Factorial2", n]

The double factorial of n: \( n!! = n \cdot (n-2) \cdot (n-4) \times \cdots\), that is the product of all the positive integers up to n that have the same parity (odd or even) as n.

n!!
\[ n!! \]
["Factorial2", 5]
// -> 15

It can also be written in terms of the \( \Gamma \) function:

\n!! = [ 2^{\frac{n}{2}+\frac{1}{4}(1-\cos(\pi n))}\pi^{\frac{1}{4}(\cos(\pi n)-1)}\Gamma\left(\frac{n}{2}+1\right) \]

This is not the same as the factorial of the factorial of n (i.e. \((n!)!)\)).

Reference

Gamma

["Gamma", z]

\Gamma(n) = (n-1)!
\[ \Gamma(n) = (n-1)! \]

The Gamma Function is an extension of the factorial function, with its argument shifted by 1, to real and complex numbers.

\[ \operatorname{\Gamma}\left(z\right) = \int\limits_{0}^{\infty} t^{z-1} \mathrm{e}^{-t} , \mathrm{d}t \]

  • Wikidata: Q190573
  • NIST: http://dlmf.nist.gov/5.2.E1
["Gamma", 5]
// 24

GammaLn

["GammaLn", z]

\ln(\gamma(z))
\[ \ln(\gamma(z)) \]

This function is called gammaln in MatLab and SciPy and LogGamma in Mathematica.