On Wed, Mar 26, 2008 at 11:42 AM, Craig Citro <[EMAIL PROTECTED]> wrote: > > Hey all, > > (I'm cc'ing this to sage-devel, because I think there are people there > who care about modular forms who might not read sage-support.) > > So I've also posted a patch on #2674, which actually fixes both of > these issues, as well as the fact that it currently is the case that > adding an element of CuspForms(22) to an element of ModularForms(22) > breaks. > > Now, I agree with William's point here: > > > > Note that > > > > b[0] + 0 > > > > and > > > > 0 + b[0] > > > > should *not* work, since in each case that's a canonical coercion, > > and there is no natural map from ZZ (the parent of 0) into CuspForms(...) > > for any weight except 0. In Sage coercions should not happen > automatically > > unless they are in some way natural and well defined on the whole domain > > of the coercion (in this case ZZ). > > > > However, the modular forms code isn't the culprit -- it just tries to > coerce in by calling the coercion code for the underlying free module. > Here's why this actually works: > > sage: M = ZZ**3 > sage: M(0) > (0, 0, 0) > sage: M(1) # goes boom
Wait -- it's perfectly fine that M(0) works! It's only bad if this were to work: sage: M._coerce_impl(0) (0, 0, 0) In fact, the above does work. That's because this code is wrong: def _coerce_impl(self, x): """ Canonical coercion of x into this free module. (0, 4/3, 8/3, 4, 16/3) """ if isinstance(x, (int, long, sage.rings.integer.Integer)) and x==0: return self.zero_vector() ... > > > > > There are some canonical coercions that one *should* have in the context > > of modular forms that aren't there, probably partly because this whole > > "canonical > > coercions" business was after I wrote the modular forms code. Here's > > an example bug (=lack of a coercion that should be there): > > > > > > sage: b=CuspForms(22).basis() > > sage: sum(b, b[0].parent()(0)) > > This now works fine with the patch I posted to #2674. > > Currently, there are no coercions between different levels; which such > coercions would people like to see? The map f(q) |--> f(q) is a canonical coercion from level Gamma to level Gamma' for any subgroup Gamma' of Gamma. It's the 1-th degeneracy map, but is the most canonical since it is the identity map on q-expansions. > Coercing from Gamma0(M) to > Gamma0(Md) seems plausible, though one argue that it's a choice of one > specific degeneracy map. That is, it seems "standard" but not > canonical. I think it's the same as asking for a natural map from > ZZ['x'] to ZZ['y']. I disagree. A modular form -- viewed as a function on the upper half plane -- for Gamma0(M) is automatically also one for Gamma0(Md) in a canonical way. It's invariant under the smaller group. > Of course, this works in Sage, so maybe the above > map should, too. Maybe also maps from Gamma0 to Gamma1 and GammaH? And > GammaH to Gamma1? Whenever one group is contained in another, coerce. > Which maps seem reasonable to people? Jay, are there any of these that > you would expect to work that don't? > > -cc > > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---