HP Forums
(15C) Dot Product, Tensor Product, Angle Between Vectors - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (15C) Dot Product, Tensor Product, Angle Between Vectors (/thread-20386.html)



(15C) Dot Product, Tensor Product, Angle Between Vectors - Eddie W. Shore - 08-24-2023 02:33 PM

HP 15C Vector Operations

Set vectors A and B as 3 x 1 vectors (3 rows, 1 column)

Code:

Code:
Dot Product  (LBL D)  
001 : 42,21,14 : LBL D
002 : 45,16,11 : RCL MATRIX A
003 : 42,16, 4 : MATRIX 4
004 : 45, 16, 12 : RCL MATRIX B
005 : 42, 26, 13 : RESULT C
006 : 20 : ×
007 : 45,16,11 : RCL MATRIX A
008 : 42,16, 4 : MATRIX 4
009 : 45,13 : RCL C
010 : 43,32 : RTN

Tensor Product (LBL E)
011 : 42,21,15 : LBL E
012 : 45,16,11 : RCL MATRIX A
013 : 45,16,12 : RCL MATRIX B
014 : 42,16, 4 : MATRIX 4
015 : 42,26,13 : RESULT C
016 : 20 : ×
017 : 45,16,12 : RCL MATRIX B
018 : 41,16, 4 : MATRIX 4
019 : 42,16, 1 : MATRIX 1
020 : 45,16,13 : RCL MATRIX C
021 : 43, 32 : RTN

Angle Between Vectors (LBL 0)
022 : 42,21, 0 : LBL 0
023 : 32,14 : GSB D
024 : 45,16,11 : RCL MATRIX A
025 : 42,16, 8 : MATRIX 8
026 : 45,16,12 : RCL MATRIX B
027 : 42,16, 8 : MATRIX 8
028 : 20 : ×
029 : 10 : ÷
030 : 43,24 : COS^-1
031 : 43,32 : RTN


Notes:

MATRIX 4: transposes a matrix, no result matrix is required.

MATRIX 8: norm of a matrix.

For the dot and tensor products, I transpose the appropriate matrix back to the 3 x 1 form after the calculation.