inttovec - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


combinat

  

vectoint

  

index of vector in canonical ordering

  

inttovec

  

vector referenced by integer in canonical ordering

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

vectoint(l)

inttovec(m, n)

Parameters

l

-

list of non-negative integers

m

-

non-negative integer

n

-

non-negative integer

Description

• 

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:

Vector

Number

Monomial

 

 

 

[0,0,0]

0

1

[1,0,0]

1

x

[0,1,0]

2

y

[0,0,1]

3

z

[2,0,0]

4

x^2

[1,1,0]

5

x*y

[1,0,1]

6

x*z

[0,2,0]

7

y^2

...

...

...

• 

The command with(combinat,vectoint) allows the use of the abbreviated form of this command.

Examples

withcombinat:

vectoint1,0,1

6

(1)

inttovec6,3

1,0,1

(2)

See Also

combinat[decodepart]

combinat[encodepart]