[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'

Re: [sage-support] Re: Coercion bug message when working with group algebras

2022-08-11 Thread keirh...@gmail.com
Ah, thanks! On Thursday, August 11, 2022 at 4:12:34 PM UTC-4 trevor...@gmail.com wrote: > There is a description/proposed fix of the problem on this trac ticket: > https://trac.sagemath.org/ticket/34292 > > On Thursday, August 11, 2022 at 12:44:59 PM UTC-7 keirh...@gmail.com > wrote: > >> This

Re: [sage-support] Re: Coercion bug message when working with group algebras

2022-08-11 Thread Trevor Karn
There is a description/proposed fix of the problem on this trac ticket: https://trac.sagemath.org/ticket/34292 On Thursday, August 11, 2022 at 12:44:59 PM UTC-7 keirh...@gmail.com wrote: > This code: > > > > > *H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])kH = > H.algebra(GF(2)

Re: [sage-support] Re: Coercion bug message when working with group algebras

2022-08-11 Thread keirh...@gmail.com
This code: *H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])kH = H.algebra(GF(2))[a, b] = H.gens()# Produces no coercion errorprint((kH(a) + kH(b) + H.one())^2)# Produces a coercion error in all cases belowtry: print((kH(a) + kH(b) + kH(kH.one()))^2)ex

Re: [sage-support] Re: Coercion bug message when working with group algebras

2022-08-06 Thread Trevor Karn
Is the x you give in these examples the same x as above? I’m worried (maybe needlessly) about if the x you give includes a summand of kH.one(). If the x you give does not include a summand of one, then the behavior you described is consistent with what I think the problem is. If the x in the new ex

[sage-support] Re: Coercion bug message when working with group algebras

2022-08-06 Thread keirh...@gmail.com
Thanks for this workaround. I was passing the group algebra to a function and then accessing the base group like so: kH.group() Both of the following cause the coercion error: kH.one() * x kH.group().one() * x But this works fine: H.one()*x I will just have to pass the original group along a

[sage-support] Re: Coercion bug message when working with group algebras

2022-08-06 Thread Trevor Karn
I can reproduce this on 9.7.beta7. The problem is that the parent is not understood to be the same (even though it clearly is). A workaround is: sage: x = kH(a) + kH(b) + kH(H.one()); x () + (5,6,7)(12,14,18) + (1,2)(3,4) sage: x*x (5,7,6)(12,18,14) Here H.one() puts the one in the right pa

[sage-support] Re: Coercion bug message when working with group algebras

2022-08-05 Thread keirh...@gmail.com
The Sage version I was using is 9.6. On Friday, August 5, 2022 at 7:19:48 PM UTC-4 keirh...@gmail.com wrote: > When I do this: > > > > > > *H = PermutationGroup([ [(1,2), (3,4)], [(5,6,7),(12,14,18)] ])kH = > H.algebra(GF(2))[a, b] = H.gens()x = kH(a) + kH(b) + kH.one(); print(x)x*x* > > I get a

[sage-support] Re: coercion failure?

2016-05-01 Thread Volker Braun
ZZ and RDF have string representations as '123' and '123.456', respectively. The analog for QQ is sage: QQ('123/456') 41/152 On Sunday, May 1, 2016 at 4:14:42 AM UTC+2, kcrisman wrote: > > RDF('0.0') is fine > QQ(RDF('0.0')) is fine > QQ('0') is fine > That one is really just QQ(ZZ('0')) using

[sage-support] Re: Coercion between polynomial rings gives parent sympy.core.add.Add

2014-03-18 Thread Tristan
It's not that I get an error message, the problem is that the parent of g should be a multivariate polynomial ring rather than a sympy.core.add.Add class object. After copying my Python code into the worksheet rather than loading the file it works as expected, so I assume that changes the inter

[sage-support] Re: Coercion between polynomial rings gives parent sympy.core.add.Add

2014-03-17 Thread Ralf Stephan
I have no problems running your code with nfs(137,1000,2,36). Please post your full error message. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+

[sage-support] Re: Coercion between polynomial rings gives parent sympy.core.add.Add

2014-03-17 Thread Tristan
It appears that I was wrong about what was causing the problem as I still get the error. I've moved to using the cloud version as I had thought that there is a problem with my installation. Ideally I want to take a given integer and construct a polynomial from its base m expansion for some n. T

[sage-support] Re: Coercion between polynomial rings gives parent sympy.core.add.Add

2014-03-17 Thread Tristan
Thanks for the pointer towards the relevance of my observation. I was using Python code to generate the polynomial in the case when it didn't work, and copying the same code into the Sage worksheet avoids the error. I'm still a little unsure as to why the parent of the f was the univariate polyn

[sage-support] Re: Coercion between polynomial rings gives parent sympy.core.add.Add

2014-03-16 Thread Nils Bruin
On Sunday, March 16, 2014 6:45:03 AM UTC-7, Tristan wrote: > > I'm not sure if it's relevant but my polynomial f is defined by taking a > list of coefficients and then adding relevant powers of u multiplied by > each coefficient to an initial 0 polynomial. I mention this because if I > define th

[sage-support] Re: coercion does work in 4.5.2, does not work in 4.6(.2)

2011-05-03 Thread Nils Bruin
On May 3, 7:23 pm, Nils Bruin wrote: > See a.log_to_int? for help. ... which says "Use int(self) to directly get a Python int." so it looks like you have found a bug in the documentation! You help the project if you would file a report and you would really help if you'd also include the fix (dele

[sage-support] Re: coercion does work in 4.5.2, does not work in 4.6(.2)

2011-05-03 Thread Nils Bruin
On May 3, 3:28 pm, eggartmumie wrote: > Hi, > > as a newbie I am rather irritated about coercion working in 4.5.2 and > not working in 4.6. > In 4.5.2 the following works nicely and up to expectation > > F.=GF(2^4); > for i in range(15): >     a = x^i; print a,'with integer representation', int(a)

[sage-support] Re: coercion bug + help please

2010-01-15 Thread Pierre
i'm afraid i don't know how tickets work. Incidentally, i'll be attending sage-days in marseille next month, is this an occasion to learn about tickets and all that ? as for the bug, i've been using x.complex_embedding() instead, which doesn't crash. How reliable can its output be, though ? On 14

[sage-support] Re: coercion bug + help please

2010-01-14 Thread Pierre
hi, i've just compiled a sage 4.3 from scratch (rather than update), and the problem is still there... thoughts anyone ? thanks! On 14 jan, 13:37, Pierre wrote: > hello, > > this must be the slowest reply in the history of sage. More than a > month later, i have upgraded and am now running sage

[sage-support] Re: coercion bug + help please

2010-01-14 Thread Pierre
hello, this must be the slowest reply in the history of sage. More than a month later, i have upgraded and am now running sage 4.3. When i enter your lines : > sage: k. = CyclotomicField(4) > sage: R. = k[] > sage: p=3; K. = NumberField(x^2-p) > sage: i = K(k.gen()) > sage: CDF(i) ... i get a ve

[sage-support] Re: Coercion into power series ring

2009-06-09 Thread Ajay Rawat
thank you. On Tue, Jun 9, 2009 at 6:31 PM, Kwankyu wrote: > > Hi, > > > On Jun 9, 7:22 pm, Ajay Rawat wrote: > > Hi, > > I want to uninstall sage 3.2.3 from my ubuntu 8.04 LTS. > > so that i can install sage 4.0. > > what i have to do. > > Thanking you > > Are you asking me? Just delete the Sa

[sage-support] Re: Coercion into power series ring

2009-06-09 Thread Kwankyu
Hi, On Jun 9, 7:22 pm, Ajay Rawat wrote: > Hi, > I want to uninstall  sage 3.2.3 from my ubuntu 8.04 LTS. > so that i can install sage 4.0. > what i have to do. > Thanking you Are you asking me? Just delete the Sage root directory wherever it is (usually /usr/local/sage). Then install the newe

[sage-support] Re: Coercion into power series ring

2009-06-09 Thread Ajay Rawat
Hi, I want to uninstall sage 3.2.3 from my ubuntu 8.04 LTS. so that i can install sage 4.0. what i have to do. Thanking you -- Ajay Rawat Kalpakkam, IGCAR - Save Himalayas

[sage-support] Re: Coercion into power series ring

2009-06-09 Thread Kwankyu
Hi Robert, Thank you for the explanation. Kwankyu --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group a

[sage-support] Re: Coercion into power series ring

2009-06-09 Thread Robert Bradshaw
On Jun 8, 2009, at 5:50 PM, Kwankyu wrote: > I tried change_ring(), without success... > > sage: R.=PowerSeriesRing(QQ) > sage: P.=PolynomialRing(R) > sage: f=t*x+t^2 > sage: g=f/t > sage: f > t*x + t^2 > sage: g > x + t > sage: f.parent() > Univariate Polynomial Ring in x over Power Series Rin

[sage-support] Re: Coercion into power series ring

2009-06-08 Thread Kwankyu
I tried change_ring(), without success... sage: R.=PowerSeriesRing(QQ) sage: P.=PolynomialRing(R) sage: f=t*x+t^2 sage: g=f/t sage: f t*x + t^2 sage: g x + t sage: f.parent() Univariate Polynomial Ring in x over Power Series Ring in t over Rational Field sage: g.parent() Univariate Polynomial Rin

[sage-support] Re: Coercion into power series ring

2009-06-08 Thread Kwankyu
A comparable case works well. sage: S.=ZZ[] sage: f=2*x+4; sage: f/2 x + 2 sage: S(f/2).parent() Univariate Polynomial Ring in x over Integer Ring --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this gr

[sage-support] Re: Coercion problem

2009-03-21 Thread Jason Bandlow
Robert Bradshaw wrote: > On Mar 21, 2009, at 9:06 AM, Jason Bandlow wrote: > >> Hi all, >> >> Is the following missing coercion known? I couldn't find anything on >> trac, but there's a lot there related to coercion, so I may have >> missed it. >> >> sage: a = float(1.0) >> sage: QQ(

[sage-support] Re: Coercion problem

2009-03-21 Thread Robert Bradshaw
On Mar 21, 2009, at 9:06 AM, Jason Bandlow wrote: > > Hi all, > > Is the following missing coercion known? I couldn't find anything on > trac, but there's a lot there related to coercion, so I may have > missed it. > > sage: a = float(1.0) > sage: QQ(a) > TypeError: Unable to

[sage-support] Re: coercion bug?

2009-03-16 Thread Alex Raichev
Sweet! Alex On Mar 12, 5:07 pm, William Stein wrote: > On Wed, Mar 11, 2009 at 5:23 PM, Alex Raichev wrote: > > >> What would you want to do with QQbar in the Symbolic Ring? > > > Everything: differentiate functions with coefficients in QQbar, > > integrate them, etc. > >    I too don't know a

[sage-support] Re: coercion bug?

2009-03-11 Thread William Stein
On Wed, Mar 11, 2009 at 5:23 PM, Alex Raichev wrote: > >> What would you want to do with QQbar in the Symbolic Ring? > > Everything: differentiate functions with coefficients in QQbar, > integrate them, etc. >    I too don't know anything about Maxima or the new symbolics > package in preparation

[sage-support] Re: coercion bug?

2009-03-11 Thread Alex Raichev
> What would you want to do with QQbar in the Symbolic Ring? Everything: differentiate functions with coefficients in QQbar, integrate them, etc. I too don't know anything about Maxima or the new symbolics package in preparation --Pynac is it? So, i'm just standing on the sidelines cheering

[sage-support] Re: coercion bug?

2009-03-11 Thread Robert Bradshaw
On Mar 11, 2009, at 3:50 PM, Carl Witty wrote: > > On Mar 11, 2:55 pm, Alex Raichev wrote: Well, I think I can explain what's happening. There's a coercion from arbitrary polynomials into the Symbolic Ring; this is useful, because it lets you deal with polynomials o

[sage-support] Re: coercion bug?

2009-03-11 Thread Carl Witty
On Mar 11, 2:55 pm, Alex Raichev wrote: > > > Well, I think I can explain what's happening.  There's a coercion from > > > arbitrary polynomials into the Symbolic Ring; this is useful, because > > > it lets you deal with polynomials over the rationals, etc. > > Similarly, i think a coercion from

[sage-support] Re: coercion bug?

2009-03-11 Thread Alex Raichev
> > Well, I think I can explain what's happening. There's a coercion from > > arbitrary polynomials into the Symbolic Ring; this is useful, because > > it lets you deal with polynomials over the rationals, etc. Similarly, i think a coercion from QQbar and polynomials over QQbar to the Symbolic R

[sage-support] Re: coercion bug?

2009-03-10 Thread Robert Bradshaw
On Mar 10, 2009, at 8:57 PM, Carl Witty wrote: > On Mar 10, 6:47 pm, Alex Raichev wrote: >> Does anyone know what's up with this weird error? Sage can >> multiply a >> symbolic variable and a constant of a polynomial ring R but not a >> symbolic variable and an element of R.base_ring(). >> >>

[sage-support] Re: coercion bug?

2009-03-10 Thread Carl Witty
On Mar 10, 6:47 pm, Alex Raichev wrote: > Does anyone know what's up with this weird error?  Sage can multiply a > symbolic variable and a constant of a polynomial ring R but not a > symbolic variable and an element of R.base_ring(). > > Alex > > sage: var('t') > t > sage: K.= NumberField(t^2+2,'

[sage-support] Re: Coercion vs. Conversion

2009-01-05 Thread Robert Bradshaw
On Jan 4, 2009, at 11:47 AM, ggrafendorfer wrote: > Hi Robert, > thanks for your answer, > I not sure if I know the difference between coercion and conversion, > could you explain it to me? A coercion is implicit and happens, for example, when you do arithmetic. sage: 1 + 1/2# 1 is coerced

[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

[sage-support] Re: coercion problem?

2008-06-02 Thread William Stein
On Mon, Jun 2, 2008 at 7:18 PM, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > > On Jun 2, 2008, at 6:43 PM, Mike Hansen wrote: > >> Hello, >> >> This is definitely not a problem with coercion -- it's a problem with >> the iterator for G. > > Coercion...always the scapegoat :-) > I made several opt

[sage-support] Re: coercion problem?

2008-06-02 Thread Robert Bradshaw
On Jun 2, 2008, at 6:43 PM, Mike Hansen wrote: > Hello, > > This is definitely not a problem with coercion -- it's a problem with > the iterator for G. Coercion...always the scapegoat :-) - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-

[sage-support] Re: coercion problem?

2008-06-02 Thread mabshoff
On Jun 3, 3:49 am, "David Joyner" <[EMAIL PROTECTED]> wrote: Hi, > Thanks. I reported this ashttp://trac.sagemath.org/sage_trac/ticket/3353 prun indicates that we are calling GAP in z.next() somewhere, so due to pexpect overhead this also should suck. "prun z.next()" took *35* CPU seconds on s

[sage-support] Re: coercion problem?

2008-06-02 Thread David Joyner
Thanks. I reported this as http://trac.sagemath.org/sage_trac/ticket/3353 On Mon, Jun 2, 2008 at 9:43 PM, Mike Hansen <[EMAIL PROTECTED]> wrote: > > Hello, > > This is definitely not a problem with coercion -- it's a problem with > the iterator for G. For example. try this: > > sage: z = iter(G

[sage-support] Re: coercion problem?

2008-06-02 Thread Mike Hansen
Hello, This is definitely not a problem with coercion -- it's a problem with the iterator for G. For example. try this: sage: z = iter(G) sage: z sage: z.next() [0 1] [1 0] sage: z.next() [0 1] [1 1] It takes quite a bit of time to do each .next() which makes me suspect that something silly i

[sage-support] Re: Coercion

2007-08-27 Thread Justin Walker
On Monday, August 27, 2007, at 06:37PM, "William Stein" <[EMAIL PROTECTED]> wrote: >On 8/27/07, Justin Walker <[EMAIL PROTECTED]> wrote: >> Hi, all, >> >> I do this, and get integers, but the types are rational: >> >> sage: b1=0 >> sage: b2=2 >> sage: s=(b1+b2)/2 >> sage: n=(b1-b2)/2 >> sage:

[sage-support] Re: Coercion

2007-08-27 Thread William Stein
On 8/27/07, Justin Walker <[EMAIL PROTECTED]> wrote: > Hi, all, > > I do this, and get integers, but the types are rational: > > sage: b1=0 > sage: b2=2 > sage: s=(b1+b2)/2 > sage: n=(b1-b2)/2 > sage: s > 1 > sage: n > -1 That s and n are rational is correct, since "/ is a constructor for elements

[sage-support] Re: Coercion bug?

2007-01-31 Thread Iftikhar Burhanuddin
> I imagine what the problem would be however I cannot reproduce it, where did > you run that test, is it a vanilla SAGE 2.0? My computation ran on sage-2.0 on sage.math. To replicate my traceback elsewhere you'll have to install the database_kohel-20060803 package (sage -i database_kohel-200608

[sage-support] Re: Coercion bug?

2007-01-31 Thread Martin Albrecht
Hi there, I imagine what the problem would be however I cannot reproduce it, where did you run that test, is it a vanilla SAGE 2.0? Martin This is my trackback: sage: sage: M = X.T(13).matrix() Modular polynomial database file /home/malb/SAGE/data/kohel/PolMod/Cls/pol.013.dbz not available -