Skip to content

Commit

Permalink
Edited documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
25shriya committed Jan 9, 2025
1 parent 7a2ae3f commit cccf433
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
44 changes: 22 additions & 22 deletions src/sage/categories/kahler_algebras.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 ]
Expand Down Expand Up @@ -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():
Expand Down
14 changes: 8 additions & 6 deletions src/sage/matroids/chow_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}}'
Expand All @@ -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}}}
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down
13 changes: 6 additions & 7 deletions src/sage/matroids/chow_ring_ideal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}
Expand Down Expand Up @@ -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,
Expand All @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cccf433

Please sign in to comment.