Re: [sage-devel] coercion issue

2015-02-06 Thread Robert Bradshaw
Interesting. It seems the problem is that cm.discover_action(GF(5), ZZ, operator.div) tries to look for a right action on of cm.discover_action(GF(5), Frac(ZZ), operator.mul) which doesn't exist as there are no coercions between GF(5) and QQ. I posted a patch to http://trac.sagemath.or

Re: [sage-devel] coercion issue

2015-02-05 Thread Jonas Jermann
Hi Set x=GF(5)['x'].gen() I dunno if this helps but here is an explanation why one gets a different behavior for x/7 than cm.bin_op(x,7,operator.div): If you do "x/7" then I think it calls __div__ from polynomial_element (Polynomial class): try: if not isinstance(right, Element) or right.pa

Re: [sage-devel] coercion issue

2015-02-05 Thread Vincent Delecroix
2015-02-05 21:38 UTC+01:00, John Cremona : > If you ask for operator.mul instead of operator.div then you get the > poly ring. Is that it, perhaps? Nope. I want to get rid of many hacks in rings/polynomial. In order to do that I need the div operation to be correctly handled by the coercion (or p

Re: [sage-devel] coercion issue

2015-02-05 Thread John Cremona
If you ask for operator.mul instead of operator.div then you get the poly ring. Is that it, perhaps? John On 5 February 2015 at 18:48, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > sage: cm = sage.structure.element.get_coercion_model() > sage: cm.explain(GF(5)['x'], ZZ, operator.div) >

[sage-devel] coercion issue

2015-02-05 Thread Vincent Delecroix
sage: cm = sage.structure.element.get_coercion_model() sage: cm.explain(GF(5)['x'], ZZ, operator.div) Coercion on right operand via Composite map: From: Integer Ring To: Univariate Polynomial Ring in x over Finite Field of size 5 Defn: Natural morphism: From:

[sage-devel] Coercion issue: is this a bug?

2011-05-04 Thread Jason Bandlow
Hello, I'm not sure if I should open a ticket on the following issue, or if this is just a case of "Error Between Keyboard And Chair". Here is a simplified version of what happened. I had parents A and B and map phi between them, as follows: sage: A = CombinatorialFreeModule(ZZ,[1,2,3],prefix='X

[sage-devel] coercion issue?

2009-05-29 Thread dmharvey
Is this a bug? sage: version() 'Sage Version 3.4.2, Release Date: 2009-05-05' sage: S. = PolynomialRing(Integers(14641)) sage: f = 1 + 9581*t sage: R = PolynomialRing(Integers(1331), "t") sage: ff = f.change_ring(R) sage: ff 264*t + 1 sage: type(f) sage: type(ff) sage: ff[0] 264*t + 1 sage: f[0

[sage-devel] Coercion issue between sparse and dense polynomial rings

2008-06-26 Thread Carl Witty
Consider the following Sage run, from Sage 3.0.3: sage: x1 = PolynomialRing(ZZ, 'x').gen() sage: x2 = PolynomialRing(ZZ, 'x', sparse=True).gen() sage: (x1+x2).parent() Univariate Polynomial Ring in x over Integer Ring sage: (x2+x1).parent() Univariate Polynomial Ring in x over Integer Ring where