Opened 8 years ago

Closed 7 years ago

# The is_old method from sage.modular.modform.element.ModularFormElement doesn't work correctly

Reported by: Owned by: Snark craigcitro major sage-5.11 modular forms sd51 sage-5.11.rc0 David Loeffler Alex Ghitza N/A

### Description

```sage: E=ModularForms(3,12).cuspidal_subspace()
sage: f=E.gens()[0]
sage: g=f-f
sage: g.is_old()
False
```

This is definitely a case where sage returns a wrong answer.

### comment:1 Changed 7 years ago by davidloeffler

I traced this back to a problem with the `__contains__` method for modular forms subspaces. The problem is that it expects imprecise q-expansions, and fails badly when given the zero q-expansion as argument.

Version 0, edited 7 years ago by davidloeffler (next)

### comment:2 Changed 7 years ago by davidloeffler

Test case for the underlying bug:

```sage: R.<q> = QQ[[]]
sage: ModularForms(2, 8)(q^20 + q^120)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-101-f1640b98a1fd> in <module>()
----> 1 ModularForms(Integer(2), Integer(8))(q**Integer(20) + q**Integer(120))

/storage/masiao/sage-5.11.beta3/local/lib/python2.7/site-packages/sage/modular/modform/space.pyc in __call__(self, x, check)
1147                 x_potential = self.free_module().linear_combination_of_basis(x_potential)
1148                 x_potential = element.ModularFormElement(self, x_potential)
-> 1149                 for i in range(int(W.degree()), x.prec()):
1150                     if x_potential[i] != x[i]:
1151                         raise ValueError, "q-expansion does not correspond to a form in self"

TypeError: range() integer end argument expected, got PlusInfinity.
```

### Changed 7 years ago by davidloeffler

patch against 5.11.beta3

### comment:3 Changed 7 years ago by davidloeffler

• Authors set to David Loeffler
• Status changed from new to needs_review

### comment:4 Changed 7 years ago by AlexGhitza

• Milestone set to sage-5.11
• Reviewers set to Alex Ghitza
• Status changed from needs_review to positive_review

### comment:5 Changed 7 years ago by jdemeyer

• Merged in set to sage-5.11.rc0
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.