[Maxima] how to generate matrix by existed matrices

Stavros Macrakis macrakis at alum.mit.edu
Wed Oct 28 09:36:36 CDT 2009


Besides addcol and addrow, you may find my email from Oct 6 useful on this
topic:

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 ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20091028/d5d2bf26/attachment.htm 


More information about the Maxima mailing list