1 | initial version |
One solution is to use Python3-style division, where the quotient of two integers is a floating-point number.
The simplest way is to import division
from __future__
:
Use .n(digits=13)
to get 13 decimal digits; using .n(13)
gives 13 bits
of precision, so only 3 decimal digits.
sage: from __future__ import division
sage: L = ['651/349*t + 5382747/9778631000', 't + 57879/196133000', '1000/349*t + 57879/68450417']
sage: t = SR.var('t')
sage: F = function('F')(t)
sage: for k in L:
....: F(t) = eval(k)
....: Fc = fast_callable(F, vars=[t])
....: val2eval = 1.0
....: print(Fc(val2eval).n(digits=13))
....:
1.865879973076
1.000295100773
2.866175073849