Non Negative Integer Semiring¶
- class sage.rings.semirings.non_negative_integer_semiring.NonNegativeIntegerSemiring[source]¶
Bases:
NonNegativeIntegersA class for the semiring of the non negative integers
This parent inherits from the infinite enumerated set of non negative integers and endows it with its natural semiring structure.
EXAMPLES:
sage: NonNegativeIntegerSemiring() Non negative integer semiring
>>> from sage.all import * >>> NonNegativeIntegerSemiring() Non negative integer semiring
For convenience,
NNis a shortcut forNonNegativeIntegerSemiring():sage: NN == NonNegativeIntegerSemiring() True sage: NN.category() Category of facade infinite enumerated commutative semirings
>>> from sage.all import * >>> NN == NonNegativeIntegerSemiring() True >>> NN.category() Category of facade infinite enumerated commutative semirings
Here is a piece of the Cayley graph for the multiplicative structure:
sage: G = NN.cayley_graph(elements=range(9), generators=[0,1,2,3,5,7]) # needs sage.graphs sage: G # needs sage.graphs Looped multi-digraph on 9 vertices sage: G.plot() # needs sage.graphs sage.plot Graphics object consisting of 48 graphics primitives
>>> from sage.all import * >>> G = NN.cayley_graph(elements=range(Integer(9)), generators=[Integer(0),Integer(1),Integer(2),Integer(3),Integer(5),Integer(7)]) # needs sage.graphs >>> G # needs sage.graphs Looped multi-digraph on 9 vertices >>> G.plot() # needs sage.graphs sage.plot Graphics object consisting of 48 graphics primitives
This is the Hasse diagram of the divisibility order on
NN.sage: Poset(NN.cayley_graph(elements=[1..12], generators=[2,3,5,7,11])).show() # needs sage.combinat sage.graphs sage.plot
Note: as for
NonNegativeIntegers,NNis currently just a “facade” parent; namely its elements are plain SageIntegerswithInteger Ringas parent:sage: x = NN(15); type(x) <class 'sage.rings.integer.Integer'> sage: x.parent() Integer Ring sage: x+3 18
>>> from sage.all import * >>> x = NN(Integer(15)); type(x) <class 'sage.rings.integer.Integer'> >>> x.parent() Integer Ring >>> x+Integer(3) 18