Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
docstring updates, fixed weights_list method for zero element
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAyotte committed Jul 29, 2021
1 parent 99f8ab5 commit 62a9484
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions src/sage/modular/modform/element.py
Expand Up @@ -3079,7 +3079,13 @@ def new_level(self):

class GradedModularFormElement(ModuleElement):
r"""
The element class for ``ModularFormsRing``
The element class for ``ModularFormsRing``. A ``GradedModularFormElement`` is basically a
formal sum of modular forms of different weight: `f_1 + f_2 + ... + f_n`. Note that a
``GradedModularFormElement`` is not necessarily a modular form (as it can have mixed weight
components).
A ``GradedModularFormElement`` should not be constructed directly via this class. Instead,
one should use the element constructor of the parent class (``ModularFormsRing``).
"""
def __init__(self, parent, forms_datum):
r"""
Expand Down Expand Up @@ -3116,15 +3122,6 @@ def __init__(self, parent, forms_datum):
2 + 12*q + 36*q^2 + 252*q^3 + 84*q^4 + 72*q^5 + O(q^6)
sage: M({4:f, 2:g})
2 + 12*q + 36*q^2 + 252*q^3 + 84*q^4 + 72*q^5 + O(q^6)
TESTS::
sage: M = ModularFormsRing(1)
sage: TestSuite(M).run()
sage: M15 = ModularFormsRing(Gamma1(5))
sage: TestSuite(M15).run()
sage: M013 = ModularFormsRing(Gamma0(13))
sage: TestSuite(M013).run()
"""
forms_dictionary = {}
if isinstance(forms_datum, dict):
Expand Down Expand Up @@ -3510,7 +3507,11 @@ def weights_list(self):
sage: F = F4 + F6 + F8
sage: F.weights_list()
[4, 6, 8]
sage: M(0).weights_list()
[0]
"""
if self.is_zero():
return [ZZ(0)]
return sorted(self._forms_dictionary)

def is_homogeneous(self):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modform/space.py
Expand Up @@ -1159,7 +1159,7 @@ def _pushout_(self, other):
...
TypeError: unsupported operand parent(s) for +: 'Modular Forms space of dimension 7 for Congruence Subgroup Gamma0(5) of weight 12 over Rational Field' and 'Modular Forms space of dimension 1 for Modular Group SL(2,Z) of weight 4 over Rational Field'
"""
from .find_generators import ModularFormsRing
from .ring import ModularFormsRing
if isinstance(other, ModularFormsSpace):
if self.group() == other.group() and self.base_ring() == other.base_ring():
if self.weight() == other.weight():
Expand Down

0 comments on commit 62a9484

Please sign in to comment.