Programs hp15c
Programs hp15c
These calculator programs are written for the Hewlett-Packard HP 15C scientific
calculator, and can be easily modified to run on other HP calculators that use HP RPN.
Contents
1. Projectile Problem
2. Kepler’s Equation
3. Hyperbolic Kepler’s Equation
4. Barker’s Equation
5. Reduction of an Angle
6. Helmert’s Equation
7. Pendulum Period
8. 1D Perfectly Elastic Collisions
1
1 Projectile Problem
This program solves the following projectile problem: given a target sitting on a hill at
coordinates .x t ; y t / and a cannon at the origin with muzzle velocity v0 , at what angle
should the cannon be aimed to hit the target? The solution is found numerically using
Newton’s method.
To run the program, enter:
Here v0 , x t , and y t may be in any consistent set of units, and the angle 0 (the
initial estimate of the answer) is in degrees. The program returns the angle needed to
hit the target in degrees.
After running the program, the calculator will be set to degrees mode.
Program Listing
2
030- 20
031- 30
032- 45 .0 RCL .0
033- 45 .2 RCL .2
034- 10
035- 43 11 g x2
036- 9 9
037- 48 .
038- 8 8
039- 20
040- 30
041- 45 .3 RCL .3
042- 2 2
043- 20
044- 24 COS
045- 45 .0 RCL .0
046- 20
047- 2 2
048- 20
049- 45 .3 RCL .3
050- 2 2
051- 20
052- 23 SIN
053- 45 .1 RCL .1
054- 20
055- 2 2
056- 20
057- 40 C
058- 10
059- 45 .3 RCL .3
060- 34 x?y
061- 30
062- 44 .3 STO .3
063- 42, 6,.4 f ISG .4
064- 22 0 GTO 0
065- 43 3 g !DEG
066- 43 7 g DEG
067- 43 32 g RTN
3
2 Kepler’s Equation
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program
solves Kepler’s equation
M D E e sin E
M ENTER e f A
Program Listing
4
028- 1 1
029- 30 -
030- 10
031- 30 -
032- 44 .2 STO .2
033- 42, 6,.3 f ISG .3
034- 22 0 GTO 0
035- 43 3 g !DEG
036- 43 7 g DEG
037- 43 32 g RTN
Example. Let M D 60ı , e D 0:15. Enter the above program, then type:
60 ENTER .15 f A
5
3 Hyperbolic Kepler’s Equation
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program
solves the hyperbolic Kepler equation
M D e sinh F F
M ENTER e f A
Program Listing
6
029- 30 -
030- 10
031- 30 -
032- 44 .2 STO .2
033- 42, 6,.3 f ISG .3
034- 22 0 GTO 0
035- 43 32 g RTN
Example. Let M D 60ı , e D 1:15. Enter the above program, then type:
60 ENTER 1.15 f A
7
4 Barker’s Equation
p
Given the constant K D GM=.2q 3 /.t Tp /, this program solves Barker’s equation
s
f 1 3 f GM
tan C tan D .t Tp /
2 3 2 2q 3
as follows:
K f A
Program Listing
8
025- 45 .0 RCL .0
026- 36 ENTER
027- 43 16 g ABS
028- 10
029- 20
030- 43 25 g TAN1
031- 2 2
032- 20
033- 43 32 g RTN
Example. Let K D 19:38 and set the calculator’s angle mode to degrees. Enter the
above program, then type:
19.38 f A
9
5 Reduction of an Angle
This program reduces a given angle to the range Œ 0; 360ı/ in degrees mode, or Œ 0; 2 /
in radians mode. It will work correctly whether the calculator is set for degrees or
radians mode.
To run the program:
f A
Program Listing
10
034- 34 x?y
035- 30 -
036- 43 32 g RTN
Example. Let D 5000ı and set the calculator’s angle mode to degrees. Enter the
above program, then type:
5000 f A
11
6 Helmert’s Equation
Given the latitude (in degrees) and the elevation H (in meters), this program uses
Helmert’s equation to find the acceleration due to gravity g.
To run the program, enter:
ENTER H f A
where is in degrees and H is in meters. The program returns the acceleration due
to gravity g in m/s2 .
After running the program, the calculator will be set to degrees mode.
Program Listing
R.1 = 0:025928
R.2 = 9:80616
R.3 = 6:9 105
R.4 = 3:086 106
12
Example. Let D 38:898ı, H D 53 m. Enter the above program, then type:
38.898 ENTER 53 f A
13
7 Pendulum Period
Given the length L and amplitude of a simple plane pendulum, this program finds
the exact period T , using the arithmetic-geometric mean method.
To run the program, enter:
L ENTER f A
Program Listing
14
033- 10
034- 44 .2 STO .2
035- 33 R#
036- 45 .3 RCL .3
037- 20
p
038- 11 x
039- 44 .3 STO .3
040- 42, 6,.4 f ISG .4
041- 22 0 GTO 0
042- 45 .1 RCL .1
043- 9 9
044- 48 .
045- 8 8
046- 10
p
047- 11 x
048- 2 2
049- 20
050- 43 26 g
051- 20
052- 45 .2 RCL .2
053- 10
054- 43 32 g RTN
Example. Let L D 1:2 m and D 65ı . Enter the above program, then type:
1.2 ENTER 65 f A
15
8 1D Perfectly Elastic Collisions
Given the masses m1 and m2 of two bodies and their initial velocities v1i and v2i , this
program finds the post-collision velocities v1f and v2f using
m1 m2 2m2
v1f D v1i C v2i
m1 C m2 m1 C m2
2m1 m2 m1
v2f D v1i C v2i
m1 C m2 m1 C m2
The program will return the post-collision velocities v1f (in the X register) and v2f
(in the Y register), in the same units.
Program Listing
16
028- 45 .1 RCL .1
029- 20
030- 45 .4 RCL .4
031- 20
032- 45 .0 RCL .0
033- 10
034- 45 .2 RCL .2
035- 45 .1 RCL .1
036- 30
037- 45 .0 RCL .0
038- 10
039- 45 .5 RCL .5
040- 20
041- 40 +
042- 45 .3 RCL .3
043- 43 32 g RTN
Example. Let m1 D 2:0 kg, m2 D 7:0 kg, v1i D 4:0 m/s, and v2i D 5:0 kg.
Enter the above program, then type:
The program returns v1f D 10 m/s in the X register, and v2f D 1 m/s in the Y
register.
17