|
From: willisbl <wil...@us...> - 2025-11-19 17:18:57
|
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 73bf030a4c3bb5f20954fb63dd5d8608f1d93dd0 (commit)
from 309ed0d3c9c48df480aafcd6c31d5c425c58f935 (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 73bf030a4c3bb5f20954fb63dd5d8608f1d93dd0
Author: Barton Willis <wi...@un...>
Date: Wed Nov 19 11:18:42 2025 -0600
#4633 integrate(exp(- t) log(t), t, 0, 1) --> integral nounform
- Extended `stirling0` to include the asymptotic expansion of the incomplete gamma function.
- Updated `rtest_log` test 120: changed expected value from nounform integral to evaluated form.
No unexpected testsuite or share testsuite failures with SBCL 2.4.7 or Clozure CL 1.13.
diff --git a/src/limit.lisp b/src/limit.lisp
index d6ad437f2..555f63ed4 100644
--- a/src/limit.lisp
+++ b/src/limit.lisp
@@ -1249,8 +1249,41 @@ ignoring dummy variables and array indices."
(let ((arglim (limit (cadr e) var val 'think)))
(eq arglim '$inf)))
(ei-asymptotic-expansion $lhospitallim (cadr e)))
+ ((eq (caar e) '%gamma_incomplete) (gamma-incomplete-asymptotic e var val $lhospitallim))
(t e)))
+;; See http://dlmf.nist.gov/8.11.i
+(defun gamma-incomplete-asymptotic (e x pt n)
+ (let* ((aaa (second e)) (z (third e)) (xxx (limit z x pt 'think)))
+ (cond
+ ;; Case 1: Asymptotic expansion when z -> +/- inf and aaa is free of x
+ ;; For the series, see http://dlmf.nist.gov/8.11.i
+ ((and (or (eq '$inf xxx) (eq '$minf xxx)) (freeof x aaa))
+ (let ((f 1) (s 0))
+ (dotimes (k n)
+ (setq s (add s f))
+ (setq f (mul f (div (add aaa -1 (- k)) z))))
+ ;; return z^(a-1)*exp(-z)*s
+ (mul (ftake 'mexpt z (sub aaa 1)) (ftake 'mexpt '$%e (mul -1 z)) s)))
+ ;; Case 2: Asymptotic expansion when z -> 0, aaa integer, and aaa <= 0
+ ;; For the series, see http://dlmf.nist.gov/8.4.E15
+ ((and (zerop2 xxx) (integerp aaa) (>= 0 aaa))
+ (let ((s 0))
+ (flet ((fn (k) (if (eql (add k aaa) 0)
+ 0
+ (div (power (neg z) k) (mul (ftake 'mfactorial k) (add k aaa))))))
+ (dotimes (k n)
+ (setq s (add s (fn k))))
+
+ (sub (mul
+ (div (ftake 'mexpt -1 (neg aaa)) (ftake 'mfactorial (neg aaa)))
+ (sub
+ (simplifya (subfunmake '$psi (list 0) (list (add (neg aaa) 1))) nil)
+ (ftake '%log z)))
+ (mul (ftake 'mexpt z (neg aaa)) s)))))
+ ;; Case 3: fall back
+ (t (ftake '%gamma_incomplete aaa z)))))
+
(defun stirling (x)
"Return sqrt(2*%pi/x)*(x/%e)^x, the Stirling approximation of
gamma(x). The argument x can be any valid expression."
diff --git a/tests/rtest_log.mac b/tests/rtest_log.mac
index 85d646789..25c5fe7be 100755
--- a/tests/rtest_log.mac
+++ b/tests/rtest_log.mac
@@ -431,7 +431,7 @@ integrate(log(t*(1-t))^5/(1-t),t,0,1/2);
'integrate(log(t*(1-t))^5/(1-t),t,0,1/2);
integrate(exp(-t)*log(t),t,0,1);
-'integrate(exp(-t)*log(t),t,0,1);
+-gamma_incomplete(0, 1) - %gamma$
/* Hier fehlen noch Integrale */
-----------------------------------------------------------------------
Summary of changes:
src/limit.lisp | 33 +++++++++++++++++++++++++++++++++
tests/rtest_log.mac | 2 +-
2 files changed, 34 insertions(+), 1 deletion(-)
hooks/post-receive
--
Maxima CAS
|