Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Polynomial
New issue 4057 by mich...@pratt.im: CoercionFailed regression in 0.7.3
http://code.google.com/p/sympy/issues/detail?id=4057
In Sympy 0.7.2, the following integral is evaluated properly:
from sympy import *
z = symbols('z')
integrate(1/((0.1-z)**2),z)
1/(-z + 0.1)
However, running the same code using Sympy 0.7.3 results in a
CoercionFailed exception:
from sympy import *
z = symbols('z')
integrate(1/((0.1-z)**2),z)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/utilities/decorator.py",
line 30, in threaded_func
return func(expr, *args, **kwargs)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 1626, in integrate
risch=risch, manual=manual)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 892, in doit
conds=conds)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 1158, in _eval_integral
result, i = risch_integrate(f, x, separate_integral=True, conds=conds)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/risch.py",
line 1675, in risch_integrate
ans = integrate(fa.as_expr()/fd.as_expr(), DE.x, risch=False)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/utilities/decorator.py",
line 30, in threaded_func
return func(expr, *args, **kwargs)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 1626, in integrate
risch=risch, manual=manual)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 892, in doit
conds=conds)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/integrals.py",
line 1234, in _eval_integral
parts.append(coeff * ratint(g, x))
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/rationaltools.py",
line 49, in ratint
g, h = ratint_ratpart(p, q, x)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/integrals/rationaltools.py",
line 153, in ratint_ratpart
H = f - A.diff()*v + A*(u.diff()*v).quo(u) - B*u
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/core/decorators.py",
line 74, in __sympifyit_wrapper
return func(a, b)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/polytools.py",
line 3653, in __mul__
return f.mul(g)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/polytools.py",
line 1356, in mul
_, per, F, G = f._unify(g)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/polytools.py",
line 376, in _unify
F = f.rep.convert(dom)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/polyclasses.py",
line 278, in convert
return DMP(dmp_convert(f.rep, f.lev, f.dom, dom), dom, f.lev)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/densebasic.py",
line 576, in dmp_convert
return dup_convert(f, K0, K1)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/densebasic.py",
line 550, in dup_convert
return dup_strip([ K1.convert(c, K0) for c in f ])
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/domains/domain.py",
line 94, in convert
return self.convert_from(element, base)
File "/tmp/sympy_test/local/lib/python2.7/site-packages/sympy/polys/domains/domain.py",
line 89, in convert_from
raise CoercionFailed("can't convert %s of type %s from %s to %s" %
(element, type(element), base, self))
sympy.polys.polyerrors.CoercionFailed: can't convert DMP([[1], []], ZZ,
ZZ[_a1,_b1]) of type <class 'sympy.polys.polyclasses.DMP'> from ZZ[_a1,_b1]
to RR
Both samples were run with Python 2.7.5, inside a clean virtualenv, with
only Sympy installed.
This seems to be triggered by the use of floating point constants in the
numerator or denominator.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues.
For more options, visit https://groups.google.com/groups/opt_out.