Skip to content

Commit

Permalink
Trac #34767: Implement _latex_ method for (quasi)modular forms ring e…
Browse files Browse the repository at this point in the history
…lements

URL: https://trac.sagemath.org/34767
Reported by: gh-DavidAyotte
Ticket author(s): David Ayotte
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Feb 11, 2023
2 parents e421c4e + 03ab6c6 commit 0993d40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/sage/modular/modform/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -3395,6 +3395,18 @@ def _repr_(self):
"""
return str(self.q_expansion())

def _latex_(self):
r"""
Return a latex representation of ``self``.
TESTS::
sage: M = ModularFormsRing(1)
sage: latex(M.0)
1 + 240 q + 2160 q^{2} + 6720 q^{3} + 17520 q^{4} + 30240 q^{5} + O(q^{6})
"""
return self.q_expansion()._latex_()

def __getitem__(self, weight):
r"""
Return the homogeneous component of the given graded modular form.
Expand Down
12 changes: 12 additions & 0 deletions src/sage/modular/quasimodform/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,18 @@ def _repr_(self):
"""
return str(self.q_expansion())

def _latex_(self):
r"""
Return a latex representation of ``self``.
TESTS::
sage: QM = QuasiModularForms(1)
sage: latex(QM.0)
1 - 24 q - 72 q^{2} - 96 q^{3} - 168 q^{4} - 144 q^{5} + O(q^{6})
"""
return self.q_expansion()._latex_()

def _richcmp_(self, other, op):
r"""
Compare self with other.
Expand Down

0 comments on commit 0993d40

Please sign in to comment.