Ask Your Question

Revision history [back]

Conversion from symbolic fraction to fraction field element:

sage: ex=(x+1)/(x-1); ex
(x + 1)/(x - 1)
sage: ex.numerator().polynomial(ZZ)/ex.denominator().polynomial(ZZ)
(x + 1)/(x - 1)
sage: type(_)
<type 'sage.rings.fraction_field_element.FractionFieldElement'>

Conversion from symbolic fraction to fraction field element:

sage: ex=(x+1)/(x-1); ex
(x + 1)/(x - 1)
sage: ex.numerator().polynomial(ZZ)/ex.denominator().polynomial(ZZ)
(x + 1)/(x - 1)
sage: type(_)
<type 'sage.rings.fraction_field_element.FractionFieldElement'>

The / operator applied to polynomial elements automagically creates the right fraction field.

Conversion from symbolic fraction to fraction field element:

sage: ex=(x+1)/(x-1); ex
(x + 1)/(x - 1)
sage: ex.numerator().polynomial(ZZ)/ex.denominator().polynomial(ZZ)
(x + 1)/(x - 1)
sage: type(_)
<type 'sage.rings.fraction_field_element.FractionFieldElement'>

The / operator applied to polynomial elements automagically creates the right fraction field.field. I admit that having a fraction conversion method for expressions (like the polynomial conversion) would be worthwhile.

Conversion from symbolic fraction to fraction field element:

sage: ex=(x+1)/(x-1); ex
(x + 1)/(x - 1)
sage: ex.numerator().polynomial(ZZ)/ex.denominator().polynomial(ZZ)
(x + 1)/(x - 1)
sage: type(_)
<type 'sage.rings.fraction_field_element.FractionFieldElement'>

The / operator applied to polynomial elements automagically creates the right fraction field. I admit that having a fraction conversion method for expressions (like the polynomial conversion) would be worthwhile.

This is now trac ticket #17539.