Top
Back: 4.9.3 matrix type cast
Forward: 4.9.5 matrix related functions
FastBack: 4. Data types
FastForward: 5. Functions and system variables
Up: 4.9 matrix
Top: Singular 2-0-4 Manual
Contents: Table of Contents
Index: F. Index
About: About This Document

4.9.4 matrix operations

+

addition with matrix or poly; the poly is converted into a diagonal matrix

-

negation or subtraction with matrix or poly; the poly is converted into a diagonal matrix

*

multiplication with matrix or poly; the poly is converted into a diagonal matrix

/

division by poly

==, <>, !=

comparison

matrix_expression [ int_expression, int_expression ]

is a matrix entry, where the first index indicates the row and the second the column


Example:

 
  ring r=32003,x,dp;
  matrix A[3][3] = 1,3,2,5,0,3,2,4,5; // define a matrix
  print(A); // nice printing of small matrices
→ 1,3,2,
→ 5,0,3,
→ 2,4,5 
  A[2,3];   // matrix entry
→ 3
  A[2,3] = A[2,3] + 1; // change entry
  A[2,1..3] = 1,2,3;   // change 2nd row
  print(A);
→ 1,3,2,
→ 1,2,3,
→ 2,4,5 
  matrix E[3][3]; E = E + 1;  // the unit matrix
  matrix B =x*E - A;
  print(B);
→ x-1,-3, -2,
→ -1, x-2,-3,
→ -2, -4, x-5
  det(B);        // the characteristic polynomial of A
→ x3-8x2-2x-1
  A*A*A - 8 * A*A - 2*A == E;  // Cayley-Hamilton
→ 1
  vector v =[x,-1,x2];
  A*v; // multiplication of matrix and vector
→ _[1,1]=2x2+x-3
→ _[2,1]=3x2+x-2
→ _[3,1]=5x2+2x-4
  matrix m[2][2]=1,2,3;
  print(m-transpose(m));
→ 0,-1,
→ 1,0  

Top Back: 4.9.3 matrix type cast Forward: 4.9.5 matrix related functions FastBack: 4. Data types FastForward: 5. Functions and system variables Up: 4.9 matrix Top: Singular 2-0-4 Manual Contents: Table of Contents Index: F. Index About: About This Document
            User manual for Singular version 2-0-4, October 2002, generated by texi2html.