Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'public/t18920' of trac.sagemath.org:sage into ecl1613
Browse files Browse the repository at this point in the history
  • Loading branch information
dimpase committed Jan 16, 2017
2 parents eff6081 + af7e5ff commit 68da1e4
Show file tree
Hide file tree
Showing 36 changed files with 302 additions and 172 deletions.
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.gz
sha1=4431afec577e3cc42370fd768262cf7e1cef9f7f
md5=4bb0b999645ec2b20b7e301d36f83a4c
cksum=80051208
sha1=db4fb31512299e9971cfbc75cc60ca628861d3f5
md5=bc21a56e0e413c24a31408ee5900cb59
cksum=1205153224
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.35.1.p2
5.38.1.p1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
From 8ec3a05cd24c756f29e0501488be971fe13f7c1f Mon Sep 17 00:00:00 2001
From: Andrej Vodopivec <andrej.vodopivec@gmail.com>
Date: Sun, 6 Nov 2016 20:58:04 +0100
Subject: [PATCH] Another fix for summation of rational functions: make sure
there are no poles in the summation area.

Fixes bug #3236.

Added the two test cases from bugreport #3236.
---
share/solve_rec/rtest_simplify_sum.mac | 16 ++++++++++++++++
share/solve_rec/simplify_sum.mac | 11 +++++++----
2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/share/solve_rec/rtest_simplify_sum.mac b/share/solve_rec/rtest_simplify_sum.mac
index eda37e1..9f47c7e 100644
--- a/share/solve_rec/rtest_simplify_sum.mac
+++ b/share/solve_rec/rtest_simplify_sum.mac
@@ -597,3 +597,19 @@ test_sum(
1
);
0;
+
+test_sum(
+ sum(1/((n+1)*(2*n-1)), n, 1,inf),
+ [],
+ false,
+ [],
+ (2*log(2)+1)/3);
+0;
+
+test_sum(
+ sum(1/((2*n-1)^2*(2*n+1)^2*(2*n+3)^2),n,0,inf),
+ [],
+ false,
+ [],
+ (3*%pi^2)/256);
+0;
diff --git a/share/solve_rec/simplify_sum.mac b/share/solve_rec/simplify_sum.mac
index a0c2da3..0502f25 100644
--- a/share/solve_rec/simplify_sum.mac
+++ b/share/solve_rec/simplify_sum.mac
@@ -658,10 +658,16 @@ split_sum(expr) :=
*******************/

ratfun_to_psi(ratfun, var, lo, hi) := block(
- [pf, sum: 0, denom_f : factor_with_solve(denom(ratfun), var)],
+ [pf, sum: 0, denom_f : factor_with_solve(denom(ratfun), var), max_root],

pf : partfrac(num(ratfun)/denom_f, var),

+ max_root: lmax(sublist(map(rhs, solve(denom_f, var)), numberp)),
+ if (numberp(max_root) and numberp(lo)) then (
+ while (lo < max_root) do (
+ sum: sum+subst(var=lo, ratfun),
+ lo: lo+1)),
+
if inpart(pf, 0)="+" then pf: args(pf)
else pf: [pf],

@@ -806,9 +812,6 @@ simp_harmonic_number(x__):=
if x__=0 then 0
else if integerp(x__) and x__<1 then error("Zero to negative power computed.")
else if integerp(x__) then num_harmonic_number(1, x__)
- else if numberp(x__) and x__<-1 then block(
- [a:-floor(x__), k%],
- simp_harmonic_number(x__+a)-apply('sum, [1/k%, k%, x__, x__+a-1]))
else if numberp(x__) or imagpart(x__)#0 then psi[0](x__+1) + %gamma
else block(
[a, b, var, k%],
--
2.10.2

Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
From e916dd0776f636eec6ce73f1bbb8706b268d7e14 Mon Sep 17 00:00:00 2001
From: Robert Dodier <robert_dodier@users.sourceforge.net>
Date: Sun, 30 Oct 2016 17:41:44 -0700
Subject: [PATCH] In RGRP, rephrase test for ECL to avoid comparing float
infinity with rational, which tickles a bug in ECL (reported as
https://gitlab.com/embeddable-common-lisp/ecl/issues/299). Fixes SF bug
#3235: "ECL lisp arithmetic error in definite integration with large limits"

---
src/compar.lisp | 4 ++--
tests/rtest_limit.mac | 22 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/compar.lisp b/src/compar.lisp
index 2954abf..cf51f4f 100644
--- a/src/compar.lisp
+++ b/src/compar.lisp
@@ -2334,8 +2334,8 @@ TDNEG TDZERO TDPN) to store it, and also sets SIGN."
(if (not (numberp y))
(setq y (/ (cadr y) (caddr y))))
(cond
- ((> x y) '$pos)
- ((> y x) '$neg)
+ (#-ecl (> x y) #+ecl (> (- x y) 0) '$pos)
+ (#-ecl (> y x) #+ecl (> (- y x) 0) '$neg)
(t '$zero)))

(defun mcons (x l)
diff --git a/tests/rtest_limit.mac b/tests/rtest_limit.mac
index 88bcf78..b112eeb 100644
--- a/tests/rtest_limit.mac
+++ b/tests/rtest_limit.mac
@@ -790,3 +790,25 @@ block([modulus:7], sum(i^-2,i,1,inf));
block([modulus:7], limit(inf));
inf;

+/* SF bug #3235: "ECL lisp arithmetic error in definite integration with large limits"
+ * the bug is actually in ECL (https://gitlab.com/embeddable-common-lisp/ecl/issues/299);
+ * here we'll test a work around.
+ */
+
+block ([actual, expected],
+ actual : limit(x*exp(x)*log(exp(x)+1),x,-1000,plus),
+ expected : -1000*%e^-1000*log(%e^-1000*(%e^1000+1)),
+ if ev (equal (actual, expected), logexpand='super) then true else [actual, expected]);
+true;
+
+/* accommodate different equivalent forms via 'equal' */
+block ([actual, expected],
+ actual : integrate((x^2)*exp(x) / (1 + exp(x))^2,x,-1000,1000),
+ expected : (-(2000*%e^1000*log(%e^-1000*(%e^1000+1)))/(%e^1000+1))
+ -(2000*log(%e^-1000*(%e^1000+1)))/(%e^1000+1)
+ -((2000*%e^1000+2000)*log(%e^1000+1)
+ +(2*%e^1000+2)*li[2](-%e^1000)-1000000*%e^1000)
+ /(%e^1000+1)+(2*%e^1000*li[2](-%e^-1000))/(%e^1000+1)
+ +(2*li[2](-%e^-1000))/(%e^1000+1)-1000000/(%e^1000+1),
+ if ev (equal (actual, expected), logexpand='super) then true else [actual, expected]);
+true;
--
2.5.5

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
From 3e4e107715ac7f99f53785e4991887253183205c Mon Sep 17 00:00:00 2001
From: Robert Dodier <robert_dodier@users.sourceforge.net>
Date: Wed, 18 May 2016 17:35:55 -0700
Subject: [PATCH] In eigenvectors, iterate over all eigenvalues.

Fixes SF bug #3008: "Eigenvectors are missing", #3085: "missed eigenvectors",
#3149: "eigenvectors does not show eigenvectors with eigenvalue zero".
---
share/matrix/eigen.mac | 3 +--
tests/rtest15.mac | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/share/matrix/eigen.mac b/share/matrix/eigen.mac
index ae1c51a..eddf05d 100644
--- a/share/matrix/eigen.mac
+++ b/share/matrix/eigen.mac
@@ -119,8 +119,7 @@ eigenvectors(mat):=
nondiagonalizable:false,
eigvecs:[],realonly:false,algebraic:true,
for index1 thru count do
- (count:mi(count-part(multiplicities,index1)+1),
- mmatrx:matrx-part(eigvals,1,index1)*vectr,
+ (mmatrx:matrx-part(eigvals,1,index1)*vectr,
equations:[],
for index2 thru dimnsn do
equations:cons(mmatrx[index2,1],equations),%rnum:0,
diff --git a/tests/rtest15.mac b/tests/rtest15.mac
index 137a4b1..6e512ae 100644
--- a/tests/rtest15.mac
+++ b/tests/rtest15.mac
@@ -1363,3 +1363,42 @@ trigrat(e^x * sin(x));
trigrat(f^x * sin(x));
%i*abs(f)^x*sin(x)*sin(atan2(0, f)*x) + abs(f)^x*sin(x)*cos(atan2(0, f)*x);

+(check_eigenvectors (M) := block ([vals, vecs, mults, eqns],
+ [[vals, mults], vecs] : eigenvectors (M),
+ eqns : [lsum (m, m, mults) = length (M),
+ apply ("*", map (lambda ([v, m], v^m), vals, mults)) = determinant (M),
+ length (vecs) = length (vals),
+ every (lambda ([mults1, vecs1], length (vecs1) <= mults1), mults, vecs),
+ every (lambda ([val, vecs1], every (lambda ([vec], transpose (M . vec) = val * matrix (vec)), vecs1)), vals, vecs)],
+ if apply ("and", eqns)
+ then true
+ else [M, eqns]),
+ 0);
+0;
+
+/* SF bug #3008: "Eigenvectors are missing" */
+
+eigenvectors (matrix([1, 1, 0], [0, 1, 0], [0, 0, 2]));
+[[[1, 2], [2, 1]], [[[1, 0, 0]], [[0, 0, 1]]]];
+
+check_eigenvectors (matrix([1, 1, 0], [0, 1, 0], [0, 0, 2]));
+true;
+
+/* SF bug #3085: "missed eigenvectors" */
+
+eigenvectors (matrix([3,1,0,0,0], [1,3,0,0,0], [0,0,2,1,1], [0,0,1,2,1], [0,0,1,1,2]));
+[[[2, 1, 4], [1, 2, 2]],
+ [[[1, - 1, 0, 0, 0]],
+ [[0, 0, 1, 0, - 1], [0, 0, 0, 1, - 1]],
+ [[1, 1, 0, 0, 0], [0, 0, 1, 1, 1]]]];
+
+check_eigenvectors (matrix([3,1,0,0,0], [1,3,0,0,0], [0,0,2,1,1], [0,0,1,2,1], [0,0,1,1,2]));
+true;
+
+/* SF bug #3149: "eigenvectors does not show eigenvectors with eigenvalue zero" */
+
+eigenvectors (matrix([2,3,1],[4,4,2],[-4,-8,-2]));
+[[[2, 0], [2, 1]], [[[1, 1, - 3]], [[1, 0, - 2]]]];
+
+check_eigenvectors (matrix([2,3,1],[4,4,2],[-4,-8,-2]));
+true;
--
2.10.1

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/src/hayat.lisp b/src/hayat.lisp
index ae2c78c..4b9c547 100644
index 07699d6..ab8984d 100644
--- a/src/hayat.lisp
+++ b/src/hayat.lisp
@@ -2181,6 +2181,23 @@
@@ -2189,6 +2189,23 @@
(or (alike1 (exp-pt (get-datum (datum-var (car l)))) (exp-pt (car l)))
(return () ))))

Expand All @@ -26,7 +26,7 @@ index ae2c78c..4b9c547 100644
(defun taylor2 (e)
(let ((last-exp e)) ;; lexp-non0 should be bound here when needed
(cond ((assolike e tlist) (var-expand e 1 () ))
@@ -2224,8 +2241,31 @@
@@ -2232,8 +2249,31 @@
((null l) t)
(or (free e (car l)) (return ()))))
(newsym e))
Expand Down Expand Up @@ -60,7 +60,7 @@ index ae2c78c..4b9c547 100644

(defun compatvarlist (a b c d)
(cond ((null a) t)
@@ -2960,7 +3000,21 @@
@@ -2968,7 +3008,21 @@
(and (or (member '$inf pt-list :test #'eq) (member '$minf pt-list :test #'eq))
(unfam-sing-err)))

Expand All @@ -83,20 +83,3 @@ index ae2c78c..4b9c547 100644
(check-inf-sing (mapcar (function caddr) l))
(cond ((not l) exp)
(t
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
@@ -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
+ */
+errcatch(taylor (sin(x)/abs(sin(x)), x, 0, 0))$
+[];
--
1.7.10.4

23 changes: 0 additions & 23 deletions build/pkgs/maxima/patches/build-fasl.patch

This file was deleted.

10 changes: 6 additions & 4 deletions build/pkgs/maxima/patches/infodir.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
--- src/src/init-cl.lisp 2010-12-05 03:06:03.000000000 +0100
+++ src/src/init-cl.lisp 2011-05-18 19:16:05.226488803 +0200
@@ -131,7 +131,7 @@
diff --git a/src/init-cl.lisp b/src/init-cl.lisp
index 0e1f18b..125f449 100644
--- a/src/init-cl.lisp
+++ b/src/init-cl.lisp
@@ -134,7 +134,7 @@ When one changes, the other does too."
(setq libdir (combine-path maxima-prefix-env "lib"))
(setq libexecdir (combine-path maxima-prefix-env "libexec"))
(setq datadir (combine-path maxima-prefix-env "share"))
- (setq infodir (combine-path maxima-prefix-env "info")))
- (setq infodir (combine-path maxima-prefix-env #+(or cygwin windows win32 win64) "share" "info")))
+ (setq infodir (combine-path maxima-prefix-env "share" "info")))
(progn
(setq libdir (maxima-parse-dirstring *autoconf-libdir*))
Expand Down
25 changes: 0 additions & 25 deletions build/pkgs/maxima/patches/makeinfo.patch

This file was deleted.

2 changes: 2 additions & 0 deletions build/pkgs/maxima/patches/matrixexp.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
diff --git a/share/linearalgebra/matrixexp.lisp b/share/linearalgebra/matrixexp.lisp
index 218bf35..f2fd468 100644
--- a/share/linearalgebra/matrixexp.lisp
+++ b/share/linearalgebra/matrixexp.lisp
@@ -138,8 +138,8 @@
Expand Down
18 changes: 16 additions & 2 deletions build/pkgs/maxima/patches/maxima.system.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--- src/src/maxima.system 2010-12-04 18:06:03.000000000 -0800
+++ /Users/wstein/sage/install/sage-4.7.3.alpha1/spkg/build/maxima-5.23.2.p0/src/src/maxima.system 2011-10-30 23:52:09.000000000 -0700
diff --git a/src/maxima.system b/src/maxima.system
index 76f2452..cf25f51 100644
--- a/src/maxima.system
+++ b/src/maxima.system
@@ -1,5 +1,8 @@
;;; -*- Lisp -*-

Expand All @@ -9,3 +11,15 @@
(in-package :cl-user)

(pushnew :cl *features*)
@@ -75,6 +78,11 @@
;; Convert dir/foo.fas to dir/foo.o
(make-pathname :type "o" :defaults p))
files)))
+ (c::build-fasl "binary-ecl/maxima" :lisp-files obj
+ :ld-flags
+ (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
+ (find-package "MAXIMA")))))
+ (if (and x (not (string= x ""))) (list x))))
(c::build-program "binary-ecl/maxima" :lisp-files obj
:ld-flags
(let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"

0 comments on commit 68da1e4

Please sign in to comment.