Wednesday, August 9, 2017

Casio fx-3650p and HP 21S: 3D Vectors: Dot Products and Angle

Casio fx-3650p and HP 21S: 3D Vectors: Dot Products and Angle

The following program computes the dot product two three-dimension vectors and the angle between them.  Degrees mode is set. 

Casio fx-3650P

Input:  [A, B, C] and [X, Y, D]

Program (66 steps):

Deg : ? → A : ? → B : ? → C :
? → X : ? → Y : ? → D :
AX + BY + CD → M
√ ( A^2 + B^2 + C^2 :
Ans √ ( X^2 + Y^2 + D^2 :
cos^-1 ( M ÷ Ans

HP 21S

Input:  [R1, R2, R3] and [R4, R5, R6].  Store the amounts before running the program (XEQ B)

Program (47 steps):

Step
Code
Key
Notes
01
61, 41, B
LBL B
Beginning of program
02
61, 23
DEG
Set degrees mode
03
22, 1
RCL 1
Calculate dot product
04
55
*

05
22, 4
RCL 4

06
75
+

07
22, 2
RCL 2

08
55
*

09
22, 5
RCL 5

10
75
+

11
22, 3
RCL 3

12
55
*

13
22, 6
RCL 6

14
74
=

15
21, 0
STO 0

16
26
R/S
Display dot product
17
22, 1
RCL 1
Calculate angle
18
51, 11
x^2

19
75
+

20
22, 2
RCL 2

21
51, 11
x^2

22
75
+

23
22, 3
RCL 3

24
51, 11
x^2

25
74
=

26
11

27
74
=

28
22, 4
RCL 4

29
51, 11
x^2

30
75
+

31
22, 5
RCL 5

32
51, 11
x^2

33
75
+

34
22, 6
RCL 6

35
51, 11
x^2

36
34
)

37
11

38
55
*

39
51, 74
LAST

40
74
=

41
22, 0
RCL 0

42
45
÷

43
51, 74
LAST

44
74
=

45
51, 24
ACOS

46
21, 7
STO 7

47
61, 26
RTN
End program

The key strokes for the HP 20S is similar.

Example:  [1, -2, 4]; [3, 7, 6]

Results:
Dot = 13
Angle = 72.98650490190°

Eddie


This blog is property of Edward Shore, 2017

No comments:

Post a Comment

HP Prime: Area by Quadratic Splines

HP Prime:  Area by Quadratic Splines Introduction The program QUADSUM calculates the area under the curve described by the set o...