Opened 8 years ago

Closed 7 years ago

#15256 closed defect (duplicate)

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

Reported by: was Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: calculus Keywords:
Cc: Merged in:
Authors: Reviewers: Punarbasu Purkayastha, Karl-Dieter Crisman
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

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>

Change History (11)

comment:1 Changed 8 years ago by kcrisman

Tangentially related: #14915.

comment:2 Changed 8 years ago by ppurka

This needs to be fixed upstream in sympy.

Edit: In fact, it seems sympy is unable to integrate it. This is why it gets into this weird problem.

Last edited 8 years ago by ppurka (previous) (diff)

comment:3 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:4 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:5 follow-up: Changed 7 years ago by kcrisman

This is a dup of #14723. Not sure which one should be closed.

Last edited 7 years ago by kcrisman (previous) (diff)

comment:6 in reply to: ↑ 5 ; follow-up: Changed 7 years ago by ppurka

Replying to kcrisman:

This is a dup of #14273. Not sure which one should be closed.

How is this related to the notebook? Am I missing something obvious?

comment:7 in reply to: ↑ 6 Changed 7 years ago by kcrisman

This is a dup of #14273. Not sure which one should be closed.

How is this related to the notebook? Am I missing something obvious?

Sorry, #14723. I'll fix it above as well.

comment:8 Changed 7 years ago by ppurka

I think this one should be closed because i) the other one was opened earlier, and ii) there was an attempt at a patch.

comment:9 Changed 7 years ago by kcrisman

  • Milestone changed from sage-6.3 to sage-duplicate/invalid/wontfix
  • Reviewers set to Punarbasu Purkayastha, Karl-Dieter Crisman
  • Status changed from new to needs_review

Okay, sounds good.

comment:10 Changed 7 years ago by kcrisman

  • Status changed from needs_review to positive_review

comment:11 Changed 7 years ago by vbraun

  • Resolution set to duplicate
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.