diff --git a/src/sage/categories/kahler_algebras.py b/src/sage/categories/kahler_algebras.py index a08ab008b92..d43b6267d72 100644 --- a/src/sage/categories/kahler_algebras.py +++ b/src/sage/categories/kahler_algebras.py @@ -73,32 +73,32 @@ def super_categories(self): EXAMPLES:: - sage: from sage.categories.kahler_algebras import KahlerAlgebras + sage: from sage.categories.kahler_algebras import KahlerAlgebras - sage: C = KahlerAlgebras(QQ); C - Category of kahler algebras over Rational Field - sage: sorted(C.super_categories(), key=str) - [Category of finite dimensional graded algebras with basis over - Rational Field] + sage: C = KahlerAlgebras(QQ); C + Category of kahler algebras over Rational Field + sage: sorted(C.super_categories(), key=str) + [Category of finite dimensional graded algebras with basis over + Rational Field] """ return [GradedAlgebrasWithBasis(self.base_ring()).FiniteDimensional()] class ParentMethods: @abstract_method - def poincare_pairing(self, a,b): + def poincare_pairing(self, a, b): r""" Return the Poincaré pairing of two elements of the Kähler algebra. - EXAMPLES:: + EXAMPLES:: - sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') - sage: Ba, Bb, Bc, Bd, Be, Bf, Bg, Babf, Bace, Badg, Bbcd, Bbeg, Bcfg, Bdef, Babcdefg = ch.gens()[8:] - sage: u = ch(-Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg); u - -Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg - sage: v = ch(Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg); v - Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg - sage: ch.poincare_pairing(v, u) - 3 + sage: ch = matroids.catalog.Fano().chow_ring(QQ, True, 'fy') + sage: Ba, Bb, Bc, Bd, Be, Bf, Bg, Babf, Bace, Badg, Bbcd, Bbeg, Bcfg, Bdef, Babcdefg = ch.gens()[8:] + sage: u = ch(-Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg); u + -Babf^2 + Bcfg^2 - 8/7*Bc*Babcdefg + 1/2*Bd*Babcdefg - Bf*Babcdefg - Bg*Babcdefg + sage: v = ch(Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg); v + Bg - 2/37*Babf + Badg + Bbeg + Bcfg + Babcdefg + sage: ch.poincare_pairing(v, u) + 3 """ @abstract_method @@ -108,7 +108,7 @@ def lefschetz_element(self): EXAMPLES:: - sage: U46 = matroids.Uniform(4,6) + sage: U46 = matroids.Uniform(4, 6) sage: C = U46.chow_ring(QQ, False) sage: w = C.lefschetz_element(); w -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 @@ -134,12 +134,12 @@ def lefschetz_element(self): def hodge_riemann_relations(self, k): r""" - Return the quadratic form for the corresponding k (< r/2) for the - Kähler algebra. + Return the quadratic form for the corresponding ``k`` + (`< \frac{r}{2}`) for the Kähler algebra, where `r` is the top degree. EXAMPLES:: - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(4, 6).chow_ring(QQ, False) sage: ch.hodge_riemann_relations(1) Quadratic form in 36 variables over Rational Field with coefficients: [ 3 -1 -1 3 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 -1 -1 3 ] @@ -181,11 +181,11 @@ def hodge_riemann_relations(self, k): sage: ch.hodge_riemann_relations(3) Traceback (most recent call last): ... - ValueError: k must be less than r < 2 + ValueError: k must be less than r/2 < 2 """ r = self.top_degree() if k > (r/2): - raise ValueError("k must be less than r < 2") + raise ValueError("k must be less than r/2 < 2") basis_k = [] lefschetz_el = self.lefschetz_element() for b in self.basis(): diff --git a/src/sage/matroids/chow_ring.py b/src/sage/matroids/chow_ring.py index 7dca223bb40..e642e1bb475 100644 --- a/src/sage/matroids/chow_ring.py +++ b/src/sage/matroids/chow_ring.py @@ -53,8 +53,10 @@ class ChowRing(QuotientRing_generic): :mod:`sage.matroids.chow_ring_ideal` - An important note to be taken is that different presentations of Chow rings - of non-simple matroids may not be isomorphic to one another. + .. WARNING:: + + Different presentations of Chow rings of non-simple matroids may not be + isomorphic to one another. INPUT: @@ -131,7 +133,7 @@ def _latex_(self): EXAMPLES:: - sage: M1 = matroids.Uniform(2,5) + sage: M1 = matroids.Uniform(2, 5) sage: ch = M1.chow_ring(QQ, False) sage: ch._latex_() 'A(\\begin{array}{l}\n\\text{\\texttt{U(2,{ }5):{ }Matroid{ }of{ }rank{ }2{ }on{ }5{ }elements{ }with{ }circuit{-}closures}}\\\\\n\\text{\\texttt{{\\char`\\{}2:{ }{\\char`\\{}{\\char`\\{}0,{ }1,{ }2,{ }3,{ }4{\\char`\\}}{\\char`\\}}{\\char`\\}}}}\n\\end{array})_{\\Bold{Q}}' @@ -148,7 +150,7 @@ def matroid(self): EXAMPLES:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, True, 'fy') + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, True, 'fy') sage: ch.matroid() U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} @@ -225,7 +227,7 @@ def lefschetz_element(self): It is then multiplied with the elements of FY-monomial bases of different degrees:: - sage: ch = matroids.Uniform(4,5).chow_ring(QQ, False) + sage: ch = matroids.Uniform(4, 5).chow_ring(QQ, False) sage: basis_deg = {} sage: for b in ch.basis(): ....: deg = b.homogeneous_degree() @@ -285,7 +287,7 @@ def lefschetz_element(self): TESTS:: - sage: U46 = matroids.Uniform(4,6) + sage: U46 = matroids.Uniform(4, 6) sage: C = U46.chow_ring(QQ, False) sage: w = C.lefschetz_element(); w -2*A01 - 2*A02 - 2*A03 - 2*A04 - 2*A05 - 2*A12 - 2*A13 - 2*A14 diff --git a/src/sage/matroids/chow_ring_ideal.py b/src/sage/matroids/chow_ring_ideal.py index db830ab0fc2..625bec8d7b9 100644 --- a/src/sage/matroids/chow_ring_ideal.py +++ b/src/sage/matroids/chow_ring_ideal.py @@ -21,7 +21,7 @@ def matroid(self): EXAMPLES:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) sage: ch.defining_ideal().matroid() U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} @@ -63,7 +63,7 @@ def flats_to_generator_dict(self): EXAMPLES:: - sage: ch = matroids.Uniform(4,6).chow_ring(QQ, True, 'atom-free') + sage: ch = matroids.Uniform(4, 6).chow_ring(QQ, True, 'atom-free') sage: ch.defining_ideal().flats_to_generator_dict() {frozenset({0}): A0, frozenset({1}): A1, frozenset({2}): A2, frozenset({3}): A3, frozenset({4}): A4, frozenset({5}): A5, @@ -87,8 +87,7 @@ def flats_to_generator_dict(self): frozenset({3, 4, 5}): A345, frozenset({0, 1, 2, 3, 4, 5}): A012345} """ - flats_gen = self._flats_generator - return flats_gen + return dict(self._flats_generator) class ChowRingIdeal_nonaug(ChowRingIdeal): @@ -129,7 +128,7 @@ class ChowRingIdeal_nonaug(ChowRingIdeal): Chow ring ideal of uniform matroid of rank 3 on 6 elements:: - sage: ch = matroids.Uniform(3,6).chow_ring(QQ, False) + sage: ch = matroids.Uniform(3, 6).chow_ring(QQ, False) sage: ch.defining_ideal() Chow ring ideal of U(3, 6): Matroid of rank 3 on 6 elements with circuit-closures {3: {{0, 1, 2, 3, 4, 5}}} - non augmented @@ -576,7 +575,7 @@ def normal_basis(self, algorithm='', *args, **kwargs): EXAMPLES:: - sage: ch = matroids.Uniform(2,5).chow_ring(QQ, True, 'fy') + sage: ch = matroids.Uniform(2, 5).chow_ring(QQ, True, 'fy') sage: I = ch.defining_ideal() sage: I.normal_basis() [1, B0, B1, B2, B3, B4, B01234, B01234^2] @@ -753,7 +752,7 @@ def groebner_basis(self, algorithm='', *args, **kwargs): EXAMPLES:: - sage: M1 = matroids.Uniform(3,6) + sage: M1 = matroids.Uniform(3, 6) sage: ch = M1.chow_ring(QQ, True, 'atom-free') sage: ch.defining_ideal().groebner_basis(algorithm='') Polynomial Sequence with 253 Polynomials in 22 Variables