Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
2fda6a4
sage.combinat: Add # optional
mkoeppe Apr 25, 2023
429577d
sage.combinat: More # optional
mkoeppe Apr 26, 2023
c415d7a
sage.combinat: More # optional
mkoeppe Apr 27, 2023
9e9f1f1
sage.combinat: More # optional
mkoeppe Apr 28, 2023
397ebd3
sage.combinat: Add # optional, docstring cosmetics
mkoeppe May 15, 2023
672a986
sage.combinat: Add # optional
mkoeppe May 15, 2023
0edead8
sage.combinat: Add # optional - sage.plot
mkoeppe May 16, 2023
0cff99e
sage.combinat: More # optional
mkoeppe May 17, 2023
f93a484
sage.combinat: More # optional
mkoeppe May 20, 2023
3ef1b02
sage.combinat: More # optional
mkoeppe May 21, 2023
1b54608
src/sage/combinat/k_regular_sequence.py: Fix alignment of # optional
mkoeppe Jun 7, 2023
d516993
src/sage/combinat/{k_regular_sequence,recognizable_series}.py: Add mo…
mkoeppe Jun 7, 2023
a2ceb72
sage.combinat: More # optional
mkoeppe Jun 7, 2023
1380e8e
Remove stray file
mkoeppe Jun 4, 2023
a8dbc70
sage.categories: More # optional
mkoeppe Jun 7, 2023
3143431
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py: Wrap some l…
mkoeppe Jun 7, 2023
c5568c2
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py: Fix markup
mkoeppe Jun 7, 2023
0f18153
src/sage/combinat/posets: Fix # optional
mkoeppe Jun 8, 2023
0b50e1a
src/sage/combinat/root_system/plot.py: Fix doctest
mkoeppe Jun 8, 2023
2710137
src/sage/combinat/cluster_algebra_quiver/cluster_seed.py: Fix markup
mkoeppe Jun 8, 2023
2b0992d
src/sage/combinat/posets/d_complete.py: Fix up doctest
mkoeppe Jun 8, 2023
6b97c82
src/sage/combinat/k_regular_sequence.py: Use file-level annotation fo…
mkoeppe Jun 10, 2023
d15a157
src/sage/combinat/root_system/root_lattice_realizations.py: Docstring…
mkoeppe Jun 10, 2023
3178ccb
src/sage/combinat/ordered_tree.py: Docstring cosmetics
mkoeppe Jun 10, 2023
62d3d48
src/sage/combinat/designs/block_design.py: Doctest/docstring cosmetic…
mkoeppe Jun 10, 2023
e5fd4e1
Fix typo of # optional - sage.modules
mkoeppe Jun 10, 2023
1e24dff
Merge tag '10.1.beta4' into sage_combinat_more_optional
mkoeppe Jun 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/sage/categories/finite_dimensional_algebras_with_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ def orthogonal_idempotents_central_mod_radical(self):
sage: Z12 = Monoids().Finite().example(); Z12
An example of a finite multiplicative monoid: the integers modulo 12
sage: A = Z12.algebra(QQ)
sage: idempotents = A.orthogonal_idempotents_central_mod_radical()
sage: sorted(idempotents, key=str)
sage: idempotents = A.orthogonal_idempotents_central_mod_radical() # optional - sage.rings.number_field
sage: sorted(idempotents, key=str) # optional - sage.rings.number_field
[-B[0] + 1/2*B[4] + 1/2*B[8],
1/2*B[4] - 1/2*B[8],
1/2*B[9] + 1/2*B[3] - B[0],
Expand All @@ -493,26 +493,26 @@ def orthogonal_idempotents_central_mod_radical(self):
1/4*B[1] - 1/2*B[9] - 1/2*B[3] + 1/4*B[11] + 1/4*B[5] + 1/4*B[7] + B[0] - 1/2*B[4] - 1/2*B[8],
1/4*B[1] - 1/4*B[5] + 1/4*B[7] - 1/4*B[11] - 1/2*B[4] + 1/2*B[8],
B[0]]
sage: sum(idempotents) == 1
sage: sum(idempotents) == 1 # optional - sage.rings.number_field
True
sage: all(e*e == e for e in idempotents)
sage: all(e*e == e for e in idempotents) # optional - sage.rings.number_field
True
sage: all(e*f == 0 and f*e == 0
sage: all(e*f == 0 and f*e == 0 # optional - sage.rings.number_field
....: for e in idempotents for f in idempotents if e != f)
True

This is best tested with::

sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents)
sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents) # optional - sage.rings.number_field
True

We construct orthogonal idempotents for the algebra of the
`0`-Hecke monoid::

sage: from sage.monoids.hecke_monoid import HeckeMonoid
sage: A = HeckeMonoid(SymmetricGroup(4)).algebra(QQ)
sage: idempotents = A.orthogonal_idempotents_central_mod_radical()
sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents)
sage: from sage.monoids.hecke_monoid import HeckeMonoid # optional - sage.groups
sage: A = HeckeMonoid(SymmetricGroup(4)).algebra(QQ) # optional - sage.groups
sage: idempotents = A.orthogonal_idempotents_central_mod_radical() # optional - sage.groups
sage: A.is_identity_decomposition_into_orthogonal_idempotents(idempotents) # optional - sage.groups
True
"""
one = self.one()
Expand Down Expand Up @@ -666,7 +666,7 @@ def cartan_invariants_matrix(self):
sage: Z12 = Monoids().Finite().example(); Z12
An example of a finite multiplicative monoid: the integers modulo 12
sage: A = Z12.algebra(QQ) # optional - sage.modules
sage: A.cartan_invariants_matrix() # optional - sage.modules
sage: A.cartan_invariants_matrix() # optional - sage.modules sage.rings.number_fields
[1 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0]
[0 0 2 0 0 0 0 0 0]
Expand All @@ -681,7 +681,7 @@ def cartan_invariants_matrix(self):

sage: from sage.monoids.hecke_monoid import HeckeMonoid # optional - sage.groups sage.modules
sage: A = HeckeMonoid(SymmetricGroup(4)).algebra(QQ) # optional - sage.groups sage.modules
sage: A.cartan_invariants_matrix() # optional - sage.groups sage.modules
sage: A.cartan_invariants_matrix() # optional - sage.groups sage.modules sage.rings.number_field
[1 0 0 0 0 0 0 0]
[0 2 1 0 1 1 0 0]
[0 1 1 0 1 0 0 0]
Expand Down
2 changes: 1 addition & 1 deletion src/sage/categories/group_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def is_integral_domain(self, proof=True):
sage: S2 = SymmetricGroup(2) # optional - sage.groups
sage: GroupAlgebra(S2).is_integral_domain() # optional - sage.groups sage.modules
False
sage: S1 = SymmetricGroup(1)
sage: S1 = SymmetricGroup(1) # optional - sage.groups
sage: GroupAlgebra(S1).is_integral_domain() # optional - sage.groups sage.modules
True
sage: GroupAlgebra(S1, IntegerModRing(4)).is_integral_domain() # optional - sage.groups sage.modules
Expand Down
6 changes: 3 additions & 3 deletions src/sage/categories/homset.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,10 @@ class Homset(Set_generic):

Homsets of unique parents are unique as well::

sage: H = End(AffineSpace(2, names='x,y'))
sage: loads(dumps(AffineSpace(2, names='x,y'))) is AffineSpace(2, names='x,y')
sage: H = End(AffineSpace(2, names='x,y')) # optional - sage.modules
sage: loads(dumps(AffineSpace(2, names='x,y'))) is AffineSpace(2, names='x,y') # optional - sage.modules
True
sage: loads(dumps(H)) is H
sage: loads(dumps(H)) is H # optional - sage.modules
True

Conversely, homsets of non-unique parents are non-unique::
Expand Down
22 changes: 11 additions & 11 deletions src/sage/categories/magmas.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,10 @@ def multiplication_table(self, names='letters', elements=None):

sage: from sage.categories.examples.finite_semigroups import LeftRegularBand
sage: L = LeftRegularBand(('a', 'b'))
sage: T = L.multiplication_table(names='digits') # optional - sage.matrix
sage: T.column_keys() # optional - sage.matrix
sage: T = L.multiplication_table(names='digits') # optional - sage.modules
sage: T.column_keys() # optional - sage.modules
('a', 'ab', 'b', 'ba')
sage: T # optional - sage.matrix
sage: T # optional - sage.modules
* 0 1 2 3
+--------
0| 0 1 1 1
Expand All @@ -918,7 +918,7 @@ def multiplication_table(self, names='letters', elements=None):

sage: L = LeftRegularBand(('a', 'b', 'c'))
sage: elts = sorted(L.list())
sage: L.multiplication_table(elements=elts) # optional - sage.matrix
sage: L.multiplication_table(elements=elts) # optional - sage.modules
* a b c d e f g h i j k l m n o
+------------------------------
a| a b c d e b b c c c d d e e e
Expand Down Expand Up @@ -947,7 +947,7 @@ def multiplication_table(self, names='letters', elements=None):

sage: L = LeftRegularBand(('a','b','c'))
sage: elts=['a', 'c', 'ac', 'ca']
sage: L.multiplication_table(names='elements', elements=elts) # optional - sage.matrix
sage: L.multiplication_table(names='elements', elements=elts) # optional - sage.modules
* 'a' 'c' 'ac' 'ca'
+--------------------
'a'| 'a' 'ac' 'ac' 'ac'
Expand All @@ -961,15 +961,15 @@ def multiplication_table(self, names='letters', elements=None):
comprehensive documentation. ::

sage: G = AlternatingGroup(3) # optional - sage.groups
sage: T = G.multiplication_table() # optional - sage.groups sage.matrix
sage: T.column_keys() # optional - sage.groups sage.matrix
sage: T = G.multiplication_table() # optional - sage.groups sage.modules
sage: T.column_keys() # optional - sage.groups sage.modules
((), (1,2,3), (1,3,2))
sage: T.translation() # optional - sage.groups sage.matrix
sage: T.translation() # optional - sage.groups sage.modules
{'a': (), 'b': (1,2,3), 'c': (1,3,2)}
sage: T.change_names(['x', 'y', 'z']) # optional - sage.groups sage.matrix
sage: T.translation() # optional - sage.groups sage.matrix
sage: T.change_names(['x', 'y', 'z']) # optional - sage.groups sage.modules
sage: T.translation() # optional - sage.groups sage.modules
{'x': (), 'y': (1,2,3), 'z': (1,3,2)}
sage: T # optional - sage.groups sage.matrix
sage: T # optional - sage.groups sage.modules
* x y z
+------
x| x y z
Expand Down
2 changes: 2 additions & 0 deletions src/sage/categories/map.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ cdef class Map(Element):
sage: import gc
sage: _ = gc.collect()
sage: C = Q.__class__.__base__ # optional - sage.rings.number_field
sage: x = None
sage: numberQuadFields = len([x for x in gc.get_objects() # optional - sage.rings.number_field
....: if isinstance(x, C)])
sage: del Q, x # optional - sage.rings.number_field
Expand Down Expand Up @@ -344,6 +345,7 @@ cdef class Map(Element):
sage: import gc
sage: _ = gc.collect()
sage: C = Q.__class__.__base__ # optional - sage.rings.number_field
sage: x = None
sage: numberQuadFields = len([x for x in gc.get_objects() # optional - sage.rings.number_field
....: if isinstance(x, C)])
sage: del Q, x # optional - sage.rings.number_field
Expand Down
20 changes: 10 additions & 10 deletions src/sage/categories/primer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@
6

sage: A = random_matrix(ZZ, 6, 3, x=7) # optional - sage.modules
sage: L = LatticePolytope(A.rows()) # optional - sage.geometry.polyhedron
sage: L.npoints() # oops! # random # optional - sage.geometry.polyhedron
sage: L = LatticePolytope(A.rows()) # optional - sage.geometry.polyhedron sage.modules
sage: L.npoints() # oops! # random # optional - sage.geometry.polyhedron sage.modules
37

- How to ensure robustness?
Expand Down Expand Up @@ -415,16 +415,16 @@ class implements:
6*(x + 1)^2

sage: R.<x> = PolynomialRing(QQ, sparse=True)
sage: pQ = R ( p )
sage: type(pQ)
sage: pQ = R(p) # optional - sage.symbolic
sage: type(pQ) # optional - sage.symbolic
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category.element_class'>
sage: pQ.factor()
sage: pQ.factor() # optional - sage.symbolic
(6) * (x + 1)^2

sage: pZ = ZZ['x'] ( p )
sage: type(pZ)
sage: pZ = ZZ['x'](p) # optional - sage.symbolic
sage: type(pZ) # optional - sage.symbolic
<class 'sage.rings.polynomial.polynomial_integer_dense_flint.Polynomial_integer_dense_flint'>
sage: pZ.factor()
sage: pZ.factor() # optional - sage.symbolic
2 * 3 * (x + 1)^2

Factoring integers, expressions, or polynomials are distinct tasks,
Expand All @@ -444,9 +444,9 @@ class implements:
sage: i._pow_.__module__ # not tested (Issue #24275)
'sage.categories.semigroups'

sage: pQ._mul_.__module__
sage: pQ._mul_.__module__ # optional - sage.symbolic
'sage.rings.polynomial.polynomial_element_generic'
sage: pQ._pow_.__module__ # not tested (Issue #24275)
sage: pQ._pow_.__module__ # not tested (Issue #24275) # optional - sage.symbolic
'sage.categories.semigroups'

We see that integers and polynomials have each their own
Expand Down
20 changes: 11 additions & 9 deletions src/sage/categories/pushout.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,10 +1758,11 @@ def __init__(self, var, multi_variate=False):
sage: F2 = LaurentPolynomialFunctor('s', multi_variate=True)
sage: F3 = LaurentPolynomialFunctor(['s','t'])
sage: F1(F2(QQ))
Univariate Laurent Polynomial Ring in t over Univariate Laurent Polynomial Ring in s over Rational Field
sage: F2(F1(QQ))
Univariate Laurent Polynomial Ring in t over
Univariate Laurent Polynomial Ring in s over Rational Field
sage: F2(F1(QQ)) # optional - sage.modules
Multivariate Laurent Polynomial Ring in t, s over Rational Field
sage: F3(QQ)
sage: F3(QQ) # optional - sage.modules
Multivariate Laurent Polynomial Ring in s, t over Rational Field

"""
Expand All @@ -1782,10 +1783,11 @@ def _apply_functor(self, R):
sage: F2 = LaurentPolynomialFunctor('s', multi_variate=True)
sage: F3 = LaurentPolynomialFunctor(['s','t'])
sage: F1(F2(QQ)) # indirect doctest
Univariate Laurent Polynomial Ring in t over Univariate Laurent Polynomial Ring in s over Rational Field
sage: F2(F1(QQ))
Univariate Laurent Polynomial Ring in t over
Univariate Laurent Polynomial Ring in s over Rational Field
sage: F2(F1(QQ)) # optional - sage.modules
Multivariate Laurent Polynomial Ring in t, s over Rational Field
sage: F3(QQ)
sage: F3(QQ) # optional - sage.modules
Multivariate Laurent Polynomial Ring in s, t over Rational Field

"""
Expand Down Expand Up @@ -3945,7 +3947,7 @@ def __init__(self, box):
sage: from sage.categories.pushout import BlackBoxConstructionFunctor
sage: FG = BlackBoxConstructionFunctor(gap) # optional - sage.libs.gap
sage: FM = BlackBoxConstructionFunctor(maxima) # optional - sage.symbolic
sage: FM == FG # optional - sage.symbolic
sage: FM == FG # optional - sage.libs.gap sage.symbolic
False
sage: FM == loads(dumps(FM)) # optional - sage.symbolic
True
Expand Down Expand Up @@ -3977,7 +3979,7 @@ def __eq__(self, other):
sage: from sage.categories.pushout import BlackBoxConstructionFunctor
sage: FG = BlackBoxConstructionFunctor(gap) # optional - sage.libs.gap
sage: FM = BlackBoxConstructionFunctor(maxima) # optional - sage.symbolic
sage: FM == FG # indirect doctest # optional - sage.symbolic
sage: FM == FG # indirect doctest # optional - sage.libs.gap sage.symbolic
False
sage: FM == loads(dumps(FM)) # optional - sage.symbolic
True
Expand All @@ -3996,7 +3998,7 @@ def __ne__(self, other):
sage: from sage.categories.pushout import BlackBoxConstructionFunctor
sage: FG = BlackBoxConstructionFunctor(gap) # optional - sage.libs.gap
sage: FM = BlackBoxConstructionFunctor(maxima) # optional - sage.symbolic
sage: FM != FG # indirect doctest # optional - sage.symbolic
sage: FM != FG # indirect doctest # optional - sage.libs.gap sage.symbolic
True
sage: FM != loads(dumps(FM)) # optional - sage.symbolic
False
Expand Down
Loading