Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Exception in sage-fricas interface

I get an error in this specific integral. Here is how to reproduce it. I call fricas from sage to do an integral. Convert the result back to sage syntax. Then use

 isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)

As a way to check if the result has no unevaluated integral in it anywhere, so I would know it actually evaluated and not echoed back.

This works OK for everything I tried so far. It works on all the tests I did on Maxima. Except on this one I found so far using Fricas

sage: fricas.setSimplifyDenomsFlag(fricas.true)
sage: var('x')
sage: theIntegral = fricas(x*(x^2-1)^9)
sage: anti = theIntegral.integrate(x)
sage: anti = anti.sage()

sage: anti
1/20*x^20 - 1/2*x^18 + 9/4*x^16 - 6*x^14 + 21/2*x^12 - 63/5*x^10 + 21/2*x^8 - 6*x^6 + 9/4*x^4 - 1/2*x^2

sage: isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)

and now

AttributeError                            Traceback (most recent call last)
<ipython-input-16-ebdd05a45434> in <module>()
----> 1 isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)

/usr/lib/python2.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4531)()
    491             AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
    492         """
--> 493         return self.getattr_from_category(name)
    494 
    495     cdef getattr_from_category(self, name):

/usr/lib/python2.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4640)()
    504         else:
    505             cls = P._abstract_element_class
--> 506         return getattr_from_other_class(self, cls, name)
    507 
    508     def __dir__(self):

/usr/lib/python2.7/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2536)()
    392         dummy_error_message.cls = type(self)
    393         dummy_error_message.name = name
--> 394         raise AttributeError(dummy_error_message)
    395     attribute = <object>attr
    396     # Check for a descriptor (__get__ in Python)

AttributeError: 'sage.rings.polynomial.polynomial_rational_flint.Polynomial_rational_flint' object has no attribute 'operator'

The above works OK on other integrals. For example

sage: theIntegral = fricas(x*(x^2+1)^(1/2))
sage: anti = theIntegral.integrate(x)
sage: anti = anti.sage()

sage: anti
1/3*(x^2 + 1)^(3/2)

sage: isinstance(anti.operator(), sage.symbolic.integration.integral.IndefiniteIntegral)
False
sage:

No error.

I am using sage: SageMath version 8.3.beta6, Release Date: 2018-06-17 and

>fricas
Checking for foreign routines
AXIOM="/usr/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
                       FriCAS Computer Algebra System 
                            Version: FriCAS 1.3.3
                   Timestamp: Tue Jun 19 19:53:54 CDT 2018

Any idea why this error shows up on this integral? Is it possible to fix it?

Thank you

--Nasser