On Jul 4, 2008, at 10:44 AM, John H Palmieri wrote:

>>
>>> So I'm very confused.  Any ideas what I should look at to try to fix
>>> this?
>>
>> Yes, Sage caches some information so it doesn't have to do the logic
>> anew on each arithmetic operation. One thing to check is if A5 == A7
>> succeeds. If you could post the traceback I could see if anything
>> stands out to me.
>
> Here's an example.
>
> sage: A5 = SteenrodAlgebra(5); A7 = SteenrodAlgebra(7)
> sage: A5 == A7
> False
> sage: v = A5.P(2)
> sage: w = A7.P(2,1)
> sage: 2 * v
> 2 P(2)
> sage: 3 * w
> ---------------------------------------------------------------------- 
> -----
> TypeError                                 Traceback (most recent call
> last)
>
> /Users/palmieri/<ipython console> in <module>()
>
> /Users/palmieri/element.pyx in
> sage.structure.element.RingElement.__mul__ (sage/structure/element.c:
> 8545)()
>
> /Users/palmieri/coerce.pyx in
> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> structure/coerce.c:5039)()
>
> /Users/palmieri/coerce.pyx in
> sage.structure.coerce.CoercionModel_cache_maps.get_action_c (sage/
> structure/coerce.c:7864)()
>
> /Users/palmieri/coerce.pyx in
> sage.structure.coerce.CoercionModel_cache_maps.discover_action_c  
> (sage/
> structure/coerce.c:8522)()
>
> /Users/palmieri/parent.pyx in
> sage.structure.parent.Parent.get_action_c (sage/structure/parent.c:
> 1843)()
>
> /Users/palmieri/parent.pyx in
> sage.structure.parent.Parent.get_action_impl (sage/structure/parent.c:
> 2005)()
>
> /Users/palmieri/parent.pyx in
> sage.structure.parent.Parent.get_action_c_impl (sage/structure/
> parent.c:2672)()
>
> /Users/palmieri/parent.pyx in sage.structure.parent._register_pair
> (sage/structure/parent.c:6360)()
>
> /Users/palmieri/parent.pyx in sage.structure.parent.EltPair.__eq__
> (sage/structure/parent.c:6183)()
>
> /Applications/sage/local/lib/python2.5/site-packages/sage/algebras/
> steenrod_algebra.py in __eq__(self, other)
>    1528         Two elements are equal if their difference is zero.
>    1529         """
> -> 1530         difference = self - other
>    1531         return len(difference._raw['milnor']) == 0
>    1532
>
> /Users/palmieri/element.pyx in
> sage.structure.element.ModuleElement.__sub__ (sage/structure/ 
> element.c:
> 5421)()
>
> /Users/palmieri/coerce.pyx in
> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
> structure/coerce.c:5338)()
>
> TypeError: unsupported operand parent(s) for '-': 'mod 7 Steenrod
> algebra' and 'mod 5 Steenrod algebra'

Ah, it looks like your __eq__ method is assuming that self and other  
are elements of the steenrod algebra. There are two solutions to this:

1) Use __cmp__ which (in Sage) will ensure that self and other have  
the same parent before it's called
2) Fix your __eq__ (and any other comparison methods you might have)  
to make sure self-other makes sense (or, as a quick fix, catch the  
type error here).

- Robert



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to