Ring of quasimodular forms as a commutative ring

asked 2024-04-12 22:44:32 +0100

seewoo5 gravatar image

updated 2024-04-15 07:49:10 +0100

FrédéricC gravatar image

I'm trying to implement a polynomial ring of two variables, where the coefficient ring is the ring of quasimodular forms (code). I did

QM = QuasiModularForms(1)
PQM.<v1,v2> = QM['v1,v2']

and I got the following error:

TypeError                                 Traceback (most recent call last)
Cell In [9], line 2
      1 QM = QuasiModularForms(Integer(1))
----> 2 PQM = QM['v1,v2']; (v1, v2,) = PQM._first_ngens(2)

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/parent.pyx:1274, in sage.structure.parent.Parent.__getitem__ (build/cythonized/sage/structure/parent.c:11540)()
   1272         except AttributeError:
   1273             return self.list()[n]
-> 1274     return meth(n)
   1275 
   1276 #########################################################################

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/categories/rings.py:1220, in Rings.ParentMethods.__getitem__(self, arg)
   1217 # 2. Otherwise, try to return a polynomial ring
   1219 from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
-> 1220 return PolynomialRing(self, elts)

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py:693, in PolynomialRing(base_ring, *args, **kwds)
    690         raise TypeError("variable names specified twice inconsistently: %r and %r" % (names, kwnames))
    692 if multivariate or len(names) != 1:
--> 693     return _multi_variate(base_ring, names, **kwds)
    694 else:
    695     return _single_variate(base_ring, names, **kwds)

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/rings/polynomial/polynomial_ring_constructor.py:844, in _multi_variate(base_ring, names, sparse, order, implementation)
    842     else:
    843         constructor = multi_polynomial_ring.MPolynomialRing_polydict
--> 844     R = constructor(base_ring, n, names, order)
    846 if R is None:
    847     raise ValueError("unknown implementation %r for multivariate polynomial rings" % (implementation,))

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_ring.py:130, in MPolynomialRing_polydict.__init__(self, base_ring, n, names, order)
    128 self._gens = tuple(self._gens)
    129 self._zero_tuple = tuple(v)
--> 130 MPolynomialRing_base.__init__(self, base_ring, n, names, order)
    131 self._has_singular = can_convert_to_singular(self)

File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_ring_base.pyx:84, in sage.rings.polynomial.multi_polynomial_ring_base.MPolynomialRing_base.__init__ (build/cythonized/sage/rings/polynomial/multi_polynomial_ring_base.c:4101)()
     82 """
     83 if base_ring not in _CommutativeRings:
---> 84     raise TypeError("The base ring %s is not a commutative ring" % base_ring)
     85 
     86 n = int(n)

TypeError: The base ring Ring of Quasimodular Forms for Modular Group SL(2,Z) over Rational Field is not a commutative ring

So first of all, the ring of quasimodular forms is a commutative ring - the default coefficient is over the rationals. I tried to look at the details of the implementation, and here's what I found. The ring QuasiModularForms is essentially a polynomial ring of one variable (E2) with coefficient ModularForms (code), and the ring ModularForms is also a polynomial ring with certain generators. Hence if the base field is just rationals QQ, then everything should be a commutative ring (which is true mathematically). I wonder if there's a way to make it as a commutative ring in Sage. Thanks in advance.

edit retag flag offensive close merge delete

Comments

Somebody must fix the category of the ring of quasi-modular forms:

sage: QM.category()
Category of graded algebras over Rational Field
FrédéricC gravatar imageFrédéricC ( 2024-04-13 09:15:40 +0100 )edit
FrédéricC gravatar imageFrédéricC ( 2024-04-13 11:14:21 +0100 )edit

@FredericC Thank you for your comment and PR (I just approved). Is there a shortcut to fix it before your PR is merged to the dev branch? e.g. by making a wrapper class?

seewoo5 gravatar imageseewoo5 ( 2024-04-13 20:16:06 +0100 )edit
1

maybe

sage: QM=QuasiModularForms(1)
sage: QM.category()
Category of graded algebras over Rational Field
sage: QM._refine_category_(QM.category().Commutative())
sage: QM.category()
Category of commutative graded algebras over Rational Field
FrédéricC gravatar imageFrédéricC ( 2024-04-13 21:15:57 +0100 )edit