> (%i1) determinant(matrix([1,2],[2,1]));
> [ 1 2 ]
> (%o1) [ ]
> [ 2 1 ]
OK, this appears to be due to r1.9 of src/matrix.lisp (diff below);
$DETERMINANT now returns its argument if $CONSTANTP is T.
$CONSTANTP returns T for nonscalar constant objects,
which seems appropriate, so maybe $DETERMINANT
needs to test for "constant and scalar" or something.
hth
Robert Dodier
PS.
log message:
revision 1.9
date: 2005/12/19 19:18:09; author: willisbl; state: Exp; lines: +2 -1
Before, determinant returned a noun form for atoms, but signaled an
error for other non-matrix inputs. Determinant now returns a noun form for
expressions that are not non-mbags and not matrices. For constant inputs,
determinant returns its argument. Thus det(a+b) -> det(a+b), det(%pi) --> %pi,
and det([a,b]) --> error. As before, det([a]) --> a.
Index: matrix.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/matrix.lisp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- matrix.lisp 7 Nov 2005 17:37:11 -0000 1.8
+++ matrix.lisp 19 Dec 2005 19:18:09 -0000 1.9
@@ -155,7 +155,8 @@
(t (mapcar #'ratplus a b))))
(defmfun $determinant (mat)
- (cond ((atom mat) (list '(%determinant) mat))
+ (cond (($constantp mat) mat)
+ ((not (or (mbagp mat) ($matrixp mat))) (list '(%determinant) mat))
(t (setq mat (check mat))
(if (not (= (length mat) (length (cadr mat))))
(merror "`determinant' called on a non-square matrix."))