# Reduction of a basis of a space of modular forms [closed]

I am trying to find the row reduced basis of q-expansions of the space of classical modular forms of weight k0+i(p-1) and level 1, in the ring "Quotient ring of Power Series Ring in q over Integer Ring by the ideal (p^mp, q^(l*p))". I can calculate the basis in Z[[q]], but then I need to reduce to the quotient ring by the ideal, and I can't figure out how to do that correctly. My code so far is:

p =5; mp = 12; l=4
R.<q> = PowerSeriesRing(ZZ)
H=QuotientRing(R,(p^mp,q^(l*p)))
def Mrr(k0,i):
return ModularForms(Gamma1(1),k0+i*(p-1)).echelon_basis()


Where k0,p,mp and l are variables that I calculate earlier in the program. In this case, they are: k0=2, p=5, mp=12 and l=4. Then, for example, one of the bases I can calculate is:

Mrr(2,5)
[
1 - 14904*q^2 - 74330112*q^3 - 31251675960*q^4 - 3388310175744*q^5 + O(q^6),
q - 288*q^2 - 128844*q^3 - 2014208*q^4 + 21640950*q^5 + O(q^6)
]


But then, I don't know how to reduce modulo the ideal. I tried doing Mrr(2,5).change_ring(H), but that simply gives the following error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-38-2707b3625883> in <module>
----> 1 Mrr(Integer(2),Integer(5)).change_ring(H)

/opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/sequence.py in __getattr__(self, name)
882             return self.__hash
883         else:
--> 884             raise AttributeError("'Sequence_generic' object has no attribute '%s'"%name)
885 seq = Sequence
886

AttributeError: 'Sequence_generic' object has no attribute 'change_ring'


That seems to indicate to me that I should be using some different function to do the reduction to the quotient ring, but I don't know what. I also tried Mrr(2,5)[0].change_ring(H), but that also returned an error message:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-39-b8315ebe287f> in <module>
----> 1 Mrr(Integer(2),Integer(5))[Integer(0)].change_ring(H)

/opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4709)()
491             AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
492         """
--> 493         return self.getattr_from_category(name)
494
495     cdef getattr_from_category(self, name):

/opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4821)()
504         else:
505             cls = P._abstract_element_class
--> 506         return getattr_from_other_class(self, cls, name)
507
508     def __dir__(self):

/opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2551)()
365         dummy_error_message.cls = type(self)
366         dummy_error_message.name = name
--> 367         raise AttributeError(dummy_error_message)
368     cdef PyObject* attr = instance_getattr(cls, name)
369     if attr is NULL:

AttributeError: 'ModularFormsAmbient_g0_Q_with_category.element_class' object has no attribute 'change_ring'


Can someone tell me what I'm doing wrong?

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by Rune close date 2022-01-30 19:57:30.729857

For me, on 9.5.rc4, I get another error earlier:

sage: H
Quotient of Power Series Ring in q over Integer Ring by the ideal (244140625, q^20)
sage: ModularForms(Gamma1(1),22,H)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/GitBox/sage/local/lib/python3.9/site-packages/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCaller.__call__ (build/cythonized/sage/misc/cachefunc.c:10347)()
1942             try:
-> 1943                 return cache[k]
1944             except TypeError:  # k is not hashable

KeyError: ((True,), ())

During handling of the above exception, another exception occurred:
NotImplementedError ...

( 2022-01-25 10:27:13 +0200 )edit

Ah, I see the issue. It should have been return ModularForms(Gamma1(1),k0+i*(p-1)).echelon_basis() rather than return ModularForms(Gamma1(1),k0+i*(p-1),H).echelon_basis(). If you make that change, then it gives the error message I stated in the question.

( 2022-01-27 22:25:00 +0200 )edit

Sort by » oldest newest most voted

This is a hack, but it does the job:

[ H( sage_eval(str(t),locals={'q':q}) ) for t in Mrr(2,5) ]

more