Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Matrix Calculator

Matrix

Function: matrix (<row_1>, ..., <row_n>) Returns a rectangular matrix which has the rows <row_1>, ..., <row_n>. Each row is a list of expressions. All rows must be the same length.

A:matrix([5*s+8,4],[4,12]);
dA:determinant(A);
B:matrix([5*s+8,4],[(24/S)+15,24/S]);

The operations + (addition), - (subtraction), * (multiplication), and / (division), are carried out element by element when the operands are two matrices, a scalar and a matrix, or a matrix and a scalar. The operation ^ (exponentiation, equivalently **) is carried out element by element if the operands are a scalar and a matrix or a matrix and a scalar, but not if the operands are two matrices. All operations are normally carried out in full, including . (noncommutative multiplication).

Matrix multiplication is represented by the noncommutative multiplication operator .. The corresponding noncommutative exponentiation operator is ^^. For a matrix <A>, <A>.<A> = <A>^^2 and <A>^^-1 is the inverse of <A>, if it exists.

There are switches for controlling simplification of expressions involving dot and matrix-list operations. These are doallmxops, domxexpt domxmxops, doscmxops, and doscmxplus.

There are additional options which are related to matrices. These are: lmxchar, rmxchar, ratmx, listarith, detout, scalarmatrix, and sparse.

There are a number of functions which take matrices as arguments or yield matrices as return values. See eigenvalues, eigenvectors, determinant, charpoly, genmatrix, addcol, addrow, copymatrix, transpose, echelon, and rank.

Examples:

* Construction of matrices from lists.

          (%i1) x: matrix ([17, 3], [-8, 11]);
                                     [ 17   3  ]
          (%o1)                      [         ]
                                     [ - 8  11 ]
          (%i2) y: matrix ([%pi, %e], [a, b]);
                                     [ %pi  %e ]
          (%o2)                      [         ]
                                     [  a   b  ]

* Addition, element by element.

          (%i3) x + y;
                                [ %pi + 17  %e + 3 ]
          (%o3)                 [                  ]
                                [  a - 8    b + 11 ]

* Subtraction, element by element.

          (%i4) x - y;
                                [ 17 - %pi  3 - %e ]
          (%o4)                 [                  ]
                                [ - a - 8   11 - b ]

* Multiplication, element by element.

          (%i5) x * y;
                                  [ 17 %pi  3 %e ]
          (%o5)                   [              ]
                                  [ - 8 a   11 b ]

* Division, element by element.

          (%i6) x / y;
                                  [ 17       - 1 ]
                                  [ ---  3 %e    ]
                                  [ %pi          ]
          (%o6)                   [              ]
                                  [   8    11    ]
                                  [ - -    --    ]
                                  [   a    b     ]

* Matrix to a scalar exponent, element by element.

          (%i7) x ^ 3;
                                   [ 4913    27  ]
          (%o7)                    [             ]
                                   [ - 512  1331 ]

* Scalar base to a matrix exponent, element by element.

          (%i8) exp(y);
                                   [   %pi    %e ]
                                   [ %e     %e   ]
          (%o8)                    [             ]
                                   [    a     b  ]
                                   [  %e    %e   ]

* Matrix base to a matrix exponent. This is not carried out element by element.

          (%i9) x ^ y;
                                          [ %pi  %e ]
                                          [         ]
                                          [  a   b  ]
                               [ 17   3  ]
          (%o9)                [         ]
                               [ - 8  11 ]

* Noncommutative matrix multiplication.

          (%i10) x . y;
                            [ 3 a + 17 %pi  3 b + 17 %e ]
          (%o10)            [                           ]
                            [ 11 a - 8 %pi  11 b - 8 %e ]
          (%i11) y . x;
                          [ 17 %pi - 8 %e  3 %pi + 11 %e ]
          (%o11)          [                              ]
                          [  17 a - 8 b     11 b + 3 a   ]

* Noncommutative matrix exponentiation. A scalar base <b> to a matrix power <M> is carried out element by element and so b^^m is the same as b^m.

          (%i12) x ^^ 3;
                                  [  3833   1719 ]
          (%o12)                  [              ]
                                  [ - 4584  395  ]
          (%i13) %e ^^ y;
                                   [   %pi    %e ]
                                   [ %e     %e   ]
          (%o13)                   [             ]
                                   [    a     b  ]
                                   [  %e    %e   ]

* A matrix raised to a -1 exponent with noncommutative exponentiation is the matrix inverse, if it exists.

          (%i14) x ^^ -1;
                                   [ 11      3  ]
                                   [ ---  - --- ]
                                   [ 211    211 ]
          (%o14)                   [            ]
                                   [  8    17   ]
                                   [ ---   ---  ]
                                   [ 211   211  ]
          (%i15) x . (x ^^ -1);
                                      [ 1  0 ]
          (%o15)                      [      ]
                                      [ 0  1 ]

There are also some inexact matches for matrix. Try ?? matrix to see them.

(%o1)                                true
(%i2) 

Matrix Example

Related Examples

matrix

matrix ([a/4, -4],[1,...

Calculate

matrix

OKS0:matrix([1, 0, 0,...

a*2;

Calculate

matrix

A:matrix([100,90],[15...

B:matrix([2,1,2],[1,2...

E:A.B;

Calculate

matrix-solve-transpose

a:matrix([-1,2*x-1],[...

transpose(a);

a=transpose(a);

Calculate

matrix-nullity

x: matrix ([1,-1,3], ...

nullity(x);

Calculate

matrix-nullspace

m:matrix([1/4, 1/4, -...

nullspace(m);

m1:matrix([2,1],[3,2]...

Calculate

matrix

A:matrix([2,1],[-10,-...

A.A.A.A.A.A.A.A.A.A.A...

su:-12;

Calculate

matrix

a:matrix([2,3],[3,1]);

b:determinat(a);

Calculate

matrix

a:matrix([1,2,1],[2,0...

b:matrix([1,3,2],[2,4...

v:[1,0,1];

Calculate

matrix

t:matrix([0,a,0,0],[0...

i:matrix([0,0,0,0],[0...

matrixexp(i);

Calculate