Logged In: YES
user_id=501686
Still present in 5.9.3cvs clisp / sbcl / gcl .
matrix([a,b],[c,d])[2,1] is a perfectly legitimate Maxima
expression which evaluates to 'c'.
And it displays fine with display2d:false:
display2d:false$
'( matrix([a,b],[c,d])[2,1] );
=> matrix([a,b],[c,d])[2,1]
But 2d display causes an error:
display2d:true$
'( matrix([a,b],[c,d])[2,1] )
=>
Error: (D-MATRIX RIGHT 2 ...) is not of type CHARACTER.
Error signalled by DIMENSION-ARRAY.
Maxima 5.9.0 gcl 2.5.0 mingw32 Windows2000 Athlon
Logged In: YES
user_id=501686
Still present in 5.9.3cvs clisp / sbcl / gcl .
For GCL 2.6.8 it now works. But CLISP 2.44 has still the reported problem.
The problem is a test in the function dimension-array in displa.lisp. The following test fails for a subscripted array:
((char= #\) (car bas))
(setq result (cons (cons 0 (cons (- h) sub)) bas) depth (max (+ h d) depth)))
For a subscripted array the expression (car bas) is not an atom and the test function char= fails for CLISP 2.44 (not for GCL 2.6.8). When we add a test to make sure that (car bas) is an atom, e.g.
((and (atom (car bas)) (char= #\) (car bas)))
(setq result (cons (cons 0 (cons (- h) sub)) bas) depth (max (+ h d) depth)))
the test no longer fails. The subscripted array is displayed correctly for GCL 2.6.8 and CLISP 2.44. I have not seen any other problem.
That is the result for the given example:
(%i6) '(matrix([a,b],[c,d])[1,2]);
[ a b ]
(%o6) [ ]
[ c d ]
1, 2
I suggest to do the proposed fix and to close the bug report.
Dieter Kaiser
The suggested test added. (The typo in the post below is not committed.)
CLISP and GCL can display e.g. the following subsripted arrays (the second example shows a nested subsripted matrix):
'(matrix([a,sin(x)],[f(y)[2,1],cos(z)]))[1,2,3,4];
'(matrix([a,matrix([a,sin(x)],[f(y)[2,1],cos(z)])[1,2,3,4]
],[f(y)[2,1],cos(z)]))[1,2,3,4];
Closing the bug report as fixed.
Dieter Kaiser
Log in to post a comment.