|
From: rtoy <rt...@us...> - 2025-11-17 21:40:31
|
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, rtoy-def-simp-gamma2 has been created
at 06dd89176115c9c3822547722e0506d4a6faaf2a (commit)
- Log -----------------------------------------------------------------
commit 06dd89176115c9c3822547722e0506d4a6faaf2a
Author: Raymond Toy <toy...@gm...>
Date: Mon Nov 17 13:18:03 2025 -0800
Remove old simplification code for log_gamma
This is all now being done by the def-simplifier for log_gamma.
diff --git a/src/gamma.lisp b/src/gamma.lisp
index 2082349d1..9c28d1934 100644
--- a/src/gamma.lisp
+++ b/src/gamma.lisp
@@ -1858,23 +1858,6 @@
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#+nil
-(progn
-(defmfun $log_gamma (z)
- (simplify (list '(%log_gamma) z)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defprop $log_gamma %log_gamma alias)
-(defprop $log_gamma %log_gamma verb)
-
-(defprop %log_gamma $log_gamma reversealias)
-(defprop %log_gamma $log_gamma noun)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defprop %log_gamma simp-log-gamma operators)
-)
;;; Logarithm of the Gamma function distributes over bags
(defprop %log_gamma (mlist $matrix mequal) distribute_over)
@@ -1894,49 +1877,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#+nil
-(defun simp-log-gamma (expr z simpflag)
- (oneargcheck expr)
- (setq z (simpcheck (cadr expr) simpflag))
- (cond
-
- ;; Check for specific values
-
- ((and (mnump z)
- (or (zerop1 z)
- (and (eq ($sign z) '$neg)
- (zerop1 (sub z ($truncate z))))))
- ;; We have zero, a negative integer or a float or bigfloat representation.
- (simp-domain-error
- (intl:gettext "log_gamma: log_gamma(~:M) is undefined.") z))
-
- ((eq z '$inf) '$inf)
-
- ;; Check for numerical evaluation
-
- ((float-numerical-eval-p z)
- (complexify (log-gamma-lanczos (complex ($float z) 0))))
-
- ((complex-float-numerical-eval-p z)
- (complexify
- (log-gamma-lanczos
- (complex ($float ($realpart z)) ($float ($imagpart z))))))
-
- ((bigfloat-numerical-eval-p z)
- (bfloat-log-gamma ($bfloat z)))
-
- ((complex-bigfloat-numerical-eval-p z)
- (complex-bfloat-log-gamma
- (add ($bfloat ($realpart z)) (mul '$%i ($bfloat ($imagpart z))))))
-
- ;; Transform to Logarithm of Factorial for integer values
- ;; At this point the integer value is positive and not zero.
-
- ((integerp z)
- (simplify (list '(%log) (simplify (list '(mfactorial) (- z 1))))))
-
- (t (eqtest (list '(%log_gamma) z) expr))))
-
(def-simplifier log_gamma (z)
(cond
;; Check for specific values
commit 3a8d6758fe28dc1f8a24e159695501abe2a5ea9b
Author: Raymond Toy <toy...@gm...>
Date: Mon Nov 17 09:47:20 2025 -0800
Actually comment out the old stuff
Forgot to do that in the previous commit. Testsuite passes as expected.
diff --git a/src/gamma.lisp b/src/gamma.lisp
index 157516814..2082349d1 100644
--- a/src/gamma.lisp
+++ b/src/gamma.lisp
@@ -1858,6 +1858,8 @@
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+#+nil
+(progn
(defmfun $log_gamma (z)
(simplify (list '(%log_gamma) z)))
@@ -1872,7 +1874,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defprop %log_gamma simp-log-gamma operators)
-
+)
;;; Logarithm of the Gamma function distributes over bags
(defprop %log_gamma (mlist $matrix mequal) distribute_over)
commit dc56baa183da024784646fcee5f80130ee71114c
Author: Raymond Toy <toy...@gm...>
Date: Mon Nov 17 07:05:42 2025 -0800
Add def-simplifier for log-gamma
diff --git a/src/gamma.lisp b/src/gamma.lisp
index f9fb3ab72..157516814 100644
--- a/src/gamma.lisp
+++ b/src/gamma.lisp
@@ -1892,6 +1892,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+#+nil
(defun simp-log-gamma (expr z simpflag)
(oneargcheck expr)
(setq z (simpcheck (cadr expr) simpflag))
@@ -1934,6 +1935,37 @@
(t (eqtest (list '(%log_gamma) z) expr))))
+(def-simplifier log_gamma (z)
+ (cond
+ ;; Check for specific values
+ ((and (mnump z)
+ (or (zerop1 z)
+ (and (eq ($sign z) '$neg)
+ (zerop1 (sub z ($truncate z))))))
+ ;; We have zero, a negative integer or a float or bigfloat representation.
+ (simp-domain-error
+ (intl:gettext "log_gamma: log_gamma(~:M) is undefined.") z))
+
+ ((eq z '$inf) '$inf)
+ ;; Check for numerical evaluation
+ ((float-numerical-eval-p z)
+ (complexify (log-gamma-lanczos (complex ($float z) 0))))
+ ((complex-float-numerical-eval-p z)
+ (complexify
+ (log-gamma-lanczos
+ (complex ($float ($realpart z)) ($float ($imagpart z))))))
+ ((bigfloat-numerical-eval-p z)
+ (bfloat-log-gamma ($bfloat z)))
+ ((complex-bigfloat-numerical-eval-p z)
+ (complex-bfloat-log-gamma
+ (add ($bfloat ($realpart z)) (mul '$%i ($bfloat ($imagpart z))))))
+ ;; Transform to Logarithm of Factorial for integer values
+ ;; At this point the integer value is positive and not zero.
+ ((integerp z)
+ (simplify (list '(%log) (simplify (list '(mfactorial) (- z 1))))))
+ (t
+ (give-up))))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; The functions log-gamma-lanczos, bfloat-log-gamma and
;;; complex-bfloat-log-gamma are modified versions of the related functions
-----------------------------------------------------------------------
hooks/post-receive
--
Maxima CAS
|