source: git/Tst/Manual/matrix_operations.tst @ 0d6b7fc

fieker-DuValspielwiese Release-4-3-2p2
Last change on this file since 0d6b7fc was 894057, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: Tests from online manual (res+stat on mamawutz): short ones Tst/Manual/s.lst
  • Property mode set to 100644
File size: 656 bytes
Line 
1LIB "tst.lib"; tst_init();
2  ring r=32003,x,dp;
3  matrix A[3][3] = 1,3,2,5,0,3,2,4,5; // define a matrix
4  print(A); // nice printing of small matrices
5  A[2,3];   // matrix entry
6  A[2,3] = A[2,3] + 1; // change entry
7  A[2,1..3] = 1,2,3;   // change 2nd row
8  print(A);
9  matrix E[3][3]; E = E + 1;  // the unit matrix
10  matrix B =x*E - A;
11  print(B);
12  // the same (but x-A does not work):
13  B = -A+x;
14  print(B);
15  det(B);        // the characteristic polynomial of A
16  A*A*A - 8 * A*A - 2*A == E;  // Cayley-Hamilton
17  vector v =[x,-1,x2];
18  A*v; // multiplication of matrix and vector
19  matrix m[2][2]=1,2,3;
20  print(m-transpose(m));
21tst_status(1);$
Note: See TracBrowser for help on using the repository browser.