Skip to content

Conversation

antonio-rojas
Copy link
Contributor

@antonio-rojas antonio-rojas commented Aug 24, 2025

Mostly output format changes, but it is not trivial to make test pass with both old and new versions

@antonio-rojas
Copy link
Contributor Author

@tobiasdiez looks like this is still not available in conda, any idea who to ping to make it happen?

Copy link

github-actions bot commented Aug 24, 2025

Documentation preview for this PR (built with commit a58c077; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tobiasdiez
Copy link
Contributor

Only conda-forge/maxima-feedstock#40 needs to be merged by either @isuruf or @saraedum.

@@ -1673,7 +1673,7 @@ class SphericalBesselJ(BuiltinFunction):
sage: spherical_bessel_J(4, x).simplify()
-((45/x^2 - 105/x^4 - 1)*sin(x) + 5*(21/x^2 - 2)*cos(x)/x)/x
sage: integrate(spherical_bessel_J(1,x)^2,(x,0,oo))
1/6*pi
0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reported this regression upstream at https://sourceforge.net/p/maxima/bugs/4601/

@orlitzky
Copy link
Contributor

You may want to base this on #40574 in case some of the new output changes. I got started with the 5.48.x upgrade but gave up when I realized that not all of the output changes are improvements. (Thinking: we may want to support 5.47.x simultaneously rather than force people to upgrade to a version with regressions, but this is a lot of work).

@orlitzky
Copy link
Contributor

IMO anything in a TESTS:: block is a good candidate to be moved to pytest, and to be checked with assert actual == expected. It's pretty dumb that we have to go through and update this output every time a new version of maxima is released. If the answer is right, the output is OK.

@antonio-rojas
Copy link
Contributor Author

You may want to base this on #40574 in case some of the new output changes. I got started with the 5.48.x upgrade but gave up when I realized that not all of the output changes are improvements. (Thinking: we may want to support 5.47.x simultaneously rather than force people to upgrade to a version with regressions, but this is a lot of work).

Since that is already positively reviewed and this will take some time, I will rebase it after the next beta. Besides the non-trivial work of rewriting the doctests, supporting both versions also requires dealing with the pcprntd → *pcprntd* rename, which I have no idea how to do (I don't speak lisp).

@tobiasdiez
Copy link
Contributor

supporting both versions also requires dealing with the pcprntd → *pcprntd* rename, which I have no idea how to do (I don't speak lisp).

A bit of dreaming: After #39030, we could have meson write the version of maxima (or actually all dependencies) into config.py. Then you should be able to conditionally use the correct ecl_eval call based on the version (and also make the doctests work for different maxima versions).

@antonio-rojas
Copy link
Contributor Author

antonio-rojas commented Aug 26, 2025

Actually, it looks like we may just drop that principal redefinition. It was originally added in #11987 to fix integrate(sin(x)*sin(x/3)/x^2, x, 0, oo), but that seems to work just fine nowadays without that redefinition. I don't completely understand the code though.

CORRECTION: That redefinition is there since the introduction of the maxima lib interface in 970a833, not clear why. Running CI now without it to see if anything breaks.

@antonio-rojas
Copy link
Contributor Author

Seems to be needed:

**********************************************************************
Error: Failed example:: Got: 4/9
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
    integrate(1/x^3,x,-1,3)
Expected:
    Traceback (most recent call last):
    ...
    ValueError: Integral is divergent.
Got:
    4/9
**********************************************************************

@antonio-rojas
Copy link
Contributor Author

After #40574 it looks like #20467 is back:

**********************************************************************
File "/usr/lib/python3.13/site-packages/sage/symbolic/integration/integral.py", line 1096, in sage.symbolic.integration.integral.integrate
Failed example:
    integral(sin(k*x)/x*erf(x^2), x, 0, oo, algorithm='maxima')
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python3.13/site-packages/sage/doctest/forker.py", line 733, in _run
        self.compile_and_execute(example, compiler, test.globs)
        ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.13/site-packages/sage/doctest/forker.py", line 1157, in compile_and_execute
        exec(compiled, globs)
        ~~~~^^^^^^^^^^^^^^^^^
      File "<doctest sage.symbolic.integration.integral.integrate[152]>", line 1, in <module>
        integral(sin(k*x)/x*erf(x**Integer(2)), x, Integer(0), oo, algorithm='maxima')
        ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.13/site-packages/sage/misc/functional.py", line 787, in integral
        return x.integral(*args, **kwds)
               ~~~~~~~~~~^^^^^^^^^^^^^^^
      File "sage/symbolic/expression.pyx", line 13181, in sage.symbolic.expression.Expression.integral
        return integral(self, *args, **kwds)
      File "/usr/lib/python3.13/site-packages/sage/symbolic/integration/integral.py", line 1104, in integrate
        return integrator(expression, v, a, b)
      File "/usr/lib/python3.13/site-packages/sage/symbolic/integration/external.py", line 41, in maxima_integrator
        result = maxima.sr_integral(expression, v, a, b)
      File "/usr/lib/python3.13/site-packages/sage/interfaces/maxima_lib.py", line 802, in sr_integral
        return max_to_sr(maxima_eval(([max_integrate],
                         ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
                                      [sr_to_max(SR(a)) for a in args])))
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "sage/libs/ecl.pyx", line 828, in sage.libs.ecl.EclObject.__call__
        return ecl_wrap(ecl_safe_apply(self.obj, (<EclObject>lispargs).obj))
      File "sage/libs/ecl.pyx", line 356, in sage.libs.ecl.ecl_safe_apply
        raise RuntimeError("ECL says: {}".format(message))
    RuntimeError: ECL says: BINDING-STACK overflow at size 10240. Stack can probably be resized.
    Proceed with caution.
**********************************************************************

Reproducible in maxima itself (but only in 5.48):

(%i1) load(abs_integrate);
(%o1) /usr/share/maxima/5.48.1/share/contrib/integration/abs_integrate.mac
(%i2) integrate(sin(k*x)/x*erf(x^2),x,0,inf);

Maxima encountered a Lisp error:

 BINDING-STACK overflow at size 10240. Stack can probably be resized.
Proceed with caution.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

@orlitzky
Copy link
Contributor

After #40574 it looks like #20467 is back:

https://sourceforge.net/p/maxima/bugs/4603/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants