HP Forums
(42S) Rotation 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: (42S) Rotation Matrix (/thread-8643.html)



(42S) Rotation Matrix - Eddie W. Shore - 07-07-2017 05:46 AM

R = [[ cos θ, -sin θ ],[ sin θ, cos θ ]]
Code:

00 {138-Byte Prgm}
01 LBL “ROTATE2”
02 DEG
03 “ANGLE °”
04 PROMPT
05 STO 00
06 1
07 ENTER
08 2
09 DIM “MAT1”
10 INDEX “MAT1”
11 “X0”
12 PROMPT
13 STOEL
14 J+
15 “Y0”
16 PROMPT
17 STOEL
18 2
19 ENTER
20 2
21 DIM “MAT2”
22 INDEX “MAT2”
23 RCL 00
24 COS
25 STOEL
26 J+
27 RCL 00
28 SIN
29 +/-
30 STOEL
31 2
32 ENTER
33 1
34 STOIJ
35 RCL 00
36 SIN
37 STOEL
38 J+
39 RCL 00
40 COS
41 STOEL
42 RCL “MAT1”
43 RCL “MAT2”
44 *
45 STO “MAT3”
46 INDEX “MAT3”
47 RCLEL
48 “X1”
49 AVIEW
50 STOP
51 J+
52 RCLEL
53 “Y1”
54 AVIEW
55 END

Example:
Input: [3, -2], at an angle θ = 40°
Result: [ 1.0126, -3.4605 ]