#8992: Coercion of univariate quotient polynomial rings
-------------------------------------------------+--------------------------
Reporter: SimonKing | Owner: robertwb
Type: defect | Status: needs_work
Priority: major | Milestone: sage-5.1
Component: coercion | Resolution:
Keywords: coercion quotient ring sd40.5 | Work issues: Convert
string into base ring as a fail safe
Report Upstream: N/A | Reviewers: Mike Hansen
Authors: Simon King | Merged in:
Dependencies: | Stopgaps:
-------------------------------------------------+--------------------------
Changes (by SimonKing):
* status: needs_review => needs_work
* work_issues: => Convert string into base ring as a fail safe
Comment:
Replying to [comment:15 mhansen]:
> This looks pretty good to me. The one things I worry about is that the
result of sage_eval may not actually belong to the correct parent. I
would put a check to make sure that it actually does. Then, I think we
can mark this as positive review.
At the moment, we have some problem with converting a string that defines
an element of the base ring:
{{{
sage: P.<x> = QQ[]
sage: Q1 = P.quo([(x^2+1)^2*(x^2-3)])
sage: Q2 = P.quo([(x^2+1)^2*(x^5+3)])
sage: from sage.categories.pushout import pushout
sage: Q = pushout(Q1,Q2); Q
Univariate Quotient Polynomial Ring in xbar over Rational Field with
modulus x^4 + 2*x^2 + 1
sage: Q(Q1.gen())
xbar
sage: sage: Q(str(Q.gen()))
xbar
sage: Q1(x)
xbar
sage: Q1('x')
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', (2061, 0))
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', (818, 0))
---------------------------------------------------------------------------
NameError Traceback (most recent call
last)
/home/simon/SAGE/sage-5.0/devel/sage-main/<ipython console> in <module>()
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-
packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
(sage/structure/parent.c:7941)()
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3345)()
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3248)()
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-
packages/sage/rings/polynomial/polynomial_quotient_ring.pyc in
_element_constructor_(self, x)
419 # Interpretation in self has priority over interpretation
in self.__ring
420 try:
--> 421 return sage_eval(x,
GenDictWithBasering(self,self.gens_dict()))
422 except TypeError, NameError:
423 pass
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-
packages/sage/misc/sage_eval.pyc in sage_eval(source, locals, cmds,
preparse)
197 return locals['_sage_eval_returnval_']
198 else:
--> 199 return eval(source, sage.all.__dict__, locals)
200
201
/home/simon/SAGE/sage-5.0/local/lib/python2.7/site-packages/sage/all.pyc
in <module>()
NameError: name 'x' is not defined
}}}
I'd like to make that work as well, and then add a test for the correct
parent.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8992#comment:17>
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.