Either
(%i2) diag_matrix(a,b);
(%o2) matrix([a,0],[0,b])
or
(%i3) apply('diag_matrix, [a,b]);
(%o3) matrix([a,0],[0,b])
--Barton
maxima-bounces at math.utexas.edu wrote on 07/28/2011 08:46:57 AM:
>
> I have a problem with this
>
> (%i1) P: makelist(P[i], i, 1, 3);
> (%o1) [P , P , P ]
> 1 2 3
> (%i2) PP: diag_matrix(P);
> (%o2) [ [P , P , P ] ]
> [ 1 2 3 ]
>