[sage-support] Re: Coercion question

2024-07-31 Thread 'Andrew' via sage-support
Thanks Nils. Actually, I think that what I need is a conversion rather than a coercion as `register_as_conversion()` lets me change the category. On Wednesday 31 July 2024 at 2:49:16 am UTC+10 Nils Bruin wrote: > On Monday 29 July 2024 at 22:13:27 UTC-7 Andrew wrote: > > [Not sure if this belong

[sage-support] Re: Coercion question

2024-07-30 Thread Nils Bruin
On Monday 29 July 2024 at 22:13:27 UTC-7 Andrew wrote: [Not sure if this belongs here or in sage-dev...] I am trying to implement coercions between algebras that are related by base change. For example,consider A=CombinatorialFreeModule(ZZ['x'], ['1','2']) B=CombinatorialFreeModule(ZZ, ['1','2'

[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri
On Jul 5, 8:39 pm, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 5, 2008, at 7:16 PM, John H Palmieri wrote: > > > > > > >>> would be good enough?  (That is, assuming I've defined a reasonable > >>> __eq__ method for the parents, the SteenrodAlgebra class.) > > >> Yes, though that will mea

[sage-support] Re: coercion question

2008-07-05 Thread Robert Bradshaw
On Jul 5, 2008, at 7:16 PM, John H Palmieri wrote: >> >>> would be good enough? (That is, assuming I've defined a reasonable >>> __eq__ method for the parents, the SteenrodAlgebra class.) >> >> Yes, though that will mean something like A5.P(2) - A5.P(2) == 0 will >> return False. This is why you

[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri
On Jul 5, 5:48 pm, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 5, 2008, at 12:42 PM, John H Palmieri wrote: > > > > > > 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:

[sage-support] Re: coercion question

2008-07-05 Thread Robert Bradshaw
On Jul 5, 2008, at 12:42 PM, John H Palmieri wrote: >> >> 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 >

[sage-support] Re: coercion question

2008-07-05 Thread Robert Bradshaw
On Jul 5, 2008, at 12:50 PM, John H Palmieri wrote: > On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> > wrote: >> On Jul 4, 2008, at 1:52 PM, John H Palmieri wrote: >> >>> >>> I still don't understand two things: why the gen method is being >>> used, >>> and why if I multiply an element

[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri
On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > 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

[sage-support] Re: coercion question

2008-07-05 Thread John H Palmieri
On Jul 5, 10:08 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > 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

[sage-support] Re: coercion question

2008-07-05 Thread Robert Bradshaw
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? >>

[sage-support] Re: coercion question

2008-07-04 Thread John H Palmieri
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 > >> a

[sage-support] Re: coercion question

2008-07-04 Thread Robert Bradshaw
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.

[sage-support] Re: coercion question

2008-07-04 Thread John H Palmieri
On Jul 4, 10:25 am, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Jul 4, 2008, at 7:12 AM, John H Palmieri wrote: > > > 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 n

[sage-support] Re: coercion question

2008-07-04 Thread Robert Bradshaw
On Jul 4, 2008, at 7:12 AM, John H Palmieri wrote: > 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 > > s