Subject: How to construct a new matrix using existent ones
From: Stavros Macrakis
Date: Tue, 6 Oct 2009 08:09:32 -0400
Let's define some example matrices:
a:matrix([a,b],[c,d]);
[ a b ]
[ ]
[ c d ]
b:matrix([e,f],[g,h]);
[ e f ]
[ ]
[ g h ]
A matrix in Maxima is a list of rows (each of which is a list), so appending
two matrices appends their row-lists, giving:
append(a,b);
[ a b ]
[ ]
[ c d ]
[ ]
[ e f ]
[ ]
[ g h ]
But you wanted to append the column-lists, so you need to map through the
rows:
map(append,a,b);
[ a b e f ]
[ ]
[ c d g h ]
Equivalently:
transpose(append(transpose(a),transpose(b)));
[ a b e f ]
[ ]
[ c d g h ]
I don't know if there is any built-in for these operations. If this isn't
what you had in mind, let us know.
-s
On Tue, Oct 6, 2009 at 4:18 AM, jie liu <liuauto at gmail.com> wrote:
> I have two matrix a:n*m and b:n*k, and I want to construct a new
> matrix using a and b : [a b]: n*(m+k). How can I do in Maxima.
>
> Thanks in advance!
>
> --
> Yours sincerely,
> Jie Liu
>
> graduate student,
> State Key Laboratory of Industry Control Technology
> Department of Control Science and Engineering,
> Zhejiang University, China
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>