Matrices
|
Keyboard access (HP49) |
Keyboard access (HP48) [MTH] [MATR] |
Keyboard access (HP49) [Matrices] |
Matrices are represented in HP48 and HP49 with brackets [ ], and as lines x colums. Inside [ ] we always have a line of the matrix. Example:
type SIZE and press [ENTER]. Example: [[ 1 2 3] [2 2 2 ]] SIZE Result: size {2 3} A matrix with 2 lines and 3 columns. |
Operation With Matrices
1) +
Sums Matrices You can sum only matrices with the same size. If you try sum matrices with different size you will have an invalid dimension error. Example: Put matrices in the levels 1 and 2 and press + [ [2 3] [5 1] ] [ [4 6] [3 2] ] + Result: [ [ 6 9 ] [ 8 3 ] ] For matrices you can get the same result if you use ADD isntead of + The same commands are also used with lists, however with lists the operator + works different of the operator ADD. 2)
Subtracts matrices
4)
You can only subtracts matrices with the same size. If sizes are different it will returns invalid dimension error Example: Subtract a matrix in level 1 from a matrix in level 2 [ [2 3] [5 1] ] [ [4 6] [3 2] ] Result: [ [-2 -3] [ 2 -1] ] 3) x Multiplies Matrices You can Multiply matrices with compatible size. An invalid dimension error will be displayed at status area if the size is not compatible. We know from Math that a matrix A {lines-a columns-a} just can be multiplyed by a matrix B {lines-b columns-b} if the numbers of columns of A is equal the numbers of lines of B, i.e. columns-a = lines-b . The new matrix will have size: {lines-a columns-b} Example: [[1 2 3][4 5 6]] size {2 3} ( 2 lines x 3 columns matrix ) [[1 4][2 5][3 6]] size {3 2} ( 3 lines x 2 columns matrix ) x Result: [ [14 32] [32 77] ] size {2 2}
Divide matrices
5) x K
You can only divide a square matrix by other of the same size. To divide square matrices put both square matrices on the stack and press Example: Divede the matrices: [[1 2 ][4 5 ]] size {2 2} [[1 4][2 5]] size {2 2} In HP calculator: [ [1 2 ] [4 5 ] ] [ [1 4] [2 5] ] Result: [[ 3.66666... 3.333333...] [ -.66666... -.333333...]] It is the same that [ [1 2 ][4 5 ] ] [ [1 4][2 5] ] [ 1/X ] [SWAP] x
Multiplies a Matrix by a constant
7) DET
Put the matrix in level 2 and the constant in level 1 and press x. Example: [[1 2 ][4 5 ]] 5 x Result: [ [5 10] [20 25] ] The same is also valid for Example: [ [1 2 ] [4 5 ] ] 5 Result: [ [.2 .4] [.8 1] ] 6) 1 / X Inver Matrices To invert a matrix it must 1- be a square matrix. 2- have determinant different of zero. To invert the matrix put it on the stack an press [1/X] Example: [ [5 2 ] [4 8] ] [1/X] Result: [ [.25 -.0625] [-.125 .15625] ]
Calculates the determinant of a matrix
8) TRN
You just can calculate determinant of a square matrices. To calculate the determinant put the matrix on the stack, type DET and press [ENTER]. Example: [ [4 5 6][9 6 3][-5 8 7] ] DET [ENTER] Result: 294
Transpose a Matrix
9) RANM
TRN change lines for colums, i.e. transpose a matrix. Example: [ [1 2 3 ] [4 5 6] ] TRN Result: [ [1 4 ] [2 5] [3 6] ]
Generates a Random matrix
10) IDN
Example: {2 3} RANM Result: [ [-1 0 7] [2 -9 -4] ] Note: the random matrix generated can be, of course, numericaly different of the one in this example.
Creates an Identity matrix
11) TRACE
Example: 3 IDN Result: [ [1 0 0] [0 1 0] [0 0 1] ]
Trace calculate the sum of the main diagonal
12) Power
of a square matrix. Example: [ [4 8 9] [3 6 7] [2 3 5] ] TRACE Result:15
Power of a matrix
You can calculate the result of the matrix A at the power n using [ENTER] and x Example: On the stack type, [[4 8 9] [3 6 7] [2 3 5]] Pressing [ENTER] three times you will get: [ [4 8 9] [3 6 7] [2 3 5] ] [ [4 8 9] [3 6 7] [2 3 5] ] [ [4 8 9] [3 6 7] [2 3 5] ] Press now two times x Result: [ [827 1517 1956] [627 1150 1483] [383 702 906] ] That is the matrix at the 3rd power. |
HP49 has a new feature for matrices. It is able to solve symbolic matrices. Example: Calculate the determinant of a symbolic matrix,
|