# 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?

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

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.