#7654: Conversion bug in MPolynomialRing_libsingular
-----------------------------------+----------------------------------------
Reporter: SimonKing | Owner: malb
Type: defect | Status: new
Priority: critical | Milestone: sage-4.7.1
Component: commutative algebra | Keywords: conversion libsingular
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
-----------------------------------+----------------------------------------
Comment(by SimonKing):
Replying to [comment:5 malb]:
> Okay, but my patch does not fix this.
>
> So, what behaviour do we want?
> a) when the number of variables match
> b) when the number of variables do not match?
Time for a little advertisement: At #8821 and #11490, I suggest to add a
section in the guided tour resp. a thematic tutorial explaining coercion
in Sage (both needs review). At least in #11490, I try to explain the
rationale behind the conversion of polynomials in Sage.
I think we should have the following rules:
Let P and Q be polynomial rings, over the same base ring (for simplicity).
If the set of variable names of P is a subset of the set of variable names
of Q then the conversion from P to Q is name preserving, and it is used as
a coercion. That is how it currently works.
{{{
sage: P.<a,b,c> = QQ[]
sage: Q = QQ['c','b','d','a']
sage: f = Q.coerce_map_from(P)
sage: f(a),f(b),f(c)
(a, b, c)
}}}
Otherwise, we should have a position preserving conversion - regardless
whether the number of variables matches or not. If the number of variables
of P is bigger than of Q, then the conversion is only defined on a sub-
ring of P. In any case, that conversion must not be used as a coercion.
Note that at the moment we only have that behaviour if the number of
variables matches:
1. Q has more variables than P:
{{{
sage: P.<a,b,c> = GF(2)[]
sage: Q = GF(2)['c','b','d','e']
sage: f = Q.convert_map_from(P)
sage: f(a)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1154, 0))
...
}}}
I suggest that one should have
{{{
sage: f(a), f(b), f(c) # not implemented
(c, b, d)
}}}
2. Q has as many variables as P:
{{{
sage: P.<a,b,c> = GF(2)[]
sage: Q = GF(2)['c','b','d']
sage: f = Q.convert_map_from(P)
sage: f(a),f(b),f(c)
(c, b, d)
}}}
I think that's fine.
3. Q has less variables than P:
{{{
sage: P.<a,b,c> = GF(2)[]
sage: Q = GF(2)['c','d']
sage: f = Q.convert_map_from(P)
sage: f(a)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1154, 0))
...
}}}
I suggest that one should have
{{{
sage: f(a), f(b) # not implemented
(c, d)
sage: f(c)
Traceback (most recent call last):
...
TypeError: That polynomial ring only has 2 variables
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7654#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.