Skip to content

incorrect behavior when algorithm='sympy' fails to find an integral #15256

@williamstein

Description

@williamstein

What happens:

sage: a = integrate(sin(x)*tan(x), x, algorithm='sympy') 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-1-27db75e497e4> in <module>()
----> 1 a = integrate(sin(x)*tan(x), x, algorithm='sympy')
 
/usr/local/sage/sage-5.11/local/lib/python2.7/site-packages/sage/misc/functional.pyc in integral(x, *args, **kwds)
    745     """
    746     if hasattr(x, 'integral'):
--> 747         return x.integral(*args, **kwds)
    748     else:
    749         from sage.symbolic.ring import SR
 
/usr/local/sage/sage-5.11/local/lib/python2.7/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.integral (sage/symbolic/expression.cpp:40833)()
 
/usr/local/sage/sage-5.11/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.pyc in integrate(expression, v, a, b, algorithm)
    681         if not integrator:
    682             raise ValueError, "Unknown algorithm: %s" % algorithm
--> 683         return integrator(expression, v, a, b)
    684     if a is None:
    685         return indefinite_integral(expression, v)
 
/usr/local/sage/sage-5.11/local/lib/python2.7/site-packages/sage/symbolic/integration/external.pyc in sympy_integrator(expression, v, a, b)
     37     else:
     38         result = sympy.integrate(ex, (v, a._sympy_(), b._sympy_()))
---> 39     return result._sage_()
     40
     41 def mma_free_integrator(expression, v, a=None, b=None):
 
AttributeError: 'Integral' object has no attribute '_sage_'
sage: 
sage: 
sage: %debug
> /usr/local/sage/sage-5.11/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py(39)sympy_integrator()
     38         result = sympy.integrate(ex, (v, a._sympy_(), b._sympy_()))
---> 39     return result._sage_()
     40 
 
ipdb> print result
Integral(sin(x)*tan(x), x)

What should happen:

sage: a = integrate(sin(x)*tan(x), x, algorithm='sympy') 
sage: a
<get back a formal integral>

Component: calculus

Reviewer: Punarbasu Purkayastha, Karl-Dieter Crisman

Issue created by migration from https://trac.sagemath.org/ticket/15256

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions