Comment #6 on issue 1304 by akshaysrinivasan: Integrate sqrt(x**2 + y**2)  
fails
http://code.google.com/p/sympy/issues/detail?id=1304

Mateusz: You were right, I apologise for posting without looking closely.
I tried what you suggested, but ended up getting errors  
sympy.polys.polynomial for
>>> integrate(sqrt(x**2-y**2),x)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/neptune/sympy-clean/sympy/utilities/decorator.py", line 55, in
threaded_decorator
     return func(expr, *args, **kwargs)
   File "/home/neptune/sympy-clean/sympy/integrals/integrals.py", line 381,  
in integrate
     return integral.doit()
   File "/home/neptune/sympy-clean/sympy/integrals/integrals.py", line 133,  
in doit
     antideriv = self._eval_integral(function, x)
   File "/home/neptune/sympy-clean/sympy/integrals/integrals.py", line 306,  
in
_eval_integral
     h = heurisch(g, x, hints=[])
   File "sympy/integrals/risch.py", line 216, in heurisch
     denom = reduce(lambda p, q: lcm(p, q, V), denoms)
   File "sympy/integrals/risch.py", line 216, in <lambda>
     denom = reduce(lambda p, q: lcm(p, q, V), denoms)
   File "<string>", line 3, in lcm
   File "/home/neptune/sympy-clean/sympy/polys/wrappers.py", line 23, in  
_map_basic
     result = f(*_conv_args(n, args), **kwargs)
   File "/home/neptune/sympy-clean/sympy/polys/algorithms.py", line 366, in  
poly_lcm
     f = Poly(f, *symbols)
   File "/home/neptune/sympy-clean/sympy/polys/polynomial.py", line 402, in  
__new__
     terms = Poly._decompose(poly, *symbols)
   File "/home/neptune/sympy-clean/sympy/polys/polynomial.py", line 545, in  
_decompose
     raise PolynomialError("Can't decompose %s" % factor)
sympy.polys.polynomial.PolynomialError: Can't decompose (y**2 -  
_x3**2)**(1/2)

-----------------
Here's the code.

diff --git a/sympy/integrals/risch.py b/sympy/integrals/risch.py
index 81e2b7a..7ef3204 100644
--- a/sympy/integrals/risch.py
+++ b/sympy/integrals/risch.py
@@ -186,12 +186,12 @@ def heurisch(f, x, **kwargs):
                  elif g.is_Pow:
                      if g.exp.is_Rational and g.exp.q == 2:
                          M = g.base.match(a*x**2 + b)
-
-                        if M is not None and M[b].is_positive:
+                       if M is not None :
                              if M[a].is_positive:
                                  terms.add(asinh(sqrt(M[a]/M[b])*x))
                              elif M[a].is_negative:
                                  terms.add(asin(sqrt(-M[a]/M[b])*x))
+
          else:

--------------------

Is this related to issue 1323 ?



--
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-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