Example of a set with grading#

sage.categories.examples.sets_with_grading.Example[source]#

alias of NonNegativeIntegers

class sage.categories.examples.sets_with_grading.NonNegativeIntegers[source]#

Bases: UniqueRepresentation, Parent

Non negative integers graded by themselves.

EXAMPLES:

sage: E = SetsWithGrading().example(); E
Non negative integers
sage: E in Sets().Infinite()
True
sage: E.graded_component(0)
{0}
sage: E.graded_component(100)
{100}
>>> from sage.all import *
>>> E = SetsWithGrading().example(); E
Non negative integers
>>> E in Sets().Infinite()
True
>>> E.graded_component(Integer(0))
{0}
>>> E.graded_component(Integer(100))
{100}
an_element()[source]#

Return 0.

EXAMPLES:

sage: SetsWithGrading().example().an_element()
0
>>> from sage.all import *
>>> SetsWithGrading().example().an_element()
0
generating_series(var='z')[source]#

Return \(1 / (1-z)\).

EXAMPLES:

sage: N = SetsWithGrading().example(); N
Non negative integers
sage: f = N.generating_series(); f
1/(-z + 1)
sage: LaurentSeriesRing(ZZ,'z')(f)
1 + z + z^2 + z^3 + z^4 + z^5 + z^6 + z^7 + z^8 + z^9 + z^10 + z^11 + z^12 + z^13 + z^14 + z^15 + z^16 + z^17 + z^18 + z^19 + O(z^20)
>>> from sage.all import *
>>> N = SetsWithGrading().example(); N
Non negative integers
>>> f = N.generating_series(); f
1/(-z + 1)
>>> LaurentSeriesRing(ZZ,'z')(f)
1 + z + z^2 + z^3 + z^4 + z^5 + z^6 + z^7 + z^8 + z^9 + z^10 + z^11 + z^12 + z^13 + z^14 + z^15 + z^16 + z^17 + z^18 + z^19 + O(z^20)
graded_component(grade)[source]#

Return the component with grade grade.

EXAMPLES:

sage: N = SetsWithGrading().example()
sage: N.graded_component(65)
{65}
>>> from sage.all import *
>>> N = SetsWithGrading().example()
>>> N.graded_component(Integer(65))
{65}
grading(elt)[source]#

Return the grade of elt.

EXAMPLES:

sage: N = SetsWithGrading().example()
sage: N.grading(10)
10
>>> from sage.all import *
>>> N = SetsWithGrading().example()
>>> N.grading(Integer(10))
10