3

in Maxima, how is it possible to simply equations that are components of a matrix? I have a rather big matrix and want to simplify the components of it (e.g. factor out and cancel out).

Thanks.

blubberbernd
  • 3,641
  • 8
  • 35
  • 46
  • Can you edit your question to include an example (say 2*2) matrix to help lazy people play with your problem? – Simon Oct 08 '11 at 04:30

1 Answers1

3

Most functions (where appropriate) already thread over lists, matrices, equations, etc...

For example:

(%i1) a : [[cos(x)^2+sin(x)^2,1],[0,sin(x)*cos(x)]];
                      2         2
(%o1)            [[sin (x) + cos (x), 1], [0, cos(x) sin(x)]]
(%i2) trigsimp(a);
(%o2)                    [[1, 1], [0, cos(x) sin(x)]]
(%i3) trigreduce(a);
                 cos(2 x) + 1   1 - cos(2 x)          sin(2 x)
(%o3)          [[------------ + ------------, 1], [0, --------]]
                      2              2                   2
(%i4) expand(%o3);
                                         sin(2 x)
(%o4)                       [[1, 1], [0, --------]]
                                            2

If this doesn't help you, can you give more details of the problem that you're having?

Simon
  • 14,631
  • 4
  • 41
  • 101
  • I have another problem with matrices, could you take a look : [converting matrix to list](http://stackoverflow.com/questions/8688906/maxima-convert-matrix-to-list) ? – Grzegorz Wierzowiecki Jan 07 '12 at 20:41
  • it does not work with matrices. See the classic electric impedance problem: Z_ee:matrix([Z_11,Z_14],[Z_41,Z_44]); Z_ei:matrix([Z_12,Z_13],[Z_42,Z_43]); Z_ie:matrix([Z_21,Z_24],[Z_31,Z_34]); Z_ii:matrix([Z_22,Z_23],[Z_32,Z_33]); Z_L:matrix([Z_L2,0],[0,Z_L3]); Z_44:"DUMMY"$ Z_14:0$ Z_41:0$ Z_42:0$ Z_43:0$ Z_24:0$ Z_34:0$ Z_in=xthru(Z_ee-Z_ei.invert(Z_ii+Z_L).Z_ie); – Asdf Nov 30 '21 at 05:34
  • This code will not diagonalize the matrix, despite all the necessary coefficients are zeroed. In order to get the simplified diagonalized answer, you have to assign every matrix again explicitly. (or execute this part two times without "remvaluing" it) – Asdf Nov 30 '21 at 05:40