(20S and 21S) Inverse and Square of a 2 x 2 Matrix - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (20S and 21S) Inverse and Square of a 2 x 2 Matrix (/thread-8468.html) |
(20S and 21S) Inverse and Square of a 2 x 2 Matrix - Eddie W. Shore - 06-08-2017 03:49 AM Let M be the 2 x 2 matrix: M = [ [ R1, R2 ] [ R3, R4 ] ] Store values in R1, R2, R3, and R4 before executing the program. HP 20S and HP 21S: Inverse of a Matrix Output: Determinant of M in R0. If the determinant is 0, then the program terminates, since the matrix is determined to be singular (and have normal inverse). Output: M^-1: [ [ R5, R6 ], [ R7, R8 ] ] where R5 = R4/det(M) R6 = -R2/det(M) R7 = -R3/det(M) R8 = R4/det(M) The keystrokes for the HP 20S and HP 21S are the same. Code:
Example 1: [ [1.9, -7], [-3.5, 4.2] ]^-1 = [ [ -0.2542, -0.4237], [ -0.2119, -0.1150 ]] Determinant: -16.52 Example 2: [ [-2, 8],[5, 6] ]^-1 = [ [-0.1154, 0.1538], [ 0.0962, 0.0385] ] Determinant: -52 HP 20S and HP 21S: Square of a Matrix Output: [ [ M5, M6 ] [ M7, M8 ] ] M5 = R1^2 + R2 * R3 M6 = R2 * (R1 + R4) M7 = R3 * (R1 + R4) M8 = R2 * R3 + R4 Code:
Example 1: [ [1.9, -7], [-3.5, 4.2] ]^2 = [ [ 28.11, -42.7], [ -21.35, 42,14 ]] Example 2: [ [-2, 8],[5, 6] ]^2 = [ [ 44, 32 ], [ 20, 76 ] ] |