Element structures for Infinite Polynomials over rings with operators

File for the ring structure of Differential polynomials

This file contains all the element structures for Differential polynomials.

AUTHORS:

  • Antonio Jimenez-Pastor (2012-05-19): initial version

dalgebra.rwo_polynomial.rwo_polynomial_element.IndexBijection(size)

Factory for the bijections of a given size.

This method returns a unique bijection object that allow to map integers to tuples of the given size in a specific order. This order tries to have the appearance of all tuples whose sum is fixed as soon as possible.

For example, for size \(3\) the tuples generated would be as follows:

\[(0,0,0) \rightarrow (0,0,1) \rightarrow (0,1,0) \rightarrow (1,0,0) \rightarrow (0,0,2) \rightarrow (0,1,1) \rightarrow (0,2,0) \rightarrow (1,0,1) \rightarrow (1,1,0) \rightarrow (2,0,0) \rightarrow \ldots\]

These bijections cache some of its results, hence the convenience of always returning the same bijection object.

INPUT:

  • size: number of elements of the tuples generated by the bijection.

OUTPUT:

A IndexBijection_Object with the given bijection.

EXAMPLES:

sage: from dalgebra.rwo_polynomial.rwo_polynomial_element import IndexBijection
sage: size2 = IndexBijection(2)
sage: size2(0)
(0, 0)
sage: size2(10)
(0, 4)
sage: size2(100)
(9, 4)
sage: size4 = IndexBijection(4)
sage: [size4(i) for i in range(5)]
[(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 0), (0, 1, 0, 0), (1, 0, 0, 0)]

Since we have a bijection, we can also go back:

sage: IndexBijection(10).inverse((1,2,3,4,5,6,7,8,9,10)) # around 2ms 156289762326