Skip to content

Commit

Permalink
gh-35619: upgrade Maxima to 5.46.0
Browse files Browse the repository at this point in the history
    
### 📚 upgrade Maxima to 5.46.0

Our 5.45.0 is getting old. This will fix #32898 as well.

We have one mild regression found while working on #35615 (already
reported upstream),
 but number of improvements in a number of places. As #35615 is a part
of this PR branch,
I propose to review them all here.

We also promote `info` spkg to standard, and make it install
`makeinfo/texi2any`, to deal with Maxima docs.
This allows us to simplify configuration/installation of Maxima and ECL.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x
]`. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

#35615 - provide `spkg-configure.m4` for Maxima


<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: #35619
Reported by: Dima Pasechnik
Reviewer(s): Dima Pasechnik, François Bissey, Gonzalo Tornaría, Matthias Köppe, Mauricio Collares, Michael Orlitzky
  • Loading branch information
Release Manager committed May 27, 2023
2 parents 35cbd2f + 42a9042 commit 4ddf932
Show file tree
Hide file tree
Showing 31 changed files with 122 additions and 129 deletions.
2 changes: 1 addition & 1 deletion build/pkgs/ecl/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(MP_LIBRARY) readline gc libffi
$(MP_LIBRARY) readline gc libffi info

----------
All lines of this file are ignored except the first.
5 changes: 1 addition & 4 deletions build/pkgs/ecl/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ SAGE_SPKG_CONFIGURE([ecl], [
AC_SUBST(SAGE_ECL_CONFIG, [$ECL_CONFIG])
fi
# Maxima cannot yet be provided by the system, so we always use
# Kenzo cannot yet be provided by the system, so we always use
# the SAGE_LOCAL path for now.
AC_SUBST(SAGE_MAXIMA_FAS, ['${prefix}'/lib/ecl/maxima.fas])
# Likewise for the optional Kenzo SPKG
AC_SUBST(SAGE_KENZO_FAS, ['${prefix}'/lib/ecl/kenzo.fas])
])
12 changes: 0 additions & 12 deletions build/pkgs/ecl/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ cp "$SAGE_ROOT"/config/config.* src

if [ x"$SAGE_SPKG_INSTALL_DOCS" != xyes ] ; then
ECL_CONFIGURE="$ECL_CONFIGURE --enable-manual=no"
else
# ECL 2020 needs modern makeinfo
command -v texi2any >/dev/null 2>&1
if [ $? -ne 0 ]; then # texi2any not found -> makeinfo too old, if present
ECL_CONFIGURE="$ECL_CONFIGURE --enable-manual=no"
else
if makeinfo -c foo 2>&1 | grep -q invalid; then
# makeinfo found but does not support all options that ecl
# likes to use
ECL_CONFIGURE="$ECL_CONFIGURE --enable-manual=no"
fi
fi
fi

sdh_configure $SAGE_CONFIGURE_GMP \
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/giac/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SAGE_SPKG_CONFIGURE([giac], [
m4_pushdef([GIAC_MAX_VERSION], [1.9.999])
AC_CACHE_CHECK([for giac >= ]GIAC_MIN_VERSION[, <= ]GIAC_MAX_VERSION, [ac_cv_path_GIAC], [
AC_PATH_PROGS_FEATURE_CHECK([GIAC], [giac], [
giac_version=$($ac_path_GIAC --version 2> /dev/null | tail -1)
giac_version=$($ac_path_GIAC --version 2> /dev/null | tail -n 1)
AS_IF([test -n "$giac_version"], [
AX_COMPARE_VERSION([$giac_version], [ge], GIAC_MIN_VERSION, [
AX_COMPARE_VERSION([$giac_version], [le], GIAC_MAX_VERSION, [
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/info/distros/fedora.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
texinfo
texinfo info
12 changes: 11 additions & 1 deletion build/pkgs/info/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
SAGE_SPKG_CONFIGURE([info], [
AC_PATH_PROG(INFO, info)
AS_IF([test -z "${INFO}"], [sage_spkg_install_info=yes])
AS_IF([test -z "${INFO}"], [sage_spkg_install_info=yes
], [
dnl very old makeinfo are not texi2any, newer are symlinks to texi2any
AC_PATH_PROG(TEXI2ANY, texi2any)
AS_IF([test -z "${TEXI2ANY}"], [sage_spkg_install_info=yes
], [
AS_IF([makeinfo -c foo 2>&1 | grep -q invalid], [
dnl makeinfo found, but too old, and does not support all options that ecl likes to use
sage_spkg_install_info=yes])
])
])
])
2 changes: 1 addition & 1 deletion build/pkgs/info/spkg-install.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd src/info
cd src
sdh_make_install
2 changes: 1 addition & 1 deletion build/pkgs/info/type
Original file line number Diff line number Diff line change
@@ -1 +1 @@
optional
standard
6 changes: 3 additions & 3 deletions build/pkgs/maxima/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
tarball=maxima-VERSION.tar.gz
sha1=ed15d5285794413ba94412079eca3d0fa55a47bf
md5=9b9ae1dace55b1386739dabaa9122e60
cksum=1765409766
sha1=1010594e6d6082bbd8efaac1b7756ec1721a4ed5
md5=3c01f1daa6936e11d8713fef7751d3fe
cksum=2420393096
upstream_url=https://sourceforge.net/projects/maxima/files/Maxima-source/VERSION-source/maxima-VERSION.tar.gz/download
2 changes: 1 addition & 1 deletion build/pkgs/maxima/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ecl
ecl info

----------
All lines of this file are ignored except the first.
2 changes: 1 addition & 1 deletion build/pkgs/maxima/distros/arch.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
maxima-ecl
maxima-fas
1 change: 1 addition & 0 deletions build/pkgs/maxima/distros/cygwin.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
maxima
1 change: 1 addition & 0 deletions build/pkgs/maxima/distros/freebsd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
math/maxima
2 changes: 2 additions & 0 deletions build/pkgs/maxima/distros/gentoo.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sci-mathematics/maxima[ecls]

2 changes: 1 addition & 1 deletion build/pkgs/maxima/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.45.0.p0
5.46.0
15 changes: 0 additions & 15 deletions build/pkgs/maxima/patches/matrixexp.patch

This file was deleted.

25 changes: 0 additions & 25 deletions build/pkgs/maxima/patches/maxima.system.patch

This file was deleted.

46 changes: 46 additions & 0 deletions build/pkgs/maxima/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
SAGE_SPKG_CONFIGURE([maxima], [
m4_pushdef([SAGE_MAXIMA_MINVER],["5.45.0"])dnl this version and higher allowed
SAGE_SPKG_DEPCHECK([ecl], [
dnl First check for the "maxima" executable in the user's PATH, because
dnl we still use pexpect to communicate with it in a few places.
AC_CACHE_CHECK([for Maxima >= $SAGE_MAXIMA_MINVER], [ac_cv_path_MAXIMA], [
AC_PATH_PROGS_FEATURE_CHECK([MAXIMA], [maxima], [
maxima_version=`$ac_path_MAXIMA --version 2>&1 | tail -n 1\
| $SED -n -e 's/Maxima *\([[0-9]]*\.[[0-9]]*\.[[0-9]]*\)/\1/p'`
AS_IF([test -n "$maxima_version"], [
AX_COMPARE_VERSION([$maxima_version], [ge], [SAGE_MAXIMA_MINVER], [
ac_cv_path_MAXIMA="$ac_path_MAXIMA"
ac_path_MAXIMA_found=:
])
])
])
])
SAGE_MAXIMA="$ac_cv_path_MAXIMA"
AS_IF([test -z "${SAGE_MAXIMA}"], [
sage_spkg_install_maxima=yes
],[
dnl If we have the executable, check also for the ECL library.
AC_MSG_CHECKING([if ECL can "require" the maxima module])
AS_IF([ecl --eval "(require 'maxima)" --eval "(quit)" \
>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD], [
AC_MSG_RESULT(yes)
], [
AC_MSG_RESULT(no)
sage_spkg_install_maxima=yes
])
])
])
m4_popdef([SAGE_MAXIMA_MINVER])
],[],[],[
# post-check
AS_IF([test x$sage_spkg_install_maxima = xyes], [
dnl Leaving this variable empty will tell sagelib to load
dnl the maxima library (within ECL) by name instead of by
dnl absolute path.
SAGE_MAXIMA='${prefix}'/bin/maxima
SAGE_MAXIMA_FAS='${prefix}'/lib/ecl/maxima.fas
])
AC_SUBST(SAGE_MAXIMA, "${SAGE_MAXIMA}")
AC_SUBST(SAGE_MAXIMA_FAS, "${SAGE_MAXIMA_FAS}")
])
22 changes: 0 additions & 22 deletions build/pkgs/maxima/spkg-install.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,6 @@ echo
echo "Now configuring Maxima..."
sdh_configure --enable-ecl git_found=false

# Note the following is regression in maxima build system
# see https://sourceforge.net/p/maxima/bugs/3278/
# and https://sourceforge.net/p/maxima/bugs/2878/
# For the previous time it was fixed.
#---------------------------------------------------------------
# Touching html and info file to avoid to regenerate them.
# This must be done after configuration since the timestamp need
# to be later than include-maxima.texi which is generated at
# configuration time
for i in doc/info/*.html ; do
touch "${i}"
done
touch doc/info/maxima.info*
# Maxima 5.44.0 build_html.sh is not compatible with makeinfo 4.8
# (which is /usr/bin/makeinfo on macOS). #30063
# Do not build the HTML docs unless the user asks for it,
# in which case it is their problem to install a better
# makeinfo version.
if [[ "$SAGE_SPKG_INSTALL_DOCS" != yes ]] ; then
touch doc/info/maxima_toc.html interfaces/xmaxima/doc/xmaxima.html
fi

#---------------------------------------------------------------

sdh_make
Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/tox/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SAGE_SPKG_CONFIGURE([tox], [
m4_pushdef([TOX4_MIN_VERSION], [4.0.15])
AC_CACHE_CHECK([for tox 3 >= ]TOX3_MIN_VERSION[ or tox 4 >= ]TOX4_MIN_VERSION, [ac_cv_path_TOX], [
AC_PATH_PROGS_FEATURE_CHECK([TOX], [tox], [
tox_version=$($ac_path_TOX --version 2> /dev/null | tail -1)
tox_version=$($ac_path_TOX --version 2> /dev/null | tail -n 1)
AS_IF([test -n "$tox_version"], [
AX_COMPARE_VERSION([$tox_version], [lt], [4], [
AX_COMPARE_VERSION([$tox_version], [ge], TOX3_MIN_VERSION, [
Expand Down
6 changes: 4 additions & 2 deletions pkgs/sage-conf/_sage_conf/_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ VERSION = "@PACKAGE_VERSION@"
SAGE_LOCAL = "@prefix@"
SAGE_ROOT = "@SAGE_ROOT@"

MAXIMA = "@prefix@/bin/maxima"
# The path to the standalone maxima executable.
MAXIMA = "@SAGE_MAXIMA@".replace('${prefix}', SAGE_LOCAL)

# Delete this line if your ECL can load maxima without further prodding.
# Set this to the empty string if your ECL can load maxima without
# further prodding.
MAXIMA_FAS = "@SAGE_MAXIMA_FAS@".replace('${prefix}', SAGE_LOCAL)

# Delete this line if your ECL can load Kenzo without further prodding.
Expand Down
3 changes: 0 additions & 3 deletions src/bin/sage-env
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,6 @@ if [ -d "$DOT_SAGE" ] ; then
fi
fi

if [ -n "$SAGE_LOCAL" ]; then
export MAXIMA_PREFIX="$SAGE_LOCAL"
fi
export MAXIMA_USERDIR="$DOT_SAGE/maxima"

if [ -n "$SAGE_LOCAL" ]; then
Expand Down
27 changes: 19 additions & 8 deletions src/sage/calculus/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@
[ 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x)) 1/2*(x*e^(2*sqrt(x)) - x)*sqrt(x)*e^(x - sqrt(x))]
[ 1/2*(e^(2*sqrt(x)) - 1)*e^(x - sqrt(x))/x^(3/2) 1/2*(e^(2*sqrt(x)) + 1)*e^(x - sqrt(x))]
And complex exponentiation works now::
Complex exponentiation works, but may require a patched version of
maxima (:trac:`32898`) for now::
sage: M = i*matrix([[pi]])
sage: e^M
sage: e^M # not tested, requires patched maxima
[-1]
sage: M = i*matrix([[pi,0],[0,2*pi]])
sage: e^M
Expand Down Expand Up @@ -1186,8 +1187,18 @@ def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv):
e
sage: f.limit(x=5)
7776/3125
sage: f.limit(x=1.2)
Domain to real, a regression in 5.46.0, see https://sf.net/p/maxima/bugs/4138 ::
sage: maxima_calculus.eval("domain:real")
...
sage: f.limit(x=1.2).n()
2.06961575467...
sage: maxima_calculus.eval("domain:complex");
...
Otherwise, it works ::
sage: f.limit(x=I, taylor=True)
(-I + 1)^I
sage: f(x=1.2)
Expand Down Expand Up @@ -1215,7 +1226,7 @@ def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv):
With this example, Maxima is looking for a LOT of information::
sage: assume(a>0)
sage: limit(x^a,x=0)
sage: limit(x^a,x=0) # random - maxima 5.46.0 does not need extra assumption
Traceback (most recent call last):
...
ValueError: Computation failed since Maxima requested additional
Expand All @@ -1224,7 +1235,7 @@ def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv):
more details)
Is a an integer?
sage: assume(a,'integer')
sage: limit(x^a, x=0)
sage: limit(x^a, x=0) # random - maxima 5.46.0 does not need extra assumption
Traceback (most recent call last):
...
ValueError: Computation failed since Maxima requested additional
Expand Down Expand Up @@ -2251,10 +2262,10 @@ def symbolic_expression_from_maxima_string(x, equals_sub=False, maxima=maxima):
True
sage: sefms("x # 3") == SR(x != 3)
True
sage: solve([x != 5], x)
[[x - 5 != 0]]
sage: solve([x != 5], x) in [[[x - 5 != 0]], [[x < 5], [5 < x]]]
True
sage: solve([2*x==3, x != 5], x)
[[x == (3/2), (-7/2) != 0]]
[[x == (3/2)...
Make sure that we don't accidentally pick up variables in the maxima namespace (:trac:`8734`)::
Expand Down
4 changes: 2 additions & 2 deletions src/sage/functions/exp_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ class Function_log_integral_offset(BuiltinFunction):
1/log(x)
sage: f.integrate(x)
-x*log_integral(2) + x*log_integral(x) - Ei(2*log(x))
sage: Li(x).integrate(x,2.0,4.5)
-2.5*log_integral(2) + 5.799321147411334
sage: Li(x).integrate(x,2.0,4.5).n(digits=10)
3.186411697
sage: N(f.integrate(x,2.0,3.0)) # abs tol 1e-15
0.601621785860587
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def quit(self, verbose=False):
sage: a = maxima('y')
sage: maxima.quit(verbose=True)
Exiting Maxima with PID ... running .../bin/maxima...
Exiting Maxima with PID ... running ...maxima...
sage: a._check_valid()
Traceback (most recent call last):
...
Expand Down
8 changes: 0 additions & 8 deletions src/sage/interfaces/maxima.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,21 +622,13 @@ def _start(self):
sage: m.is_running()
True
Test that we can use more than 256MB RAM (see :trac:`6772`)::
sage: a = maxima(10)^(10^5)
sage: b = a^600 # long time -- about 10-15 seconds
"""
Expect._start(self)
self._sendline(r":lisp (defun tex-derivative (x l r) (tex (if $derivabbrev (tex-dabbrev x) (tex-d x '\\partial)) l r lop rop ))")

# Don't use ! for factorials (#11539)
self._sendline(":lisp (remprop 'mfactorial 'grind)")

# Remove limit on the max heapsize (since otherwise it defaults
# to 256MB with ECL).
self._sendline(":lisp (ext:set-limit 'ext:heap-size 0)")
self._eval_line('0;')

# set random seed
Expand Down
11 changes: 9 additions & 2 deletions src/sage/interfaces/maxima_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,8 +934,15 @@ def sr_limit(self, expr, v, a, dir=None):
e
sage: limit(f,x = 5)
7776/3125
sage: limit(f,x = 1.2)
Domain to real, a regression in 5.46.0, see https://sf.net/p/maxima/bugs/4138 ::
sage: maxima_calculus.eval("domain:real")
...
sage: limit(f,x = 1.2).n()
2.06961575467...
sage: maxima_calculus.eval("domain:complex");
...
sage: var('a')
a
sage: limit(x^a,x=0)
Expand All @@ -947,7 +954,7 @@ def sr_limit(self, expr, v, a, dir=None):
for more details)
Is a positive, negative or zero?
sage: assume(a>0)
sage: limit(x^a,x=0)
sage: limit(x^a,x=0) # random - not needed for maxima 5.46.0
Traceback (most recent call last):
...
ValueError: Computation failed ...
Expand Down
5 changes: 3 additions & 2 deletions src/sage/matrix/matrix2.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15425,9 +15425,10 @@ cdef class Matrix(Matrix1):

TESTS:

Check that sparse matrices are handled correctly (:trac:`28935`)::
Sparse matrices are handled correctly (:trac:`28935`), but may
require a patched version of maxima (:trac:`32898`) for now::

sage: matrix.diagonal([0], sparse=True).exp()
sage: matrix.diagonal([0], sparse=True).exp() # not tested, requires patched maxima
[1]
sage: matrix.zero(CBF, 2, sparse=True).exp()
[1.000000000000000 0]
Expand Down
Loading

0 comments on commit 4ddf932

Please sign in to comment.