|
From: <ap...@us...> - 2025-10-12 16:53: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 66001dab3be0640192eb470ace3f304536380c65 (commit)
via 9b17dd530c6b371a6ca94d1d9648d3fed1e347f8 (commit)
via 9eb0dcdddbadb95590dc200c1ddd33992ef28aa4 (commit)
via e8eaabacc55cb2f7a8bfc2fb9320b752e94f168a (commit)
via 7bea89b3f84f87adf76cdc7c21a5770e0afec20f (commit)
from 99a82633cbfdf84489a1d02ee55045f527361c29 (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 66001dab3be0640192eb470ace3f304536380c65
Author: Robert Dodier <rob...@so...>
Date: Sun Oct 12 09:19:04 2025 -0700
In 2-d display for derivatives, correct depth of denominator in Leibniz notation.
diff --git a/src/displa.lisp b/src/displa.lisp
index 5eb62a013..b545d2b52 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -744,7 +744,7 @@
'mparen 'mparen nil 0))
(t (dimension-superscript
(cons '(diff) l) (cons #\d (cons #\space den)))))
- w2 (+ 2 w2 width) h2 (max h2 height) d2 (+ d2 depth)))
+ w2 (+ 2 w2 width) h2 (max h2 height) d2 (max d2 depth)))
(setq num (nformat-check (addn num t)))
(cond ((equal 1 num) (setq num (list #\d) w1 1 h1 1 d1 0))
(t (setq num (dimension-superscript (list '(diff) #\d num) nil)
diff --git a/tests/rtest_unicode_display.mac b/tests/rtest_unicode_display.mac
index f43100f6a..1ba7d8a8c 100644
--- a/tests/rtest_unicode_display.mac
+++ b/tests/rtest_unicode_display.mac
@@ -949,12 +949,10 @@ print_string_2d_unicode(matrix(ee2));
" ┌ ┐
│ 6 │
│ d │
- │ ─────────── (h(u , v , w )) │
- Col 1 = │ 3 2 i j k │
+ Col 1 = │ ─────────── (h(u , v , w )) │
+ │ 3 2 i j k │
│ du dv dw │
│ i j k │
- │ │
- │ │
└ ┘
┌ ┐ ┌ ┐
│ │ │ │ │ 1 │ │
@@ -1010,8 +1008,6 @@ print_string_2d_unicode(transpose(matrix(ee2)));
│ du dv dw │
│ i j k │
│ │
-│ │
-│ │
│ │ │
│ 1 │ │
│ ───────────│ │
@@ -1351,3 +1347,105 @@ block ([linel: 140], print_string_2d_unicode (matrix (ee1, ee2, ee4, ee5)));
│ i j │
└ ┘
";
+
+print_string_2d_unicode (foo: diff(f[i[j[k[l]]]](x[i], y[j[k[l]]], z[m]), x[i], 2^n, y[j[k[l]]], 2^(m^n), z[m], 1));
+" n
+ n m
+ 2 + 2 + 1
+d
+────────────── (f (x , y , z ))
+ n i i j m
+ n m j k
+ 2 2 k l
+dx dy dz l
+ i j m
+ k
+ l
+";
+
+print_string_2d_unicode (box (foo));
+"╔════════════════════════════════════╗
+║ n ║
+║ n m ║
+║ 2 + 2 + 1 ║
+║d ║
+║────────────── (f (x , y , z ))║
+║ n i i j m ║
+║ n m j k ║
+║ 2 2 k l ║
+║dx dy dz l ║
+║ i j m ║
+║ k ║
+║ l ║
+╚════════════════════════════════════╝
+";
+
+print_string_2d_unicode (baz: diff(f[i[j[k[l]]]](x, y, z), x, 1, y, 1, z, 1));
+" 3
+ d
+──────── (f (x, y, z))
+dx dy dz i
+ j
+ k
+ l
+";
+
+print_string_2d_unicode (box (baz));
+"╔═════════════════════════╗
+║ 3 ║
+║ d ║
+║──────── (f (x, y, z))║
+║dx dy dz i ║
+║ j ║
+║ k ║
+║ l ║
+╚═════════════════════════╝
+";
+
+print_string_2d_unicode (quux: baz/(1 - foo));
+" 3
+ d
+ ──────── (f (x, y, z))
+ dx dy dz i
+ j
+ k
+ l
+────────────────────────────────────────
+ n
+ n m
+ 2 + 2 + 1
+ d
+1 - ────────────── (f (x , y , z ))
+ n i i j m
+ n m j k
+ 2 2 k l
+ dx dy dz l
+ i j m
+ k
+ l
+";
+
+print_string_2d_unicode (box (quux));
+"╔════════════════════════════════════════╗
+║ 3 ║
+║ d ║
+║ ──────── (f (x, y, z)) ║
+║ dx dy dz i ║
+║ j ║
+║ k ║
+║ l ║
+║────────────────────────────────────────║
+║ n ║
+║ n m ║
+║ 2 + 2 + 1 ║
+║ d ║
+║1 - ────────────── (f (x , y , z ))║
+║ n i i j m ║
+║ n m j k ║
+║ 2 2 k l ║
+║ dx dy dz l ║
+║ i j m ║
+║ k ║
+║ l ║
+╚════════════════════════════════════════╝
+";
commit 9b17dd530c6b371a6ca94d1d9648d3fed1e347f8
Author: Robert Dodier <rob...@so...>
Date: Wed Oct 8 21:01:55 2025 -0700
Commit new script test_matrix_display.mac to test display flags for matrix and box.
test_matrix_display.mac is a script to be executed by batch or load;
it is not arranged in expression, expected result pairs.
diff --git a/tests/test_matrix_display.mac b/tests/test_matrix_display.mac
new file mode 100644
index 000000000..d20617023
--- /dev/null
+++ b/tests/test_matrix_display.mac
@@ -0,0 +1,145 @@
+/* test_matrix_display.mac
+ * copyright 2025 by Robert Dodier
+ * I release this work under terms of the GNU General Public License, version 2.
+ *
+ * Tell Maxima to process this file with batch or load;
+ * e.g.: maxima --batch test_matrix_display.mac
+ * or: maxima --preload test_matrix_display.mac
+ * Optionally see the various matrix expressions again
+ * via ''values; afterwards.
+ */
+
+hh(m,n):=genmatrix(lambda([i,j],1/(i+j-1)),m,n);
+foo(n):= flatten ([ makelist ([ hh(k,n), hh(n,k) ], k, 1, n - 1), hh(n,n) ]);
+
+distribute_over: false;
+
+foo1: foo(1);
+foo2: foo(2);
+foo3: foo(3);
+foo4: foo(4);
+foo5: foo(5);
+
+abs_foo1: map (abs, foo1);
+abs_foo2: map (abs, foo2);
+abs_foo3: map (abs, foo3);
+abs_foo4: map (abs, foo4);
+abs_foo5: map (abs, foo5);
+
+det_foo1: map (nounify (determinant), foo1);
+det_foo2: map (nounify (determinant), foo2);
+det_foo3: map (nounify (determinant), foo3);
+det_foo4: map (nounify (determinant), foo4);
+det_foo5: map (nounify (determinant), foo5);
+
+recip_abs_foo1: map (lambda ([x], x/(1 + abs(x))), foo1);
+recip_abs_foo2: map (lambda ([x], x/(1 + abs(x))), foo2);
+recip_abs_foo3: map (lambda ([x], x/(1 + abs(x))), foo3);
+recip_abs_foo4: map (lambda ([x], x/(1 + abs(x))), foo4);
+recip_abs_foo5: map (lambda ([x], x/(1 + abs(x))), foo5);
+
+box_foo1: map (box, foo1);
+box_foo2: map (box, foo2);
+box_foo3: map (box, foo3);
+box_foo4: map (box, foo4);
+box_foo5: map (box, foo5);
+
+recip_box_abs_foo1: map (lambda ([x], x/(1 + box (abs(x)))), foo1);
+recip_box_abs_foo2: map (lambda ([x], x/(1 + box (abs(x)))), foo2);
+recip_box_abs_foo3: map (lambda ([x], x/(1 + box (abs(x)))), foo3);
+recip_box_abs_foo4: map (lambda ([x], x/(1 + box (abs(x)))), foo4);
+recip_box_abs_foo5: map (lambda ([x], x/(1 + box (abs(x)))), foo5);
+
+recip_abs_box_foo1: map (lambda ([x], x/(1 + abs (box(x)))), foo1);
+recip_abs_box_foo2: map (lambda ([x], x/(1 + abs (box(x)))), foo2);
+recip_abs_box_foo3: map (lambda ([x], x/(1 + abs (box(x)))), foo3);
+recip_abs_box_foo4: map (lambda ([x], x/(1 + abs (box(x)))), foo4);
+recip_abs_box_foo5: map (lambda ([x], x/(1 + abs (box(x)))), foo5);
+
+display_matrix_brackets: false;
+display_box_double_lines: false;
+
+foo1;
+foo2;
+foo3;
+foo4;
+foo5;
+
+abs_foo1;
+abs_foo2;
+abs_foo3;
+abs_foo4;
+abs_foo5;
+
+det_foo1;
+det_foo2;
+det_foo3;
+det_foo4;
+det_foo5;
+
+recip_abs_foo1;
+recip_abs_foo2;
+recip_abs_foo3;
+recip_abs_foo4;
+recip_abs_foo5;
+
+box_foo1;
+box_foo2;
+box_foo3;
+box_foo4;
+box_foo5;
+
+recip_box_abs_foo1;
+recip_box_abs_foo2;
+recip_box_abs_foo3;
+recip_box_abs_foo4;
+recip_box_abs_foo5;
+
+recip_abs_box_foo1;
+recip_abs_box_foo2;
+recip_abs_box_foo3;
+recip_abs_box_foo4;
+recip_abs_box_foo5;
+
+print (foo1) $
+print (foo2) $
+print (foo3) $
+print (foo4) $
+print (foo5) $
+
+print (abs_foo1) $
+print (abs_foo2) $
+print (abs_foo3) $
+print (abs_foo4) $
+print (abs_foo5) $
+
+print (det_foo1) $
+print (det_foo2) $
+print (det_foo3) $
+print (det_foo4) $
+print (det_foo5) $
+
+print (recip_abs_foo1) $
+print (recip_abs_foo2) $
+print (recip_abs_foo3) $
+print (recip_abs_foo4) $
+print (recip_abs_foo5) $
+
+print (box_foo1) $
+print (box_foo2) $
+print (box_foo3) $
+print (box_foo4) $
+print (box_foo5) $
+
+print (recip_box_abs_foo1) $
+print (recip_box_abs_foo2) $
+print (recip_box_abs_foo3) $
+print (recip_box_abs_foo4) $
+print (recip_box_abs_foo5) $
+
+print (recip_abs_box_foo1) $
+print (recip_abs_box_foo2) $
+print (recip_abs_box_foo3) $
+print (recip_abs_box_foo4) $
+print (recip_abs_box_foo5) $
+
commit 9eb0dcdddbadb95590dc200c1ddd33992ef28aa4
Author: Robert Dodier <rob...@so...>
Date: Tue Oct 7 23:18:00 2025 -0700
New flag display_determinant_bars; when true, display determinant of a literal matrix with a bar on either side,
otherwise as an ordinary function call. Default is display_determinant_bars = true.
Has the advertised effect whether display2d_unicode is enabled or disabled.
diff --git a/doc/info/Matrices.texi.m4 b/doc/info/Matrices.texi.m4
index 84b42a8d3..4a4792ecc 100644
--- a/doc/info/Matrices.texi.m4
+++ b/doc/info/Matrices.texi.m4
@@ -578,12 +578,35 @@ The form of the result depends upon the setting of the switch @mrefdot{ratmx}
There is a special routine for computing sparse determinants which is called
when the switches @code{ratmx} and @mref{sparse} are both @code{true}.
+@code{display_determinant_bars} governs the display of determinants.
+
@c EXAMPLES NEEDED HERE
@opencatbox{Categories:}
@category{Matrices}
@closecatbox
@end deffn
+@c -----------------------------------------------------------------------------
+@anchor{display_determinant_bars}
+@defvr {Option variable} display_determinant_bars
+Default value: @code{true}
+
+When @code{display_determinant_bars} is @code{true},
+a determinant noun expression which has a literal matrix as its sole argument
+is displayed with a vertical bar on either side.
+
+Otherwise, @code{display_determinant_bars} is @code{false},
+or the determinant is not a noun expression,
+or its argument is not a literal matrix;
+in these cases, the expression is displayed as an ordinary function call.
+
+@opencatbox{Categories:}
+@category{Display flags and variables}
+@category{Matrices}
+@closecatbox
+
+@end defvr
+
@c -----------------------------------------------------------------------------
@anchor{detout}
@defvr {Option variable} detout
diff --git a/src/displa.lisp b/src/displa.lisp
index f02e385d7..5eb62a013 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -1269,6 +1269,17 @@
collect (list '(mequal) (format nil " Col ~d" k) ($col form k))))
result ""))
+(displa-def %determinant dim-determinant)
+
+(defmvar $display_determinant_bars t)
+
+(defun dim-determinant (form result)
+ (let ((a (rest form)))
+ (if (and $display_determinant_bars (= (length a) 1) ($matrixp (first a)))
+ (let ($display_matrix_brackets)
+ (dim-mabs `((mabs) ,(first a)) result))
+ (dimension-function form result))))
+
(displa-def mbox dim-mbox)
(displa-def %mbox dim-mbox)
commit e8eaabacc55cb2f7a8bfc2fb9320b752e94f168a
Author: Robert Dodier <rob...@so...>
Date: Tue Oct 7 21:18:59 2025 -0700
New flag display_matrix_brackets; when true, display matrices with a bracket on either side,
otherwise without brackets. Default is display_matrix_brackets = true.
Has the advertised effect whether display2d_unicode is enabled or disabled.
diff --git a/doc/info/Matrices.texi.m4 b/doc/info/Matrices.texi.m4
index 0879b35fb..84b42a8d3 100644
--- a/doc/info/Matrices.texi.m4
+++ b/doc/info/Matrices.texi.m4
@@ -1580,6 +1580,25 @@ Example:
@closecatbox
@end defvr
+@c -----------------------------------------------------------------------------
+@anchor{display_matrix_brackets}
+@deffn {Option variable} display_matrix_brackets
+Default value: @code{true}
+
+When @code{display_matrix_brackets} is @code{true},
+matrices are displayed with brackets (square braces) to the left and right.
+
+When @code{display_matrix_brackets} is @code{false},
+matrices are not displayed with brackets;
+only the matrix elements are displayed.
+
+@opencatbox{Categories:}
+@category{Matrices}
+@category{Display flags and variables}
+@closecatbox
+
+@end deffn
+
@c -----------------------------------------------------------------------------
@anchor{matrix}
@deffn {Function} matrix (@var{row_1}, @dots{}, @var{row_n})
@@ -1624,6 +1643,8 @@ See @mrefcomma{eigenvalues} @mrefcomma{eigenvectors} @mrefcomma{determinant}@w{}
@mrefcomma{echelon} and @mrefdot{rank}
@c CHECK -- WE PROBABLY WANT EXHAUSTIVE LIST HERE
+@mref{display_matrix_brackets} governs the display of matrices.
+
Examples:
@itemize @bullet
diff --git a/src/displa.lisp b/src/displa.lisp
index 79ac08ff4..f02e385d7 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -1200,6 +1200,8 @@
(displa-def $matrix dim-$matrix)
(displa-def %matrix dim-$matrix)
+(defmvar $display_matrix_brackets t)
+
(defun dim-$matrix (form result)
(prog (dmstr rstr cstr consp cols)
(setq cols (if ($listp (cadr form)) (length (cadr form)) 0))
@@ -1235,13 +1237,13 @@
(if (> (+ height depth) (length linearray))
(setq consp t))
(return
- (cond ((and (not consp) (checkfit (+ 2 width)))
+ (cond ((and (not consp) (checkfit (if $display_matrix_brackets (+ 2 width) width)))
(matout dmstr cstr rstr result))
((and (not consp) (<= level 2)) (colout form result))
(t (dimension-function form result))))))
(defun matout (dmstr cstr rstr result)
- (push `(d-matrix left ,height ,depth) result)
+ (when $display_matrix_brackets (push `(d-matrix left ,height ,depth) result))
(push #\space result)
(do ((d dmstr (cdr d)) (c cstr (cdr c)) (w 0 0))
((null d))
@@ -1251,10 +1253,13 @@
(setq w (truncate (+ (car c) (caar d)) 2))
(rplaca d (cdar d)))
(setq result (cons (list (+ 2 (- (car c) w)) 0) (nreconc (car d) result))))
- (setq width (+ 2 width))
+ (if $display_matrix_brackets
+ (setq width (+ 2 width))
+ (when $display2d_unicode
+ (setq height (1- height) depth (1- depth))))
(update-heights height depth)
(rplaca (car result) (1- (caar result)))
- (push `(d-matrix right ,height ,depth) result)
+ (when $display_matrix_brackets (push `(d-matrix right ,height ,depth) result))
result)
(defun colout (form result)
@@ -1492,12 +1497,17 @@
;; Block mode i/o isn't needed since PRINC is used instead of WRITE-CHAR and
;; CURSORPOS.
-(defun output-linear (result w)
+(defun output-linear (result w &aux i0)
(draw-linear result bkptdp w)
(do ((i (1- (+ bkptht bkptdp)) (1- i)))
((< i 0))
- (cond ((null (aref linearray i)))
- (t (output-linear-one-line i)))))
+ (cond
+ ((and (null i0) (null (aref linearray i))))
+ (t
+ (when (null i0) (setq i0 i))
+ (if (null (aref linearray i))
+ (mterpri)
+ (output-linear-one-line i))))))
(defun output-linear-one-line (i)
(prog (line (n 0))
commit 7bea89b3f84f87adf76cdc7c21a5770e0afec20f
Author: Robert Dodier <rob...@so...>
Date: Sun Oct 5 13:14:25 2025 -0700
New flag display_box_double_lines; when true, display box expressions with double-line characters, otherwise single-line.
Only affects display when display2d_unicode is true.
diff --git a/doc/info/Expressions.texi b/doc/info/Expressions.texi
index 463fef986..eb4207467 100644
--- a/doc/info/Expressions.texi
+++ b/doc/info/Expressions.texi
@@ -474,6 +474,25 @@ unbound).
@closecatbox
@end deffn
+@c -----------------------------------------------------------------------------
+@anchor{display_box_double_lines}
+@defvr {Option variable} display_box_double_lines
+Default value: @code{true}
+
+When @code{display_box_double_lines} is @code{true},
+@code{box} expressions are displayed with Unicode double-line characters.
+
+When @code{display_box_double_lines} is @code{false},
+@code{box} expressions are displayed with Unicode single-line characters.
+
+@code{display_box_double_lines} only has any effect when @code{display2d_unicode} is @code{true}.
+
+@opencatbox{Categories:}
+@category{Expressions}
+@category{Display flags and variables}
+@closecatbox
+@end defvr
+
@c -----------------------------------------------------------------------------
@anchor{box}
@deffn {Function} box @
@@ -495,7 +514,7 @@ computations. @mref{rembox} removes the box again.
@mref{boxchar} is the character used to draw the box in @code{box} and in the
@mref{dpart} and @mref{lpart} functions.
-See also @mrefcomma{rembox} @mref{dpart} and @mrefdot{lpart}
+See also @mrefcomma{rembox} @mrefcomma{dpart} @mrefcomma{lpart} and @mrefdot{display_box_double_lines}
Examples:
diff --git a/src/displa.lisp b/src/displa.lisp
index f77080fc1..79ac08ff4 100644
--- a/src/displa.lisp
+++ b/src/displa.lisp
@@ -1284,7 +1284,21 @@
(dim-mlabox-unicode form result)
(dim-mlabox-ascii form result)))
+(defmvar $display_box_double_lines t)
+
(defun dim-mlabox-unicode (form result)
+ (if $display_box_double_lines
+ (dim-mlabox-unicode-default form result)
+ (let
+ ((*d-box-char-unicode-horz* (get-unicode-char :box-drawings-light-horizontal))
+ (*d-box-char-unicode-vert* (get-unicode-char :box-drawings-light-vertical))
+ (*d-box-char-unicode-upper-left* (get-unicode-char :box-drawings-light-down-and-right))
+ (*d-box-char-unicode-upper-right* (get-unicode-char :box-drawings-light-down-and-left))
+ (*d-box-char-unicode-lower-right* (get-unicode-char :box-drawings-light-up-and-left))
+ (*d-box-char-unicode-lower-left* (get-unicode-char :box-drawings-light-up-and-right)))
+ (dim-mlabox-unicode-default form result))))
+
+(defun dim-mlabox-unicode-default (form result)
(prog (dummy)
(setq dummy (dimension (cadr form) nil 'mparen 'mparen nil 0))
(cond ((not (checkfit (+ 2 width)))
@@ -1680,7 +1694,19 @@
(d-box-unicode h d w body)
(d-box-ascii h d w body)))
-(defun d-box-unicode (h d w body &aux dmstr)
+(defun d-box-unicode (h d w body)
+ (if $display_box_double_lines
+ (d-box-unicode-default h d w body)
+ (let
+ ((*d-box-char-unicode-horz* (get-unicode-char :box-drawings-light-horizontal))
+ (*d-box-char-unicode-vert* (get-unicode-char :box-drawings-light-vertical))
+ (*d-box-char-unicode-upper-left* (get-unicode-char :box-drawings-light-down-and-right))
+ (*d-box-char-unicode-upper-right* (get-unicode-char :box-drawings-light-down-and-left))
+ (*d-box-char-unicode-lower-right* (get-unicode-char :box-drawings-light-up-and-left))
+ (*d-box-char-unicode-lower-left* (get-unicode-char :box-drawings-light-up-and-right)))
+ (d-box-unicode-default h d w body))))
+
+(defun d-box-unicode-default (h d w body &aux dmstr)
(setq dmstr `((0 ,h ,*d-box-char-unicode-upper-right* (d-hbar ,w ,*d-box-char-unicode-horz*) ,*d-box-char-unicode-upper-left*)
(,(- (+ w 2)) 0)
(d-vbar ,h ,d ,*d-box-char-unicode-vert*)
-----------------------------------------------------------------------
Summary of changes:
doc/info/Expressions.texi | 21 +++++-
doc/info/Matrices.texi.m4 | 44 ++++++++++++
src/displa.lisp | 65 +++++++++++++++---
tests/rtest_unicode_display.mac | 110 ++++++++++++++++++++++++++++--
tests/test_matrix_display.mac | 145 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 369 insertions(+), 16 deletions(-)
create mode 100644 tests/test_matrix_display.mac
hooks/post-receive
--
Maxima CAS
|