Status: Accepted
Owner: matt...@gmail.com
Labels: Type-Defect Priority-Medium Integration

New issue 2718 by matt...@gmail.com: integrate() fails with UnificationFailed
http://code.google.com/p/sympy/issues/detail?id=2718

In [4]: var('a:c,x', real=True)
Out[4]: (a, b, c, x)

In [5]: integrate(a/(a**2+b*a+b*c*x**2),x)
---------------------------------------------------------------------------
UnificationFailed                         Traceback (most recent call last)
/home/mateusz/repo/git/sympy/<ipython-input-5-96f555343d1c> in <module>()
----> 1 integrate(a/(a**2+b*a+b*c*x**2),x)

/home/mateusz/repo/git/sympy/sympy/utilities/decorator.py 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

/home/mateusz/repo/git/sympy/sympy/integrals/integrals.py in integrate(*args, **kwargs)
    845
    846     if isinstance(integral, Integral):
--> 847         return integral.doit(deep = False)
    848     else:
    849         return integral

/home/mateusz/repo/git/sympy/sympy/integrals/integrals.py in doit(self, **hints)
    362                 continue
    363
--> 364             antideriv = self._eval_integral(function, xab[0])
    365
    366             if antideriv is None:

/home/mateusz/repo/git/sympy/sympy/integrals/integrals.py 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

/home/mateusz/repo/git/sympy/sympy/integrals/rationaltools.py 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:

/home/mateusz/repo/git/sympy/sympy/integrals/rationaltools.py 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

/home/mateusz/repo/git/sympy/sympy/polys/polytools.py in count_roots(f, inf, sup)
   2854         if inf_real and sup_real:
   2855             if hasattr(f.rep, 'count_real_roots'):
-> 2856                 count = f.rep.count_real_roots(inf=inf, sup=sup)
   2857             else: # pragma: no cover
   2858                 raise OperationNotSupported(f, 'count_real_roots')

/home/mateusz/repo/git/sympy/sympy/polys/polyclasses.py in count_real_roots(f, inf, sup)
    755     def count_real_roots(f, inf=None, sup=None):
756 """Return the number of real roots of ``f`` in ``[inf, sup]``. """
--> 757         return dup_count_real_roots(f.rep, f.dom, inf=inf, sup=sup)
    758
    759     def count_complex_roots(f, inf=None, sup=None):

/home/mateusz/repo/git/sympy/sympy/polys/rootisolation.py 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)

/home/mateusz/repo/git/sympy/sympy/polys/densetools.py in dup_sign_variations(f, K)
   1124
   1125     for coeff in f:
-> 1126         if coeff*prev < 0:
   1127             k += 1
   1128

/home/mateusz/repo/git/sympy/sympy/polys/polyclasses.py in __lt__(f, g)
   1301
   1302     def __lt__(f, g):
-> 1303         _, _, _, F, G = f.frac_unify(g)
   1304         return F.__lt__(G)
   1305

/home/mateusz/repo/git/sympy/sympy/polys/polyclasses.py in frac_unify(f, g)
   1051         """Unify representations of two multivariate fractions. """
   1052         if not isinstance(g, DMF) or f.lev != g.lev:
-> 1053 raise UnificationFailed("can't unify %s with %s" % (f, g))
   1054
   1055         if f.dom == g.dom:

UnificationFailed: can't unify DMF(([[[]]], [[[mpz(1)]]]), ZZ) with 0

Note that this works when real=True isn't specified.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@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