On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote:

>
>
>
> On Jul 4, 10:53 am, Robert Bradshaw <[EMAIL PROTECTED]>
> wrote:
>> 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).
>>
>
> I still don't understand two things: why the gen method is being used,
> and why if I multiply an element of SteenrodAlgebra(7) by 3, somehow
> elements of SteenrodAlgebra(5) are getting involved.

I'm not seeing where the gen method is being used--it's probably to  
get a "generic" element to see if multiplication is a viable option.  
As for elements of SteenrodAlgebra(7) and SteenrodAlgebra(5) getting  
compared, that's because it's looking up something in a (global-ish)  
lookup table that happens to have SteenrodAlgebra(5) in it as well.  
Obviously equality here should return False.

- Robert


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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