From: Rupert Swarbrick <rswarbrick@us...>  20140130 23:41:26

This is an automated email from the git hooks/postreceive script. It was generated because a ref change was pushed to the repository containing the project "Maxima CAS". The branch, master has been updated via d58d3799007ce03d6440bb915c8e5f307fe6f859 (commit) via 2f9ae60628c1f95c934bcb926a85c452b42a8195 (commit) from e61b21595368a73864c158606702cc9b7c2ad461 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.  Log  commit d58d3799007ce03d6440bb915c8e5f307fe6f859 Author: Rupert Swarbrick <rswarbrick@...> Date: Thu Jan 30 23:37:39 2014 +0000 Trivial change to fix some subscripted integration $DEFINT used STRIPDOLLAR to make a temporary integration variable when you passed it a subscripted variable. This turns out to be less than brilliant... The first example in #2676 hit this bug because it was using x[1]. It turns out that X is the dummy variable used in the integral lookup table (and (STRIPDOLLAR $X) => X). Gensyms seem a saner way to make symbols... diff git a/src/defint.lisp b/src/defint.lisp index f2a270f..2ecd50d 100644  a/src/defint.lisp +++ b/src/defint.lisp @@ 202,13 +202,13 @@ in the interval of integration.") (setq ul (ratdisrep ul)) (cond (($constantp var) (merror (intl:gettext "defint: variable of integration cannot be a constant; found ~M") var))  (($subvarp var) (setq var (stripdollar (caar var))) + (($subvarp var) (setq var (gensym)) (setq exp ($substitute var origvar exp)))) (cond ((not (atom var)) (merror (intl:gettext "defint: variable of integration must be a simple or subscripted variable.~%defint: found ~M") var)) ((or (among var ul) (among var ll))  (setq var (stripdollar var)) + (setq var (gensym)) (setq exp ($substitute var origvar exp)))) (unless (lenientextendedrealp ll) (merror (intl:gettext "defint: lower limit of integration must be real; found ~M") ll)) diff git a/tests/rtest16.mac b/tests/rtest16.mac index 3d12f40..d8310d1 100644  a/tests/rtest16.mac +++ b/tests/rtest16.mac @@ 1872,3 +1872,7 @@ true$ /* #2680: Floating point overflow multiplying an integer by float */ bfloatp(1000! * 0.01); true$ + +/* #2676 (1/3): Integration yields noun form with subscripted variable */ +integrate(exp((1+%i)*x[1]),x[1],0,inf); +1/2  %i/2$ commit 2f9ae60628c1f95c934bcb926a85c452b42a8195 Author: Rupert Swarbrick <rswarbrick@...> Date: Thu Jan 30 22:39:26 2014 +0000 Document SUMOFINTSP & make it a bit more efficient I was trying to track down another bug and had to think hard to work out what this function was doing, so I figure I may as well leave the documentation for the next visitor... diff git a/src/sin.lisp b/src/sin.lisp index 1eac6a0..f2d8def 100644  a/src/sin.lisp +++ b/src/sin.lisp @@ 1629,19 +1629,49 @@ (list '(%integrate) exp var) ans)))))) +;; SUMOFINTSP +;; +;; This is a heuristic that SININT uses to work out whether the result from +;; INTEGRATOR is worth returning or whether just to return a noun form. If this +;; function returns T, then SININT will return a noun form. +;; +;; The logic, as I understand it (Rupert 01/2014): +;; +;; (1) If I integrate f(x) wrt x and get an atom other than x, either +;; something's gone horribly wrong, or this is part of a larger +;; expression. In the latter case, we can return T here because hopefully +;; something else interesting will make the toplevel return NIL. +;; +;; (2) If I get a sum, return a noun form if every one of the summands is no +;; better than what I started with. (Presumably this is where the name +;; came from) +;; +;; (3) If this is a noun form, it doesn't convey much information on its own, +;; so return T. +;; +;; (4) If this is a product, something interesting has probably happened. But +;; I still want a noun form if the result is like 2*'integrate(f(x),x), so +;; I'm only interested in terms in the product that are not free of +;; VAR. If one of those terms is worthy of report, that's great: return +;; NIL. Otherwise, return T if we saw at least two things (eg splitting an +;; integral into a product of two integrals) +;; +;; (5) If the result is free of VAR, we're in a similar position to (1). +;; +;; (6) Otherwise something interested (and hopefully useful) has +;; happened. Return NIL to tell SININT to report it. (defun sumofintsp (ans) (cond ((atom ans) (not (eq ans var))) ((mplusp ans) (every #'sumofintsp (cdr ans))) ((eq (caar ans) '%integrate) t) ((mtimesp ans)  (do ((facs (cdr ans) (cdr facs))  (ints))  ((null facs)  (< (length ints) 2))  (unless (freeof var (car facs))  (if (sumofintsp (car facs))  (push (car facs) ints)  (return nil))))) + (let ((intfactors 0)) + (not (or (dolist (factor (cdr ans)) + (unless (freeof var factor) + (if (sumofintsp factor) + (incf intfactors) + (return t)))) + (<= 2 intfactors))))) ((freeof var ans) t) (t nil)))  Summary of changes: src/defint.lisp  4 ++ src/sin.lisp  46 ++++++++++++++++++++++++++++++++++++++ tests/rtest16.mac  4 ++++ 3 files changed, 44 insertions(+), 10 deletions() hooks/postreceive  Maxima CAS 