index of vector in canonical ordering
vector referenced by integer in canonical ordering
list of non-negative integers
These two functions provide a one-to-one correspondence between the non-negative integers and all vectors composed of n non-negative integers.
The one-to-one correspondence is defined as follows. View all vectors of n non-negative integers as exponent vectors on n variables. Therefore, for each vector, there is a corresponding monomial. Collect all such monomials and order them by increasing total degree. Resolve ties by ordering monomials of the same degree in lexicographic order. This gives a canonical ordering.
Given a vector l of n non-negative integers, the corresponding integer m is its index in this canonical ordering. The function vectoint(l) computes and returns this integer m.
Given a non-negative integer m, the corresponding vector l is the m^th vector in this canonical ordering of vectors of length n. The function inttovec(m, n) computes and returns this vector l.
Here is a sample canonical ordering where n is 3:
The command with(combinat,vectoint) allows the use of the abbreviated form of this command.
Download Help Document
What kind of issue would you like to report? (Optional)