FYI, independent CAS integration tests, summer 2023 edition. Fricas related

13 views
Skip to first unread message

Nasser M. Abbasi

unread,
Sep 7, 2023, 5:03:55 AM9/7/23
to FriCAS - computer algebra system

fyi, summer 2023 edition of CAS integration tests is now completed after 7 months running.

There is now a new chapter that shows internal exceptions generated by different CAS systems.

These are the Fricas ones (DISTINCT ones, not the full list as there are over 2.000)

   sqlite> select DISTINCT fricas_anti from main where fricas_pass=-2;

Error detected within library code:   integrate: implementation incomplete (constant residues)

Error detected within library code:   integrate: implementation incomplete (has polynomial part)

Error detected within library code:   not invertible

Error detected within library code:   Curve not irreducible after change of variable 0 -> infinity

Error detected within library code:   integrate: implementation incomplete (residue poly has multiple non-linear factors)

Error detected within library code:   integrate: implementation incomplete (trace 0)

Error detected within library code:   catdef: division by zero

RuntimeError >> no explicit roots found

Error detected within library code:   alglogextint: unimplemented

Error detected within library code:   Not integrable (provided residues have no relations)

Error detected within library code:   Shouldn not  happen

Error detected within library code:   Too many variables

Error detected within library code:   failed of mode 

Union(SparseUnivariatePolynomial(Expression(Complex(Integer))),failed)

Error detected within library code:   failed of mode 

Union(SparseUnivariatePolynomial(Expression(Integer)),failed)

System error:   Heap exhausted  45588576 requested.PROCEED WITH CAUTION.

AttributeError

Error detected within library code:   integrate: implementation incomplete (irrational residues)

Error detected within library code:   do_alg_rde: unimplemented kernel

System error:   Heap exhausted (no more space for allocation).PROCEED WITH CAUTION.

   Number of problems failed in Fricas due to exception is

    sqlite> select COUNT(*) from main where fricas_pass=-2;
    2017

    Out of total 85963 integrals, this gives 2.34%.

Fricas did well, scoring 80.892%, Highest of the open source CAS systems.

Solved percentage
-------------------
1.  Mathematica  % 98.233
2.  Rubi         % 94.217
3.  Maple       % 86.609
4.  Fricas      % 80.892
5.  Giac         % 59.034
6.  Maxima(*) % 57.28  --> 57.28+5.516 = % 62.796 (see below on exceptions)
7.  Mupad        % 57.09
8.  Sympy        % 43.562

 
Full reports are here

--Nasser

Nasser M. Abbasi

unread,
Sep 7, 2023, 5:12:50 AM9/7/23
to FriCAS - computer algebra system
copy of plain text release notes are here

Cross posted at sci.math.symbolics

--Nasser

Waldek Hebisch

unread,
Sep 7, 2023, 2:05:40 PM9/7/23
to 'Nasser M. Abbasi' via FriCAS - computer algebra system
Dnia Thu, Sep 07, 2023 at 02:03:54AM -0700, 'Nasser M. Abbasi' via FriCAS - computer algebra system napisał(a):
>
> fyi, summer 2023 edition of CAS integration tests is now completed after 7
> months running.
>
> There is now a new chapter that shows internal exceptions generated by
> different CAS systems.
>
> These are the Fricas ones (DISTINCT ones, not the full list as there are
> over 2.000)

Thanks for info,.
>
> RuntimeError >> no explicit roots found

AFAICS this is Sage error.

>
> AttributeError

That one also looks like Sage error.


--
Waldek Hebisch

Nasser M. Abbasi

unread,
Sep 7, 2023, 10:45:00 PM9/7/23
to FriCAS - computer algebra system


Yes, these are sagemath API errors. I've submitted bug report on these ones (  no explicit roots found )    https://github.com/sagemath/sage/issues/36211

There are 17 such failures 

sqlite> select COUNT(*) from main where fricas_pass=-2 and fricas_anti LIKE '%no explicit roots found%';
17

sqlite> select rowid from main where fricas_pass=-2 and fricas_anti LIKE '%no explicit roots found%';
11675
11679
26634
26635
26637
26638
26639
37499
37502
42249
42252
56590
56591
60472
61525
61528
73949

sqlite> select command_in_fricas from main where rowid=11675;
integrate(1/(b*x^7+a),x, algorithm="fricas")


The "AttributeError" is also sagemath error.  And there are 8 of these

sqlite> select rowid from main where fricas_pass=-2 and fricas_anti LIKE '%AttributeError%';
73702
73703
74212
74213
74293
74294
74966
74967

--Nasser
 


Martin R

unread,
Sep 8, 2023, 5:24:08 AM9/8/23
to FriCAS - computer algebra system
Hi Nasser!

I cannot reproduce the AttributeError integrals - on my computer they eventually fail with an ECL  memory limit error.

I'm quite sure that the problem is the same as with the explicit roots - there is no sagemath equivalent for fricas' implicit roots, which is https://github.com/sagemath/sage/issues/32143.

Best wishes,

Martin

Nasser M. Abbasi

unread,
Sep 8, 2023, 8:41:48 AM9/8/23
to FriCAS - computer algebra system

" I cannot reproduce the AttributeError integrals - on my computer they eventually fail with an ECL  memory limit error."

Yes, you are right, it is "ECL says: Memory limit reached."  I have to find out why Python exception in my program printed "Exception raised: AttributeError"

I just verified one of these:

sqlite> select rowid from main where fricas_pass=-2 and fricas_anti LIKE '%AttributeError%';
73702
73703
74212
74213
74293
74294
74966
74967
sqlite> select fricas_anti from main where rowid=73702;
Exception raised: AttributeError
sqlite> select command_in_fricas from main where rowid=73702;
integrate(1/(x-(a*x+b)^(1/2)*(c+(a*x+b)^(1/2))^(1/2)),x, algorithm="fricas")
sqlite> select command_in_fricas from main where rowid=73703;
integrate(1/(x-(a*x+b)^(1/2)*(c+(a*x+b)^(1/2))^(1/2)),x, algorithm="fricas")
sqlite>

>sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.1, Release Date: 2023-08-20                    │
│ Using Python 3.11.3. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
sage: var('x a b c')
(x, a, b, c)
sage: integrate(1/(x-(a*x+b)^(1/2)*(c+(a*x+b)^(1/2))^(1/2)),x, algorithm="fricas")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:748, in InterfaceElement.__init__(self, parent, value, is_name, name)
    747 try:
--> 748     self._name = parent._create(value, name=name)
    749 except (TypeError, RuntimeError, ValueError) as x:

File ~/TMP/sage-10.1/src/sage/interfaces/maxima_lib.py:621, in MaximaLib._create(self, value, name)
    620     else:
--> 621         self.set(name, value)
    622 except RuntimeError as error:

File ~/TMP/sage-10.1/src/sage/interfaces/maxima_lib.py:529, in MaximaLib.set(self, var, value)
    528 cmd = '%s : %s$'%(var, value.rstrip(';'))
--> 529 self.eval(cmd)

File ~/TMP/sage-10.1/src/sage/interfaces/maxima_lib.py:475, in MaximaLib._eval_line(self, line, locals, reformat, **kwds)
    474         if statement:
--> 475             maxima_eval("#$%s$" % statement)
    476 if not reformat:

File ~/TMP/sage-10.1/src/sage/libs/ecl.pyx:830, in sage.libs.ecl.EclObject.__call__()
    829 lispargs = EclObject(list(args))
--> 830 return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
    831

File ~/TMP/sage-10.1/src/sage/libs/ecl.pyx:353, in sage.libs.ecl.ecl_safe_apply()
    352     else:
--> 353         raise RuntimeError("ECL says: {}".format(message))
    354 else:

RuntimeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the
memory limits before executing the program again.

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
Cell In [2], line 1
----> 1 integrate(Integer(1)/(x-(a*x+b)**(Integer(1)/Integer(2))*(c+(a*x+b)**(Integer(1)/Integer(2)))**(Integer(1)/Integer(2))),x, algorithm="fricas")

File ~/TMP/sage-10.1/src/sage/misc/functional.py:773, in integral(x, *args, **kwds)
    648 """
    649 Return an indefinite or definite integral of an object ``x``.
    650
   (...)
    770
    771 """
    772 if hasattr(x, 'integral'):
--> 773     return x.integral(*args, **kwds)
    774 else:
    775     from sage.symbolic.ring import SR

File ~/TMP/sage-10.1/src/sage/symbolic/expression.pyx:13283, in sage.symbolic.expression.Expression.integral()
  13281                 R = SR
  13282         return R(integral(f, v, a, b, **kwds))
> 13283     return integral(self, *args, **kwds)
  13284
  13285 integrate = integral

File ~/TMP/sage-10.1/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.1/src/sage/symbolic/integration/external.py:206, in fricas_integrator(expression, v, a, b, noPole)
    203     else:
    204         result = e_fricas.integrate(seg)
--> 206 result = result.sage()
    208 if result == "failed":
    209     result = expression.integrate(v, a, b, hold=True)

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

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

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

File ~/TMP/sage-10.1/src/sage/symbolic/expression.pyx:12332, in sage.symbolic.expression.Expression.roots()
  12330     return p.roots(ring=ring, multiplicities=multiplicities)
  12331
> 12332 S, mul = self.solve(x, multiplicities=True, explicit_solutions=explicit_solutions)
  12333 if len(mul) == 0 and explicit_solutions:
  12334     raise RuntimeError("no explicit roots found")

File ~/TMP/sage-10.1/src/sage/symbolic/expression.pyx:12399, in sage.symbolic.expression.Expression.solve()
  12397 """
  12398 from sage.symbolic.relation import solve
> 12399 return solve(self, x, multiplicities=multiplicities,
  12400                       solution_dict=solution_dict,
  12401                       explicit_solutions=explicit_solutions,

File ~/TMP/sage-10.1/src/sage/symbolic/relation.py:1068, in solve(f, *args, **kwds)
   1063         raise TypeError("The first argument to solve() should be a "
   1064                         "symbolic expression or a list of symbolic "
   1065                         "expressions.")
   1067 if isinstance(f, Expression):  # f is a single expression
-> 1068     return _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain)
   1070 if not isinstance(f, (list, tuple)):
   1071     raise TypeError("The first argument must be a symbolic expression or a list of symbolic expressions.")

File ~/TMP/sage-10.1/src/sage/symbolic/relation.py:1338, in _solve_expression(f, x, explicit_solutions, multiplicities, to_poly_solve, solution_dict, algorithm, domain)
   1336 try:
   1337     if to_poly_solve != 'force':
-> 1338         s = m.solve(x).str()
   1339     else:  # omit Maxima's solve command
   1340         s = str([])

File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:696, in InterfaceFunctionElement.__call__(self, *args, **kwds)
    695 def __call__(self, *args, **kwds):
--> 696     return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds)

File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:616, in Interface.function_call(self, function, args, kwds)
    612 self._check_valid_function_name(function)
    613 s = self._function_call_string(function,
    614                                [s.name() for s in args],
    615                                ['%s=%s'%(key,value.name()) for key, value in kwds.items()])
--> 616 return self.new(s)

File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:385, in Interface.new(self, code)
    384 def new(self, code):
--> 385     return self(code)

File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:298, in Interface.__call__(self, x, name)
    295         pass
    297 if isinstance(x, str):
--> 298     return cls(self, x, name=name)
    299 try:
    300     # Special methods do not and should not have an option to
    301     # set the name directly, as the identifier assigned by the
    302     # interface should stay consistent. An identifier with a
    303     # user-assigned name might change its value, so we return a
    304     # new element.
    305     result = self._coerce_from_special_method(x)

File ~/TMP/sage-10.1/src/sage/interfaces/interface.py:750, in InterfaceElement.__init__(self, parent, value, is_name, name)
    748     self._name = parent._create(value, name=name)
    749 except (TypeError, RuntimeError, ValueError) as x:
--> 750     raise TypeError(x)

TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, quit program and enlarge the
memory limits before executing the program again.
sage:

---------------------------------------------

As for the " no explicit roots" errors, you are right, it it is duplicate of #32143 as you noticed. Please free free to close the one I just opened in this case on this.

Thanks
--Nasser
Reply all
Reply to author
Forward
0 new messages