## Saturday, January 7, 2017

### HP 12C: Rule of 78, Slicing a Right Triangle, Sums, Projectile Motion

Announcement: Calculator Reviews

In the coming weeks, I have acquired a lot of calculators and plan to give a short review of each. They include, the original Hewlett Packard HP 10B, Casio EL-5500 III, and the Calculated Industries Construction Pro/Trig App.

Fun with the HP 12C (I lost count on how segments I done so far)

More fun with the HP 12C!  (The HP 12C is on my list of top ten calculators of all time - the other nine I have to think about... subject of a future post?).  I like using the HP 12C for a variety of applications and not just strictly finance.  Here are four more programs, enjoy!

HP 12C:  Rule of 78

When a mortgage, a loan, a lease, or other annuity is paid early, we can determine how much interest rebate is due by the Rule of 78:

Rebate = ( (n – k + 1) * FC ) / ( (n + 1) * n)

Where:
n = the length of the annuity (number of periods)
k = the period where the loan is paid off
FC = total interest, finance charge = PMT * n – PV

The program will require the user to input and compute the annuity variables [ n ], [ i ], [ PV ], and [PMT] ([FV] if a balloon payment is required).  Then enter the period # where the loan is paid off (k), and press [R/S].

Program:

Keep in mind: this is done on the HP 12C (regular).  For the HP 12C Platinum, the code for Last X is 43, 40 ([ g ] [ + ])

 STEP KEY CODE NUMBER 01 STO 1 44, 1 02 RCL PMT 45, 14 03 RCL n 45, 11 04 * 20 05 RCL PV 45, 13 06 + 40 07 CHS 16 08 STO 0 44, 0 09 RCL n 45, 11 10 RCL 1 45, 1 11 - 30 12 1 1 13 + 40 14 * 20 15 RCL 1 45, 1 16 ÷ 10 17 LST x 43, 36 18 1 1 19 + 40 20 ÷ 10 21 GTO 00 43, 33, 00

Example:  On a 48 month purchase of a \$20,000 car, financed at 5%, the purchaser pays the car off early after 24 payments (k = 24).  What is the rebate?

Output:
Find the payment:
[ f ] [X<>Y] (CLEAR FIN)  (if necessary)
48 [ n ]
5 [ g ] [ i ] (12÷)
20000 [ PV ]
[ PMT ]  (payment = -460.59)

24 [R/S]
Rebate:  \$87.84

Source:  Rosenstein, Morton.  Computing With the Scientific Calculator Casio: Tokyo, Japan.  1986.  ISBN-10: 1124161430

HP 12C: Slicing a Right Triangle

The program finds slices a right triangle into equal parts.  Using similar triangles, the bases and heights of similar triangles are found.

 STEP KEY CODE NUMBER 01 RCL 0 45, 0 02 RCL 2 45, 2 03 ÷ 10 04 INTG 43, 25 05 STO 3 44, 3 06 1 1 07 STO 4 44, 4 08 RCL 0 45, 0 09 RCL 3 45, 3 10 RCL 4 45, 4 11 * 20 12 - 30 13 R/S 31 14 RCL 1 45, 1 15 * 20 16 RCL 0 45, 0 17 ÷ 10 18 R/S 31 19 1 1 20 STO+ 4 44, 40, 4 21 RCL 2 45, 2 22 RCL 4 45, 4 23 X≤Y 43, 34 24 GTO 08 43, 33, 08 25 GTO 00 43, 33, 00

Input:  Pre-store the following values:
Run in Register 0 (R0)
Rise in Register 1 (R1)
Number of partitions in Register (R2)

Output:  Loop:
Base of the smaller triangle (x), press [ R/S ]
Height of the smaller triangle (y), press [ R/S ]
Loop ends after n pairs

Example:  Run = 5  (R0), Height = 3 (R1), Number of Partitions = 5 (R2)

Output:
 X 4 3 2 1 0 Y 2.4 1.8 1.2 0.6 0

HP 12C:  Sums of Î£x, Î£x^2, Î£x^3

This program takes two arguments:

Y: x
X: n  (where n=1, n=2, n=3)

If n = 1, the sum Î£ x from 1 to n is calculated
If n = 2, the sum Î£ x^2 from 1 to n is calculated
If n = 3, the sum Î£ x^3 from 1 to n is calculated

If n is not 1, 2, or 3, an error occurs.

Program:

Keep in mind: this is done on the HP 12C (regular).  For the HP 12C Platinum, the code for Last X is 43, 40 ([ g ] [ + ]) and the step numbers are three digits (000 instead of 00).

 STEP KEY CODE NUMBER 01 X<>Y 34 02 STO 1 44, 1 03 X<>Y 34 04 STO 0 44, 0 05 1 1 06 - 30 07 X=0 43,35 08 GTO 21 44, 33, 21 09 RCL 0 45, 0 10 2 2 11 - 30 12 X=0 43, 35 13 GTO 29 44, 33, 29 14 RCL 0 45, 0 15 3 3 16 - 30 17 X=0 43, 35 18 GTO 46 43, 33, 46 19 0 0 20 ÷ 10 21 RCL 1 45, 1 22 ENTER 36 23 * 20 24 LST X 43, 36 25 + 40 26 2 2 27 ÷ 10 28 GTO 00 43, 33, 00 29 RCL 1 45, 1 30 ENTER 36 31 * 20 32 LST X 43, 36 33 X<>Y 34 34 3 3 35 * 20 36 + 40 37 RCL 1 45, 1 38 3 3 39 Y^X 21 40 2 2 41 * 20 42 + 40 43 6 6 44 ÷ 10 45 GTO 00 43, 33, 00 46 RCL 1 45, 1 47 ENTER 36 48 ENTER 36 49 1 1 50 + 40 51 * 20 52 ENTER 36 53 * 20 54 4 4 55 ÷ 10 56 GTO 00 43, 33, 00

Example:  n = 5
Y: 5, X: 1. Result: 15
Y: 5, X: 2. Result: 55
Y: 5, X: 3. Result 225

HP 12C:  Projectile Motion, No Air Resistance:  Maximum Distance (U.S. Units)

For an object that travels in a projectile motion, we can track its range (distance traveled from the beginning) and height by:

R = v^2 * sin (2 * Î¸)/g
H = (v^2 * (sin Î¸)^2) / (2 * g)

Where:
v = initial velocity
Î¸ = initial angle
g = Earth’s gravity.  For in US units, g = 32.1740468 ft/s^2.
This program uses the approximation g ≈ 32.174 ft/s^2

The projectile will have maximum range (distance) if we aim the object at 45°.
--------------------------
Aside:  Why?

Let’s let range (R) be a function of angle (Î¸):

R = v^2/g * sin(2 * Î¸)

Find the critical points by finding the zero of the first derivative:

dR/dÎ¸ = 2 * v^2/g * cos (2 * Î¸)
0 = 2 * v^2/g * cos (2 * Î¸)
0 = cos (2 * Î¸)
arccos 0 = 2 * Î¸
Ï€/2 = 2 * Î¸
Î¸ = Ï€/4

Now we can use the second derivative to test whether the function is at a maximum (less than 0) and minimum (more than 0) at the crucial point.

d^2 R/dÎ¸^2 = -4 * v^2/g * sin(2 * Î¸)
Let Î¸ = Ï€/4
-4 * v^2/g * sin(2 * Ï€/4) = -4 * v^2/g * sin(Ï€/2) = -4 * v^2/g < 0
(We are assuming the initial velocity is positive, and g ≈ 32.174 >0)

Since the second derivative at Î¸ = Ï€/4 is negative, the range is at its maximum.

Note that in calculus, angles are measured in radians.  Ï€/2 radians in degrees is 90° and Ï€/4 radians in degrees is 45°.  (We are only concentrating on angles between 0° and 90°)
--------------------------

To find the maximum range and height, substitute at Î¸ = 45° and range and height are:

R = v^2 /g
H = v^2 / (4 * g)
The time this certain projectile lasts is:

T = (v * √2) / (2 * g)

Program:

Keep in mind: this is done on the HP 12C (regular).  For the HP 12C Platinum, the code for Last X is 43, 40 ([ g ] [ + ])

 STEP KEY CODE NUMBER 01 STO 1 44, 1 02 2 2 03 ÷ 10 04 LST x 43, 36 05 √x 43, 21 06 * 20 07 3 3 08 2 2 09 . 48 10 1 1 11 7 7 12 4 4 13 STO 0 44, 0 14 ÷ 10 15 R/S 31 16 RCL 1 45, 1 17 ENTER 36 18 * 20 19 RCL 0 45, 0 20 ÷ 10 21 R/S 31 22 4 4 23 ÷ 10 24 GTO 00 43, 33, 00

Input:  velocity in ft/s   (convert from mph to ft/s by multiplying it by 22/15)

Output:
time of projectile in seconds, [R/S]
range of projectile in feet, [R/S]
height of projectile in feet

Example:
V = 25 mph = 36.6666667 ft/s  (110/3)

Output:
Time:  0.81 sec,  Range: 41.79 ft,  Height: 10.45 ft

Source:  Rosenstein, Morton.  Computing With the Scientific Calculator Casio: Tokyo, Japan.  1986.  ISBN-10: 1124161430

Eddie

This blog is property of Edward Shore, 2017.  (2017, wow!  7 days already have passed.)

1. Very useful information and program instructions with HP 12C calculator.
Keep the good work !!

1. Thank you! I love working with the 12C. I wasn't a fan at first (we're talking 20 years ago), but it grew on me. It's one the of the best calculators.

Eddie

2. Many thanks Eddie once again for a superb article on programming a calculator. Would love to read about your top ten all-time-favorite calculators! I think it would be interesting to see which company's calculators tug at your heart (and head) the most.
TI
HP
Casio