This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
 3.2.5 Combinatorial Functions Combinatorial functions. The factorial functionn! gives the number of ways of ordering objects. For non-integer , the numerical value of is obtained from the gamma function, discussed in Section 3.2.10. The binomial coefficient Binomial[n,m] can be written as . It gives the number of ways of choosing objects from a collection of objects, without regard to order. The Catalan numbers, which appear in various tree enumeration problems, are given in terms of binomial coefficients as . The multinomial coefficient Multinomial[ , , ... ], denoted , gives the number of ways of partitioning distinct objects into sets of sizes (with ). Mathematica gives the exact integer result for the factorial of an integer. In[1]:= 30! Out[1]= For non-integers, Mathematica evaluates factorials using the gamma function. In[2]:= 3.6! Out[2]= Mathematica can give symbolic results for some binomial coefficients. In[3]:= Binomial[n, 2] Out[3]= This gives the number of ways of partitioning objects into sets containing 6 and 5 objects. In[4]:= Multinomial[6, 5] Out[4]= The result is the same as . In[5]:= Binomial[11, 6] Out[5]= The Fibonacci numbersFibonacci[n] satisfy the recurrence relation with . They appear in a wide range of discrete mathematical problems. For large , approaches the golden ratio. The Fibonacci polynomials Fibonacci[n,x] appear as the coefficients of in the expansion of . The Bernoulli polynomials BernoulliB[n,x] satisfy the generating function relation . The Bernoulli numbers BernoulliB[n] are given by . The appear as the coefficients of the terms in the Euler-Maclaurin summation formula for approximating integrals. Numerical values for Bernoulli numbers are needed in many numerical algorithms. You can always get these numerical values by first finding exact rational results using BernoulliB[ n], and then applying N. The Euler polynomialsEulerE[n,x] have generating function , and the Euler numbers EulerE[n] are given by . The Euler numbers are related to the Genocchi numbers by . This gives the second Bernoulli polynomial . In[6]:= BernoulliB[2, x] Out[6]= You can also get Bernoulli polynomials by explicitly computing the power series for the generating function. In[7]:= Series[t Exp[x t]/(Exp[t] - 1), {t, 0, 4}] Out[7]= BernoulliB[n] gives exact rational-number results for Bernoulli numbers. In[8]:= BernoulliB[20] Out[8]= Stirling numbers show up in many combinatorial enumeration problems. For Stirling numbers of the first kindStirlingS1[n,m], gives the number of permutations of elements which contain exactly cycles. These Stirling numbers satisfy the generating function relation . Note that some definitions of the differ by a factor from what is used in Mathematica. Stirling numbers of the second kind StirlingS2[n,m] give the number of ways of partitioning a set of elements into non-empty subsets. They satisfy the relation . The partition function PartitionsP[n] gives the number of ways of writing the integer n as a sum of positive integers, without regard to order. PartitionsQ[n] gives the number of ways of writing n as a sum of positive integers, with the constraint that all the integers in each sum are distinct. This gives a table of Stirling numbers of the first kind. In[9]:= Table[StirlingS1[5, i], {i, 5}] Out[9]= The Stirling numbers appear as coefficients in this product. In[10]:= Expand[Product[x - i, {i, 0, 4}]] Out[10]= This gives the number of partitions of 100, with and without the constraint that the terms should be distinct. In[11]:= {PartitionsQ[100], PartitionsP[100]} Out[11]= The partition function increases asymptotically like . Note that you cannot simply use Plot to generate a plot of a function like PartitionsP because the function can only be evaluated with integer arguments. In[12]:= ListPlot[ Table[ N[Log[ PartitionsP[n] ]], {n, 100} ] ] The functions in this section allow you to enumerate various kinds of combinatorial objects. Functions like Permutations, discussed in Section 1.8.13, allow you instead to generate lists of various combinations of elements. The signature functionSignature[ , , ... ] gives the signature of a permutation. It is equal to for even permutations (composed of an even number of transpositions), and to for odd permutations. The signature function can be thought of as a totally antisymmetric tensor, Levi-Civita symbol or epsilon symbol. Rotational coupling coefficients. Clebsch-Gordan coefficients and -j symbols arise in the study of angular momenta in quantum mechanics, and in other applications of the rotation group. The Clebsch-Gordan coefficients ClebschGordan[ , , , , j,m ] give the coefficients in the expansion of the quantum mechanical angular momentum state in terms of products of states . The 3-j symbols or Wigner coefficients ThreeJSymbol[ , , , , , ] are a more symmetrical form of Clebsch-Gordan coefficients. In Mathematica, the Clebsch-Gordan coefficients are given in terms of 3-j symbols by . The 6-j symbols SixJSymbol[ , , , , , ] give the couplings of three quantum mechanical angular momentum states. The Racah coefficients are related by a phase to the 6-j symbols. You can give symbolic parameters in 3-j symbols. In[13]:= ThreeJSymbol[{j, m}, {j+1/2, -m-1/2}, {1/2, 1/2}] Out[13]=