Function File: [c alpha] = multinom_coeff (m, n)
Function File: [c alpha] = multinom_coeff (m, n,order)
Produces the coefficients of the multinomial expansion
(x1 + x2 + ... + xm).^nFor example, for m=3, n=3 the expansion is
(x1+x2+x3)^3 = = x1^3 + x2^3 + x3^3 + + 3 x1^2 x2 + 3 x1^2 x3 + 3 x2^2 x1 + 3 x2^2 x3 + + 3 x3^2 x1 + 3 x3^2 x2 + 6 x1 x2 x3and the coefficients are [6 3 3 3 3 3 3 1 1 1].
The order of the coefficients is defined by the optinal argument order. It is passed to the function
multion_exp
. See the help of that function for explanation. The multinomial coefficients are generated using/ \ | n | n! | | = ------------------------ | k | k(1)!k(2)! ... k(end)! \ /See also: multinom multinom_exp
The following code
multinom_coeff(3,3) multinom_coeff(3,3,'ascend') multinom_coeff(3,3,'descend')
Produces the following output
ans = 1 3 3 3 6 3 1 3 3 1 ans = 6 3 3 3 3 3 3 1 1 1 ans = 1 1 1 3 3 3 3 3 3 6
Package: specfun