(35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. (/thread-18512.html) |
(35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Roberto Volpi - 06-26-2022 07:42 AM Taking advantage of the HP35S vector support, a determinant of a 3x3 squared matrix can be computed with just 10 lines of programs: 001 LBL M 002 XEQ X 003 STO G 004 SF 10 005 (EQN) 3RD VECTOR 006 CF 10 007 (EQN) [REGZ, REGY, REGX]* 008 RCL G 009 x 010 RTN * to insert REGX in program mode press EQN, R down, and select X INSTRUCTIONS: The elements of our 3x3 matrix will be input as row vectors, just by typing the values separated by ENTER. EX. calculate the determinant of the following 3x3 matrix: [3, 5, 2 9, 7, 2 11, 0, 0] - input the 1st row: 3 ENTER 5 ENTER 2 - press XEQ M and the HP35S will display: 2ND VECTOR - input the 2nd row: 9 ENTER 7 ENTER 2 - press R/S and the HP35S will display: 3RD VECTOR - input the 3rd row: 11 ENTER 0 ENTER ENTER (as the "0" is repeated) - press R/S and the HP35S will display the result: -44 It does not work? Well, also the subroutine X needs to be inserted. It is a short standalone program of just 10 lines to compute the cross product of a 2 vectors of 3 elements. 001 LBL X 002 SF 10 003 STO C 004 R down 005 STO B 006 R down 007 (EQN) 2ND VECTOR 008 CF 10 009 (EQN) [BxREGX-CxREGY,CxREGZ-REGTxREGX,REGTxREGY-BxREGZ] 010 RTN INTRUCTIONS: The elements of our vectors will be input just by typing the values separated by ENTER. EX. calculate the cross products of these 2 vectors: [3, 5, 2] and [9, 7, 2] - input the 1st vector: 3 ENTER 5 ENTER 2 - press XEQ X and the HP35S will prompt: 2ND VECTOR - input the 2nd vector: 9 ENTER 7 ENTER 2 - press R/S and the HP35S will display the result: [-4, 12, -24] Enjoy! RE: (35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Thomas Klemm - 06-26-2022 08:52 AM Somewhat related from HP 35s - my first thoughts: Message #20: Code: X001 LBL X Now that we have the cross-product of two vectors it's easy to calculate the determinant: just calculate the scalar product with the third vector. RE: (35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Thomas Klemm - 06-26-2022 09:01 AM You might also be interested in these links:
RE: (35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Roberto Volpi - 06-26-2022 09:07 AM (06-26-2022 09:01 AM)Thomas Klemm Wrote: You might also be interested in these links: The list of related items may be in fact endless. Matrices are an interesting subject and lot of HP35S users have submitted great programs to add matrix calculation features, à la HP15C. |