Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 1857 by renierm: evalf/simplify accuracy
http://code.google.com/p/sympy/issues/detail?id=1857

Sympy seems to lose accuracy with simplification and evalf use.

As expressions are simlified accuracy seems to be lost. Consider the
following defined constants.


import sympy

mu0 = 4*sympy.pi*1e-7
c0 = sympy.Real(299792458)
eps0 = 1/(c0**2*mu0)

# As one would expect

print 4e-7*sympy.pi.evalf(100) - mu0.evalf(100)

# returns x.xxE-108 which is equivalent to 0 (=0)
# but

print 1/(c0**2*mu0.evalf(100)) - eps0.evalf(100)

# returns x.xxE-28 (!= 0)
# and

print sympy.sqrt(eps0).evalf(100) - sympy.sqrt(eps0.evalf(100))

# returns x.xxE-22 (!= 0)
# while

print (sympy.Real(1.0e9)*sympy.sqrt(eps0)).evalf(100) -
sympy.Real(1.0e9)*sympy.sqrt(eps0.evalf(100))

# returns x.xxE-13 (!= 0)

It seems that as sympy internally simplifies expressions, some assumption
in precision is being made, e.g., pi is evaluated at some stage to some
precision and then this rounding error is propagated.

Renier

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-iss...@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to