Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium Assumptions Integration Polynomial
New issue 2672 by asmeurer: UnificationFailed with integrate(-diff(y/(x**2
+ y**2), y), x)
http://code.google.com/p/sympy/issues/detail?id=2672
In [110]: x, y = symbols('x y', real=True)
In [111]: integrate(-diff(y/(x**2 + y**2), y), x)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (17, 0))
---------------------------------------------------------------------------
UnificationFailed Traceback (most recent call last)
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/<ipython-input-111-6c3ba16c58ef>
in
<module>()
----> 1 integrate(-diff(y/(x**2 + y**2), y), x)
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/utilities/decorator.pyc
in
threaded_func(expr, *args, **kwargs)
23 func(expr.rhs, *args,
**kwargs))
24 else:
---> 25 return func(expr, *args, **kwargs)
26
27 return threaded_func
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/integrals/integrals.pyc
in
integrate(*args, **kwargs)
845
846 if isinstance(integral, Integral):
--> 847 return integral.doit(deep = False)
848 else:
849 return integral
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/integrals/integrals.pyc
in
doit(self, **hints)
362 continue
363
--> 364 antideriv = self._eval_integral(function, xab[0])
365
366 if antideriv is None:
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/integrals/integrals.pyc
in
_eval_integral(self, f, x)
575 # poly(x)
576 if g.is_rational_function(x):
--> 577 parts.append(coeff * ratint(g, x))
578 continue
579
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/integrals/rationaltools.pyc
in
ratint(f, x, **flags)
86 else:
87 for h, q in L:
---> 88 R = log_to_real(h, q, x, t)
89
90 if R is not None:
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/integrals/rationaltools.pyc
in
log_to_real(h, q, x, t)
252 R_u = roots(R, filter='R')
253
--> 254 if len(R_u) != R.count_roots():
255 return None
256
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/polytools.pyc
in
count_roots(f, inf, sup)
2863 if inf_real and sup_real:
2864 if hasattr(f.rep, 'count_real_roots'):
-> 2865 count = f.rep.count_real_roots(inf=inf, sup=sup)
2866 else: # pragma: no cover
2867 raise OperationNotSupported(f, 'count_real_roots')
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/polyclasses.py
in
count_real_roots(f, inf, sup)
757 def count_real_roots(f, inf=None, sup=None):
758 """Return the number of real roots of ``f`` in ``[inf,
sup]``. """
--> 759 return dup_count_real_roots(f.rep, f.dom, inf=inf, sup=sup)
760
761 def count_complex_roots(f, inf=None, sup=None):
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/rootisolation.pyc
in
dup_count_real_roots(f, K, inf, sup)
652
653 if inf is None:
--> 654 signs_inf = dup_sign_variations([ dup_LC(s,
K)*(-1)**dup_degree(s) for s in sturm ], K)
655 else:
656 signs_inf = dup_sign_variations([ dup_eval(s, inf, K) for s
in sturm ], K)
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/densetools.pyc
in
dup_sign_variations(f, K)
1124
1125 for coeff in f:
-> 1126 if coeff*prev < 0:
1127 k += 1
1128
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/polyclasses.py
in
__lt__(f, g)
1297
1298 def __lt__(f, g):
-> 1299 _, _, _, F, G = f.frac_unify(g)
1300 return F.__lt__(G)
1301
/Users/aaronmeurer/Documents/python/sympy/sympy-scratch/sympy/polys/polyclasses.py
in
frac_unify(f, g)
1047 """Unify representations of two multivariate fractions. """
1048 if not isinstance(g, DMF) or f.lev != g.lev:
-> 1049 raise UnificationFailed("can't unify %s with %s" % (f,
g))
1050
1051 if f.dom == g.dom:
UnificationFailed: can't unify DMF(([], [mpz(1)]), ZZ) with 0
If x and y are just regular symbols, it works fine:
In [113]: x, y = symbols('x y')
In [114]: integrate(-diff(y/(x**2 + y**2), y), x)
Out[114]:
⎛ ⎽⎽⎽⎽ ⎛ ⎽⎽⎽⎽⎞ ⎽⎽⎽⎽
⎛ ⎽⎽⎽⎽⎞⎞ ⎽⎽⎽⎽ ⎛ ⎽⎽⎽⎽⎞
⎜ ╱ -1 ⎜ 4 ╱ -1 ⎟ ╱ -1 ⎜
4 ╱ -1 ⎟⎟ ╱ -1 ⎜ 2 ╱ -1 ⎟
⎜ ╱ ── ⋅log⎜x - y ⋅ ╱ ── ⎟ ╱ ── ⋅log⎜x +
y ⋅ ╱ ── ⎟⎟ ╱ ── ⋅log⎜x - y ⋅ ╱ ── ⎟
⎜ ╱ 6 ⎜ ╱ 6 ⎟ ╱ 6
⎜ ╱ 6 ⎟⎟ ╱ 2 ⎜ ╱ 2 ⎟
2 ⎜ x ╲╱ y ⎝ ╲╱ y ⎠ ╲╱ y
⎝ ╲╱ y ⎠⎟ ╲╱ y ⎝ ╲╱ y ⎠ ╲╱
2⋅y ⋅⎜────────────── - ─────────────────────────────── +
───────────────────────────────⎟ + ─────────────────────────────── - ──
⎜ 2 2 4 4
4 ⎟ 2
⎝2⋅x ⋅y +
2⋅y ⎠
⎽⎽⎽⎽ ⎛ ⎽⎽⎽⎽⎞
╱ -1 ⎜ 2 ╱ -1 ⎟
╱ ── ⋅log⎜x + y ⋅ ╱ ── ⎟
╱ 2 ⎜ ╱ 2 ⎟
y ⎝ ╲╱ y ⎠
─────────────────────────────
2
--
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.