Examples of graded modules with basis¶
-
sage.categories.examples.graded_modules_with_basis.
Example
¶ alias of
GradedPartitionModule
-
class
sage.categories.examples.graded_modules_with_basis.
GradedPartitionModule
(base_ring)¶ Bases:
sage.combinat.free_module.CombinatorialFreeModule
This class illustrates an implementation of a graded module with basis: the free module over partitions.
INPUT:
R
- base ring
The implementation involves the following:
A choice of how to represent elements. In this case, the basis elements are partitions. The algebra is constructed as a
CombinatorialFreeModule
on the set of partitions, so it inherits all of the methods for such objects, and has operations like addition already defined.sage: A = GradedModulesWithBasis(QQ).example()
A basis function - this module is graded by the non-negative integers, so there is a function defined in this module, creatively called
basis()
, which takes an integeras input and returns a family of partitions representing a basis for the algebra in degree
.
sage: A.basis(2) Lazy family (Term map from Partitions to An example of a graded module with basis: the free module on partitions over Rational Field(i))_{i in Partitions of the integer 2} sage: A.basis(6)[Partition([3,2,1])] P[3, 2, 1]
If the algebra is called
A
, then its basis function is stored asA.basis
. Thus the function can be used to find a basis for the degreepiece: essentially, just call
A.basis(d)
. More precisely, callx
for eachx
inA.basis(d)
.sage: [m for m in A.basis(4)] [P[4], P[3, 1], P[2, 2], P[2, 1, 1], P[1, 1, 1, 1]]
For dealing with basis elements:
degree_on_basis()
, and_repr_term()
. The first of these defines the degree of any monomial, and then thedegree
method for elements – see the next item – uses it to compute the degree for a linear combination of monomials. The last of these determines the print representation for monomials, which automatically produces the print representation for general elements.sage: A.degree_on_basis(Partition([4,3])) 7 sage: A._repr_term(Partition([4,3])) 'P[4, 3]'
There is a class for elements, which inherits from
CombinatorialFreeModuleElement
. An element is determined by a dictionary whose keys are partitions and whose corresponding values are the coefficients. The class implements two things: anis_homogeneous
method and adegree
method.sage: p = A.monomial(Partition([3,2,1])); p P[3, 2, 1] sage: p.is_homogeneous() True sage: p.degree() 6
-
basis
(d=None)¶ Returns the basis for (an homogeneous component of) this graded module
INPUT:
– non negative integer or
None
, optional (default:None
)
If
is None, returns a basis of the module. Otherwise, returns the basis of the homogeneous component of degree
.
EXAMPLES:
sage: A = GradedModulesWithBasis(ZZ).example() sage: A.basis(4) Lazy family (Term map from Partitions to An example of a graded module with basis: the free module on partitions over Integer Ring(i))_{i in Partitions of the integer 4}
Without arguments, the full basis is returned:
sage: A.basis() Lazy family (Term map from Partitions to An example of a graded module with basis: the free module on partitions over Integer Ring(i))_{i in Partitions} sage: A.basis() Lazy family (Term map from Partitions to An example of a graded module with basis: the free module on partitions over Integer Ring(i))_{i in Partitions}
-
degree_on_basis
(t)¶ The degree of the element determined by the partition
t
in this graded module.INPUT:
t
– the index of an element of the basis of this module, i.e. a partition
OUTPUT: an integer, the degree of the corresponding basis element
EXAMPLES:
sage: A = GradedModulesWithBasis(QQ).example() sage: A.degree_on_basis(Partition((2,1))) 3 sage: A.degree_on_basis(Partition((4,2,1,1,1,1))) 10 sage: type(A.degree_on_basis(Partition((1,1)))) <type 'sage.rings.integer.Integer'>