Post Reply 
(35S) Determinant of a 3x3 matrix (plus cross product): the shortest way.
06-26-2022, 07:42 AM (This post was last modified: 06-28-2022 07:02 PM by Roberto Volpi.)
Post: #1
(35S) Determinant of a 3x3 matrix (plus cross product): the shortest way.
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!



Put a calculator into your life!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(35S) Determinant of a 3x3 matrix (plus cross product): the shortest way. - Roberto Volpi - 06-26-2022 07:42 AM



User(s) browsing this thread: 1 Guest(s)