From 3db87ad1fd15fb50b6e44267cc5c37759376bba0 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 5 Jul 2020 17:34:29 -0700 Subject: [PATCH 1/7] build/pkgs/maxima: Update to 5.44.0 --- build/pkgs/maxima/checksums.ini | 7 ++++--- build/pkgs/maxima/package-version.txt | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build/pkgs/maxima/checksums.ini b/build/pkgs/maxima/checksums.ini index f401c24c375..065f7d02e61 100644 --- a/build/pkgs/maxima/checksums.ini +++ b/build/pkgs/maxima/checksums.ini @@ -1,4 +1,5 @@ tarball=maxima-VERSION.tar.gz -sha1=ddb2f1405ccb2c4f2bd6712755e2dbbd9a2e57e0 -md5=b66bf80a95e7e78d68e5f230e7b94761 -cksum=1645453342 +sha1=5f1fce915675f46823c33638480dcc1fcaf447a1 +md5=75e040745161901968d9c99c7a258e5c +cksum=2316004676 +upstream_url=https://sourceforge.net/projects/maxima/files/Maxima-source/VERSION-source/maxima-VERSION.tar.gz/download diff --git a/build/pkgs/maxima/package-version.txt b/build/pkgs/maxima/package-version.txt index ec8bbb5f834..d532a08f3cd 100644 --- a/build/pkgs/maxima/package-version.txt +++ b/build/pkgs/maxima/package-version.txt @@ -1 +1 @@ -5.42.2 +5.44.0 From bcf3c98839dfdfa37a9863e6f1c70f20997bb4ea Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 18 Jul 2020 23:21:21 -0700 Subject: [PATCH 2/7] Remove old patches --- ...owing-the-stack-when-diff-expand-isn.patch | 85 ------------------- build/pkgs/maxima/patches/bugfix3629.patch | 19 ----- 2 files changed, 104 deletions(-) delete mode 100644 build/pkgs/maxima/patches/0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch delete mode 100644 build/pkgs/maxima/patches/bugfix3629.patch diff --git a/build/pkgs/maxima/patches/0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch b/build/pkgs/maxima/patches/0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch deleted file mode 100644 index 49abbb14c1c..00000000000 --- a/build/pkgs/maxima/patches/0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff --git a/src/hayat.lisp b/src/hayat.lisp -index 07699d6..ab8984d 100644 ---- a/src/hayat.lisp -+++ b/src/hayat.lisp -@@ -2189,6 +2189,23 @@ - (or (alike1 (exp-pt (get-datum (datum-var (car l)))) (exp-pt (car l))) - (return () )))) - -+;; SUBTREE-SEARCH -+;; -+;; Search for subtrees, ST, of TREE that contain an element equal to BRANCH -+;; under TEST as an immediate child and return them as a list. -+;; -+;; Examples: -+;; (SUBTREE-SEARCH 2 '(1 2 3)) => '((1 2 3)) -+;; (SUBTREE-SEARCH 2 '(1 2 2 3)) => '((1 2 2 3)) -+;; (SUBTREE-SEARCH 2 '(1 (2) 3)) => '((2)) -+;; (SUBTREE-SEARCH 4 '(1 (2) 3)) => NIL -+;; (SUBTREE-SEARCH 2 '(1 (2) 3 (2))) => '((2) (2)) -+ -+(defun subtree-search (branch tree &optional (test 'equalp)) -+ (unless (atom tree) -+ (if (find branch tree :test test) (list tree) -+ (mapcan (lambda (child) (subtree-search branch child test)) tree)))) -+ - (defun taylor2 (e) - (let ((last-exp e)) ;; lexp-non0 should be bound here when needed - (cond ((assolike e tlist) (var-expand e 1 () )) -@@ -2232,8 +2249,31 @@ - ((null l) t) - (or (free e (car l)) (return ())))) - (newsym e)) -- (t (let ((exact-poly () )) ; Taylor series aren't exact -- (taylor2 (diff-expand e tlist))))))) -+ (t -+ ;; When all else fails, call diff-expand to try to expand e around the -+ ;; point as a Taylor series by taking repeated derivatives. This might -+ ;; fail, unfortunately: If a required derivative doesn't exist, then -+ ;; DIFF-EXPAND will return a form of the form "f'(x)" with the -+ ;; variable, rather than the expansion point in it. -+ ;; -+ ;; Sometimes this works - in particular, if there is a genuine pole at -+ ;; the point, we end up passing a sum of terms like x^(-k) to a -+ ;; recursive invocation and all is good. Unfortunately, it can also -+ ;; fail. For example, if e is abs(sin(x)) and we try to expand to first -+ ;; order, the expression "1/1*(cos(x)*sin(x)/abs(sin(x)))*x^1+0" is -+ ;; returned. If we call taylor2 on that, we will end up recursing and -+ ;; blowing the stack. To avoid doing so, error out if EXPANSION -+ ;; contains E as a subtree. However, don't error if it occurs as an -+ ;; argument to %DERIVATIVE (in which case, we might well be fine). This -+ ;; happens from things like taylor(log(f(x)), x, x0, 1). -+ -+ (let* ((exact-poly nil) ; (Taylor series aren't exact) -+ (expansion (diff-expand e tlist))) -+ (when (find-if (lambda (subtree) -+ (not (eq ($op subtree) '%derivative))) -+ (subtree-search e expansion)) -+ (exp-pt-err)) -+ (taylor2 expansion)))))) - - (defun compatvarlist (a b c d) - (cond ((null a) t) -@@ -2968,7 +3008,21 @@ - (and (or (member '$inf pt-list :test #'eq) (member '$minf pt-list :test #'eq)) - (unfam-sing-err))) - --(defun diff-expand (exp l) ;l is tlist -+;; DIFF-EXPAND -+;; -+;; Expand EXP in the variables as specified in L, which is a list of tlists. If -+;; L is a singleton, this just works by the classic Taylor expansion: -+;; -+;; f(x) = f(c) + f'(c) + f''(c)/2 + ... + f^(k)(c)/k! -+;; -+;; If L specifies multiple expansions, DIFF-EXPAND works recursively by -+;; expanding one variable at a time. The derivatives are computed using SDIFF. -+;; -+;; In some cases, f'(c) or some higher derivative might be an expression of the -+;; form 1/0. Instead of returning an error, DIFF-EXPAND uses f'(x) -+;; instead. (Note: This seems bogus to me (RJS), but I'm just describing how -+;; EVAL-DERIV works) -+(defun diff-expand (exp l) - (check-inf-sing (mapcar (function caddr) l)) - (cond ((not l) exp) - (t diff --git a/build/pkgs/maxima/patches/bugfix3629.patch b/build/pkgs/maxima/patches/bugfix3629.patch deleted file mode 100644 index 196131410b0..00000000000 --- a/build/pkgs/maxima/patches/bugfix3629.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit 615b4bf8b13d55a576bc60ad04f7b17d75f49021 -Author: Yasuaki Honda -Date: Sun Apr 26 12:15:14 2020 +0900 - - Fix for Bug #3629, to compile with ECL 20.4.24 - -diff --git a/lisp-utils/defsystem.lisp b/lisp-utils/defsystem.lisp -index dda669d26..b8e96eebe 100644 ---- a/lisp-utils/defsystem.lisp -+++ b/lisp-utils/defsystem.lisp -@@ -4152,7 +4152,7 @@ the system definition, if provided." - #+:ecl - (progn - (ext:package-lock "CL" nil) -- (setf (symbol-function 'lisp:require) -+ (setf (symbol-function 'cl:require) - (symbol-function 'new-require)) - (ext:package-lock "CL" t)) - #+:lispworks From 07aa2f93345d2cecee75e074dc9bbcb22074129c Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 19 Jul 2020 00:13:56 -0700 Subject: [PATCH 3/7] build/pkgs/maxima/spkg-install.in: New workaround for makeinfo trouble --- build/pkgs/maxima/spkg-install.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build/pkgs/maxima/spkg-install.in b/build/pkgs/maxima/spkg-install.in index 835b9c068a0..eb4c0da4d14 100644 --- a/build/pkgs/maxima/spkg-install.in +++ b/build/pkgs/maxima/spkg-install.in @@ -41,6 +41,15 @@ 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 From 046634d7429f9c82a47b011dd986bbb665759a13 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 19 Jul 2020 20:27:25 -0700 Subject: [PATCH 4/7] sage.interfaces.maxima_abstract.MaximaAbstract._command_runner: Skip all comment lines, rather than counting lines to skip --- src/sage/interfaces/maxima_abstract.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py index ed3055da9d2..e6428852687 100644 --- a/src/sage/interfaces/maxima_abstract.py +++ b/src/sage/interfaces/maxima_abstract.py @@ -177,10 +177,14 @@ def _command_runner(self, command, s, redirect=True): if redirect: res = bytes_to_str(subprocess.check_output(cmd, shell=True, env=env)) - # We get 4 lines of commented verbosity every time Maxima starts - # and the input is echoed, so we need to get rid of them - for _ in range(5): - res = res[res.find('\n')+1:] + # We get a few lines of commented verbosity every time Maxima starts + while res.startswith(';;;'): + newline = res.find('\n') + if newline == -1: + break + res = res[newline + 1:] + # The input is echoed, so we need to get rid of it + res = res[res.find('\n')+1:] return AsciiArtString(res) else: From d1ad8d7a9482bbbb3b7c0a6b919744e954f396cf Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 19 Jul 2020 21:09:26 -0700 Subject: [PATCH 5/7] sage.interfaces.maxima_abstract.MaximaAbstract.completions: Remove '-impl' functions --- src/sage/interfaces/maxima_abstract.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sage/interfaces/maxima_abstract.py b/src/sage/interfaces/maxima_abstract.py index e6428852687..70e885c0930 100644 --- a/src/sage/interfaces/maxima_abstract.py +++ b/src/sage/interfaces/maxima_abstract.py @@ -293,8 +293,14 @@ def completions(self, s, verbose=True): # in Maxima 5.19.1, apropos returns all commands that contain # the given string, instead of all commands that start with # the given string - cmd_list = self._eval_line('apropos("%s")'%s, error_check=False).replace('\\ - ','-') - cmd_list = [x for x in cmd_list[1:-1].split(',') if x[0] != '?'] + # + # Maxima 5.44 changed DEFMFUN so that it creates both $NAME + # and $NAME-IMPL (although the documentation suggests it would + # create NAME-IMPL, without the leading $). This causes + # name-impl to show up in $APROPOS. We remove it. + # https://sourceforge.net/p/maxima/bugs/3643/ + cmd_list = self._eval_line('apropos("%s")'%s, error_check=False).replace('\\ - ','-').replace('\\-','-') + cmd_list = [x for x in cmd_list[1:-1].split(',') if x[0] != '?' and not x.endswith('-impl')] return [x for x in cmd_list if x.find(s) == 0] def _commands(self, verbose=True): From 8f83f9643a24963b4abf01d174c74158d2092408 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Fri, 14 Aug 2020 11:02:09 +0200 Subject: [PATCH 6/7] #30063 : Maxima gamma_greek is now called gamma_incomplete_lower --- src/sage/functions/gamma.py | 4 ++-- src/sage/symbolic/expression.pyx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/functions/gamma.py b/src/sage/functions/gamma.py index 3806cb01620..7f4b8325e41 100644 --- a/src/sage/functions/gamma.py +++ b/src/sage/functions/gamma.py @@ -509,14 +509,14 @@ def __init__(self): sage: gamma_inc_lower(x,x)._sympy_() lowergamma(x, x) sage: maxima(gamma_inc_lower(x,x)) - gamma_greek(_SAGE_VAR_x,_SAGE_VAR_x) + gamma_incomplete_lower(_SAGE_VAR_x,_SAGE_VAR_x) .. SEEALSO:: :class:`Function_gamma_inc` """ BuiltinFunction.__init__(self, "gamma_inc_lower", nargs=2, latex_name=r"\gamma", - conversions={'maxima':'gamma_greek', + conversions={'maxima':'gamma_incomplete_lower', 'maple':'GAMMA', 'sympy':'lowergamma', 'giac':'igamma'}) def _eval_(self, x, y): diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx index e18eda5f01a..51c597a6e5d 100644 --- a/src/sage/symbolic/expression.pyx +++ b/src/sage/symbolic/expression.pyx @@ -10038,7 +10038,7 @@ cdef class Expression(CommutativeRingElement): ....: .simplify_hypergeometric(algorithm='sage')) hypergeometric((hypergeometric((e^x,), (1,), x),), (1,), x) sage: hypergeometric_M(1, 3, x).simplify_hypergeometric() - -2*(x - e^x + 1)/x^2 + -2*((x + 1)*e^(-x) - 1)*e^x/x^2 sage: (2 * hypergeometric_U(1, 3, x)).simplify_hypergeometric() 2*(x + 1)/x^2 From 21e2feaa1188735241e988836a7d21bec258c741 Mon Sep 17 00:00:00 2001 From: Thierry Monteil Date: Fri, 14 Aug 2020 11:10:45 +0200 Subject: [PATCH 7/7] #30063 : mark Maxima's integration regression as known bug. --- src/sage/symbolic/integration/integral.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/symbolic/integration/integral.py b/src/sage/symbolic/integration/integral.py index b9734be1c7f..80bc14679c7 100644 --- a/src/sage/symbolic/integration/integral.py +++ b/src/sage/symbolic/integration/integral.py @@ -859,11 +859,11 @@ def integrate(expression, v=None, a=None, b=None, algorithm=None, hold=False): sage: integrate(cos(w+T) / (1+c*cos(T))^2, T, 0, 2*pi) 2*pi*sqrt(-c^2 + 1)*c*cos(w)/(c^4 - 2*c^2 + 1) - Check that :trac:`13733` is fixed:: + Check that :trac:`13733` is fixed (but the bug reappeared, see :trac:`30063`):: - sage: a = integral(log(cot(x) - 1), x, 0, pi/4); a # long time (about 6 s) + sage: a = integral(log(cot(x) - 1), x, 0, pi/4); a # long time (about 6 s) # known bug -1/4*pi*log(2) - 1/2*I*dilog(I + 1) + 1/2*I*dilog(-I + 1) + 1/2*I*dilog(1/2*I + 1/2) - 1/2*I*dilog(-1/2*I + 1/2) - sage: abs(N(a - pi*log(2)/8)) < 1e-15 # long time + sage: abs(N(a - pi*log(2)/8)) < 1e-15 # long time # known bug True Check that :trac:`17968` is fixed::