-
-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
Description
Given a symbolic expression which is a rational fraction sage refuse to convert it to a element of the Field of rational fraction:
hivert@boxen:~$ sage
----------------------------------------------------------------------
| Sage Version 4.2.1, Release Date: 2009-11-14 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: fr = (1+x)/(1+x+x^2)
sage: Fld = FractionField(PolynomialRing(QQ,x))
sage: Fld(fr)
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', (1181, 0))
[...]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
[...]
/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/polynomial_ring.pyc in _element_constructor_(self, x, check, is_gen, construct, **kwds)
304 x = x.numerator() * x.denominator().inverse_of_unit()
305 else:
--> 306 raise TypeError, "denominator must be a unit"
307
308 elif isinstance(x, pari_gen):
TypeError: denominator must be a unit
It seems that it needs to convert is to a polynomial. Of course if one convert numerator and denominator separately everything is Ok:
sage: Fld((1+x))/(1+x+x^2)
(x + 1)/(x^2 + x + 1)
I'm not sure about which component should be selected... Is it algebra, calculus or coercion...
Florent
CC: @burcin
Component: coercion
Keywords: Fraction Field
Author: Robert Bradshaw
Reviewer: Florent Hivert, Burcin Erocal
Merged: sage-4.6.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/7741