Skip to content

Commit

Permalink
Trac #13973: Upgrade Maxima to 5.33.0
Browse files Browse the repository at this point in the history
This is a continuation of #13364, and aims at including more upstream
bug fixes, which e.g. fix an
[http://permalink.gmane.org/gmane.comp.mathematics.sage.support/30644
issue reported on sage-support],
which was reported as Maxima bug
[https://sourceforge.net/p/maxima/bugs/2535 2535], and marked there as
closed in post-5.29.1.

Fixes #11894, #13526, #13712, #14209, #14306, #15386 and possibly other
Maxima-related bugs.

Ought to fix #13733 (but loading the `abs_integrate` package currently
causes this to fail).

Ought to fix #8728 (but Maxima asks for more constraints which follow
from the existing ones).

Does not fix #14591, #14677, #15033.

'''tarball:''' [http://homepages.warwick.ac.uk/staff/P.Bruin/sage/maxima
-5.33.0.tar.bz2]

Note about the existing `maxima_bug_2526.patch`: ​the bug was marked
"closed" in the [http://sourceforge.net/p/maxima/bugs/2526/ Maxima bug
tracking system], but the commit somehow disappeared from the Maxima
repository and the bug has been reopened.  Hence this patch is still
needed to fix it.

URL: http://trac.sagemath.org/13973
Reported by: dimpase
Ticket author(s): Peter Bruin
Reviewer(s): Marc Mezzarobba
  • Loading branch information
Release Manager authored and vbraun committed May 25, 2014
2 parents a3c4cf3 + a130eed commit 6220027
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 93 deletions.
62 changes: 37 additions & 25 deletions build/pkgs/maxima/SPKG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,55 @@ COPYING.

* The Maxima mailing list - see http://maxima.sourceforge.net/maximalist.html

== Dependencies ==

* ECL (Embedded Common Lisp)

== Special Update/Build Instructions ==

* Make sure the patches still apply cleanly.
1. Go to http://sourceforge.net/projects/maxima/files/Maxima-source/
and download the source tarball maxima-x.y.z.tar.gz.

2. Extract the tarball.

3. In the directory maxima-x.y.z, run the spkg-src script.

4. Compress the directory into a new file maxima-x.y.z.tar.bz2 and
place it in the upstream/ directory.

* Run the `spkg-src` script after updating to a newer upstream
release. It removes a large amount of unused documentation and
disables the associated Makefiles, reducing the size of the SPKG
greatly.
5. Make sure the patches still apply cleanly, and update them if
necessary.

=============================================================
6. Test the resulting package.

How to make a new version of the Maxima spkg.
Here's what spkg-src does:

1. Go to http://sourceforge.net/project/showfiles.php?group_id=4933
and download the source tar.gz ball. That's near the bottom
of that page (i.e., hard to find if you don't scroll past
all the big red adds).
* Removes the unneeded PDF figures from the documentation.

2. Extract the tarball to replace the src/ subdirectory of this package.
* Removes the foreign language versions of the info files.

3. Create an spkg from this directory, with
sage -pkg maxima-x.y.z
The following patches are applied:

4. Test the resulting maxima-??.spkg.
* 0001-taylor2-Avoid-blowing-the-stack-when-diff-expand-isn.patch:
Fix for Maxima bug #2520 (abs_integrate fails on abs(sin(x)) and
abs(cos(x))). Introduced in Trac #13364 (Upgrade Maxima to
5.29.1).

=============================================================
* build-fasl.patch: Build a fasl library for ecl in addition to an
executable program. Introduced in Trac #16178 (Build maxima fasl
without asdf).

Here's what spkg-dist does:
* infodir.patch: Correct the path to the Info directory.

* Removes the foreign language versions of the info files,
since they add several MEGS (and they weren't in previous
versions of Maxima). This means making empty directories
and changing the Makefile.in's.
* matrixexp.patch: Fix matrixexp(matrix([%i*%pi])), which broke after
Maxima 5.29.1. Introduced in Trac #13973.

* In the past, before doing step 3 above, one would also type
* maxima_bug_2526.patch: Fix for Maxima bug #2526 (abs_integrate
fails on integrate(sqrt(x + sqrt(x)), x)). Introduced in Trac
#13364 (Upgrade Maxima to 5.29.1).

./spkg-dist
* maxima.system.patch: Set c::*compile-in-constants* to t.

However, this caused problems with calling automake because
of the changed .in files.
* undoing_true_false_printing_patch.patch: Revert an upstream change
causing '?' to be printed around some words. Introduced in Trac
#13364 (Upgrade Maxima to 5.29.1).
6 changes: 3 additions & 3 deletions build/pkgs/maxima/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
tarball=maxima-VERSION.tar.bz2
sha1=9314e23a4166a3d455b37a18d846474aa310e6c4
md5=40b01a718ddba1c8364d76a1e5d35d8f
cksum=2999621606
sha1=8c1a10d0cfb10bb10448fd18b021d73e25fc744a
md5=55140d4f9f7f212fb1cf8479b895862e
cksum=1303222960
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.29.1.p5
5.33.0.p0
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ diff --git a/tests/rtest_taylor.mac b/tests/rtest_taylor.mac
index 1b26258..d2132c7 100644
--- a/tests/rtest_taylor.mac
+++ b/tests/rtest_taylor.mac
@@ -517,3 +517,9 @@ diff('(f(taylor(x,x,0,6))),x);
'diff(f(taylor(x,x,0,6)),x,1);
ev(%,nouns);
'diff(f(+x),x,1);
@@ -539,3 +539,9 @@
+ 2856700692480*x^2 + 3370143559680*x + 2386516803584)],
pade (t, 5, 5), is (equal (%%, foo)));
true;
+
+/* Avoid blowing the stack if diff-expand doesn't return anything
+ helpful. Example comes from Bug ID: 2520
Expand Down
13 changes: 13 additions & 0 deletions build/pkgs/maxima/patches/matrixexp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/share/linearalgebra/matrixexp.lisp 2013-10-07 04:37:12.000000000 +0100
+++ b/share/linearalgebra/matrixexp.lisp 2014-05-16 02:16:09.112011893 +0100
@@ -138,8 +138,8 @@
(print `(ratvars = ,$ratvars gcd = '$gcd algebraic = ,$algebraic))
(print `(ratfac = ,$ratfac))
(merror "Unable to find the spectrum")))
-
- (setq res ($fullratsimp (ncpower (sub (mult z ($ident n)) mat) -1) z))
+
+ (setq res ($fullratsimp ($invert (sub (mult z ($ident n)) mat) '$crering) z))
(setq m (length sp))
(dotimes (i m)
(setq zi (nth i sp))
9 changes: 2 additions & 7 deletions build/pkgs/maxima/patches/maxima_bug_2526.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
q : almost_everywhere_simp(q),
--- a/share/contrib/integration/rtest_abs_integrate.mac
+++ b/share/contrib/integration/rtest_abs_integrate.mac
@@ -511,16 +511,24 @@ integrate(sqrt(max(5,x)),x);
@@ -510,12 +510,19 @@ integrate(sqrt(max(5,x)),x);
/* abs_integrate causes stack overflow - ID: 3533723 */
block([extra_integration_methods : ['intfudu, 'intfugudu, 'signum_int, 'abs_integrate_use_if, 'floor_int, 'if_int]],
integrate(log(sin(x)),x));
Expand All @@ -35,10 +35,5 @@
+integrate(sqrt(x + sqrt(x)),x,0,1);
+(3*log(sqrt(2)+1)-3*log(sqrt(2)-1)+7*2^(3/2))/24$

(print("time = ", elapsed_real_time () - start), is(elapsed_real_time () - start < 70));
true$
/* SF bug #2557: "abs_integrate leaks assumptions into enclosing context" */

+
(remvalue(e,i,di,f1,start), remove(x,noninteger), remfunction(convolution, unit_box),0);
0$

6 changes: 3 additions & 3 deletions build/pkgs/maxima/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def cmd(x):
if os.system(x):
print "(Failed.)"

cmd('rm src/doc/info/figures/*.pdf')
cmd('rm doc/info/figures/*.pdf')

for X in ['de', 'de.utf8', 'es', 'es.utf8', 'pt', 'pt.utf8', 'pt_BR', 'pt_BR.utf8']:
cmd('rm -r src/doc/info/%s/*'%X)
open('src/doc/info/%s/Makefile.in'%X,'w').write('all:\n\tls\n\n')
cmd('rm -r doc/info/%s/*'%X)
open('doc/info/%s/Makefile.in'%X,'w').write('all:\n\tls\n\n')
2 changes: 1 addition & 1 deletion src/sage/calculus/calculus.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ def limit(ex, dir=None, taylor=False, algorithm='maxima', **argv):
ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before limit evaluation
*may* help (see `assume?` for more details)
Is a positive, negative, or zero?
Is a positive, negative or zero?
With this example, Maxima is looking for a LOT of information::
Expand Down
2 changes: 1 addition & 1 deletion src/sage/calculus/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def integral(f, *args, **kwds):
constraints; using the 'assume' command before integral evaluation
*may* help (example of legal syntax is 'assume(a>0)',
see `assume?` for more details)
Is a positive, negative, or zero?
Is a positive, negative or zero?
sage: assume(a>0)
sage: integral(abs(x)*x, x, 0, a)
1/3*a^3
Expand Down
6 changes: 3 additions & 3 deletions src/sage/functions/bessel.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def __call__(self, *args, **kwds):
sage: bessel_J(0, 1.0, "maxima", 53)
doctest:1: DeprecationWarning: precision argument is deprecated; algorithm argument is currently deprecated, but will be available as a named keyword in the future
See http://trac.sagemath.org/4102 for details.
.7651976865579666
0.7651976865579666
"""
if len(args) > 2 or len(kwds) > 0:
from sage.misc.superseded import deprecation
Expand Down Expand Up @@ -1485,8 +1485,8 @@ def __init__(self, nu, typ = "J", algorithm = None, prec = 53):
bessel_j(6,pi)
sage: b.n(53)
0.0145459669825056
sage: _Bessel(6, typ='I', algorithm="maxima")(pi)
0.0294619840059568
sage: _Bessel(6, typ='I', algorithm="maxima")(pi) # rel tol 5e-13
0.02946198400594384
sage: _Bessel(6, typ='Y', algorithm="maxima")(pi)
-4.33932818939038
Expand Down
17 changes: 9 additions & 8 deletions src/sage/interfaces/maxima.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,9 @@ def __init__(self, script_subdirectory=None, logfile=None, server=None,
self._display_prompt = '<sage-display>'
# See #15440 for the importance of the trailing space
self._output_prompt_re = re.compile('\(\%o[0-9]+\) ')
self._ask = ['zero or nonzero?', 'an integer?', 'positive, negative, or zero?',
'positive or negative?', 'positive or zero?']
self._ask = ['zero or nonzero\\?', 'an integer\\?',
'positive, negative or zero\\?', 'positive or negative\\?',
'positive or zero\\?', 'equal to .*\\?']
self._prompt_wait = [self._prompt] + [re.compile(x) for x in self._ask] + \
['Break [0-9]+'] #note that you might need to change _expect_expr if you
#change this
Expand Down Expand Up @@ -642,7 +643,7 @@ def _expect_expr(self, expr=None, timeout=None):
TypeError: Computation failed since Maxima requested additional
constraints (try the command "maxima.assume('a>0')"
before integral or limit evaluation, for example):
Is a positive or negative?
Is a positive or negative?
sage: maxima.assume('a>0')
[a>0]
sage: maxima('integrate(1/(x^3*(a+b*x)^(1/3)),x)')
Expand All @@ -651,9 +652,9 @@ def _expect_expr(self, expr=None, timeout=None):
Traceback (most recent call last):
...
TypeError: Computation failed since Maxima requested additional
constraints (try the command "maxima.assume('n+1>0')" before
constraints (try the command "maxima.assume('n>0')" before
integral or limit evaluation, for example):
Is n+1 zero or nonzero?
Is n equal to -1?
sage: maxima.assume('n+1>0')
[n>-1]
sage: maxima('integrate(x^n,x)')
Expand All @@ -670,7 +671,7 @@ def _expect_expr(self, expr=None, timeout=None):
TypeError: Computation failed since Maxima requested additional
constraints (try the command "maxima.assume('a>0')" before
integral or limit evaluation, for example):
Is a positive, negative, or zero?
Is a positive, negative or zero?
"""
if expr is None:
expr = self._prompt_wait
Expand All @@ -692,8 +693,8 @@ def _expect_expr(self, expr=None, timeout=None):

j = v.find('Is ')
v = v[j:]
k = v.find(' ',4)
msg = """Computation failed since Maxima requested additional constraints (try the command "maxima.assume('""" + v[4:k] +""">0')" before integral or limit evaluation, for example):\n""" + v + self._ask[i-1]
k = v.find(' ', 3)
msg = """Computation failed since Maxima requested additional constraints (try the command "maxima.assume('""" + v[3:k] + """>0')" before integral or limit evaluation, for example):\n""" + v + self._expect.after
self._sendline(";")
self._expect_expr()
raise ValueError(msg)
Expand Down
16 changes: 8 additions & 8 deletions src/sage/interfaces/maxima_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def completions(self, s, verbose=True):
EXAMPLES::
sage: sorted(maxima.completions('gc', verbose=False))
['gcd', 'gcdex', 'gcfactor', 'gcprint', 'gctime']
['gcd', 'gcdex', 'gcfactor', 'gctime']
"""
if verbose:
print s,
Expand Down Expand Up @@ -420,7 +420,7 @@ def version(self):
EXAMPLES::
sage: maxima.version()
'5.29.1'
'5.33.0'
"""
return maxima_version()

Expand Down Expand Up @@ -601,11 +601,11 @@ def function(self, args, defn, rep=None, latex=None):
EXAMPLES::
sage: f = maxima.function('x', 'sin(x)')
sage: f(3.2)
-.058374143427580...
sage: f(3.2) # abs tol 2e-16
-0.058374143427579909
sage: f = maxima.function('x,y', 'sin(x)+cos(y)')
sage: f(2,3.5)
sin(2)-.9364566872907963
sage: f(2, 3.5) # abs tol 2e-16
sin(2)-0.9364566872907963
sage: f
sin(x)+cos(y)
Expand Down Expand Up @@ -1513,7 +1513,7 @@ def nintegral(self, var='x', a=0, b=1,
EXAMPLES::
sage: maxima('exp(-sqrt(x))').nintegral('x',0,1)
(.5284822353142306, 4.16331413788384...e-11, 231, 0)
(0.5284822353142306, 4.16331413788384...e-11, 231, 0)
Note that GP also does numerical integration, and can do so to very
high precision very quickly::
Expand Down Expand Up @@ -2352,7 +2352,7 @@ def maxima_version():
sage: from sage.interfaces.maxima_abstract import maxima_version
sage: maxima_version()
'5.29.1'
'5.33.0'
"""
return os.popen('maxima --version').read().split()[-1]

Expand Down
31 changes: 20 additions & 11 deletions src/sage/interfaces/maxima_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ def sr_integral(self,*args):
constraints; using the 'assume' command before integral evaluation
*may* help (example of legal syntax is 'assume(a>0)', see
`assume?` for more details)
Is a positive or negative?
Is a positive or negative?
sage: assume(a>0)
sage: integrate(1/(x^3 *(a+b*x)^(1/3)),x)
2/9*sqrt(3)*b^2*arctan(1/3*sqrt(3)*(2*(b*x + a)^(1/3) + a^(1/3))/a^(1/3))/a^(7/3) - 1/9*b^2*log((b*x + a)^(2/3) + (b*x + a)^(1/3)*a^(1/3) + a^(2/3))/a^(7/3) + 2/9*b^2*log((b*x + a)^(1/3) - a^(1/3))/a^(7/3) + 1/6*(4*(b*x + a)^(5/3)*b^2 - 7*(b*x + a)^(2/3)*a*b^2)/((b*x + a)^2*a^2 - 2*(b*x + a)*a^3 + a^4)
Expand All @@ -665,9 +665,9 @@ def sr_integral(self,*args):
...
ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before integral evaluation
*may* help (example of legal syntax is 'assume(n+1>0)',
*may* help (example of legal syntax is 'assume(n>0)',
see `assume?` for more details)
Is n+1 zero or nonzero?
Is n equal to -1?
sage: assume(n+1>0)
sage: integral(x^n,x)
x^(n + 1)/(n + 1)
Expand Down Expand Up @@ -700,7 +700,16 @@ def sr_integral(self,*args):
::
sage: integrate(cos(x + abs(x)), x)
-1/2*x*sgn(x) + 1/4*(sgn(x) + 1)*sin(2*x) + 1/2*x
-1/4*(2*x - sin(2*x))*real_part(sgn(x)) + 1/2*x + 1/4*sin(2*x)
Note that the last example yielded the same answer in a
simpler form in earlier versions of Maxima (<= 5.29.1), namely
``-1/2*x*sgn(x) + 1/4*(sgn(x) + 1)*sin(2*x) + 1/2*x``. This
is because Maxima no longer simplifies ``realpart(signum(x))``
to ``signum(x)``::
sage: maxima("realpart(signum(x))")
'realpart(signum(x))
An example from sage-support thread e641001f8b8d1129::
Expand Down Expand Up @@ -742,8 +751,8 @@ def sr_integral(self,*args):
elif "Is" in s: # Maxima asked for a condition
j = s.find('Is ')
s = s[j:]
k = s.find(' ',4)
raise ValueError("Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(" + s[4:k] +">0)', see `assume?` for more details)\n" + s)
k = s.find(' ', 3)
raise ValueError("Computation failed since Maxima requested additional constraints; using the 'assume' command before integral evaluation *may* help (example of legal syntax is 'assume(" + s[3:k] + ">0)', see `assume?` for more details)\n" + s)
else:
raise

Expand Down Expand Up @@ -772,7 +781,7 @@ def sr_sum(self,*args):
constraints; using the 'assume' command before summation *may* help
(example of legal syntax is 'assume(abs(q)-1>0)', see `assume?`
for more details)
Is abs(q)-1 positive, negative, or zero?
Is abs(q)-1 positive, negative or zero?
sage: assume(q > 1)
sage: sum(a*q^k, k, 0, oo)
Traceback (most recent call last):
Expand Down Expand Up @@ -808,8 +817,8 @@ def sr_sum(self,*args):
elif "Is" in s: # Maxima asked for a condition
j = s.find('Is ')
s = s[j:]
k = s.find(' ',4)
raise ValueError("Computation failed since Maxima requested additional constraints; using the 'assume' command before summation *may* help (example of legal syntax is 'assume(" + s[4:k] +">0)', see `assume?` for more details)\n" + s)
k = s.find(' ', 3)
raise ValueError("Computation failed since Maxima requested additional constraints; using the 'assume' command before summation *may* help (example of legal syntax is 'assume(" + s[3:k] + ">0)', see `assume?` for more details)\n" + s)
else:
raise

Expand All @@ -834,7 +843,7 @@ def sr_limit(self,expr,v,a,dir=None):
ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before limit evaluation
*may* help (see `assume?` for more details)
Is a positive, negative, or zero?
Is a positive, negative or zero?
sage: assume(a>0)
sage: limit(x^a,x=0)
Traceback (most recent call last):
Expand Down Expand Up @@ -966,7 +975,7 @@ def to_poly_solve(self,vars,options=""):
sage: from sage.interfaces.maxima_lib import maxima_lib
sage: sol = maxima_lib(sin(x) == 0).to_poly_solve(x)
sage: sol.sage()
[[x == pi + 2*pi*z60], [x == 2*pi*z62]]
[[x == pi*z54]]
"""
if options.find("use_grobner=true") != -1:
cmd=EclObject([[max_to_poly_solve], self.ecl(), sr_to_max(vars),
Expand Down
Loading

0 comments on commit 6220027

Please sign in to comment.