strange error from integrate command with maxima 5.47 and sagemath 10.1 beta 6

75 views
Skip to first unread message

Nasser M. Abbasi

unread,
Jul 16, 2023, 8:48:00 AM7/16/23
to sage-devel
After some struggle,  build sagemath with maxima 5.47 upstream.

Could someone see if they get same error I see on this one example?

>sage
│ SageMath version 10.1.beta6, Release Date: 2023-07-09              │
│ Using Python 3.11.3. Type "help()" for help.                       │
┃ Warning: this is a prerelease version, and it may be unstable.     ┃

age: ver = installed_packages()
sage: ver['maxima']
'5.47.0'
 
sage: var('f x e n a p h g b c d q')

sage: integrate(sin(x),x,algorithm="maxima")
-cos(x)

sage: integrate((a+b*log(c*(d*(f*x+e)^p)^q))^n/(h*x+g),x,algorithm="maxima")

RuntimeError                              Traceback (most recent call last)
Cell In [2], line 1
----> 1 integrate((a+b*log(c*(d*(f*x+e)**p)**q))**n/(h*x+g),x,algorithm="maxima")

File ~/TMP/sage-10.1.beta6/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.beta6/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.beta6/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.beta6/src/sage/symbolic/integration/external.py:44, in maxima_integrator(expression, v, a, b)
     42     expression = SR(expression)
     43 if a is None:
---> 44     result = maxima.sr_integral(expression, v)
     45 else:
     46     result = maxima.sr_integral(expression, v, a, b)

File ~/TMP/sage-10.1.beta6/src/sage/interfaces/maxima_lib.py:806, in MaximaLib.sr_integral(self, *args)
    700 """
    701 Helper function to wrap calculus use of Maxima's integration.
    702
   (...)
    803
    804 """
    805 try:
--> 806     return max_to_sr(maxima_eval(([max_integrate],[sr_to_max(SR(a)) for a in args])))
    807 except RuntimeError as error:
    808     s = str(error)

File ~/TMP/sage-10.1.beta6/src/sage/libs/ecl.pyx:830, in sage.libs.ecl.EclObject.__call__()
    828     """
    829     lispargs = EclObject(list(args))
--> 830     return ecl_wrap(ecl_safe_apply(self.obj,(<EclObject>lispargs).obj))
    831
    832 def __richcmp__(left, right, int op):

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

RuntimeError: ECL says: In function CAR, the value of the first argument is
  0
which is not of the expected type LIST
sage:


The same integrate command does not give this error the system maxima (also version 5.47) (but it does not evaluate, but no exception):

>which maxima
/usr/bin/maxima
>maxima --version
;;; Loading #P"/usr/lib/ecl-21.2.1/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-21.2.1/sockets.fas"
Maxima 5.47.0
>
>maxima
;;; Loading #P"/usr/lib/ecl-21.2.1/sb-bsd-sockets.fas"
;;; Loading #P"/usr/lib/ecl-21.2.1/sockets.fas"
Maxima 5.47.0 https://maxima.sourceforge.io
using Lisp ECL 21.2.1
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate((a+b*log(c*(d*(f*x+e)^p)^q))^n/(h*x+g),x);
                     /                      p q      n
                     [ (b log(c (d (f x + e) ) ) + a)
(%o1)                I ------------------------------- dx
                     ]             h x + g
                     /
(%i2)
 
All on Linux,

Why this gives exception when calling maxima from sage but not when calling maxima directly?  Is there something I can do to verify that maxima build by sagemath internally is build correct? I saw no errors at all during the build: Here is the maxima build by sagemath:

>pwd
/home/me/TMP/sage-10.1.beta6/local/bin

>ls -lrt maxima
-rwxr-xr-x 1 me me 9563 Jul 16 06:16 maxima

>./maxima --version
;;; Loading #P"/home/me/TMP/sage-10.1.beta6/local/lib/ecl-21.2.1/sb-bsd-sockets.fas"
;;; Loading #P"/home/me/TMP/sage-10.1.beta6/local/lib/ecl-21.2.1/sockets.fas"
Maxima 5.47.0
>

--Nasser

Matthias Koeppe

unread,
Jul 16, 2023, 1:30:53 PM7/16/23
to sage-devel
On Sunday, July 16, 2023 at 5:48:00 AM UTC-7 Nasser M. Abbasi wrote:
After some struggle,  build sagemath with maxima 5.47 upstream.

Open a PR with the upgrade please

John H Palmieri

unread,
Jul 16, 2023, 2:36:37 PM7/16/23
to sage-devel
I get the same error when evaluating this integral in Sage with its own Maxima. (version 5.46.0).

Emmanuel Charpentier

unread,
Jul 16, 2023, 3:47:24 PM7/16/23
to sage-devel

FWIW, neither Maxima, Giac, Sympy, Fricas, the Wolfram engine nor the Rubi integrator seem to be able to give a closed form to this antiderivative…

  • Maxima (5.46.0) fails as reported above relatively quickly (a few seconds).
  • the default integrator (i. e. what is called without specifying algorithm) and Sympy (1.12) takes their sweet time (> 5 minutes) before returning the held integrate call.- Giac (1.9.0) and Fricas (1.3.8.p1) return the held integrate expression faster (less than 1/3 of a second).

  • the Wolfram Engine (13.3.0) and Rubi (4.16.1.0, used through the Wolfram Engine) need a bit more than 1/2 second to return the unevaluated call ; this might be due to the Mathematica interface (which is still pexpect- based, IIRC).

HTH,

Nasser M. Abbasi

unread,
Jul 16, 2023, 10:59:53 PM7/16/23
to sage-devel

Emmanuel Charpentier

unread,
Jul 17, 2023, 2:04:04 AM7/17/23
to sage-devel

Le lundi 17 juillet 2023 à 04:59:53 UTC+2, Nasser M. Abbasi a écrit :

Would you conider posting your upgrade to Maxima (5.46.0 to 5.47.0) as a PR ?

Nasser M. Abbasi

unread,
Jul 17, 2023, 2:41:43 AM7/17/23
to sage-devel
"Would you conider posting your upgrade to Maxima (5.46.0 to 5.47.0) as a PR ?"

I am sorry, I do not understand what you mean?


To build sagemath with maxima 5.47.

i.e. I downloaded maxima source and put it in the upstream folder and made changes as described in the above link.

At first I thought sagemath 10.1 beta6 will automatically build with maxima 5.47, because that is what it said in release notes of sagemath 10.1 beta5


  "29daacb7579 gh-35707: Make Sage work with maxima 5.47"

i.e. what I read the above, it sounded to me that now sagemath 10.1 will have maxima 5.47 out of the box. But it does not.
So I had to follow the instructions in the link above to make it use 5.47. 

--Nasser

Dima Pasechnik

unread,
Jul 17, 2023, 3:27:55 AM7/17/23
to sage-...@googlegroups.com
On Mon, Jul 17, 2023 at 7:41 AM 'Nasser M. Abbasi' via sage-devel
<sage-...@googlegroups.com> wrote:
>
> "Would you conider posting your upgrade to Maxima (5.46.0 to 5.47.0) as a PR ?"
>
> I am sorry, I do not understand what you mean?
>
> I just followed instructions given in https://github.com/sagemath/sage/blob/1ca4a47dbd7c59f09b4840d66f6ced9edde9686a/build/pkgs/maxima/SPKG.rst
>
> To build sagemath with maxima 5.47.
>
> i.e. I downloaded maxima source and put it in the upstream folder and made changes as described in the above link.

this has changed Sage code, as you could see by running

git diff

You've opened an issue, how about opening a PR with these changes?

>
> At first I thought sagemath 10.1 beta6 will automatically build with maxima 5.47, because that is what it said in release notes of sagemath 10.1 beta5
>
> https://groups.google.com/g/sage-release/c/9kYG2vryie8
>
> "29daacb7579 gh-35707: Make Sage work with maxima 5.47"
>
> i.e. what I read the above, it sounded to me that now sagemath 10.1 will have maxima 5.47 out of the box. But it does not.
> So I had to follow the instructions in the link above to make it use 5.47.
>
> --Nasser
>
>
> On Monday, July 17, 2023 at 1:04:04 AM UTC-5 Emmanuel Charpentier wrote:
>>
>> Le lundi 17 juillet 2023 à 04:59:53 UTC+2, Nasser M. Abbasi a écrit :
>>
>> fyi, added PR
>>
>> https://github.com/sagemath/sage/issues/35960
>>
>> Would you conider posting your upgrade to Maxima (5.46.0 to 5.47.0) as a PR ?
>>
>> On Sunday, July 16, 2023 at 12:30:53 PM UTC-5 Matthias Koeppe wrote:
>>
>> On Sunday, July 16, 2023 at 5:48:00 AM UTC-7 Nasser M. Abbasi wrote:
>>
>> After some struggle, build sagemath with maxima 5.47 upstream.
>>
>>
>> Open a PR with the upgrade please
>>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/675e3dad-0549-4263-b3f7-36afe59e4fd1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages