Additive magmas¶
- class sage.categories.additive_magmas.AdditiveMagmas[source]¶
- Bases: - Category_singleton- The category of additive magmas. - An additive magma is a set endowed with a binary operation \(+\). - EXAMPLES: - sage: AdditiveMagmas() Category of additive magmas sage: AdditiveMagmas().super_categories() [Category of sets] sage: AdditiveMagmas().all_super_categories() [Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects] - >>> from sage.all import * >>> AdditiveMagmas() Category of additive magmas >>> AdditiveMagmas().super_categories() [Category of sets] >>> AdditiveMagmas().all_super_categories() [Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects] - The following axioms are defined by this category: - sage: AdditiveMagmas().AdditiveAssociative() Category of additive semigroups sage: AdditiveMagmas().AdditiveUnital() Category of additive unital additive magmas sage: AdditiveMagmas().AdditiveCommutative() Category of additive commutative additive magmas sage: AdditiveMagmas().AdditiveUnital().AdditiveInverse() Category of additive inverse additive unital additive magmas sage: C = AdditiveMagmas().AdditiveAssociative().AdditiveCommutative(); C Category of commutative additive semigroups sage: C.AdditiveUnital() Category of commutative additive monoids sage: C.AdditiveUnital().AdditiveInverse() Category of commutative additive groups - >>> from sage.all import * >>> AdditiveMagmas().AdditiveAssociative() Category of additive semigroups >>> AdditiveMagmas().AdditiveUnital() Category of additive unital additive magmas >>> AdditiveMagmas().AdditiveCommutative() Category of additive commutative additive magmas >>> AdditiveMagmas().AdditiveUnital().AdditiveInverse() Category of additive inverse additive unital additive magmas >>> C = AdditiveMagmas().AdditiveAssociative().AdditiveCommutative(); C Category of commutative additive semigroups >>> C.AdditiveUnital() Category of commutative additive monoids >>> C.AdditiveUnital().AdditiveInverse() Category of commutative additive groups - AdditiveAssociative[source]¶
- alias of - AdditiveSemigroups
 - class AdditiveCommutative(base_category)[source]¶
- Bases: - CategoryWithAxiom_singleton- class Algebras(category, *args)[source]¶
- Bases: - AlgebrasCategory- extra_super_categories()[source]¶
- Implement the fact that the algebra of a commutative additive magmas is commutative. - EXAMPLES: - sage: C = AdditiveMagmas().AdditiveCommutative().Algebras(QQ) sage: C.extra_super_categories() [Category of commutative magmas] sage: C.super_categories() [Category of additive magma algebras over Rational Field, Category of commutative magmas] - >>> from sage.all import * >>> C = AdditiveMagmas().AdditiveCommutative().Algebras(QQ) >>> C.extra_super_categories() [Category of commutative magmas] >>> C.super_categories() [Category of additive magma algebras over Rational Field, Category of commutative magmas] 
 
 - class CartesianProducts(category, *args)[source]¶
- Bases: - CartesianProductsCategory- extra_super_categories()[source]¶
- Implement the fact that a Cartesian product of commutative additive magmas is a commutative additive magma. - EXAMPLES: - sage: C = AdditiveMagmas().AdditiveCommutative().CartesianProducts() sage: C.extra_super_categories() [Category of additive commutative additive magmas] sage: C.axioms() frozenset({'AdditiveCommutative'}) - >>> from sage.all import * >>> C = AdditiveMagmas().AdditiveCommutative().CartesianProducts() >>> C.extra_super_categories() [Category of additive commutative additive magmas] >>> C.axioms() frozenset({'AdditiveCommutative'}) 
 
 
 - class AdditiveUnital(base_category)[source]¶
- Bases: - CategoryWithAxiom_singleton- class AdditiveInverse(base_category)[source]¶
- Bases: - CategoryWithAxiom_singleton- class CartesianProducts(category, *args)[source]¶
- Bases: - CartesianProductsCategory- extra_super_categories()[source]¶
- Implement the fact that a Cartesian product of additive magmas with inverses is an additive magma with inverse. - EXAMPLES: - sage: C = AdditiveMagmas().AdditiveUnital().AdditiveInverse().CartesianProducts() sage: C.extra_super_categories() [Category of additive inverse additive unital additive magmas] sage: sorted(C.axioms()) ['AdditiveInverse', 'AdditiveUnital'] - >>> from sage.all import * >>> C = AdditiveMagmas().AdditiveUnital().AdditiveInverse().CartesianProducts() >>> C.extra_super_categories() [Category of additive inverse additive unital additive magmas] >>> sorted(C.axioms()) ['AdditiveInverse', 'AdditiveUnital'] 
 
 
 - class Algebras(category, *args)[source]¶
- Bases: - AlgebrasCategory- class ParentMethods[source]¶
- Bases: - object- one_basis()[source]¶
- Return the zero of this additive magma, which index the one of this algebra, as per - AlgebrasWithBasis.ParentMethods.one_basis().- EXAMPLES: - sage: # needs sage.modules sage: S = CommutativeAdditiveMonoids().example(); S An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd') sage: A = S.algebra(ZZ) sage: A.one_basis() 0 sage: A.one() B[0] sage: A(3) 3*B[0] - >>> from sage.all import * >>> # needs sage.modules >>> S = CommutativeAdditiveMonoids().example(); S An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd') >>> A = S.algebra(ZZ) >>> A.one_basis() 0 >>> A.one() B[0] >>> A(Integer(3)) 3*B[0] 
 
 - extra_super_categories()[source]¶
- EXAMPLES: - sage: C = AdditiveMagmas().AdditiveUnital().Algebras(QQ) sage: C.extra_super_categories() [Category of unital magmas] sage: C.super_categories() [Category of additive magma algebras over Rational Field, Category of unital algebras with basis over Rational Field] - >>> from sage.all import * >>> C = AdditiveMagmas().AdditiveUnital().Algebras(QQ) >>> C.extra_super_categories() [Category of unital magmas] >>> C.super_categories() [Category of additive magma algebras over Rational Field, Category of unital algebras with basis over Rational Field] 
 
 - class CartesianProducts(category, *args)[source]¶
- Bases: - CartesianProductsCategory- extra_super_categories()[source]¶
- Implement the fact that a Cartesian product of unital additive magmas is a unital additive magma. - EXAMPLES: - sage: C = AdditiveMagmas().AdditiveUnital().CartesianProducts() sage: C.extra_super_categories() [Category of additive unital additive magmas] sage: C.axioms() frozenset({'AdditiveUnital'}) - >>> from sage.all import * >>> C = AdditiveMagmas().AdditiveUnital().CartesianProducts() >>> C.extra_super_categories() [Category of additive unital additive magmas] >>> C.axioms() frozenset({'AdditiveUnital'}) 
 
 - class Homsets(category, *args)[source]¶
- Bases: - HomsetsCategory- class ParentMethods[source]¶
- Bases: - object- zero()[source]¶
- EXAMPLES: - sage: R = QQ['x'] sage: H = Hom(ZZ, R, AdditiveMagmas().AdditiveUnital()) sage: f = H.zero() sage: f Generic morphism: From: Integer Ring To: Univariate Polynomial Ring in x over Rational Field sage: f(3) 0 sage: f(3) is R.zero() True - >>> from sage.all import * >>> R = QQ['x'] >>> H = Hom(ZZ, R, AdditiveMagmas().AdditiveUnital()) >>> f = H.zero() >>> f Generic morphism: From: Integer Ring To: Univariate Polynomial Ring in x over Rational Field >>> f(Integer(3)) 0 >>> f(Integer(3)) is R.zero() True 
 
 - extra_super_categories()[source]¶
- Implement the fact that a homset between two unital additive magmas is a unital additive magma. - EXAMPLES: - sage: AdditiveMagmas().AdditiveUnital().Homsets().extra_super_categories() [Category of additive unital additive magmas] sage: AdditiveMagmas().AdditiveUnital().Homsets().super_categories() [Category of additive unital additive magmas, Category of homsets] - >>> from sage.all import * >>> AdditiveMagmas().AdditiveUnital().Homsets().extra_super_categories() [Category of additive unital additive magmas] >>> AdditiveMagmas().AdditiveUnital().Homsets().super_categories() [Category of additive unital additive magmas, Category of homsets] 
 
 - class ParentMethods[source]¶
- Bases: - object- is_empty()[source]¶
- Return whether this set is empty. - Since this set is an additive magma it has a zero element and hence is not empty. This method thus always returns - False.- EXAMPLES: - sage: # needs sage.modules sage: A = AdditiveAbelianGroup([3, 3]) sage: A in AdditiveMagmas() True sage: A.is_empty() False sage: B = CommutativeAdditiveMonoids().example() sage: B.is_empty() False - >>> from sage.all import * >>> # needs sage.modules >>> A = AdditiveAbelianGroup([Integer(3), Integer(3)]) >>> A in AdditiveMagmas() True >>> A.is_empty() False >>> B = CommutativeAdditiveMonoids().example() >>> B.is_empty() False 
 - zero()[source]¶
- Return the zero of this additive magma, that is the unique neutral element for \(+\). - The default implementation is to coerce - 0into- self.- It is recommended to override this method because the coercion from the integers: - is not always meaningful (except for \(0\)), and 
- often uses - self.zero()otherwise.
 - EXAMPLES: - sage: S = CommutativeAdditiveMonoids().example() sage: S.zero() 0 - >>> from sage.all import * >>> S = CommutativeAdditiveMonoids().example() >>> S.zero() 0 
 
 - class SubcategoryMethods[source]¶
- Bases: - object- AdditiveInverse()[source]¶
- Return the full subcategory of the additive inverse objects of - self.- An inverse - additive magmais a- unital additive magmasuch that every element admits both an additive inverse on the left and on the right. Such an additive magma is also called an additive loop.- EXAMPLES: - sage: AdditiveMagmas().AdditiveUnital().AdditiveInverse() Category of additive inverse additive unital additive magmas sage: from sage.categories.additive_monoids import AdditiveMonoids sage: AdditiveMonoids().AdditiveInverse() Category of additive groups - >>> from sage.all import * >>> AdditiveMagmas().AdditiveUnital().AdditiveInverse() Category of additive inverse additive unital additive magmas >>> from sage.categories.additive_monoids import AdditiveMonoids >>> AdditiveMonoids().AdditiveInverse() Category of additive groups 
 
 - class WithRealizations(category, *args)[source]¶
- Bases: - WithRealizationsCategory- class ParentMethods[source]¶
- Bases: - object- zero()[source]¶
- Return the zero of this unital additive magma. - This default implementation returns the zero of the realization of - selfgiven by- a_realization().- EXAMPLES: - sage: A = Sets().WithRealizations().example(); A # needs sage.modules The subset algebra of {1, 2, 3} over Rational Field sage: A.zero.__module__ # needs sage.modules 'sage.categories.additive_magmas' sage: A.zero() # needs sage.modules 0 - >>> from sage.all import * >>> A = Sets().WithRealizations().example(); A # needs sage.modules The subset algebra of {1, 2, 3} over Rational Field >>> A.zero.__module__ # needs sage.modules 'sage.categories.additive_magmas' >>> A.zero() # needs sage.modules 0 
 
 
 - additional_structure()[source]¶
- Return whether - selfis a structure category.- See also - The category of unital additive magmas defines the zero as additional structure, and this zero shall be preserved by morphisms. - EXAMPLES: - sage: AdditiveMagmas().AdditiveUnital().additional_structure() Category of additive unital additive magmas - >>> from sage.all import * >>> AdditiveMagmas().AdditiveUnital().additional_structure() Category of additive unital additive magmas 
 
 - class Algebras(category, *args)[source]¶
- Bases: - AlgebrasCategory- class ParentMethods[source]¶
- Bases: - object- algebra_generators()[source]¶
- The generators of this algebra, as per - MagmaticAlgebras.ParentMethods.algebra_generators().- They correspond to the generators of the additive semigroup. - EXAMPLES: - sage: S = CommutativeAdditiveSemigroups().example(); S An example of a commutative semigroup: the free commutative semigroup generated by ('a', 'b', 'c', 'd') sage: A = S.algebra(QQ) # needs sage.modules sage: A.algebra_generators() # needs sage.modules Family (B[a], B[b], B[c], B[d]) - >>> from sage.all import * >>> S = CommutativeAdditiveSemigroups().example(); S An example of a commutative semigroup: the free commutative semigroup generated by ('a', 'b', 'c', 'd') >>> A = S.algebra(QQ) # needs sage.modules >>> A.algebra_generators() # needs sage.modules Family (B[a], B[b], B[c], B[d]) - Todo - This doctest does not actually test this method, but rather the method of the same name for - AdditiveSemigroups. Find a better doctest!
 - product_on_basis(g1, g2)[source]¶
- Product, on basis elements, as per - MagmaticAlgebras.WithBasis.ParentMethods.product_on_basis().- The product of two basis elements is induced by the addition of the corresponding elements of the group. - EXAMPLES: - sage: S = CommutativeAdditiveSemigroups().example(); S An example of a commutative semigroup: the free commutative semigroup generated by ('a', 'b', 'c', 'd') sage: A = S.algebra(QQ) # needs sage.modules sage: a, b, c, d = A.algebra_generators() # needs sage.modules sage: a * d * b # needs sage.modules B[a + b + d] - >>> from sage.all import * >>> S = CommutativeAdditiveSemigroups().example(); S An example of a commutative semigroup: the free commutative semigroup generated by ('a', 'b', 'c', 'd') >>> A = S.algebra(QQ) # needs sage.modules >>> a, b, c, d = A.algebra_generators() # needs sage.modules >>> a * d * b # needs sage.modules B[a + b + d] - Todo - This doctest does not actually test this method, but rather the method of the same name for - AdditiveSemigroups. Find a better doctest!
 
 - extra_super_categories()[source]¶
- EXAMPLES: - sage: AdditiveMagmas().Algebras(QQ).extra_super_categories() [Category of magmatic algebras with basis over Rational Field] sage: AdditiveMagmas().Algebras(QQ).super_categories() [Category of magmatic algebras with basis over Rational Field, Category of set algebras over Rational Field] - >>> from sage.all import * >>> AdditiveMagmas().Algebras(QQ).extra_super_categories() [Category of magmatic algebras with basis over Rational Field] >>> AdditiveMagmas().Algebras(QQ).super_categories() [Category of magmatic algebras with basis over Rational Field, Category of set algebras over Rational Field] 
 
 - class CartesianProducts(category, *args)[source]¶
- Bases: - CartesianProductsCategory- extra_super_categories()[source]¶
- Implement the fact that a Cartesian product of additive magmas is an additive magma. - EXAMPLES: - sage: C = AdditiveMagmas().CartesianProducts() sage: C.extra_super_categories() [Category of additive magmas] sage: C.super_categories() [Category of additive magmas, Category of Cartesian products of sets] sage: C.axioms() frozenset() - >>> from sage.all import * >>> C = AdditiveMagmas().CartesianProducts() >>> C.extra_super_categories() [Category of additive magmas] >>> C.super_categories() [Category of additive magmas, Category of Cartesian products of sets] >>> C.axioms() frozenset() 
 
 - class Homsets(category, *args)[source]¶
- Bases: - HomsetsCategory- extra_super_categories()[source]¶
- Implement the fact that a homset between two magmas is a magma. - EXAMPLES: - sage: AdditiveMagmas().Homsets().extra_super_categories() [Category of additive magmas] sage: AdditiveMagmas().Homsets().super_categories() [Category of additive magmas, Category of homsets] - >>> from sage.all import * >>> AdditiveMagmas().Homsets().extra_super_categories() [Category of additive magmas] >>> AdditiveMagmas().Homsets().super_categories() [Category of additive magmas, Category of homsets] 
 
 - class ParentMethods[source]¶
- Bases: - object- addition_table(names='letters', elements=None)[source]¶
- Return a table describing the addition operation. - Note - The order of the elements in the row and column headings is equal to the order given by the table’s - column_keys()method. The association can also be retrieved with the- translation()method.- INPUT: - names– the type of names used:- 'letters'– lowercase ASCII letters are used for a base 26 representation of the elements’ positions in the list given by- column_keys(), padded to a common width with leading ‘a’s.
- 'digits'– base 10 representation of the elements’ positions in the list given by- column_keys(), padded to a common width with leading zeros.
- 'elements'– the string representations of the elements themselves.
- a list - a list of strings, where the length of the list equals the number of elements. 
 
- elements– (default:- None) A list of elements of the additive magma, in forms that can be coerced into the structure, eg. their string representations. This may be used to impose an alternate ordering on the elements, perhaps when this is used in the context of a particular structure. The default is to use whatever ordering the- S.listmethod returns. Or the- elementscan be a subset which is closed under the operation. In particular, this can be used when the base set is infinite.
 - OUTPUT: - The addition table as an object of the class - OperationTablewhich defines several methods for manipulating and displaying the table. See the documentation there for full details to supplement the documentation here.- EXAMPLES: - All that is required is that an algebraic structure has an addition defined.The default is to represent elements as lowercase ASCII letters. - sage: R = IntegerModRing(5) sage: R.addition_table() # needs sage.modules + a b c d e +---------- a| a b c d e b| b c d e a c| c d e a b d| d e a b c e| e a b c d - >>> from sage.all import * >>> R = IntegerModRing(Integer(5)) >>> R.addition_table() # needs sage.modules + a b c d e +---------- a| a b c d e b| b c d e a c| c d e a b d| d e a b c e| e a b c d - The - namesargument allows displaying the elements in different ways. Requesting- elementswill use the representation of the elements of the set. Requesting- digitswill include leading zeros as padding.- sage: R = IntegerModRing(11) sage: P = R.addition_table(names='elements'); P # needs sage.modules + 0 1 2 3 4 5 6 7 8 9 10 +--------------------------------- 0| 0 1 2 3 4 5 6 7 8 9 10 1| 1 2 3 4 5 6 7 8 9 10 0 2| 2 3 4 5 6 7 8 9 10 0 1 3| 3 4 5 6 7 8 9 10 0 1 2 4| 4 5 6 7 8 9 10 0 1 2 3 5| 5 6 7 8 9 10 0 1 2 3 4 6| 6 7 8 9 10 0 1 2 3 4 5 7| 7 8 9 10 0 1 2 3 4 5 6 8| 8 9 10 0 1 2 3 4 5 6 7 9| 9 10 0 1 2 3 4 5 6 7 8 10| 10 0 1 2 3 4 5 6 7 8 9 sage: T = R.addition_table(names='digits'); T # needs sage.modules + 00 01 02 03 04 05 06 07 08 09 10 +--------------------------------- 00| 00 01 02 03 04 05 06 07 08 09 10 01| 01 02 03 04 05 06 07 08 09 10 00 02| 02 03 04 05 06 07 08 09 10 00 01 03| 03 04 05 06 07 08 09 10 00 01 02 04| 04 05 06 07 08 09 10 00 01 02 03 05| 05 06 07 08 09 10 00 01 02 03 04 06| 06 07 08 09 10 00 01 02 03 04 05 07| 07 08 09 10 00 01 02 03 04 05 06 08| 08 09 10 00 01 02 03 04 05 06 07 09| 09 10 00 01 02 03 04 05 06 07 08 10| 10 00 01 02 03 04 05 06 07 08 09 - >>> from sage.all import * >>> R = IntegerModRing(Integer(11)) >>> P = R.addition_table(names='elements'); P # needs sage.modules + 0 1 2 3 4 5 6 7 8 9 10 +--------------------------------- 0| 0 1 2 3 4 5 6 7 8 9 10 1| 1 2 3 4 5 6 7 8 9 10 0 2| 2 3 4 5 6 7 8 9 10 0 1 3| 3 4 5 6 7 8 9 10 0 1 2 4| 4 5 6 7 8 9 10 0 1 2 3 5| 5 6 7 8 9 10 0 1 2 3 4 6| 6 7 8 9 10 0 1 2 3 4 5 7| 7 8 9 10 0 1 2 3 4 5 6 8| 8 9 10 0 1 2 3 4 5 6 7 9| 9 10 0 1 2 3 4 5 6 7 8 10| 10 0 1 2 3 4 5 6 7 8 9 >>> T = R.addition_table(names='digits'); T # needs sage.modules + 00 01 02 03 04 05 06 07 08 09 10 +--------------------------------- 00| 00 01 02 03 04 05 06 07 08 09 10 01| 01 02 03 04 05 06 07 08 09 10 00 02| 02 03 04 05 06 07 08 09 10 00 01 03| 03 04 05 06 07 08 09 10 00 01 02 04| 04 05 06 07 08 09 10 00 01 02 03 05| 05 06 07 08 09 10 00 01 02 03 04 06| 06 07 08 09 10 00 01 02 03 04 05 07| 07 08 09 10 00 01 02 03 04 05 06 08| 08 09 10 00 01 02 03 04 05 06 07 09| 09 10 00 01 02 03 04 05 06 07 08 10| 10 00 01 02 03 04 05 06 07 08 09 - Specifying the elements in an alternative order can provide more insight into how the operation behaves. - sage: S = IntegerModRing(7) sage: elts = [0, 3, 6, 2, 5, 1, 4] sage: S.addition_table(elements=elts) # needs sage.modules + a b c d e f g +-------------- a| a b c d e f g b| b c d e f g a c| c d e f g a b d| d e f g a b c e| e f g a b c d f| f g a b c d e g| g a b c d e f - >>> from sage.all import * >>> S = IntegerModRing(Integer(7)) >>> elts = [Integer(0), Integer(3), Integer(6), Integer(2), Integer(5), Integer(1), Integer(4)] >>> S.addition_table(elements=elts) # needs sage.modules + a b c d e f g +-------------- a| a b c d e f g b| b c d e f g a c| c d e f g a b d| d e f g a b c e| e f g a b c d f| f g a b c d e g| g a b c d e f - The - elementsargument can be used to provide a subset of the elements of the structure. The subset must be closed under the operation. Elements need only be in a form that can be coerced into the set. The- namesargument can also be used to request that the elements be represented with their usual string representation.- sage: T = IntegerModRing(12) sage: elts = [0, 3, 6, 9] sage: T.addition_table(names='elements', elements=elts) # needs sage.modules + 0 3 6 9 +-------- 0| 0 3 6 9 3| 3 6 9 0 6| 6 9 0 3 9| 9 0 3 6 - >>> from sage.all import * >>> T = IntegerModRing(Integer(12)) >>> elts = [Integer(0), Integer(3), Integer(6), Integer(9)] >>> T.addition_table(names='elements', elements=elts) # needs sage.modules + 0 3 6 9 +-------- 0| 0 3 6 9 3| 3 6 9 0 6| 6 9 0 3 9| 9 0 3 6 - The table returned can be manipulated in various ways. See the documentation for - OperationTablefor more comprehensive documentation.- sage: # needs sage.modules sage: R = IntegerModRing(3) sage: T = R.addition_table() sage: T.column_keys() (0, 1, 2) sage: sorted(T.translation().items()) [('a', 0), ('b', 1), ('c', 2)] sage: T.change_names(['x', 'y', 'z']) sage: sorted(T.translation().items()) [('x', 0), ('y', 1), ('z', 2)] sage: T + x y z +------ x| x y z y| y z x z| z x y - >>> from sage.all import * >>> # needs sage.modules >>> R = IntegerModRing(Integer(3)) >>> T = R.addition_table() >>> T.column_keys() (0, 1, 2) >>> sorted(T.translation().items()) [('a', 0), ('b', 1), ('c', 2)] >>> T.change_names(['x', 'y', 'z']) >>> sorted(T.translation().items()) [('x', 0), ('y', 1), ('z', 2)] >>> T + x y z +------ x| x y z y| y z x z| z x y 
 - summation(x, y)[source]¶
- Return the sum of - xand- y.- The binary addition operator of this additive magma. - INPUT: - x,- y– elements of this additive magma
 - EXAMPLES: - sage: S = CommutativeAdditiveSemigroups().example() sage: (a,b,c,d) = S.additive_semigroup_generators() sage: S.summation(a, b) a + b - >>> from sage.all import * >>> S = CommutativeAdditiveSemigroups().example() >>> (a,b,c,d) = S.additive_semigroup_generators() >>> S.summation(a, b) a + b - A parent in - AdditiveMagmas()must either implement- summation()in the parent class or- _add_in the element class. By default, the addition method on elements- x._add_(y)calls- S.summation(x,y), and reciprocally.- As a bonus effect, - S.summationby itself models the binary function from- Sto- S:- sage: bin = S.summation sage: bin(a,b) a + b - >>> from sage.all import * >>> bin = S.summation >>> bin(a,b) a + b - Here, - S.summationis just a bound method. Whenever possible, it is recommended to enrich- S.summationwith extra mathematical structure. Lazy attributes can come handy for this.- Todo - Add an example. 
 - summation_from_element_class_add(x, y)[source]¶
- Return the sum of - xand- y.- The binary addition operator of this additive magma. - INPUT: - x,- y– elements of this additive magma
 - EXAMPLES: - sage: S = CommutativeAdditiveSemigroups().example() sage: (a,b,c,d) = S.additive_semigroup_generators() sage: S.summation(a, b) a + b - >>> from sage.all import * >>> S = CommutativeAdditiveSemigroups().example() >>> (a,b,c,d) = S.additive_semigroup_generators() >>> S.summation(a, b) a + b - A parent in - AdditiveMagmas()must either implement- summation()in the parent class or- _add_in the element class. By default, the addition method on elements- x._add_(y)calls- S.summation(x,y), and reciprocally.- As a bonus effect, - S.summationby itself models the binary function from- Sto- S:- sage: bin = S.summation sage: bin(a,b) a + b - >>> from sage.all import * >>> bin = S.summation >>> bin(a,b) a + b - Here, - S.summationis just a bound method. Whenever possible, it is recommended to enrich- S.summationwith extra mathematical structure. Lazy attributes can come handy for this.- Todo - Add an example. 
 
 - class SubcategoryMethods[source]¶
- Bases: - object- AdditiveAssociative()[source]¶
- Return the full subcategory of the additive associative objects of - self.- An - additive magma\(M\) is associative if, for all \(x,y,z \in M\),\[x + (y + z) = (x + y) + z\]- EXAMPLES: - sage: AdditiveMagmas().AdditiveAssociative() Category of additive semigroups - >>> from sage.all import * >>> AdditiveMagmas().AdditiveAssociative() Category of additive semigroups 
 - AdditiveCommutative()[source]¶
- Return the full subcategory of the commutative objects of - self.- An - additive magma\(M\) is commutative if, for all \(x,y \in M\),\[x + y = y + x\]- EXAMPLES: - sage: AdditiveMagmas().AdditiveCommutative() Category of additive commutative additive magmas sage: C = AdditiveMagmas().AdditiveAssociative().AdditiveUnital() sage: C.AdditiveCommutative() Category of commutative additive monoids sage: C.AdditiveCommutative() is CommutativeAdditiveMonoids() True - >>> from sage.all import * >>> AdditiveMagmas().AdditiveCommutative() Category of additive commutative additive magmas >>> C = AdditiveMagmas().AdditiveAssociative().AdditiveUnital() >>> C.AdditiveCommutative() Category of commutative additive monoids >>> C.AdditiveCommutative() is CommutativeAdditiveMonoids() True 
 - AdditiveUnital()[source]¶
- Return the subcategory of the unital objects of - self.- An - additive magma\(M\) is unital if it admits an element \(0\), called neutral element, such that for all \(x \in M\),\[0 + x = x + 0 = x\]- This element is necessarily unique, and should be provided as - M.zero().- EXAMPLES: - sage: AdditiveMagmas().AdditiveUnital() Category of additive unital additive magmas sage: from sage.categories.additive_semigroups import AdditiveSemigroups sage: AdditiveSemigroups().AdditiveUnital() Category of additive monoids sage: CommutativeAdditiveMonoids().AdditiveUnital() Category of commutative additive monoids - >>> from sage.all import * >>> AdditiveMagmas().AdditiveUnital() Category of additive unital additive magmas >>> from sage.categories.additive_semigroups import AdditiveSemigroups >>> AdditiveSemigroups().AdditiveUnital() Category of additive monoids >>> CommutativeAdditiveMonoids().AdditiveUnital() Category of commutative additive monoids