El jue, 20-04-2006 a las 13:49 +0200, van Nek escribi??:
> Hi all,
>
>
> function $diagmatrix in src/matrix.lisp doesn't act like I expected. I
> found
>
>
> (%i1) mat: matrix([1,1],[1,-1]);
> [ 1 1 ]
> (%o1) [ ]
> [ 1 - 1 ]
> (%i2) diagmatrix(2,mat);
> [ [ 1 1 ] ]
> [ [ ] 0 ]
> [ [ 1 - 1 ] ]
> (%o2) [ ]
> [ [ 1 1 ] ]
> [ 0 [ ] ]
> [ [ 1 - 1 ] ]
>
>
> You can't multiply this with a 4-dim vector. This matrix is more or
> less useless.
> What I expected is the following.
>
>
> (%i4) diagmatrix(2,mat);
> [ 1 1 0 0 ]
> [ ]
> [ 1 - 1 0 0 ]
> (%o4) [ ]
> [ 0 0 1 1 ]
> [ ]
> [ 0 0 1 - 1 ]
>
>
> I can offer a patch, which acts like shown in (%o4), if the second arg
> to $diagmatrix is a matrix.
Hallo Volker, wie geht's?
I think 'diagmatrix' works as expected according to
'describe(diagmatrix)'.
You can proceed as follows in order to get what you want:
/************* begin Maxima session ****************/
(%i9) load("diag")$
(%i10) mat: matrix([1,1],[1,-1]);
[ 1 1 ]
(%o10) [ ]
[ 1 - 1 ]
(%i11) diag([mat,mat]);
[ 1 1 0 0 ]
[ ]
[ 1 - 1 0 0 ]
(%o11) [ ]
[ 0 0 1 1 ]
[ ]
[ 0 0 1 - 1 ]
/************* end Maxima session ****************/
Best wishes
--
Mario Rodriguez Riotorto
www.biomates.net