From 4ac814afde928dba62809984e3a0680f78e28369 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 15 May 2023 14:10:59 -0700 Subject: [PATCH 01/25] sage.algebras: Add # optional --- src/sage/algebras/clifford_algebra.py | 8 +++---- src/sage/algebras/lie_algebras/morphism.py | 4 ++-- src/sage/algebras/lie_algebras/quotient.py | 8 +++---- .../lie_algebras/structure_coefficients.py | 4 ++-- src/sage/algebras/lie_algebras/subalgebra.py | 24 +++++++++---------- .../algebras/quaternion_algebra_element.py | 8 +++---- src/sage/algebras/weyl_algebra.py | 8 +++---- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index 220a2eb27a5..adb065e31b7 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -1770,11 +1770,11 @@ def interior_product_on_basis(self, a, b): Check :trac:`34694`:: - sage: E = ExteriorAlgebra(SR,'e',3) - sage: E.inject_variables() + sage: E = ExteriorAlgebra(SR,'e',3) # optional - sage.symbolic + sage: E.inject_variables() # optional - sage.symbolic Defining e0, e1, e2 - sage: a = (e0*e1).interior_product(e0) - sage: a * e0 + sage: a = (e0*e1).interior_product(e0) # optional - sage.symbolic + sage: a * e0 # optional - sage.symbolic -e0*e1 """ sgn = True diff --git a/src/sage/algebras/lie_algebras/morphism.py b/src/sage/algebras/lie_algebras/morphism.py index f71001ce98f..a4c03e22104 100644 --- a/src/sage/algebras/lie_algebras/morphism.py +++ b/src/sage/algebras/lie_algebras/morphism.py @@ -461,8 +461,8 @@ class LieAlgebraMorphism_from_generators(LieAlgebraHomomorphism_im_gens): A quotient type Lie algebra morphism:: - sage: K. = LieAlgebra(SR, abelian=True) - sage: L.morphism({X: A, Y: B}) + sage: K. = LieAlgebra(SR, abelian=True) # optional - sage.symbolic + sage: L.morphism({X: A, Y: B}) # optional - sage.symbolic Lie algebra morphism: From: Lie algebra on 4 generators (X, Y, Z, W) over Rational Field To: Abelian Lie algebra on 2 generators (A, B) over Symbolic Ring diff --git a/src/sage/algebras/lie_algebras/quotient.py b/src/sage/algebras/lie_algebras/quotient.py index 7fe6b29677f..a0400221af6 100644 --- a/src/sage/algebras/lie_algebras/quotient.py +++ b/src/sage/algebras/lie_algebras/quotient.py @@ -242,11 +242,11 @@ def __init__(self, I, L, names, index_set, category=None): TESTS:: - sage: L. = LieAlgebra(SR, {('x','y'): {'x':1}}) - sage: K = L.quotient(y) - sage: K.dimension() + sage: L. = LieAlgebra(SR, {('x','y'): {'x':1}}) # optional - sage.symbolic + sage: K = L.quotient(y) # optional - sage.symbolic + sage: K.dimension() # optional - sage.symbolic 1 - sage: TestSuite(K).run() + sage: TestSuite(K).run() # optional - sage.symbolic """ B = L.basis() sm = L.module().submodule_with_basis([I.reduce(B[i]).to_vector() diff --git a/src/sage/algebras/lie_algebras/structure_coefficients.py b/src/sage/algebras/lie_algebras/structure_coefficients.py index 16c2cf51029..48b1bbecf41 100644 --- a/src/sage/algebras/lie_algebras/structure_coefficients.py +++ b/src/sage/algebras/lie_algebras/structure_coefficients.py @@ -411,8 +411,8 @@ def change_ring(self, R): sage: LQQ = L.change_ring(QQ) sage: LQQ.structure_coefficients() Finite family {('x', 'y'): z} - sage: LSR = LQQ.change_ring(SR) - sage: LSR.structure_coefficients() + sage: LSR = LQQ.change_ring(SR) # optional - sage.symbolic + sage: LSR.structure_coefficients() # optional - sage.symbolic Finite family {('x', 'y'): z} """ return LieAlgebraWithStructureCoefficients( diff --git a/src/sage/algebras/lie_algebras/subalgebra.py b/src/sage/algebras/lie_algebras/subalgebra.py index 90779eb91fc..ab7b6922083 100644 --- a/src/sage/algebras/lie_algebras/subalgebra.py +++ b/src/sage/algebras/lie_algebras/subalgebra.py @@ -75,32 +75,32 @@ class LieSubalgebra_finite_dimensional_with_basis(Parent, UniqueRepresentation): Elements of the ambient Lie algebra can be reduced modulo an ideal or subalgebra:: - sage: L. = LieAlgebra(SR, {('X','Y'): {'Z': 1}}) - sage: I = L.ideal(Y) - sage: I.reduce(X + 2*Y + 3*Z) + sage: L. = LieAlgebra(SR, {('X','Y'): {'Z': 1}}) # optional - sage.symbolic + sage: I = L.ideal(Y) # optional - sage.symbolic + sage: I.reduce(X + 2*Y + 3*Z) # optional - sage.symbolic X - sage: S = L.subalgebra(Y) - sage: S.reduce(X + 2*Y + 3*Z) + sage: S = L.subalgebra(Y) # optional - sage.symbolic + sage: S.reduce(X + 2*Y + 3*Z) # optional - sage.symbolic X + 3*Z The reduction gives elements in a fixed complementary subspace. When the base ring is a field, the complementary subspace is spanned by those basis elements which are not leading supports of the basis:: - sage: I = L.ideal(X + Y) - sage: I.basis() + sage: I = L.ideal(X + Y) # optional - sage.symbolic + sage: I.basis() # optional - sage.symbolic Family (X + Y, Z) - sage: el = var('x')*X + var('y')*Y + var('z')*Z; el + sage: el = var('x')*X + var('y')*Y + var('z')*Z; el # optional - sage.symbolic x*X + y*Y + z*Z - sage: I.reduce(el) + sage: I.reduce(el) # optional - sage.symbolic (x-y)*X Giving a different ``order`` may change the reduction of elements:: - sage: I = L.ideal(X + Y, order=lambda s: ['Z','Y','X'].index(s)) - sage: I.basis() + sage: I = L.ideal(X + Y, order=lambda s: ['Z','Y','X'].index(s)) # optional - sage.symbolic + sage: I.basis() # optional - sage.symbolic Family (Z, X + Y) - sage: I.reduce(el) + sage: I.reduce(el) # optional - sage.symbolic (-x+y)*Y A subalgebra of a subalgebra is a subalgebra of the original:: diff --git a/src/sage/algebras/quaternion_algebra_element.py b/src/sage/algebras/quaternion_algebra_element.py index ef527e2f269..48c1c9871ec 100644 --- a/src/sage/algebras/quaternion_algebra_element.py +++ b/src/sage/algebras/quaternion_algebra_element.py @@ -37,12 +37,12 @@ def unpickle_QuaternionAlgebraElement_number_field_v0(*args): """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j - sage: f, t = z.__reduce__() + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j # optional - sage.symbolic + sage: f, t = z.__reduce__() # optional - sage.symbolic sage: import sage.algebras.quaternion_algebra_element - sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) + sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) # optional - sage.symbolic i + j - sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z + sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z # optional - sage.symbolic True """ return QuaternionAlgebraElement_number_field(*args) diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index 13604578430..48b1dee6075 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -53,12 +53,12 @@ def repr_from_monomials(monomials, term_repr, use_latex=False): sage: from sage.algebras.weyl_algebra import repr_from_monomials sage: R. = QQ[] - sage: d = [(z, 4/7), (y, sqrt(2)), (x, -5)] - sage: repr_from_monomials(d, lambda m: repr(m)) + sage: d = [(z, 4/7), (y, sqrt(2)), (x, -5)] # optional - sage.symbolic + sage: repr_from_monomials(d, lambda m: repr(m)) # optional - sage.symbolic '4/7*z + sqrt(2)*y - 5*x' - sage: a = repr_from_monomials(d, lambda m: latex(m), True); a + sage: a = repr_from_monomials(d, lambda m: latex(m), True); a # optional - sage.symbolic \frac{4}{7} z + \sqrt{2} y - 5 x - sage: type(a) + sage: type(a) # optional - sage.symbolic The zero element:: From ce226276941f66b5c8c2187caccd2ebee71fbaf5 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 17 May 2023 13:20:30 -0700 Subject: [PATCH 02/25] Massive modularization fixes --- src/sage/algebras/commutative_dga.py | 18 +- src/sage/algebras/lie_algebras/morphism.py | 14 +- .../algebras/quatalg/quaternion_algebra.py | 155 ++++++++++++------ .../quatalg/quaternion_algebra_element.pyx | 82 ++++----- src/sage/algebras/weyl_algebra.py | 8 +- 5 files changed, 164 insertions(+), 113 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 953364d6813..2b5f2ccffd1 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -3925,8 +3925,8 @@ class CohomologyClass(SageObject, CachedRepresentation): sage: from sage.algebras.commutative_dga import CohomologyClass sage: CohomologyClass(3) [3] - sage: A. = GradedCommutativeAlgebra(QQ, degrees = (2,2,3,3)) - sage: CohomologyClass(x^2+2*y*z, A) + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(2,2,3,3)) + sage: CohomologyClass(x^2 + 2*y*z, A) [2*y*z + x^2] TESTS: @@ -3978,7 +3978,7 @@ def __init__(self, x, cdga=None): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: CohomologyClass(x-2) + sage: CohomologyClass(x - 2) # optional - sage.symbolic [x - 2] """ self._x = x @@ -3989,7 +3989,7 @@ def __hash__(self): TESTS:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: hash(CohomologyClass(sin)) == hash(sin) + sage: hash(CohomologyClass(sin)) == hash(sin) # optional - sage.symbolic True """ return hash(self._x) @@ -3999,7 +3999,7 @@ def _repr_(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: CohomologyClass(sin) + sage: CohomologyClass(sin) # optional - sage.symbolic [sin] """ return '[{}]'.format(self._x) @@ -4009,9 +4009,9 @@ def _latex_(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: latex(CohomologyClass(sin)) + sage: latex(CohomologyClass(sin)) # optional - sage.symbolic \left[ \sin \right] - sage: latex(CohomologyClass(x^2)) + sage: latex(CohomologyClass(x^2)) # optional - sage.symbolic \left[ x^{2} \right] """ from sage.misc.latex import latex @@ -4024,8 +4024,8 @@ def representative(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: x = CohomologyClass(sin) - sage: x.representative() == sin + sage: x = CohomologyClass(sin) # optional - sage.symbolic + sage: x.representative() == sin # optional - sage.symbolic True """ return self._x diff --git a/src/sage/algebras/lie_algebras/morphism.py b/src/sage/algebras/lie_algebras/morphism.py index a4c03e22104..2d04a5e6b65 100644 --- a/src/sage/algebras/lie_algebras/morphism.py +++ b/src/sage/algebras/lie_algebras/morphism.py @@ -623,17 +623,17 @@ def _call_(self, x): EXAMPLES:: sage: L. = LieAlgebra(QQ, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}}) - sage: K. = LieAlgebra(SR, abelian=True) - sage: phi = L.morphism({X: A, Y: B}) - sage: phi(X) + sage: K. = LieAlgebra(SR, abelian=True) # optional - sage.symbolic + sage: phi = L.morphism({X: A, Y: B}) # optional - sage.symbolic + sage: phi(X) # optional - sage.symbolic A - sage: phi(Y) + sage: phi(Y) # optional - sage.symbolic B - sage: phi(Z) + sage: phi(Z) # optional - sage.symbolic 0 - sage: phi(W) + sage: phi(W) # optional - sage.symbolic 0 - sage: phi(-X + 3*Y) + sage: phi(-X + 3*Y) # optional - sage.symbolic -A + 3*B sage: K. = LieAlgebra(QQ, {('A','B'): {'C':2}}) diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index 1b6001209a0..f0a31dca349 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -119,15 +119,17 @@ class QuaternionAlgebraFactory(UniqueFactory): Quaternion Algebra (2, 3) with base ring Finite Field of size 5 sage: QuaternionAlgebra(2, GF(5)(3)) Quaternion Algebra (2, 3) with base ring Finite Field of size 5 - sage: QuaternionAlgebra(QQ[sqrt(2)](-1), -5) - Quaternion Algebra (-1, -5) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? - sage: QuaternionAlgebra(sqrt(-1), sqrt(-3)) + sage: QuaternionAlgebra(QQ[sqrt(2)](-1), -5) # optional - sage.symbolic + Quaternion Algebra (-1, -5) with base ring Number Field in sqrt2 + with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? + sage: QuaternionAlgebra(sqrt(-1), sqrt(-3)) # optional - sage.symbolic Quaternion Algebra (I, sqrt(-3)) with base ring Symbolic Ring sage: QuaternionAlgebra(1r,1) Quaternion Algebra (1, 1) with base ring Rational Field sage: A. = ZZ[] sage: QuaternionAlgebra(-1, t) - Quaternion Algebra (-1, t) with base ring Fraction Field of Univariate Polynomial Ring in t over Integer Ring + Quaternion Algebra (-1, t) with base ring + Fraction Field of Univariate Polynomial Ring in t over Integer Ring Python ints and floats may be passed to the ``QuaternionAlgebra(a, b)`` constructor, as may all pairs of @@ -138,11 +140,13 @@ class QuaternionAlgebraFactory(UniqueFactory): sage: QuaternionAlgebra(1r,1) Quaternion Algebra (1, 1) with base ring Rational Field sage: QuaternionAlgebra(1,1.0r) - Quaternion Algebra (1.00000000000000, 1.00000000000000) with base ring Real Field with 53 bits of precision + Quaternion Algebra (1.00000000000000, 1.00000000000000) with base ring + Real Field with 53 bits of precision sage: QuaternionAlgebra(0,0) Traceback (most recent call last): ... - ValueError: defining elements of quaternion algebra (0, 0) are not invertible in Rational Field + ValueError: defining elements of quaternion algebra (0, 0) + are not invertible in Rational Field sage: QuaternionAlgebra(GF(2)(1),1) Traceback (most recent call last): ... @@ -158,8 +162,9 @@ class QuaternionAlgebraFactory(UniqueFactory): sage: QuaternionAlgebra(QQ, -7, -21) Quaternion Algebra (-7, -21) with base ring Rational Field - sage: QuaternionAlgebra(QQ[sqrt(2)], -2,-3) - Quaternion Algebra (-2, -3) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? + sage: QuaternionAlgebra(QQ[sqrt(2)], -2,-3) # optional - sage.symbolic + Quaternion Algebra (-2, -3) with base ring Number Field in sqrt2 + with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? ``QuaternionAlgebra(D)`` -- `D` is a squarefree integer; return a rational quaternion algebra of discriminant `D`:: @@ -540,8 +545,8 @@ def random_element(self, *args, **kwds): EXAMPLES:: - sage: g = QuaternionAlgebra(QQ[sqrt(2)], -3, 7).random_element() - sage: g.parent() is QuaternionAlgebra(QQ[sqrt(2)], -3, 7) + sage: g = QuaternionAlgebra(QQ[sqrt(2)], -3, 7).random_element() # optional - sage.symbolic + sage: g.parent() is QuaternionAlgebra(QQ[sqrt(2)], -3, 7) # optional - sage.symbolic True sage: g = QuaternionAlgebra(-3, 19).random_element() sage: g.parent() is QuaternionAlgebra(-3, 19) @@ -576,12 +581,13 @@ def free_module(self): sage: A. = LaurentPolynomialRing(GF(3)) sage: B = QuaternionAlgebra(A, -1, t) sage: B.free_module() - Ambient free quadratic module of rank 4 over the principal ideal domain Univariate Laurent Polynomial Ring in t over Finite Field of size 3 - Inner product matrix: - [2 0 0 0] - [0 2 0 0] - [0 0 t 0] - [0 0 0 t] + Ambient free quadratic module of rank 4 over the principal ideal domain + Univariate Laurent Polynomial Ring in t over Finite Field of size 3 + Inner product matrix: + [2 0 0 0] + [0 2 0 0] + [0 0 t 0] + [0 0 0 t] """ return FreeModule(self.base_ring(), 4, inner_product_matrix=self.inner_product_matrix()) @@ -594,10 +600,10 @@ def vector_space(self): sage: QuaternionAlgebra(-3,19).vector_space() Ambient quadratic space of dimension 4 over Rational Field Inner product matrix: - [ 2 0 0 0] - [ 0 6 0 0] - [ 0 0 -38 0] - [ 0 0 0 -114] + [ 2 0 0 0] + [ 0 6 0 0] + [ 0 0 -38 0] + [ 0 0 0 -114] """ return self.free_module() @@ -697,7 +703,8 @@ def maximal_order(self, take_shortcuts=True): EXAMPLES:: sage: QuaternionAlgebra(-1,-7).maximal_order() - Order of Quaternion Algebra (-1, -7) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k) + Order of Quaternion Algebra (-1, -7) with base ring Rational Field + with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k) sage: QuaternionAlgebra(-1,-1).maximal_order().basis() (1/2 + 1/2*i + 1/2*j + 1/2*k, i, j, k) @@ -732,13 +739,16 @@ def maximal_order(self, take_shortcuts=True): If you want bases containing 1, switch off ``take_shortcuts``:: sage: QuaternionAlgebra(-3,-89).maximal_order(take_shortcuts=False) - Order of Quaternion Algebra (-3, -89) with base ring Rational Field with basis (1, 1/2 + 1/2*i, j, 1/2 + 1/6*i + 1/2*j + 1/6*k) + Order of Quaternion Algebra (-3, -89) with base ring Rational Field + with basis (1, 1/2 + 1/2*i, j, 1/2 + 1/6*i + 1/2*j + 1/6*k) sage: QuaternionAlgebra(1,1).maximal_order(take_shortcuts=False) # Matrix ring - Order of Quaternion Algebra (1, 1) with base ring Rational Field with basis (1, 1/2 + 1/2*i, j, 1/2*j + 1/2*k) + Order of Quaternion Algebra (1, 1) with base ring Rational Field + with basis (1, 1/2 + 1/2*i, j, 1/2*j + 1/2*k) sage: QuaternionAlgebra(-22,210).maximal_order(take_shortcuts=False) - Order of Quaternion Algebra (-22, 210) with base ring Rational Field with basis (1, i, 1/2*i + 1/2*j, 1/2 + 17/22*i + 1/44*k) + Order of Quaternion Algebra (-22, 210) with base ring Rational Field + with basis (1, i, 1/2*i + 1/2*j, 1/2 + 17/22*i + 1/44*k) sage: for d in ( m for m in range(1, 750) if is_squarefree(m) ): # long time (3s) ....: A = QuaternionAlgebra(d) @@ -751,7 +761,8 @@ def maximal_order(self, take_shortcuts=True): sage: QuaternionAlgebra(K,-1,-1).maximal_order() Traceback (most recent call last): ... - NotImplementedError: maximal order only implemented for rational quaternion algebras + NotImplementedError: maximal order only implemented + for rational quaternion algebras """ if self.base_ring() != QQ: raise NotImplementedError("maximal order only implemented for rational quaternion algebras") @@ -1037,7 +1048,7 @@ def discriminant(self): sage: B.discriminant() Fractional ideal (2) - sage: QuaternionAlgebra(QQ[sqrt(2)],3,19).discriminant() + sage: QuaternionAlgebra(QQ[sqrt(2)], 3, 19).discriminant() # optional - sage.symbolic Fractional ideal (1) """ if not is_RationalField(self.base_ring()): @@ -1082,11 +1093,13 @@ def _magma_init_(self, magma): A more complicated example involving a quaternion algebra over a number field:: - sage: K. = QQ[sqrt(2)]; Q = QuaternionAlgebra(K,-1,a); Q - Quaternion Algebra (-1, sqrt2) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? - sage: magma(Q) # optional - magma - Quaternion Algebra with base ring Number Field with defining polynomial x^2 - 2 over the Rational Field, defined by i^2 = -1, j^2 = sqrt2 - sage: Q._magma_init_(magma) # optional - magma + sage: K. = QQ[sqrt(2)]; Q = QuaternionAlgebra(K,-1,a); Q # optional - sage.symbolic + Quaternion Algebra (-1, sqrt2) with base ring Number Field in sqrt2 + with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? + sage: magma(Q) # optional - magma sage.symbolic + Quaternion Algebra with base ring Number Field with defining polynomial + x^2 - 2 over the Rational Field, defined by i^2 = -1, j^2 = sqrt2 + sage: Q._magma_init_(magma) # optional - magma sage.symbolic 'QuaternionAlgebra(_sage_[...],(_sage_[...]![-1, 0]),(_sage_[...]![0, 1]))' """ R = magma(self.base_ring()) @@ -1107,14 +1120,17 @@ def quaternion_order(self, basis, check=True): sage: Q. = QuaternionAlgebra(-11,-1) sage: Q.quaternion_order([1,i,j,k]) - Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1, i, j, k) + Order of Quaternion Algebra (-11, -1) with base ring Rational Field + with basis (1, i, j, k) We test out ``check=False``:: sage: Q.quaternion_order([1,i,j,k], check=False) - Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1, i, j, k) + Order of Quaternion Algebra (-11, -1) with base ring Rational Field + with basis (1, i, j, k) sage: Q.quaternion_order([i,j,k], check=False) - Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (i, j, k) + Order of Quaternion Algebra (-11, -1) with base ring Rational Field + with basis (i, j, k) """ return QuaternionOrder(self, basis, check=check) @@ -1210,7 +1226,9 @@ def modp_splitting_data(self, p): sage: Q.modp_splitting_data(5) Traceback (most recent call last): ... - NotImplementedError: algorithm for computing local splittings not implemented in general (currently require the first invariant to be coprime to p) + NotImplementedError: algorithm for computing local splittings + not implemented in general (currently require the first invariant + to be coprime to p) sage: Q.modp_splitting_data(2) Traceback (most recent call last): @@ -1363,7 +1381,8 @@ def __init__(self, A, basis, check=True): sage: K = QuadraticField(10) sage: A. = QuaternionAlgebra(K,-1,-1) sage: A.quaternion_order([1,i,j,k]) - Order of Quaternion Algebra (-1, -1) with base ring Number Field in a with defining polynomial x^2 - 10 with a = 3.162277660168380? with basis (1, i, j, k) + Order of Quaternion Algebra (-1, -1) with base ring Number Field in a + with defining polynomial x^2 - 10 with a = 3.162277660168380? with basis (1, i, j, k) sage: A.quaternion_order([1,i/2,j,k]) Traceback (most recent call last): ... @@ -1508,7 +1527,8 @@ def gen(self, n): EXAMPLES:: sage: R = QuaternionAlgebra(-11,-1).maximal_order(); R - Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*i, 1/2*j - 1/2*k, i, -k) + Order of Quaternion Algebra (-11, -1) with base ring Rational Field + with basis (1/2 + 1/2*i, 1/2*j - 1/2*k, i, -k) sage: R.gen(0) 1/2 + 1/2*i sage: R.gen(1) @@ -1649,20 +1669,23 @@ def intersection(self, other): sage: R = QuaternionAlgebra(-11,-1).maximal_order() sage: R.intersection(R) - Order of Quaternion Algebra (-11, -1) with base ring Rational Field with basis (1/2 + 1/2*i, i, 1/2*j + 1/2*k, k) + Order of Quaternion Algebra (-11, -1) with base ring Rational Field + with basis (1/2 + 1/2*i, i, 1/2*j + 1/2*k, k) We intersect various orders in the quaternion algebra ramified at 11:: sage: B = BrandtModule(11,3) sage: R = B.maximal_order(); S = B.order_of_level_N() sage: R.intersection(S) - Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 5/2*k, j, 3*k) + Order of Quaternion Algebra (-1, -11) with base ring Rational Field + with basis (1/2 + 1/2*j, 1/2*i + 5/2*k, j, 3*k) sage: R.intersection(S) == S True sage: B = BrandtModule(11,5) sage: T = B.order_of_level_N() sage: S.intersection(T) - Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 23/2*k, j, 15*k) + Order of Quaternion Algebra (-1, -11) with base ring Rational Field + with basis (1/2 + 1/2*j, 1/2*i + 23/2*k, j, 15*k) """ if not isinstance(other, QuaternionOrder): raise TypeError("other must be a QuaternionOrder") @@ -2021,7 +2044,8 @@ def scale(self, alpha, left=False): EXAMPLES:: - sage: B = BrandtModule(5,37); I = B.right_ideals()[0]; i,j,k = B.quaternion_algebra().gens(); I + sage: B = BrandtModule(5,37); I = B.right_ideals()[0] + sage: i,j,k = B.quaternion_algebra().gens(); I Fractional ideal (2 + 2*j + 106*k, i + 2*j + 105*k, 4*j + 64*k, 148*k) sage: I.scale(i) Fractional ideal (2*i + 212*j - 2*k, -2 + 210*j - 2*k, 128*j - 4*k, 296*j) @@ -2101,9 +2125,11 @@ def _compute_order(self, side='left'): sage: R. = QuaternionAlgebra(-1,-11) sage: I = R.ideal([2 + 2*j + 140*k, 2*i + 4*j + 150*k, 8*j + 104*k, 152*k]) sage: Ol = I._compute_order('left'); Ol - Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j + 35*k, 1/4*i + 1/2*j + 75/4*k, j + 32*k, 38*k) + Order of Quaternion Algebra (-1, -11) with base ring Rational Field + with basis (1/2 + 1/2*j + 35*k, 1/4*i + 1/2*j + 75/4*k, j + 32*k, 38*k) sage: Or = I._compute_order('right'); Or - Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j + 16*k, 1/2*i + 11/2*k, j + 13*k, 19*k) + Order of Quaternion Algebra (-1, -11) with base ring Rational Field + with basis (1/2 + 1/2*j + 16*k, 1/2*i + 11/2*k, j + 13*k, 19*k) sage: Ol.discriminant() 209 sage: Or.discriminant() @@ -2163,7 +2189,8 @@ def left_order(self): sage: R = B.maximal_order() sage: I = R.unit_ideal() sage: I.left_order() - Order of Quaternion Algebra (-1, -11) with base ring Rational Field with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k) + Order of Quaternion Algebra (-1, -11) with base ring Rational Field + with basis (1/2 + 1/2*j, 1/2*i + 1/2*k, j, k) We do a consistency check:: @@ -2186,9 +2213,11 @@ def right_order(self): sage: I = BrandtModule(389).right_ideals()[1]; I Fractional ideal (2 + 6*j + 2*k, i + 2*j + k, 8*j, 8*k) sage: I.right_order() - Order of Quaternion Algebra (-2, -389) with base ring Rational Field with basis (1/2 + 1/2*j + 1/2*k, 1/4*i + 1/2*j + 1/4*k, j, k) + Order of Quaternion Algebra (-2, -389) with base ring Rational Field + with basis (1/2 + 1/2*j + 1/2*k, 1/4*i + 1/2*j + 1/4*k, j, k) sage: I.left_order() - Order of Quaternion Algebra (-2, -389) with base ring Rational Field with basis (1/2 + 1/2*j + 3/2*k, 1/8*i + 1/4*j + 9/8*k, j + k, 2*k) + Order of Quaternion Algebra (-2, -389) with base ring Rational Field + with basis (1/2 + 1/2*j + 3/2*k, 1/8*i + 1/4*j + 9/8*k, j + k, 2*k) The following is a big consistency check. We take reps for all the right ideal classes of a certain order, take the @@ -2238,7 +2267,8 @@ def quaternion_order(self): sage: R = QuaternionAlgebra(-11,-1).maximal_order() sage: R.unit_ideal().quaternion_order() is R - doctest:...: DeprecationWarning: quaternion_order() is deprecated, please use left_order() or right_order() + doctest:...: DeprecationWarning: quaternion_order() is deprecated, + please use left_order() or right_order() See https://github.com/sagemath/sage/issues/31583 for details. True """ @@ -2838,31 +2868,47 @@ def cyclic_right_subideals(self, p, alpha=None): sage: B = BrandtModule(2,37); I = B.right_ideals()[0] sage: I.cyclic_right_subideals(3) - [Fractional ideal (2 + 2*i + 10*j + 90*k, 4*i + 4*j + 152*k, 12*j + 132*k, 444*k), Fractional ideal (2 + 2*i + 2*j + 150*k, 4*i + 8*j + 196*k, 12*j + 132*k, 444*k), Fractional ideal (2 + 2*i + 6*j + 194*k, 4*i + 8*j + 344*k, 12*j + 132*k, 444*k), Fractional ideal (2 + 2*i + 6*j + 46*k, 4*i + 4*j + 4*k, 12*j + 132*k, 444*k)] + [Fractional ideal (2 + 2*i + 10*j + 90*k, 4*i + 4*j + 152*k, 12*j + 132*k, 444*k), + Fractional ideal (2 + 2*i + 2*j + 150*k, 4*i + 8*j + 196*k, 12*j + 132*k, 444*k), + Fractional ideal (2 + 2*i + 6*j + 194*k, 4*i + 8*j + 344*k, 12*j + 132*k, 444*k), + Fractional ideal (2 + 2*i + 6*j + 46*k, 4*i + 4*j + 4*k, 12*j + 132*k, 444*k)] sage: B = BrandtModule(5,389); I = B.right_ideals()[0] sage: C = I.cyclic_right_subideals(3); C - [Fractional ideal (2 + 10*j + 546*k, i + 6*j + 133*k, 12*j + 3456*k, 4668*k), Fractional ideal (2 + 2*j + 2910*k, i + 6*j + 3245*k, 12*j + 3456*k, 4668*k), Fractional ideal (2 + i + 2295*k, 3*i + 2*j + 3571*k, 4*j + 2708*k, 4668*k), Fractional ideal (2 + 2*i + 2*j + 4388*k, 3*i + 2*j + 2015*k, 4*j + 4264*k, 4668*k)] + [Fractional ideal (2 + 10*j + 546*k, i + 6*j + 133*k, 12*j + 3456*k, 4668*k), + Fractional ideal (2 + 2*j + 2910*k, i + 6*j + 3245*k, 12*j + 3456*k, 4668*k), + Fractional ideal (2 + i + 2295*k, 3*i + 2*j + 3571*k, 4*j + 2708*k, 4668*k), + Fractional ideal (2 + 2*i + 2*j + 4388*k, 3*i + 2*j + 2015*k, 4*j + 4264*k, 4668*k)] sage: [(I.free_module()/J.free_module()).invariants() for J in C] [(3, 3), (3, 3), (3, 3), (3, 3)] sage: I.scale(3).cyclic_right_subideals(3) - [Fractional ideal (6 + 30*j + 1638*k, 3*i + 18*j + 399*k, 36*j + 10368*k, 14004*k), Fractional ideal (6 + 6*j + 8730*k, 3*i + 18*j + 9735*k, 36*j + 10368*k, 14004*k), Fractional ideal (6 + 3*i + 6885*k, 9*i + 6*j + 10713*k, 12*j + 8124*k, 14004*k), Fractional ideal (6 + 6*i + 6*j + 13164*k, 9*i + 6*j + 6045*k, 12*j + 12792*k, 14004*k)] + [Fractional ideal (6 + 30*j + 1638*k, 3*i + 18*j + 399*k, 36*j + 10368*k, 14004*k), + Fractional ideal (6 + 6*j + 8730*k, 3*i + 18*j + 9735*k, 36*j + 10368*k, 14004*k), + Fractional ideal (6 + 3*i + 6885*k, 9*i + 6*j + 10713*k, 12*j + 8124*k, 14004*k), + Fractional ideal (6 + 6*i + 6*j + 13164*k, 9*i + 6*j + 6045*k, 12*j + 12792*k, 14004*k)] sage: C = I.scale(1/9).cyclic_right_subideals(3); C - [Fractional ideal (2/9 + 10/9*j + 182/3*k, 1/9*i + 2/3*j + 133/9*k, 4/3*j + 384*k, 1556/3*k), Fractional ideal (2/9 + 2/9*j + 970/3*k, 1/9*i + 2/3*j + 3245/9*k, 4/3*j + 384*k, 1556/3*k), Fractional ideal (2/9 + 1/9*i + 255*k, 1/3*i + 2/9*j + 3571/9*k, 4/9*j + 2708/9*k, 1556/3*k), Fractional ideal (2/9 + 2/9*i + 2/9*j + 4388/9*k, 1/3*i + 2/9*j + 2015/9*k, 4/9*j + 4264/9*k, 1556/3*k)] + [Fractional ideal (2/9 + 10/9*j + 182/3*k, 1/9*i + 2/3*j + 133/9*k, 4/3*j + 384*k, 1556/3*k), + Fractional ideal (2/9 + 2/9*j + 970/3*k, 1/9*i + 2/3*j + 3245/9*k, 4/3*j + 384*k, 1556/3*k), + Fractional ideal (2/9 + 1/9*i + 255*k, 1/3*i + 2/9*j + 3571/9*k, 4/9*j + 2708/9*k, 1556/3*k), + Fractional ideal (2/9 + 2/9*i + 2/9*j + 4388/9*k, 1/3*i + 2/9*j + 2015/9*k, 4/9*j + 4264/9*k, 1556/3*k)] sage: [(I.scale(1/9).free_module()/J.free_module()).invariants() for J in C] [(3, 3), (3, 3), (3, 3), (3, 3)] sage: Q. = QuaternionAlgebra(-2,-5) sage: I = Q.ideal([Q(1),i,j,k]) sage: I.cyclic_right_subideals(3) - [Fractional ideal (1 + 2*j, i + k, 3*j, 3*k), Fractional ideal (1 + j, i + 2*k, 3*j, 3*k), Fractional ideal (1 + 2*i, 3*i, j + 2*k, 3*k), Fractional ideal (1 + i, 3*i, j + k, 3*k)] + [Fractional ideal (1 + 2*j, i + k, 3*j, 3*k), + Fractional ideal (1 + j, i + 2*k, 3*j, 3*k), + Fractional ideal (1 + 2*i, 3*i, j + 2*k, 3*k), + Fractional ideal (1 + i, 3*i, j + k, 3*k)] The general algorithm is not yet implemented here:: sage: I.cyclic_right_subideals(3)[0].cyclic_right_subideals(3) Traceback (most recent call last): ... - NotImplementedError: general algorithm not implemented (The given basis vectors must be linearly independent.) + NotImplementedError: general algorithm not implemented + (The given basis vectors must be linearly independent.) """ R = self.right_order() Q = self.quaternion_algebra() @@ -3075,7 +3121,8 @@ def normalize_basis_at_p(e, p, B=QuaternionAlgebraElement_abstract.pair): sage: A. = QuaternionAlgebra(-1,-7) sage: e = [A(1), k, j, 1/2 + 1/2*i + 1/2*j + 1/2*k] sage: normalize_basis_at_p(e, 2) - [(1, 0), (1/2 + 1/2*i + 1/2*j + 1/2*k, 0), (-34/105*i - 463/735*j + 71/105*k, 1), (-34/105*i - 463/735*j + 71/105*k, 1)] + [(1, 0), (1/2 + 1/2*i + 1/2*j + 1/2*k, 0), (-34/105*i - 463/735*j + 71/105*k, 1), + (-34/105*i - 463/735*j + 71/105*k, 1)] """ N = len(e) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index a1dd86a224c..71188038aa9 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -1658,8 +1658,8 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/5)]; Q. = QuaternionAlgebra(K,-a,a*17/3) - sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest + sage: K. = QQ[2^(1/5)]; Q. = QuaternionAlgebra(K,-a,a*17/3) # optional - sage.symbolic + sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # optional - sage.symbolic a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k """ fmpz_poly_init(self.x) @@ -1688,8 +1688,8 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) - sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) # optional - sage.symbolic + sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # optional - sage.symbolic a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k """ self._parent = parent @@ -1732,21 +1732,21 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) - sage: Q([a,-2/3,a^2-1/2,a*2]) + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) # optional - sage.symbolic + sage: Q([a,-2/3,a^2-1/2,a*2]) # optional - sage.symbolic a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k - sage: x = Q([a,-2/3,a^2-1/2,a*2]) - sage: type(x) + sage: x = Q([a,-2/3,a^2-1/2,a*2]) # optional - sage.symbolic + sage: type(x) # optional - sage.symbolic - sage: x[0] + sage: x[0] # optional - sage.symbolic a - sage: x[1] + sage: x[1] # optional - sage.symbolic -2/3 - sage: x[2] + sage: x[2] # optional - sage.symbolic a^2 - 1/2 - sage: x[3] + sage: x[3] # optional - sage.symbolic 2*a - sage: list(x) + sage: list(x) # optional - sage.symbolic [a, -2/3, a^2 - 1/2, 2*a] """ # general number -- this code assumes that the number field is not quadratic!! @@ -1773,13 +1773,13 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) - sage: z = (i+j+k+a)^2; z + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic + sage: z = (i+j+k+a)^2; z # optional - sage.symbolic a^2 + 4*a - 3 + 2*a*i + 2*a*j + 2*a*k - sage: f, t = z.__reduce__() - sage: f(*t) + sage: f, t = z.__reduce__() # optional - sage.symbolic + sage: f(*t) # optional - sage.symbolic a^2 + 4*a - 3 + 2*a*i + 2*a*j + 2*a*k - sage: loads(dumps(z)) == z + sage: loads(dumps(z)) == z # optional - sage.symbolic True """ return (unpickle_QuaternionAlgebraElement_number_field_v0, @@ -1791,11 +1791,12 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) - sage: z = a + i + (2/3)*a^3*j + (1+a)*k; w = a - i - (2/3)*a^3*j + (1/3+a)*k - sage: type(z) + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic + sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic + sage: type(z) # optional - sage.symbolic - sage: z._add_(w) + sage: z._add_(w) # optional - sage.symbolic 2*a + (2*a + 4/3)*k Check that the fix in :trac:`17099` is correct:: @@ -1863,11 +1864,12 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) - sage: z = a + i + (2/3)*a^3*j + (1+a)*k; w = a - i - (2/3)*a^3*j + (1/3+a)*k - sage: type(z) + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic + sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic + sage: type(z) # optional - sage.symbolic - sage: z._sub_(w) + sage: z._sub_(w) # optional - sage.symbolic 2*i + 8/3*j + 2/3*k """ # Implementation Note: To obtain _sub_, we simply replace every occurrence of @@ -1912,11 +1914,12 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) - sage: z = a + i + (2/3)*a^3*j + (1+a)*k; w = a - i - (2/3)*a^3*j + (1/3+a)*k - sage: type(z) + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic + sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic + sage: type(z) # optional - sage.symbolic - sage: z._mul_(w) + sage: z._mul_(w) # optional - sage.symbolic 5*a^2 - 7/9*a + 9 + (-8/3*a^2 - 16/9*a)*i + (-6*a - 4)*j + (2*a^2 + 4/3*a)*k """ # We use the following formula for multiplication: @@ -2060,11 +2063,12 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra TESTS:: - sage: F = QQ[3^(1/3)] - sage: a = F.gen() - sage: K. = QuaternionAlgebra(F, -10 + a, -7 - a) - sage: ((1/4 + 1/2 * i + a^3/7 * j + a/28 * k)*14*i)^3 # implicit doctest - 34503/2*a^2 + 132195/2*a + 791399/4 + (203/8*a^2 - 10591*a + 169225/4)*i + (-84695/4*a^2 + 483413/8*a + 18591/4)*j + (-87/2*a^2 + 18156*a - 72525)*k + sage: F = QQ[3^(1/3)] # optional - sage.symbolic + sage: a = F.gen() # optional - sage.symbolic + sage: K. = QuaternionAlgebra(F, -10 + a, -7 - a) # optional - sage.symbolic + sage: ((1/4 + 1/2 * i + a^3/7 * j + a/28 * k)*14*i)^3 # implicit doctest # optional - sage.symbolic + 34503/2*a^2 + 132195/2*a + 791399/4 + (203/8*a^2 - 10591*a + 169225/4)*i + + (-84695/4*a^2 + 483413/8*a + 18591/4)*j + (-87/2*a^2 + 18156*a - 72525)*k """ # Note: this function changes the module-level global variables @@ -2137,11 +2141,11 @@ def unpickle_QuaternionAlgebraElement_number_field_v0(*args): """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j - sage: f, t = z.__reduce__() - sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j # optional - sage.symbolic + sage: f, t = z.__reduce__() # optional - sage.symbolic + sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) # optional - sage.symbolic i + j - sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z + sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z # optional - sage.symbolic True """ return QuaternionAlgebraElement_number_field(*args, check=False) diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index 48b1dee6075..efb148bb5b3 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -90,12 +90,12 @@ def repr_from_monomials(monomials, term_repr, use_latex=False): Leading minus signs are dealt with appropriately:: - sage: d = [(z, -4/7), (y, -sqrt(2)), (x, -5)] - sage: repr_from_monomials(d, lambda m: repr(m)) + sage: d = [(z, -4/7), (y, -sqrt(2)), (x, -5)] # optional - sage.symbolic + sage: repr_from_monomials(d, lambda m: repr(m)) # optional - sage.symbolic '-4/7*z - sqrt(2)*y - 5*x' - sage: a = repr_from_monomials(d, lambda m: latex(m), True); a + sage: a = repr_from_monomials(d, lambda m: latex(m), True); a # optional - sage.symbolic -\frac{4}{7} z - \sqrt{2} y - 5 x - sage: type(a) + sage: type(a) # optional - sage.symbolic Indirect doctests using a class that uses this function:: From c6b3d5719c0908ee7c102cff3d79403143a97cff Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 1 Jun 2023 23:00:42 -0700 Subject: [PATCH 03/25] sage.algebras: Add # optional --- .../finite_dimensional_algebra.py | 321 +++++++++++------- .../finite_dimensional_algebra_element.pyx | 137 +++++--- .../finite_dimensional_algebra_morphism.py | 32 +- 3 files changed, 313 insertions(+), 177 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index af2b5e7dd3c..67625148ecd 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -57,22 +57,28 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Algebra): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]); A Finite-dimensional algebra of degree 2 over Finite Field of size 3 - sage: TestSuite(A).run() + sage: TestSuite(A).run() # optional - sage.rings.finite_rings - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B Finite-dimensional algebra of degree 3 over Rational Field TESTS:: - sage: A.category() - Category of finite dimensional magmatic algebras with basis over Finite Field of size 3 - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])], assume_associative=True) - sage: A.category() - Category of finite dimensional associative algebras with basis over Finite Field of size 3 + sage: A.category() # optional - sage.rings.finite_rings + Category of finite dimensional magmatic algebras with basis + over Finite Field of size 3 + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])], + ....: assume_associative=True) + sage: A.category() # optional - sage.rings.finite_rings + Category of finite dimensional associative algebras with basis + over Finite Field of size 3 """ @staticmethod def __classcall_private__(cls, k, table, names='e', assume_associative=False, @@ -83,46 +89,47 @@ def __classcall_private__(cls, k, table, names='e', assume_associative=False, TESTS:: sage: table = [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])] - sage: A1 = FiniteDimensionalAlgebra(GF(3), table) - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, names='e') - sage: A3 = FiniteDimensionalAlgebra(GF(3), table, names=['e0', 'e1']) - sage: A1 is A2 and A2 is A3 + sage: A1 = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, names='e') # optional - sage.rings.finite_rings + sage: A3 = FiniteDimensionalAlgebra(GF(3), table, names=['e0', 'e1']) # optional - sage.rings.finite_rings + sage: A1 is A2 and A2 is A3 # optional - sage.rings.finite_rings True The ``assume_associative`` keyword is built into the category:: sage: from sage.categories.magmatic_algebras import MagmaticAlgebras - sage: cat = MagmaticAlgebras(GF(3)).FiniteDimensional().WithBasis() - sage: A1 = FiniteDimensionalAlgebra(GF(3), table, category=cat.Associative()) - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, assume_associative=True) - sage: A1 is A2 + sage: cat = MagmaticAlgebras(GF(3)).FiniteDimensional().WithBasis() # optional - sage.rings.finite_rings + sage: A1 = FiniteDimensionalAlgebra(GF(3), table, # optional - sage.rings.finite_rings + ....: category=cat.Associative()) + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, assume_associative=True) # optional - sage.rings.finite_rings + sage: A1 is A2 # optional - sage.rings.finite_rings True Uniqueness depends on the category:: - sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis() - sage: A1 = FiniteDimensionalAlgebra(GF(3), table) - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, category=cat) - sage: A1 == A2 + sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis() # optional - sage.rings.finite_rings + sage: A1 = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, category=cat) # optional - sage.rings.finite_rings + sage: A1 == A2 # optional - sage.rings.finite_rings False - sage: A1 is A2 + sage: A1 is A2 # optional - sage.rings.finite_rings False Checking that equality is still as expected:: - sage: A = FiniteDimensionalAlgebra(GF(3), table) - sage: B = FiniteDimensionalAlgebra(GF(5), [Matrix([0])]) - sage: A == A + sage: A = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings + sage: B = FiniteDimensionalAlgebra(GF(5), [Matrix([0])]) # optional - sage.rings.finite_rings + sage: A == A # optional - sage.rings.finite_rings True - sage: B == B + sage: B == B # optional - sage.rings.finite_rings True - sage: A == B + sage: A == B # optional - sage.rings.finite_rings False - sage: A != A + sage: A != A # optional - sage.rings.finite_rings False - sage: B != B + sage: B != B # optional - sage.rings.finite_rings False - sage: A != B + sage: A != B # optional - sage.rings.finite_rings True """ n = len(table) @@ -154,17 +161,17 @@ def __init__(self, k, table, names='e', category=None): sage: TestSuite(A).run() - sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([1])]) - sage: B + sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([1])]) # optional - sage.rings.finite_rings + sage: B # optional - sage.rings.finite_rings Finite-dimensional algebra of degree 1 over Finite Field of size 7 - sage: TestSuite(B).run() + sage: TestSuite(B).run() # optional - sage.rings.finite_rings sage: C = FiniteDimensionalAlgebra(CC, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) sage: C Finite-dimensional algebra of degree 2 over Complex Field with 53 bits of precision sage: TestSuite(C).run() - sage: FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]])]) + sage: FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]])]) # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: input is not a multiplication table @@ -197,14 +204,15 @@ def _coerce_map_from_(self, S): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.has_coerce_map_from(ZZ) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings True - sage: A.has_coerce_map_from(GF(3)) + sage: A.has_coerce_map_from(GF(3)) # optional - sage.rings.finite_rings True - sage: A.has_coerce_map_from(GF(5)) + sage: A.has_coerce_map_from(GF(5)) # optional - sage.rings.finite_rings False - sage: A.has_coerce_map_from(QQ) + sage: A.has_coerce_map_from(QQ) # optional - sage.rings.finite_rings False """ return S == self or (self.base_ring().has_coerce_map_from(S) and self.is_unitary()) @@ -224,7 +232,9 @@ def _element_constructor_(self, x): ... TypeError: algebra is not unitary - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(17) 17*e0 + 17*e2 """ @@ -243,7 +253,9 @@ def _Hom_(self, B, category): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) sage: A._Hom_(B, A.category()) - Set of Homomorphisms from Finite-dimensional algebra of degree 1 over Rational Field to Finite-dimensional algebra of degree 2 over Rational Field + Set of Homomorphisms + from Finite-dimensional algebra of degree 1 over Rational Field + to Finite-dimensional algebra of degree 2 over Rational Field """ cat = MagmaticAlgebras(self.base_ring()).FiniteDimensional().WithBasis() if category.is_subcategory(cat): @@ -258,8 +270,9 @@ def ngens(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.ngens() + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.ngens() # optional - sage.rings.finite_rings 2 """ return len(self._table) @@ -273,8 +286,9 @@ def gen(self, i): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.gen(0) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.gen(0) # optional - sage.rings.finite_rings e0 """ return self.element_class(self, [j == i for j in range(self.ngens())]) @@ -286,8 +300,9 @@ def basis(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.basis() + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.basis() # optional - sage.rings.finite_rings Family (e0, e1) """ from sage.sets.family import Family @@ -299,8 +314,9 @@ def __iter__(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: list(A) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: list(A) # optional - sage.rings.finite_rings [0, e0, 2*e0, e1, e0 + e1, 2*e0 + e1, 2*e1, e0 + 2*e1, 2*e0 + 2*e1] This is used in the :class:`Testsuite`'s when ``self`` is @@ -319,8 +335,9 @@ def _ideal_class_(self, n=0): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A._ideal_class_() + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A._ideal_class_() # optional - sage.rings.finite_rings """ return FiniteDimensionalAlgebraIdeal @@ -332,8 +349,9 @@ def table(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.table() + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.table() # optional - sage.rings.finite_rings ( [1 0] [0 1] [0 1], [0 0] @@ -349,7 +367,8 @@ def left_table(self): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1],[-1,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: T = B.left_table(); T ( [1 0] [ 0 1] @@ -381,9 +400,9 @@ def base_extend(self, F): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])]) - sage: k. = GF(4) - sage: C.base_extend(k) + sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])]) # optional - sage.rings.finite_rings + sage: k. = GF(4) # optional - sage.rings.finite_rings + sage: C.base_extend(k) # optional - sage.rings.finite_rings Finite-dimensional algebra of degree 1 over Finite Field in y of size 2^2 """ # Base extension of the multiplication table is done by __classcall_private__. @@ -395,11 +414,13 @@ def cardinality(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [2, 3]])]) - sage: A.cardinality() + sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [2, 3]])]) + sage: A.cardinality() # optional - sage.rings.finite_rings 49 - sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [2, 3]])]) + sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [2, 3]])]) sage: B.cardinality() +Infinity @@ -431,9 +452,11 @@ def ideal(self, gens=None, given_by_matrix=False, side=None): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.ideal(A([1,1])) - Ideal (e0 + e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3 + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.ideal(A([1,1])) # optional - sage.rings.finite_rings + Ideal (e0 + e1) of + Finite-dimensional algebra of degree 2 over Finite Field of size 3 """ return self._ideal_class_()(self, gens=gens, given_by_matrix=given_by_matrix) @@ -445,11 +468,14 @@ def is_associative(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1],[-1,0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: A.is_associative() True - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,1], [0,0,0], [1,0,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,1], [0,0,0], [1,0,0]])]) sage: B.is_associative() False @@ -473,11 +499,15 @@ def is_commutative(self): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B.is_commutative() True - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,1,0], [0,0,1]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,1,0], [0,0,1]])]) sage: C.is_commutative() False """ @@ -495,11 +525,13 @@ def is_finite(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [2, 3]])]) - sage: A.is_finite() + sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [2, 3]])]) + sage: A.is_finite() # optional - sage.rings.finite_rings True - sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [2, 3]])]) + sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [2, 3]])]) sage: B.is_finite() False @@ -526,27 +558,35 @@ def is_unitary(self): sage: A.is_unitary() True - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: B.is_unitary() True - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]), Matrix([[0,0], [0,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]), + ....: Matrix([[0,0], [0,0]])]) sage: C.is_unitary() False - sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[1,0], [0,1]])]) + sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[1,0], [0,1]])]) sage: D.is_unitary() False - sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0],[1,0]]), Matrix([[0,1],[0,1]])]) + sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0],[1,0]]), + ....: Matrix([[0,1],[0,1]])]) sage: E.is_unitary() False - sage: F = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,1], [0,0,0], [1,0,0]])]) + sage: F = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,1], [0,0,0], [1,0,0]])]) sage: F.is_unitary() True - sage: G = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [1,0,0]])]) + sage: G = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [1,0,0]])]) sage: G.is_unitary() # Unique right identity, but no left identity. False """ @@ -583,8 +623,8 @@ def is_zero(self): sage: A.is_zero() True - sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])]) - sage: B.is_zero() + sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])]) # optional - sage.rings.finite_rings + sage: B.is_zero() # optional - sage.rings.finite_rings False """ return self.degree() == 0 @@ -600,21 +640,27 @@ def one(self): sage: A.one() 0 - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: B.one() e0 - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]), Matrix([[0,0], [0,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[0,0], [0,0]]), + ....: Matrix([[0,0], [0,0]])]) sage: C.one() Traceback (most recent call last): ... TypeError: algebra is not unitary - sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,1], [0,0,0], [1,0,0]])]) + sage: D = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,1], [0,0,0], [1,0,0]])]) sage: D.one() e0 - sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [1,0,0]])]) + sage: E = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,1]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [1,0,0]])]) sage: E.one() Traceback (most recent call last): ... @@ -634,11 +680,14 @@ def random_element(self, *args, **kwargs): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.random_element() # random + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.random_element() # random # optional - sage.rings.finite_rings e0 + 2*e1 - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B.random_element(num_bound=1000) # random 215/981*e0 + 709/953*e1 + 931/264*e2 """ @@ -648,32 +697,39 @@ def _is_valid_homomorphism_(self, other, im_gens, base_map=None): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) sage: Hom(A, B)(Matrix([[1], [0]])) - Morphism from Finite-dimensional algebra of degree 2 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field given by matrix + Morphism from Finite-dimensional algebra of degree 2 over Rational Field + to Finite-dimensional algebra of degree 1 over Rational Field given by matrix [1] [0] sage: Hom(B, A)(Matrix([[1, 0]])) - Morphism from Finite-dimensional algebra of degree 1 over Rational Field to Finite-dimensional algebra of degree 2 over Rational Field given by matrix + Morphism from Finite-dimensional algebra of degree 1 over Rational Field + to Finite-dimensional algebra of degree 2 over Rational Field given by matrix [1 0] sage: H = Hom(A, A) sage: H(Matrix.identity(QQ, 2)) - Morphism from Finite-dimensional algebra of degree 2 over Rational Field to Finite-dimensional algebra of degree 2 over Rational Field given by matrix + Morphism from Finite-dimensional algebra of degree 2 over Rational Field + to Finite-dimensional algebra of degree 2 over Rational Field given by matrix [1 0] [0 1] sage: H(Matrix([[1, 0], [0, 0]])) - Morphism from Finite-dimensional algebra of degree 2 over Rational Field to Finite-dimensional algebra of degree 2 over Rational Field given by matrix + Morphism from Finite-dimensional algebra of degree 2 over Rational Field + to Finite-dimensional algebra of degree 2 over Rational Field given by matrix [1 0] [0 0] sage: H(Matrix([[1, 0], [1, 1]])) Traceback (most recent call last): ... - ValueError: relations do not all (canonically) map to 0 under map determined by images of generators + ValueError: relations do not all (canonically) map to 0 + under map determined by images of generators sage: Hom(B, B)(Matrix([[2]])) Traceback (most recent call last): ... - ValueError: relations do not all (canonically) map to 0 under map determined by images of generators + ValueError: relations do not all (canonically) map to 0 + under map determined by images of generators """ assert len(im_gens) == self.degree() @@ -694,7 +750,7 @@ def quotient_map(self, ideal): INPUT: - - ``ideal`` -- a ``FiniteDimensionalAlgebraIdeal`` + - ``ideal`` -- a :class:`FiniteDimensionalAlgebraIdeal` OUTPUT: @@ -703,17 +759,22 @@ def quotient_map(self, ideal): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: q0 = A.quotient_map(A.zero_ideal()) - sage: q0 - Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 2 over Finite Field of size 3 given by matrix - [1 0] - [0 1] - sage: q1 = A.quotient_map(A.ideal(A.gen(1))) - sage: q1 - Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 1 over Finite Field of size 3 given by matrix - [1] - [0] + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: q0 = A.quotient_map(A.zero_ideal()); q0 # optional - sage.rings.finite_rings + Morphism + from Finite-dimensional algebra of degree 2 over Finite Field of size 3 + to Finite-dimensional algebra of degree 2 over Finite Field of size 3 + given by matrix + [1 0] + [0 1] + sage: q1 = A.quotient_map(A.ideal(A.gen(1))); q1 # optional - sage.rings.finite_rings + Morphism + from Finite-dimensional algebra of degree 2 over Finite Field of size 3 + to Finite-dimensional algebra of degree 1 over Finite Field of size 3 + given by matrix + [1] + [0] """ k = self.base_ring() f = ideal.basis_matrix().transpose().kernel().basis_matrix().echelon_form().transpose() @@ -744,11 +805,15 @@ def maximal_ideal(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.maximal_ideal() - Ideal (0, e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3 + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.maximal_ideal() # optional - sage.rings.finite_rings + Ideal (0, e1) of + Finite-dimensional algebra of degree 2 over Finite Field of size 3 - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B.maximal_ideal() Traceback (most recent call last): ... @@ -783,18 +848,31 @@ def primary_decomposition(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.primary_decomposition() - [Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 2 over Finite Field of size 3 given by matrix [1 0] - [0 1]] - - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.primary_decomposition() # optional - sage.rings.finite_rings + [Morphism + from Finite-dimensional algebra of degree 2 over Finite Field of size 3 + to Finite-dimensional algebra of degree 2 over Finite Field of size 3 + given by matrix [1 0] + [0 1]] + + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B.primary_decomposition() - [Morphism from Finite-dimensional algebra of degree 3 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field given by matrix [0] - [0] - [1], Morphism from Finite-dimensional algebra of degree 3 over Rational Field to Finite-dimensional algebra of degree 2 over Rational Field given by matrix [1 0] - [0 1] - [0 0]] + [Morphism + from Finite-dimensional algebra of degree 3 over Rational Field + to Finite-dimensional algebra of degree 1 over Rational Field + given by matrix [0] + [0] + [1], + Morphism + from Finite-dimensional algebra of degree 3 over Rational Field + to Finite-dimensional algebra of degree 2 over Rational Field + given by matrix [1 0] + [0 1] + [0 0]] """ k = self.base_ring() n = self.degree() @@ -838,8 +916,9 @@ def maximal_ideals(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) - sage: A.maximal_ideals() + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0, 1], [0, 0]])]) + sage: A.maximal_ideals() # optional - sage.rings.finite_rings [Ideal (e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3] sage: B = FiniteDimensionalAlgebra(QQ, []) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx index e4901439e19..d0724bca028 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx @@ -26,7 +26,9 @@ cpdef FiniteDimensionalAlgebraElement unpickle_FiniteDimensionalAlgebraElement(A TESTS:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[1,1,0], [0,1,1], [0,1,1]]), Matrix([[0,0,1], [0,1,0], [1,0,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[1,1,0], [0,1,1], [0,1,1]]), + ....: Matrix([[0,0,1], [0,1,0], [1,0,0]])]) sage: x = B([1,2,3]) sage: loads(dumps(x)) == x # indirect doctest True @@ -59,23 +61,26 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A(17) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A(17) # optional - sage.rings.finite_rings 2*e0 - sage: A([1,1]) + sage: A([1,1]) # optional - sage.rings.finite_rings e0 + e1 """ def __init__(self, A, elt=None, check=True): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A(QQ(4)) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A(QQ(4)) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: elt should be a vector, a matrix, or an element of the base field - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: elt = B(Matrix([[1,1], [-1,1]])); elt e0 + e1 sage: TestSuite(elt).run() @@ -133,7 +138,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ TESTS:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[1,1,0], [0,1,1], [0,1,1]]), Matrix([[0,0,1], [0,1,0], [1,0,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[1,1,0], [0,1,1], [0,1,1]]), + ....: Matrix([[0,0,1], [0,1,0], [1,0,0]])]) sage: x = B([1,2,3]) sage: loads(dumps(x)) == x # indirect doctest True @@ -149,7 +156,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): TESTS:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: x = A.element_class.__new__(A.element_class) sage: x.__setstate__((A, {'_vector':vector([1,1,1]), '_matrix':matrix(QQ,3,[1,1,0, 0,1,0, 0,0,1])})) sage: x @@ -183,7 +192,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ TESTS:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[1,1,0], [0,1,1], [0,1,1]]), Matrix([[0,0,1], [0,1,0], [1,0,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[1,1,0], [0,1,1], [0,1,1]]), + ....: Matrix([[0,0,1], [0,1,0], [1,0,0]])]) sage: x = B([1,2,3]) sage: x._matrix [3 2 3] @@ -205,7 +216,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(5).vector() (5, 0, 5) """ @@ -220,7 +233,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(5).matrix() [5 0 0] [0 5 0] @@ -240,7 +255,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: elt = B(Matrix([[1,1], [-1,1]])) sage: elt.monomial_coefficients() {0: 1, 1: 1} @@ -254,7 +270,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,1,0], [0,0,1]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,1,0], [0,0,1]])]) sage: C([1,2,0]).left_matrix() [1 0 0] [0 1 0] @@ -272,8 +290,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A(1) + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A(1) # optional - sage.rings.finite_rings e0 """ s = " " @@ -308,8 +327,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: latex(A(1)) # indirect doctest + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: latex(A(1)) # indirect doctest # optional - sage.rings.finite_rings \left(\begin{array}{rr} 1 & 0 \\ 0 & 1 @@ -324,7 +344,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: A([2,1/4,3])[2] 3 """ @@ -334,7 +356,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: len(A([2,1/4,3])) 3 """ @@ -345,15 +369,18 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A(2) == 2 + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A(2) == 2 # optional - sage.rings.finite_rings True - sage: A(2) == 3 + sage: A(2) == 3 # optional - sage.rings.finite_rings False - sage: A(2) == GF(5)(2) + sage: A(2) == GF(5)(2) # optional - sage.rings.finite_rings False - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(1) != 0 True @@ -362,13 +389,13 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): the algebra corresponds to the standard monomials of the relation ideal, when the algebra is considered as a quotient of a path algebra. :: - sage: A(1) > 0 + sage: A(1) > 0 # optional - sage.rings.finite_rings True - sage: A(1) < 0 + sage: A(1) < 0 # optional - sage.rings.finite_rings False - sage: A(1) >= 0 + sage: A(1) >= 0 # optional - sage.rings.finite_rings True - sage: A(1) <= 0 + sage: A(1) <= 0 # optional - sage.rings.finite_rings False """ return richcmp(self._vector, right._vector, op) @@ -377,8 +404,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A.basis()[0] + A.basis()[1] + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A.basis()[0] + A.basis()[1] # optional - sage.rings.finite_rings e0 + e1 """ return self._parent.element_class(self._parent, self._vector + other._vector) @@ -387,8 +415,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) - sage: A.basis()[0] - A.basis()[1] + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + ....: Matrix([[0,1], [0,0]])]) + sage: A.basis()[0] - A.basis()[1] # optional - sage.rings.finite_rings e0 + 2*e1 """ return self._parent.element_class(self._parent, self._vector - other._vector) @@ -397,7 +426,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,1,0], [0,0,1]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,1,0], [0,0,1]])]) sage: C.basis()[1] * C.basis()[2] e1 """ @@ -407,7 +438,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ TESTS:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,1,0], [0,0,1]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,1,0], [0,0,1]])]) sage: c = C.random_element() sage: c * 2 == c + c True @@ -421,7 +454,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ TESTS:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,1,0], [0,0,1]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,1,0], [0,0,1]])]) sage: c = C.random_element() sage: 2 * c == c + c True @@ -438,7 +473,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: b = B([2,3,4]) sage: b^6 64*e0 + 576*e1 + 4096*e2 @@ -459,7 +496,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ TESTS:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: x = C([1,2]) sage: y = ~x; y # indirect doctest 1/5*e0 - 2/5*e1 @@ -486,7 +524,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: C([1,2]).is_invertible() True sage: C(0).is_invertible() @@ -505,7 +544,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: C([1,2])._inverse 1/5*e0 - 2/5*e1 sage: C(0)._inverse is None @@ -543,7 +583,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [-1,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [-1,0]])]) sage: C([1,2]).inverse() 1/5*e0 - 2/5*e1 """ @@ -561,7 +602,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [0,0]])]) sage: C([1,0]).is_zerodivisor() False sage: C([0,1]).is_zerodivisor() @@ -575,7 +617,8 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), Matrix([[0,1], [0,0]])]) + sage: C = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0], [0,1]]), + ....: Matrix([[0,1], [0,0]])]) sage: C([1,0]).is_nilpotent() False sage: C([0,1]).is_nilpotent() @@ -596,7 +639,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(0).minimal_polynomial() x sage: b = B.random_element() @@ -625,7 +670,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), Matrix([[0,1,0], [0,0,0], [0,0,0]]), Matrix([[0,0,0], [0,0,0], [0,0,1]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), + ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), + ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) sage: B(0).characteristic_polynomial() x^3 sage: b = B.random_element() diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py index 22f12ce6bb5..eea375c01d0 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py @@ -41,7 +41,8 @@ class FiniteDimensionalAlgebraMorphism(RingHomomorphism_im_gens): EXAMPLES:: sage: from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_morphism import FiniteDimensionalAlgebraMorphism - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) sage: H = Hom(A, B) sage: f = H(Matrix([[1], [0]])) @@ -62,7 +63,8 @@ def __init__(self, parent, f, check=True, unitary=True): sage: from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra_morphism import FiniteDimensionalAlgebraMorphism sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: H = Hom(A, B) sage: phi = FiniteDimensionalAlgebraMorphism(H, Matrix([[1, 0]])) sage: TestSuite(phi).run(skip="_test_category") @@ -82,7 +84,8 @@ def _repr_(self): r""" TESTS:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: I = A.maximal_ideal() sage: q = A.quotient_map(I) sage: q._repr_() @@ -95,7 +98,8 @@ def __call__(self, x): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: I = A.maximal_ideal() sage: q = A.quotient_map(I) sage: q(0) == 0 and q(1) == 1 @@ -112,7 +116,8 @@ def __eq__(self, other): TESTS:: sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: H = Hom(A, B) sage: phi = H(Matrix([[1, 0]])) sage: psi = H(Matrix([[1, 0]])) @@ -132,7 +137,8 @@ def __ne__(self, other): TESTS:: sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: H = Hom(A, B) sage: phi = H(Matrix([[1, 0]])) sage: psi = H(Matrix([[1, 0]])) @@ -149,7 +155,8 @@ def matrix(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) sage: M = Matrix([[1], [0]]) sage: H = Hom(A, B) @@ -169,11 +176,12 @@ def inverse_image(self, I): OUTPUT: - -- ``FiniteDimensionalAlgebraIdeal``, the inverse image of `I` under ``self``. + :class:`FiniteDimensionalAlgebraIdeal`, the inverse image of `I` under ``self``. EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: I = A.maximal_ideal() sage: q = A.quotient_map(I) sage: B = q.codomain() @@ -195,7 +203,8 @@ def zero(self): EXAMPLES:: sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: H = Hom(A, B) sage: H.zero() Morphism from Finite-dimensional algebra of degree 1 over Rational Field to @@ -218,7 +227,8 @@ def __call__(self, f, check=True, unitary=True): EXAMPLES:: sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([1])]) - sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) + sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), + ....: Matrix([[0, 1], [0, 0]])]) sage: H = Hom(A, B) sage: H(Matrix([[1, 0]])) Morphism from Finite-dimensional algebra of degree 1 over Rational Field to From 6b25b45e0e3df18a37a9f12b610f3d0b1273992e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 3 Jun 2023 17:00:52 -0700 Subject: [PATCH 04/25] sage.algebras: Modularization fixes --- .../algebras/affine_nil_temperley_lieb.py | 1 + src/sage/algebras/algebra.py | 1 + src/sage/algebras/askey_wilson.py | 1 + src/sage/algebras/associated_graded.py | 1 + src/sage/algebras/catalog.py | 21 +- src/sage/algebras/cellular_basis.py | 1 + src/sage/algebras/clifford_algebra.py | 1 + .../algebras/clifford_algebra_element.pyx | 1 + src/sage/algebras/cluster_algebra.py | 8 +- src/sage/algebras/commutative_dga.py | 363 +++++++++++------- src/sage/algebras/down_up_algebra.py | 1 + .../algebras/exterior_algebra_groebner.pyx | 1 + src/sage/algebras/finite_gca.py | 1 + src/sage/algebras/free_algebra.py | 197 +++++----- src/sage/algebras/free_algebra_element.py | 2 +- src/sage/algebras/free_algebra_quotient.py | 31 +- .../algebras/free_algebra_quotient_element.py | 1 + src/sage/algebras/free_zinbiel_algebra.py | 27 +- src/sage/algebras/group_algebra.py | 1 + src/sage/algebras/hall_algebra.py | 1 + src/sage/algebras/iwahori_hecke_algebra.py | 1 + src/sage/algebras/nil_coxeter_algebra.py | 1 + src/sage/algebras/octonion_algebra.pyx | 1 + src/sage/algebras/orlik_solomon.py | 119 +++--- src/sage/algebras/orlik_terao.py | 1 + src/sage/algebras/q_commuting_polynomials.py | 1 + src/sage/algebras/q_system.py | 2 +- src/sage/algebras/quantum_clifford.py | 1 + .../algebras/quantum_groups/fock_space.py | 2 +- .../quantum_matrix_coordinate_algebra.py | 1 + src/sage/algebras/quaternion_algebra.py | 2 + .../algebras/quaternion_algebra_element.py | 2 + .../algebras/rational_cherednik_algebra.py | 1 + src/sage/algebras/schur_algebra.py | 1 + src/sage/algebras/shuffle_algebra.py | 2 +- src/sage/algebras/splitting_algebra.py | 2 +- .../algebras/steenrod/steenrod_algebra.py | 2 +- .../steenrod/steenrod_algebra_bases.py | 22 +- src/sage/algebras/tensor_algebra.py | 1 + src/sage/algebras/weyl_algebra.py | 1 + src/sage/algebras/yangian.py | 1 + src/sage/algebras/yokonuma_hecke_algebra.py | 1 + 42 files changed, 478 insertions(+), 352 deletions(-) diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index 720c5f481cd..8f88e2bb3b7 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Affine nilTemperley Lieb Algebra of type A """ diff --git a/src/sage/algebras/algebra.py b/src/sage/algebras/algebra.py index 5aac6f22b9a..547eee6c699 100644 --- a/src/sage/algebras/algebra.py +++ b/src/sage/algebras/algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Abstract base class for algebras """ diff --git a/src/sage/algebras/askey_wilson.py b/src/sage/algebras/askey_wilson.py index 37303e030c3..1d597987c60 100644 --- a/src/sage/algebras/askey_wilson.py +++ b/src/sage/algebras/askey_wilson.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Askey-Wilson Algebras diff --git a/src/sage/algebras/associated_graded.py b/src/sage/algebras/associated_graded.py index 5e9d7b1f6b9..9afb563923b 100644 --- a/src/sage/algebras/associated_graded.py +++ b/src/sage/algebras/associated_graded.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Associated Graded Algebras To Filtered Algebras diff --git a/src/sage/algebras/catalog.py b/src/sage/algebras/catalog.py index efda74ed00e..ec48a6debed 100644 --- a/src/sage/algebras/catalog.py +++ b/src/sage/algebras/catalog.py @@ -84,17 +84,18 @@ ` """ -from sage.algebras.free_algebra import FreeAlgebra as Free -from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra as Quaternion -from sage.algebras.steenrod.steenrod_algebra import SteenrodAlgebra as Steenrod -from sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra import FiniteDimensionalAlgebra as FiniteDimensional -from sage.algebras.group_algebra import GroupAlgebra as Group -from sage.algebras.clifford_algebra import CliffordAlgebra as Clifford -from sage.algebras.clifford_algebra import ExteriorAlgebra as Exterior -from sage.algebras.weyl_algebra import DifferentialWeylAlgebra as DifferentialWeyl -from sage.algebras.lie_algebras.lie_algebra import LieAlgebra as Lie - from sage.misc.lazy_import import lazy_import +lazy_import('sage.algebras.free_algebra', 'FreeAlgebra', as_='Free') +lazy_import('sage.algebras.quatalg.quaternion_algebra', 'QuaternionAlgebra', as_='Quaternion') +lazy_import('sage.algebras.steenrod.steenrod_algebra', 'SteenrodAlgebra', as_='Steenrod') +lazy_import('sage.algebras.finite_dimensional_algebras.finite_dimensional_algebra', + 'FiniteDimensionalAlgebra', as_='FiniteDimensional') +lazy_import('sage.algebras.group_algebra', 'GroupAlgebra', as_='Group') +lazy_import('sage.algebras.clifford_algebra', 'CliffordAlgebra', as_='Clifford') +lazy_import('sage.algebras.clifford_algebra', 'ExteriorAlgebra', as_='Exterior') +lazy_import('sage.algebras.weyl_algebra', 'DifferentialWeylAlgebra', as_='DifferentialWeyl') +lazy_import('sage.algebras.lie_algebras.lie_algebra', 'LieAlgebra', as_='Lie') + lazy_import('sage.algebras.iwahori_hecke_algebra', 'IwahoriHeckeAlgebra', 'IwahoriHecke') lazy_import('sage.algebras.nil_coxeter_algebra', 'NilCoxeterAlgebra', 'NilCoxeter') lazy_import('sage.algebras.free_zinbiel_algebra', 'FreeZinbielAlgebra', 'FreeZinbiel') diff --git a/src/sage/algebras/cellular_basis.py b/src/sage/algebras/cellular_basis.py index 873bd899b3e..62aeaa03bdd 100644 --- a/src/sage/algebras/cellular_basis.py +++ b/src/sage/algebras/cellular_basis.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Cellular Basis ============== diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index adb065e31b7..7d517534792 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Clifford Algebras diff --git a/src/sage/algebras/clifford_algebra_element.pyx b/src/sage/algebras/clifford_algebra_element.pyx index 0a1a4adb681..fc70360dab3 100644 --- a/src/sage/algebras/clifford_algebra_element.pyx +++ b/src/sage/algebras/clifford_algebra_element.pyx @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules """ Clifford algebra elements diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index 14669dfed5c..8a468dad0e1 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.graphs sage.modules r""" Cluster algebras @@ -360,12 +361,11 @@ from sage.categories.rings import Rings from sage.combinat.cluster_algebra_quiver.quiver import ClusterQuiver from sage.combinat.permutation import Permutation -from sage.geometry.cone import Cone -from sage.geometry.fan import Fan from sage.graphs.digraph import DiGraph from sage.matrix.constructor import identity_matrix, matrix from sage.matrix.special import block_matrix from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import lazy_import from sage.misc.misc_c import prod from sage.modules.free_module_element import vector from sage.rings.infinity import infinity @@ -380,6 +380,8 @@ from sage.structure.sage_object import SageObject from sage.structure.unique_representation import UniqueRepresentation +lazy_import('sage.geometry.cone', 'Cone') +lazy_import('sage.geometry.fan', 'Fan') ############################################################################## # Elements of a cluster algebra @@ -2371,7 +2373,7 @@ def cluster_fan(self, depth=infinity): EXAMPLES:: sage: A = ClusterAlgebra(['A', 2]) - sage: A.cluster_fan() + sage: A.cluster_fan() # optional - sage.geometry.polyhedron Rational polyhedral fan in 2-d lattice N """ seeds = self.seeds(depth=depth, mutating_F=False) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 2b5f2ccffd1..39da2cd3772 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Commutative Differential Graded Algebras @@ -42,7 +43,8 @@ sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,1,2)) sage: B = A.cdg_algebra({x: x*y, y: -x*y}) sage: B - Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z') + in degrees (1, 1, 2) over Rational Field with differential: x --> x*y y --> -x*y z --> 0 @@ -116,7 +118,7 @@ def sorting_keys(element): OUTPUT: - Its coordinates in the corresponding cohomology_raw quotient vector space + Its coordinates in the corresponding ``cohomology_raw`` quotient vector space EXAMPLES:: @@ -155,7 +157,8 @@ class Differential(UniqueRepresentation, Morphism, sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1, 1, 2, 3)) sage: B = A.cdg_algebra({x: x*y, y: -x*y , z: t}) sage: B - Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (1, 1, 2, 3) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') + in degrees (1, 1, 2, 3) over Rational Field with differential: x --> x*y y --> -x*y z --> t @@ -181,7 +184,9 @@ def __classcall__(cls, A, im_gens): sage: A. = GradedCommutativeAlgebra(QQ,degrees=(2,2,3,3)) sage: A = A.quotient(A.ideal([a*u,b*u,x*u])) sage: A.cdg_algebra({x:a*b,a:u}) - Commutative Differential Graded Algebra with generators ('a', 'b', 'x', 'u') in degrees (2, 2, 3, 3) with relations [a*u, b*u, x*u] over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('a', 'b', 'x', 'u') + in degrees (2, 2, 3, 3) with relations [a*u, b*u, x*u] over Rational Field + with differential: a --> u b --> 0 x --> a*b @@ -910,7 +915,8 @@ class GCAlgebra(UniqueRepresentation, QuotientRing_nc): 2 sage: B = A.quotient(A.ideal(a**2*b)) sage: B - Graded Commutative Algebra with generators ('a', 'b') in degrees (2, 3) with relations [a^2*b] over Rational Field + Graded Commutative Algebra with generators ('a', 'b') in degrees (2, 3) + with relations [a^2*b] over Rational Field sage: A.basis(7) [a^2*b] sage: B.basis(7) @@ -943,8 +949,8 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= TESTS:: - sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) - sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) + sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) # optional - sage.rings.finite_rings + sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) # optional - sage.rings.finite_rings sage: A1 is A2 True @@ -956,8 +962,8 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= sage: A4. = GradedCommutativeAlgebra(QQ, degrees=[4]) sage: z**2 == 0 False - sage: A5. = GradedCommutativeAlgebra(GF(2)) - sage: z**2 == 0 + sage: A5. = GradedCommutativeAlgebra(GF(2)) # optional - sage.rings.finite_rings + sage: z**2 == 0 # optional - sage.rings.finite_rings False """ if names is None: @@ -1201,18 +1207,19 @@ def quotient(self, I, check=True): EXAMPLES:: - sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 2, 3, 4)) - sage: I = A.ideal([x*t+z^2, x*y - t]) - sage: B = A.quotient(I) - sage: B - Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 2, 3, 4) with relations [x*t, x*y - t] over Finite Field of size 5 - sage: B(x*t) + sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 2, 3, 4)) # optional - sage.rings.finite_rings + sage: I = A.ideal([x*t+z^2, x*y - t]) # optional - sage.rings.finite_rings + sage: B = A.quotient(I); B # optional - sage.rings.finite_rings + Graded Commutative Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 2, 3, 4) with relations [x*t, x*y - t] + over Finite Field of size 5 + sage: B(x*t) # optional - sage.rings.finite_rings 0 - sage: B(x*y) + sage: B(x*y) # optional - sage.rings.finite_rings t - sage: A.basis(7) + sage: A.basis(7) # optional - sage.rings.finite_rings [x^2*z, x*y*z, y^2*z, z*t] - sage: B.basis(7) + sage: B.basis(7) # optional - sage.rings.finite_rings [x^2*z, y^2*z, z*t] """ if check and any(not i.is_homogeneous() for i in I.gens()): @@ -1304,13 +1311,22 @@ def _Hom_(self, B, category): sage: B. = GradedCommutativeAlgebra(QQ, degrees=(1,2,3)) sage: C. = GradedCommutativeAlgebra(GF(17)) sage: Hom(A,A) - Set of Homomorphisms from Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 1) over Rational Field to Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 1) over Rational Field + Set of Homomorphisms + from Graded Commutative Algebra with generators ('x', 'y') + in degrees (1, 1) over Rational Field + to Graded Commutative Algebra with generators ('x', 'y') + in degrees (1, 1) over Rational Field sage: Hom(A,B) - Set of Homomorphisms from Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 1) over Rational Field to Graded Commutative Algebra with generators ('a', 'b', 'c') in degrees (1, 2, 3) over Rational Field + Set of Homomorphisms + from Graded Commutative Algebra with generators ('x', 'y') + in degrees (1, 1) over Rational Field + to Graded Commutative Algebra with generators ('a', 'b', 'c') + in degrees (1, 2, 3) over Rational Field sage: Hom(A,C) Traceback (most recent call last): ... - NotImplementedError: homomorphisms of graded commutative algebras have only been implemented when the base rings are the same + NotImplementedError: homomorphisms of graded commutative algebras + have only been implemented when the base rings are the same """ R = self.base_ring() # The base rings need to be checked before the categories, or @@ -1345,7 +1361,8 @@ def differential(self, diff): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1, 1, 2)) sage: A.differential({y:x*y, x: x*y}) - Differential of Graded Commutative Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field + Differential of Graded Commutative Algebra with generators ('x', 'y', 'z') + in degrees (1, 1, 2) over Rational Field Defn: x --> x*y y --> x*y z --> 0 @@ -1382,7 +1399,8 @@ def cdg_algebra(self, differential): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1, 1, 1)) sage: B = A.cdg_algebra({a: b*c, b: a*c}) sage: B - Commutative Differential Graded Algebra with generators ('a', 'b', 'c') in degrees (1, 1, 1) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('a', 'b', 'c') + in degrees (1, 1, 1) over Rational Field with differential: a --> b*c b --> a*c c --> 0 @@ -1391,7 +1409,8 @@ def cdg_algebra(self, differential): sage: d = A.differential({a: b*c, b: a*c}) sage: d - Differential of Graded Commutative Algebra with generators ('a', 'b', 'c') in degrees (1, 1, 1) over Rational Field + Differential of Graded Commutative Algebra with generators ('a', 'b', 'c') + in degrees (1, 1, 1) over Rational Field Defn: a --> b*c b --> a*c c --> 0 @@ -1646,7 +1665,8 @@ class GCAlgebra_multigraded(GCAlgebra): sage: A. = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0,1), (1,1))) sage: A - Graded Commutative Algebra with generators ('a', 'b', 'c') in degrees ((1, 0), (0, 1), (1, 1)) over Rational Field + Graded Commutative Algebra with generators ('a', 'b', 'c') + in degrees ((1, 0), (0, 1), (1, 1)) over Rational Field sage: a**2 0 sage: c.degree(total=True) @@ -1727,7 +1747,9 @@ def quotient(self, I, check=True): sage: I = A.ideal([x*t+z^2, x*y - t]) sage: B = A.quotient(I) sage: B - Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 2, 3, 4) with relations [x*t, x*y - t] over Finite Field of size 5 + Graded Commutative Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 2, 3, 4) with relations [x*t, x*y - t] + over Finite Field of size 5 sage: B(x*t) 0 sage: B(x*y) @@ -1823,7 +1845,8 @@ def differential(self, diff): sage: A. = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0, 1), (0,2))) sage: A.differential({a: c}) - Differential of Graded Commutative Algebra with generators ('a', 'b', 'c') in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field + Differential of Graded Commutative Algebra with generators ('a', 'b', 'c') + in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field Defn: a --> c b --> 0 c --> 0 @@ -1855,13 +1878,15 @@ def cdg_algebra(self, differential): sage: A. = GradedCommutativeAlgebra(QQ, degrees=((1,0), (0, 1), (0,2))) sage: A.cdg_algebra({a: c}) - Commutative Differential Graded Algebra with generators ('a', 'b', 'c') in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('a', 'b', 'c') + in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field with differential: a --> c b --> 0 c --> 0 sage: d = A.differential({a: c}) sage: A.cdg_algebra(d) - Commutative Differential Graded Algebra with generators ('a', 'b', 'c') in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('a', 'b', 'c') + in degrees ((1, 0), (0, 1), (0, 2)) over Rational Field with differential: a --> c b --> 0 c --> 0 @@ -1884,18 +1909,19 @@ def degree(self, total=False): EXAMPLES:: - sage: A. = GradedCommutativeAlgebra(GF(2), degrees=((1,0), (0,1), (1,1))) - sage: (a**2*b).degree() + sage: A. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + ....: degrees=((1,0), (0,1), (1,1))) + sage: (a**2*b).degree() # optional - sage.rings.finite_rings (2, 1) - sage: (a**2*b).degree(total=True) + sage: (a**2*b).degree(total=True) # optional - sage.rings.finite_rings 3 - sage: (a**2*b + c).degree() + sage: (a**2*b + c).degree() # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: this element is not homogeneous - sage: (a**2*b + c).degree(total=True) + sage: (a**2*b + c).degree(total=True) # optional - sage.rings.finite_rings 3 - sage: A(0).degree() + sage: A(0).degree() # optional - sage.rings.finite_rings Traceback (most recent call last): ... ValueError: the zero element does not have a well-defined degree @@ -1944,7 +1970,8 @@ class DifferentialGCAlgebra(GCAlgebra): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(2, 2, 3, 3)) sage: A.cdg_algebra({z: x*y}) - Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 2, 3, 3) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 2, 3, 3) over Rational Field with differential: x --> 0 y --> 0 z --> x*y @@ -1954,7 +1981,8 @@ class DifferentialGCAlgebra(GCAlgebra): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(2, 2, 3, 3)) sage: A.cdg_algebra(differential={z: x*y}) - Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 2, 3, 3) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 2, 3, 3) over Rational Field with differential: x --> 0 y --> 0 z --> x*y @@ -2052,13 +2080,17 @@ def cdg_algebra(self, differential): sage: B = A.quotient(A.ideal(x^3-z*t)) sage: C = B.cdg_algebra({y:t}) sage: C - Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 3, 2, 4) with relations [x^3 - z*t] over Finite Field of size 5 with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 3, 2, 4) with relations [x^3 - z*t] + over Finite Field of size 5 with differential: x --> 0 y --> t z --> 0 t --> 0 sage: C.cdg_algebra({}) - Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 3, 2, 4) with relations [x^3 - z*t] over Finite Field of size 5 with differential: + Commutative Differential Graded Algebra with generators ('x', 'y', 'z', 't') + in degrees (2, 3, 2, 4) with relations [x^3 - z*t] + over Finite Field of size 5 with differential: x --> 0 y --> 0 z --> 0 @@ -2168,7 +2200,8 @@ def differential(self, x=None): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,1,2)) sage: B = A.cdg_algebra({y:x*y, x: y*x}) sage: d = B.differential(); d - Differential of Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field + Differential of Commutative Differential Graded Algebra + with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field Defn: x --> -x*y y --> x*y z --> 0 @@ -2281,7 +2314,8 @@ def cohomology(self, n): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,1,1,1,1)) sage: B = A.cdg_algebra({d: a*b, e: b*c}) sage: B.cohomology(2) - Free module generated by {[a*c], [a*d], [b*d], [c*d - a*e], [b*e], [c*e]} over Rational Field + Free module generated by {[a*c], [a*d], [b*d], [c*d - a*e], [b*e], [c*e]} + over Rational Field Compare to :meth:`cohomology_raw`:: @@ -2354,21 +2388,23 @@ def cohomology_generators(self, max_degree): In contrast, the corresponding algebra in characteristic `p` has finitely generated cohomology:: - sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) - sage: B3 = A3.cdg_algebra(differential={y: a*x}) - sage: B3.cohomology_generators(16) + sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) # optional - sage.rings.finite_rings + sage: B3 = A3.cdg_algebra(differential={y: a*x}) # optional - sage.rings.finite_rings + sage: B3.cohomology_generators(16) # optional - sage.rings.finite_rings {1: [a], 2: [x], 3: [a*y], 5: [a*y^2], 6: [y^3]} This method works with both singly graded and multi-graded algebras:: - sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) - sage: Ds = Cs.cdg_algebra({a:c, b:d}) - sage: Ds.cohomology_generators(10) + sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) # optional - sage.rings.finite_rings + sage: Ds = Cs.cdg_algebra({a:c, b:d}) # optional - sage.rings.finite_rings + sage: Ds.cohomology_generators(10) # optional - sage.rings.finite_rings {2: [a^2], 4: [b^2]} - sage: Cm. = GradedCommutativeAlgebra(GF(2), degrees=((1,0), (1,1), (0,2), (0,3))) - sage: Dm = Cm.cdg_algebra({a:c, b:d}) - sage: Dm.cohomology_generators(10) + sage: Cm. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + ....: degrees=((1,0), (1,1), + ....: (0,2), (0,3))) + sage: Dm = Cm.cdg_algebra({a:c, b:d}) # optional - sage.rings.finite_rings + sage: Dm.cohomology_generators(10) # optional - sage.rings.finite_rings {2: [a^2], 4: [b^2]} TESTS: @@ -2459,13 +2495,17 @@ def minimal_model(self, i=3, max_iterations=3, partial_result=False): sage: T = p.domain() sage: p Commutative Differential Graded Algebra morphism: - From: Commutative Differential Graded Algebra with generators ('x1_0', 'x2_0') in degrees (1, 2) over Rational Field with differential: - x1_0 --> 0 - x2_0 --> 0 - To: Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) over Rational Field with differential: - x --> x*y - y --> x*y - z --> 0 + From: Commutative Differential Graded Algebra + with generators ('x1_0', 'x2_0') in degrees (1, 2) + over Rational Field with differential: + x1_0 --> 0 + x2_0 --> 0 + To: Commutative Differential Graded Algebra + with generators ('x', 'y', 'z') in degrees (1, 1, 2) + over Rational Field with differential: + x --> x*y + y --> x*y + z --> 0 Defn: (x1_0, x2_0) --> (x - y, z) sage: R.cohomology(1) Free module generated by {[x - y]} over Rational Field @@ -2488,7 +2528,11 @@ def minimal_model(self, i=3, max_iterations=3, partial_result=False): sage: phi = B.minimal_model(i=3) sage: M = phi.domain() sage: M - Commutative Differential Graded Algebra with generators ('x1_0', 'x1_1', 'x1_2', 'x2_0', 'x2_1', 'x2_2', 'x2_3', 'y3_0', 'y3_1', 'y3_2', 'y3_3', 'y3_4', 'y3_5', 'y3_6', 'y3_7', 'y3_8') in degrees (1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3) over Rational Field with differential: + Commutative Differential Graded Algebra with generators + ('x1_0', 'x1_1', 'x1_2', 'x2_0', 'x2_1', 'x2_2', 'x2_3', + 'y3_0', 'y3_1', 'y3_2', 'y3_3', 'y3_4', 'y3_5', 'y3_6', 'y3_7', 'y3_8') + in degrees (1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3) + over Rational Field with differential: x1_0 --> 0 x1_1 --> 0 x1_2 --> 0 @@ -2508,32 +2552,40 @@ def minimal_model(self, i=3, max_iterations=3, partial_result=False): sage: phi Commutative Differential Graded Algebra morphism: - From: Commutative Differential Graded Algebra with generators ('x1_0', 'x1_1', 'x1_2', 'x2_0', 'x2_1', 'x2_2', 'x2_3', 'y3_0', 'y3_1', 'y3_2', 'y3_3', 'y3_4', 'y3_5', 'y3_6', 'y3_7', 'y3_8') in degrees (1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3) over Rational Field with differential: - x1_0 --> 0 - x1_1 --> 0 - x1_2 --> 0 - x2_0 --> 0 - x2_1 --> 0 - x2_2 --> 0 - x2_3 --> 0 - y3_0 --> x2_0^2 - y3_1 --> x2_0*x2_1 - y3_2 --> x2_1^2 - y3_3 --> x2_0*x2_2 - y3_4 --> x2_1*x2_2 + x2_0*x2_3 - y3_5 --> x2_2^2 - y3_6 --> x2_1*x2_3 - y3_7 --> x2_2*x2_3 - y3_8 --> x2_3^2 - To: Commutative Differential Graded Algebra with generators ('e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7') in degrees (1, 1, 1, 1, 1, 1, 1) over Rational Field with differential: - e1 --> e1*e7 - e2 --> e2*e7 - e3 --> -e3*e7 - e4 --> -e4*e7 - e5 --> 0 - e6 --> 0 - e7 --> 0 - Defn: (x1_0, x1_1, x1_2, x2_0, x2_1, x2_2, x2_3, y3_0, y3_1, y3_2, y3_3, y3_4, y3_5, y3_6, y3_7, y3_8) --> (e5, e6, e7, e1*e3, e2*e3, e1*e4, e2*e4, 0, 0, 0, 0, 0, 0, 0, 0, 0) + From: Commutative Differential Graded Algebra with generators + ('x1_0', 'x1_1', 'x1_2', 'x2_0', 'x2_1', 'x2_2', 'x2_3', + 'y3_0', 'y3_1', 'y3_2', 'y3_3', 'y3_4', 'y3_5', 'y3_6', 'y3_7', 'y3_8') + in degrees (1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3) + over Rational Field with differential: + x1_0 --> 0 + x1_1 --> 0 + x1_2 --> 0 + x2_0 --> 0 + x2_1 --> 0 + x2_2 --> 0 + x2_3 --> 0 + y3_0 --> x2_0^2 + y3_1 --> x2_0*x2_1 + y3_2 --> x2_1^2 + y3_3 --> x2_0*x2_2 + y3_4 --> x2_1*x2_2 + x2_0*x2_3 + y3_5 --> x2_2^2 + y3_6 --> x2_1*x2_3 + y3_7 --> x2_2*x2_3 + y3_8 --> x2_3^2 + To: Commutative Differential Graded Algebra with generators + ('e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7') + in degrees (1, 1, 1, 1, 1, 1, 1) over Rational Field with differential: + e1 --> e1*e7 + e2 --> e2*e7 + e3 --> -e3*e7 + e4 --> -e4*e7 + e5 --> 0 + e6 --> 0 + e7 --> 0 + Defn: (x1_0, x1_1, x1_2, x2_0, x2_1, x2_2, x2_3, + y3_0, y3_1, y3_2, y3_3, y3_4, y3_5, y3_6, y3_7, y3_8) + --> (e5, e6, e7, e1*e3, e2*e3, e1*e4, e2*e4, 0, 0, 0, 0, 0, 0, 0, 0, 0) sage: [B.cohomology(i).dimension() for i in [1..3]] [3, 7, 13] sage: [M.cohomology(i).dimension() for i in [1..3]] @@ -2772,7 +2824,8 @@ def cohomology_algebra(self, max_degree=3): sage: B = A.cdg_algebra(d) sage: M = B.cohomology_algebra() sage: M - Commutative Differential Graded Algebra with generators ('x0', 'x1', 'x2') in degrees (1, 1, 2) over Rational Field with differential: + Commutative Differential Graded Algebra with generators ('x0', 'x1', 'x2') + in degrees (1, 1, 2) over Rational Field with differential: x0 --> 0 x1 --> 0 x2 --> 0 @@ -2843,14 +2896,18 @@ def numerical_invariants(self, max_degree=3, max_iterations=3): sage: B = A.cdg_algebra({e3 : e1*e2}) sage: B.minimal_model(4) Commutative Differential Graded Algebra morphism: - From: Commutative Differential Graded Algebra with generators ('x1_0', 'x1_1', 'y1_0') in degrees (1, 1, 1) over Rational Field with differential: - x1_0 --> 0 - x1_1 --> 0 - y1_0 --> x1_0*x1_1 - To: Commutative Differential Graded Algebra with generators ('e1', 'e2', 'e3') in degrees (1, 1, 1) over Rational Field with differential: - e1 --> 0 - e2 --> 0 - e3 --> e1*e2 + From: Commutative Differential Graded Algebra with + generators ('x1_0', 'x1_1', 'y1_0') in degrees (1, 1, 1) + over Rational Field with differential: + x1_0 --> 0 + x1_1 --> 0 + y1_0 --> x1_0*x1_1 + To: Commutative Differential Graded Algebra with + generators ('e1', 'e2', 'e3') in degrees (1, 1, 1) + over Rational Field with differential: + e1 --> 0 + e2 --> 0 + e3 --> e1*e2 Defn: (x1_0, x1_1, y1_0) --> (e1, e2, e3) sage: B.numerical_invariants(2) {1: [2, 1, 0], 2: [0, 0]} @@ -2908,7 +2965,7 @@ def is_formal(self, i, max_iterations=3): EXAMPLES:: sage: A. = GradedCommutativeAlgebra(QQ) - sage: B = A.cdg_algebra({e5 : e1*e2 + e3*e4}) + sage: B = A.cdg_algebra({e5: e1*e2 + e3*e4}) sage: B.is_formal(1) True sage: B.is_formal(2) @@ -2946,7 +3003,7 @@ def differential(self): EXAMPLES:: - sage: A. = GradedCommutativeAlgebra(QQ, degrees = (2, 2, 3, 4)) + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(2, 2, 3, 4)) sage: B = A.cdg_algebra({t: x*z, x: z, y: z}) sage: B.inject_variables() Defining x, y, z, t @@ -2973,9 +3030,9 @@ def is_coboundary(self): False sage: (x*z).is_coboundary() True - sage: (x*z+x*y).is_coboundary() + sage: (x*z + x*y).is_coboundary() False - sage: (x*z+y**2).is_coboundary() + sage: (x*z + y**2).is_coboundary() Traceback (most recent call last): ... ValueError: this element is not homogeneous @@ -3000,7 +3057,7 @@ def is_cohomologous_to(self, other): EXAMPLES:: sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,1,1,1)) - sage: B = A.cdg_algebra(differential={a:b*c-c*d}) + sage: B = A.cdg_algebra(differential={a: b*c-c*d}) sage: w, x, y, z = B.gens() sage: (x*y).is_cohomologous_to(y*z) True @@ -3016,7 +3073,7 @@ def is_cohomologous_to(self, other): False sage: (x*y-y*z).is_cohomologous_to(x*y*z) True - sage: (x*y*z).is_cohomologous_to(0) # make sure 0 works + sage: (x*y*z).is_cohomologous_to(0) # make sure 0 works True """ if other.is_zero(): @@ -3036,17 +3093,17 @@ def cohomology_class(self): EXAMPLES:: sage: A. = GradedCommutativeAlgebra(QQ) - sage: B = A.cdg_algebra({e5:e1*e2+e3*e4}) + sage: B = A.cdg_algebra({e5: e1*e2+e3*e4}) sage: B.inject_variables() Defining e1, e2, e3, e4, e5 - sage: a = e1*e3*e5-3*e2*e3*e5 + sage: a = e1*e3*e5 - 3*e2*e3*e5 sage: a.cohomology_class() B[[e1*e3*e5]] - 3*B[[e2*e3*e5]] TESTS:: sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1, 2, 3)) - sage: B = A.cdg_algebra({a:b}) + sage: B = A.cdg_algebra({a: b}) sage: B.inject_variables() Defining a, b, c sage: b.cohomology_class() @@ -3057,10 +3114,10 @@ def cohomology_class(self): Check that the issue detected in :trac:`28155` is solved:: sage: A. = GradedCommutativeAlgebra(QQ) - sage: B = A.cdg_algebra({e5:e1*e2+e3*e4}) + sage: B = A.cdg_algebra({e5: e1*e2+e3*e4}) sage: B.inject_variables() Defining e1, e2, e3, e4, e5 - sage: a = e1*e3*e5-3*e2*e3*e5 + sage: a = e1*e3*e5 - 3*e2*e3*e5 sage: ca = a.cohomology_class() sage: C = B.cohomology(3) sage: ca in C @@ -3087,7 +3144,7 @@ def _cohomology_class_dict(self): EXAMPLES:: sage: A. = GradedCommutativeAlgebra(QQ) - sage: B = A.cdg_algebra({e5:e1*e2+e3*e4}) + sage: B = A.cdg_algebra({e5: e1*e2+e3*e4}) sage: a = B(e1*e3*e5-3*e2*e3*e5) sage: a._cohomology_class_dict() {(0, 0, 0, 0, 0, 0, 1, 0, 0): -3, (0, 0, 0, 0, 0, 1, 0, 0, 0): 1} @@ -3096,7 +3153,7 @@ def _cohomology_class_dict(self): x5 - 3*x6 sage: B.cohomology_generators(3) {1: [e1, e2, e3, e4], - 3: [e1*e2*e5 - e3*e4*e5, e1*e3*e5, e2*e3*e5, e1*e4*e5, e2*e4*e5]} + 3: [e1*e2*e5 - e3*e4*e5, e1*e3*e5, e2*e3*e5, e1*e4*e5, e2*e4*e5]} sage: [H(g._cohomology_class_dict()) for g in flatten(B.cohomology_generators(3).values())] [x0, x1, x2, x3, x4, x5, x6, x7, x8] """ @@ -3380,9 +3437,11 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, Defining a graded commutative algebra:: sage: GradedCommutativeAlgebra(QQ, 'x, y, z') - Graded Commutative Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 1) over Rational Field + Graded Commutative Algebra with generators ('x', 'y', 'z') + in degrees (1, 1, 1) over Rational Field sage: GradedCommutativeAlgebra(QQ, degrees=(2, 3, 4)) - Graded Commutative Algebra with generators ('x0', 'x1', 'x2') in degrees (2, 3, 4) over Rational Field + Graded Commutative Algebra with generators ('x0', 'x1', 'x2') + in degrees (2, 3, 4) over Rational Field As usual in Sage, the ``A.<...>`` notation defines both the algebra and the generator names:: @@ -3390,21 +3449,21 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1, 1, 2)) sage: x^2 0 - sage: y*x # Odd classes anticommute. + sage: y*x # Odd classes anticommute. -x*y - sage: z*y # z is central since it is in degree 2. + sage: z*y # z is central since it is in degree 2. y*z sage: (x*y*z**3).degree() 8 - sage: A.basis(3) # basis of homogeneous degree 3 elements + sage: A.basis(3) # basis of homogeneous degree 3 elements [x*z, y*z] Defining a quotient:: sage: I = A.ideal(x*z) - sage: AQ = A.quotient(I) - sage: AQ - Graded Commutative Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) with relations [x*z] over Rational Field + sage: AQ = A.quotient(I); AQ + Graded Commutative Algebra with generators ('x', 'y', 'z') + in degrees (1, 1, 2) with relations [x*z] over Rational Field sage: AQ.basis(3) [y*z] @@ -3421,14 +3480,15 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, Now we add a differential to ``AQ``:: - sage: B = AQ.cdg_algebra({z:y*z}) - sage: B - Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) with relations [x*z] over Rational Field with differential: + sage: B = AQ.cdg_algebra({z: y*z}); B + Commutative Differential Graded Algebra with generators ('x', 'y', 'z') + in degrees (1, 1, 2) with relations [x*z] over Rational Field with differential: x --> 0 y --> 0 z --> y*z sage: B.differential() - Differential of Commutative Differential Graded Algebra with generators ('x', 'y', 'z') in degrees (1, 1, 2) with relations [x*z] over Rational Field + Differential of Commutative Differential Graded Algebra with generators + ('x', 'y', 'z') in degrees (1, 1, 2) with relations [x*z] over Rational Field Defn: x --> 0 y --> 0 z --> y*z @@ -3447,10 +3507,12 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, We can construct multi-graded rings as well. We work in characteristic 2 for a change, so the algebras here are honestly commutative:: - sage: C. = GradedCommutativeAlgebra(GF(2), degrees=((1,0), (1,1), (0,2), (0,3))) - sage: D = C.cdg_algebra(differential={a:c, b:d}) - sage: D - Commutative Differential Graded Algebra with generators ('a', 'b', 'c', 'd') in degrees ((1, 0), (1, 1), (0, 2), (0, 3)) over Finite Field of size 2 with differential: + sage: C. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + ....: degrees=((1,0), (1,1), (0,2), (0,3))) + sage: D = C.cdg_algebra(differential={a: c, b: d}); D # optional - sage.rings.finite_rings + Commutative Differential Graded Algebra with generators ('a', 'b', 'c', 'd') + in degrees ((1, 0), (1, 1), (0, 2), (0, 3)) over Finite Field of size 2 + with differential: a --> c b --> d c --> 0 @@ -3460,52 +3522,51 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, Use tuples, lists, vectors, or elements of additive abelian groups to specify degrees:: - sage: D.basis(3) # basis in total degree 3 + sage: D.basis(3) # basis in total degree 3 # optional - sage.rings.finite_rings [a^3, a*b, a*c, d] - sage: D.basis((1,2)) # basis in degree (1,2) + sage: D.basis((1,2)) # basis in degree (1,2) # optional - sage.rings.finite_rings [a*c] - sage: D.basis([1,2]) + sage: D.basis([1,2]) # optional - sage.rings.finite_rings [a*c] - sage: D.basis(vector([1,2])) + sage: D.basis(vector([1,2])) # optional - sage.rings.finite_rings [a*c] sage: G = AdditiveAbelianGroup([0,0]); G Additive abelian group isomorphic to Z + Z - sage: D.basis(G(vector([1,2]))) + sage: D.basis(G(vector([1,2]))) # optional - sage.rings.finite_rings [a*c] At this point, ``a``, for example, is an element of ``C``. We can redefine it so that it is instead an element of ``D`` in several ways, for instance using :meth:`gens` method:: - sage: a, b, c, d = D.gens() - sage: a.differential() + sage: a, b, c, d = D.gens() # optional - sage.rings.finite_rings + sage: a.differential() # optional - sage.rings.finite_rings c Or the :meth:`inject_variables` method:: - sage: D.inject_variables() + sage: D.inject_variables() # optional - sage.rings.finite_rings Defining a, b, c, d - sage: (a*b).differential() + sage: (a*b).differential() # optional - sage.rings.finite_rings b*c + a*d - sage: (a*b*c**2).degree() + sage: (a*b*c**2).degree() # optional - sage.rings.finite_rings (2, 5) Degrees are returned as elements of additive abelian groups:: - sage: (a*b*c**2).degree() in G + sage: (a*b*c**2).degree() in G # optional - sage.rings.finite_rings True - sage: (a*b*c**2).degree(total=True) # total degree + sage: (a*b*c**2).degree(total=True) # total degree # optional - sage.rings.finite_rings 7 - sage: D.cohomology(4) + sage: D.cohomology(4) # optional - sage.rings.finite_rings Free module generated by {[a^4], [b^2]} over Finite Field of size 2 - sage: D.cohomology((2,2)) + sage: D.cohomology((2,2)) # optional - sage.rings.finite_rings Free module generated by {[b^2]} over Finite Field of size 2 Graded algebra with maximal degree:: - sage: A. = GradedCommutativeAlgebra(QQ, degrees=(4,2), max_degree=6) - sage: A + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(4,2), max_degree=6); A Graded commutative algebra with generators ('p', 'e') in degrees (4, 2) with maximal degree 6 sage: p^2 @@ -3563,7 +3624,8 @@ class GCAlgebraMorphism(RingHomomorphism_im_gens): sage: H = Hom(A,A) sage: f = H([y,x]) sage: f - Graded Commutative Algebra endomorphism of Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 1) over Rational Field + Graded Commutative Algebra endomorphism of Graded Commutative Algebra + with generators ('x', 'y') in degrees (1, 1) over Rational Field Defn: (x, y) --> (y, x) sage: f(x*y) -x*y @@ -3590,7 +3652,8 @@ def __init__(self, parent, im_gens, check=True): sage: H = Hom(A,A) sage: f = H([x,x]) sage: f - Graded Commutative Algebra endomorphism of Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 2) over Rational Field + Graded Commutative Algebra endomorphism of Graded Commutative Algebra + with generators ('x', 'y') in degrees (1, 2) over Rational Field Defn: (x, y) --> (x, x) sage: f.is_graded() False @@ -3608,7 +3671,8 @@ def __init__(self, parent, im_gens, check=True): sage: A2. = GradedCommutativeAlgebra(GF(2), degrees=(1,2)) sage: H2 = Hom(A2,A2) sage: H2([y,y]) - Graded Commutative Algebra endomorphism of Graded Commutative Algebra with generators ('x', 'y') in degrees (1, 2) over Finite Field of size 2 + Graded Commutative Algebra endomorphism of Graded Commutative Algebra + with generators ('x', 'y') in degrees (1, 2) over Finite Field of size 2 Defn: (x, y) --> (y, y) The "nc-relations" `a*b = -b*a`, for `a` and `b` in odd @@ -3652,7 +3716,8 @@ def __init__(self, parent, im_gens, check=True): sage: A.cover_ring() Multivariate Polynomial Ring in e1 over Rational Field sage: A.hom([2*e1]) - Graded Commutative Algebra endomorphism of Graded Commutative Algebra with generators ('e1',) in degrees (1,) over Rational Field + Graded Commutative Algebra endomorphism of Graded Commutative Algebra + with generators ('e1',) in degrees (1,) over Rational Field Defn: (e1,) --> (2*e1,) """ @@ -3834,13 +3899,17 @@ class GCAlgebraHomset(RingHomset_generic): sage: H = Hom(A,B) sage: H([y,0]) Graded Commutative Algebra morphism: - From: Graded Commutative Algebra with generators ('w', 'x') in degrees (1, 2) over Rational Field - To: Graded Commutative Algebra with generators ('y', 'z') in degrees (1, 1) over Rational Field + From: Graded Commutative Algebra with generators ('w', 'x') + in degrees (1, 2) over Rational Field + To: Graded Commutative Algebra with generators ('y', 'z') + in degrees (1, 1) over Rational Field Defn: (w, x) --> (y, 0) sage: H([y,y*z]) Graded Commutative Algebra morphism: - From: Graded Commutative Algebra with generators ('w', 'x') in degrees (1, 2) over Rational Field - To: Graded Commutative Algebra with generators ('y', 'z') in degrees (1, 1) over Rational Field + From: Graded Commutative Algebra with generators ('w', 'x') + in degrees (1, 2) over Rational Field + To: Graded Commutative Algebra with generators ('y', 'z') + in degrees (1, 1) over Rational Field Defn: (w, x) --> (y, y*z) """ @@ -4085,7 +4154,7 @@ def total_degree(deg): INPUT: - - ``deg`` - an element of a free abelian group. + - ``deg`` -- an element of a free abelian group. In fact, ``deg`` could be an integer, a Python int, a list, a tuple, a vector, etc. This function returns the sum of the diff --git a/src/sage/algebras/down_up_algebra.py b/src/sage/algebras/down_up_algebra.py index 3ee1bcea25f..b39c86b3d4f 100644 --- a/src/sage/algebras/down_up_algebra.py +++ b/src/sage/algebras/down_up_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Down-Up Algebras diff --git a/src/sage/algebras/exterior_algebra_groebner.pyx b/src/sage/algebras/exterior_algebra_groebner.pyx index 376eb454082..ee54b5e4baf 100644 --- a/src/sage/algebras/exterior_algebra_groebner.pyx +++ b/src/sage/algebras/exterior_algebra_groebner.pyx @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Exterior algebras Gröbner bases diff --git a/src/sage/algebras/finite_gca.py b/src/sage/algebras/finite_gca.py index 5f21cdc8290..9c76ddf3199 100644 --- a/src/sage/algebras/finite_gca.py +++ b/src/sage/algebras/finite_gca.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Finite dimensional graded commutative algebras diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 460b623b877..eaddfc54e5a 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules """ Free algebras @@ -17,11 +17,12 @@ EXAMPLES:: - sage: F = FreeAlgebra(ZZ,3,'x,y,z') + sage: F = FreeAlgebra(ZZ, 3, 'x,y,z') sage: F.base_ring() Integer Ring sage: G = FreeAlgebra(F, 2, 'm,n'); G - Free Algebra on 2 generators (m, n) over Free Algebra on 3 generators (x, y, z) over Integer Ring + Free Algebra on 2 generators (m, n) over + Free Algebra on 3 generators (x, y, z) over Integer Ring sage: G.base_ring() Free Algebra on 3 generators (x, y, z) over Integer Ring @@ -34,11 +35,10 @@ Moreover, we can compute Groebner bases with degree bound for its two-sided ideals, and thus provide ideal containment tests:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace') - sage: F + sage: F. = FreeAlgebra(QQ, implementation='letterplace'); F # optional - sage.libs.singular Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field - sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F - sage: I.groebner_basis(degbound=4) + sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F # optional - sage.libs.singular + sage: I.groebner_basis(degbound=4) # optional - sage.libs.singular Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, @@ -48,67 +48,67 @@ y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field - sage: y*z*y*y*z*z + 2*y*z*y*z*z*x + y*z*y*z*z*z - y*z*z*y*z*x + y*z*z*z*z*x in I + sage: y*z*y*y*z*z + 2*y*z*y*z*z*x + y*z*y*z*z*z - y*z*z*y*z*x + y*z*z*z*z*x in I # optional - sage.libs.singular True Positive integral degree weights for the letterplace implementation was introduced in :trac:`7797`:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace', degrees=[2,1,3]) - sage: x.degree() + sage: F. = FreeAlgebra(QQ, implementation='letterplace', degrees=[2,1,3]) # optional - sage.libs.singular + sage: x.degree() # optional - sage.libs.singular 2 - sage: y.degree() + sage: y.degree() # optional - sage.libs.singular 1 - sage: z.degree() + sage: z.degree() # optional - sage.libs.singular 3 - sage: I = F*[x*y-y*x, x^2+2*y*z, (x*y)^2-z^2]*F - sage: Q. = F.quo(I) - sage: TestSuite(Q).run() - sage: a^2*b^2 + sage: I = F*[x*y-y*x, x^2+2*y*z, (x*y)^2-z^2]*F # optional - sage.libs.singular + sage: Q. = F.quo(I) # optional - sage.libs.singular + sage: TestSuite(Q).run() # optional - sage.libs.singular + sage: a^2*b^2 # optional - sage.libs.singular c*c TESTS:: - sage: F = FreeAlgebra(GF(5),3,'x') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3,'x') # optional - sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings True :: - sage: F. = FreeAlgebra(GF(5),3) - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings True :: - sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y']) - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y']) # optional - sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings True :: - sage: F = FreeAlgebra(GF(5),3, 'abc') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3, 'abc') # optional - sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') - sage: TestSuite(F).run() - sage: F is loads(dumps(F)) + sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings True :: @@ -121,7 +121,7 @@ Note that the letterplace implementation can only be used if the corresponding (multivariate) polynomial ring has an implementation in Singular:: - sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') + sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: polynomials over Free Algebra on 2 generators (a, b) over Integer Ring are not supported in Singular @@ -165,21 +165,22 @@ class FreeAlgebraFactory(UniqueFactory): EXAMPLES:: - sage: FreeAlgebra(GF(5),3,'x') + sage: FreeAlgebra(GF(5),3,'x') # optional - sage.rings.finite_rings Free Algebra on 3 generators (x0, x1, x2) over Finite Field of size 5 - sage: F. = FreeAlgebra(GF(5),3) - sage: (x+y+z)^2 + sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings + sage: (x+y+z)^2 # optional - sage.rings.finite_rings x^2 + x*y + x*z + y*x + y^2 + y*z + z*x + z*y + z^2 - sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') + sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') # optional - sage.rings.finite_rings Free Algebra on 3 generators (xx, zba, Y) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),3, 'abc') + sage: FreeAlgebra(GF(5),3, 'abc') # optional - sage.rings.finite_rings Free Algebra on 3 generators (a, b, c) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, 'z') + sage: FreeAlgebra(GF(5),1, 'z') # optional - sage.rings.finite_rings Free Algebra on 1 generators (z,) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, ['alpha']) + sage: FreeAlgebra(GF(5),1, ['alpha']) # optional - sage.rings.finite_rings Free Algebra on 1 generators (alpha,) over Finite Field of size 5 sage: FreeAlgebra(FreeAlgebra(ZZ,1,'a'), 2, 'x') - Free Algebra on 2 generators (x0, x1) over Free Algebra on 1 generators (a,) over Integer Ring + Free Algebra on 2 generators (x0, x1) over + Free Algebra on 1 generators (a,) over Integer Ring Free algebras are globally unique:: @@ -187,14 +188,14 @@ class FreeAlgebraFactory(UniqueFactory): sage: G = FreeAlgebra(ZZ,3,'x,y,z') sage: F is G True - sage: F. = FreeAlgebra(GF(5),3) # indirect doctest - sage: F is loads(dumps(F)) + sage: F. = FreeAlgebra(GF(5),3) # indirect doctest # optional - sage.rings.finite_rings + sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: F is FreeAlgebra(GF(5),['x','y','z']) + sage: F is FreeAlgebra(GF(5),['x','y','z']) # optional - sage.rings.finite_rings True - sage: copy(F) is F is loads(dumps(F)) + sage: copy(F) is F is loads(dumps(F)) # optional - sage.rings.finite_rings True - sage: TestSuite(F).run() + sage: TestSuite(F).run() # optional - sage.rings.finite_rings By :trac:`7797`, we provide a different implementation of free algebras, based on Singular's "letterplace rings". Our letterplace @@ -203,25 +204,27 @@ class FreeAlgebraFactory(UniqueFactory): elements are supported. Of course, isomorphic algebras in different implementations are not identical:: - sage: G = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') - sage: F == G + sage: G = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: F == G # optional - sage.libs.singular sage.rings.finite_rings False - sage: G is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') + sage: G is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings True - sage: copy(G) is G is loads(dumps(G)) + sage: copy(G) is G is loads(dumps(G)) # optional - sage.libs.singular sage.rings.finite_rings True - sage: TestSuite(G).run() + sage: TestSuite(G).run() # optional - sage.libs.singular sage.rings.finite_rings :: - sage: H = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace', degrees=[1,2,3]) - sage: F != H != G + sage: H = FreeAlgebra(GF(5), ['x','y','z'], implementation='letterplace', # optional - sage.libs.singular sage.rings.finite_rings + ....: degrees=[1,2,3]) + sage: F != H != G # optional - sage.libs.singular sage.rings.finite_rings True - sage: H is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace', degrees=[1,2,3]) + sage: H is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace', # optional - sage.libs.singular sage.rings.finite_rings + ....: degrees=[1,2,3]) True - sage: copy(H) is H is loads(dumps(H)) + sage: copy(H) is H is loads(dumps(H)) # optional - sage.libs.singular sage.rings.finite_rings True - sage: TestSuite(H).run() + sage: TestSuite(H).run() # optional - sage.libs.singular sage.rings.finite_rings Free algebras commute with their base ring. :: @@ -235,7 +238,8 @@ class FreeAlgebraFactory(UniqueFactory): sage: s = a*b^2 * c^3; s a*b^2*c^3 sage: parent(s) - Free Algebra on 1 generators (c,) over Free Algebra on 2 generators (a, b) over Rational Field + Free Algebra on 1 generators (c,) over + Free Algebra on 2 generators (a, b) over Rational Field sage: c^3 * a * b^2 a*b^2*c^3 """ @@ -248,19 +252,23 @@ def create_key(self, base_ring, arg1=None, arg2=None, TESTS:: - sage: FreeAlgebra.create_key(GF(5),['x','y','z']) + sage: FreeAlgebra.create_key(GF(5),['x','y','z']) # optional - sage.rings.finite_rings (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3) + sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3) # optional - sage.rings.finite_rings (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),3,'xyz') + sage: FreeAlgebra.create_key(GF(5),3,'xyz') # optional - sage.rings.finite_rings (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'], implementation='letterplace') + sage: FreeAlgebra.create_key(GF(5),['x','y','z'], # optional - sage.libs.singular sage.rings.finite_rings + ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, implementation='letterplace') + sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, # optional - sage.libs.singular sage.rings.finite_rings + ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', implementation='letterplace') + sage: FreeAlgebra.create_key(GF(5),3,'xyz', # optional - sage.libs.singular sage.rings.finite_rings + ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', implementation='letterplace', degrees=[1,2,3]) + sage: FreeAlgebra.create_key(GF(5),3,'xyz', # optional - sage.libs.singular sage.rings.finite_rings + ....: implementation='letterplace', degrees=[1,2,3]) ((1, 2, 3), Multivariate Polynomial Ring in x, y, z, x_ over Finite Field of size 5) """ @@ -543,21 +551,21 @@ def _element_constructor_(self, x): TESTS:: - sage: F. = FreeAlgebra(GF(5),3) - sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') - sage: F(x) # indirect doctest + sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings + sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: F(x) # indirect doctest # optional - sage.libs.singular sage.rings.finite_rings x - sage: F.1*L.2 + sage: F.1*L.2 # optional - sage.libs.singular sage.rings.finite_rings y*z - sage: (F.1*L.2).parent() is F + sage: (F.1*L.2).parent() is F # optional - sage.libs.singular sage.rings.finite_rings True :: - sage: K. = GF(25) - sage: F. = FreeAlgebra(K,3) - sage: L. = FreeAlgebra(K,3, implementation='letterplace') - sage: F.1+(z+1)*L.2 + sage: K. = GF(25) # optional - sage.rings.finite_rings + sage: F. = FreeAlgebra(K,3) # optional - sage.rings.finite_rings + sage: L. = FreeAlgebra(K,3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: F.1+(z+1)*L.2 # optional - sage.libs.singular sage.rings.finite_rings b + (z+1)*c Check that :trac:`15169` is fixed:: @@ -667,23 +675,23 @@ def _coerce_map_from_(self, R): sage: F.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z')) False - sage: K. = GF(25) - sage: F. = FreeAlgebra(K,3) - sage: F._coerce_map_from_(ZZ) + sage: K. = GF(25) # optional - sage.rings.finite_rings + sage: F. = FreeAlgebra(K,3) # optional - sage.rings.finite_rings + sage: F._coerce_map_from_(ZZ) # optional - sage.rings.finite_rings True - sage: F._coerce_map_from_(QQ) + sage: F._coerce_map_from_(QQ) # optional - sage.rings.finite_rings False - sage: F._coerce_map_from_(F.monoid()) + sage: F._coerce_map_from_(F.monoid()) # optional - sage.rings.finite_rings True - sage: F._coerce_map_from_(F.pbw_basis()) + sage: F._coerce_map_from_(F.pbw_basis()) # optional - sage.rings.finite_rings True sage: G = FreeAlgebra(ZZ, 3, 'a,b,c') - sage: F._coerce_map_from_(G) + sage: F._coerce_map_from_(G) # optional - sage.rings.finite_rings True - sage: G._coerce_map_from_(F) + sage: G._coerce_map_from_(F) # optional - sage.rings.finite_rings False - sage: L. = FreeAlgebra(K,3, implementation='letterplace') - sage: F.1 + (z+1) * L.2 + sage: L. = FreeAlgebra(K,3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: F.1 + (z+1) * L.2 # optional - sage.libs.singular sage.rings.finite_rings b + (z+1)*c """ if self._indices.has_coerce_map_from(R): @@ -780,9 +788,12 @@ def quotient(self, mons, mats=None, names=None, **args): sage: i, j, k = F.gens() sage: mons = [ F(1), i, j, k ] sage: M = MatrixSpace(QQ,4) - sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]), M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]) ] + sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), + ....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]), + ....: M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]) ] sage: H. = A.quotient(mons, mats); H - Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 over Rational Field + Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 + over Rational Field """ if mats is None: return super().quotient(mons, names) diff --git a/src/sage/algebras/free_algebra_element.py b/src/sage/algebras/free_algebra_element.py index 559df673fbf..f5bf4277f16 100644 --- a/src/sage/algebras/free_algebra_element.py +++ b/src/sage/algebras/free_algebra_element.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules """ Free algebra elements diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index b19884335c4..d79b9a2ac47 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -21,11 +21,12 @@ sage: A = FreeAlgebra(QQ,n,'x') sage: F = A.monoid() sage: i, j = F.gens() - sage: mons = [ F(1), i, j, i*j ] + sage: mons = [F(1), i, j, i*j] sage: r = len(mons) sage: M = MatrixSpace(QQ,r) - sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] - sage: H2. = A.quotient(mons,mats) + sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), +....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] + sage: H2. = A.quotient(mons, mats) sage: H2 == loads(dumps(H2)) True sage: i == loads(dumps(i)) @@ -106,15 +107,20 @@ def __init__(self, A, mons, mats, names): sage: A = FreeAlgebra(QQ,n,'i') sage: F = A.monoid() sage: i, j, k = F.gens() - sage: mons = [ F(1), i, j, k ] + sage: mons = [F(1), i, j, k] sage: M = MatrixSpace(QQ,4) - sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]), M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]) ] + sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), + ....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]), + ....: M([0,0,0,1, 0,0,-1,0, 0,1,0,0, -1,0,0,0]) ] sage: H3. = FreeAlgebraQuotient(A,mons,mats) sage: x = 1 + i + j + k sage: x 1 + i + j + k sage: x**128 - -170141183460469231731687303715884105728 + 170141183460469231731687303715884105728*i + 170141183460469231731687303715884105728*j + 170141183460469231731687303715884105728*k + -170141183460469231731687303715884105728 + + 170141183460469231731687303715884105728*i + + 170141183460469231731687303715884105728*j + + 170141183460469231731687303715884105728*k Same algebra defined in terms of two generators, with some penalty on already slow arithmetic. @@ -128,14 +134,18 @@ def __init__(self, A, mons, mats, names): sage: mons = [ F(1), i, j, i*j ] sage: r = len(mons) sage: M = MatrixSpace(QQ,r) - sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] + sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), + ....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] sage: H2. = A.quotient(mons,mats) sage: k = i*j sage: x = 1 + i + j + k sage: x 1 + i + j + i*j sage: x**128 - -170141183460469231731687303715884105728 + 170141183460469231731687303715884105728*i + 170141183460469231731687303715884105728*j + 170141183460469231731687303715884105728*i*j + -170141183460469231731687303715884105728 + + 170141183460469231731687303715884105728*i + + 170141183460469231731687303715884105728*j + + 170141183460469231731687303715884105728*i*j TESTS:: @@ -180,7 +190,7 @@ def _coerce_map_from_(self, S): True sage: H._coerce_map_from_(QQ) True - sage: H._coerce_map_from_(GF(7)) + sage: H._coerce_map_from_(GF(7)) # optional - sage.rings.finite_rings False """ return S == self or self.__free_algebra.has_coerce_map_from(S) @@ -345,7 +355,8 @@ def hamilton_quatalg(R): sage: H, (i,j,k) = sage.algebras.free_algebra_quotient.hamilton_quatalg(ZZ) sage: H - Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 over Integer Ring + Free algebra quotient on 3 generators ('i', 'j', 'k') and dimension 4 + over Integer Ring sage: i^2 -1 sage: i in H diff --git a/src/sage/algebras/free_algebra_quotient_element.py b/src/sage/algebras/free_algebra_quotient_element.py index c841a9210cf..738e5b723a3 100644 --- a/src/sage/algebras/free_algebra_quotient_element.py +++ b/src/sage/algebras/free_algebra_quotient_element.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Free algebra quotient elements diff --git a/src/sage/algebras/free_zinbiel_algebra.py b/src/sage/algebras/free_zinbiel_algebra.py index 39ac9091618..f7e2f97e50c 100644 --- a/src/sage/algebras/free_zinbiel_algebra.py +++ b/src/sage/algebras/free_zinbiel_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Free Zinbiel Algebras @@ -539,14 +540,14 @@ def _coerce_map_from_(self, R): EXAMPLES:: - sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F + sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F # optional - sage.rings.finite_rings Free Zinbiel algebra on generators (Z[x], Z[y], Z[z]) over Finite Field of size 7 Elements of the free Zinbiel algebra canonically coerce in:: - sage: x, y, z = F.gens() - sage: F.coerce(x+y) == x+y + sage: x, y, z = F.gens() # optional - sage.rings.finite_rings + sage: F.coerce(x+y) == x+y # optional - sage.rings.finite_rings True The free Zinbiel algebra over `\ZZ` on `x, y, z` coerces in, since @@ -554,15 +555,15 @@ def _coerce_map_from_(self, R): sage: G = algebras.FreeZinbiel(ZZ, 'x,y,z') sage: Gx,Gy,Gz = G.gens() - sage: z = F.coerce(Gx+Gy); z + sage: z = F.coerce(Gx+Gy); z # optional - sage.rings.finite_rings Z[x] + Z[y] - sage: z.parent() is F + sage: z.parent() is F # optional - sage.rings.finite_rings True However, `\GF{7}` does not coerce to `\ZZ`, so the free Zinbiel algebra over `\GF{7}` does not coerce to the one over `\ZZ`:: - sage: G.coerce(y) + sage: G.coerce(y) # optional - sage.rings.finite_rings Traceback (most recent call last): ... TypeError: no canonical coercion from Free Zinbiel algebra on @@ -641,18 +642,18 @@ class ZinbielFunctor(ConstructionFunctor): sage: F = P.construction()[0]; F Zinbiel[x,y] - sage: A = GF(5)['a,b'] - sage: a, b = A.gens() - sage: F(A) + sage: A = GF(5)['a,b'] # optional - sage.rings.finite_rings + sage: a, b = A.gens() # optional - sage.rings.finite_rings + sage: F(A) # optional - sage.rings.finite_rings Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: f = A.hom([a+b,a-b],A) - sage: F(f) + sage: f = A.hom([a+b,a-b],A) # optional - sage.rings.finite_rings + sage: F(f) # optional - sage.rings.finite_rings Generic endomorphism of Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: F(f)(a * F(A)(x)) + sage: F(f)(a * F(A)(x)) # optional - sage.rings.finite_rings (a+b)*Z[x] """ rank = 9 @@ -705,7 +706,7 @@ def _apply_functor_to_morphism(self, f): TESTS:: sage: R = algebras.FreeZinbiel(ZZ, 'x').construction()[0] - sage: R(ZZ.hom(GF(3))) # indirect doctest + sage: R(ZZ.hom(GF(3))) # indirect doctest # optional - sage.rings.finite_rings Generic morphism: From: Free Zinbiel algebra on generators (Z[x],) over Integer Ring diff --git a/src/sage/algebras/group_algebra.py b/src/sage/algebras/group_algebra.py index e16b0c08a21..38698c5f00d 100644 --- a/src/sage/algebras/group_algebra.py +++ b/src/sage/algebras/group_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.groups sage.modules r""" Group algebras diff --git a/src/sage/algebras/hall_algebra.py b/src/sage/algebras/hall_algebra.py index 3492ba5e073..1da3c8f397e 100644 --- a/src/sage/algebras/hall_algebra.py +++ b/src/sage/algebras/hall_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Hall Algebras diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 0b6696af043..abd613791d3 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Iwahori-Hecke Algebras diff --git a/src/sage/algebras/nil_coxeter_algebra.py b/src/sage/algebras/nil_coxeter_algebra.py index 862fdc3b97e..32d9de8638e 100644 --- a/src/sage/algebras/nil_coxeter_algebra.py +++ b/src/sage/algebras/nil_coxeter_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Nil-Coxeter Algebra """ diff --git a/src/sage/algebras/octonion_algebra.pyx b/src/sage/algebras/octonion_algebra.pyx index aef4f54aa9d..85984dff57c 100644 --- a/src/sage/algebras/octonion_algebra.pyx +++ b/src/sage/algebras/octonion_algebra.pyx @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules """ Octonion Algebras diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 920056787c6..8a57893dc7f 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Orlik-Solomon Algebras """ @@ -545,10 +546,10 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): Lets start with the action of `S_3` on the rank `2` braid matroid:: - sage: M = matroids.CompleteGraphic(3) - sage: M.groundset() + sage: M = matroids.CompleteGraphic(3) # optional - sage.graphs + sage: M.groundset() # optional - sage.graphs frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) + sage: G = SymmetricGroup(3) # optional - sage.groups Calling elements ``g`` of ``G`` on an element `i` of `\{1, 2, 3\}` defines the action we want, but since the groundset is `\{0, 1, 2\}` @@ -560,30 +561,30 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): Now that we have defined an action we can create the invariant, and get its basis:: - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, on_groundset)) - sage: OSG.basis() + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, on_groundset)) # optional - sage.graphs sage.groups + sage: OSG.basis() # optional - sage.graphs sage.groups Finite family {0: B[0], 1: B[1]} - sage: [OSG.lift(b) for b in OSG.basis()] + sage: [OSG.lift(b) for b in OSG.basis()] # optional - sage.graphs sage.groups [OS{}, OS{0} + OS{1} + OS{2}] Since it is invariant, the action of any ``g`` in ``G`` is trivial:: - sage: x = OSG.an_element(); x + sage: x = OSG.an_element(); x # optional - sage.graphs sage.groups 2*B[0] + 2*B[1] - sage: g = G.an_element(); g + sage: g = G.an_element(); g # optional - sage.graphs sage.groups (2,3) - sage: g * x + sage: g * x # optional - sage.graphs sage.groups 2*B[0] + 2*B[1] - sage: x = OSG.random_element() - sage: g = G.random_element() - sage: g * x == x + sage: x = OSG.random_element() # optional - sage.graphs sage.groups + sage: g = G.random_element() # optional - sage.graphs sage.groups + sage: g * x == x # optional - sage.graphs sage.groups True The underlying ambient module is the Orlik-Solomon algebra, which is accessible via :meth:`ambient()`:: - sage: M.orlik_solomon_algebra(QQ) is OSG.ambient() + sage: M.orlik_solomon_algebra(QQ) is OSG.ambient() # optional - sage.graphs sage.groups True There is not much structure here, so lets look at a bigger example. @@ -591,53 +592,53 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): easier, we'll start the indexing at `1` so that the `S_6` action on the groundset is simply calling `g`:: - sage: M = matroids.CompleteGraphic(4); M.groundset() + sage: M = matroids.CompleteGraphic(4); M.groundset() # optional - sage.graphs frozenset({0, 1, 2, 3, 4, 5}) - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] - sage: M = Matroid(bases=new_bases); M.groundset() + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # optional - sage.graphs + sage: M = Matroid(bases=new_bases); M.groundset() # optional - sage.graphs frozenset({1, 2, 3, 4, 5, 6}) - sage: G = SymmetricGroup(6) - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) - sage: OSG.basis() + sage: G = SymmetricGroup(6) # optional - sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # optional - sage.graphs sage.groups + sage: OSG.basis() # optional - sage.graphs sage.groups Finite family {0: B[0], 1: B[1]} - sage: [OSG.lift(b) for b in OSG.basis()] + sage: [OSG.lift(b) for b in OSG.basis()] # optional - sage.graphs sage.groups [OS{}, OS{1} + OS{2} + OS{3} + OS{4} + OS{5} + OS{6}] - sage: (OSG.basis()[1])^2 + sage: (OSG.basis()[1])^2 # optional - sage.graphs sage.groups 0 - sage: 5 * OSG.basis()[1] + sage: 5 * OSG.basis()[1] # optional - sage.graphs sage.groups 5*B[1] Next, we look at the same matroid but with an `S_3 \times S_3` action (here realized as a Young subgroup of `S_6`):: - sage: H = G.young_subgroup([3, 3]) - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) - sage: OSH.basis() + sage: H = G.young_subgroup([3, 3]) # optional - sage.graphs sage.groups + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) # optional - sage.graphs sage.groups + sage: OSH.basis() # optional - sage.graphs sage.groups Finite family {0: B[0], 1: B[1], 2: B[2]} - sage: [OSH.lift(b) for b in OSH.basis()] + sage: [OSH.lift(b) for b in OSH.basis()] # optional - sage.graphs sage.groups [OS{}, OS{4} + OS{5} + OS{6}, OS{1} + OS{2} + OS{3}] We implement an `S_4` action on the vertices:: - sage: M = matroids.CompleteGraphic(4) - sage: G = SymmetricGroup(4) - sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] + sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs + sage: G = SymmetricGroup(4) # optional - sage.groups + sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] # optional - sage.graphs ....: for i in M.groundset()} - sage: inv_map = {v: k for k, v in edge_map.items()} + sage: inv_map = {v: k for k, v in edge_map.items()} # optional - sage.graphs sage: def vert_action(g, x): ....: a, b = edge_map[x] ....: return inv_map[tuple(sorted([g(a+1)-1, g(b+1)-1]))] - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) - sage: B = OSG.basis() - sage: [OSG.lift(b) for b in B] + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) # optional - sage.graphs sage.groups + sage: B = OSG.basis() # optional - sage.graphs sage.groups + sage: [OSG.lift(b) for b in B] # optional - sage.graphs sage.groups [OS{}, OS{0} + OS{1} + OS{2} + OS{3} + OS{4} + OS{5}] We use this to describe the Young subgroup `S_2 \times S_2` action:: - sage: H = G.young_subgroup([2,2]) - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) - sage: B = OSH.basis() - sage: [OSH.lift(b) for b in B] + sage: H = G.young_subgroup([2,2]) # optional - sage.graphs sage.groups + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) # optional - sage.graphs sage.groups + sage: B = OSH.basis() # optional - sage.graphs sage.groups + sage: [OSH.lift(b) for b in B] # optional - sage.graphs sage.groups [OS{}, OS{5}, OS{1} + OS{2} + OS{3} + OS{4}, OS{0}, -1/2*OS{1, 2} + OS{1, 5} - 1/2*OS{3, 4} + OS{3, 5}, OS{0, 5}, OS{0, 1} + OS{0, 2} + OS{0, 3} + OS{0, 4}, @@ -645,7 +646,7 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): We demonstrate the algebra structure:: - sage: matrix([[b*bp for b in B] for bp in B]) + sage: matrix([[b*bp for b in B] for bp in B]) # optional - sage.graphs sage.groups [ B[0] B[1] B[2] B[3] B[4] B[5] B[6] B[7]] [ B[1] 0 2*B[4] B[5] 0 0 2*B[7] 0] [ B[2] -2*B[4] 0 B[6] 0 -2*B[7] 0 0] @@ -668,12 +669,12 @@ def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs): EXAMPLES:: - sage: M = matroids.CompleteGraphic(4) - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] - sage: M = Matroid(bases=new_bases) - sage: G = SymmetricGroup(6) - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) - sage: TestSuite(OSG).run() + sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # optional - sage.graphs + sage: M = Matroid(bases=new_bases) # optional - sage.graphs + sage: G = SymmetricGroup(6) # optional - sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # optional - sage.graphs sage.groups + sage: TestSuite(OSG).run() # optional - sage.graphs sage.groups """ ordering = kwargs.pop('ordering', None) OS = OrlikSolomonAlgebra(R, M, ordering) @@ -756,16 +757,16 @@ def _basis_action(self, g, f): EXAMPLES:: - sage: M = matroids.CompleteGraphic(3) - sage: M.groundset() + sage: M = matroids.CompleteGraphic(3) # optional - sage.graphs + sage: M.groundset() # optional - sage.graphs frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) - sage: def on_groundset(g,x): + sage: G = SymmetricGroup(3) # optional - sage.groups + sage: def on_groundset(g, x): ....: return g(x+1)-1 - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) # optional - sage.graphs sage.groups sage: act = lambda g: (OSG._basis_action(g,frozenset({0,1})), ....: OSG._basis_action(g,frozenset({0,2}))) - sage: [act(g) for g in G] + sage: [act(g) for g in G] # optional - sage.graphs sage.groups [(OS{0, 1}, OS{0, 2}), (-OS{0, 2}, OS{0, 1} - OS{0, 2}), (-OS{0, 1} + OS{0, 2}, -OS{0, 1}), @@ -775,26 +776,26 @@ def _basis_action(self, g, f): We also check that the ordering is respected:: - sage: fset = frozenset({1,2}) - sage: OS1 = M.orlik_solomon_algebra(QQ) - sage: OS1.subset_image(fset) + sage: fset = frozenset({1,2}) # optional - sage.graphs sage.groups + sage: OS1 = M.orlik_solomon_algebra(QQ) # optional - sage.graphs sage.groups + sage: OS1.subset_image(fset) # optional - sage.graphs sage.groups -OS{0, 1} + OS{0, 2} - sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) - sage: OS2.subset_image(fset) + sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) # optional - sage.graphs sage.groups + sage: OS2.subset_image(fset) # optional - sage.graphs sage.groups OS{1, 2} - sage: OSG2 = M.orlik_solomon_algebra(QQ, + sage: OSG2 = M.orlik_solomon_algebra(QQ, # optional - sage.graphs sage.groups ....: invariant=(G,on_groundset), ....: ordering=range(2,-1,-1)) - sage: g = G.an_element(); g + sage: g = G.an_element(); g # optional - sage.graphs sage.groups (2,3) This choice of ``g`` acting on this choice of ``fset`` reverses the sign:: - sage: OSG._basis_action(g, fset) + sage: OSG._basis_action(g, fset) # optional - sage.graphs sage.groups OS{0, 1} - OS{0, 2} - sage: OSG2._basis_action(g, fset) + sage: OSG2._basis_action(g, fset) # optional - sage.graphs sage.groups -OS{1, 2} """ OS = self._ambient diff --git a/src/sage/algebras/orlik_terao.py b/src/sage/algebras/orlik_terao.py index 55fd2bdb641..f7728124ec3 100644 --- a/src/sage/algebras/orlik_terao.py +++ b/src/sage/algebras/orlik_terao.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Orlik-Terao Algebras """ diff --git a/src/sage/algebras/q_commuting_polynomials.py b/src/sage/algebras/q_commuting_polynomials.py index a50b2335787..670e890ecd8 100644 --- a/src/sage/algebras/q_commuting_polynomials.py +++ b/src/sage/algebras/q_commuting_polynomials.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" `q`-Commuting Polynomials diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index f7d495aac50..c39a97db88c 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules r""" Q-Systems diff --git a/src/sage/algebras/quantum_clifford.py b/src/sage/algebras/quantum_clifford.py index 2b85615cf20..3a414418c52 100644 --- a/src/sage/algebras/quantum_clifford.py +++ b/src/sage/algebras/quantum_clifford.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules r""" Quantum Clifford Algebras diff --git a/src/sage/algebras/quantum_groups/fock_space.py b/src/sage/algebras/quantum_groups/fock_space.py index 3352f143a7c..965247f858f 100644 --- a/src/sage/algebras/quantum_groups/fock_space.py +++ b/src/sage/algebras/quantum_groups/fock_space.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules r""" Fock Space diff --git a/src/sage/algebras/quantum_matrix_coordinate_algebra.py b/src/sage/algebras/quantum_matrix_coordinate_algebra.py index 1579896fa86..64b29c82a45 100644 --- a/src/sage/algebras/quantum_matrix_coordinate_algebra.py +++ b/src/sage/algebras/quantum_matrix_coordinate_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Quantum Matrix Coordinate Algebras diff --git a/src/sage/algebras/quaternion_algebra.py b/src/sage/algebras/quaternion_algebra.py index 0f577bbd0b9..bb617738cdc 100644 --- a/src/sage/algebras/quaternion_algebra.py +++ b/src/sage/algebras/quaternion_algebra.py @@ -1,3 +1,5 @@ +# sage.doctest: optional - sage.modules + ############################################################ # Backwards compatible unpickling ############################################################ diff --git a/src/sage/algebras/quaternion_algebra_element.py b/src/sage/algebras/quaternion_algebra_element.py index 48c1c9871ec..aa4f349f1da 100644 --- a/src/sage/algebras/quaternion_algebra_element.py +++ b/src/sage/algebras/quaternion_algebra_element.py @@ -1,3 +1,5 @@ +# sage.doctest: optional - sage.modules + ####################################################################### # Backward compatible unpickle functions ####################################################################### diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index 3b85c1e13a3..d17c415f027 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Rational Cherednik Algebras """ diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index ff960e56dd9..0329c502fc1 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -1,3 +1,4 @@ +# optional - sage.combinat sage.modules r""" Schur algebras for `GL_n` diff --git a/src/sage/algebras/shuffle_algebra.py b/src/sage/algebras/shuffle_algebra.py index 5d383f8dfab..50d43f2a8f7 100644 --- a/src/sage/algebras/shuffle_algebra.py +++ b/src/sage/algebras/shuffle_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# optional - sage.combinat sage.modules r""" Shuffle algebras diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 3b0dfce4586..57bbf71b64e 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# optional - sage.modules r""" Splitting Algebras diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index 7c4d444f81c..ba94cf6311b 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules r""" The Steenrod algebra diff --git a/src/sage/algebras/steenrod/steenrod_algebra_bases.py b/src/sage/algebras/steenrod/steenrod_algebra_bases.py index c289b284fe1..367c854249e 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_bases.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_bases.py @@ -132,12 +132,12 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): EXAMPLES:: sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_to_milnor_matrix - sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest + sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest # optional - sage.modules sage.rings.finite_rings [0 1] [1 1] - sage: convert_to_milnor_matrix(45, 'milnor') + sage: convert_to_milnor_matrix(45, 'milnor') # optional - sage.modules sage.rings.finite_rings 111 x 111 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: convert_to_milnor_matrix(12,'wall') + sage: convert_to_milnor_matrix(12,'wall') # optional - sage.modules sage.rings.finite_rings [1 0 0 1 0 0 0] [1 1 0 0 0 1 0] [0 1 0 1 0 0 0] @@ -149,15 +149,15 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_to_milnor_matrix(17,'adem',3) + sage: convert_to_milnor_matrix(17,'adem',3) # optional - sage.modules sage.rings.finite_rings [0 0 1 1] [0 0 0 1] [1 1 1 1] [0 1 0 1] - sage: convert_to_milnor_matrix(48,'adem',5) + sage: convert_to_milnor_matrix(48,'adem',5) # optional - sage.modules sage.rings.finite_rings [0 1] [1 1] - sage: convert_to_milnor_matrix(36,'adem',3) + sage: convert_to_milnor_matrix(36,'adem',3) # optional - sage.modules sage.rings.finite_rings [0 0 1] [0 1 0] [1 2 0] @@ -206,7 +206,7 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): EXAMPLES:: sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_from_milnor_matrix, convert_to_milnor_matrix - sage: convert_from_milnor_matrix(12,'wall') + sage: convert_from_milnor_matrix(12,'wall') # optional - sage.modules sage.rings.finite_rings [1 0 0 1 0 0 0] [0 0 1 1 0 0 0] [0 0 0 1 0 1 1] @@ -214,10 +214,10 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): [1 0 1 0 1 0 0] [1 1 1 0 0 0 0] [1 0 1 0 1 0 1] - sage: convert_from_milnor_matrix(38,'serre_cartan') + sage: convert_from_milnor_matrix(38,'serre_cartan') # optional - sage.modules sage.rings.finite_rings 72 x 72 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: x = convert_to_milnor_matrix(20,'wood_y') - sage: y = convert_from_milnor_matrix(20,'wood_y') + sage: x = convert_to_milnor_matrix(20,'wood_y') # optional - sage.modules sage.rings.finite_rings + sage: y = convert_from_milnor_matrix(20,'wood_y') # optional - sage.modules sage.rings.finite_rings sage: x*y [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] @@ -240,7 +240,7 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_from_milnor_matrix(17,'adem',3) + sage: convert_from_milnor_matrix(17,'adem',3) # optional - sage.modules sage.rings.finite_rings [2 1 1 2] [0 2 0 1] [1 2 0 0] diff --git a/src/sage/algebras/tensor_algebra.py b/src/sage/algebras/tensor_algebra.py index 664027ee6ae..6054ef8f6c5 100644 --- a/src/sage/algebras/tensor_algebra.py +++ b/src/sage/algebras/tensor_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Tensor Algebras diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index efb148bb5b3..142136d2232 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Weyl Algebras diff --git a/src/sage/algebras/yangian.py b/src/sage/algebras/yangian.py index 55bb61fccf5..2b9702fa247 100644 --- a/src/sage/algebras/yangian.py +++ b/src/sage/algebras/yangian.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Yangians diff --git a/src/sage/algebras/yokonuma_hecke_algebra.py b/src/sage/algebras/yokonuma_hecke_algebra.py index df474b8d4f7..8651e5d32bd 100644 --- a/src/sage/algebras/yokonuma_hecke_algebra.py +++ b/src/sage/algebras/yokonuma_hecke_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.modules """ Yokonuma-Hecke Algebras From 1bddc6b40312479e222980c2ce89ea62223f7384 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 9 Jun 2023 00:55:41 -0700 Subject: [PATCH 05/25] More # optional --- .../algebras/hecke_algebras/ariki_koike_algebra.py | 2 +- .../algebras/hecke_algebras/cubic_hecke_algebra.py | 2 +- .../algebras/hecke_algebras/cubic_hecke_matrix_rep.py | 2 +- src/sage/algebras/jordan_algebra.py | 1 + .../abelian_lie_conformal_algebra.py | 1 + .../affine_lie_conformal_algebra.py | 1 + .../bosonic_ghosts_lie_conformal_algebra.py | 1 + .../fermionic_ghosts_lie_conformal_algebra.py | 1 + .../finitely_freely_generated_lca.py | 1 + .../free_bosons_lie_conformal_algebra.py | 1 + .../free_fermions_lie_conformal_algebra.py | 1 + .../freely_generated_lie_conformal_algebra.py | 1 + .../graded_lie_conformal_algebra.py | 1 + .../lie_conformal_algebras/lie_conformal_algebra.py | 1 + .../lie_conformal_algebra_element.py | 1 + .../lie_conformal_algebra_with_basis.py | 1 + .../lie_conformal_algebra_with_structure_coefs.py | 1 + .../n2_lie_conformal_algebra.py | 1 + .../neveu_schwarz_lie_conformal_algebra.py | 1 + .../virasoro_lie_conformal_algebra.py | 1 + .../weyl_lie_conformal_algebra.py | 1 + .../algebras/quantum_groups/ace_quantum_onsager.py | 1 + src/sage/algebras/quantum_groups/quantum_group_gap.py | 11 +++++++---- src/sage/algebras/quantum_groups/representations.py | 1 + src/sage/algebras/shuffle_algebra.py | 2 +- src/sage/algebras/steenrod/steenrod_algebra_mult.py | 1 + 26 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index cf1c7a04c39..15a0566747c 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.modules r""" Ariki-Koike Algebras diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py index 29d444e745f..a1c175e9151 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.combinat sage.groups sage.modules r""" Cubic Hecke Algebras diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py index ef8ba7316c9..ceda4ec816b 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: optional - sage.modules r""" Cubic Hecke matrix representations diff --git a/src/sage/algebras/jordan_algebra.py b/src/sage/algebras/jordan_algebra.py index 81c40105f8a..0e3a05b4026 100644 --- a/src/sage/algebras/jordan_algebra.py +++ b/src/sage/algebras/jordan_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Jordan Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py index aa8b71901e1..d1efd6e21f2 100644 --- a/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Abelian Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py index 9fdf888fe39..5b7aea16317 100644 --- a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Affine Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py index 178493b13e8..7367bab5c4d 100644 --- a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Bosonic Ghosts Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py index e6bca4de671..4a21da4370b 100644 --- a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Fermionic Ghosts Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py index 9077ef8f6a2..4aaf9da36eb 100644 --- a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +++ b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Finitely and Freely Generated Lie Conformal Algebras. diff --git a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py index 53952f38c91..9008a9770ad 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Free Bosons Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py index 8cc6533b781..83f7bdc0698 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Free Fermions Super Lie Conformal Algebra. diff --git a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py index 8fa5460d29a..21fc30d393b 100644 --- a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Freely Generated Lie Conformal Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py index 35863aece41..a2f1eb8fdf1 100644 --- a/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Graded Lie Conformal Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py index 1007488e165..16758675fdd 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index 723ae5c385a..ccf3ce24111 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Lie Conformal Algebra Element diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py index ae4882dbad0..3b3e3674897 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Lie Conformal Algebras With Basis diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py index 7581daf0ddb..89f7ecc0483 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Lie Conformal Algebras With Structure Coefficients diff --git a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py index 045bfb6e57a..3d02419cc18 100644 --- a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules sage.rings.number_field r""" N=2 Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py index 8f5756f993f..45e28ab3a3c 100644 --- a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Neveu-Schwarz Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py index cc11ec06a0a..6c16820f412 100644 --- a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Virasoro Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index 343ee8a66f9..07c6007e0a4 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Weyl Lie Conformal Algebra diff --git a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py index 91138258e5a..4d2a8386980 100644 --- a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py +++ b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Alternating Central Extension Quantum Onsager Algebra diff --git a/src/sage/algebras/quantum_groups/quantum_group_gap.py b/src/sage/algebras/quantum_groups/quantum_group_gap.py index 8925c047916..4998af7b588 100644 --- a/src/sage/algebras/quantum_groups/quantum_group_gap.py +++ b/src/sage/algebras/quantum_groups/quantum_group_gap.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - gap_package_quagroup +# sage.doctest: optional - gap_package_quagroup sage.combinat sage.libs.gap sage.modules """ Quantum Groups Using GAP's QuaGroup Package @@ -21,7 +21,12 @@ # https://www.gnu.org/licenses/ # **************************************************************************** +import re + +from copy import copy + from sage.misc.lazy_attribute import lazy_attribute +from sage.misc.lazy_import import lazy_import from sage.misc.cachefunc import cached_method from sage.structure.parent import Parent from sage.structure.element import Element @@ -33,7 +38,6 @@ from sage.combinat.root_system.cartan_type import CartanType from sage.libs.gap.libgap import libgap from sage.features.gap import GapPackage -from sage.graphs.digraph import DiGraph from sage.rings.rational_field import QQ from sage.categories.algebras import Algebras from sage.categories.cartesian_product import cartesian_product @@ -44,8 +48,7 @@ from sage.categories.morphism import Morphism from sage.categories.rings import Rings -from copy import copy -import re +lazy_import('sage.graphs.digraph', 'DiGraph') class QuaGroupModuleElement(Element): diff --git a/src/sage/algebras/quantum_groups/representations.py b/src/sage/algebras/quantum_groups/representations.py index b874d264669..19a35b0aa53 100644 --- a/src/sage/algebras/quantum_groups/representations.py +++ b/src/sage/algebras/quantum_groups/representations.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules r""" Quantum Group Representations diff --git a/src/sage/algebras/shuffle_algebra.py b/src/sage/algebras/shuffle_algebra.py index 50d43f2a8f7..d137e2bc9d6 100644 --- a/src/sage/algebras/shuffle_algebra.py +++ b/src/sage/algebras/shuffle_algebra.py @@ -1,4 +1,4 @@ -# optional - sage.combinat sage.modules +# sage.doctest: optional - sage.combinat sage.modules r""" Shuffle algebras diff --git a/src/sage/algebras/steenrod/steenrod_algebra_mult.py b/src/sage/algebras/steenrod/steenrod_algebra_mult.py index 1fb52aba028..35c06d9f711 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_mult.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_mult.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.rings.finite_rings r""" Multiplication for elements of the Steenrod algebra From c78b53caee3fa98e9d86c392e09ad420b3b6d756 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 10 Jun 2023 17:42:47 -0700 Subject: [PATCH 06/25] sage.algebras: More # optional --- src/sage/algebras/free_algebra_quotient.py | 2 +- src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py | 1 + src/sage/algebras/schur_algebra.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index d79b9a2ac47..9ac3706444d 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -25,7 +25,7 @@ sage: r = len(mons) sage: M = MatrixSpace(QQ,r) sage: mats = [M([0,1,0,0, -1,0,0,0, 0,0,0,-1, 0,0,1,0]), -....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] + ....: M([0,0,1,0, 0,0,0,1, -1,0,0,0, 0,-1,0,0]) ] sage: H2. = A.quotient(mons, mats) sage: H2 == loads(dumps(H2)) True diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py index 7c2fe4a2210..159ab06db3a 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.libs.pari (for factorization) r""" Cubic Hecke Base Rings diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index 0329c502fc1..9356d18cd4b 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -1,4 +1,4 @@ -# optional - sage.combinat sage.modules +# sage.doctest: optional - sage.combinat sage.modules r""" Schur algebras for `GL_n` From 4fef2a5a0ef42aad72c87e0e8fe9e196d35da9b6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 10:51:37 -0700 Subject: [PATCH 07/25] More # optional --- .../finite_dimensional_algebra.py | 4 ++-- .../finite_dimensional_algebra_element.pyx | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 67625148ecd..ed6c762ac23 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -814,7 +814,7 @@ def maximal_ideal(self): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B.maximal_ideal() + sage: B.maximal_ideal() # optional - sage.libs.pari Traceback (most recent call last): ... ValueError: algebra is not local @@ -860,7 +860,7 @@ def primary_decomposition(self): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B.primary_decomposition() + sage: B.primary_decomposition() # optional - sage.libs.pari [Morphism from Finite-dimensional algebra of degree 3 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx index d0724bca028..b51f5ed4f7a 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx @@ -642,12 +642,12 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B(0).minimal_polynomial() + sage: B(0).minimal_polynomial() # optional - sage.libs.pari x sage: b = B.random_element() - sage: f = b.minimal_polynomial(); f # random + sage: f = b.minimal_polynomial(); f # random # optional - sage.libs.pari x^3 + 1/2*x^2 - 7/16*x + 1/16 - sage: f(b) == 0 + sage: f(b) == 0 # optional - sage.libs.pari True """ A = self.parent() @@ -673,12 +673,12 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B(0).characteristic_polynomial() + sage: B(0).characteristic_polynomial() # optional - sage.libs.pari x^3 sage: b = B.random_element() - sage: f = b.characteristic_polynomial(); f # random + sage: f = b.characteristic_polynomial(); f # random # optional - sage.libs.pari x^3 - 8*x^2 + 16*x - sage: f(b) == 0 + sage: f(b) == 0 # optional - sage.libs.pari True """ return self.matrix().characteristic_polynomial() From a9fdb2224a3e35bb2e4020c950b1ee2ed4276084 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 23:46:46 -0700 Subject: [PATCH 08/25] src/sage/algebras/free_algebra.py: Use lazy_import --- src/sage/algebras/free_algebra.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index eaddfc54e5a..ea4e2707e67 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -149,6 +149,7 @@ from sage.structure.factory import UniqueFactory from sage.misc.cachefunc import cached_method +from sage.misc.lazy_import import lazy_import from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.ring import Algebra from sage.categories.algebras_with_basis import AlgebrasWithBasis @@ -156,6 +157,8 @@ from sage.combinat.words.word import Word from sage.structure.category_object import normalize_names +lazy_import('sage.algebras.letterplace.free_algebra_letterplace', 'FreeAlgebra_letterplace') + class FreeAlgebraFactory(UniqueFactory): """ @@ -362,8 +365,7 @@ def is_FreeAlgebra(x): True """ - from sage.algebras.letterplace.free_algebra_letterplace import FreeAlgebra_letterplace - return isinstance(x, (FreeAlgebra_generic,FreeAlgebra_letterplace)) + return isinstance(x, (FreeAlgebra_generic, FreeAlgebra_letterplace)) class FreeAlgebra_generic(CombinatorialFreeModule, Algebra): From 445721d621620feb36d3ccb6f9a35fb7ae4bc02c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 11 Jun 2023 23:47:37 -0700 Subject: [PATCH 09/25] More # optional --- src/sage/algebras/free_algebra_quotient.py | 1 + src/sage/algebras/splitting_algebra.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index 9ac3706444d..e54d92ae482 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.combinat sage.modules """ Finite dimensional free algebra quotients diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 57bbf71b64e..8e6d35e7c1b 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -1,4 +1,4 @@ -# optional - sage.modules +# sage.doctest: optional - sage.libs.pari sage.modules r""" Splitting Algebras From aa70cd75243ee4743c458114a687f00eda173446 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 12 Jun 2023 20:59:16 -0700 Subject: [PATCH 10/25] More # optional --- .../finite_dimensional_algebra_morphism.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py index eea375c01d0..5f6512baccf 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py @@ -86,9 +86,9 @@ def _repr_(self): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() - sage: q = A.quotient_map(I) - sage: q._repr_() + sage: I = A.maximal_ideal() # optional - sage.libs.pari + sage: q = A.quotient_map(I) # optional - sage.libs.pari + sage: q._repr_() # optional - sage.libs.pari 'Morphism from Finite-dimensional algebra of degree 2 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field given by matrix\n[1]\n[0]' """ return "Morphism from {} to {} given by matrix\n{}".format( @@ -100,9 +100,9 @@ def __call__(self, x): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() - sage: q = A.quotient_map(I) - sage: q(0) == 0 and q(1) == 1 + sage: I = A.maximal_ideal() # optional - sage.libs.pari + sage: q = A.quotient_map(I) # optional - sage.libs.pari + sage: q(0) == 0 and q(1) == 1 # optional - sage.libs.pari True """ x = self.domain()(x) @@ -182,10 +182,10 @@ def inverse_image(self, I): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() - sage: q = A.quotient_map(I) - sage: B = q.codomain() - sage: q.inverse_image(B.zero_ideal()) == I + sage: I = A.maximal_ideal() # optional - sage.libs.pari + sage: q = A.quotient_map(I) # optional - sage.libs.pari + sage: B = q.codomain() # optional - sage.libs.pari + sage: q.inverse_image(B.zero_ideal()) == I # optional - sage.libs.pari True """ coker_I = I.basis_matrix().transpose().kernel().basis_matrix().transpose() From 017f8bf14432565a9749e432f61281ebf10a1d23 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 30 Jun 2023 18:57:29 -0700 Subject: [PATCH 11/25] ./sage -fixdoctests --long --distribution 'sagemath-modules' --probe sage.rings.finite_rings,sage.libs.pari --overwrite src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx --- .../finite_dimensional_algebra_element.pyx | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx index b51f5ed4f7a..f953a9fab7c 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx @@ -61,20 +61,20 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A(17) # optional - sage.rings.finite_rings + sage: A(17) 2*e0 - sage: A([1,1]) # optional - sage.rings.finite_rings + sage: A([1,1]) e0 + e1 """ def __init__(self, A, elt=None, check=True): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A(QQ(4)) # optional - sage.rings.finite_rings + sage: A(QQ(4)) Traceback (most recent call last): ... TypeError: elt should be a vector, a matrix, or an element of the base field @@ -290,9 +290,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A(1) # optional - sage.rings.finite_rings + sage: A(1) e0 """ s = " " @@ -327,9 +327,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: latex(A(1)) # indirect doctest # optional - sage.rings.finite_rings + sage: latex(A(1)) # indirect doctest \left(\begin{array}{rr} 1 & 0 \\ 0 & 1 @@ -369,13 +369,13 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A(2) == 2 # optional - sage.rings.finite_rings + sage: A(2) == 2 True - sage: A(2) == 3 # optional - sage.rings.finite_rings + sage: A(2) == 3 False - sage: A(2) == GF(5)(2) # optional - sage.rings.finite_rings + sage: A(2) == GF(5)(2) # needs sage.rings.finite_rings False sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), @@ -389,13 +389,13 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): the algebra corresponds to the standard monomials of the relation ideal, when the algebra is considered as a quotient of a path algebra. :: - sage: A(1) > 0 # optional - sage.rings.finite_rings + sage: A(1) > 0 True - sage: A(1) < 0 # optional - sage.rings.finite_rings + sage: A(1) < 0 False - sage: A(1) >= 0 # optional - sage.rings.finite_rings + sage: A(1) >= 0 True - sage: A(1) <= 0 # optional - sage.rings.finite_rings + sage: A(1) <= 0 False """ return richcmp(self._vector, right._vector, op) @@ -404,9 +404,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A.basis()[0] + A.basis()[1] # optional - sage.rings.finite_rings + sage: A.basis()[0] + A.basis()[1] e0 + e1 """ return self._parent.element_class(self._parent, self._vector + other._vector) @@ -415,9 +415,9 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): """ EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1,0], [0,1]]), ....: Matrix([[0,1], [0,0]])]) - sage: A.basis()[0] - A.basis()[1] # optional - sage.rings.finite_rings + sage: A.basis()[0] - A.basis()[1] e0 + 2*e1 """ return self._parent.element_class(self._parent, self._vector - other._vector) @@ -642,12 +642,12 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B(0).minimal_polynomial() # optional - sage.libs.pari + sage: B(0).minimal_polynomial() # needs sage.libs.pari x sage: b = B.random_element() - sage: f = b.minimal_polynomial(); f # random # optional - sage.libs.pari + sage: f = b.minimal_polynomial(); f # random # needs sage.libs.pari x^3 + 1/2*x^2 - 7/16*x + 1/16 - sage: f(b) == 0 # optional - sage.libs.pari + sage: f(b) == 0 # needs sage.libs.pari True """ A = self.parent() @@ -673,12 +673,12 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B(0).characteristic_polynomial() # optional - sage.libs.pari + sage: B(0).characteristic_polynomial() # needs sage.libs.pari x^3 sage: b = B.random_element() - sage: f = b.characteristic_polynomial(); f # random # optional - sage.libs.pari + sage: f = b.characteristic_polynomial(); f # random # needs sage.libs.pari x^3 - 8*x^2 + 16*x - sage: f(b) == 0 # optional - sage.libs.pari + sage: f(b) == 0 # needs sage.libs.pari True """ return self.matrix().characteristic_polynomial() From 6f704455414c78e2ddfbecf0f9460bf68eb539f6 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 1 Jul 2023 17:45:47 -0700 Subject: [PATCH 12/25] ./sage -fixdoctests --long --distribution 'sagemath-modules' --only-tags --probe sage.rings.finite_rings --overwrite src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py --- .../finite_dimensional_algebra.py | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index ed6c762ac23..448c1916aed 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -57,10 +57,10 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Algebra): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]); A Finite-dimensional algebra of degree 2 over Finite Field of size 3 - sage: TestSuite(A).run() # optional - sage.rings.finite_rings + sage: TestSuite(A).run() sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), @@ -70,13 +70,13 @@ class FiniteDimensionalAlgebra(UniqueRepresentation, Algebra): TESTS:: - sage: A.category() # optional - sage.rings.finite_rings + sage: A.category() Category of finite dimensional magmatic algebras with basis over Finite Field of size 3 - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])], ....: assume_associative=True) - sage: A.category() # optional - sage.rings.finite_rings + sage: A.category() Category of finite dimensional associative algebras with basis over Finite Field of size 3 """ @@ -89,47 +89,47 @@ def __classcall_private__(cls, k, table, names='e', assume_associative=False, TESTS:: sage: table = [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])] - sage: A1 = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, names='e') # optional - sage.rings.finite_rings - sage: A3 = FiniteDimensionalAlgebra(GF(3), table, names=['e0', 'e1']) # optional - sage.rings.finite_rings - sage: A1 is A2 and A2 is A3 # optional - sage.rings.finite_rings + sage: A1 = FiniteDimensionalAlgebra(GF(3), table) + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, names='e') + sage: A3 = FiniteDimensionalAlgebra(GF(3), table, names=['e0', 'e1']) + sage: A1 is A2 and A2 is A3 True The ``assume_associative`` keyword is built into the category:: sage: from sage.categories.magmatic_algebras import MagmaticAlgebras - sage: cat = MagmaticAlgebras(GF(3)).FiniteDimensional().WithBasis() # optional - sage.rings.finite_rings - sage: A1 = FiniteDimensionalAlgebra(GF(3), table, # optional - sage.rings.finite_rings + sage: cat = MagmaticAlgebras(GF(3)).FiniteDimensional().WithBasis() + sage: A1 = FiniteDimensionalAlgebra(GF(3), table, ....: category=cat.Associative()) - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, assume_associative=True) # optional - sage.rings.finite_rings - sage: A1 is A2 # optional - sage.rings.finite_rings + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, assume_associative=True) + sage: A1 is A2 True Uniqueness depends on the category:: - sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis() # optional - sage.rings.finite_rings - sage: A1 = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings - sage: A2 = FiniteDimensionalAlgebra(GF(3), table, category=cat) # optional - sage.rings.finite_rings - sage: A1 == A2 # optional - sage.rings.finite_rings + sage: cat = Algebras(GF(3)).FiniteDimensional().WithBasis() + sage: A1 = FiniteDimensionalAlgebra(GF(3), table) + sage: A2 = FiniteDimensionalAlgebra(GF(3), table, category=cat) + sage: A1 == A2 False - sage: A1 is A2 # optional - sage.rings.finite_rings + sage: A1 is A2 False Checking that equality is still as expected:: - sage: A = FiniteDimensionalAlgebra(GF(3), table) # optional - sage.rings.finite_rings - sage: B = FiniteDimensionalAlgebra(GF(5), [Matrix([0])]) # optional - sage.rings.finite_rings - sage: A == A # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), table) + sage: B = FiniteDimensionalAlgebra(GF(5), [Matrix([0])]) + sage: A == A True - sage: B == B # optional - sage.rings.finite_rings + sage: B == B True - sage: A == B # optional - sage.rings.finite_rings + sage: A == B False - sage: A != A # optional - sage.rings.finite_rings + sage: A != A False - sage: B != B # optional - sage.rings.finite_rings + sage: B != B False - sage: A != B # optional - sage.rings.finite_rings + sage: A != B True """ n = len(table) @@ -161,17 +161,17 @@ def __init__(self, k, table, names='e', category=None): sage: TestSuite(A).run() - sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([1])]) # optional - sage.rings.finite_rings - sage: B # optional - sage.rings.finite_rings + sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([1])]) + sage: B Finite-dimensional algebra of degree 1 over Finite Field of size 7 - sage: TestSuite(B).run() # optional - sage.rings.finite_rings + sage: TestSuite(B).run() sage: C = FiniteDimensionalAlgebra(CC, [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])]) sage: C Finite-dimensional algebra of degree 2 over Complex Field with 53 bits of precision sage: TestSuite(C).run() - sage: FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]])]) # optional - sage.rings.finite_rings + sage: FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]])]) Traceback (most recent call last): ... ValueError: input is not a multiplication table @@ -204,15 +204,15 @@ def _coerce_map_from_(self, S): """ TESTS:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.has_coerce_map_from(ZZ) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(ZZ) True - sage: A.has_coerce_map_from(GF(3)) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(GF(3)) True - sage: A.has_coerce_map_from(GF(5)) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(GF(5)) # needs sage.rings.finite_rings False - sage: A.has_coerce_map_from(QQ) # optional - sage.rings.finite_rings + sage: A.has_coerce_map_from(QQ) False """ return S == self or (self.base_ring().has_coerce_map_from(S) and self.is_unitary()) @@ -270,9 +270,9 @@ def ngens(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.ngens() # optional - sage.rings.finite_rings + sage: A.ngens() 2 """ return len(self._table) @@ -286,9 +286,9 @@ def gen(self, i): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.gen(0) # optional - sage.rings.finite_rings + sage: A.gen(0) e0 """ return self.element_class(self, [j == i for j in range(self.ngens())]) @@ -300,9 +300,9 @@ def basis(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.basis() # optional - sage.rings.finite_rings + sage: A.basis() Family (e0, e1) """ from sage.sets.family import Family @@ -314,9 +314,9 @@ def __iter__(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: list(A) # optional - sage.rings.finite_rings + sage: list(A) [0, e0, 2*e0, e1, e0 + e1, 2*e0 + e1, 2*e1, e0 + 2*e1, 2*e0 + 2*e1] This is used in the :class:`Testsuite`'s when ``self`` is @@ -335,9 +335,9 @@ def _ideal_class_(self, n=0): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A._ideal_class_() # optional - sage.rings.finite_rings + sage: A._ideal_class_() """ return FiniteDimensionalAlgebraIdeal @@ -349,9 +349,9 @@ def table(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.table() # optional - sage.rings.finite_rings + sage: A.table() ( [1 0] [0 1] [0 1], [0 0] @@ -400,9 +400,9 @@ def base_extend(self, F): EXAMPLES:: - sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])]) # optional - sage.rings.finite_rings - sage: k. = GF(4) # optional - sage.rings.finite_rings - sage: C.base_extend(k) # optional - sage.rings.finite_rings + sage: C = FiniteDimensionalAlgebra(GF(2), [Matrix([1])]) + sage: k. = GF(4) # needs sage.rings.finite_rings + sage: C.base_extend(k) # needs sage.rings.finite_rings Finite-dimensional algebra of degree 1 over Finite Field in y of size 2^2 """ # Base extension of the multiplication table is done by __classcall_private__. @@ -414,9 +414,9 @@ def cardinality(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [2, 3]])]) - sage: A.cardinality() # optional - sage.rings.finite_rings + sage: A.cardinality() 49 sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), @@ -452,9 +452,9 @@ def ideal(self, gens=None, given_by_matrix=False, side=None): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.ideal(A([1,1])) # optional - sage.rings.finite_rings + sage: A.ideal(A([1,1])) Ideal (e0 + e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3 """ @@ -525,9 +525,9 @@ def is_finite(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(7), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [2, 3]])]) - sage: A.is_finite() # optional - sage.rings.finite_rings + sage: A.is_finite() True sage: B = FiniteDimensionalAlgebra(RR, [Matrix([[1, 0], [0, 1]]), @@ -623,8 +623,8 @@ def is_zero(self): sage: A.is_zero() True - sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])]) # optional - sage.rings.finite_rings - sage: B.is_zero() # optional - sage.rings.finite_rings + sage: B = FiniteDimensionalAlgebra(GF(7), [Matrix([0])]) + sage: B.is_zero() False """ return self.degree() == 0 @@ -680,9 +680,9 @@ def random_element(self, *args, **kwargs): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.random_element() # random # optional - sage.rings.finite_rings + sage: A.random_element() # random e0 + 2*e1 sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), @@ -759,16 +759,16 @@ def quotient_map(self, ideal): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: q0 = A.quotient_map(A.zero_ideal()); q0 # optional - sage.rings.finite_rings + sage: q0 = A.quotient_map(A.zero_ideal()); q0 Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 2 over Finite Field of size 3 given by matrix [1 0] [0 1] - sage: q1 = A.quotient_map(A.ideal(A.gen(1))); q1 # optional - sage.rings.finite_rings + sage: q1 = A.quotient_map(A.ideal(A.gen(1))); q1 Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 1 over Finite Field of size 3 @@ -805,16 +805,16 @@ def maximal_ideal(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.maximal_ideal() # optional - sage.rings.finite_rings + sage: A.maximal_ideal() # needs sage.rings.finite_rings Ideal (0, e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3 sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B.maximal_ideal() # optional - sage.libs.pari + sage: B.maximal_ideal() # needs sage.libs.pari Traceback (most recent call last): ... ValueError: algebra is not local @@ -848,9 +848,9 @@ def primary_decomposition(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.primary_decomposition() # optional - sage.rings.finite_rings + sage: A.primary_decomposition() # needs sage.rings.finite_rings [Morphism from Finite-dimensional algebra of degree 2 over Finite Field of size 3 to Finite-dimensional algebra of degree 2 over Finite Field of size 3 @@ -860,7 +860,7 @@ def primary_decomposition(self): sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), ....: Matrix([[0,1,0], [0,0,0], [0,0,0]]), ....: Matrix([[0,0,0], [0,0,0], [0,0,1]])]) - sage: B.primary_decomposition() # optional - sage.libs.pari + sage: B.primary_decomposition() # needs sage.libs.pari [Morphism from Finite-dimensional algebra of degree 3 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field @@ -916,9 +916,9 @@ def maximal_ideals(self): EXAMPLES:: - sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), # optional - sage.rings.finite_rings + sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: A.maximal_ideals() # optional - sage.rings.finite_rings + sage: A.maximal_ideals() # needs sage.rings.finite_rings [Ideal (e1) of Finite-dimensional algebra of degree 2 over Finite Field of size 3] sage: B = FiniteDimensionalAlgebra(QQ, []) From 88c05fd59806e6312847e3dad4ca57849a823740 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 2 Jul 2023 01:00:55 -0700 Subject: [PATCH 13/25] sage.algebras: Update # optional / # needs --- src/sage/algebras/algebra.py | 2 +- .../algebras/clifford_algebra_element.pyx | 1 + src/sage/algebras/group_algebra.py | 2 +- src/sage/algebras/octonion_algebra.pyx | 12 +- src/sage/algebras/orlik_solomon.py | 188 ++++++++++-------- src/sage/algebras/orlik_terao.py | 32 ++- 6 files changed, 137 insertions(+), 100 deletions(-) diff --git a/src/sage/algebras/algebra.py b/src/sage/algebras/algebra.py index 547eee6c699..e69ea7da530 100644 --- a/src/sage/algebras/algebra.py +++ b/src/sage/algebras/algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Abstract base class for algebras """ diff --git a/src/sage/algebras/clifford_algebra_element.pyx b/src/sage/algebras/clifford_algebra_element.pyx index fc70360dab3..3ebad1013fe 100644 --- a/src/sage/algebras/clifford_algebra_element.pyx +++ b/src/sage/algebras/clifford_algebra_element.pyx @@ -945,6 +945,7 @@ cdef class CohomologyRAAGElement(CliffordAlgebraElement): EXAMPLES:: + sage: # needs sage.graphs sage: C4 = graphs.CycleGraph(4) sage: A = groups.misc.RightAngledArtin(C4) sage: H = A.cohomology() diff --git a/src/sage/algebras/group_algebra.py b/src/sage/algebras/group_algebra.py index 38698c5f00d..eaffe7538b7 100644 --- a/src/sage/algebras/group_algebra.py +++ b/src/sage/algebras/group_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.groups sage.modules +# sage.doctest: needs sage.groups sage.modules r""" Group algebras diff --git a/src/sage/algebras/octonion_algebra.pyx b/src/sage/algebras/octonion_algebra.pyx index 85984dff57c..ee69aca6a7e 100644 --- a/src/sage/algebras/octonion_algebra.pyx +++ b/src/sage/algebras/octonion_algebra.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules """ Octonion Algebras @@ -416,7 +416,7 @@ cdef class Octonion_generic(AlgebraElement): sage: O = OctonionAlgebra(QQ, 1, 3, 7) sage: elt = sum(i * b for i, b in enumerate(O.basis(), start=2)) - sage: elt.norm() + sage: elt.norm() # needs sage.symbolic 2*sqrt(-61) sage: elt = sum(O.basis()) sage: elt.norm() @@ -439,7 +439,7 @@ cdef class Octonion_generic(AlgebraElement): sage: O = OctonionAlgebra(QQ, 1, 3, 7) sage: elt = sum(i * b for i, b in enumerate(O.basis(), start=2)) - sage: elt.abs() + sage: elt.abs() # needs sage.symbolic 2*sqrt(-61) sage: elt = sum(O.basis()) sage: elt.abs() @@ -577,10 +577,10 @@ cdef class Octonion(Octonion_generic): sage: O = OctonionAlgebra(QQ) sage: elt = sum(i * b for i, b in enumerate(O.basis(), start=2)) - sage: elt.norm() + sage: elt.norm() # needs sage.symbolic 2*sqrt(71) sage: elt = sum(O.basis()) - sage: elt.norm() + sage: elt.norm() # needs sage.symbolic 2*sqrt(2) """ return self.vec.norm() @@ -751,7 +751,7 @@ class OctonionAlgebra(UniqueRepresentation, Parent): EXAMPLES:: sage: O = OctonionAlgebra(QQ) - sage: TestSuite(O).run() + sage: TestSuite(O).run() # needs sage.symbolic sage: O = OctonionAlgebra(QQ, 1, 3, 7) sage: TestSuite(O).run() diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 8a57893dc7f..f92a93c7e21 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Orlik-Solomon Algebras """ @@ -115,9 +115,10 @@ def __init__(self, R, M, ordering=None): We check on the matroid associated to the graph with 3 vertices and 2 edges between each vertex:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True) - sage: M = Matroid(G) - sage: OS = M.orlik_solomon_algebra(QQ) + sage: MG = Matroid(G) + sage: OS = MG.orlik_solomon_algebra(QQ) sage: elts = OS.some_elements() + list(OS.algebra_generators()) sage: TestSuite(OS).run(elements=elts) """ @@ -254,10 +255,11 @@ def product_on_basis(self, a, b): Let us check that `e_{s_1} e_{s_2} \cdots e_{s_k} = e_S` for any subset `S = \{ s_1 < s_2 < \cdots < s_k \}` of the ground set:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True) - sage: M = Matroid(G).regular_matroid() - sage: E = M.groundset_list() - sage: OS = M.orlik_solomon_algebra(ZZ) + sage: MG = Matroid(G).regular_matroid() + sage: E = MG.groundset_list() + sage: OS = MG.orlik_solomon_algebra(ZZ) sage: G = OS.algebra_generators() sage: import itertools sage: def test_prod(F): @@ -327,31 +329,33 @@ def subset_image(self, S): ([2, 5], -OS{0, 2} + OS{0, 5}) ([4, 5], -OS{3, 4} + OS{3, 5}) + sage: # needs sage.graphs sage: M4 = matroids.CompleteGraphic(4) - sage: OS = M4.orlik_solomon_algebra(QQ) - sage: OS.subset_image(frozenset({2,3,4})) + sage: OSM4 = M4.orlik_solomon_algebra(QQ) + sage: OSM4.subset_image(frozenset({2,3,4})) OS{0, 2, 3} + OS{0, 3, 4} An example of a custom ordering:: + sage: # needs sage.graphs sage: G = Graph([[3, 4], [4, 1], [1, 2], [2, 3], [3, 5], [5, 6], [6, 3]]) - sage: M = Matroid(G) + sage: MG = Matroid(G) sage: s = [(5, 6), (1, 2), (3, 5), (2, 3), (1, 4), (3, 6), (3, 4)] - sage: sorted([sorted(c) for c in M.circuits()]) + sage: sorted([sorted(c) for c in MG.circuits()]) [[(1, 2), (1, 4), (2, 3), (3, 4)], [(3, 5), (3, 6), (5, 6)]] - sage: OS = M.orlik_solomon_algebra(QQ, ordering=s) - sage: OS.subset_image(frozenset([])) + sage: OSMG = MG.orlik_solomon_algebra(QQ, ordering=s) + sage: OSMG.subset_image(frozenset([])) OS{} - sage: OS.subset_image(frozenset([(1,2),(3,4),(1,4),(2,3)])) + sage: OSMG.subset_image(frozenset([(1,2),(3,4),(1,4),(2,3)])) 0 - sage: OS.subset_image(frozenset([(2,3),(1,2),(3,4)])) + sage: OSMG.subset_image(frozenset([(2,3),(1,2),(3,4)])) OS{(1, 2), (2, 3), (3, 4)} - sage: OS.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(5,6)])) + sage: OSMG.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(5,6)])) -OS{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)} + OS{(1, 2), (1, 4), (3, 4), (3, 6), (5, 6)} - OS{(1, 2), (2, 3), (3, 4), (3, 6), (5, 6)} - sage: OS.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(3,5)])) + sage: OSMG.subset_image(frozenset([(1,4),(3,4),(2,3),(3,6),(3,5)])) OS{(1, 2), (1, 4), (2, 3), (3, 5), (5, 6)} - OS{(1, 2), (1, 4), (2, 3), (3, 6), (5, 6)} + OS{(1, 2), (1, 4), (3, 4), (3, 5), (5, 6)} @@ -361,34 +365,36 @@ def subset_image(self, S): TESTS:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True) - sage: M = Matroid(G) + sage: MG = Matroid(G) sage: sorted([sorted(c) for c in M.circuits()]) [[0, 1], [0, 2, 4], [0, 2, 5], [0, 3, 4], [0, 3, 5], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3, 5], [2, 3], [4, 5]] - sage: OS = M.orlik_solomon_algebra(QQ) - sage: OS.subset_image(frozenset([])) + sage: OSMG = MG.orlik_solomon_algebra(QQ) + sage: OSMG.subset_image(frozenset([])) OS{} - sage: OS.subset_image(frozenset([1, 2, 3])) + sage: OSMG.subset_image(frozenset([1, 2, 3])) 0 - sage: OS.subset_image(frozenset([1, 3, 5])) + sage: OSMG.subset_image(frozenset([1, 3, 5])) 0 - sage: OS.subset_image(frozenset([1, 2])) + sage: OSMG.subset_image(frozenset([1, 2])) OS{0, 2} - sage: OS.subset_image(frozenset([3, 4])) + sage: OSMG.subset_image(frozenset([3, 4])) -OS{0, 2} + OS{0, 4} - sage: OS.subset_image(frozenset([1, 5])) + sage: OSMG.subset_image(frozenset([1, 5])) OS{0, 4} + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True) - sage: M = Matroid(G) - sage: sorted([sorted(c) for c in M.circuits()]) + sage: MG = Matroid(G) + sage: sorted([sorted(c) for c in MG.circuits()]) [[0, 1], [2, 3, 4]] - sage: OS = M.orlik_solomon_algebra(QQ) - sage: OS.subset_image(frozenset([])) + sage: OSMG = MG.orlik_solomon_algebra(QQ) + sage: OSMG.subset_image(frozenset([])) OS{} - sage: OS.subset_image(frozenset([1, 3, 4])) + sage: OSMG.subset_image(frozenset([1, 3, 4])) -OS{0, 2, 3} + OS{0, 2, 4} We check on a non-standard ordering:: @@ -453,6 +459,7 @@ def as_gca(self): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: H = hyperplane_arrangements.braid(3) sage: O = H.orlik_solomon_algebra(QQ) sage: O.as_gca() @@ -477,6 +484,7 @@ def as_gca(self): TESTS:: + sage: # needs sage.geometry.polyhedron sage: H = hyperplane_arrangements.Catalan(3,QQ).cone() sage: O = H.orlik_solomon_algebra(QQ) sage: A = O.as_gca() @@ -516,6 +524,7 @@ def as_cdga(self): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: H = hyperplane_arrangements.braid(3) sage: O = H.orlik_solomon_algebra(QQ) sage: O.as_cdga() @@ -546,10 +555,11 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): Lets start with the action of `S_3` on the rank `2` braid matroid:: - sage: M = matroids.CompleteGraphic(3) # optional - sage.graphs - sage: M.groundset() # optional - sage.graphs + sage: # needs sage.graphs + sage: M = matroids.CompleteGraphic(3) + sage: M.groundset() frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) # optional - sage.groups + sage: G = SymmetricGroup(3) # needs sage.groups Calling elements ``g`` of ``G`` on an element `i` of `\{1, 2, 3\}` defines the action we want, but since the groundset is `\{0, 1, 2\}` @@ -561,30 +571,33 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): Now that we have defined an action we can create the invariant, and get its basis:: - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, on_groundset)) # optional - sage.graphs sage.groups - sage: OSG.basis() # optional - sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, on_groundset)) + sage: OSG.basis() Finite family {0: B[0], 1: B[1]} - sage: [OSG.lift(b) for b in OSG.basis()] # optional - sage.graphs sage.groups + sage: [OSG.lift(b) for b in OSG.basis()] [OS{}, OS{0} + OS{1} + OS{2}] Since it is invariant, the action of any ``g`` in ``G`` is trivial:: - sage: x = OSG.an_element(); x # optional - sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: x = OSG.an_element(); x 2*B[0] + 2*B[1] - sage: g = G.an_element(); g # optional - sage.graphs sage.groups + sage: g = G.an_element(); g (2,3) - sage: g * x # optional - sage.graphs sage.groups + sage: g * x 2*B[0] + 2*B[1] - sage: x = OSG.random_element() # optional - sage.graphs sage.groups - sage: g = G.random_element() # optional - sage.graphs sage.groups - sage: g * x == x # optional - sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: x = OSG.random_element() + sage: g = G.random_element() + sage: g * x == x True The underlying ambient module is the Orlik-Solomon algebra, which is accessible via :meth:`ambient()`:: - sage: M.orlik_solomon_algebra(QQ) is OSG.ambient() # optional - sage.graphs sage.groups + sage: M.orlik_solomon_algebra(QQ) is OSG.ambient() # needs sage.graphs sage.groups True There is not much structure here, so lets look at a bigger example. @@ -592,53 +605,53 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): easier, we'll start the indexing at `1` so that the `S_6` action on the groundset is simply calling `g`:: - sage: M = matroids.CompleteGraphic(4); M.groundset() # optional - sage.graphs + sage: M = matroids.CompleteGraphic(4); M.groundset() # needs sage.graphs frozenset({0, 1, 2, 3, 4, 5}) - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # optional - sage.graphs - sage: M = Matroid(bases=new_bases); M.groundset() # optional - sage.graphs + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # needs sage.graphs + sage: M = Matroid(bases=new_bases); M.groundset() # needs sage.graphs frozenset({1, 2, 3, 4, 5, 6}) - sage: G = SymmetricGroup(6) # optional - sage.groups - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # optional - sage.graphs sage.groups - sage: OSG.basis() # optional - sage.graphs sage.groups + sage: G = SymmetricGroup(6) # needs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # needs sage.graphs sage.groups + sage: OSG.basis() # needs sage.graphs sage.groups Finite family {0: B[0], 1: B[1]} - sage: [OSG.lift(b) for b in OSG.basis()] # optional - sage.graphs sage.groups + sage: [OSG.lift(b) for b in OSG.basis()] # needs sage.graphs sage.groups [OS{}, OS{1} + OS{2} + OS{3} + OS{4} + OS{5} + OS{6}] - sage: (OSG.basis()[1])^2 # optional - sage.graphs sage.groups + sage: (OSG.basis()[1])^2 # needs sage.graphs sage.groups 0 - sage: 5 * OSG.basis()[1] # optional - sage.graphs sage.groups + sage: 5 * OSG.basis()[1] # needs sage.graphs sage.groups 5*B[1] Next, we look at the same matroid but with an `S_3 \times S_3` action (here realized as a Young subgroup of `S_6`):: - sage: H = G.young_subgroup([3, 3]) # optional - sage.graphs sage.groups - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) # optional - sage.graphs sage.groups - sage: OSH.basis() # optional - sage.graphs sage.groups + sage: H = G.young_subgroup([3, 3]) # needs sage.graphs sage.groups + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) # needs sage.graphs sage.groups + sage: OSH.basis() # needs sage.graphs sage.groups Finite family {0: B[0], 1: B[1], 2: B[2]} - sage: [OSH.lift(b) for b in OSH.basis()] # optional - sage.graphs sage.groups + sage: [OSH.lift(b) for b in OSH.basis()] # needs sage.graphs sage.groups [OS{}, OS{4} + OS{5} + OS{6}, OS{1} + OS{2} + OS{3}] We implement an `S_4` action on the vertices:: - sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs - sage: G = SymmetricGroup(4) # optional - sage.groups - sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] # optional - sage.graphs + sage: M = matroids.CompleteGraphic(4) # needs sage.graphs + sage: G = SymmetricGroup(4) # needs sage.groups + sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] # needs sage.graphs ....: for i in M.groundset()} - sage: inv_map = {v: k for k, v in edge_map.items()} # optional - sage.graphs + sage: inv_map = {v: k for k, v in edge_map.items()} # needs sage.graphs sage: def vert_action(g, x): ....: a, b = edge_map[x] ....: return inv_map[tuple(sorted([g(a+1)-1, g(b+1)-1]))] - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) # optional - sage.graphs sage.groups - sage: B = OSG.basis() # optional - sage.graphs sage.groups - sage: [OSG.lift(b) for b in B] # optional - sage.graphs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) # needs sage.graphs sage.groups + sage: B = OSG.basis() # needs sage.graphs sage.groups + sage: [OSG.lift(b) for b in B] # needs sage.graphs sage.groups [OS{}, OS{0} + OS{1} + OS{2} + OS{3} + OS{4} + OS{5}] We use this to describe the Young subgroup `S_2 \times S_2` action:: - sage: H = G.young_subgroup([2,2]) # optional - sage.graphs sage.groups - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) # optional - sage.graphs sage.groups - sage: B = OSH.basis() # optional - sage.graphs sage.groups - sage: [OSH.lift(b) for b in B] # optional - sage.graphs sage.groups + sage: H = G.young_subgroup([2,2]) # needs sage.graphs sage.groups + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) # needs sage.graphs sage.groups + sage: B = OSH.basis() # needs sage.graphs sage.groups + sage: [OSH.lift(b) for b in B] # needs sage.graphs sage.groups [OS{}, OS{5}, OS{1} + OS{2} + OS{3} + OS{4}, OS{0}, -1/2*OS{1, 2} + OS{1, 5} - 1/2*OS{3, 4} + OS{3, 5}, OS{0, 5}, OS{0, 1} + OS{0, 2} + OS{0, 3} + OS{0, 4}, @@ -646,7 +659,7 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): We demonstrate the algebra structure:: - sage: matrix([[b*bp for b in B] for bp in B]) # optional - sage.graphs sage.groups + sage: matrix([[b*bp for b in B] for bp in B]) # needs sage.graphs sage.groups [ B[0] B[1] B[2] B[3] B[4] B[5] B[6] B[7]] [ B[1] 0 2*B[4] B[5] 0 0 2*B[7] 0] [ B[2] -2*B[4] 0 B[6] 0 -2*B[7] 0 0] @@ -669,12 +682,12 @@ def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs): EXAMPLES:: - sage: M = matroids.CompleteGraphic(4) # optional - sage.graphs - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # optional - sage.graphs - sage: M = Matroid(bases=new_bases) # optional - sage.graphs - sage: G = SymmetricGroup(6) # optional - sage.groups - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # optional - sage.graphs sage.groups - sage: TestSuite(OSG).run() # optional - sage.graphs sage.groups + sage: M = matroids.CompleteGraphic(4) # needs sage.graphs + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # needs sage.graphs + sage: M = Matroid(bases=new_bases) # needs sage.graphs + sage: G = SymmetricGroup(6) # needs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # needs sage.graphs sage.groups + sage: TestSuite(OSG).run() # needs sage.graphs sage.groups """ ordering = kwargs.pop('ordering', None) OS = OrlikSolomonAlgebra(R, M, ordering) @@ -757,16 +770,17 @@ def _basis_action(self, g, f): EXAMPLES:: - sage: M = matroids.CompleteGraphic(3) # optional - sage.graphs - sage: M.groundset() # optional - sage.graphs + sage: # needs sage.graphs + sage: M = matroids.CompleteGraphic(3) + sage: M.groundset() frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) # optional - sage.groups + sage: G = SymmetricGroup(3) # needs sage.groups sage: def on_groundset(g, x): ....: return g(x+1)-1 - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) # optional - sage.graphs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) # needs sage.groups sage: act = lambda g: (OSG._basis_action(g,frozenset({0,1})), ....: OSG._basis_action(g,frozenset({0,2}))) - sage: [act(g) for g in G] # optional - sage.graphs sage.groups + sage: [act(g) for g in G] # needs sage.groups [(OS{0, 1}, OS{0, 2}), (-OS{0, 2}, OS{0, 1} - OS{0, 2}), (-OS{0, 1} + OS{0, 2}, -OS{0, 1}), @@ -776,26 +790,26 @@ def _basis_action(self, g, f): We also check that the ordering is respected:: - sage: fset = frozenset({1,2}) # optional - sage.graphs sage.groups - sage: OS1 = M.orlik_solomon_algebra(QQ) # optional - sage.graphs sage.groups - sage: OS1.subset_image(fset) # optional - sage.graphs sage.groups + sage: fset = frozenset({1,2}) # needs sage.graphs sage.groups + sage: OS1 = M.orlik_solomon_algebra(QQ) # needs sage.graphs sage.groups + sage: OS1.subset_image(fset) # needs sage.graphs sage.groups -OS{0, 1} + OS{0, 2} - sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) # optional - sage.graphs sage.groups - sage: OS2.subset_image(fset) # optional - sage.graphs sage.groups + sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) # needs sage.graphs sage.groups + sage: OS2.subset_image(fset) # needs sage.graphs sage.groups OS{1, 2} - sage: OSG2 = M.orlik_solomon_algebra(QQ, # optional - sage.graphs sage.groups + sage: OSG2 = M.orlik_solomon_algebra(QQ, # needs sage.graphs sage.groups ....: invariant=(G,on_groundset), ....: ordering=range(2,-1,-1)) - sage: g = G.an_element(); g # optional - sage.graphs sage.groups + sage: g = G.an_element(); g # needs sage.graphs sage.groups (2,3) This choice of ``g`` acting on this choice of ``fset`` reverses the sign:: - sage: OSG._basis_action(g, fset) # optional - sage.graphs sage.groups + sage: OSG._basis_action(g, fset) # needs sage.graphs sage.groups OS{0, 1} - OS{0, 2} - sage: OSG2._basis_action(g, fset) # optional - sage.graphs sage.groups + sage: OSG2._basis_action(g, fset) # needs sage.graphs sage.groups -OS{1, 2} """ OS = self._ambient diff --git a/src/sage/algebras/orlik_terao.py b/src/sage/algebras/orlik_terao.py index f7728124ec3..db493ac6b1b 100644 --- a/src/sage/algebras/orlik_terao.py +++ b/src/sage/algebras/orlik_terao.py @@ -131,10 +131,12 @@ def __init__(self, R, M, ordering=None): sage: OT = M.orlik_terao_algebra(QQ) sage: TestSuite(OT).run(elements=OT.basis()) + sage: # needs sage.graphs sage: M = matroids.CompleteGraphic(4).ternary_matroid() sage: OT = M.orlik_terao_algebra(GF(3)['t']) sage: TestSuite(OT).run(elements=OT.basis()) + sage: # needs sage.geometry.polyhedron sage: H = hyperplane_arrangements.Catalan(4).cone() sage: M = H.matroid() sage: OT = M.orlik_terao_algebra() @@ -145,6 +147,7 @@ def __init__(self, R, M, ordering=None): We check on the matroid associated to the graph with 3 vertices and 2 edges between each vertex:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True) sage: M = Matroid(G).regular_matroid() sage: OT = M.orlik_terao_algebra(QQ) @@ -322,6 +325,7 @@ def product_on_basis(self, a, b): Let us check that `e_{s_1} e_{s_2} \cdots e_{s_k} = e_S` for any subset `S = \{ s_1 < s_2 < \cdots < s_k \}` of the ground set:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True) sage: M = Matroid(G).regular_matroid() sage: E = M.groundset_list() @@ -371,6 +375,7 @@ def subset_image(self, S): ([2, 5], -OT{0, 2} + OT{0, 5}) ([4, 5], -OT{3, 4} - OT{3, 5}) + sage: # needs sage.graphs sage: M4 = matroids.CompleteGraphic(4).ternary_matroid() sage: OT = M4.orlik_terao_algebra() sage: OT.subset_image(frozenset({2,3,4})) @@ -378,6 +383,7 @@ def subset_image(self, S): An example of a custom ordering:: + sage: # needs sage.graphs sage: G = Graph([[3, 4], [4, 1], [1, 2], [2, 3], [3, 5], [5, 6], [6, 3]]) sage: M = Matroid(G).regular_matroid() sage: s = [(5, 6), (1, 2), (3, 5), (2, 3), (1, 4), (3, 6), (3, 4)] @@ -405,6 +411,7 @@ def subset_image(self, S): TESTS:: + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True) sage: M = Matroid(G).regular_matroid() sage: sorted([sorted(c) for c in M.circuits()]) @@ -425,6 +432,7 @@ def subset_image(self, S): sage: OT.subset_image(frozenset([1, 5])) OT{0, 4} + sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[3,4],[4,2]], multiedges=True) sage: M = Matroid(G).regular_matroid() sage: sorted([sorted(c) for c in M.circuits()]) @@ -499,6 +507,7 @@ def _chi(self, X): EXAMPLES:: + sage: # needs sage.geometry.polyhedron sage: H = hyperplane_arrangements.Catalan(2).cone() sage: M = H.matroid() sage: OT = M.orlik_terao_algebra() @@ -542,7 +551,7 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): sage: M = Matroid(A) sage: M.groundset() frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) + sage: G = SymmetricGroup(3) # needs sage.groups Calling elements ``g`` of ``G`` on an element `i` of `\{1,2,3\}` defines the action we want, but since the groundset is `\{0,1,2\}` @@ -554,7 +563,8 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): Now that we have defined an action we can create the invariant, and get its basis:: - sage: OTG = M.orlik_terao_algebra(QQ, invariant = (G, on_groundset)) + sage: # needs sage.groups + sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G, on_groundset)) sage: OTG.basis() Finite family {0: B[0], 1: B[1]} sage: [OTG.lift(b) for b in OTG.basis()] @@ -562,6 +572,7 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): Since it is invariant, the action of any ``g`` in ``G`` is trivial:: + sage: # needs sage.groups sage: x = OTG.an_element(); x 2*B[0] + 2*B[1] sage: g = G.an_element(); g @@ -569,6 +580,7 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): sage: g*x 2*B[0] + 2*B[1] + sage: # needs sage.groups sage: x = OTG.random_element() sage: g = G.random_element() sage: g*x == x @@ -577,11 +589,12 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): The underlying ambient module is the Orlik-Terao algebra, which is accessible via :meth:`ambient()`:: - sage: M.orlik_terao_algebra(QQ) is OTG.ambient() + sage: M.orlik_terao_algebra(QQ) is OTG.ambient() # needs sage.groups True For a bigger example, here we will look at the rank-`3` braid matroid:: + sage: # needs sage.groups sage: A = matrix([[1,1,1,0,0,0],[-1,0,0,1,1,0], ....: [0,-1,0,-1,0,1],[0,0,-1,0,-1,-1]]); A [ 1 1 1 0 0 0] @@ -591,9 +604,11 @@ class OrlikTeraoInvariantAlgebra(FiniteDimensionalInvariantModule): sage: M = Matroid(A); M.groundset() frozenset({0, 1, 2, 3, 4, 5}) sage: G = SymmetricGroup(6) - sage: OTG = M.orlik_terao_algebra(QQ, invariant = (G, on_groundset)) + sage: OTG = M.orlik_terao_algebra(QQ, invariant=(G, on_groundset)) sage: OTG.ambient() - Orlik-Terao algebra of Linear matroid of rank 3 on 6 elements represented over the Rational Field over Rational Field + Orlik-Terao algebra of + Linear matroid of rank 3 on 6 elements represented over the Rational Field + over Rational Field sage: OTG.basis() Finite family {0: B[0], 1: B[1]} sage: [OTG.lift(b) for b in OTG.basis()] @@ -606,6 +621,7 @@ def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs): EXAMPLES:: + sage: # needs sage.groups sage: A = matrix([[1,1,1,0,0,0],[-1,0,0,1,1,0],[0,-1,0,-1,0,1], ....: [0,0,-1,0,-1,-1]]) sage: M = Matroid(A); @@ -669,6 +685,7 @@ def construction(self): TESTS:: + sage: # needs sage.groups sage: A = matrix([[1,1,0],[-1,0,1],[0,-1,-1]]) sage: M = Matroid(A) sage: G = SymmetricGroup(3) @@ -697,6 +714,7 @@ def _basis_action(self, g, f): EXAMPLES:: + sage: # needs sage.groups sage: A = matrix([[1,1,0],[-1,0,1],[0,-1,-1]]) sage: M = Matroid(A) sage: M.groundset() @@ -719,6 +737,7 @@ def _basis_action(self, g, f): We also check that the ordering is respected:: + sage: # needs sage.groups sage: fset = frozenset({1,2}) sage: OT1 = M.orlik_terao_algebra(QQ) sage: OT1.subset_image(fset) @@ -727,6 +746,7 @@ def _basis_action(self, g, f): sage: OT2.subset_image(fset) OT{1, 2} + sage: # needs sage.groups sage: OTG2 = M.orlik_terao_algebra(QQ, ....: invariant=(G,on_groundset), ....: ordering=range(2,-1,-1)) @@ -735,6 +755,7 @@ def _basis_action(self, g, f): This choice of ``g`` fixes these elements:: + sage: # needs sage.groups sage: OTG._basis_action(g, fset) -OT{0, 1} + OT{0, 2} sage: OTG2._basis_action(g, fset) @@ -742,6 +763,7 @@ def _basis_action(self, g, f): TESTS:: + sage: # needs sage.groups sage: [on_groundset(g, e) for e in M.groundset()] [0, 2, 1] sage: [OTG._groundset_action(g,e) for e in M.groundset()] From 6857ee2ab51b999e267a9a9d7f65c786e5b80c70 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 20:44:52 -0700 Subject: [PATCH 14/25] src/sage/algebras: Update file-level doctest tag --- src/sage/algebras/affine_nil_temperley_lieb.py | 2 +- src/sage/algebras/askey_wilson.py | 2 +- src/sage/algebras/associated_graded.py | 2 +- src/sage/algebras/cellular_basis.py | 2 +- src/sage/algebras/clifford_algebra.py | 2 +- src/sage/algebras/clifford_algebra_element.pyx | 2 +- src/sage/algebras/cluster_algebra.py | 2 +- src/sage/algebras/commutative_dga.py | 2 +- src/sage/algebras/down_up_algebra.py | 2 +- src/sage/algebras/exterior_algebra_groebner.pyx | 2 +- .../finite_dimensional_algebra_ideal.py | 1 + src/sage/algebras/finite_gca.py | 2 +- src/sage/algebras/free_algebra.py | 2 +- src/sage/algebras/free_algebra_element.py | 2 +- src/sage/algebras/free_algebra_quotient.py | 2 +- src/sage/algebras/free_algebra_quotient_element.py | 2 +- src/sage/algebras/free_zinbiel_algebra.py | 2 +- src/sage/algebras/hall_algebra.py | 2 +- src/sage/algebras/hecke_algebras/ariki_koike_algebra.py | 2 +- src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py | 2 +- src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py | 2 +- src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py | 2 +- src/sage/algebras/iwahori_hecke_algebra.py | 2 +- src/sage/algebras/jordan_algebra.py | 2 +- .../lie_conformal_algebras/abelian_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/affine_lie_conformal_algebra.py | 2 +- .../bosonic_ghosts_lie_conformal_algebra.py | 2 +- .../fermionic_ghosts_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/finitely_freely_generated_lca.py | 2 +- .../lie_conformal_algebras/free_bosons_lie_conformal_algebra.py | 2 +- .../free_fermions_lie_conformal_algebra.py | 2 +- .../freely_generated_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/graded_lie_conformal_algebra.py | 2 +- .../algebras/lie_conformal_algebras/lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/lie_conformal_algebra_element.py | 2 +- .../lie_conformal_algebras/lie_conformal_algebra_with_basis.py | 2 +- .../lie_conformal_algebra_with_structure_coefs.py | 2 +- .../algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py | 2 +- .../neveu_schwarz_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/virasoro_lie_conformal_algebra.py | 2 +- .../lie_conformal_algebras/weyl_lie_conformal_algebra.py | 2 +- src/sage/algebras/nil_coxeter_algebra.py | 2 +- src/sage/algebras/orlik_terao.py | 2 +- src/sage/algebras/q_commuting_polynomials.py | 2 +- src/sage/algebras/q_system.py | 2 +- src/sage/algebras/quantum_clifford.py | 2 +- src/sage/algebras/quantum_groups/ace_quantum_onsager.py | 2 +- src/sage/algebras/quantum_groups/fock_space.py | 2 +- src/sage/algebras/quantum_groups/representations.py | 2 +- src/sage/algebras/quantum_matrix_coordinate_algebra.py | 2 +- src/sage/algebras/quaternion_algebra.py | 2 +- src/sage/algebras/quaternion_algebra_element.py | 2 +- src/sage/algebras/rational_cherednik_algebra.py | 2 +- src/sage/algebras/schur_algebra.py | 2 +- src/sage/algebras/shuffle_algebra.py | 2 +- src/sage/algebras/splitting_algebra.py | 2 +- src/sage/algebras/steenrod/steenrod_algebra.py | 2 +- src/sage/algebras/steenrod/steenrod_algebra_mult.py | 2 +- src/sage/algebras/tensor_algebra.py | 2 +- src/sage/algebras/weyl_algebra.py | 2 +- src/sage/algebras/yangian.py | 2 +- src/sage/algebras/yokonuma_hecke_algebra.py | 2 +- 62 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/sage/algebras/affine_nil_temperley_lieb.py b/src/sage/algebras/affine_nil_temperley_lieb.py index 8f88e2bb3b7..1fa213bd4bc 100644 --- a/src/sage/algebras/affine_nil_temperley_lieb.py +++ b/src/sage/algebras/affine_nil_temperley_lieb.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Affine nilTemperley Lieb Algebra of type A """ diff --git a/src/sage/algebras/askey_wilson.py b/src/sage/algebras/askey_wilson.py index 1d597987c60..4943c73b36d 100644 --- a/src/sage/algebras/askey_wilson.py +++ b/src/sage/algebras/askey_wilson.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Askey-Wilson Algebras diff --git a/src/sage/algebras/associated_graded.py b/src/sage/algebras/associated_graded.py index 9afb563923b..5dd01321114 100644 --- a/src/sage/algebras/associated_graded.py +++ b/src/sage/algebras/associated_graded.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Associated Graded Algebras To Filtered Algebras diff --git a/src/sage/algebras/cellular_basis.py b/src/sage/algebras/cellular_basis.py index 62aeaa03bdd..e6e7487cba9 100644 --- a/src/sage/algebras/cellular_basis.py +++ b/src/sage/algebras/cellular_basis.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Cellular Basis ============== diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index 7d517534792..ed24df4abfc 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Clifford Algebras diff --git a/src/sage/algebras/clifford_algebra_element.pyx b/src/sage/algebras/clifford_algebra_element.pyx index 3ebad1013fe..ce4708313b4 100644 --- a/src/sage/algebras/clifford_algebra_element.pyx +++ b/src/sage/algebras/clifford_algebra_element.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules """ Clifford algebra elements diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index 8a468dad0e1..bdd8164955c 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.graphs sage.modules +# sage.doctest: needs sage.graphs sage.modules r""" Cluster algebras diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index 39da2cd3772..f3ef35660cc 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Commutative Differential Graded Algebras diff --git a/src/sage/algebras/down_up_algebra.py b/src/sage/algebras/down_up_algebra.py index b39c86b3d4f..d5fe1c257eb 100644 --- a/src/sage/algebras/down_up_algebra.py +++ b/src/sage/algebras/down_up_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Down-Up Algebras diff --git a/src/sage/algebras/exterior_algebra_groebner.pyx b/src/sage/algebras/exterior_algebra_groebner.pyx index ee54b5e4baf..265e9323536 100644 --- a/src/sage/algebras/exterior_algebra_groebner.pyx +++ b/src/sage/algebras/exterior_algebra_groebner.pyx @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Exterior algebras Gröbner bases diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py index 54f137e1966..15f0881bb8b 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_ideal.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.rings.finite_rings (because all doctests use GF) """ Ideals of Finite Algebras """ diff --git a/src/sage/algebras/finite_gca.py b/src/sage/algebras/finite_gca.py index 9c76ddf3199..f2e7d9af301 100644 --- a/src/sage/algebras/finite_gca.py +++ b/src/sage/algebras/finite_gca.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Finite dimensional graded commutative algebras diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index ea4e2707e67..70ccb24c63f 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Free algebras diff --git a/src/sage/algebras/free_algebra_element.py b/src/sage/algebras/free_algebra_element.py index f5bf4277f16..1854414e2d0 100644 --- a/src/sage/algebras/free_algebra_element.py +++ b/src/sage/algebras/free_algebra_element.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Free algebra elements diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index e54d92ae482..21284681549 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Finite dimensional free algebra quotients diff --git a/src/sage/algebras/free_algebra_quotient_element.py b/src/sage/algebras/free_algebra_quotient_element.py index 738e5b723a3..559d4246ac0 100644 --- a/src/sage/algebras/free_algebra_quotient_element.py +++ b/src/sage/algebras/free_algebra_quotient_element.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Free algebra quotient elements diff --git a/src/sage/algebras/free_zinbiel_algebra.py b/src/sage/algebras/free_zinbiel_algebra.py index f7e2f97e50c..3f4a41ea751 100644 --- a/src/sage/algebras/free_zinbiel_algebra.py +++ b/src/sage/algebras/free_zinbiel_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Free Zinbiel Algebras diff --git a/src/sage/algebras/hall_algebra.py b/src/sage/algebras/hall_algebra.py index 1da3c8f397e..83442eabc94 100644 --- a/src/sage/algebras/hall_algebra.py +++ b/src/sage/algebras/hall_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Hall Algebras diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index 15a0566747c..df2818d5dd5 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Ariki-Koike Algebras diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py index a1c175e9151..df4b748dca4 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.groups sage.modules +# sage.doctest: needs sage.combinat sage.groups sage.modules r""" Cubic Hecke Algebras diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py index 159ab06db3a..99e359b518f 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.libs.pari (for factorization) +# sage.doctest: needs sage.libs.pari (for factorization) r""" Cubic Hecke Base Rings diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py index ceda4ec816b..49ea61b5f3a 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_matrix_rep.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Cubic Hecke matrix representations diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index abd613791d3..d0141592724 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Iwahori-Hecke Algebras diff --git a/src/sage/algebras/jordan_algebra.py b/src/sage/algebras/jordan_algebra.py index 0e3a05b4026..f783dc890c8 100644 --- a/src/sage/algebras/jordan_algebra.py +++ b/src/sage/algebras/jordan_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Jordan Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py index d1efd6e21f2..80df46c57d3 100644 --- a/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/abelian_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Abelian Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py index 5b7aea16317..f5d39cacbf2 100644 --- a/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/affine_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Affine Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py index 7367bab5c4d..0b0b61b4e25 100644 --- a/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/bosonic_ghosts_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Bosonic Ghosts Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py index 4a21da4370b..098644908e6 100644 --- a/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/fermionic_ghosts_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Fermionic Ghosts Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py index 4aaf9da36eb..8aefdd9d3a6 100644 --- a/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py +++ b/src/sage/algebras/lie_conformal_algebras/finitely_freely_generated_lca.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Finitely and Freely Generated Lie Conformal Algebras. diff --git a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py index 9008a9770ad..0787226252d 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_bosons_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Free Bosons Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py index 83f7bdc0698..1e7525ae1d3 100644 --- a/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/free_fermions_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Free Fermions Super Lie Conformal Algebra. diff --git a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py index 21fc30d393b..b26d0bb4ca0 100644 --- a/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/freely_generated_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Freely Generated Lie Conformal Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py index a2f1eb8fdf1..c335daf98f7 100644 --- a/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/graded_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Graded Lie Conformal Algebras diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py index 16758675fdd..5ca0c8f6d07 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py index ccf3ce24111..09fb63a0a4c 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_element.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Lie Conformal Algebra Element diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py index 3b3e3674897..4fef0fcf2e6 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_basis.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Lie Conformal Algebras With Basis diff --git a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py index 89f7ecc0483..3c4252ce905 100644 --- a/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py +++ b/src/sage/algebras/lie_conformal_algebras/lie_conformal_algebra_with_structure_coefs.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Lie Conformal Algebras With Structure Coefficients diff --git a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py index 3d02419cc18..baf7a896144 100644 --- a/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/n2_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules sage.rings.number_field +# sage.doctest: needs sage.combinat sage.modules sage.rings.number_field r""" N=2 Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py index 45e28ab3a3c..5542b9fc097 100644 --- a/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/neveu_schwarz_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Neveu-Schwarz Super Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py index 6c16820f412..0db2d545290 100644 --- a/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/virasoro_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Virasoro Lie Conformal Algebra diff --git a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py index 07c6007e0a4..3c319db7ca3 100644 --- a/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py +++ b/src/sage/algebras/lie_conformal_algebras/weyl_lie_conformal_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Weyl Lie Conformal Algebra diff --git a/src/sage/algebras/nil_coxeter_algebra.py b/src/sage/algebras/nil_coxeter_algebra.py index 32d9de8638e..b5dbd2d62c8 100644 --- a/src/sage/algebras/nil_coxeter_algebra.py +++ b/src/sage/algebras/nil_coxeter_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Nil-Coxeter Algebra """ diff --git a/src/sage/algebras/orlik_terao.py b/src/sage/algebras/orlik_terao.py index db493ac6b1b..81158f3e9b7 100644 --- a/src/sage/algebras/orlik_terao.py +++ b/src/sage/algebras/orlik_terao.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Orlik-Terao Algebras """ diff --git a/src/sage/algebras/q_commuting_polynomials.py b/src/sage/algebras/q_commuting_polynomials.py index 670e890ecd8..0b23a756fd5 100644 --- a/src/sage/algebras/q_commuting_polynomials.py +++ b/src/sage/algebras/q_commuting_polynomials.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" `q`-Commuting Polynomials diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index c39a97db88c..74bf87c2787 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Q-Systems diff --git a/src/sage/algebras/quantum_clifford.py b/src/sage/algebras/quantum_clifford.py index 3a414418c52..dc61084f2f8 100644 --- a/src/sage/algebras/quantum_clifford.py +++ b/src/sage/algebras/quantum_clifford.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules r""" Quantum Clifford Algebras diff --git a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py index 4d2a8386980..9d983529c73 100644 --- a/src/sage/algebras/quantum_groups/ace_quantum_onsager.py +++ b/src/sage/algebras/quantum_groups/ace_quantum_onsager.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Alternating Central Extension Quantum Onsager Algebra diff --git a/src/sage/algebras/quantum_groups/fock_space.py b/src/sage/algebras/quantum_groups/fock_space.py index 965247f858f..22665746325 100644 --- a/src/sage/algebras/quantum_groups/fock_space.py +++ b/src/sage/algebras/quantum_groups/fock_space.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Fock Space diff --git a/src/sage/algebras/quantum_groups/representations.py b/src/sage/algebras/quantum_groups/representations.py index 19a35b0aa53..cb026008d6d 100644 --- a/src/sage/algebras/quantum_groups/representations.py +++ b/src/sage/algebras/quantum_groups/representations.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Quantum Group Representations diff --git a/src/sage/algebras/quantum_matrix_coordinate_algebra.py b/src/sage/algebras/quantum_matrix_coordinate_algebra.py index 64b29c82a45..c9f7e312788 100644 --- a/src/sage/algebras/quantum_matrix_coordinate_algebra.py +++ b/src/sage/algebras/quantum_matrix_coordinate_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Quantum Matrix Coordinate Algebras diff --git a/src/sage/algebras/quaternion_algebra.py b/src/sage/algebras/quaternion_algebra.py index bb617738cdc..4e92b73de69 100644 --- a/src/sage/algebras/quaternion_algebra.py +++ b/src/sage/algebras/quaternion_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules ############################################################ # Backwards compatible unpickling diff --git a/src/sage/algebras/quaternion_algebra_element.py b/src/sage/algebras/quaternion_algebra_element.py index aa4f349f1da..dbd70e25856 100644 --- a/src/sage/algebras/quaternion_algebra_element.py +++ b/src/sage/algebras/quaternion_algebra_element.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules ####################################################################### # Backward compatible unpickle functions diff --git a/src/sage/algebras/rational_cherednik_algebra.py b/src/sage/algebras/rational_cherednik_algebra.py index d17c415f027..58b3ce5441d 100644 --- a/src/sage/algebras/rational_cherednik_algebra.py +++ b/src/sage/algebras/rational_cherednik_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules """ Rational Cherednik Algebras """ diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index 9356d18cd4b..0df04485a2a 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Schur algebras for `GL_n` diff --git a/src/sage/algebras/shuffle_algebra.py b/src/sage/algebras/shuffle_algebra.py index d137e2bc9d6..2db55513d66 100644 --- a/src/sage/algebras/shuffle_algebra.py +++ b/src/sage/algebras/shuffle_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Shuffle algebras diff --git a/src/sage/algebras/splitting_algebra.py b/src/sage/algebras/splitting_algebra.py index 8e6d35e7c1b..8913932ffac 100644 --- a/src/sage/algebras/splitting_algebra.py +++ b/src/sage/algebras/splitting_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.libs.pari sage.modules +# sage.doctest: needs sage.libs.pari sage.modules r""" Splitting Algebras diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index ba94cf6311b..ce764f0a258 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" The Steenrod algebra diff --git a/src/sage/algebras/steenrod/steenrod_algebra_mult.py b/src/sage/algebras/steenrod/steenrod_algebra_mult.py index 35c06d9f711..e2d48f616b7 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_mult.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_mult.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.rings.finite_rings +# sage.doctest: needs sage.rings.finite_rings r""" Multiplication for elements of the Steenrod algebra diff --git a/src/sage/algebras/tensor_algebra.py b/src/sage/algebras/tensor_algebra.py index 6054ef8f6c5..a14ab916336 100644 --- a/src/sage/algebras/tensor_algebra.py +++ b/src/sage/algebras/tensor_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Tensor Algebras diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index 142136d2232..14ae670b00e 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Weyl Algebras diff --git a/src/sage/algebras/yangian.py b/src/sage/algebras/yangian.py index 2b9702fa247..8e19b92ba07 100644 --- a/src/sage/algebras/yangian.py +++ b/src/sage/algebras/yangian.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.modules r""" Yangians diff --git a/src/sage/algebras/yokonuma_hecke_algebra.py b/src/sage/algebras/yokonuma_hecke_algebra.py index 8651e5d32bd..779beb95ffe 100644 --- a/src/sage/algebras/yokonuma_hecke_algebra.py +++ b/src/sage/algebras/yokonuma_hecke_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.modules +# sage.doctest: needs sage.modules """ Yokonuma-Hecke Algebras From 63aba2094249585afb47b197d3b6b43de4ff57ff Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 7 Aug 2023 22:43:56 -0700 Subject: [PATCH 15/25] src/sage/algebras: sage -fixdoctests --only-tags --- src/sage/algebras/clifford_algebra.py | 9 +- src/sage/algebras/cluster_algebra.py | 17 +- src/sage/algebras/commutative_dga.py | 102 +++++----- .../finite_dimensional_algebra_morphism.py | 20 +- src/sage/algebras/free_algebra.py | 181 ++++++++++-------- src/sage/algebras/free_algebra_quotient.py | 2 +- src/sage/algebras/free_zinbiel_algebra.py | 26 +-- .../hecke_algebras/cubic_hecke_algebra.py | 71 +++---- .../hecke_algebras/cubic_hecke_base_ring.py | 13 +- src/sage/algebras/iwahori_hecke_algebra.py | 67 ++++--- src/sage/algebras/lie_algebras/morphism.py | 18 +- src/sage/algebras/lie_algebras/quotient.py | 9 +- .../lie_algebras/structure_coefficients.py | 4 +- src/sage/algebras/lie_algebras/subalgebra.py | 26 +-- src/sage/algebras/orlik_solomon.py | 29 +-- .../algebras/quatalg/quaternion_algebra.py | 27 +-- .../quatalg/quaternion_algebra_element.pyx | 89 +++++---- .../algebras/quaternion_algebra_element.py | 9 +- .../steenrod/steenrod_algebra_bases.py | 33 ++-- src/sage/algebras/weyl_algebra.py | 17 +- 20 files changed, 406 insertions(+), 363 deletions(-) diff --git a/src/sage/algebras/clifford_algebra.py b/src/sage/algebras/clifford_algebra.py index ed24df4abfc..ad8bd314c25 100644 --- a/src/sage/algebras/clifford_algebra.py +++ b/src/sage/algebras/clifford_algebra.py @@ -1771,11 +1771,12 @@ def interior_product_on_basis(self, a, b): Check :trac:`34694`:: - sage: E = ExteriorAlgebra(SR,'e',3) # optional - sage.symbolic - sage: E.inject_variables() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: E = ExteriorAlgebra(SR,'e',3) + sage: E.inject_variables() Defining e0, e1, e2 - sage: a = (e0*e1).interior_product(e0) # optional - sage.symbolic - sage: a * e0 # optional - sage.symbolic + sage: a = (e0*e1).interior_product(e0) + sage: a * e0 -e0*e1 """ sgn = True diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index bdd8164955c..fa29367d014 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -298,15 +298,16 @@ which might not be a good idea in algebras that are too big. One workaround is to first disable F-polynomials and then recompute only the desired mutations:: - sage: A.reset_exploring_iterator(mutating_F=False) # long time - sage: v = (-1, 1, -2, 2, -1, 1, -1, 1, 1) # long time - sage: seq = A.find_g_vector(v); seq # long time random + sage: # long time + sage: A.reset_exploring_iterator(mutating_F=False) + sage: v = (-1, 1, -2, 2, -1, 1, -1, 1, 1) + sage: seq = A.find_g_vector(v); seq [1, 0, 2, 6, 5, 4, 3, 8, 1] - sage: S = A.initial_seed().mutate(seq, inplace=False) # long time - sage: v in S.g_vectors() # long time + sage: S = A.initial_seed().mutate(seq, inplace=False) + sage: v in S.g_vectors() True - sage: A.current_seed().mutate(seq) # long time - sage: A.F_polynomial((-1, 1, -2, 2, -1, 1, -1, 1, 1)) # long time + sage: A.current_seed().mutate(seq) + sage: A.F_polynomial((-1, 1, -2, 2, -1, 1, -1, 1, 1)) u0*u1^2*u2^2*u3*u4*u5*u6*u8 + ... 2*u2 + u4 + u6 + 1 @@ -2373,7 +2374,7 @@ def cluster_fan(self, depth=infinity): EXAMPLES:: sage: A = ClusterAlgebra(['A', 2]) - sage: A.cluster_fan() # optional - sage.geometry.polyhedron + sage: A.cluster_fan() # needs sage.geometry.polyhedron Rational polyhedral fan in 2-d lattice N """ seeds = self.seeds(depth=depth, mutating_F=False) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index f3ef35660cc..d1ea9b782e4 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -949,9 +949,9 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= TESTS:: - sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) # optional - sage.rings.finite_rings - sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) # optional - sage.rings.finite_rings - sage: A1 is A2 + sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) # needs sage.rings.finite_rings + sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) # needs sage.rings.finite_rings + sage: A1 is A2 # needs sage.rings.finite_rings True Testing the single generator case (:trac:`25276`):: @@ -962,8 +962,8 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= sage: A4. = GradedCommutativeAlgebra(QQ, degrees=[4]) sage: z**2 == 0 False - sage: A5. = GradedCommutativeAlgebra(GF(2)) # optional - sage.rings.finite_rings - sage: z**2 == 0 # optional - sage.rings.finite_rings + sage: A5. = GradedCommutativeAlgebra(GF(2)) # needs sage.rings.finite_rings + sage: z**2 == 0 # needs sage.rings.finite_rings False """ if names is None: @@ -1207,19 +1207,20 @@ def quotient(self, I, check=True): EXAMPLES:: - sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 2, 3, 4)) # optional - sage.rings.finite_rings - sage: I = A.ideal([x*t+z^2, x*y - t]) # optional - sage.rings.finite_rings - sage: B = A.quotient(I); B # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 2, 3, 4)) + sage: I = A.ideal([x*t+z^2, x*y - t]) + sage: B = A.quotient(I); B Graded Commutative Algebra with generators ('x', 'y', 'z', 't') in degrees (2, 2, 3, 4) with relations [x*t, x*y - t] over Finite Field of size 5 - sage: B(x*t) # optional - sage.rings.finite_rings + sage: B(x*t) 0 - sage: B(x*y) # optional - sage.rings.finite_rings + sage: B(x*y) t - sage: A.basis(7) # optional - sage.rings.finite_rings + sage: A.basis(7) [x^2*z, x*y*z, y^2*z, z*t] - sage: B.basis(7) # optional - sage.rings.finite_rings + sage: B.basis(7) [x^2*z, y^2*z, z*t] """ if check and any(not i.is_homogeneous() for i in I.gens()): @@ -1909,19 +1910,20 @@ def degree(self, total=False): EXAMPLES:: - sage: A. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: A. = GradedCommutativeAlgebra(GF(2), ....: degrees=((1,0), (0,1), (1,1))) - sage: (a**2*b).degree() # optional - sage.rings.finite_rings + sage: (a**2*b).degree() (2, 1) - sage: (a**2*b).degree(total=True) # optional - sage.rings.finite_rings + sage: (a**2*b).degree(total=True) 3 - sage: (a**2*b + c).degree() # optional - sage.rings.finite_rings + sage: (a**2*b + c).degree() Traceback (most recent call last): ... ValueError: this element is not homogeneous - sage: (a**2*b + c).degree(total=True) # optional - sage.rings.finite_rings + sage: (a**2*b + c).degree(total=True) 3 - sage: A(0).degree() # optional - sage.rings.finite_rings + sage: A(0).degree() Traceback (most recent call last): ... ValueError: the zero element does not have a well-defined degree @@ -2388,23 +2390,23 @@ def cohomology_generators(self, max_degree): In contrast, the corresponding algebra in characteristic `p` has finitely generated cohomology:: - sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) # optional - sage.rings.finite_rings - sage: B3 = A3.cdg_algebra(differential={y: a*x}) # optional - sage.rings.finite_rings - sage: B3.cohomology_generators(16) # optional - sage.rings.finite_rings + sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) # needs sage.rings.finite_rings + sage: B3 = A3.cdg_algebra(differential={y: a*x}) # needs sage.rings.finite_rings + sage: B3.cohomology_generators(16) # needs sage.rings.finite_rings {1: [a], 2: [x], 3: [a*y], 5: [a*y^2], 6: [y^3]} This method works with both singly graded and multi-graded algebras:: - sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) # optional - sage.rings.finite_rings - sage: Ds = Cs.cdg_algebra({a:c, b:d}) # optional - sage.rings.finite_rings - sage: Ds.cohomology_generators(10) # optional - sage.rings.finite_rings + sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) # needs sage.rings.finite_rings + sage: Ds = Cs.cdg_algebra({a:c, b:d}) # needs sage.rings.finite_rings + sage: Ds.cohomology_generators(10) # needs sage.rings.finite_rings {2: [a^2], 4: [b^2]} - sage: Cm. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + sage: Cm. = GradedCommutativeAlgebra(GF(2), # needs sage.rings.finite_rings ....: degrees=((1,0), (1,1), ....: (0,2), (0,3))) - sage: Dm = Cm.cdg_algebra({a:c, b:d}) # optional - sage.rings.finite_rings - sage: Dm.cohomology_generators(10) # optional - sage.rings.finite_rings + sage: Dm = Cm.cdg_algebra({a:c, b:d}) # needs sage.rings.finite_rings + sage: Dm.cohomology_generators(10) # needs sage.rings.finite_rings {2: [a^2], 4: [b^2]} TESTS: @@ -3507,9 +3509,9 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, We can construct multi-graded rings as well. We work in characteristic 2 for a change, so the algebras here are honestly commutative:: - sage: C. = GradedCommutativeAlgebra(GF(2), # optional - sage.rings.finite_rings + sage: C. = GradedCommutativeAlgebra(GF(2), # needs sage.rings.finite_rings ....: degrees=((1,0), (1,1), (0,2), (0,3))) - sage: D = C.cdg_algebra(differential={a: c, b: d}); D # optional - sage.rings.finite_rings + sage: D = C.cdg_algebra(differential={a: c, b: d}); D # needs sage.rings.finite_rings Commutative Differential Graded Algebra with generators ('a', 'b', 'c', 'd') in degrees ((1, 0), (1, 1), (0, 2), (0, 3)) over Finite Field of size 2 with differential: @@ -3522,46 +3524,46 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, Use tuples, lists, vectors, or elements of additive abelian groups to specify degrees:: - sage: D.basis(3) # basis in total degree 3 # optional - sage.rings.finite_rings + sage: D.basis(3) # basis in total degree 3 # needs sage.rings.finite_rings [a^3, a*b, a*c, d] - sage: D.basis((1,2)) # basis in degree (1,2) # optional - sage.rings.finite_rings + sage: D.basis((1,2)) # basis in degree (1,2) # needs sage.rings.finite_rings [a*c] - sage: D.basis([1,2]) # optional - sage.rings.finite_rings + sage: D.basis([1,2]) # needs sage.rings.finite_rings [a*c] - sage: D.basis(vector([1,2])) # optional - sage.rings.finite_rings + sage: D.basis(vector([1,2])) # needs sage.rings.finite_rings [a*c] sage: G = AdditiveAbelianGroup([0,0]); G Additive abelian group isomorphic to Z + Z - sage: D.basis(G(vector([1,2]))) # optional - sage.rings.finite_rings + sage: D.basis(G(vector([1,2]))) # needs sage.rings.finite_rings [a*c] At this point, ``a``, for example, is an element of ``C``. We can redefine it so that it is instead an element of ``D`` in several ways, for instance using :meth:`gens` method:: - sage: a, b, c, d = D.gens() # optional - sage.rings.finite_rings - sage: a.differential() # optional - sage.rings.finite_rings + sage: a, b, c, d = D.gens() # needs sage.rings.finite_rings + sage: a.differential() # needs sage.rings.finite_rings c Or the :meth:`inject_variables` method:: - sage: D.inject_variables() # optional - sage.rings.finite_rings + sage: D.inject_variables() # needs sage.rings.finite_rings Defining a, b, c, d - sage: (a*b).differential() # optional - sage.rings.finite_rings + sage: (a*b).differential() # needs sage.rings.finite_rings b*c + a*d - sage: (a*b*c**2).degree() # optional - sage.rings.finite_rings + sage: (a*b*c**2).degree() # needs sage.rings.finite_rings (2, 5) Degrees are returned as elements of additive abelian groups:: - sage: (a*b*c**2).degree() in G # optional - sage.rings.finite_rings + sage: (a*b*c**2).degree() in G # needs sage.rings.finite_rings True - sage: (a*b*c**2).degree(total=True) # total degree # optional - sage.rings.finite_rings + sage: (a*b*c**2).degree(total=True) # total degree # needs sage.rings.finite_rings 7 - sage: D.cohomology(4) # optional - sage.rings.finite_rings + sage: D.cohomology(4) # needs sage.rings.finite_rings Free module generated by {[a^4], [b^2]} over Finite Field of size 2 - sage: D.cohomology((2,2)) # optional - sage.rings.finite_rings + sage: D.cohomology((2,2)) # needs sage.rings.finite_rings Free module generated by {[b^2]} over Finite Field of size 2 Graded algebra with maximal degree:: @@ -4047,7 +4049,7 @@ def __init__(self, x, cdga=None): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: CohomologyClass(x - 2) # optional - sage.symbolic + sage: CohomologyClass(x - 2) # needs sage.symbolic [x - 2] """ self._x = x @@ -4058,7 +4060,7 @@ def __hash__(self): TESTS:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: hash(CohomologyClass(sin)) == hash(sin) # optional - sage.symbolic + sage: hash(CohomologyClass(sin)) == hash(sin) # needs sage.symbolic True """ return hash(self._x) @@ -4068,7 +4070,7 @@ def _repr_(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: CohomologyClass(sin) # optional - sage.symbolic + sage: CohomologyClass(sin) # needs sage.symbolic [sin] """ return '[{}]'.format(self._x) @@ -4078,9 +4080,9 @@ def _latex_(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: latex(CohomologyClass(sin)) # optional - sage.symbolic + sage: latex(CohomologyClass(sin)) # needs sage.symbolic \left[ \sin \right] - sage: latex(CohomologyClass(x^2)) # optional - sage.symbolic + sage: latex(CohomologyClass(x^2)) # needs sage.symbolic \left[ x^{2} \right] """ from sage.misc.latex import latex @@ -4093,8 +4095,8 @@ def representative(self): EXAMPLES:: sage: from sage.algebras.commutative_dga import CohomologyClass - sage: x = CohomologyClass(sin) # optional - sage.symbolic - sage: x.representative() == sin # optional - sage.symbolic + sage: x = CohomologyClass(sin) # needs sage.symbolic + sage: x.representative() == sin # needs sage.symbolic True """ return self._x diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py index 5f6512baccf..d2114511ae6 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_morphism.py @@ -86,9 +86,9 @@ def _repr_(self): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() # optional - sage.libs.pari - sage: q = A.quotient_map(I) # optional - sage.libs.pari - sage: q._repr_() # optional - sage.libs.pari + sage: I = A.maximal_ideal() # needs sage.libs.pari + sage: q = A.quotient_map(I) # needs sage.libs.pari + sage: q._repr_() # needs sage.libs.pari 'Morphism from Finite-dimensional algebra of degree 2 over Rational Field to Finite-dimensional algebra of degree 1 over Rational Field given by matrix\n[1]\n[0]' """ return "Morphism from {} to {} given by matrix\n{}".format( @@ -100,9 +100,9 @@ def __call__(self, x): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() # optional - sage.libs.pari - sage: q = A.quotient_map(I) # optional - sage.libs.pari - sage: q(0) == 0 and q(1) == 1 # optional - sage.libs.pari + sage: I = A.maximal_ideal() # needs sage.libs.pari + sage: q = A.quotient_map(I) # needs sage.libs.pari + sage: q(0) == 0 and q(1) == 1 # needs sage.libs.pari True """ x = self.domain()(x) @@ -182,10 +182,10 @@ def inverse_image(self, I): sage: A = FiniteDimensionalAlgebra(QQ, [Matrix([[1, 0], [0, 1]]), ....: Matrix([[0, 1], [0, 0]])]) - sage: I = A.maximal_ideal() # optional - sage.libs.pari - sage: q = A.quotient_map(I) # optional - sage.libs.pari - sage: B = q.codomain() # optional - sage.libs.pari - sage: q.inverse_image(B.zero_ideal()) == I # optional - sage.libs.pari + sage: I = A.maximal_ideal() # needs sage.libs.pari + sage: q = A.quotient_map(I) # needs sage.libs.pari + sage: B = q.codomain() # needs sage.libs.pari + sage: q.inverse_image(B.zero_ideal()) == I # needs sage.libs.pari True """ coker_I = I.basis_matrix().transpose().kernel().basis_matrix().transpose() diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index 70ccb24c63f..d1a536a7043 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -35,10 +35,11 @@ Moreover, we can compute Groebner bases with degree bound for its two-sided ideals, and thus provide ideal containment tests:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace'); F # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: F. = FreeAlgebra(QQ, implementation='letterplace'); F Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field - sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F # optional - sage.libs.singular - sage: I.groebner_basis(degbound=4) # optional - sage.libs.singular + sage: I = F*[x*y+y*z,x^2+x*y-y*x-y^2]*F + sage: I.groebner_basis(degbound=4) Twosided Ideal (x*y + y*z, x*x - y*x - y*y - y*z, y*y*y - y*y*z + y*z*y - y*z*z, @@ -48,67 +49,72 @@ y*y*z*x + y*y*z*z + y*z*z*x + y*z*z*z, y*z*y*x + y*z*y*z + y*z*z*x + y*z*z*z) of Free Associative Unital Algebra on 3 generators (x, y, z) over Rational Field - sage: y*z*y*y*z*z + 2*y*z*y*z*z*x + y*z*y*z*z*z - y*z*z*y*z*x + y*z*z*z*z*x in I # optional - sage.libs.singular + sage: y*z*y*y*z*z + 2*y*z*y*z*z*x + y*z*y*z*z*z - y*z*z*y*z*x + y*z*z*z*z*x in I True Positive integral degree weights for the letterplace implementation was introduced in :trac:`7797`:: - sage: F. = FreeAlgebra(QQ, implementation='letterplace', degrees=[2,1,3]) # optional - sage.libs.singular - sage: x.degree() # optional - sage.libs.singular + sage: # needs sage.libs.singular + sage: F. = FreeAlgebra(QQ, implementation='letterplace', degrees=[2,1,3]) + sage: x.degree() 2 - sage: y.degree() # optional - sage.libs.singular + sage: y.degree() 1 - sage: z.degree() # optional - sage.libs.singular + sage: z.degree() 3 - sage: I = F*[x*y-y*x, x^2+2*y*z, (x*y)^2-z^2]*F # optional - sage.libs.singular - sage: Q. = F.quo(I) # optional - sage.libs.singular - sage: TestSuite(Q).run() # optional - sage.libs.singular - sage: a^2*b^2 # optional - sage.libs.singular + sage: I = F*[x*y-y*x, x^2+2*y*z, (x*y)^2-z^2]*F + sage: Q. = F.quo(I) + sage: TestSuite(Q).run() + sage: a^2*b^2 c*c TESTS:: - sage: F = FreeAlgebra(GF(5),3,'x') # optional - sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3,'x') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') # needs sage.libs.singular + sage: TestSuite(F).run() # needs sage.libs.singular + sage: F is loads(dumps(F)) # needs sage.libs.singular True :: - sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True - sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') # needs sage.libs.singular + sage: TestSuite(F).run() # needs sage.libs.singular + sage: F is loads(dumps(F)) # needs sage.libs.singular True :: - sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y']) # optional - sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y']) + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') # needs sage.libs.singular + sage: TestSuite(F).run() # needs sage.libs.singular + sage: F is loads(dumps(F)) # needs sage.libs.singular True :: - sage: F = FreeAlgebra(GF(5),3, 'abc') # optional - sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3, 'abc') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: TestSuite(F).run() # optional - sage.libs.singular sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.libs.singular sage.rings.finite_rings + sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') # needs sage.libs.singular + sage: TestSuite(F).run() # needs sage.libs.singular + sage: F is loads(dumps(F)) # needs sage.libs.singular True :: @@ -121,7 +127,7 @@ Note that the letterplace implementation can only be used if the corresponding (multivariate) polynomial ring has an implementation in Singular:: - sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') # needs sage.libs.singular sage.rings.finite_rings Traceback (most recent call last): ... NotImplementedError: polynomials over Free Algebra on 2 generators (a, b) over Integer Ring are not supported in Singular @@ -168,18 +174,18 @@ class FreeAlgebraFactory(UniqueFactory): EXAMPLES:: - sage: FreeAlgebra(GF(5),3,'x') # optional - sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3,'x') # needs sage.rings.finite_rings Free Algebra on 3 generators (x0, x1, x2) over Finite Field of size 5 - sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings - sage: (x+y+z)^2 # optional - sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) # needs sage.rings.finite_rings + sage: (x+y+z)^2 # needs sage.rings.finite_rings x^2 + x*y + x*z + y*x + y^2 + y*z + z*x + z*y + z^2 - sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') # optional - sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') # needs sage.rings.finite_rings Free Algebra on 3 generators (xx, zba, Y) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),3, 'abc') # optional - sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3, 'abc') # needs sage.rings.finite_rings Free Algebra on 3 generators (a, b, c) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, 'z') # optional - sage.rings.finite_rings + sage: FreeAlgebra(GF(5),1, 'z') # needs sage.rings.finite_rings Free Algebra on 1 generators (z,) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, ['alpha']) # optional - sage.rings.finite_rings + sage: FreeAlgebra(GF(5),1, ['alpha']) # needs sage.rings.finite_rings Free Algebra on 1 generators (alpha,) over Finite Field of size 5 sage: FreeAlgebra(FreeAlgebra(ZZ,1,'a'), 2, 'x') Free Algebra on 2 generators (x0, x1) over @@ -191,14 +197,14 @@ class FreeAlgebraFactory(UniqueFactory): sage: G = FreeAlgebra(ZZ,3,'x,y,z') sage: F is G True - sage: F. = FreeAlgebra(GF(5),3) # indirect doctest # optional - sage.rings.finite_rings - sage: F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) # indirect doctest # needs sage.rings.finite_rings + sage: F is loads(dumps(F)) # needs sage.rings.finite_rings True - sage: F is FreeAlgebra(GF(5),['x','y','z']) # optional - sage.rings.finite_rings + sage: F is FreeAlgebra(GF(5),['x','y','z']) # needs sage.rings.finite_rings True - sage: copy(F) is F is loads(dumps(F)) # optional - sage.rings.finite_rings + sage: copy(F) is F is loads(dumps(F)) # needs sage.rings.finite_rings True - sage: TestSuite(F).run() # optional - sage.rings.finite_rings + sage: TestSuite(F).run() # needs sage.rings.finite_rings By :trac:`7797`, we provide a different implementation of free algebras, based on Singular's "letterplace rings". Our letterplace @@ -207,27 +213,29 @@ class FreeAlgebraFactory(UniqueFactory): elements are supported. Of course, isomorphic algebras in different implementations are not identical:: - sage: G = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: F == G # optional - sage.libs.singular sage.rings.finite_rings + sage: # needs sage.libs.singular sage.rings.finite_rings + sage: G = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') + sage: F == G False - sage: G is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings + sage: G is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') True - sage: copy(G) is G is loads(dumps(G)) # optional - sage.libs.singular sage.rings.finite_rings + sage: copy(G) is G is loads(dumps(G)) True - sage: TestSuite(G).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(G).run() :: - sage: H = FreeAlgebra(GF(5), ['x','y','z'], implementation='letterplace', # optional - sage.libs.singular sage.rings.finite_rings + sage: # needs sage.libs.singular sage.rings.finite_rings + sage: H = FreeAlgebra(GF(5), ['x','y','z'], implementation='letterplace', ....: degrees=[1,2,3]) - sage: F != H != G # optional - sage.libs.singular sage.rings.finite_rings + sage: F != H != G True - sage: H is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace', # optional - sage.libs.singular sage.rings.finite_rings + sage: H is FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace', ....: degrees=[1,2,3]) True - sage: copy(H) is H is loads(dumps(H)) # optional - sage.libs.singular sage.rings.finite_rings + sage: copy(H) is H is loads(dumps(H)) True - sage: TestSuite(H).run() # optional - sage.libs.singular sage.rings.finite_rings + sage: TestSuite(H).run() Free algebras commute with their base ring. :: @@ -255,22 +263,23 @@ def create_key(self, base_ring, arg1=None, arg2=None, TESTS:: - sage: FreeAlgebra.create_key(GF(5),['x','y','z']) # optional - sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),['x','y','z']) (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3) # optional - sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3) (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),3,'xyz') # optional - sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),3,'xyz') (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'], # optional - sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),['x','y','z'], # needs sage.libs.singular ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, # optional - sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, # needs sage.libs.singular ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', # optional - sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),3,'xyz', # needs sage.libs.singular ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', # optional - sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra.create_key(GF(5),3,'xyz', # needs sage.libs.singular ....: implementation='letterplace', degrees=[1,2,3]) ((1, 2, 3), Multivariate Polynomial Ring in x, y, z, x_ over Finite Field of size 5) @@ -553,21 +562,23 @@ def _element_constructor_(self, x): TESTS:: - sage: F. = FreeAlgebra(GF(5),3) # optional - sage.rings.finite_rings - sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: F(x) # indirect doctest # optional - sage.libs.singular sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) + sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') # needs sage.libs.singular + sage: F(x) # indirect doctest # needs sage.libs.singular x - sage: F.1*L.2 # optional - sage.libs.singular sage.rings.finite_rings + sage: F.1*L.2 # needs sage.libs.singular y*z - sage: (F.1*L.2).parent() is F # optional - sage.libs.singular sage.rings.finite_rings + sage: (F.1*L.2).parent() is F # needs sage.libs.singular True :: - sage: K. = GF(25) # optional - sage.rings.finite_rings - sage: F. = FreeAlgebra(K,3) # optional - sage.rings.finite_rings - sage: L. = FreeAlgebra(K,3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: F.1+(z+1)*L.2 # optional - sage.libs.singular sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(25) + sage: F. = FreeAlgebra(K,3) + sage: L. = FreeAlgebra(K,3, implementation='letterplace') # needs sage.libs.singular + sage: F.1+(z+1)*L.2 # needs sage.libs.singular b + (z+1)*c Check that :trac:`15169` is fixed:: @@ -677,23 +688,23 @@ def _coerce_map_from_(self, R): sage: F.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z')) False - sage: K. = GF(25) # optional - sage.rings.finite_rings - sage: F. = FreeAlgebra(K,3) # optional - sage.rings.finite_rings - sage: F._coerce_map_from_(ZZ) # optional - sage.rings.finite_rings + sage: K. = GF(25) # needs sage.rings.finite_rings + sage: F. = FreeAlgebra(K,3) # needs sage.rings.finite_rings + sage: F._coerce_map_from_(ZZ) # needs sage.rings.finite_rings True - sage: F._coerce_map_from_(QQ) # optional - sage.rings.finite_rings + sage: F._coerce_map_from_(QQ) # needs sage.rings.finite_rings False - sage: F._coerce_map_from_(F.monoid()) # optional - sage.rings.finite_rings + sage: F._coerce_map_from_(F.monoid()) # needs sage.rings.finite_rings True - sage: F._coerce_map_from_(F.pbw_basis()) # optional - sage.rings.finite_rings + sage: F._coerce_map_from_(F.pbw_basis()) # needs sage.rings.finite_rings True sage: G = FreeAlgebra(ZZ, 3, 'a,b,c') - sage: F._coerce_map_from_(G) # optional - sage.rings.finite_rings + sage: F._coerce_map_from_(G) # needs sage.rings.finite_rings True - sage: G._coerce_map_from_(F) # optional - sage.rings.finite_rings + sage: G._coerce_map_from_(F) # needs sage.rings.finite_rings False - sage: L. = FreeAlgebra(K,3, implementation='letterplace') # optional - sage.libs.singular sage.rings.finite_rings - sage: F.1 + (z+1) * L.2 # optional - sage.libs.singular sage.rings.finite_rings + sage: L. = FreeAlgebra(K,3, implementation='letterplace') # needs sage.libs.singular sage.rings.finite_rings + sage: F.1 + (z+1) * L.2 # needs sage.libs.singular sage.rings.finite_rings b + (z+1)*c """ if self._indices.has_coerce_map_from(R): diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index 21284681549..b0f0efed0cd 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -191,7 +191,7 @@ def _coerce_map_from_(self, S): True sage: H._coerce_map_from_(QQ) True - sage: H._coerce_map_from_(GF(7)) # optional - sage.rings.finite_rings + sage: H._coerce_map_from_(GF(7)) # needs sage.rings.finite_rings False """ return S == self or self.__free_algebra.has_coerce_map_from(S) diff --git a/src/sage/algebras/free_zinbiel_algebra.py b/src/sage/algebras/free_zinbiel_algebra.py index 3f4a41ea751..cee797e37c4 100644 --- a/src/sage/algebras/free_zinbiel_algebra.py +++ b/src/sage/algebras/free_zinbiel_algebra.py @@ -540,14 +540,14 @@ def _coerce_map_from_(self, R): EXAMPLES:: - sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F # optional - sage.rings.finite_rings + sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F # needs sage.rings.finite_rings Free Zinbiel algebra on generators (Z[x], Z[y], Z[z]) over Finite Field of size 7 Elements of the free Zinbiel algebra canonically coerce in:: - sage: x, y, z = F.gens() # optional - sage.rings.finite_rings - sage: F.coerce(x+y) == x+y # optional - sage.rings.finite_rings + sage: x, y, z = F.gens() # needs sage.rings.finite_rings + sage: F.coerce(x+y) == x+y # needs sage.rings.finite_rings True The free Zinbiel algebra over `\ZZ` on `x, y, z` coerces in, since @@ -555,15 +555,15 @@ def _coerce_map_from_(self, R): sage: G = algebras.FreeZinbiel(ZZ, 'x,y,z') sage: Gx,Gy,Gz = G.gens() - sage: z = F.coerce(Gx+Gy); z # optional - sage.rings.finite_rings + sage: z = F.coerce(Gx+Gy); z # needs sage.rings.finite_rings Z[x] + Z[y] - sage: z.parent() is F # optional - sage.rings.finite_rings + sage: z.parent() is F # needs sage.rings.finite_rings True However, `\GF{7}` does not coerce to `\ZZ`, so the free Zinbiel algebra over `\GF{7}` does not coerce to the one over `\ZZ`:: - sage: G.coerce(y) # optional - sage.rings.finite_rings + sage: G.coerce(y) # needs sage.rings.finite_rings Traceback (most recent call last): ... TypeError: no canonical coercion from Free Zinbiel algebra on @@ -642,18 +642,18 @@ class ZinbielFunctor(ConstructionFunctor): sage: F = P.construction()[0]; F Zinbiel[x,y] - sage: A = GF(5)['a,b'] # optional - sage.rings.finite_rings - sage: a, b = A.gens() # optional - sage.rings.finite_rings - sage: F(A) # optional - sage.rings.finite_rings + sage: A = GF(5)['a,b'] # needs sage.rings.finite_rings + sage: a, b = A.gens() # needs sage.rings.finite_rings + sage: F(A) # needs sage.rings.finite_rings Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: f = A.hom([a+b,a-b],A) # optional - sage.rings.finite_rings - sage: F(f) # optional - sage.rings.finite_rings + sage: f = A.hom([a+b,a-b],A) # needs sage.rings.finite_rings + sage: F(f) # needs sage.rings.finite_rings Generic endomorphism of Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: F(f)(a * F(A)(x)) # optional - sage.rings.finite_rings + sage: F(f)(a * F(A)(x)) # needs sage.rings.finite_rings (a+b)*Z[x] """ rank = 9 @@ -706,7 +706,7 @@ def _apply_functor_to_morphism(self, f): TESTS:: sage: R = algebras.FreeZinbiel(ZZ, 'x').construction()[0] - sage: R(ZZ.hom(GF(3))) # indirect doctest # optional - sage.rings.finite_rings + sage: R(ZZ.hom(GF(3))) # indirect doctest # needs sage.rings.finite_rings Generic morphism: From: Free Zinbiel algebra on generators (Z[x],) over Integer Ring diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py index df4b748dca4..c0c055ccc65 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_algebra.py @@ -93,14 +93,15 @@ initializing. However, you can do calculations inside the infinite algebra as well:: - sage: CHA6 = algebras.CubicHecke(6) # optional - database_cubic_hecke - sage: CHA6.inject_variables() # optional - database_cubic_hecke + sage: # optional - database_cubic_hecke + sage: CHA6 = algebras.CubicHecke(6) + sage: CHA6.inject_variables() Defining c0, c1, c2, c3, c4 - sage: s = c0*c1*c2*c3*c4; s # optional - database_cubic_hecke + sage: s = c0*c1*c2*c3*c4; s c0*c1*c2*c3*c4 - sage: s^2 # optional - database_cubic_hecke + sage: s^2 (c0*c1*c2*c3*c4)^2 - sage: t = CHA6.an_element() * c4; t # optional - database_cubic_hecke + sage: t = CHA6.an_element() * c4; t (-w)*c0*c1^-1*c4 + v*c0*c2^-1*c4 + u*c2*c1*c4 + ((-v*w+u)/w)*c4 REFERENCES: @@ -1833,18 +1834,19 @@ def _init_basis_extension(self): EXAMPLES:: - sage: CHA5 = algebras.CubicHecke(5) # optional - database_cubic_hecke # indirect doctest - sage: fc = CHA5._filecache # optional - database_cubic_hecke - sage: be = fc.section.basis_extensions # optional - database_cubic_hecke - sage: CHA5.reset_filecache(be) # optional - database_cubic_hecke - sage: fc.read(be) # optional - database_cubic_hecke + sage: # optional - database_cubic_hecke + sage: CHA5 = algebras.CubicHecke(5) + sage: fc = CHA5._filecache + sage: be = fc.section.basis_extensions + sage: CHA5.reset_filecache(be) + sage: fc.read(be) [[4], [-4]] - sage: ele = CHA5.an_element() # optional - database_cubic_hecke - sage: CHA5.inject_variables() # optional - database_cubic_hecke + sage: ele = CHA5.an_element() + sage: CHA5.inject_variables() Defining c0, c1, c2, c3 - sage: ele2 = ele * c3 # optional - database_cubic_hecke - sage: bex = fc.read(be) # optional - database_cubic_hecke - sage: bex.sort(); bex # optional - database_cubic_hecke + sage: ele2 = ele * c3 + sage: bex = fc.read(be) + sage: bex.sort(); bex [[-4], [1, -3, 4], [1, -2, 4], [3, 2, 4], [4]] """ self._basis_extension = [] @@ -2220,14 +2222,15 @@ def _braid_image_by_basis_extension(self, braid_tietze): EXAMPLES:: - sage: CHA5 = algebras.CubicHecke(5) # optional - database_cubic_hecke - sage: be = CHA5.filecache_section().basis_extensions # optional - database_cubic_hecke - sage: CHA5.reset_filecache(be) # optional - database_cubic_hecke - sage: CHA5._basis_extension # optional - database_cubic_hecke + sage: # optional - database_cubic_hecke + sage: CHA5 = algebras.CubicHecke(5) + sage: be = CHA5.filecache_section().basis_extensions + sage: CHA5.reset_filecache(be) + sage: CHA5._basis_extension [[4], [-4]] - sage: CHA5._braid_image_by_basis_extension((4,1)) # optional - database_cubic_hecke + sage: CHA5._braid_image_by_basis_extension((4,1)) c3*c0 - sage: CHA5._basis_extension # optional - database_cubic_hecke + sage: CHA5._basis_extension [[4], [-4], [4, 1]] case where the braid already has an corresponding basis element:: @@ -2524,15 +2527,16 @@ def _cubic_braid_append_to_basis(self, cubic_braid): EXAMPLES:: - sage: CHA5 = algebras.CubicHecke(5) # optional - database_cubic_hecke - sage: be = CHA5.filecache_section().basis_extensions # optional - database_cubic_hecke - sage: CHA5.reset_filecache(be) # optional - database_cubic_hecke - sage: CHA5._basis_extension # optional - database_cubic_hecke + sage: # optional - database_cubic_hecke + sage: CHA5 = algebras.CubicHecke(5) + sage: be = CHA5.filecache_section().basis_extensions + sage: CHA5.reset_filecache(be) + sage: CHA5._basis_extension [[4], [-4]] - sage: CBG = CHA5.cubic_braid_group() # optional - database_cubic_hecke - sage: CHA5._cubic_braid_append_to_basis(CBG((4,1))) # optional - database_cubic_hecke + sage: CBG = CHA5.cubic_braid_group() + sage: CHA5._cubic_braid_append_to_basis(CBG((4,1))) c3*c0 - sage: CHA5._basis_extension # optional - database_cubic_hecke + sage: CHA5._basis_extension [[4], [-4], [4, 1]] """ @@ -2807,12 +2811,13 @@ def reset_filecache(self, section=None, commit=True): EXAMPLES:: - sage: CHA5 = algebras.CubicHecke(5) # optional - database_cubic_hecke - sage: be = CHA5.filecache_section().basis_extensions # optional - database_cubic_hecke - sage: CHA5.is_filecache_empty(be) # optional - database_cubic_hecke + sage: # optional - database_cubic_hecke + sage: CHA5 = algebras.CubicHecke(5) + sage: be = CHA5.filecache_section().basis_extensions + sage: CHA5.is_filecache_empty(be) False - sage: CHA5.reset_filecache(be) # optional - database_cubic_hecke - sage: CHA5.is_filecache_empty(be) # optional - database_cubic_hecke + sage: CHA5.reset_filecache(be) + sage: CHA5.is_filecache_empty(be) True """ fc = self._filecache diff --git a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py index 99e359b518f..90d6657d309 100644 --- a/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py +++ b/src/sage/algebras/hecke_algebras/cubic_hecke_base_ring.py @@ -298,14 +298,15 @@ def _element_constructor_(self, x, mon=None): EXAMPLES:: - sage: CHA3 = algebras.CubicHecke(3) # optional gap3 - sage: GER = CHA3.extension_ring(generic=True) # optional gap3 - sage: sch7 = CHA3.chevie().SchurElements()[7] # optional gap3 - sage: GER(sch7) # optional gap3 + sage: # optional - gap3 + sage: CHA3 = algebras.CubicHecke(3) + sage: GER = CHA3.extension_ring(generic=True) + sage: sch7 = CHA3.chevie().SchurElements()[7] + sage: GER(sch7) a*b*c^-2 + a^2*b^-1*c^-1 + a^-1*b^2*c^-1 + 2 + a*b^-2*c + a^-2*b*c + a^-1*b^-1*c^2 - sage: rep4_gap3 = CHA3.chevie().Representations(4) # optional gap3 - sage: matrix(GER, rep4_gap3[1]) # optional gap3 + sage: rep4_gap3 = CHA3.chevie().Representations(4) + sage: matrix(GER, rep4_gap3[1]) [ b 0] [-b c] """ diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index d0141592724..9608d684409 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -1955,12 +1955,13 @@ class Cp(_KLHeckeBasis): implemented with ``coxeter3`` to avoid unnecessary conversions, as in the following example with the same product computed in the last one:: - sage: R = LaurentPolynomialRing(QQ, 'v') # optional - coxeter3 - sage: v = R.gen(0) # optional - coxeter3 - sage: W = CoxeterGroup('A9', implementation='coxeter3') # optional - coxeter3 - sage: H = IwahoriHeckeAlgebra(W, v**2) # optional - coxeter3 - sage: Cp = H.Cp() # optional - coxeter3 - sage: Cp[1,2,1,8,9,8]*Cp[1,2,3,7,8,9] # optional - coxeter3 + sage: # optional - coxeter3 + sage: R = LaurentPolynomialRing(QQ, 'v') + sage: v = R.gen(0) + sage: W = CoxeterGroup('A9', implementation='coxeter3') + sage: H = IwahoriHeckeAlgebra(W, v**2) + sage: Cp = H.Cp() + sage: Cp[1,2,1,8,9,8]*Cp[1,2,3,7,8,9] (v^-2+2+v^2)*Cp[1,2,1,3,7,8,7,9,8,7] + (v^-2+2+v^2)*Cp[1,2,1,3,8,9,8,7] + (v^-3+3*v^-1+3*v+v^3)*Cp[1,2,1,3,8,9,8] @@ -1984,17 +1985,18 @@ def __init__(self, IHAlgebra, prefix=None): r""" TESTS:: - sage: R. = LaurentPolynomialRing(QQ) # optional - coxeter3 - sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3 - sage: H = IwahoriHeckeAlgebra(W, v**2) # optional - coxeter3 - sage: Cp = H.Cp() # optional - coxeter3 - sage: Cp._delta == v + ~v # optional - coxeter3 + sage: # optional - coxeter3 + sage: R. = LaurentPolynomialRing(QQ) + sage: W = CoxeterGroup('A3', implementation='coxeter3') + sage: H = IwahoriHeckeAlgebra(W, v**2) + sage: Cp = H.Cp() + sage: Cp._delta == v + ~v True - sage: Cp._W_Coxeter3 == H._W # optional - coxeter3 + sage: Cp._W_Coxeter3 == H._W True - sage: H = IwahoriHeckeAlgebra(W, QQ(1)) # optional - coxeter3 - sage: Cp = H.Cp() # optional - coxeter3 - sage: Cp._W_Coxeter3 is None # optional - coxeter3 + sage: H = IwahoriHeckeAlgebra(W, QQ(1)) + sage: Cp = H.Cp() + sage: Cp._W_Coxeter3 is None True """ super().__init__(IHAlgebra, prefix) @@ -2128,12 +2130,13 @@ def product_on_basis(self, w1, w2): EXAMPLES:: - sage: R. = LaurentPolynomialRing(ZZ, 'v') # optional - coxeter3 - sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3 - sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp() # optional - coxeter3 - sage: Cp.product_on_basis(W([1,2,1]), W([3,1])) # optional - coxeter3 + sage: # optional - coxeter3 + sage: R. = LaurentPolynomialRing(ZZ, 'v') + sage: W = CoxeterGroup('A3', implementation='coxeter3') + sage: H = IwahoriHeckeAlgebra(W, v**2); Cp=H.Cp() + sage: Cp.product_on_basis(W([1,2,1]), W([3,1])) (v^-1+v)*Cp[1,2,1,3] - sage: Cp.product_on_basis(W([1,2,1]), W([3,1,2])) # optional - coxeter3 + sage: Cp.product_on_basis(W([1,2,1]), W([3,1,2])) (v^-1+v)*Cp[1,2,1,3,2] + (v^-1+v)*Cp[1,2,1] """ if self._W_Coxeter3 is None: @@ -2195,14 +2198,15 @@ def _product_with_generator_on_basis(self, s, w, side='left'): EXAMPLES:: - sage: R. = LaurentPolynomialRing(ZZ, 'v') # optional - coxeter3 - sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3 - sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() # optional - coxeter3 - sage: Cp._product_with_generator_on_basis(1, W([2,1]), 'left') # optional - coxeter3 + sage: # optional - coxeter3 + sage: R. = LaurentPolynomialRing(ZZ, 'v') + sage: W = CoxeterGroup('A3', implementation='coxeter3') + sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() + sage: Cp._product_with_generator_on_basis(1, W([2,1]), 'left') Cp[1,2,1] + Cp[1] - sage: Cp._product_with_generator_on_basis(1, W([2,1]), 'right') # optional - coxeter3 + sage: Cp._product_with_generator_on_basis(1, W([2,1]), 'right') (v^-1+v)*Cp[2,1] - sage: Cp._product_with_generator_on_basis(2, W([1,3,2,1,3]), 'right') # optional - coxeter3 + sage: Cp._product_with_generator_on_basis(2, W([1,3,2,1,3]), 'right') Cp[1,2,1,3,2,1] + Cp[1,2,3,2] + Cp[1,3,2,1] """ # use the product formula described in the class' documentation @@ -2237,12 +2241,13 @@ def _product_with_generator(self, s, x, side='left'): EXAMPLES:: - sage: R. = LaurentPolynomialRing(ZZ, 'v') # optional - coxeter3 - sage: W = CoxeterGroup('A3', implementation='coxeter3') # optional - coxeter3 - sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() # optional - coxeter3 - sage: Cp._product_with_generator(1, Cp[1]+Cp[2], 'left') # optional - coxeter3 + sage: # optional - coxeter3 + sage: R. = LaurentPolynomialRing(ZZ, 'v') + sage: W = CoxeterGroup('A3', implementation='coxeter3') + sage: H = IwahoriHeckeAlgebra(W, v**2); Cp = H.Cp() + sage: Cp._product_with_generator(1, Cp[1]+Cp[2], 'left') Cp[1,2] + (v^-1+v)*Cp[1] - sage: Cp._product_with_generator(1, Cp[1]+Cp[2], 'right') # optional - coxeter3 + sage: Cp._product_with_generator(1, Cp[1]+Cp[2], 'right') Cp[2,1] + (v^-1+v)*Cp[1] """ return self.linear_combination((self._product_with_generator_on_basis(s, w, side), coeff) for (w, coeff) in x) diff --git a/src/sage/algebras/lie_algebras/morphism.py b/src/sage/algebras/lie_algebras/morphism.py index 2d04a5e6b65..3fa39f8ff78 100644 --- a/src/sage/algebras/lie_algebras/morphism.py +++ b/src/sage/algebras/lie_algebras/morphism.py @@ -461,8 +461,8 @@ class LieAlgebraMorphism_from_generators(LieAlgebraHomomorphism_im_gens): A quotient type Lie algebra morphism:: - sage: K. = LieAlgebra(SR, abelian=True) # optional - sage.symbolic - sage: L.morphism({X: A, Y: B}) # optional - sage.symbolic + sage: K. = LieAlgebra(SR, abelian=True) # needs sage.symbolic + sage: L.morphism({X: A, Y: B}) # needs sage.symbolic Lie algebra morphism: From: Lie algebra on 4 generators (X, Y, Z, W) over Rational Field To: Abelian Lie algebra on 2 generators (A, B) over Symbolic Ring @@ -623,17 +623,17 @@ def _call_(self, x): EXAMPLES:: sage: L. = LieAlgebra(QQ, {('X','Y'): {'Z':1}, ('X','Z'): {'W':1}}) - sage: K. = LieAlgebra(SR, abelian=True) # optional - sage.symbolic - sage: phi = L.morphism({X: A, Y: B}) # optional - sage.symbolic - sage: phi(X) # optional - sage.symbolic + sage: K. = LieAlgebra(SR, abelian=True) # needs sage.symbolic + sage: phi = L.morphism({X: A, Y: B}) # needs sage.symbolic + sage: phi(X) # needs sage.symbolic A - sage: phi(Y) # optional - sage.symbolic + sage: phi(Y) # needs sage.symbolic B - sage: phi(Z) # optional - sage.symbolic + sage: phi(Z) # needs sage.symbolic 0 - sage: phi(W) # optional - sage.symbolic + sage: phi(W) # needs sage.symbolic 0 - sage: phi(-X + 3*Y) # optional - sage.symbolic + sage: phi(-X + 3*Y) # needs sage.symbolic -A + 3*B sage: K. = LieAlgebra(QQ, {('A','B'): {'C':2}}) diff --git a/src/sage/algebras/lie_algebras/quotient.py b/src/sage/algebras/lie_algebras/quotient.py index a0400221af6..ed64e6ee279 100644 --- a/src/sage/algebras/lie_algebras/quotient.py +++ b/src/sage/algebras/lie_algebras/quotient.py @@ -242,11 +242,12 @@ def __init__(self, I, L, names, index_set, category=None): TESTS:: - sage: L. = LieAlgebra(SR, {('x','y'): {'x':1}}) # optional - sage.symbolic - sage: K = L.quotient(y) # optional - sage.symbolic - sage: K.dimension() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: L. = LieAlgebra(SR, {('x','y'): {'x':1}}) + sage: K = L.quotient(y) + sage: K.dimension() 1 - sage: TestSuite(K).run() # optional - sage.symbolic + sage: TestSuite(K).run() """ B = L.basis() sm = L.module().submodule_with_basis([I.reduce(B[i]).to_vector() diff --git a/src/sage/algebras/lie_algebras/structure_coefficients.py b/src/sage/algebras/lie_algebras/structure_coefficients.py index 48b1bbecf41..ed200875e32 100644 --- a/src/sage/algebras/lie_algebras/structure_coefficients.py +++ b/src/sage/algebras/lie_algebras/structure_coefficients.py @@ -411,8 +411,8 @@ def change_ring(self, R): sage: LQQ = L.change_ring(QQ) sage: LQQ.structure_coefficients() Finite family {('x', 'y'): z} - sage: LSR = LQQ.change_ring(SR) # optional - sage.symbolic - sage: LSR.structure_coefficients() # optional - sage.symbolic + sage: LSR = LQQ.change_ring(SR) # needs sage.symbolic + sage: LSR.structure_coefficients() # needs sage.symbolic Finite family {('x', 'y'): z} """ return LieAlgebraWithStructureCoefficients( diff --git a/src/sage/algebras/lie_algebras/subalgebra.py b/src/sage/algebras/lie_algebras/subalgebra.py index ab7b6922083..7dc6e8ef37e 100644 --- a/src/sage/algebras/lie_algebras/subalgebra.py +++ b/src/sage/algebras/lie_algebras/subalgebra.py @@ -75,32 +75,34 @@ class LieSubalgebra_finite_dimensional_with_basis(Parent, UniqueRepresentation): Elements of the ambient Lie algebra can be reduced modulo an ideal or subalgebra:: - sage: L. = LieAlgebra(SR, {('X','Y'): {'Z': 1}}) # optional - sage.symbolic - sage: I = L.ideal(Y) # optional - sage.symbolic - sage: I.reduce(X + 2*Y + 3*Z) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: L. = LieAlgebra(SR, {('X','Y'): {'Z': 1}}) + sage: I = L.ideal(Y) + sage: I.reduce(X + 2*Y + 3*Z) X - sage: S = L.subalgebra(Y) # optional - sage.symbolic - sage: S.reduce(X + 2*Y + 3*Z) # optional - sage.symbolic + sage: S = L.subalgebra(Y) + sage: S.reduce(X + 2*Y + 3*Z) X + 3*Z The reduction gives elements in a fixed complementary subspace. When the base ring is a field, the complementary subspace is spanned by those basis elements which are not leading supports of the basis:: - sage: I = L.ideal(X + Y) # optional - sage.symbolic - sage: I.basis() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: I = L.ideal(X + Y) + sage: I.basis() Family (X + Y, Z) - sage: el = var('x')*X + var('y')*Y + var('z')*Z; el # optional - sage.symbolic + sage: el = var('x')*X + var('y')*Y + var('z')*Z; el x*X + y*Y + z*Z - sage: I.reduce(el) # optional - sage.symbolic + sage: I.reduce(el) (x-y)*X Giving a different ``order`` may change the reduction of elements:: - sage: I = L.ideal(X + Y, order=lambda s: ['Z','Y','X'].index(s)) # optional - sage.symbolic - sage: I.basis() # optional - sage.symbolic + sage: I = L.ideal(X + Y, order=lambda s: ['Z','Y','X'].index(s)) # needs sage.symbolic + sage: I.basis() # needs sage.symbolic Family (Z, X + Y) - sage: I.reduce(el) # optional - sage.symbolic + sage: I.reduce(el) # needs sage.symbolic (-x+y)*Y A subalgebra of a subalgebra is a subalgebra of the original:: diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index f92a93c7e21..2cb2dcb8299 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -624,11 +624,12 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): Next, we look at the same matroid but with an `S_3 \times S_3` action (here realized as a Young subgroup of `S_6`):: - sage: H = G.young_subgroup([3, 3]) # needs sage.graphs sage.groups - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) # needs sage.graphs sage.groups - sage: OSH.basis() # needs sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: H = G.young_subgroup([3, 3]) + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=H) + sage: OSH.basis() Finite family {0: B[0], 1: B[1], 2: B[2]} - sage: [OSH.lift(b) for b in OSH.basis()] # needs sage.graphs sage.groups + sage: [OSH.lift(b) for b in OSH.basis()] [OS{}, OS{4} + OS{5} + OS{6}, OS{1} + OS{2} + OS{3}] We implement an `S_4` action on the vertices:: @@ -648,10 +649,11 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): We use this to describe the Young subgroup `S_2 \times S_2` action:: - sage: H = G.young_subgroup([2,2]) # needs sage.graphs sage.groups - sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) # needs sage.graphs sage.groups - sage: B = OSH.basis() # needs sage.graphs sage.groups - sage: [OSH.lift(b) for b in B] # needs sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: H = G.young_subgroup([2,2]) + sage: OSH = M.orlik_solomon_algebra(QQ, invariant=(H, vert_action)) + sage: B = OSH.basis() + sage: [OSH.lift(b) for b in B] [OS{}, OS{5}, OS{1} + OS{2} + OS{3} + OS{4}, OS{0}, -1/2*OS{1, 2} + OS{1, 5} - 1/2*OS{3, 4} + OS{3, 5}, OS{0, 5}, OS{0, 1} + OS{0, 2} + OS{0, 3} + OS{0, 4}, @@ -790,12 +792,13 @@ def _basis_action(self, g, f): We also check that the ordering is respected:: - sage: fset = frozenset({1,2}) # needs sage.graphs sage.groups - sage: OS1 = M.orlik_solomon_algebra(QQ) # needs sage.graphs sage.groups - sage: OS1.subset_image(fset) # needs sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: fset = frozenset({1,2}) + sage: OS1 = M.orlik_solomon_algebra(QQ) + sage: OS1.subset_image(fset) -OS{0, 1} + OS{0, 2} - sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) # needs sage.graphs sage.groups - sage: OS2.subset_image(fset) # needs sage.graphs sage.groups + sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) + sage: OS2.subset_image(fset) OS{1, 2} sage: OSG2 = M.orlik_solomon_algebra(QQ, # needs sage.graphs sage.groups diff --git a/src/sage/algebras/quatalg/quaternion_algebra.py b/src/sage/algebras/quatalg/quaternion_algebra.py index f0a31dca349..9c1562041e4 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra.py +++ b/src/sage/algebras/quatalg/quaternion_algebra.py @@ -119,10 +119,10 @@ class QuaternionAlgebraFactory(UniqueFactory): Quaternion Algebra (2, 3) with base ring Finite Field of size 5 sage: QuaternionAlgebra(2, GF(5)(3)) Quaternion Algebra (2, 3) with base ring Finite Field of size 5 - sage: QuaternionAlgebra(QQ[sqrt(2)](-1), -5) # optional - sage.symbolic + sage: QuaternionAlgebra(QQ[sqrt(2)](-1), -5) # needs sage.symbolic Quaternion Algebra (-1, -5) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? - sage: QuaternionAlgebra(sqrt(-1), sqrt(-3)) # optional - sage.symbolic + sage: QuaternionAlgebra(sqrt(-1), sqrt(-3)) # needs sage.symbolic Quaternion Algebra (I, sqrt(-3)) with base ring Symbolic Ring sage: QuaternionAlgebra(1r,1) Quaternion Algebra (1, 1) with base ring Rational Field @@ -162,7 +162,7 @@ class QuaternionAlgebraFactory(UniqueFactory): sage: QuaternionAlgebra(QQ, -7, -21) Quaternion Algebra (-7, -21) with base ring Rational Field - sage: QuaternionAlgebra(QQ[sqrt(2)], -2,-3) # optional - sage.symbolic + sage: QuaternionAlgebra(QQ[sqrt(2)], -2,-3) # needs sage.symbolic Quaternion Algebra (-2, -3) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? @@ -545,8 +545,8 @@ def random_element(self, *args, **kwds): EXAMPLES:: - sage: g = QuaternionAlgebra(QQ[sqrt(2)], -3, 7).random_element() # optional - sage.symbolic - sage: g.parent() is QuaternionAlgebra(QQ[sqrt(2)], -3, 7) # optional - sage.symbolic + sage: g = QuaternionAlgebra(QQ[sqrt(2)], -3, 7).random_element() # needs sage.symbolic + sage: g.parent() is QuaternionAlgebra(QQ[sqrt(2)], -3, 7) # needs sage.symbolic True sage: g = QuaternionAlgebra(-3, 19).random_element() sage: g.parent() is QuaternionAlgebra(-3, 19) @@ -1048,7 +1048,7 @@ def discriminant(self): sage: B.discriminant() Fractional ideal (2) - sage: QuaternionAlgebra(QQ[sqrt(2)], 3, 19).discriminant() # optional - sage.symbolic + sage: QuaternionAlgebra(QQ[sqrt(2)], 3, 19).discriminant() # needs sage.symbolic Fractional ideal (1) """ if not is_RationalField(self.base_ring()): @@ -1093,13 +1093,13 @@ def _magma_init_(self, magma): A more complicated example involving a quaternion algebra over a number field:: - sage: K. = QQ[sqrt(2)]; Q = QuaternionAlgebra(K,-1,a); Q # optional - sage.symbolic + sage: K. = QQ[sqrt(2)]; Q = QuaternionAlgebra(K,-1,a); Q # needs sage.symbolic Quaternion Algebra (-1, sqrt2) with base ring Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095? - sage: magma(Q) # optional - magma sage.symbolic + sage: magma(Q) # optional - magma, needs sage.symbolic Quaternion Algebra with base ring Number Field with defining polynomial x^2 - 2 over the Rational Field, defined by i^2 = -1, j^2 = sqrt2 - sage: Q._magma_init_(magma) # optional - magma sage.symbolic + sage: Q._magma_init_(magma) # optional - magma, needs sage.symbolic 'QuaternionAlgebra(_sage_[...],(_sage_[...]![-1, 0]),(_sage_[...]![0, 1]))' """ R = magma(self.base_ring()) @@ -2546,12 +2546,13 @@ def norm(self): sage: [I.norm() for I in C] [16, 32, 32] - sage: (a,b) = M.quaternion_algebra().invariants() # optional - magma - sage: magma.eval('A := QuaternionAlgebra' % (a,b)) # optional - magma + sage: # optional - magma + sage: (a,b) = M.quaternion_algebra().invariants() + sage: magma.eval('A := QuaternionAlgebra' % (a,b)) '' - sage: magma.eval('O := QuaternionOrder(%s)' % str(list(C[0].right_order().basis()))) # optional - magma + sage: magma.eval('O := QuaternionOrder(%s)' % str(list(C[0].right_order().basis()))) '' - sage: [ magma('rideal' % str(list(I.basis()))).Norm() for I in C] # optional - magma + sage: [ magma('rideal' % str(list(I.basis()))).Norm() for I in C] [16, 32, 32] sage: A. = QuaternionAlgebra(-1,-1) diff --git a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx index 71188038aa9..b4c5eed5b49 100644 --- a/src/sage/algebras/quatalg/quaternion_algebra_element.pyx +++ b/src/sage/algebras/quatalg/quaternion_algebra_element.pyx @@ -1658,8 +1658,8 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/5)]; Q. = QuaternionAlgebra(K,-a,a*17/3) # optional - sage.symbolic - sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # optional - sage.symbolic + sage: K. = QQ[2^(1/5)]; Q. = QuaternionAlgebra(K,-a,a*17/3) # needs sage.symbolic + sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # needs sage.symbolic a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k """ fmpz_poly_init(self.x) @@ -1688,8 +1688,8 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) # optional - sage.symbolic - sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # optional - sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) # needs sage.symbolic + sage: Q([a,-2/3,a^2-1/2,a*2]) # implicit doctest # needs sage.symbolic a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k """ self._parent = parent @@ -1732,21 +1732,22 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) # optional - sage.symbolic - sage: Q([a,-2/3,a^2-1/2,a*2]) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K,-a,a+1) + sage: Q([a,-2/3,a^2-1/2,a*2]) a + (-2/3)*i + (a^2 - 1/2)*j + 2*a*k - sage: x = Q([a,-2/3,a^2-1/2,a*2]) # optional - sage.symbolic - sage: type(x) # optional - sage.symbolic + sage: x = Q([a,-2/3,a^2-1/2,a*2]) + sage: type(x) - sage: x[0] # optional - sage.symbolic + sage: x[0] a - sage: x[1] # optional - sage.symbolic + sage: x[1] -2/3 - sage: x[2] # optional - sage.symbolic + sage: x[2] a^2 - 1/2 - sage: x[3] # optional - sage.symbolic + sage: x[3] 2*a - sage: list(x) # optional - sage.symbolic + sage: list(x) [a, -2/3, a^2 - 1/2, 2*a] """ # general number -- this code assumes that the number field is not quadratic!! @@ -1773,13 +1774,14 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic - sage: z = (i+j+k+a)^2; z # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) + sage: z = (i+j+k+a)^2; z a^2 + 4*a - 3 + 2*a*i + 2*a*j + 2*a*k - sage: f, t = z.__reduce__() # optional - sage.symbolic - sage: f(*t) # optional - sage.symbolic + sage: f, t = z.__reduce__() + sage: f(*t) a^2 + 4*a - 3 + 2*a*i + 2*a*j + 2*a*k - sage: loads(dumps(z)) == z # optional - sage.symbolic + sage: loads(dumps(z)) == z True """ return (unpickle_QuaternionAlgebraElement_number_field_v0, @@ -1791,12 +1793,13 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic - sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic - sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic - sage: type(z) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) + sage: z = a + i + (2/3)*a^3*j + (1+a)*k + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k + sage: type(z) - sage: z._add_(w) # optional - sage.symbolic + sage: z._add_(w) 2*a + (2*a + 4/3)*k Check that the fix in :trac:`17099` is correct:: @@ -1864,12 +1867,13 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic - sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic - sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic - sage: type(z) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) + sage: z = a + i + (2/3)*a^3*j + (1+a)*k + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k + sage: type(z) - sage: z._sub_(w) # optional - sage.symbolic + sage: z._sub_(w) 2*i + 8/3*j + 2/3*k """ # Implementation Note: To obtain _sub_, we simply replace every occurrence of @@ -1914,12 +1918,13 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) # optional - sage.symbolic - sage: z = a + i + (2/3)*a^3*j + (1+a)*k # optional - sage.symbolic - sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k # optional - sage.symbolic - sage: type(z) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a) + sage: z = a + i + (2/3)*a^3*j + (1+a)*k + sage: w = a - i - (2/3)*a^3*j + (1/3+a)*k + sage: type(z) - sage: z._mul_(w) # optional - sage.symbolic + sage: z._mul_(w) 5*a^2 - 7/9*a + 9 + (-8/3*a^2 - 16/9*a)*i + (-6*a - 4)*j + (2*a^2 + 4/3*a)*k """ # We use the following formula for multiplication: @@ -2063,10 +2068,11 @@ cdef class QuaternionAlgebraElement_number_field(QuaternionAlgebraElement_abstra TESTS:: - sage: F = QQ[3^(1/3)] # optional - sage.symbolic - sage: a = F.gen() # optional - sage.symbolic - sage: K. = QuaternionAlgebra(F, -10 + a, -7 - a) # optional - sage.symbolic - sage: ((1/4 + 1/2 * i + a^3/7 * j + a/28 * k)*14*i)^3 # implicit doctest # optional - sage.symbolic + sage: # needs sage.symbolic + sage: F = QQ[3^(1/3)] + sage: a = F.gen() + sage: K. = QuaternionAlgebra(F, -10 + a, -7 - a) + sage: ((1/4 + 1/2 * i + a^3/7 * j + a/28 * k)*14*i)^3 # implicit doctest 34503/2*a^2 + 132195/2*a + 791399/4 + (203/8*a^2 - 10591*a + 169225/4)*i + (-84695/4*a^2 + 483413/8*a + 18591/4)*j + (-87/2*a^2 + 18156*a - 72525)*k """ @@ -2141,11 +2147,12 @@ def unpickle_QuaternionAlgebraElement_number_field_v0(*args): """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j # optional - sage.symbolic - sage: f, t = z.__reduce__() # optional - sage.symbolic - sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j + sage: f, t = z.__reduce__() + sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) i + j - sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z # optional - sage.symbolic + sage: sage.algebras.quatalg.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z True """ return QuaternionAlgebraElement_number_field(*args, check=False) diff --git a/src/sage/algebras/quaternion_algebra_element.py b/src/sage/algebras/quaternion_algebra_element.py index dbd70e25856..ed0baaf0152 100644 --- a/src/sage/algebras/quaternion_algebra_element.py +++ b/src/sage/algebras/quaternion_algebra_element.py @@ -39,12 +39,13 @@ def unpickle_QuaternionAlgebraElement_number_field_v0(*args): """ EXAMPLES:: - sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j # optional - sage.symbolic - sage: f, t = z.__reduce__() # optional - sage.symbolic + sage: # needs sage.symbolic + sage: K. = QQ[2^(1/3)]; Q. = QuaternionAlgebra(K, -3, a); z = i + j + sage: f, t = z.__reduce__() sage: import sage.algebras.quaternion_algebra_element - sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) # optional - sage.symbolic + sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) i + j - sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z # optional - sage.symbolic + sage: sage.algebras.quaternion_algebra_element.unpickle_QuaternionAlgebraElement_number_field_v0(*t) == z True """ return QuaternionAlgebraElement_number_field(*args) diff --git a/src/sage/algebras/steenrod/steenrod_algebra_bases.py b/src/sage/algebras/steenrod/steenrod_algebra_bases.py index 367c854249e..d2a8760581e 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_bases.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_bases.py @@ -132,12 +132,12 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): EXAMPLES:: sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_to_milnor_matrix - sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest # needs sage.modules sage.rings.finite_rings [0 1] [1 1] - sage: convert_to_milnor_matrix(45, 'milnor') # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(45, 'milnor') # needs sage.modules sage.rings.finite_rings 111 x 111 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: convert_to_milnor_matrix(12,'wall') # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(12,'wall') # needs sage.modules sage.rings.finite_rings [1 0 0 1 0 0 0] [1 1 0 0 0 1 0] [0 1 0 1 0 0 0] @@ -149,15 +149,15 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_to_milnor_matrix(17,'adem',3) # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(17,'adem',3) # needs sage.modules sage.rings.finite_rings [0 0 1 1] [0 0 0 1] [1 1 1 1] [0 1 0 1] - sage: convert_to_milnor_matrix(48,'adem',5) # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(48,'adem',5) # needs sage.modules sage.rings.finite_rings [0 1] [1 1] - sage: convert_to_milnor_matrix(36,'adem',3) # optional - sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(36,'adem',3) # needs sage.modules sage.rings.finite_rings [0 0 1] [0 1 0] [1 2 0] @@ -206,7 +206,7 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): EXAMPLES:: sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_from_milnor_matrix, convert_to_milnor_matrix - sage: convert_from_milnor_matrix(12,'wall') # optional - sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(12,'wall') # needs sage.modules sage.rings.finite_rings [1 0 0 1 0 0 0] [0 0 1 1 0 0 0] [0 0 0 1 0 1 1] @@ -214,11 +214,11 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): [1 0 1 0 1 0 0] [1 1 1 0 0 0 0] [1 0 1 0 1 0 1] - sage: convert_from_milnor_matrix(38,'serre_cartan') # optional - sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(38,'serre_cartan') # needs sage.modules sage.rings.finite_rings 72 x 72 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: x = convert_to_milnor_matrix(20,'wood_y') # optional - sage.modules sage.rings.finite_rings - sage: y = convert_from_milnor_matrix(20,'wood_y') # optional - sage.modules sage.rings.finite_rings - sage: x*y + sage: x = convert_to_milnor_matrix(20,'wood_y') # needs sage.modules sage.rings.finite_rings + sage: y = convert_from_milnor_matrix(20,'wood_y') # needs sage.modules sage.rings.finite_rings + sage: x*y # needs sage.modules sage.rings.finite_rings [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] @@ -240,7 +240,7 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_from_milnor_matrix(17,'adem',3) # optional - sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(17,'adem',3) # needs sage.modules sage.rings.finite_rings [2 1 1 2] [0 2 0 1] [1 2 0 0] @@ -1108,11 +1108,12 @@ def steenrod_basis_error_check(dim, p, **kwds): EXAMPLES:: + sage: # long time sage: from sage.algebras.steenrod.steenrod_algebra_bases import steenrod_basis_error_check - sage: steenrod_basis_error_check(15,2) # long time - sage: steenrod_basis_error_check(15,2,generic=True) # long time - sage: steenrod_basis_error_check(40,3) # long time - sage: steenrod_basis_error_check(80,5) # long time + sage: steenrod_basis_error_check(15,2) + sage: steenrod_basis_error_check(15,2,generic=True) + sage: steenrod_basis_error_check(40,3) + sage: steenrod_basis_error_check(80,5) """ from sage.misc.verbose import verbose generic = kwds.get('generic', p != 2) diff --git a/src/sage/algebras/weyl_algebra.py b/src/sage/algebras/weyl_algebra.py index 14ae670b00e..b033a24065c 100644 --- a/src/sage/algebras/weyl_algebra.py +++ b/src/sage/algebras/weyl_algebra.py @@ -54,12 +54,12 @@ def repr_from_monomials(monomials, term_repr, use_latex=False): sage: from sage.algebras.weyl_algebra import repr_from_monomials sage: R. = QQ[] - sage: d = [(z, 4/7), (y, sqrt(2)), (x, -5)] # optional - sage.symbolic - sage: repr_from_monomials(d, lambda m: repr(m)) # optional - sage.symbolic + sage: d = [(z, 4/7), (y, sqrt(2)), (x, -5)] # needs sage.symbolic + sage: repr_from_monomials(d, lambda m: repr(m)) # needs sage.symbolic '4/7*z + sqrt(2)*y - 5*x' - sage: a = repr_from_monomials(d, lambda m: latex(m), True); a # optional - sage.symbolic + sage: a = repr_from_monomials(d, lambda m: latex(m), True); a # needs sage.symbolic \frac{4}{7} z + \sqrt{2} y - 5 x - sage: type(a) # optional - sage.symbolic + sage: type(a) # needs sage.symbolic The zero element:: @@ -91,12 +91,13 @@ def repr_from_monomials(monomials, term_repr, use_latex=False): Leading minus signs are dealt with appropriately:: - sage: d = [(z, -4/7), (y, -sqrt(2)), (x, -5)] # optional - sage.symbolic - sage: repr_from_monomials(d, lambda m: repr(m)) # optional - sage.symbolic + sage: # needs sage.symbolic + sage: d = [(z, -4/7), (y, -sqrt(2)), (x, -5)] + sage: repr_from_monomials(d, lambda m: repr(m)) '-4/7*z - sqrt(2)*y - 5*x' - sage: a = repr_from_monomials(d, lambda m: latex(m), True); a # optional - sage.symbolic + sage: a = repr_from_monomials(d, lambda m: latex(m), True); a -\frac{4}{7} z - \sqrt{2} y - 5 x - sage: type(a) # optional - sage.symbolic + sage: type(a) Indirect doctests using a class that uses this function:: From 28588b78a4bb66f4786a59235443a853c4e53e79 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 12 Aug 2023 21:49:25 -0700 Subject: [PATCH 16/25] Add # needs --- src/sage/algebras/clifford_algebra_element.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/algebras/clifford_algebra_element.pyx b/src/sage/algebras/clifford_algebra_element.pyx index ce4708313b4..2e6ad0a8547 100644 --- a/src/sage/algebras/clifford_algebra_element.pyx +++ b/src/sage/algebras/clifford_algebra_element.pyx @@ -945,7 +945,7 @@ cdef class CohomologyRAAGElement(CliffordAlgebraElement): EXAMPLES:: - sage: # needs sage.graphs + sage: # needs sage.graphs sage.groups sage: C4 = graphs.CycleGraph(4) sage: A = groups.misc.RightAngledArtin(C4) sage: H = A.cohomology() From 78dfa45507859af40a7e5a64acf80ec1603c9d6d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Sep 2023 14:28:28 -0700 Subject: [PATCH 17/25] src/sage/algebras/schur_algebra.py: Update # needs --- src/sage/algebras/schur_algebra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/algebras/schur_algebra.py b/src/sage/algebras/schur_algebra.py index 0df04485a2a..4fca609ecf7 100644 --- a/src/sage/algebras/schur_algebra.py +++ b/src/sage/algebras/schur_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.groups sage.modules r""" Schur algebras for `GL_n` From b528606d24464e1891b7dbd758df3df11402b15e Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Sep 2023 17:23:19 -0700 Subject: [PATCH 18/25] src/sage/algebras: Add file-level tags; src/sage/rings/finite_rings: Add tags --- src/sage/algebras/iwahori_hecke_algebra.py | 2 +- src/sage/algebras/q_commuting_polynomials.py | 2 +- src/sage/algebras/q_system.py | 2 +- src/sage/algebras/quantum_groups/representations.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 9608d684409..5ff849c8786 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Iwahori-Hecke Algebras diff --git a/src/sage/algebras/q_commuting_polynomials.py b/src/sage/algebras/q_commuting_polynomials.py index 0b23a756fd5..10f5f55a987 100644 --- a/src/sage/algebras/q_commuting_polynomials.py +++ b/src/sage/algebras/q_commuting_polynomials.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.modules +# sage.doctest: needs sage.combinat sage.groups sage.modules r""" `q`-Commuting Polynomials diff --git a/src/sage/algebras/q_system.py b/src/sage/algebras/q_system.py index 74bf87c2787..d35c51a32a5 100644 --- a/src/sage/algebras/q_system.py +++ b/src/sage/algebras/q_system.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Q-Systems diff --git a/src/sage/algebras/quantum_groups/representations.py b/src/sage/algebras/quantum_groups/representations.py index cb026008d6d..cea110137db 100644 --- a/src/sage/algebras/quantum_groups/representations.py +++ b/src/sage/algebras/quantum_groups/representations.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.combinat sage.modules +# sage.doctest: needs sage.combinat sage.graphs sage.modules r""" Quantum Group Representations From 26fc8187d436bdb5e68d47ecc2e6fa76fb178b78 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Sep 2023 17:49:04 -0700 Subject: [PATCH 19/25] src/sage/algebras/steenrod/steenrod_algebra_bases.py: Update # needs, doctest cosmetics --- .../steenrod/steenrod_algebra_bases.py | 233 +++++++++--------- 1 file changed, 119 insertions(+), 114 deletions(-) diff --git a/src/sage/algebras/steenrod/steenrod_algebra_bases.py b/src/sage/algebras/steenrod/steenrod_algebra_bases.py index d2a8760581e..9c8cc0935c8 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra_bases.py +++ b/src/sage/algebras/steenrod/steenrod_algebra_bases.py @@ -20,29 +20,29 @@ Monks [Mon1998]_ and Wood [Woo1998]_ for more information about them. For commutator bases, see the preprint by Palmieri and Zhang [PZ2008]_. -- 'milnor': Milnor basis. +- ``'milnor'``: Milnor basis. -- 'serre-cartan' or 'adem' or 'admissible': Serre-Cartan basis. +- ``'serre-cartan'`` or ``'adem'`` or ``'admissible'``: Serre-Cartan basis. Most of the rest of the bases are only defined when `p=2`. The only exceptions are the `P^s_t`-bases and the commutator bases, which are defined at all primes. -- 'wood_y': Wood's Y basis. +- ``'wood_y'``: Wood's Y basis. -- 'wood_z': Wood's Z basis. +- ``'wood_z'``: Wood's Z basis. -- 'wall', 'wall_long': Wall's basis. +- ``'wall'``, ``'wall_long'``: Wall's basis. -- 'arnon_a', 'arnon_a_long': Arnon's A basis. +- ``'arnon_a'``, ``'arnon_a_long'``: Arnon's A basis. -- 'arnon_c': Arnon's C basis. +- ``'arnon_c'``: Arnon's C basis. -- 'pst', 'pst_rlex', 'pst_llex', 'pst_deg', 'pst_revz': +- ``'pst'``, ``'pst_rlex'``, ``'pst_llex'``, ``'pst_deg'``, ``'pst_revz'``: various `P^s_t`-bases. -- 'comm', 'comm_rlex', 'comm_llex', 'comm_deg', 'comm_revz', - or these with '_long' appended: various commutator bases. +- ``'comm'``, ``'comm_rlex'``, ``'comm_llex'``, ``'comm_deg'``, ``'comm_revz'``, + or these with ``'_long'`` appended: various commutator bases. The main functions provided here are @@ -121,23 +121,24 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): INPUT: - - ``n`` - non-negative integer, the dimension - - ``basis`` - string, the basis from which to convert - - ``p`` - positive prime number (optional, default 2) + - ``n`` -- non-negative integer, the dimension + - ``basis`` -- string, the basis from which to convert + - ``p`` -- positive prime number (optional, default 2) OUTPUT: - ``matrix`` - change-of-basis matrix, a square matrix over ``GF(p)`` + ``matrix`` -- change-of-basis matrix, a square matrix over `\GF{p}` EXAMPLES:: + sage: # needs sage.modules sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_to_milnor_matrix - sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest # needs sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(5, 'adem') # indirect doctest [0 1] [1 1] - sage: convert_to_milnor_matrix(45, 'milnor') # needs sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(45, 'milnor') 111 x 111 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: convert_to_milnor_matrix(12,'wall') # needs sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(12, 'wall') [1 0 0 1 0 0 0] [1 1 0 0 0 1 0] [0 1 0 1 0 0 0] @@ -149,15 +150,16 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_to_milnor_matrix(17,'adem',3) # needs sage.modules sage.rings.finite_rings + sage: # needs sage.modules + sage: convert_to_milnor_matrix(17, 'adem', 3) [0 0 1 1] [0 0 0 1] [1 1 1 1] [0 1 0 1] - sage: convert_to_milnor_matrix(48,'adem',5) # needs sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(48, 'adem', 5) [0 1] [1 1] - sage: convert_to_milnor_matrix(36,'adem',3) # needs sage.modules sage.rings.finite_rings + sage: convert_to_milnor_matrix(36, 'adem', 3) [0 0 1] [0 1 0] [1 2 0] @@ -182,20 +184,19 @@ def convert_to_milnor_matrix(n, basis, p=2, generic='auto'): def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): r""" - Change-of-basis matrix, Milnor to 'basis', in dimension - `n`. + Change-of-basis matrix, Milnor to ``basis``, in dimension `n`. INPUT: - - ``n`` - non-negative integer, the dimension + - ``n`` -- non-negative integer, the dimension - - ``basis`` - string, the basis to which to convert + - ``basis`` -- string, the basis to which to convert - - ``p`` - positive prime number (optional, default 2) + - ``p`` -- positive prime number (optional, default 2) OUTPUT: - ``matrix`` - change-of-basis matrix, a square matrix over GF(p) + ``matrix`` -- change-of-basis matrix, a square matrix over `\GF{p}` .. note:: @@ -205,8 +206,9 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): EXAMPLES:: + sage: # needs sage.modules sage: from sage.algebras.steenrod.steenrod_algebra_bases import convert_from_milnor_matrix, convert_to_milnor_matrix - sage: convert_from_milnor_matrix(12,'wall') # needs sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(12, 'wall') [1 0 0 1 0 0 0] [0 0 1 1 0 0 0] [0 0 0 1 0 1 1] @@ -214,11 +216,11 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): [1 0 1 0 1 0 0] [1 1 1 0 0 0 0] [1 0 1 0 1 0 1] - sage: convert_from_milnor_matrix(38,'serre_cartan') # needs sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(38, 'serre_cartan') 72 x 72 dense matrix over Finite Field of size 2 (use the '.str()' method to see the entries) - sage: x = convert_to_milnor_matrix(20,'wood_y') # needs sage.modules sage.rings.finite_rings - sage: y = convert_from_milnor_matrix(20,'wood_y') # needs sage.modules sage.rings.finite_rings - sage: x*y # needs sage.modules sage.rings.finite_rings + sage: x = convert_to_milnor_matrix(20, 'wood_y') + sage: y = convert_from_milnor_matrix(20, 'wood_y') + sage: x*y [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0] @@ -240,7 +242,7 @@ def convert_from_milnor_matrix(n, basis, p=2, generic='auto'): The function takes an optional argument, the prime `p` over which to work:: - sage: convert_from_milnor_matrix(17,'adem',3) # needs sage.modules sage.rings.finite_rings + sage: convert_from_milnor_matrix(17, 'adem', 3) # needs sage.modules [2 1 1 2] [0 2 0 1] [1 2 0 0] @@ -259,17 +261,17 @@ def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds): INPUT: - - ``n`` - non-negative integer - - ``basis`` - string, which basis to use (optional, default = 'milnor') - - ``p`` - positive prime number (optional, default = 2) - - ``profile`` - profile function (optional, default None). This + - ``n`` -- non-negative integer + - ``basis`` -- string, which basis to use (optional, default: ``'milnor'``) + - ``p`` -- positive prime number (optional, default: 2) + - ``profile`` -- profile function (optional, default: ``None``). This is just passed on to the functions :func:`milnor_basis` and :func:`pst_basis`. - - ``truncation_type`` - truncation type, either 0 or Infinity + - ``truncation_type`` -- truncation type, either 0 or Infinity (optional, default Infinity if no profile function is specified, 0 otherwise). This is just passed on to the function :func:`milnor_basis`. - - ``generic`` - boolean (optional, default = None) + - ``generic`` -- boolean (optional, default: ``None``) OUTPUT: @@ -280,25 +282,25 @@ def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds): documentation for :mod:`sage.algebras.steenrod.steenrod_algebra` for details on each basis: - - 'milnor': Milnor basis. - - 'serre-cartan' or 'adem' or 'admissible': Serre-Cartan basis. - - 'pst', 'pst_rlex', 'pst_llex', 'pst_deg', 'pst_revz': + - ``'milnor'``: Milnor basis. + - ``'serre-cartan'`` or ``'adem'`` or ``'admissible'``: Serre-Cartan basis. + - ``'pst'``, ``'pst_rlex'``, ``'pst_llex'``, ``'pst_deg'``, ``'pst_revz'``: various `P^s_t`-bases. - - 'comm', 'comm_rlex', 'comm_llex', 'comm_deg', 'comm_revz', or - any of these with '_long' appended: various commutator bases. + - ``'comm'``, ``'comm_rlex'``, ``'comm_llex'``, ``'comm_deg'``, ``'comm_revz'``, or + any of these with ``'_long'`` appended: various commutator bases. The rest of these bases are only defined when `p=2`. - - 'wood_y': Wood's Y basis. - - 'wood_z': Wood's Z basis. - - 'wall' or 'wall_long': Wall's basis. - - 'arnon_a' or 'arnon_a_long': Arnon's A basis. - - 'arnon_c': Arnon's C basis. + - ``'wood_y'``: Wood's Y basis. + - ``'wood_z'``: Wood's Z basis. + - ``'wall'`` or ``'wall_long'``: Wall's basis. + - ``'arnon_a'`` or ``'arnon_a_long'``: Arnon's A basis. + - ``'arnon_c'``: Arnon's C basis. EXAMPLES:: sage: from sage.algebras.steenrod.steenrod_algebra_bases import steenrod_algebra_basis - sage: steenrod_algebra_basis(7,'milnor') # indirect doctest + sage: steenrod_algebra_basis(7, 'milnor') # indirect doctest ((0, 0, 1), (1, 2), (4, 1), (7,)) sage: steenrod_algebra_basis(5) # milnor basis is the default ((2, 1), (5,)) @@ -320,15 +322,15 @@ def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds): Other bases:: - sage: steenrod_algebra_basis(7,'admissible') + sage: steenrod_algebra_basis(7, 'admissible') ((7,), (6, 1), (4, 2, 1), (5, 2)) - sage: steenrod_algebra_basis(13,'admissible',p=3) + sage: steenrod_algebra_basis(13, 'admissible', p=3) ((1, 3, 0), (0, 3, 1)) - sage: steenrod_algebra_basis(5,'wall') + sage: steenrod_algebra_basis(5, 'wall') (((2, 2), (0, 0)), ((1, 1), (1, 0))) - sage: steenrod_algebra_basis(5,'wall_long') + sage: steenrod_algebra_basis(5, 'wall_long') (((2, 2), (0, 0)), ((1, 1), (1, 0))) - sage: steenrod_algebra_basis(5,'pst-rlex') + sage: steenrod_algebra_basis(5, 'pst-rlex') (((0, 1), (2, 1)), ((1, 1), (0, 2))) """ from .steenrod_algebra_misc import get_basis_name @@ -375,14 +377,14 @@ def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds): def restricted_partitions(n, l, no_repeats=False): """ - List of 'restricted' partitions of n: partitions with parts taken - from list. + List of 'restricted' partitions of `n`: partitions with parts taken + from list `l`. INPUT: - - ``n`` - non-negative integer - - ``l`` - list of positive integers - - ``no_repeats`` - boolean (optional, default = False), if True, + - ``n`` -- non-negative integer + - ``l`` -- list of positive integers + - ``no_repeats`` -- boolean (optional, default: ``False``), if ``True``, only return partitions with no repeated parts OUTPUT: list of lists @@ -406,10 +408,10 @@ def restricted_partitions(n, l, no_repeats=False): sage: restricted_partitions(10, [6,4,2], no_repeats=True) [[6, 4]] - 'l' may have repeated elements. If 'no_repeats' is False, this - has no effect. If 'no_repeats' is True, and if the repeated - elements appear consecutively in 'l', then each element may be - used only as many times as it appears in 'l':: + ``l`` may have repeated elements. If ``no_repeats`` is ``False``, this + has no effect. If ``no_repeats`` is ``True``, and if the repeated + elements appear consecutively in ``l``, then each element may be + used only as many times as it appears in ``l``:: sage: restricted_partitions(10, [6,4,2,2], no_repeats=True) [[6, 4], [6, 2, 2]] @@ -420,7 +422,7 @@ def restricted_partitions(n, l, no_repeats=False): are likely meaningless, containing several partitions more than once, for example.) - In the following examples, 'no_repeats' is False:: + In the following examples, ``no_repeats`` is ``False``:: sage: restricted_partitions(10, [6,4,2]) [[6, 4], [6, 2, 2], [4, 4, 2], [4, 2, 2, 2], [2, 2, 2, 2, 2]] @@ -448,25 +450,25 @@ def restricted_partitions(n, l, no_repeats=False): old_i = i return results -def xi_degrees(n,p=2, reverse=True): +def xi_degrees(n, p=2, reverse=True): r""" - Decreasing list of degrees of the xi_i's, starting in degree n. + Decreasing list of degrees of the `\xi_i`'s, starting in degree `n`. INPUT: - - `n` - integer - - `p` - prime number, optional (default 2) - - ``reverse`` - bool, optional (default True) + - ``n`` -- integer + - ``p`` -- prime number, optional (default: 2) + - ``reverse`` -- bool, optional (default: ``True``) - OUTPUT: ``list`` - list of integers + OUTPUT: ``list`` -- list of integers When `p=2`: decreasing list of the degrees of the `\xi_i`'s with - degree at most n. + degree at most `n`. At odd primes: decreasing list of these degrees, each divided by `2(p-1)`. - If ``reverse`` is False, then return an increasing list rather + If ``reverse`` is ``False``, then return an increasing list rather than a decreasing one. EXAMPLES:: @@ -475,9 +477,9 @@ def xi_degrees(n,p=2, reverse=True): [15, 7, 3, 1] sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17, reverse=False) [1, 3, 7, 15] - sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17,p=3) + sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(17, p=3) [13, 4, 1] - sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(400,p=17) + sage: sage.algebras.steenrod.steenrod_algebra_bases.xi_degrees(400, p=17) [307, 18, 1] """ from sage.rings.integer import Integer @@ -505,23 +507,23 @@ def milnor_basis(n, p=2, **kwds): INPUT: - - ``n`` - non-negative integer + - ``n`` -- non-negative integer - - ``p`` - positive prime number (optional, default 2) + - ``p`` -- positive prime number (optional, default 2) - - ``profile`` - profile function (optional, default None). + - ``profile`` - profile function (optional, default ``None``). Together with ``truncation_type``, specify the profile function - to be used; None means the profile function for the entire + to be used; ``None`` means the profile function for the entire Steenrod algebra. See :mod:`sage.algebras.steenrod.steenrod_algebra` and :func:`SteenrodAlgebra ` for information on profile functions. - - ``truncation_type`` - truncation type, either 0 or Infinity + - ``truncation_type`` -- truncation type, either 0 or Infinity (optional, default Infinity if no profile function is specified, 0 otherwise) - OUTPUT: tuple of mod p Milnor basis elements in dimension n + OUTPUT: tuple of mod `p` Milnor basis elements in dimension `n` At the prime 2, the Milnor basis consists of symbols of the form `\text{Sq}(m_1, m_2, ..., m_t)`, where each @@ -669,11 +671,11 @@ def serre_cartan_basis(n, p=2, bound=1, **kwds): INPUT: - - ``n`` - non-negative integer - - ``bound`` - positive integer (optional) - - ``prime`` - positive prime number (optional, default 2) + - ``n`` -- non-negative integer + - ``bound`` -- positive integer (optional) + - ``prime`` -- positive prime number (optional, default 2) - OUTPUT: tuple of mod p Serre-Cartan basis elements in dimension n + OUTPUT: tuple of mod `p` Serre-Cartan basis elements in dimension `n` The Serre-Cartan basis consists of 'admissible monomials in the Steenrod squares'. Thus at the prime 2, it consists of monomials @@ -694,8 +696,8 @@ def serre_cartan_basis(n, p=2, bound=1, **kwds): ((1, 5, 0, 1, 1), (1, 6, 1)) If optional argument ``bound`` is present, include only those monomials - whose last term is at least ``bound`` (when p=2), or those for which - `s_k - e_k \geq bound` (when p is odd). :: + whose last term is at least ``bound`` (when `p=2`), or those for which + `s_k - e_k \geq bound` (when `p` is odd). :: sage: serre_cartan_basis(7, bound=2) ((7,), (5, 2)) @@ -753,27 +755,28 @@ def atomic_basis(n, basis, **kwds): INPUT: - - ``n`` - non-negative integer - - ``basis`` - string, the name of the basis + - ``n`` -- non-negative integer - - ``profile`` - profile function (optional, default None). + - ``basis`` -- string, the name of the basis + + - ``profile`` -- profile function (optional, default: ``None``). Together with ``truncation_type``, specify the profile function - to be used; None means the profile function for the entire + to be used; ``None`` means the profile function for the entire Steenrod algebra. See :mod:`sage.algebras.steenrod.steenrod_algebra` and :func:`SteenrodAlgebra` for information on profile functions. - - ``truncation_type`` - truncation type, either 0 or Infinity + - ``truncation_type`` -- truncation type, either 0 or Infinity (optional, default Infinity if no profile function is specified, 0 otherwise). - OUTPUT: tuple of basis elements in dimension n + OUTPUT: tuple of basis elements in dimension `n` The atomic bases include Wood's Y and Z bases, Wall's basis, Arnon's A basis, the `P^s_t`-bases, and the commutator bases. (All of these bases are constructed similarly, hence their constructions have been consolidated into a single function. Also, - see the documentation for 'steenrod_algebra_basis' for + see the documentation for :func:`steenrod_algebra_basis` for descriptions of them.) For `P^s_t`-bases, you may also specify a profile function and truncation type; profile functions are ignored for the other bases. @@ -824,12 +827,12 @@ def atomic_basis(n, basis, **kwds): """ def degree_dictionary(n, basis): """ - Dictionary of atomic degrees for basis up to degree n. + Dictionary of atomic degrees for basis up to degree `n`. - The keys for the dictionary are the atomic degrees - the numbers of - the form 2^i (2^j - 1) - which are less than or equal to n. The value + The keys for the dictionary are the atomic degrees -- the numbers of + the form `2^i (2^j - 1)` -- which are less than or equal to `n`. The value associated to such a degree depends on basis; it has the form - (s,t), where (s,t) is a pair of integers which indexes the + `(s,t)`, where `(s,t)` is a pair of integers which indexes the corresponding element. """ dict = {} @@ -931,11 +934,11 @@ def arnonC_basis(n,bound=1): INPUT: - - ``n`` - non-negative integer + - ``n`` -- non-negative integer - - ``bound`` - positive integer (optional) + - ``bound`` -- positive integer (optional) - OUTPUT: tuple of basis elements in dimension n + OUTPUT: tuple of basis elements in dimension `n` The elements of Arnon's C basis are monomials of the form `\text{Sq}^{t_1} ... \text{Sq}^{t_m}` where for each @@ -978,22 +981,24 @@ def atomic_basis_odd(n, basis, p, **kwds): INPUT: - - ``n`` - non-negative integer - - ``basis`` - string, the name of the basis - - ``p`` - positive prime number + - ``n`` -- non-negative integer + + - ``basis`` -- string, the name of the basis + + - ``p`` -- positive prime number - - ``profile`` - profile function (optional, default None). + - ``profile`` -- profile function (optional, default: ``None``). Together with ``truncation_type``, specify the profile function - to be used; None means the profile function for the entire + to be used; ``None`` means the profile function for the entire Steenrod algebra. See :mod:`sage.algebras.steenrod.steenrod_algebra` and :func:`SteenrodAlgebra` for information on profile functions. - - ``truncation_type`` - truncation type, either 0 or Infinity + - ``truncation_type`` -- truncation type, either 0 or Infinity (optional, default Infinity if no profile function is specified, 0 otherwise). - OUTPUT: tuple of basis elements in dimension n + OUTPUT: tuple of basis elements in dimension `n` The only possible difference in the implementations for `P^s_t` bases and commutator bases is that the former make sense, and @@ -1091,8 +1096,8 @@ def steenrod_basis_error_check(dim, p, **kwds): INPUT: - - ``dim`` - non-negative integer - - ``p`` - positive prime number + - ``dim`` -- non-negative integer + - ``p`` -- positive prime number OUTPUT: None @@ -1100,7 +1105,7 @@ def steenrod_basis_error_check(dim, p, **kwds): if the change-of-basis matrices are invertible. If something goes wrong, an error message is printed. - This function checks at the prime ``p`` as the dimension goes up + This function checks at the prime `p` as the dimension goes up from 0 to ``dim``. If you set the Sage verbosity level to a positive integer (using @@ -1110,10 +1115,10 @@ def steenrod_basis_error_check(dim, p, **kwds): sage: # long time sage: from sage.algebras.steenrod.steenrod_algebra_bases import steenrod_basis_error_check - sage: steenrod_basis_error_check(15,2) - sage: steenrod_basis_error_check(15,2,generic=True) - sage: steenrod_basis_error_check(40,3) - sage: steenrod_basis_error_check(80,5) + sage: steenrod_basis_error_check(15, 2) + sage: steenrod_basis_error_check(15, 2, generic=True) + sage: steenrod_basis_error_check(40, 3) + sage: steenrod_basis_error_check(80, 5) """ from sage.misc.verbose import verbose generic = kwds.get('generic', p != 2) From a20a928d7b9a12cfbfec424e2fa3cdaaa72c72ce Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 2 Sep 2023 22:42:26 -0700 Subject: [PATCH 20/25] sage.algebras: Docstring cosmetics, update # needs --- src/sage/algebras/down_up_algebra.py | 5 +- .../finite_dimensional_algebra.py | 2 +- .../finite_dimensional_algebra_element.pyx | 2 +- src/sage/algebras/finite_gca.py | 2 +- src/sage/algebras/free_algebra.py | 125 ++++++++++-------- src/sage/algebras/free_algebra_quotient.py | 2 +- src/sage/algebras/free_zinbiel_algebra.py | 26 ++-- .../hecke_algebras/ariki_koike_algebra.py | 2 + src/sage/algebras/iwahori_hecke_algebra.py | 28 ++-- src/sage/algebras/orlik_solomon.py | 66 ++++----- .../algebras/steenrod/steenrod_algebra.py | 69 +++++----- 11 files changed, 176 insertions(+), 153 deletions(-) diff --git a/src/sage/algebras/down_up_algebra.py b/src/sage/algebras/down_up_algebra.py index d5fe1c257eb..088e7ac30ad 100644 --- a/src/sage/algebras/down_up_algebra.py +++ b/src/sage/algebras/down_up_algebra.py @@ -540,12 +540,13 @@ class VermaModule(CombinatorialFreeModule): construction of the irreducible representation `V(5)` (but they are different as `\mathfrak{gl}_2` weights):: - sage: B = crystals.Tableaux(['A',1], shape=[5]) - sage: [b.weight() for b in B] + sage: B = crystals.Tableaux(['A',1], shape=[5]) # needs sage.graphs + sage: [b.weight() for b in B] # needs sage.graphs [(5, 0), (4, 1), (3, 2), (2, 3), (1, 4), (0, 5)] An example with periodic weights (see Theorem 2.13 of [BR1998]_):: + sage: # needs sage.rings.number_field sage: k. = CyclotomicField(6) sage: al = z6 + 1 sage: (al - 1)^6 == 1 diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py index 448c1916aed..a3b8742b4e0 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra.py @@ -210,7 +210,7 @@ def _coerce_map_from_(self, S): True sage: A.has_coerce_map_from(GF(3)) True - sage: A.has_coerce_map_from(GF(5)) # needs sage.rings.finite_rings + sage: A.has_coerce_map_from(GF(5)) False sage: A.has_coerce_map_from(QQ) False diff --git a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx index f953a9fab7c..d58e1ac8647 100644 --- a/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx +++ b/src/sage/algebras/finite_dimensional_algebras/finite_dimensional_algebra_element.pyx @@ -375,7 +375,7 @@ cdef class FiniteDimensionalAlgebraElement(AlgebraElement): True sage: A(2) == 3 False - sage: A(2) == GF(5)(2) # needs sage.rings.finite_rings + sage: A(2) == GF(5)(2) False sage: B = FiniteDimensionalAlgebra(QQ, [Matrix([[1,0,0], [0,1,0], [0,0,0]]), diff --git a/src/sage/algebras/finite_gca.py b/src/sage/algebras/finite_gca.py index f2e7d9af301..08ebb27616e 100644 --- a/src/sage/algebras/finite_gca.py +++ b/src/sage/algebras/finite_gca.py @@ -127,7 +127,7 @@ class FiniteGCAlgebra(CombinatorialFreeModule, Algebra): omitted, an instance of the class :class:`sage.algebras.commutative_dga.GCAlgebra` is created instead:: - sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6)) + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6)) # needs sage.libs.singular sage: type(A) diff --git a/src/sage/algebras/free_algebra.py b/src/sage/algebras/free_algebra.py index d1a536a7043..61fc6175a8c 100644 --- a/src/sage/algebras/free_algebra.py +++ b/src/sage/algebras/free_algebra.py @@ -71,50 +71,54 @@ TESTS:: - sage: # needs sage.rings.finite_rings sage: F = FreeAlgebra(GF(5),3,'x') sage: TestSuite(F).run() sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') # needs sage.libs.singular - sage: TestSuite(F).run() # needs sage.libs.singular - sage: F is loads(dumps(F)) # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: F = FreeAlgebra(GF(5),3,'x', implementation='letterplace') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True :: - sage: # needs sage.rings.finite_rings sage: F. = FreeAlgebra(GF(5),3) sage: TestSuite(F).run() sage: F is loads(dumps(F)) True - sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') # needs sage.libs.singular - sage: TestSuite(F).run() # needs sage.libs.singular - sage: F is loads(dumps(F)) # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: F. = FreeAlgebra(GF(5),3, implementation='letterplace') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True :: - sage: # needs sage.rings.finite_rings sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y']) sage: TestSuite(F).run() sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') # needs sage.libs.singular - sage: TestSuite(F).run() # needs sage.libs.singular - sage: F is loads(dumps(F)) # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: F = FreeAlgebra(GF(5),3, ['xx', 'zba', 'Y'], implementation='letterplace') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True :: - sage: # needs sage.rings.finite_rings sage: F = FreeAlgebra(GF(5),3, 'abc') sage: TestSuite(F).run() sage: F is loads(dumps(F)) True - sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') # needs sage.libs.singular - sage: TestSuite(F).run() # needs sage.libs.singular - sage: F is loads(dumps(F)) # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: F = FreeAlgebra(GF(5),3, 'abc', implementation='letterplace') + sage: TestSuite(F).run() + sage: F is loads(dumps(F)) True :: @@ -127,10 +131,11 @@ Note that the letterplace implementation can only be used if the corresponding (multivariate) polynomial ring has an implementation in Singular:: - sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') # needs sage.libs.singular sage.rings.finite_rings + sage: FreeAlgebra(FreeAlgebra(ZZ,2,'ab'), 2, 'x', implementation='letterplace') # needs sage.libs.singular Traceback (most recent call last): ... - NotImplementedError: polynomials over Free Algebra on 2 generators (a, b) over Integer Ring are not supported in Singular + NotImplementedError: polynomials over Free Algebra on 2 generators (a, b) + over Integer Ring are not supported in Singular """ #***************************************************************************** @@ -174,18 +179,18 @@ class FreeAlgebraFactory(UniqueFactory): EXAMPLES:: - sage: FreeAlgebra(GF(5),3,'x') # needs sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3,'x') Free Algebra on 3 generators (x0, x1, x2) over Finite Field of size 5 - sage: F. = FreeAlgebra(GF(5),3) # needs sage.rings.finite_rings - sage: (x+y+z)^2 # needs sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) + sage: (x+y+z)^2 x^2 + x*y + x*z + y*x + y^2 + y*z + z*x + z*y + z^2 - sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') # needs sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3, 'xx, zba, Y') Free Algebra on 3 generators (xx, zba, Y) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),3, 'abc') # needs sage.rings.finite_rings + sage: FreeAlgebra(GF(5),3, 'abc') Free Algebra on 3 generators (a, b, c) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, 'z') # needs sage.rings.finite_rings + sage: FreeAlgebra(GF(5),1, 'z') Free Algebra on 1 generators (z,) over Finite Field of size 5 - sage: FreeAlgebra(GF(5),1, ['alpha']) # needs sage.rings.finite_rings + sage: FreeAlgebra(GF(5),1, ['alpha']) Free Algebra on 1 generators (alpha,) over Finite Field of size 5 sage: FreeAlgebra(FreeAlgebra(ZZ,1,'a'), 2, 'x') Free Algebra on 2 generators (x0, x1) over @@ -197,14 +202,14 @@ class FreeAlgebraFactory(UniqueFactory): sage: G = FreeAlgebra(ZZ,3,'x,y,z') sage: F is G True - sage: F. = FreeAlgebra(GF(5),3) # indirect doctest # needs sage.rings.finite_rings - sage: F is loads(dumps(F)) # needs sage.rings.finite_rings + sage: F. = FreeAlgebra(GF(5),3) # indirect doctest + sage: F is loads(dumps(F)) True - sage: F is FreeAlgebra(GF(5),['x','y','z']) # needs sage.rings.finite_rings + sage: F is FreeAlgebra(GF(5),['x','y','z']) True - sage: copy(F) is F is loads(dumps(F)) # needs sage.rings.finite_rings + sage: copy(F) is F is loads(dumps(F)) True - sage: TestSuite(F).run() # needs sage.rings.finite_rings + sage: TestSuite(F).run() By :trac:`7797`, we provide a different implementation of free algebras, based on Singular's "letterplace rings". Our letterplace @@ -213,7 +218,7 @@ class FreeAlgebraFactory(UniqueFactory): elements are supported. Of course, isomorphic algebras in different implementations are not identical:: - sage: # needs sage.libs.singular sage.rings.finite_rings + sage: # needs sage.libs.singular sage: G = FreeAlgebra(GF(5),['x','y','z'], implementation='letterplace') sage: F == G False @@ -225,7 +230,7 @@ class FreeAlgebraFactory(UniqueFactory): :: - sage: # needs sage.libs.singular sage.rings.finite_rings + sage: # needs sage.libs.singular sage: H = FreeAlgebra(GF(5), ['x','y','z'], implementation='letterplace', ....: degrees=[1,2,3]) sage: F != H != G @@ -263,23 +268,24 @@ def create_key(self, base_ring, arg1=None, arg2=None, TESTS:: - sage: # needs sage.rings.finite_rings sage: FreeAlgebra.create_key(GF(5),['x','y','z']) (Finite Field of size 5, ('x', 'y', 'z')) sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3) (Finite Field of size 5, ('x', 'y', 'z')) sage: FreeAlgebra.create_key(GF(5),3,'xyz') (Finite Field of size 5, ('x', 'y', 'z')) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'], # needs sage.libs.singular + + sage: # needs sage.libs.singular + sage: FreeAlgebra.create_key(GF(5),['x','y','z'], ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, # needs sage.libs.singular + sage: FreeAlgebra.create_key(GF(5),['x','y','z'],3, ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', # needs sage.libs.singular + sage: FreeAlgebra.create_key(GF(5),3,'xyz', ....: implementation='letterplace') (Multivariate Polynomial Ring in x, y, z over Finite Field of size 5,) - sage: FreeAlgebra.create_key(GF(5),3,'xyz', # needs sage.libs.singular + sage: FreeAlgebra.create_key(GF(5),3,'xyz', ....: implementation='letterplace', degrees=[1,2,3]) ((1, 2, 3), Multivariate Polynomial Ring in x, y, z, x_ over Finite Field of size 5) @@ -370,7 +376,8 @@ def is_FreeAlgebra(x): True sage: is_FreeAlgebra(FreeAlgebra(ZZ,10,'x',implementation='letterplace')) True - sage: is_FreeAlgebra(FreeAlgebra(ZZ,10,'x',implementation='letterplace', degrees=list(range(1,11)))) + sage: is_FreeAlgebra(FreeAlgebra(ZZ,10,'x',implementation='letterplace', + ....: degrees=list(range(1,11)))) True """ @@ -562,23 +569,23 @@ def _element_constructor_(self, x): TESTS:: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage: F. = FreeAlgebra(GF(5),3) - sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') # needs sage.libs.singular - sage: F(x) # indirect doctest # needs sage.libs.singular + sage: L. = FreeAlgebra(ZZ,3,implementation='letterplace') + sage: F(x) # indirect doctest x - sage: F.1*L.2 # needs sage.libs.singular + sage: F.1*L.2 y*z - sage: (F.1*L.2).parent() is F # needs sage.libs.singular + sage: (F.1*L.2).parent() is F True :: - sage: # needs sage.rings.finite_rings + sage: # needs sage.libs.singular sage.rings.finite_rings sage: K. = GF(25) sage: F. = FreeAlgebra(K,3) - sage: L. = FreeAlgebra(K,3, implementation='letterplace') # needs sage.libs.singular - sage: F.1+(z+1)*L.2 # needs sage.libs.singular + sage: L. = FreeAlgebra(K,3, implementation='letterplace') + sage: F.1 + (z+1)*L.2 b + (z+1)*c Check that :trac:`15169` is fixed:: @@ -688,23 +695,24 @@ def _coerce_map_from_(self, R): sage: F.has_coerce_map_from(PolynomialRing(ZZ, 3, 'x,y,z')) False - sage: K. = GF(25) # needs sage.rings.finite_rings - sage: F. = FreeAlgebra(K,3) # needs sage.rings.finite_rings - sage: F._coerce_map_from_(ZZ) # needs sage.rings.finite_rings + sage: # needs sage.rings.finite_rings + sage: K. = GF(25) + sage: F. = FreeAlgebra(K,3) + sage: F._coerce_map_from_(ZZ) True - sage: F._coerce_map_from_(QQ) # needs sage.rings.finite_rings + sage: F._coerce_map_from_(QQ) False - sage: F._coerce_map_from_(F.monoid()) # needs sage.rings.finite_rings + sage: F._coerce_map_from_(F.monoid()) True - sage: F._coerce_map_from_(F.pbw_basis()) # needs sage.rings.finite_rings + sage: F._coerce_map_from_(F.pbw_basis()) True sage: G = FreeAlgebra(ZZ, 3, 'a,b,c') - sage: F._coerce_map_from_(G) # needs sage.rings.finite_rings + sage: F._coerce_map_from_(G) True - sage: G._coerce_map_from_(F) # needs sage.rings.finite_rings + sage: G._coerce_map_from_(F) False - sage: L. = FreeAlgebra(K,3, implementation='letterplace') # needs sage.libs.singular sage.rings.finite_rings - sage: F.1 + (z+1) * L.2 # needs sage.libs.singular sage.rings.finite_rings + sage: L. = FreeAlgebra(K,3, implementation='letterplace') # needs sage.libs.singular + sage: F.1 + (z+1) * L.2 # needs sage.libs.singular b + (z+1)*c """ if self._indices.has_coerce_map_from(R): @@ -854,6 +862,7 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True): EXAMPLES:: + sage: # needs sage.libs.singular sage: A. = FreeAlgebra(QQ,3) sage: G = A.g_algebra({y*x: -x*y}) sage: (x,y,z) = G.gens() @@ -864,12 +873,12 @@ def g_algebra(self, relations, names=None, order='degrevlex', check=True): sage: z*x x*z sage: (x,y,z) = A.gens() - sage: G = A.g_algebra({y*x: -x*y+1}) + sage: G = A.g_algebra({y*x: -x*y + 1}) sage: (x,y,z) = G.gens() sage: y*x -x*y + 1 sage: (x,y,z) = A.gens() - sage: G = A.g_algebra({y*x: -x*y+z}) + sage: G = A.g_algebra({y*x: -x*y + z}) sage: (x,y,z) = G.gens() sage: y*x -x*y + z diff --git a/src/sage/algebras/free_algebra_quotient.py b/src/sage/algebras/free_algebra_quotient.py index b0f0efed0cd..e41e9c877c5 100644 --- a/src/sage/algebras/free_algebra_quotient.py +++ b/src/sage/algebras/free_algebra_quotient.py @@ -191,7 +191,7 @@ def _coerce_map_from_(self, S): True sage: H._coerce_map_from_(QQ) True - sage: H._coerce_map_from_(GF(7)) # needs sage.rings.finite_rings + sage: H._coerce_map_from_(GF(7)) False """ return S == self or self.__free_algebra.has_coerce_map_from(S) diff --git a/src/sage/algebras/free_zinbiel_algebra.py b/src/sage/algebras/free_zinbiel_algebra.py index cee797e37c4..d421b2d7aee 100644 --- a/src/sage/algebras/free_zinbiel_algebra.py +++ b/src/sage/algebras/free_zinbiel_algebra.py @@ -540,14 +540,14 @@ def _coerce_map_from_(self, R): EXAMPLES:: - sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F # needs sage.rings.finite_rings + sage: F = algebras.FreeZinbiel(GF(7), 'x,y,z'); F Free Zinbiel algebra on generators (Z[x], Z[y], Z[z]) over Finite Field of size 7 Elements of the free Zinbiel algebra canonically coerce in:: - sage: x, y, z = F.gens() # needs sage.rings.finite_rings - sage: F.coerce(x+y) == x+y # needs sage.rings.finite_rings + sage: x, y, z = F.gens() + sage: F.coerce(x+y) == x+y True The free Zinbiel algebra over `\ZZ` on `x, y, z` coerces in, since @@ -555,15 +555,15 @@ def _coerce_map_from_(self, R): sage: G = algebras.FreeZinbiel(ZZ, 'x,y,z') sage: Gx,Gy,Gz = G.gens() - sage: z = F.coerce(Gx+Gy); z # needs sage.rings.finite_rings + sage: z = F.coerce(Gx+Gy); z Z[x] + Z[y] - sage: z.parent() is F # needs sage.rings.finite_rings + sage: z.parent() is F True However, `\GF{7}` does not coerce to `\ZZ`, so the free Zinbiel algebra over `\GF{7}` does not coerce to the one over `\ZZ`:: - sage: G.coerce(y) # needs sage.rings.finite_rings + sage: G.coerce(y) Traceback (most recent call last): ... TypeError: no canonical coercion from Free Zinbiel algebra on @@ -642,18 +642,18 @@ class ZinbielFunctor(ConstructionFunctor): sage: F = P.construction()[0]; F Zinbiel[x,y] - sage: A = GF(5)['a,b'] # needs sage.rings.finite_rings - sage: a, b = A.gens() # needs sage.rings.finite_rings - sage: F(A) # needs sage.rings.finite_rings + sage: A = GF(5)['a,b'] + sage: a, b = A.gens() + sage: F(A) Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: f = A.hom([a+b,a-b],A) # needs sage.rings.finite_rings - sage: F(f) # needs sage.rings.finite_rings + sage: f = A.hom([a+b,a-b],A) + sage: F(f) Generic endomorphism of Free Zinbiel algebra on generators (Z[x], Z[y]) over Multivariate Polynomial Ring in a, b over Finite Field of size 5 - sage: F(f)(a * F(A)(x)) # needs sage.rings.finite_rings + sage: F(f)(a * F(A)(x)) (a+b)*Z[x] """ rank = 9 @@ -706,7 +706,7 @@ def _apply_functor_to_morphism(self, f): TESTS:: sage: R = algebras.FreeZinbiel(ZZ, 'x').construction()[0] - sage: R(ZZ.hom(GF(3))) # indirect doctest # needs sage.rings.finite_rings + sage: R(ZZ.hom(GF(3))) # indirect doctest Generic morphism: From: Free Zinbiel algebra on generators (Z[x],) over Integer Ring diff --git a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py index df2818d5dd5..f34beb5a1f8 100644 --- a/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py +++ b/src/sage/algebras/hecke_algebras/ariki_koike_algebra.py @@ -234,6 +234,7 @@ class ArikiKoikeAlgebra(Parent, UniqueRepresentation): We construct an Ariki-Koike algebra with `u = (1, \zeta_3, \zeta_3^2)`, where `\zeta_3` is a primitive third root of unity:: + sage: # needs sage.rings.number_field sage: F = CyclotomicField(3) sage: zeta3 = F.gen() sage: R. = LaurentPolynomialRing(F) @@ -248,6 +249,7 @@ class ArikiKoikeAlgebra(Parent, UniqueRepresentation): Next, we additionally take `q = 1` to obtain the group algebra of `G(r, 1, n)`:: + sage: # needs sage.rings.number_field sage: F = CyclotomicField(3) sage: zeta3 = F.gen() sage: H = algebras.ArikiKoike(3, 4, q=1, u=[1, zeta3, zeta3^2], R=F) diff --git a/src/sage/algebras/iwahori_hecke_algebra.py b/src/sage/algebras/iwahori_hecke_algebra.py index 5ff849c8786..a599c28a488 100644 --- a/src/sage/algebras/iwahori_hecke_algebra.py +++ b/src/sage/algebras/iwahori_hecke_algebra.py @@ -52,15 +52,15 @@ def normalized_laurent_polynomial(R, p): the base ring. This function is a hack to recover from this. This occurs somewhat haphazardly with Laurent polynomial rings:: - sage: R.=LaurentPolynomialRing(ZZ) + sage: R. = LaurentPolynomialRing(ZZ) sage: [type(c) for c in (q**-1).coefficients()] [] It also happens in any ring when dividing by units:: - sage: type ( 3/1 ) + sage: type(3/1) - sage: type ( -1/-1 ) + sage: type(-1/-1) This function is a variation on a suggested workaround of Nils Bruin. @@ -68,19 +68,19 @@ def normalized_laurent_polynomial(R, p): EXAMPLES:: sage: from sage.algebras.iwahori_hecke_algebra import normalized_laurent_polynomial - sage: type ( normalized_laurent_polynomial(ZZ, 3/1) ) + sage: type(normalized_laurent_polynomial(ZZ, 3/1)) - sage: R.=LaurentPolynomialRing(ZZ) + sage: R. = LaurentPolynomialRing(ZZ) sage: [type(c) for c in normalized_laurent_polynomial(R, q**-1).coefficients()] [] - sage: R.=LaurentPolynomialRing(ZZ,2) - sage: p=normalized_laurent_polynomial(R, 2*u**-1*v**-1+u*v) - sage: ui=normalized_laurent_polynomial(R, u^-1) - sage: vi=normalized_laurent_polynomial(R, v^-1) - sage: p(ui,vi) + sage: R. = LaurentPolynomialRing(ZZ,2) + sage: p = normalized_laurent_polynomial(R, 2*u**-1*v**-1 + u*v) + sage: ui = normalized_laurent_polynomial(R, u^-1) + sage: vi = normalized_laurent_polynomial(R, v^-1) + sage: p(ui, vi) 2*u*v + u^-1*v^-1 - sage: q= u+v+ui - sage: q(ui,vi) + sage: q = u+v+ui + sage: q(ui, vi) u + v^-1 + u^-1 """ try: @@ -208,8 +208,8 @@ class IwahoriHeckeAlgebra(Parent, UniqueRepresentation): The Kazhdan-Lusztig bases are implemented inside `H` whenever `-q_1 q_2` has a square root:: - sage: H = IwahoriHeckeAlgebra('A3', u^2,-v^2) - sage: T=H.T(); Cp= H.Cp(); C=H.C() + sage: H = IwahoriHeckeAlgebra('A3', u^2, -v^2) + sage: T = H.T(); Cp = H.Cp(); C = H.C() sage: T(Cp[1]) (u^-1*v^-1)*T[1] + (u^-1*v) sage: T(C[1]) diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 2cb2dcb8299..7cb469f09cc 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -459,7 +459,7 @@ def as_gca(self): EXAMPLES:: - sage: # needs sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron sage.graphs sage: H = hyperplane_arrangements.braid(3) sage: O = H.orlik_solomon_algebra(QQ) sage: O.as_gca() @@ -470,7 +470,7 @@ def as_gca(self): sage: N = matroids.named_matroids.Fano() sage: O = N.orlik_solomon_algebra(QQ) - sage: O.as_gca() + sage: O.as_gca() # needs sage.libs.singular Graded Commutative Algebra with generators ('e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6') in degrees (1, 1, 1, 1, 1, 1, 1) with relations [e1*e2 - e1*e3 + e2*e3, e0*e1*e3 - e0*e1*e4 + e0*e3*e4 - e1*e3*e4, @@ -524,7 +524,7 @@ def as_cdga(self): EXAMPLES:: - sage: # needs sage.geometry.polyhedron + sage: # needs sage.geometry.polyhedron sage.graphs sage: H = hyperplane_arrangements.braid(3) sage: O = H.orlik_solomon_algebra(QQ) sage: O.as_cdga() @@ -605,20 +605,21 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): easier, we'll start the indexing at `1` so that the `S_6` action on the groundset is simply calling `g`:: - sage: M = matroids.CompleteGraphic(4); M.groundset() # needs sage.graphs + sage: # needs sage.graphs sage.groups + sage: M = matroids.CompleteGraphic(4); M.groundset() frozenset({0, 1, 2, 3, 4, 5}) - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # needs sage.graphs - sage: M = Matroid(bases=new_bases); M.groundset() # needs sage.graphs + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] + sage: M = Matroid(bases=new_bases); M.groundset() frozenset({1, 2, 3, 4, 5, 6}) - sage: G = SymmetricGroup(6) # needs sage.groups - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # needs sage.graphs sage.groups - sage: OSG.basis() # needs sage.graphs sage.groups + sage: G = SymmetricGroup(6) + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) + sage: OSG.basis() Finite family {0: B[0], 1: B[1]} - sage: [OSG.lift(b) for b in OSG.basis()] # needs sage.graphs sage.groups + sage: [OSG.lift(b) for b in OSG.basis()] [OS{}, OS{1} + OS{2} + OS{3} + OS{4} + OS{5} + OS{6}] - sage: (OSG.basis()[1])^2 # needs sage.graphs sage.groups + sage: (OSG.basis()[1])^2 0 - sage: 5 * OSG.basis()[1] # needs sage.graphs sage.groups + sage: 5 * OSG.basis()[1] 5*B[1] Next, we look at the same matroid but with an `S_3 \times S_3` action @@ -634,17 +635,18 @@ class OrlikSolomonInvariantAlgebra(FiniteDimensionalInvariantModule): We implement an `S_4` action on the vertices:: - sage: M = matroids.CompleteGraphic(4) # needs sage.graphs - sage: G = SymmetricGroup(4) # needs sage.groups - sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] # needs sage.graphs + sage: # needs sage.graphs sage.groups + sage: M = matroids.CompleteGraphic(4) + sage: G = SymmetricGroup(4) + sage: edge_map = {i: M.groundset_to_edges([i])[0][:2] ....: for i in M.groundset()} - sage: inv_map = {v: k for k, v in edge_map.items()} # needs sage.graphs + sage: inv_map = {v: k for k, v in edge_map.items()} sage: def vert_action(g, x): ....: a, b = edge_map[x] ....: return inv_map[tuple(sorted([g(a+1)-1, g(b+1)-1]))] - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) # needs sage.graphs sage.groups - sage: B = OSG.basis() # needs sage.graphs sage.groups - sage: [OSG.lift(b) for b in B] # needs sage.graphs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G, vert_action)) + sage: B = OSG.basis() + sage: [OSG.lift(b) for b in B] [OS{}, OS{0} + OS{1} + OS{2} + OS{3} + OS{4} + OS{5}] We use this to describe the Young subgroup `S_2 \times S_2` action:: @@ -684,12 +686,13 @@ def __init__(self, R, M, G, action_on_groundset=None, *args, **kwargs): EXAMPLES:: - sage: M = matroids.CompleteGraphic(4) # needs sage.graphs - sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] # needs sage.graphs - sage: M = Matroid(bases=new_bases) # needs sage.graphs - sage: G = SymmetricGroup(6) # needs sage.groups - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) # needs sage.graphs sage.groups - sage: TestSuite(OSG).run() # needs sage.graphs sage.groups + sage: # needs sage.graphs sage.groups + sage: M = matroids.CompleteGraphic(4) + sage: new_bases = [frozenset(i+1 for i in j) for j in M.bases()] + sage: M = Matroid(bases=new_bases) + sage: G = SymmetricGroup(6) + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=G) + sage: TestSuite(OSG).run() """ ordering = kwargs.pop('ordering', None) OS = OrlikSolomonAlgebra(R, M, ordering) @@ -772,17 +775,17 @@ def _basis_action(self, g, f): EXAMPLES:: - sage: # needs sage.graphs + sage: # needs sage.graphs sage.groups sage: M = matroids.CompleteGraphic(3) sage: M.groundset() frozenset({0, 1, 2}) - sage: G = SymmetricGroup(3) # needs sage.groups + sage: G = SymmetricGroup(3) sage: def on_groundset(g, x): ....: return g(x+1)-1 - sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) # needs sage.groups + sage: OSG = M.orlik_solomon_algebra(QQ, invariant=(G,on_groundset)) sage: act = lambda g: (OSG._basis_action(g,frozenset({0,1})), ....: OSG._basis_action(g,frozenset({0,2}))) - sage: [act(g) for g in G] # needs sage.groups + sage: [act(g) for g in G] [(OS{0, 1}, OS{0, 2}), (-OS{0, 2}, OS{0, 1} - OS{0, 2}), (-OS{0, 1} + OS{0, 2}, -OS{0, 1}), @@ -800,11 +803,10 @@ def _basis_action(self, g, f): sage: OS2 = M.orlik_solomon_algebra(QQ, range(2,-1,-1)) sage: OS2.subset_image(fset) OS{1, 2} - - sage: OSG2 = M.orlik_solomon_algebra(QQ, # needs sage.graphs sage.groups + sage: OSG2 = M.orlik_solomon_algebra(QQ, ....: invariant=(G,on_groundset), ....: ordering=range(2,-1,-1)) - sage: g = G.an_element(); g # needs sage.graphs sage.groups + sage: g = G.an_element(); g (2,3) This choice of ``g`` acting on this choice of ``fset`` reverses diff --git a/src/sage/algebras/steenrod/steenrod_algebra.py b/src/sage/algebras/steenrod/steenrod_algebra.py index ce764f0a258..993e94dc828 100644 --- a/src/sage/algebras/steenrod/steenrod_algebra.py +++ b/src/sage/algebras/steenrod/steenrod_algebra.py @@ -552,8 +552,8 @@ def __init__(self, p=2, basis='milnor', **kwds): sage: TestSuite(SteenrodAlgebra(profile=[4,3,2,2,1])).run() sage: TestSuite(SteenrodAlgebra(basis='adem')).run() sage: TestSuite(SteenrodAlgebra(basis='wall')).run() - sage: TestSuite(SteenrodAlgebra(basis='arnonc')).run() # long time - sage: TestSuite(SteenrodAlgebra(basis='woody')).run() # long time + sage: TestSuite(SteenrodAlgebra(basis='arnonc')).run() # long time + sage: TestSuite(SteenrodAlgebra(basis='woody')).run() # long time sage: A3 = SteenrodAlgebra(3) sage: A3.category() Category of supercocommutative super hopf algebras @@ -562,7 +562,7 @@ def __init__(self, p=2, basis='milnor', **kwds): sage: TestSuite(SteenrodAlgebra(basis='adem', p=3)).run() sage: TestSuite(SteenrodAlgebra(basis='pst_llex', p=7)).run() # long time sage: TestSuite(SteenrodAlgebra(basis='comm_deg', p=5)).run() # long time - sage: TestSuite(SteenrodAlgebra(p=2, generic=True)).run() # long time + sage: TestSuite(SteenrodAlgebra(p=2, generic=True)).run() # long time Two Steenrod algebras are equal iff their associated primes, bases, and profile functions (if present) are equal. Because @@ -753,8 +753,8 @@ def _repr_(self): mod 3 Steenrod algebra, milnor basis sage: SteenrodAlgebra(2, basis='adem') mod 2 Steenrod algebra, serre-cartan basis - sage: B = SteenrodAlgebra(2003) - sage: B._repr_() + sage: B = SteenrodAlgebra(2003) # needs sage.rings.finite_rings + sage: B._repr_() # needs sage.rings.finite_rings 'mod 2003 Steenrod algebra, milnor basis' sage: SteenrodAlgebra(generic=True, basis='adem') generic mod 2 Steenrod algebra, serre-cartan basis @@ -1393,14 +1393,14 @@ def coproduct(self, x, algorithm='milnor'): INPUT: - - ``x`` -- element of self + - ``x`` -- element of ``self`` - - ``algorithm`` -- ``None`` or a string, either 'milnor' or - 'serre-cartan' (or anything which will be converted to one + - ``algorithm`` -- ``None`` or a string, either ``'milnor'`` or + ``'serre-cartan'`` (or anything which will be converted to one of these by the function :func:`get_basis_name `. - If ``None``, default to 'serre-cartan' if current basis is - 'serre-cartan'; otherwise use 'milnor'. + If ``None``, default to ``'serre-cartan'`` if current basis is + ``'serre-cartan'``; otherwise use ``'milnor'``. This calls :meth:`coproduct_on_basis` on the summands of ``x`` and extends linearly. @@ -1440,12 +1440,12 @@ def antipode_on_basis(self, t): INPUT: - - ``t`` -- tuple, the index of a basis element of self + - ``t`` -- tuple, the index of a basis element of ``self`` OUTPUT: the antipode of the corresponding basis element, - as an element of self. + as an element of ``self``. ALGORITHM: according to a result of Milnor's, the antipode of `\text{Sq}(n)` is the sum of all of the Milnor basis elements @@ -1490,7 +1490,7 @@ def antipode_on_basis(self, t): TESTS:: sage: Milnor = SteenrodAlgebra() - sage: all(x.antipode().antipode() == x for x in Milnor.basis(11)) # long time + sage: all(x.antipode().antipode() == x for x in Milnor.basis(11)) # long time True sage: A5 = SteenrodAlgebra(p=5, basis='adem') sage: all(x.antipode().antipode() == x for x in A5.basis(25)) @@ -1531,7 +1531,7 @@ def counit_on_basis(self, t): INPUT: - - ``t`` -- tuple, the index of a basis element of self + - ``t`` -- tuple, the index of a basis element of ``self`` EXAMPLES:: @@ -2237,7 +2237,9 @@ def basis(self, d=None): This does not print in a very helpful way, unfortunately:: sage: A7.basis() - Lazy family (Term map from basis key family of mod 7 Steenrod algebra, milnor basis to mod 7 Steenrod algebra, milnor basis(i))_{i in basis key family of mod 7 Steenrod algebra, milnor basis} + Lazy family (Term map from basis key family of mod 7 Steenrod algebra, milnor basis + to mod 7 Steenrod algebra, milnor basis(i))_{i in basis key family + of mod 7 Steenrod algebra, milnor basis} sage: for (idx,a) in zip((1,..,9),A7.basis()): ....: print("{} {}".format(idx, a)) 1 1 @@ -2251,7 +2253,8 @@ def basis(self, d=None): 9 Q_0 P(2) sage: D = SteenrodAlgebra(p=3, profile=([1], [2,2])) sage: sorted(D.basis()) - [1, P(1), P(2), Q_0, Q_0 P(1), Q_0 P(2), Q_0 Q_1, Q_0 Q_1 P(1), Q_0 Q_1 P(2), Q_1, Q_1 P(1), Q_1 P(2)] + [1, P(1), P(2), Q_0, Q_0 P(1), Q_0 P(2), Q_0 Q_1, + Q_0 Q_1 P(1), Q_0 Q_1 P(2), Q_1, Q_1 P(1), Q_1 P(2)] """ from sage.sets.family import Family if d is None: @@ -2573,7 +2576,7 @@ def pst(self,s,t): def ngens(self): r""" - Number of generators of self. + Number of generators of ``self``. OUTPUT: number or Infinity @@ -2601,7 +2604,7 @@ def ngens(self): 3 sage: SteenrodAlgebra(profile=[3,2,1], basis='pst').ngens() 3 - sage: SteenrodAlgebra(p=3, profile=[[3,2,1], [2,2,2,2]]).ngens() # A(3) at p=3 + sage: SteenrodAlgebra(p=3, profile=[[3,2,1], [2,2,2,2]]).ngens() # A(3) at p=3 4 sage: SteenrodAlgebra(profile=[1,2,1,1]).ngens() 5 @@ -2647,7 +2650,8 @@ def gens(self): sage: A3 = SteenrodAlgebra(3, 'adem') sage: A3.gens() - Lazy family ((i))_{i in Non negative integers} + Lazy family ((i))_{i in Non negative integers} sage: A3.gens()[0] beta sage: A3.gens()[1] @@ -2666,7 +2670,9 @@ def gens(self): sage: SteenrodAlgebra(p=5, profile=[[2,1], [2,2,2]]).gens() Family (Q_0, P(1), P(5)) sage: SteenrodAlgebra(profile=lambda n: n).gens() - Lazy family ((i))_{i in Non negative integers} + Lazy family ((i))_{i in Non negative integers} You may also use ``algebra_generators`` instead of ``gens``:: @@ -2932,16 +2938,16 @@ def top_class(self): EXAMPLES:: - sage: SteenrodAlgebra(2,profile=(3,2,1)).top_class() + sage: SteenrodAlgebra(2, profile=(3,2,1)).top_class() Sq(7,3,1) - sage: SteenrodAlgebra(3,profile=((2,2,1),(1,2,2,2,2))).top_class() + sage: SteenrodAlgebra(3, profile=((2,2,1),(1,2,2,2,2))).top_class() Q_1 Q_2 Q_3 Q_4 P(8,8,2) TESTS:: - sage: SteenrodAlgebra(2,profile=(3,2,1),basis='pst').top_class() + sage: SteenrodAlgebra(2, profile=(3,2,1), basis='pst').top_class() P^0_1 P^0_2 P^1_1 P^0_3 P^1_2 P^2_1 - sage: SteenrodAlgebra(5,profile=((0,),(2,1,2,2))).top_class() + sage: SteenrodAlgebra(5, profile=((0,),(2,1,2,2))).top_class() Q_0 Q_2 Q_3 sage: SteenrodAlgebra(5).top_class() Traceback (most recent call last): @@ -2953,12 +2959,12 @@ def top_class(self): but far from optimal for the 'pst' basis. Occasionally, it also gives an awkward leading coefficient:: - sage: SteenrodAlgebra(3,profile=((2,1),(1,2,2)),basis='pst').top_class() + sage: SteenrodAlgebra(3, profile=((2,1),(1,2,2)), basis='pst').top_class() 2 Q_1 Q_2 (P^0_1)^2 (P^0_2)^2 (P^1_1)^2 TESTS:: - sage: A=SteenrodAlgebra(2,profile=(3,2,1),basis='pst') + sage: A=SteenrodAlgebra(2, profile=(3,2,1), basis='pst') sage: A.top_class().parent() is A True """ @@ -3080,7 +3086,7 @@ def is_generic(self): True sage: SteenrodAlgebra(2).is_generic() False - sage: SteenrodAlgebra(2,generic=True).is_generic() + sage: SteenrodAlgebra(2, generic=True).is_generic() True """ return self._generic @@ -4146,7 +4152,8 @@ def SteenrodAlgebra(p=2, basis='milnor', generic='auto', **kwds): sage: EA = SteenrodAlgebra(p=2,generic=True) ; EA generic mod 2 Steenrod algebra, milnor basis sage: EA[8] - Vector space spanned by (Q_0 Q_2, Q_0 Q_1 P(2), P(1,1), P(4)) over Finite Field of size 2 + Vector space spanned by (Q_0 Q_2, Q_0 Q_1 P(2), P(1,1), P(4)) + over Finite Field of size 2 TESTS: @@ -4201,9 +4208,11 @@ def AA(n=None, p=2): sage: A() mod 2 Steenrod algebra, milnor basis sage: A(2) - sub-Hopf algebra of mod 2 Steenrod algebra, milnor basis, profile function [3, 2, 1] + sub-Hopf algebra of mod 2 Steenrod algebra, milnor basis, + profile function [3, 2, 1] sage: A(2, p=5) - sub-Hopf algebra of mod 5 Steenrod algebra, milnor basis, profile function ([2, 1], [2, 2, 2]) + sub-Hopf algebra of mod 5 Steenrod algebra, milnor basis, + profile function ([2, 1], [2, 2, 2]) """ if n is None: return SteenrodAlgebra(p=p) From 8f795cc2cc97053fb5578e70920d6304176bc570 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 14:51:43 -0700 Subject: [PATCH 21/25] src/sage/algebras/lie_algebras/lie_algebra_element.pyx: # needs --- src/sage/algebras/lie_algebras/lie_algebra_element.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx index ed9680a0af5..f221fe6ab55 100644 --- a/src/sage/algebras/lie_algebras/lie_algebra_element.pyx +++ b/src/sage/algebras/lie_algebras/lie_algebra_element.pyx @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# sage.doctest: needs sage.combinat """ Lie Algebra Elements From d2e559e95fc6eefb3f05b8cb8d84a38d56726cef Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Nov 2023 11:42:18 -0700 Subject: [PATCH 22/25] src/sage/algebras/cluster_algebra.py: Restore lost # random --- src/sage/algebras/cluster_algebra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/algebras/cluster_algebra.py b/src/sage/algebras/cluster_algebra.py index fa29367d014..4550e57e6ab 100644 --- a/src/sage/algebras/cluster_algebra.py +++ b/src/sage/algebras/cluster_algebra.py @@ -301,7 +301,7 @@ sage: # long time sage: A.reset_exploring_iterator(mutating_F=False) sage: v = (-1, 1, -2, 2, -1, 1, -1, 1, 1) - sage: seq = A.find_g_vector(v); seq + sage: seq = A.find_g_vector(v); seq # random [1, 0, 2, 6, 5, 4, 3, 8, 1] sage: S = A.initial_seed().mutate(seq, inplace=False) sage: v in S.g_vectors() From df17d12eb2fe08f69c175e670d786115b20b4440 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 4 Nov 2023 11:42:30 -0700 Subject: [PATCH 23/25] src/sage/algebras/orlik_solomon.py: Fix doctest fix --- src/sage/algebras/orlik_solomon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/algebras/orlik_solomon.py b/src/sage/algebras/orlik_solomon.py index 7cb469f09cc..76ed00aa855 100644 --- a/src/sage/algebras/orlik_solomon.py +++ b/src/sage/algebras/orlik_solomon.py @@ -368,7 +368,7 @@ def subset_image(self, S): sage: # needs sage.graphs sage: G = Graph([[1,2],[1,2],[2,3],[2,3],[1,3],[1,3]], multiedges=True) sage: MG = Matroid(G) - sage: sorted([sorted(c) for c in M.circuits()]) + sage: sorted([sorted(c) for c in MG.circuits()]) [[0, 1], [0, 2, 4], [0, 2, 5], [0, 3, 4], [0, 3, 5], [1, 2, 4], [1, 2, 5], [1, 3, 4], [1, 3, 5], [2, 3], [4, 5]] From bd006df67861d65e0132617f11ed643c08906124 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Nov 2023 14:19:27 -0800 Subject: [PATCH 24/25] src/sage/algebras/commutative_dga.py: Remove obsolete '# needs sage.rings.finite_rings' --- src/sage/algebras/commutative_dga.py | 62 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/sage/algebras/commutative_dga.py b/src/sage/algebras/commutative_dga.py index d1ea9b782e4..35facfa7866 100644 --- a/src/sage/algebras/commutative_dga.py +++ b/src/sage/algebras/commutative_dga.py @@ -949,9 +949,9 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= TESTS:: - sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) # needs sage.rings.finite_rings - sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) # needs sage.rings.finite_rings - sage: A1 is A2 # needs sage.rings.finite_rings + sage: A1 = GradedCommutativeAlgebra(GF(2), 'x,y', (3, 6)) + sage: A2 = GradedCommutativeAlgebra(GF(2), ['x', 'y'], [3, 6]) + sage: A1 is A2 True Testing the single generator case (:trac:`25276`):: @@ -962,8 +962,8 @@ def __classcall__(cls, base, names=None, degrees=None, R=None, I=None, category= sage: A4. = GradedCommutativeAlgebra(QQ, degrees=[4]) sage: z**2 == 0 False - sage: A5. = GradedCommutativeAlgebra(GF(2)) # needs sage.rings.finite_rings - sage: z**2 == 0 # needs sage.rings.finite_rings + sage: A5. = GradedCommutativeAlgebra(GF(2)) + sage: z**2 == 0 False """ if names is None: @@ -1207,7 +1207,6 @@ def quotient(self, I, check=True): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = GradedCommutativeAlgebra(GF(5), degrees=(2, 2, 3, 4)) sage: I = A.ideal([x*t+z^2, x*y - t]) sage: B = A.quotient(I); B @@ -1910,7 +1909,6 @@ def degree(self, total=False): EXAMPLES:: - sage: # needs sage.rings.finite_rings sage: A. = GradedCommutativeAlgebra(GF(2), ....: degrees=((1,0), (0,1), (1,1))) sage: (a**2*b).degree() @@ -2390,23 +2388,23 @@ def cohomology_generators(self, max_degree): In contrast, the corresponding algebra in characteristic `p` has finitely generated cohomology:: - sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) # needs sage.rings.finite_rings - sage: B3 = A3.cdg_algebra(differential={y: a*x}) # needs sage.rings.finite_rings - sage: B3.cohomology_generators(16) # needs sage.rings.finite_rings + sage: A3. = GradedCommutativeAlgebra(GF(3), degrees=(1,2,2)) + sage: B3 = A3.cdg_algebra(differential={y: a*x}) + sage: B3.cohomology_generators(16) {1: [a], 2: [x], 3: [a*y], 5: [a*y^2], 6: [y^3]} This method works with both singly graded and multi-graded algebras:: - sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) # needs sage.rings.finite_rings - sage: Ds = Cs.cdg_algebra({a:c, b:d}) # needs sage.rings.finite_rings - sage: Ds.cohomology_generators(10) # needs sage.rings.finite_rings + sage: Cs. = GradedCommutativeAlgebra(GF(2), degrees=(1,2,2,3)) + sage: Ds = Cs.cdg_algebra({a:c, b:d}) + sage: Ds.cohomology_generators(10) {2: [a^2], 4: [b^2]} - sage: Cm. = GradedCommutativeAlgebra(GF(2), # needs sage.rings.finite_rings + sage: Cm. = GradedCommutativeAlgebra(GF(2), ....: degrees=((1,0), (1,1), ....: (0,2), (0,3))) - sage: Dm = Cm.cdg_algebra({a:c, b:d}) # needs sage.rings.finite_rings - sage: Dm.cohomology_generators(10) # needs sage.rings.finite_rings + sage: Dm = Cm.cdg_algebra({a:c, b:d}) + sage: Dm.cohomology_generators(10) {2: [a^2], 4: [b^2]} TESTS: @@ -3509,9 +3507,9 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, We can construct multi-graded rings as well. We work in characteristic 2 for a change, so the algebras here are honestly commutative:: - sage: C. = GradedCommutativeAlgebra(GF(2), # needs sage.rings.finite_rings + sage: C. = GradedCommutativeAlgebra(GF(2), ....: degrees=((1,0), (1,1), (0,2), (0,3))) - sage: D = C.cdg_algebra(differential={a: c, b: d}); D # needs sage.rings.finite_rings + sage: D = C.cdg_algebra(differential={a: c, b: d}); D Commutative Differential Graded Algebra with generators ('a', 'b', 'c', 'd') in degrees ((1, 0), (1, 1), (0, 2), (0, 3)) over Finite Field of size 2 with differential: @@ -3524,46 +3522,46 @@ def GradedCommutativeAlgebra(ring, names=None, degrees=None, max_degree=None, Use tuples, lists, vectors, or elements of additive abelian groups to specify degrees:: - sage: D.basis(3) # basis in total degree 3 # needs sage.rings.finite_rings + sage: D.basis(3) # basis in total degree 3 [a^3, a*b, a*c, d] - sage: D.basis((1,2)) # basis in degree (1,2) # needs sage.rings.finite_rings + sage: D.basis((1,2)) # basis in degree (1,2) [a*c] - sage: D.basis([1,2]) # needs sage.rings.finite_rings + sage: D.basis([1,2]) [a*c] - sage: D.basis(vector([1,2])) # needs sage.rings.finite_rings + sage: D.basis(vector([1,2])) [a*c] sage: G = AdditiveAbelianGroup([0,0]); G Additive abelian group isomorphic to Z + Z - sage: D.basis(G(vector([1,2]))) # needs sage.rings.finite_rings + sage: D.basis(G(vector([1,2]))) [a*c] At this point, ``a``, for example, is an element of ``C``. We can redefine it so that it is instead an element of ``D`` in several ways, for instance using :meth:`gens` method:: - sage: a, b, c, d = D.gens() # needs sage.rings.finite_rings - sage: a.differential() # needs sage.rings.finite_rings + sage: a, b, c, d = D.gens() + sage: a.differential() c Or the :meth:`inject_variables` method:: - sage: D.inject_variables() # needs sage.rings.finite_rings + sage: D.inject_variables() Defining a, b, c, d - sage: (a*b).differential() # needs sage.rings.finite_rings + sage: (a*b).differential() b*c + a*d - sage: (a*b*c**2).degree() # needs sage.rings.finite_rings + sage: (a*b*c**2).degree() (2, 5) Degrees are returned as elements of additive abelian groups:: - sage: (a*b*c**2).degree() in G # needs sage.rings.finite_rings + sage: (a*b*c**2).degree() in G True - sage: (a*b*c**2).degree(total=True) # total degree # needs sage.rings.finite_rings + sage: (a*b*c**2).degree(total=True) # total degree 7 - sage: D.cohomology(4) # needs sage.rings.finite_rings + sage: D.cohomology(4) Free module generated by {[a^4], [b^2]} over Finite Field of size 2 - sage: D.cohomology((2,2)) # needs sage.rings.finite_rings + sage: D.cohomology((2,2)) Free module generated by {[b^2]} over Finite Field of size 2 Graded algebra with maximal degree:: From 919ec6ff0cf034bef5870b85e323f40ff6caa3a2 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 12 Nov 2023 14:25:29 -0800 Subject: [PATCH 25/25] src/sage/algebras/finite_gca.py: Remove dubious '# needs sage.libs.singular'; doctest cosmetics --- src/sage/algebras/finite_gca.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/sage/algebras/finite_gca.py b/src/sage/algebras/finite_gca.py index 08ebb27616e..cb6c29e358d 100644 --- a/src/sage/algebras/finite_gca.py +++ b/src/sage/algebras/finite_gca.py @@ -90,14 +90,15 @@ class FiniteGCAlgebra(CombinatorialFreeModule, Algebra): sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,2,3), max_degree=6) sage: A - Graded commutative algebra with generators ('x', 'y', 'z', 't') in degrees (1, 2, 2, 3) with maximal degree 6 + Graded commutative algebra with generators ('x', 'y', 'z', 't') + in degrees (1, 2, 2, 3) with maximal degree 6 sage: t*x + x*t 0 sage: x^2 0 sage: x*t^2 0 - sage: x*y^2+z*t + sage: x*y^2 + z*t x*y^2 + z*t The generators can be returned with :meth:`algebra_generators`:: @@ -115,7 +116,9 @@ class FiniteGCAlgebra(CombinatorialFreeModule, Algebra): Depending on the context, the multiplication can be given a different symbol:: - sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6), max_degree=10, mul_symbol='⌣', mul_latex_symbol=r'\smile') + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6), max_degree=10, + ....: mul_symbol='⌣', + ....: mul_latex_symbol=r'\smile') sage: x*y^2 + x*t x⌣y^2 + x⌣t sage: latex(x*y^2 - z*x) @@ -127,7 +130,7 @@ class FiniteGCAlgebra(CombinatorialFreeModule, Algebra): omitted, an instance of the class :class:`sage.algebras.commutative_dga.GCAlgebra` is created instead:: - sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6)) # needs sage.libs.singular + sage: A. = GradedCommutativeAlgebra(QQ, degrees=(1,2,6,6)) sage: type(A)