The category of graded modules with a distinguished basis.

EXAMPLES:

sage: C = GradedModulesWithBasis(ZZ); C
Category of graded modules with basis over Integer Ring
sage: sorted(C.super_categories(), key=str)
[Category of graded modules over Integer Ring,
Category of modules with basis over Integer Ring]
True


TESTS:

sage: TestSuite(C).run()

class ElementMethods
degree()

The degree of this element in the graded module.

Note

This raises an error if the element is not homogeneous. Another implementation option would be to return the maximum of the degrees of the homogeneous summands.

EXAMPLES:

sage: A = GradedModulesWithBasis(ZZ).example()
sage: x = A(Partition((3,2,1)))
sage: y = A(Partition((4,4,1)))
sage: z = A(Partition((2,2,2)))
sage: x.degree()
6
sage: (x + 2*z).degree()
6
sage: (y - x).degree()
Traceback (most recent call last):
...
ValueError: Element is not homogeneous.

homogeneous_component(n)

Return the homogeneous component of degree n of this element.

EXAMPLES:

sage: A = GradedModulesWithBasis(ZZ).example()
sage: x = A.an_element(); x
2*P[] + 2*P[1] + 3*P[2]
sage: x.homogeneous_component(-1)
0
sage: x.homogeneous_component(0)
2*P[]
sage: x.homogeneous_component(1)
2*P[1]
sage: x.homogeneous_component(2)
3*P[2]
sage: x.homogeneous_component(3)
0


TESTS:

Check that this really return A.zero() and not a plain 0:

sage: x.homogeneous_component(3).parent() is A
True

is_homogeneous()

Return whether this element is homogeneous.

EXAMPLES:

sage: A = GradedModulesWithBasis(ZZ).example()
sage: x=A(Partition((3,2,1)))
sage: y=A(Partition((4,4,1)))
sage: z=A(Partition((2,2,2)))
sage: (3*x).is_homogeneous()
True
sage: (x - y).is_homogeneous()
False
sage: (x+2*z).is_homogeneous()
True

truncate(n)

Return the sum of the homogeneous components of degree < n of this element

EXAMPLES:

sage: A = GradedModulesWithBasis(ZZ).example()
sage: x = A.an_element(); x
2*P[] + 2*P[1] + 3*P[2]
sage: x.truncate(0)
0
sage: x.truncate(1)
2*P[]
sage: x.truncate(2)
2*P[] + 2*P[1]
sage: x.truncate(3)
2*P[] + 2*P[1] + 3*P[2]


TESTS:

Check that this really return A.zero() and not a plain 0:

sage: x.truncate(0).parent() is A
True

basis(d=None)

Returns the basis for (an homogeneous component of) this graded module

INPUT:

• $$d$$ – non negative integer or None, optional (default: None)

If $$d$$ is None, returns a basis of the module. Otherwise, returns the basis of the homogeneous component of degree $$d$$.

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}