Here's a possible way to solve the precision problems with Maxima. This replaces RealNumbers and RealLiterals with variables before simplifying an Expression.
from sage.symbolic.expression_conversions import Converter class DoNothing(Converter): def arithmetic(self, ex, operator): return reduce(operator, map(self, ex.operands())) def pyobject(self, ex, obj): return ex def symbol(self, ex): return ex def relation(self, ex, operator): return operator(*map(self, ex.operands())) def derivative(self, ex, operator): #We'll just ignore this for now return ex def composition(self, ex, operator): return operator(*map(self, ex.operands())) class MaintainPrec(DoNothing): def __init__(self): self.repl_dict = {} self.counter = 1 def pyobject(self, ex, obj): if isinstance(obj, sage.rings.real_mpfr.RealLiteral) or isinstance(obj, sage.rings.real_mpfr.RealNumber): newvar = var('repl%s' % self.counter) self.repl_dict[newvar] = obj self.counter += 1 return newvar else: return obj def safe_simplify(expr): replacer = MaintainPrec() return replacer(expr).simplify_full().subs(replacer.repl_dict) Now: sage: a = RealField(200)(8.987551787368175506591796875e9) sage: var('y') y sage: b = (a * x).mul(y, hold=True) sage: (b / (x * y)).simplify() 8987551787.37 sage: safe_simplify(b / (x * y)) 8.9875517873681755065917968750000000000000000000000000000000e9 Does this look like a good solution? It should be done before sending any Expression to Maxima, because Maxima itself does not try to preserve precision at all with its bigfloats<http://trac.sagemath.org/sage_trac/ticket/11643#comment:3> . -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org