Navigation

Operators and Keywords

Function List:

C++ API

Function File: alpha = multinom_exp (m, n)

Function File: alpha = multinom_exp (m, n,sort)

Returns the exponents of the terms in the multinomial expansion

          (x1 + x2 + ... + xm).^n

For example, for m=2, n=3 the expansion has the terms

          x1^3, x2^3, x1^2*x2, x1*x2^2

then alpha = [3 0; 2 1; 1 2; 0 3];

The optional argument sort is passed to function sort to sort the exponents by the maximum degree. The example above calling multinom(m,n,"ascend") produces

alpha = [2 1; 1 2; 3 0; 0 3];

calling multinom(m,n,"descend") produces

alpha = [3 0; 0 3; 2 1; 1 2];

Demonstration 1

The following code

 m=2;
 n=3;
 alpha = multinom_exp(m,n)
 alpha_asc = multinom_exp(m,n,'ascend')
 alpha_dec = multinom_exp(m,n,'descend')

Produces the following output

alpha =

   3   0
   2   1
   1   2
   0   3

alpha_asc =

   2   1
   1   2
   3   0
   0   3

alpha_dec =

   3   0
   0   3
   2   1
   1   2

Package: specfun