Opened 21 months ago
Closed 14 months ago
#31512 closed enhancement (fixed)
Implementation of the graded quasimodular forms ring
Reported by:  David Ayotte  Owned by:  David Ayotte 

Priority:  minor  Milestone:  sage9.5 
Component:  modular forms  Keywords:  quasimodularforms gsoc2021 
Cc:  Samuel Lelièvre, Vincent Delecroix  Merged in:  
Authors:  David Ayotte  Reviewers:  Vincent Delecroix 
Report Upstream:  N/A  Work issues:  
Branch:  20e633e (Commits, GitHub, GitLab)  Commit:  20e633e7622fbc3097458b6c860772f21fba19e0 
Dependencies:  #31559, #32135  Stopgaps: 
Description (last modified by )
Change History (45)
comment:1 Changed 21 months ago by
Branch:  → u/ghDavidAyotte/implementation_of_the_graded_quasimodular_forms_ring 

comment:2 Changed 21 months ago by
Commit:  → 7b029adc62b4b8702394638170cff1577e20d8a4 

Owner:  set to David Ayotte 
comment:3 Changed 21 months ago by
Commit:  7b029adc62b4b8702394638170cff1577e20d8a4 → d9940aa9be03fca1634bf95d440086eea80edd3e 

Branch pushed to git repo; I updated commit sha1. New commits:
d9940aa  Fixed some typos and syntax in the documentation

comment:4 Changed 21 months ago by
Cc:  Samuel Lelièvre added 

Description:  modified (diff) 
comment:5 Changed 21 months ago by
Hi David,
Great start.
Let us stick to SL(2,Z)
in this ticket. Further improvements (other congruence subgroups, BlochOkounkov brackets should be reserved for other tickets).
Some concrete remarks
QuasiModularFormsRing
could simply beQuasiModularForms
 The main class should inherit from
Parent
and the category should be properly initialized, see https://doc.sagemath.org/html/en/thematic_tutorials/coercion_and_categories.html  The objective is to manipulate exact formal objects. Not approximate qseries. The following operations should be available on the elements
 equality tests between two qmforms
 decomposition of a qmform with respect to the grading (ie by level)
 testing modularity
 computing the qseries expansion of a qmform (arbitrary precision)
 multiplication by a modular form (maybe the simplest to achieve this is to define qmforms as an algebra over modular forms?)
 (further ticket) computing algebraic or differential equations (for that purpose it is necessary to have formal derivatives, not the derivative of the qexpansion)
 (further ticket) asymptotics of coefficients
 The following methods should be available on the parent (the algebra itself)
 vector space basis of a given graded component
 basis and generators up to modular forms
comment:6 followup: 7 Changed 21 months ago by
Commit:  d9940aa9be03fca1634bf95d440086eea80edd3e → 9fa1397adf5b3412c1974551f1ebe8d564892d38 

Branch pushed to git repo; I updated commit sha1. New commits:
9fa1397  Changed the name of the main class to QuasiModularForms. Added inheritance from Parent and UniqueRepresentation. Implemented category framework to the main class

comment:7 Changed 21 months ago by
Replying to git:
Branch pushed to git repo; I updated commit sha1. New commits:
9fa1397 Changed the name of the main class to QuasiModularForms. Added inheritance from Parent and UniqueRepresentation. Implemented category framework to the main class
I just realized that there are some inconsistencies in the code of that commit. They will be fixed this week.
comment:8 Changed 21 months ago by
Commit:  9fa1397adf5b3412c1974551f1ebe8d564892d38 → 13a244107883a9a6d318ec4b1e0cad7f90158357 

Branch pushed to git repo; I updated commit sha1. New commits:
13a2441  Implementation of QuasiModularFormsElement class. Fixed some inconsistencies in the code. The default precision is now 6 (to be consistent with classical ModularForms)

comment:9 Changed 21 months ago by
Description:  modified (diff) 

Keywords:  quasimodularforms added; graded quasimodular forms removed 
Milestone:  sagewishlist → sage9.4 
comment:10 Changed 18 months ago by
Commit:  13a244107883a9a6d318ec4b1e0cad7f90158357 → 8433a5abbe46b1c3a6859795288955a2569b79cf 

Branch pushed to git repo; I updated commit sha1. New commits:
0ef06e3  Initial implementation of quasimodular forms

39642c2  Fixed some typos and syntax in the documentation

33d0897  Changed the name of the main class to QuasiModularForms. Added inheritance from Parent and UniqueRepresentation. Implemented category framework to the main class

f6d57bf  Implementation of QuasiModularFormsElement class. Fixed some inconsistencies in the code. The default precision is now 6 (to be consistent with classical ModularForms)

8433a5a  Merge branch 'u/ghDavidAyotte/implementation_of_the_graded_quasimodular_forms_ring' of trac.sagemath.org:sage into t/31512/implementation_of_the_graded_quasimodular_forms_ring

comment:11 Changed 17 months ago by
Milestone:  sage9.4 → sage9.5 

comment:12 Changed 17 months ago by
Commit:  8433a5abbe46b1c3a6859795288955a2569b79cf → f9217247dfd73752b1e7beeda1c6e1d1dc79dd0e 

Branch pushed to git repo; I updated commit sha1. New commits:
f921724  Merge branch 'develop' into t/31512/implementation_of_the_graded_quasimodular_forms_ring

comment:13 Changed 16 months ago by
Commit:  f9217247dfd73752b1e7beeda1c6e1d1dc79dd0e → 45f179173dc573a488a9dcc253cdd4f50f0ee006 

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:
c4595c1  Merge branch 'gamma1_modform_conversion' into t/31559/make_modularformrings_manipulate_formal_objects

a6c745d  small fixes

906b8ab  fixes: pyflakes, failing doctest in find_generators

523c7b0  fix some doctring

7dbaf4e  fix indentation error

5887973  fix docstring, changed some syntax, removed _rmul_, add negative weight checker for __getitem__, fix weight of zero element bug

7fdca22  changed _repr_ method of ModularFormsRing, added TestSuite in doctests, added some_elements method, fixed conversion bug

1b9332e  moved sage.modular.modform.find_generators.py in sage.rings, attempt at making decrecation work (without success)

4305360  Merge branch 't/31559/make_modularformrings_manipulate_formal_objects' into t/31512/implementation_of_the_graded_quasimodular_forms_ring

45f1791  Major changes: Implementation of _add_, _mul_, _lmul_, __neg__. Added Docstring. Implemented conversion. Added generators methods.

comment:14 Changed 16 months ago by
Dependencies:  → #31559 

comment:15 Changed 16 months ago by
Commit:  45f179173dc573a488a9dcc253cdd4f50f0ee006 → c36dafd0d3ff085ba2ab80eebdef29999add4882 

Branch pushed to git repo; I updated commit sha1. New commits:
68509f9  deprecation, added missing newline

2e78c45  revert to commit 7fdca22

99f8ab5  renamed find_generators.py to ring.py, added deprecation

62a9484  docstring updates, fixed weights_list method for zero element

ed90b5a  fixed deprecation, added deprecation for find_generators and basis_for_modform_space

d489a1f  moved deprecation doctests inside find_generators, fixed docstrings

bf19eec  added example info for GradedModularFormElement class, moved some doctests inside the __init__ method (for coverage)

2e49907  fix docbuild error

3afb0a1  Merge branch 't/31559/make_modularformrings_manipulate_formal_objects' into t/31512/implementation_of_the_graded_quasimodular_forms_ring

c36dafd  moved QuasiModularFormsRing into ring.py, moved QuasiModularFormElement into element.py, fixed conversion error

comment:16 Changed 16 months ago by
Commit:  c36dafd0d3ff085ba2ab80eebdef29999add4882 → c59eb13023e00261eb86b638dd36891d567b198d 

Branch pushed to git repo; I updated commit sha1. New commits:
c59eb13  new methods: one, zero, some_elements, is_one, is_zero, __bool__

comment:17 Changed 16 months ago by
Commit:  c59eb13023e00261eb86b638dd36891d567b198d → 24ada0c219fde5609ba20a18bdf94ff180b361fd 

Branch pushed to git repo; I updated commit sha1. New commits:
24ada0c  added docstring and tests, small fixes, added modular_forms_of_weight and quasimodular_forms_of_weight methods

comment:18 Changed 16 months ago by
Commit:  24ada0c219fde5609ba20a18bdf94ff180b361fd → a53d988af11a1e3202beee36f3bc2918d5a3997d 

Branch pushed to git repo; I updated commit sha1. New commits:
a53d988  New methods: is_graded_modular_forms, is_modular_forms. Added doctests to _element_constructor_. Multiple small docstring fix (PEP8).

comment:19 Changed 16 months ago by
Commit:  a53d988af11a1e3202beee36f3bc2918d5a3997d → 9304a663232f0f0515856b886043dca14b663ff6 

Branch pushed to git repo; I updated commit sha1. New commits:
dd6e659  Initial commit

5bbc4f4  initial implementation of the method from_polynomial

b2517ec  updated _generators_variables_dictionnary

461d5f6  implementation of to_polynomial

1e6a262  make polynomial_ring not private, assigned degrees to the variables

7d8b20a  fix docstring of to_polynomial

e4a974f  fix docstring, removed _weights_of_gemerators, small code syntax changes

1038d68  rename find_generator.py into ring.py

d991d19  merge ticket 31559 'Make ModularFormRings manipulate formal objects' and fix conflicts

9304a66  Merge ticket 32135 'Implement to_polynomial and from_polynomial methods for ModularFormsRing' into t/31512/implementation_of_the_graded_quasimodular_forms_ring

comment:20 Changed 16 months ago by
Dependencies:  #31559 → #31559, #32135 

comment:21 Changed 16 months ago by
Commit:  9304a663232f0f0515856b886043dca14b663ff6 → 526c8849f8186693d615ed579e2d0e91ab4b7546 

Branch pushed to git repo; I updated commit sha1. New commits:
526c884  fix constant polynomials bug

comment:22 Changed 16 months ago by
Commit:  526c8849f8186693d615ed579e2d0e91ab4b7546 → 6ab4ca9a1332e7d34ca788134a42da29e1049dba 

Branch pushed to git repo; I updated commit sha1. New commits:
6ab4ca9  fix some docstring. small fix.

comment:23 Changed 16 months ago by
Status:  new → needs_review 

comment:24 Changed 16 months ago by
Commit:  6ab4ca9a1332e7d34ca788134a42da29e1049dba → 6984a26e74439171831704266b8d47a1c8c0b8dd 

Branch pushed to git repo; I updated commit sha1. New commits:
6984a26  fix failing doctests, pyflakes, block, tiple colon

comment:25 Changed 16 months ago by
Reviewers:  → Vincent Delecroix 

Status:  needs_review → needs_work 
This
if not self._polynomial.degree(): return self._polynomial[0].is_modular_form() else: return False
is equivalent to
return not self._polynomial.degree() and self._polynomial[0].is_modular_form()
Why do you store base ring in the element (attribute __base_ring
)? This would better be accessed through the parent. Note that ModuleElement
has a default implementation of the method base_ring
as
def base_ring(self): return self._parent.base_ring()
Also, since you inherit from Parent
, there is already a slot dedicated to that. Namely _base
. This is initialized inside the constructor
Parent.__init__(self, base=..., category=...)
So : remove __base_ring
from both QuasiModularForms
and QuasiModularFormsElement
.
(I believe the same could be done for modular forms. But leave that to another ticket)
comment:26 Changed 16 months ago by
Commit:  6984a26e74439171831704266b8d47a1c8c0b8dd → 5a373a38666a69425f68ee716ddff1a7ca61e588 

Branch pushed to git repo; I updated commit sha1. New commits:
5a373a3  remove __base_ring attributes and method, changed some syntax

comment:27 Changed 16 months ago by
Status:  needs_work → needs_review 

Thanks a lot! I had forgotten about the base ring attribute after implementing the parent/element framework. I will open a ticket to fix this for the class ModularFormsRing
.
comment:28 followup: 30 Changed 16 months ago by
Why is it only implemented for SL(2,Z)? The isomorphism QM = M[E2]
is valid in general.
comment:30 Changed 16 months ago by
Replying to vdelecroix:
Why is it only implemented for SL(2,Z)? The isomorphism
QM = M[E2]
is valid in general.
I will check if this doesn't break anything, but I mostly stick to the case of SL2Z because of comment:5. But thanks for reminding me this isomorphism, it should not be a problem.
comment:32 followup: 33 Changed 16 months ago by
Maybe we made a mistake, but the initialization from polynomial is confusing. The reason is that both E2 * E4  3 * E2^2
and 1/24 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5
are polynomials.
comment:33 Changed 16 months ago by
Replying to vdelecroix:
Maybe we made a mistake, but the initialization from polynomial is confusing. The reason is that both
E2 * E4  3 * E2^2
and1/24 + q + 3*q^2 + 4*q^3 + 7*q^4 + 6*q^5
are polynomials.
This is in fact really important. To fix this confusion, my idea would be to give more examples and explanations in the doc. Do you have an other idea to fix this?
comment:34 followup: 35 Changed 16 months ago by
In the case of ModularFormsRing._element_constructor_
, when the input is a polynomial the code calls from_polynomial
. This is very different from what is happening with the quasimodular forms.
comment:35 followup: 36 Changed 16 months ago by
Replying to vdelecroix:
In the case of
ModularFormsRing._element_constructor_
, when the input is a polynomial the code callsfrom_polynomial
. This is very different from what is happening with the quasimodular forms.
Ok, so maybe the element constructor of ModularFormsRing
should not call from_polynomial
. What do you think?
comment:36 Changed 16 months ago by
Replying to ghDavidAyotte:
Replying to vdelecroix:
In the case of
ModularFormsRing._element_constructor_
, when the input is a polynomial the code callsfrom_polynomial
. This is very different from what is happening with the quasimodular forms.Ok, so maybe the element constructor of
ModularFormsRing
should not callfrom_polynomial
. What do you think?
I think it would be fine to allow both. It just needs more parsing of the input
 univariate polynomial ring with generator
q
> qexpansion (raise aNotImplementedError
for now)  multivariate polynomial ring with rational or finite field coefficients > call
from_polynomial
as it is now.
comment:37 Changed 16 months ago by
Commit:  5a373a38666a69425f68ee716ddff1a7ca61e588 → 6884d6d2a6a1e5b5f498749d5a426f3927884c80 

comment:38 Changed 15 months ago by
Commit:  6884d6d2a6a1e5b5f498749d5a426f3927884c80 → 31432ae6112e7a31873906ddcf7fb49729de789e 

Branch pushed to git repo; I updated commit sha1. New commits:
31432ae  fixed input parsing for qexpansion, added documentation to reference manual, added a bibliographical reference

comment:39 Changed 15 months ago by
Commit:  31432ae6112e7a31873906ddcf7fb49729de789e → 377d88bbb7f7af348c2a63b20a9bb23a90c85dc7 

comment:40 Changed 15 months ago by
Commit:  377d88bbb7f7af348c2a63b20a9bb23a90c85dc7 → 100f0795427069860fe58475e2f8df6884f01577 

Branch pushed to git repo; I updated commit sha1. New commits:
100f079  added missing newline, fix capitalization of title

comment:41 followup: 42 Changed 15 months ago by
Two small remarks:
In the element, why are you storing both the polynomial and its coefficients? The latter is only used in q_expansion
for which you could have use equally the polynomial.
The methods is_modular_form
and is_graded_modular_form
are not quite right for the zero element as
sage: QQ['x'].zero().degree() 1
comment:42 Changed 15 months ago by
Two small remarks:
In the element, why are you storing both the polynomial and its coefficients? The latter is only used in
q_expansion
for which you could have use equally the polynomial.
Since the coefficient attribute is used only once, I will drop it.
The methods
is_modular_form
andis_graded_modular_form
are not quite right for the zero element assage: QQ['x'].zero().degree() 1
Oops, thanks for finding this! I had forgotten that there was a special rule for the degree of the zero polynomial. I'll fix this.
comment:43 Changed 15 months ago by
Commit:  100f0795427069860fe58475e2f8df6884f01577 → 20e633e7622fbc3097458b6c860772f21fba19e0 

Branch pushed to git repo; I updated commit sha1. New commits:
20e633e  removed _coefficients attribute, fix bug in is_graded_modular_form and is_modular_form, fix pyflakes

comment:44 Changed 15 months ago by
Status:  needs_review → positive_review 

comment:45 Changed 14 months ago by
Branch:  u/ghDavidAyotte/implementation_of_the_graded_quasimodular_forms_ring → 20e633e7622fbc3097458b6c860772f21fba19e0 

Resolution:  → fixed 
Status:  positive_review → closed 
New commits:
Initial implementation of quasimodular forms