#14723: Error when SymPy can't evaluate an integral
-------------------------------------------------+-------------------------
       Reporter:  eviatarbach                    |        Owner:  burcin
           Type:  defect                         |       Status:
       Priority:  major                          |  needs_work
      Component:  calculus                       |    Milestone:  sage-6.4
       Keywords:  sympy, integrate               |   Resolution:
        Authors:  Eviatar Bach                   |    Merged in:
Report Upstream:  Completely fixed; Fix          |    Reviewers:
  reported upstream                              |  Work issues:  fix in
         Branch:                                 |  sympy
   Dependencies:                                 |       Commit:
                                                 |     Stopgaps:
-------------------------------------------------+-------------------------
Changes (by rws):

 * upstream:  Reported upstream. Developers acknowledge bug. => Completely
     fixed; Fix reported upstream


Comment:

 This Sympy patch completely fixes the issue. A pull request containing it
 was reported there and waits for review.

 https://github.com/sympy/sympy/pull/8592

 {{{
 diff --git a/sympy/integrals/integrals.py b/sympy/integrals/integrals.py
 index 2a3ccfe..ac434c5 100644
 --- a/sympy/integrals/integrals.py
 +++ b/sympy/integrals/integrals.py
 @@ -1070,6 +1070,27 @@ def as_sum(self, n, method="midpoint"):
              result += self.function.subs(sym, xi)
          return result*dx

 +    def _sage_(self, ):
 +        from sage.symbolic.integration.integral import definite_integral,
 indefinite_integral
 +        f, limits = self.function, list(self.limits)
 +        limit = limits.pop(-1)
 +        if len(limit) >= 2:
 +            if len(limit) == 2:
 +                x, b = limit
 +                a = None
 +            else:
 +                x, a, b = limit
 +            return definite_integral(f._sage_(),
 +                                        x._sage_(),
 +                                        a._sage_(),
 +                                        b._sage_(),
 +                                        hold=True)
 +        else:
 +            x = limit[0]
 +            return indefinite_integral(f._sage_(),
 +                                       x._sage_(),
 +                                       hold=True)
 +

  @xthreaded
  def integrate(*args, **kwargs):
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/14723#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to