Open fafcb8fb-f679-4d5a-b5d7-a3b49c3076ce opened 12 years ago
Description changed:
---
+++
@@ -1,10 +1,11 @@
+
+```
sage: P.<t> = PolynomialRing(QQ)
sage: F.<a> = FractionField(P)
sage: Pxy.<x,y> = PolynomialRing(F,2)
sage: f = y^2 - x*(x-1)*(x-2)
sage: E = EllipticCurve(f)
-
----
+---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/kohel/<ipython console> in <module>()
@@ -31,5 +32,5 @@
sage: f = y^2 - x*(x-1)*(x-2)
sage: type(f.degrees())
<type 'tuple'>
-
+```
The elliptic curve example above is a red herring, except to show that this unexpected and inconsistent return type is likely to create major issues elsewhere. I can imagine a resolution to this particular issue by defining a coercion from tuples so that the comparison does not fail, but someone knowledgeable about the design of polynomial rings and/or coercions needs to look at this. Note that a coercion does exist and parent(x.degrees())((1,0)) == x.degrees() returns True.
Simplified issue:
sage: F = FractionField(PolynomialRing(QQ,'t'))
sage: Pxy.<x,y> = PolynomialRing(F,2)
sage: f = y^2 - x*(x-1)*(x-2)
sage: f.degrees()
(3, 2)
sage: f.degrees() == (3,2)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-94-a14e4537ede5> in <module>()
----> 1 f.degrees() == (Integer(3),Integer(2))
TypeError: Argument 'other' has incorrect type (expected
sage.rings.polynomial.polydict.ETuple, got tuple)
The elliptic curve example above is a red herring, except to show that this unexpected and inconsistent return type is likely to create major issues elsewhere. I can imagine a resolution to this particular issue by defining a coercion from tuples so that the comparison does not fail, but someone knowledgeable about the design of polynomial rings and/or coercions needs to look at this. Note that a coercion does exist and parent(x.degrees())((1,0)) == x.degrees() returns True.
Component: number theory
Author: David Kohel
Issue created by migration from https://trac.sagemath.org/ticket/12040