Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error: "fraction must have unit denominator" when converting symbolic expression into Univariate Polynomial Ring

I want to convert a symbolic expression into (fractional) polynomials over RealField.

ploy_real = RealField()['E']
(E_real,) = ploy_real._first_ngens(1)
E = SR.var('E')
f = -1/4*(4*E + 3)/E
f.polynomial(base_ring=RealField())

However, I got this error. How to solve this error? Hasn't f already had a denominator E?

/usr/lib/python3/dist-packages/sage/rings/fraction_field.py in _call_(self, x, check)
   1242             # However, too much existing code is expecting this to throw a
   1243             # TypeError, so we decided to keep it for the time being.
-> 1244             raise TypeError("fraction must have unit denominator")
   1245         return num * den.inverse_of_unit()
click to hide/show revision 2
retagged

Error: "fraction must have unit denominator" when converting symbolic expression into Univariate Polynomial Ring

I want to convert a symbolic expression into (fractional) polynomials over RealField.

ploy_real = RealField()['E']
(E_real,) = ploy_real._first_ngens(1)
E = SR.var('E')
f = -1/4*(4*E + 3)/E
f.polynomial(base_ring=RealField())

However, I got this error. How to solve this error? Hasn't f already had a denominator E?

/usr/lib/python3/dist-packages/sage/rings/fraction_field.py in _call_(self, x, check)
   1242             # However, too much existing code is expecting this to throw a
   1243             # TypeError, so we decided to keep it for the time being.
-> 1244             raise TypeError("fraction must have unit denominator")
   1245         return num * den.inverse_of_unit()