Modular forms membership testing bug

54 views
Skip to first unread message

David Loeffler

unread,
Oct 3, 2012, 5:20:06 AM10/3/12
to sage-...@googlegroups.com
I just hit this bug in the wild while doing some modular forms computations:

masiao@fermat:~$ sage
----------------------------------------------------------------------
| Sage Version 5.3, Release Date: 2012-09-08                         |
| Type "notebook()" for the browser-based notebook interface.        |
| Type "help()" for help.                                            |
----------------------------------------------------------------------
sage: M = ModularForms(Gamma0(17), 4)
sage: v = M.q_expansion_basis(prec=10)[0]
sage: v in M
False

Oddly "M(v)" works if v corresponds to a q-expansion of a form in M, and raises an error if it doesn't -- as it should do -- so there is something going wrong in the code for __contains__. Does anyone know what might be causing this?

David

Maarten Derickx

unread,
Oct 3, 2012, 7:57:24 PM10/3/12
to sage-...@googlegroups.com
The reason is that q_expansion_basis returns power series and not modular forms:

sage: M = ModularForms(Gamma0(17), 4)
sage: M.basis()[0].parent()
Modular Forms space of dimension 6 for Congruence Subgroup Gamma0(17) of weight 4 over Rational Field
sage: M.basis()[0] in M
True
sage: M.q_expansion_basis()[0].parent()
Power Series Ring in q over Rational Field

David Loeffler

unread,
Oct 4, 2012, 5:24:07 AM10/4/12
to sage-...@googlegroups.com
On 4 October 2012 00:57, Maarten Derickx <m.derick...@gmail.com> wrote:
> The reason is that q_expansion_basis returns power series and not modular
> forms:

Yes, I know, but in practice one often wants to know if a given power
series is the q-expansion of an element of the space, and it seems
strange to me that you can do this by the ugly method of calling
"M(v)" and testing whether it raises an error, but you can't just use
"in". Maybe it's a matter of taste.

David

William Stein

unread,
Oct 4, 2012, 12:52:15 PM10/4/12
to sage-...@googlegroups.com
You're probably right, given the way in tends to work, e.g.,

sage: GF(3)(2) in ZZ
True

sage: 7/1 in ZZ
True

>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To post to this group, send email to sage-...@googlegroups.com.
> To unsubscribe from this group, send email to sage-devel+...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
Reply all
Reply to author
Forward
0 new messages