Subfactorial

Subfactorial[n]

gives the number of permutations of n objects that leave no object fixed.

Details

  • Mathematical function, suitable for both symbolic and numerical manipulation.
  • For noninteger n, the numerical value of Subfactorial[n] is given by Gamma[n+1,-1]/E.
  • Subfactorial can be evaluated to arbitrary numerical precision.
  • A permutation in which no object appears in its natural place is called a derangement. The subfactorial counts the number of derangements.
  • Subfactorial automatically threads over lists. »
  • Subfactorial[0] gives 1.
  • Subfactorial can be used with CenteredInterval objects. »

Examples

open allclose all

Basic Examples  (5)

Evaluate numerically:

Plot the values on a log scale over a subset of the reals:

Plot over a subset of the complexes:

Series expansion at the origin:

Series expansion at Infinity:

Scope  (28)

Numerical Evaluation  (7)

Evaluate numerically:

Evaluate to high precision:

The precision of the output tracks the precision of the input:

Complex number input:

Evaluate efficiently at high precision:

Subfactorial automatically threads over lists:

Compute the elementwise values of an array using automatic threading:

Or compute the matrix Subfactorial function using MatrixFunction:

Subfactorial can be used with CenteredInterval objects:

Specific Values  (5)

Values of Subfactorial at fixed points:

Value at zero:

Evaluate symbolically:

Limiting values at infinity:

Find a value of for which the real part of Subfactorial[x] is equal to 5:

Visualization  (2)

Plot the absolute value of Subfactorial:

Plot the real part of Subfactorial[z]:

Plot the imaginary part of Subfactorial[z]:

Function Properties  (6)

Real domain of Subfactorial:

Complex domain:

Subfactorial is not an analytic function on :

In fact, it is singular and discontinuous everywhere on the reals:

The reason is that it is only real valued at isolated points:

However, it is analytic in the complex plane:

The imaginary part of Subfactorial is not injective:

The imaginary part of Subfactorial is not surjective:

The real part of Subfactorial is neither non-negative nor non-positive:

The real part of Subfactorial is neither convex nor concave:

Differentiation  (2)

First derivative with respect to :

Higher derivatives with respect to :

Plot the higher derivatives with respect to :

Series Expansions  (3)

Find the Taylor expansion using Series:

Plots of the first three approximations around :

Find the series expansion at Infinity:

Taylor expansion at a generic point:

Recurrence Identities and Simplifications  (3)

One-step recurrence relation:

Two-step recurrence relation:

On the positive integers, Subfactorial[n]==Round[n!/E]:

Applications  (1)

There are 9 derangements of a set of 4 objects:

Here are all permutations of the set {1,2,3,4}:

Delete all permutations where an object is fixed:

Check that there are only 9 derangements:

Properties & Relations  (5)

Subfactorial[n] is given by :

Recurrence relations satisfied by Subfactorial:

Subfactorial can be represented as a DifferenceRoot:

FindSequenceFunction can recognize the Subfactorial sequence:

The exponential generating function for Subfactorial:

Neat Examples  (1)

The only number equal to the sum of subfactorials of its digits:

Wolfram Research (2007), Subfactorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Subfactorial.html.

Text

Wolfram Research (2007), Subfactorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Subfactorial.html.

CMS

Wolfram Language. 2007. "Subfactorial." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Subfactorial.html.

APA

Wolfram Language. (2007). Subfactorial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Subfactorial.html

BibTeX

@misc{reference.wolfram_2024_subfactorial, author="Wolfram Research", title="{Subfactorial}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Subfactorial.html}", note=[Accessed: 03-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_subfactorial, organization={Wolfram Research}, title={Subfactorial}, year={2007}, url={https://reference.wolfram.com/language/ref/Subfactorial.html}, note=[Accessed: 03-December-2024 ]}