Updates:
Cc: Vinzent.Steinberg
Comment #3 on issue 1857 by [email protected]: evalf/simplify accuracy
http://code.google.com/p/sympy/issues/detail?id=1857
Rather than start a new issue, I would like to pick this one up again. The
one place where sympy should do better is in computing the difference of
identical numbers:
>>> s=sqrt(3)
>>> s==s
True
>>> s.n(2)==s.n(2)
True
>>> s.n(2)-s.n(2)
0.00049
That should be zero regardless of the level of evaluation. If the following
change to Add.flatten is made at line 57
if coeff.is_Number:
coeff += o.__add__(0)
then such differences of identical numbers give the expected result. Part
of the problem might stem from mpmath.libmpf.py in the add routine where
appears the following:
# Handle zeros and special numbers
if _sub:
t = mpf_neg(t)
if not sman:
if sexp:
...
sman and tman are the mantissa of the numbers being added and a check is
only being made to see if sman is zero; but tman might also be zero --
should it be watching for that? If that is fixed there some core tests
start to fail in bad ways; the change to Add.flatten doesn't cause any core
test to fail. It basically makes sure that all Numbers being added have
been normalized to the same value.
Does anyone else have a suggestion of how to fix this?
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.