Wild guess: the float coefficients are coerced to QQ, because otherwise
numerical inaccuracy would prevent us from finding a solution. For example,
(0.333333... + 0.666666...)*x
might not equal x.
For a workaround, someone recently showed me this. You would call
`symbolic_approx` on your result.
---
class NumericEvaluator(Converter):
def arithmetic(self, ex, operator):
return reduce(operator, map(self, ex.operands()))
def pyobject(self, ex, obj):
return ex.n()
def symbol(self, ex):
return SR(ex)
def symbolic_approx(expr):
ne = NumericEvaluator()
return ne(expr)
Whoops, you'll need this, too:
from sage.symbolic.expression_conversions import Converter
Or you can do this:
sage: t = -2/3*x + 4/3
sage: t._convert(RR)
-0.666666666666667*x + 1.33333333333333
Cheers,
Burcin
Where were you a few weeks ago? =)
Would anyone be opposed to making this a visible method?
I opened a ticket to make this visible:
http://trac.sagemath.org/sage_trac/ticket/12577
Thanks again for the easy solution.