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?
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
Le mercredi 3 octobre 2012 11:20:06 UTC+2, David Loeffler a écrit :
> 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?
On 4 October 2012 00:57, Maarten Derickx <m.derickx.stud...@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.
<d.a.loeff...@warwick.ac.uk> wrote:
> On 4 October 2012 00:57, Maarten Derickx <m.derickx.stud...@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
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-devel@googlegroups.com.
> To unsubscribe from this group, send email to sage-devel+unsubscribe@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