id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,work_issues,upstream,reviewer,author,merged,dependencies,stopgaps
7741,Can't construct a rational fraction from a symbolic one.,hivert,robertwb,"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",defect,closed,major,sage-4.6,coercion,fixed,"Fraction Field, coercion",burcin,,N/A,"Florent Hivert, Burcin Erocal",Robert Bradshaw,sage-4.6.alpha2,,
