Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sagemath-Fricas issue. RuntimeError: no explicit roots found calling integrate #37814

Open
2 tasks done
nasser1 opened this issue Apr 16, 2024 · 0 comments
Open
2 tasks done

Comments

@nasser1
Copy link

nasser1 commented Apr 16, 2024

Steps To Reproduce

Using sagemath 10.3 with Fricas :

sage --version
SageMath version 10.3, Release Date: 2024-03-19

>fricas --version
FriCAS 1.3.10
based on sbcl 2.3.11
>

Sage gives RuntimeError: no explicit roots found on an integral which Fricas directly can do


>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.3, Release Date: 2024-03-19                    │
│ Using Python 3.11.8. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘

sage: print(fricas.eval(")lisp |$build_version|"))

Value = "FriCAS 1.3.10"

sage: var('x a b B y A')
(x, a, b, B, y, A)

sage: integrate(1/(b*x^7+a),x, algorithm="fricas")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
Cell In[5], line 1
----> 1 integrate(Integer(1)/(b*x**Integer(7)+a),x, algorithm="fricas")

File ~/TMP/sage-10.3/src/sage/misc/functional.py:788, in integral(x, *args, **kwds)
    655 """
    656 Return an indefinite or definite integral of an object ``x``.
    657 
   (...)
    785 
    786 """
    787 if hasattr(x, 'integral'):
--> 788     return x.integral(*args, **kwds)
    789 else:
    790     from sage.symbolic.ring import SR

File ~/TMP/sage-10.3/src/sage/symbolic/expression.pyx:13268, in sage.symbolic.expression.Expression.integral()
  13266                 R = SR
  13267         return R(integral(f, v, a, b, **kwds))
> 13268     return integral(self, *args, **kwds)
  13269 
  13270 integrate = integral

File ~/TMP/sage-10.3/src/sage/symbolic/integration/integral.py:1062, in integrate(expression, v, a, b, algorithm, hold)
   1060     if not integrator:
   1061         raise ValueError("Unknown algorithm: %s" % algorithm)
-> 1062     return integrator(expression, v, a, b)
   1063 if a is None:
   1064     return indefinite_integral(expression, v, hold=hold)

File ~/TMP/sage-10.3/src/sage/symbolic/integration/external.py:207, in fricas_integrator(expression, v, a, b, noPole)
    204     else:
    205         result = e_fricas.integrate(seg)
--> 207 result = result.sage()
    209 if result == "failed":
    210     result = expression.integrate(v, a, b, hold=True)

File ~/TMP/sage-10.3/src/sage/interfaces/interface.py:1123, in InterfaceElement.sage(self, *args, **kwds)
   1104 def sage(self, *args, **kwds):
   1105     """
   1106     Attempt to return a Sage version of this object.
   1107 
   (...)
   1121         [0 0]
   1122     """
-> 1123     return self._sage_(*args, **kwds)

File ~/TMP/sage-10.3/src/sage/interfaces/fricas.py:2056, in FriCASElement._sage_(self)
   2051     return FriCASElement._sage_expression(P.get_InputForm(self._name))
   2053 if head == "Expression" or head == "Pi":
   2054     # we treat Expression Integer and Expression Complex
   2055     # Integer just the same
-> 2056     return FriCASElement._sage_expression(P.get_InputForm(self._name))
   2058 if head == 'DistributedMultivariatePolynomial':
   2059     base_ring = self._get_sage_type(domain[2])

File ~/TMP/sage-10.3/src/sage/interfaces/fricas.py:1759, in FriCASElement._sage_expression(fricas_InputForm)
   1754 del rootOf[var]
   1755 if evars:
   1756     # we just need any root per FriCAS specification -
   1757     # however, if there are extra variables, we cannot
   1758     # use QQbar.any_root
-> 1759     rootOf_ev[var] = poly.roots(var, multiplicities=False)[0]
   1760 else:
   1761     R = PolynomialRing(QQbar, "x")

File ~/TMP/sage-10.3/src/sage/symbolic/expression.pyx:12308, in sage.symbolic.expression.Expression.roots()
  12306 S, mul = self.solve(x, multiplicities=True, explicit_solutions=explicit_solutions)
  12307 if len(mul) == 0 and explicit_solutions:
> 12308     raise RuntimeError("no explicit roots found")
  12309 else:
  12310     rt_muls = [(S[i].rhs(), mul[i]) for i in range(len(mul))]

RuntimeError: no explicit roots found
sage: 


Same command works with no error and solved by Fricas. Output not shown as long

>fricas
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
                       FriCAS Computer Algebra System 
                Version: FriCAS 1.3.10 built with sbcl 2.3.11
                 Timestamp: Wed Jan 10 09:37:52 PM CST 2024

integrate(1/(b*x^7+a),x)
%no error

Expected Behavior

No exception is expected

Actual Behavior

Exception generated by sagemath

Additional Information

No response

Environment

Linux on Virtual box

lsb_release -a
LSB Version:	n/a
Distributor ID:	ManjaroLinux
Description:	Manjaro Linux
Release:	23.1.4
Codename:	Vulcan


sage --version
SageMath version 10.3, Release Date: 2024-03-19

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants