I'm running into a coercion problem. I'm trying to define a class SteenrodAlgebra (based on the Algebra class); there should be one Steenrod algebra for each prime number p, and it is an algebra over GF(p). For example, you can do
sage: A5 = SteenrodAlgebra(5) sage: A7 = SteenrodAlgebra(7) I have coercion working properly for addition, but not multiplication, and I really don't know why. One way to define elements is to use a method called "P": sage: v = A5.P(1,2,3) sage: w = A7.P(4,5) The identity element of the Steenrod algebra is called P(0), and I have a _coerce_impl method which seems to work: it seems to coerce a scalar into the appropriate scalar multiple of P(0): sage: 3 + v 3 P(0) + P(1,2,3) sage: 11 + w # addition here is mod 7 4 P(0) + P(4,5) Multiplication is broken, though: sage: 3 * v # this works 3 P(1,2,3) sage: 11 * w gives me a traceback, and it appears that the problem is that Sage is testing whether A5.gen(0) is equal to A7.gen(0). Why is A7.gen(0) involved? I mean, w is in A7, but why is Sage interested in its 0th generator? And why is A5.gen(0) involved in this at all, when I'm trying to multiply an element of A7 by an integer (which should coerce to an element of GF(7), and then into A7)? If I interchange the order of evaluation here, doing 11 * w before 3 * v, then 11 * w works, while 3 * v gives the error. By putting in some print statements in various places, I can see that even when 3 * v works, it is still calling A5.gen(0) the first time it is called; subsequent times, it doesn't call this. (Is Sage caching information about generators somewhere, and is that perhaps causing problems, because I've done something wrong and not distinguished sufficiently between Steenrod algebras at different primes?) So I'm very confused. Any ideas what I should look at to try to fix this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---