|
From: willisbl <wil...@us...> - 2026-05-27 16:56:43
|
This is an automated email from the git hooks/post-receive 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 6c7372506b5eb62bf2295b27b8b9b2ec1933a1d0 (commit)
from 94c96353eb5e8644fe80e50eca3d95e168372635 (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 6c7372506b5eb62bf2295b27b8b9b2ec1933a1d0
Author: Barton Willis <wi...@un...>
Date: Wed May 27 11:56:26 2026 -0500
Fix for \#4689: limit of spherical_bessel_j
Modified colexpt so that it throws to 'limit when it cannot determine the required limit.
Removed one explicit call to simplimexpt from colexpt; dispatching such functions is the
responsibility of simplimit.
Deprecated the function limroot. It is no longer needed by colexpt and is not called by any
other function.
Added test cases, including the test suggested in the ticket, to rtest_limit_extra.mac.
Updated ChangeLog.
No unexpected testsuite or share testsuite failures using SBCL 2.6.4 or Clozure CL 1.13.1.
diff --git a/ChangeLog b/ChangeLog
index 86db0c245..721b58853 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Bug fixes for numbered bugs:
----------------------------
* \#4585 Taylor polynomials involving tangent & a quotient
* \#4634 Divergent integral simplifies to -1/4 with simplify_sum
+ * \#4689 limit of a spherical_bessel_j function
* \#4724 xreduce with init arg and declared nary function
* \#4729 rtest_limit.mac: Problem 230 (line 866)
* \#4735 rtest_limit_gruntz problem 21, line 121 has sign error in expected limit
diff --git a/src/limit.lisp b/src/limit.lisp
index 702966924..80086c899 100644
--- a/src/limit.lisp
+++ b/src/limit.lisp
@@ -1512,27 +1512,48 @@ ignoring dummy variables and array indices."
(t ($gcd (getexp (car list))
(getexplist (cdr list))))))
-(defun limroot (exp power)
- (cond ((or (atom exp) (not (member (caar exp) '(mtimes mexpt) :test #'eq)))
- (limroot (list '(mexpt) exp 1) power)) ;This is strange-JIM.
- ((mexptp exp) (m^ (cadr exp)
- (sratsimp (m* (caddr exp) (m^ power -1.)))))
- (t (m*l (mapcar #'(lambda (x)
- (limroot x power))
- (cdr exp))))))
-
-;;NUMERATOR AND DENOMINATOR HAVE EXPONENTS WITH GCD OF GCP.
-;;; Used to call simplimit but some of the transformations used here
-;;; were not stable w.r.t. the simplifier, so try keeping exponent separate
-;;; from bas.
+(defun limroot (&rest args)
+ "limroot is deprecated and no longer available."
+ (declare (ignore args))
+ (merror "limroot is deprecated and no longer available."))
+
+(defun freeof-extended-real (e)
+ "Return T iff e is semantically free of extended-real numbers."
+ ($freeof '$minf '$zerob '$zeroa '$ind '$und '$inf '$infinity e))
+
+;; colexpt returns limit(n/dn, var, val). Assumptions:
+;; (a) n has the form a^P
+;; (b) dn has the form b^Q
+;; (c) gcp is a positive integer
+;;
+;; The function colexpt attempts to compute limit(a^P/b^Q, x, pt) using the identity
+;; limit(a^P / b^Q, x, pt) = limit(a^(P/gcp) / b^(Q/gcp), x, pt)^gcp.
+;; The value of gcp is passed to colexpt; the logic for finding a suitable gcp
+;; is not part of colexpt.
+;;
+;; When the assumptions are unmet, or when Maxima is unsuccessful in finding
+;; limit(a^(P/gcp) / b^(Q/gcp), x, pt), colexpt throws to 'limit.
+;;
+;; After determining lim = limit(a^(P/gcp) / b^(Q/gcp), x, pt), the code
+;; evaluates infsimp(lim^gcp). The function infsimp cleans up some cases, such
+;; as inf^2, but it misses others such as ind^2. To avoid returning expressions
+;; such as ind^2, the code performs a semantic check to determine whether the
+;; expression is either an extended real or does not involve an extended real.
(defun colexpt (n dn gcp)
- (let ((bas (m* (limroot n gcp) (limroot dn (m* -1 gcp))))
- (expo gcp)
- baslim expolim)
- (setq baslim (limit bas var val 'think))
- (setq expolim (limit expo var val 'think))
- (simplimexpt bas expo baslim expolim)))
+ (cond ((and (mexptp n) (mexptp dn) (integerp gcp) (> gcp 0))
+ (let* ((a (second n))
+ (p (div (third n) gcp))
+ (b (second dn))
+ (q (div (third dn) gcp))
+ (lim (limit (div (ftake 'mexpt a p) (ftake 'mexpt b q)) var val 'think))
+ (lim^gcp (if (successful-limit-result-p lim)
+ (infsimp (ftake 'mexpt lim gcp))
+ nil)))
+ (if (and lim^gcp (or (extended-real-p lim^gcp) (freeof-extended-real lim^gcp)))
+ lim^gcp
+ (throw 'limit nil))))
+ (t (throw 'limit nil))))
(defun zero-fixup (e x pt)
"Assuming `substitute(pt, x, e)` vanishes, attempt to determine if the zero is `zerob` or `zeroa`.
diff --git a/tests/rtest_limit_extra.mac b/tests/rtest_limit_extra.mac
index 6fd1aa6b9..966cef9e0 100644
--- a/tests/rtest_limit_extra.mac
+++ b/tests/rtest_limit_extra.mac
@@ -1493,6 +1493,22 @@ block([expintrep : gamma_incomplete],
limit(expintegral_ci(5 + cos(x)), x, inf));
ind$
+/* \#4689 limit of a spherical_bessel_j function */
+limit(spherical_bessel_j(1,x)^2,x,inf);
+0$
+
+limit(spherical_bessel_j(1,x)^2,x,minf);
+0$
+
+limit(spherical_bessel_j(1,x),x,inf);
+0$
+
+limit(spherical_bessel_j(3,x),x,inf);
+0$
+
+limit(spherical_bessel_j(3,x),x,minf);
+0$
+
/* clean up*/
/*(kill(values),0);
0$*/
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 1 +
src/limit.lisp | 59 ++++++++++++++++++++++++++++++---------------
tests/rtest_limit_extra.mac | 16 ++++++++++++
3 files changed, 57 insertions(+), 19 deletions(-)
hooks/post-receive
--
Maxima CAS
|