Thursday, October 23, 2014

Fun with the HP 12C


I used the classic HP 12C, with the 99 step capacity.  Even without the trig functions, we can do a lot.

Eddie
 

Calculating f(x) = p * ∑(a^k, k=1 to n) using the TVM Keys

 
Input:
[ n ] = n
R0 = a
R1 = p

Program:

STEP
KEY
CODE
01
BEGIN
43 7
02
RCL 0
45 0
03
1
1
04
-
30
05
EEX
26
06
2
2
07
*
20
08
[i]
12
09
RCL 1
45 1
10
CHS
16
11
[PMT]
14
12
[FV]
15
13
END
43 8
14
GTO 00
43 33 00

 

Examples:

n = 60, R0 = 1.01, R1 = 350.  Result:  28,870.2283

n = 5, R0 = 2, R1 = 10.05.   Result:  623.1

 

Heron’s Formula

Area of a Triangle with side lengths a, b, and c.

Area = √(s*(s-a)*(s-b)*(s-c)) where s = (a+b+c)/2

Input:
R1 = a
R2 = b
R3 = c


Program:

STEP
KEY
CODE
01
RCL 1
45 1
02
RCL 2
45 2
03
+
40
04
RCL 3
45 3
05
+
40
06
2
2
07
÷
10
08
STO 4
44 4
09
RCL 4
45 4
10
RCL 1
45 1
11
-
30
12
RCL 4
45 4
13
RCL 2
45 2
14
-
30
15
*
20
16
RCL 4
45 4
17
RCL 3
45 3
18
-
30
19
*
20
20
RCL 4
45 4
21
*
20
22
43 21
23
GTO 00
43

 

Example:   a = 5, b = 5, c = 6.  Result:  12

Projectile Motion without Air Resistance:  With the projectile being launched at 45° at velocity V.  The maximum distance will be achieved at these conditions.


Theoretical Maximum Distance:
R_max = v^2/g (in feet)

Theoretical Height of the Projectile (at x = R_max/2)
H = v^2/(4g)  (in feet)

Where g = 32.17404 ft/s^2

If you desire meters, substitute g = 9.80665 m/s^2 instead.

Run the program with V in the display.  The velocity is assumed to be feet/second.  The maximum distance is calculated, then the projectile’s theoretical height.

Program:

STEP
KEY
CODE
01
2
2
02
Y^X
21
03
3
3
04
2
2
05
.
48
06
1
1
07
7
7
08
4
4
09
0
0
10
4
4
11
÷
40
12
R/S
31  (display R)
13
4
4
14
÷
40
15
GTO 00
43 33 00 (display H)

 Example:  V = 40  ft/s
Results:  R = 49.7295 ft,  H = 12.4324 ft
 
Factorials of Large Integers

N! =  N * (N-1) * (N-2) * … * 1

**For large n, this program will take time if you have an HP 12C that was manufactured in the 1980s.


Input n, press R/S. 
The mantissa is displayed.  Press R/S
The exponent is displayed (10^exponent).

 Program:

STEP
KEY
CODE
01
STO 0
44 0
02
0
0
03
STO 1
44 1
04
RCL 0
45 0
05
LN
43 23   // loop begins
06
STO+ 1
44 40 1
07
1
1
08
STO- 0
44 30 0
09
RCL 0
45 0
10
1
1
11
-
30
12
X=0
43 35
13
GTO 15
43 33 15   // end of loop
14
GTO 04
43 33 04
15
RCL 1
45 1
16
1
1
17
0
0
18
LN
43 23
19
÷
10
20
STO 1
44 1
21
ENTER
36
22
FRAC
43 24
23
1
1
24
0
0
25
X<>Y
34
26
Y^X
21
27
R/S
31  // mantissa
28
X<>Y
34
29
INTG
43 25 // exponent
30
GTO 00
43 33 00

 
Example: 

50! » 3.0414 * 10^64
50 R/S
Result:  3.0414 R/S 64

76! » 1.8855 * 10^111
76 R/S
Result:  1.8855 R/S 111

Degrees Minutes Seconds to Decimal Degrees

2°51’32.4” -> 2.859

Type input as DD.MMSSSS (degrees, minutes, seconds). For our example, the input would be 2.51324.

 Program:

STEP
KEY
CODE
01
STO 0
44 0
02
INTG
43 25
03
STO 1
44 1
04
RCL 0
45 0
05
FRAC
43 24
06
EEX
26
07
2
2
08
*
20
09
INTG
43 25
10
6
6
11
0
0
12
÷
10
13
STO+ 1
44 40 1
14
RCL 0
45 0
15
EEX
26
16
2
2
17
*
20
18
FRAC
43 24
19
3
3
20
6
6
21
÷
10
22
STO+ 1
44 40 1
23
RCL 1
45 1
24
GTO 00
43 33 00

Decimal Degrees to Degrees Minutes Seconds

 2.859 -> 2°51’32.4”

Answer displayed as DD.MMSSSS (degrees minutes seconds)

Program:

01
STO 0
44 0
02
INTG
43 25
03
STO 1
44 1
04
RCL 0
45 0
05
FRAC
43 24
06
6
6
07
0
0
08
*
20
09
ENTER
36
10
INTG
43 25
11
EEX
26
12
2
2
13
÷
10
14
STO+ 1
44 40 1
15
R-Down
33
16
FRAC
43 24
17
6
6
18
0
0
19
*
20
20
EEX
26
21
4
4
22
÷
10
23
STO+ 1
44 40 1
24
RCL 1
45 1
25
GTO 00
43 33 00

 
This blog is property of Edward Shore - 2014

 

 

No comments:

Post a Comment

Adventures in Python: String Manipulation and Function/Derivative Table (Subroutines)

Adventures in Python:  String Manipulation and Function/Derivative Table (Subroutines) String Manipulation This script demonstrate...