# hp-15c Program Index

## BisecnewtP Solver - Solver for hp programmable calculators - J E Patterson

BisecnewtP - Documentation

I have combined the BisectionP, SecantP and Newton-Raphson routines into one program. The three solvers in this program have their own particular strengths. With the additional choice of the built-in solver in the hp-15C Simulator solutions to most root finding problems can be found. This program is suitable for some calculators which don't include the hp Solver.

GSB A runs a bisection solver which acts on f(x) = 0 under label E. Two guesses for x are required.

GSB B runs a secant solver which acts on f(x) = 0 under label E. Two guesses for x are required.

GSB C runs a Newton-Raphson solver which acts on f(x) = 0 under label E. One guess for x is required.

Apple Numbers, Microsoft Excel and PDF versions of these solvers are now included in the download so convergence rates can be compared.

## BisectionP Solver - Solver for hp programmable calculators - J E Patterson

BisectionP - Documentation

GSB A runs a self contained bisection solver which acts on f(x) = 0 under label E. This program is suitable for some calculators which don't include the hp Solver.

## SecantP - Solver for hp programmable calculators - J E Patterson

SecantP - Documentation

GSB A runs a self contained secant solver which acts on f(x) = 0 under label E. This program is suitable for some calculators which don't include the hp Solver.

These programs are still being tested and modified.

## Introduction

The following programs and program compilations have been prepared using Torstan Mantz's hp-15c Simulator and Smultron a programming editor for macOS.

The first 5 programs below are bonded collections of smaller programs. Calling the appropriate label will run the desired program. Themes include Maths, Cycling and Physics.

Use the references in the documentation to find the original programs or use this index to find some others. Collections can be created using a simple text editor by cutting and pasting smaller programs into one file. The line numbering will be fixed once the Simulator saves the composite file. Documentation can be combined in a similar way, mostly by pasting lines beginning with #D: and adding new headings. Normally documentation is created with the Simulator editor and a final edit would be done there.

## Composite - 12 programs

Composite - 12 programs - Documentation

CurveP - J E Patterson
The program fits data that may be linear at low x,y amplitudes but y falls off at higher x values. This is a common issue in many physical systems.

TVM - Accurate TVM - Jeff Kearns
Store known values in nominated registers and solve for the variable not entered. f SOLVE E for example.

HgCalP - J E Patterson
The concentration of mercury vapour in air, above liquid mercury, depends on the temperature. A good calibration curve can be obtained using a simplified Dumarey equation.

RGCalP - J E Patterson
RAIN GAUGE calibration in mm per bucket tip, given the number of bucket tips, the diameter of funnel in mm and the calibration volume of water in ml.

Parallel Resistances - J E Patterson
First resistance, press ENTER, second resistance GSB 3 for parallel resistance result.

Quadratic Equation Solver program for the hp-15c - from Torsten Manz
This program finds the roots of a quadratic equation of the form ax2 + bx + c = 0.

Convert to Fraction - Guido Socher
Let's say you would like to know what 0.15625 as a fraction is. You type: 0.15625 GSB 5. The display shows "running" and then you see first 5, and then a second later, 32 The fraction is therefore 5/32 (numerator = 5 and denominator = 32).

Solve a System of Linear Equations - J E Patterson
N GSB 6 where N is the number of equations (8 or less). A N N is displayed. Matrix [A] has a dimension of NxN. Enter the coefficients of xi where i has values from 1 to N. Press R/S after each is entered. B N 1 is displayed. Matrix [B] has a dimension of Nx1. Enter the constants. Press R/S after each is entered. C N 1 is displayed. Matrix [C] has a dimension of Nx1. Values for xi are read out in turn by pressing R/S.

EbikeMax - Ebike maximum speed from motor rpm - J E Patterson
Enter motor rpm. Enter wheel size in inches or mm - the program works out if the units are inches or mm from the magnitude. GSB 7. The maximum speed at 36 volts is displayed. Press R/S. The maximum speed at 42 volts is displayed.

Bike Power - J E Patterson
This program calculates the power in watts required for a given bike speed.

Bike Development - J E Patterson
Enter wheel diameter in inches or mm - the program works out if the units are inches or mm from the magnitude Enter front sprocket teeth number. Enter rear sprocket teeth number. GSB 9 returns Gear-Inches. R/S returns Metres-Development. R/S returns Gain-Ratio for a 170 mm crank arm

Function tests - J E patterson
N STO 2 GSB 0 for N iterations. N is the number of iterations required otherwise there is only one iteration. My Simulator result is 3736036.572 with 10,000 iterations in 56 seconds. My DM15 result is 3736036.611 with 100 iterations in 67 seconds.

## Maths1 - 8 Programs

Maths1 - 8 Programs - Documentation

CurveP - J E Patterson
The program fits data that may be linear at low x,y amplitudes but y falls off at higher x values. This is a common issue in many physical systems. x1, y1 should preferably be on the linear part of the curve. CurveP is not a regression. It assumes that the data is reasonably precise. Linear and power curves can be fitted, as well.

Prime Factorization - Eddie Shore
N GSB C for prime factors of N

Little Gauss formula for the hp-15c - J E Patterson
The sum of integers up to n are calculated.

TVM - Accurate TVM - Jeff Kearns
Store known values in nominated registers and solve for the variable not entered. f SOLVE E for example.

Quadratic Equation Solver program for the hp-15c - from Torsten Manz
This program finds the roots of a quadratic equation of the form ax2 + bx + c = 0.

Convert to Fraction - Guido Socher
Let's say you would like to know what 0.15625 as a fraction is. You type: 0.15625 GSB 5 The display shows "running" and then you see first 5, and then a second later, 32 The fraction is therefore 5/32 (numerator = 5 and denominator = 32).

Solve a System of Linear Equations - J E Patterson
N GSB 6 where N is the number of equations (8 or less). A N N is displayed. Matrix [A] has a dimension of NxN. Enter the coefficients of xi where i has values from 1 to N. Press R/S after each is entered. B N 1 is displayed. Matrix [B] has a dimension of Nx1. Enter the constants. Press R/S after each is entered. C N 1 is displayed. Matrix [C] has a dimension of Nx1. Values for xi are read out in turn by pressing R/S.

Nth-degree Polynomial Fitting - Valentín Albillo
N GSB 4 to start the program where N<8. 1.0000 is displayed, this is a prompt to enter x value for the first data point. At xn+1 the prompt returns to 1.0000 so enter the first y data point. At yn+1 R/S returns a0 Repeat R/S to get all the polynomial coefficients up to an.

## Maths2 - 12 Programs

Maths2 - 12 Programs - Documentation

Gaussian Integration - Valentín Albillo
Enter equation code between LBL . 1 and RTN Store the number of sub-intervals in Register I. N must be an integer number equal or greater than 1. The larger N, the more precise the result will be and the longer it will take to run. N STO I. Enter limit a ENTER and limit b. GSB A. The integral is displayed.

Decimal to Fraction - Joseph Horn
Converts any positive decimal number to a fraction. Accuracy is controlled by the current FIX setting.

Base Conversion - Thomas Klemm
This program allows the conversion of numbers from one base to another.

Prime Factorization - Eddie Shore
N GSB C for prime factors of N

Numerical Derivative - Eddie Shore
Calculate numerical derivatives of f(x).

Modulo - Gamo
x mod y = x – y*int(x/y) is more accurate than the alternative x mod y = y*frac(x/y) which displays roundoff errors.

Big Factorial program for the hp-15c - Torsten Manz
This program computes the factorial of large numbers up to 1x108.

2D Coordinate Rotation - Eddie Shore
Store the following: X in R4, Y in R5, and θ in R3. Run the program - GSB 2. Results are stored in R6 and R7, for X’ and Y’, respectively. X’ is displayed first, press R/S to get Y’.

Stair Calculation - Eddie Shore
Store riser height in R0 (RH). Store horizontal run in R1. Store vertical rise in R2 GSB 3 displays number of stairs (S). R/S displays treadwidth (TW). R/S displays stringer length (ST)

Triangle Solution provided 2 sides and 1 angle - Gamo
Find the 3rd side and 2 remaining angles.

RNEAR - Round to nearest 1/n - Eddie Shore, Dieter. Modified for hp-15c - J E Patterson.
The program RNEAR rounds a number x to the nearest 1/n

Hyperfocal Distance - Gamo, Dieter.
Hyperfocal Distance is the closest distance setting at which a lens should be focused while still keeping everything, from half the hyperfocal distance to infinity, sharp.

## Physics1 - 8 Programs

Physics1 - 8 Programs - Documentation

1. Projectile Problem - Dr. D G Simpson
This program solves the following projectile problem: given a target sitting on a hill at coordinates (xt, yt) and a cannon at the origin with muzzle velocity vc. At what angle should the cannon be aimed to hit the target? The solution is found numerically using Newton’s method.

2. Kepler’s Equation - Dr. D G Simpson
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program solves Kepler’s equation M = E - e sin E to find the eccentric anomaly E.

3. Hyperbolic Kepler’s Equation - Dr. D G Simpson
Given the mean anomaly M (in degrees) and the orbit eccentricity e, this program solves the hyperbolic Kepler equation M = e sinh(F) - F to find the hyperbolic eccentric anomaly F .

4. Barker’s Equation - Dr. D G Simpson
Given the constant K = √GM/2q3 (t - Tp) this program solves Barker's equation tan (f/2) + 1/3 tan3(f/2) = √GM/2q3 (t-Tp) to find the true anomaly f.

5. Reduction of an Angle - Dr. D G Simpson
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.

6. Helmert’s Equation - Dr. D G Simpson
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.

7. Pendulum Period - Dr. D G Simpson
Given the length L and amplitude θ° of a simple plane pendulum, this program finds the exact period T , using the arithmetic-geometric mean method.

8. 1D Perfectly Elastic Collisions - Dr. D G Simpson
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.

## Bike1 - 4 Programs

Bike1 - 4 Programs - Documentation

EbikeMax - Ebike maximum speed from motor rpm - J E Patterson
Enter motor rpm. Enter wheel size in inches or mm - the program works out if the units are inches or mm from the magnitude. GSB 7. The maximum speed at 36 volts is displayed. Press R/S. The maximum speed at 42 volts is displayed.

Bike Power - J E Patterson
This program calculates the power in watts required for a given bike speed.

Bike Development - J E Patterson
Enter wheel diameter in inches or mm - the program works out if the units are inches or mm from the magnitude Enter front sprocket teeth number. Enter rear sprocket teeth number. GSB 9 returns Gear-Inches. R/S returns Metres-Development. R/S returns Gain-Ratio for a 170 mm crank arm

Bike Speed - J E Patterson
Run Bike Development first. Enter cadence in RPM. GSB D. The bike speed in km/h is returned

## StrayLightP - Stray light curve correction - J E Patterson

StrayLightP - Stray light curve correction - Documentation

Spectrophotometers have some stray light or detector dark current which causes the calibration to be non linear at high absorbances. This program corrects for the calibration curvature caused by the presence of stray light.

## CurveP - J E Patterson

CurveP - Curve Fitting - Documentation

The program fits data that may be linear at low x,y amplitudes but y falls off at higher x values. This is a common issue in many physical systems. x1, y1 should preferably be on the linear part of the curve. CurveP is not a regression. It assumes that the data is reasonably precise. Linear and power fit data sets also work well.

## Stat4P - Curve fitting with linear, logarithmic, power and exponential equations - J E Patterson

Stat4P - Statistical curve fitting - Download
Stat4P - Curve fitting with linear, logarithmic, power and exponential equations - Documentation

This program provides linear, logarithmic, power and exponential regressions with a single entry of a data set.

• y ENTER x GSB A. Repeat to enter more data.
• GSB B for linear regression y = ax+b, b is shown, R/S for a, R/S for r. Enter x' R/S for estimate y'.
• GSB C for logarithmic regression y = a ln(x) + b, b is shown, R/S for a, R/S for r. Enter x' R/S for estimate y'.
• GSB D for power regression y = xa * b, b is shown, R/S for a, R/S for r. Enter x' R/S for estimate y'.
• GSB E for exponential regression y = eax * b, b is shown, R/S for a, R/S for r. Enter x' R/S for estimate y'.
• Repeat x' R/S if required.
• GSB B, C, D, and E can be repeated at any time without re-entering data.

## Mercury vapour standard concentration ng/ml - J E Patterson

HgCalP - Calibrate Mercury Analyser - Download
HgCalP - Calibrate Mercury Analyser - Documentation

The concentration of mercury vapour in air, above liquid mercury, depends on the temperature. A good calibration can be obtained using a simplified Dumarey equation. Reference: R. Dumarey, E. Temmerman, R. Dams, J. Hoste, Analyt. Chim. Acta 170, 337 (1985).

## ReactanceP - Reactance calculations, including inductor turns - J E Patterson

ReactanceP - Reactance calculations zip-file - Download
ReactanceP - Reactance calculations, including inductor turns - Documentation

This program calculates solutions to common reactance problems and also allows an inductor to be specified. Solver is not needed to do reactance calculations. The equations can be solved directly. The advantage with using Solver is that programs can be shorter. The equations which follow are all used in this program. An unknown variable C, L or f can be calculated by entering it as zero.

• C = 1/(4𝛑2Lf2) capcitance in farads
• L = 1/(4𝛑2Cf2) inductance in henrys
• f = 1/(2𝛑√(LC)) frequency in hertz
• Xc = 1/(2𝛑fC) capacitive reactance in ohms
• Xl = 2𝛑fL inductive reactance in ohms
• T = 5040√((18*d +40*l)L)/d calculate coil turns given inductance L (henrys), coil diameter d (mm) and coil length l (mm).
• T ≈ 45000√(L/d) for coils with a 2:3 ratio of diameter d (mm) to length. L is in henrys.

The factor 5040 in front of the standard Wheeler formula corrects for henrys instead of microhenrys (1000) and mm instead of inches (5.04). This factor was wrongly set at 1000 in the initial version of this program.

## BisectionP Solver - Solver for hp programmable calculators - J E Patterson

BisectionP - Documentation

GSB A runs a self contained bisection solver which acts on f(x) = 0 under label E. This program is suitable for some calculators which don't include the hp Solver.

## SecantP - Solver for hp programmable calculators - J E Patterson

SecantP - Documentation

GSB A runs a self contained secant solver which acts on f(x) = 0 under label E. This program is suitable for some calculators which don't include the hp Solver.

hp-15c Program Examples - 14 Programs - Download

## hp-15c Program Examples - Documentation

Polygon inscribed in circle - J E Patterson
N sided polygon with side length L inscribed in circle diameter D.

CurveP - J E Patterson
The program fits data that may be linear at low x,y amplitudes but y falls off at higher x values. This is a common issue in many physical systems. x1, y1 should preferably be on the linear part of the curve. CurveP is not a regression. It assumes that the data is reasonably precise. Linear and power fit data sets also work well.

Dumarey equation. Mercury vapour standard concentration ng/ml - J E Patterson
Enter temperature in °C of mercury calibration vessel, GSB A The mercury vapour concentration in air is displayed in ng/ml

Ebike maximum speed from motor rpm - J E Patterson
Enter motor rpm. Enter wheel size in inches or mm. Press GSB A.

Fibonacci Number - J E Patterson
N GSB A for Nth Fibonacci number.

Function tests - J E Patterson
N STO 2. GSB 7 for N iterations.

Mercury vapour standard concentration ng/ml - J E Patterson
The concentration of mercury vapour in air, above liquid mercury, depends on the temperature. A good calibration curve can be obtained using a simplified Dumarey equation.

Little Gauss formula for the hp-15c - J E Patterson
The sum of integers up to n are calculated.

Parallel Resistances - J E Patterson
First resistance ENTER. Second resistance GSB A. Result = parallel resistance.

RainGaugeCalP - J E patterson
Tipping Bucket Rain Gauge calibration given volume of water in ml, number of tips and diameter of funnel in mm.

hp-15c random number simulator - J E patterson
This program generates the same values as the hp-15c RAN# function. There are not enough digits to do this directly so some programming effort is needed to get the right result. The techniques used here may be of use elsewhere.

Random7 Repeat RAN# n times - J E patterson
This program shows the limitations of a psuedo-random number generator. There are patterns, the most notable being the gradual revealing of the original seed value. The random number sequence repeats after 1E10 numbers have been generated.

StrayLightP - Stray light curve correction - J E patterson
Spectrophotometers have some stray light or detector dark current which causes the calibration to be non linear at high absorbances. This program corrects for the calibration curvature caused by the presence of stray light.

Test many functions - J E patterson
Function test - Simulator final result is 3736036.572. DM15 is 3736036.611

hp-15c Owner's Handbook - 14 Programs - Download

## hp-15c Owner's Handbook - Documentation

Calculate time an object takes to fall to the ground
hp-15c Owner's Handbook - Pages 14-16.

Mother's Kitchen, a canning company
hp-15c Owner's Handbook - Pages 70-74.

Predict the diminishing radioactivity of a radioisotope
hp-15c Owner's Handbook - Pages 93-94.

Slope of a secant line
hp-15c Owner's Handbook - Pages 102-103.

Solve a system of linear equations
hp-15c Owner's Handbook - Pages 138-140 - General version - up to 8 equations each with 8 coefficients and 1 constant.

Solve a system of linear equations
hp-15c Owner's Handbook - Pages 138-140 - Random version - up to 8 equations each with 8 coefficients and 1 constant.

Solving a system of linear equations
hp-15c Owner's Handbook - Pages 138-140 - 2 equation example.

Cabbages and broccoli
hp-15c Owner's Handbook - Pages 157-159. Cabbages and broccoli are sold. Total weekly weight, total weekly value and the price per kg of each are known. The program enters the sales data over 3 weeks and outputs the total weights of each vegetable, for each week, in matrix [D].

Complex Matrix Transformations
hp-15c Owner's Handbook - Pages 163-168.

Electric circuit analysis
hp-15c Owner's Handbook - Pages 169-171.

Matrix function tests
hp-15c Owner's Handbook - Pages 177-179.

Solve Example program for the hp-15c
hp-15c Owner's Handbook - Pages 181-184.

Throwing a ridget
hp-15c Owner's Handbook - Pages 184-186.

Open-top box form problem
hp-15c Owner's Handbook - Pages 189-190. Using a rectangular piece of sheet metal 4 decimeters by 8 decimeters, an open-top box having a volume of 7.5 cubic decimeters is to be formed. How should the metal be folded? (A taller box is preferred to a shorter one.)

## hp-15c Advanced Functions Handbook - Documentation

Arctic explorer Jean-Claude Coulerre in anticipation of the sun's reappearance
See "hp-15c Advanced Functions Handbook" pages 13-16. for the description of this example.

Design of a vertical broadcasting tower
See "hp-15c Advanced Functions Handbook" pages 18 - 21. for the description of this example.

Discounted cash flow analysis
See "hp-15c Advanced Functions Handbook" pages 34-38. This program performs two kinds of discounted cash flow analysis: net present value (NPV) and internal rate of return (IRR). It calculates NPV or IRR for up to 24 groups of cash flows.

Special functions for any argument x
See "hp-15c Advanced Functions Handbook" pages 51-55. The program calculates the values of four special functions for any argument x:

• P(x): Normal distribution function
• Q(x): Complementary normal distribution function
• erf(x): Error function
• erfc(x): Complementary error function

Using Complex Mode
See "hp-15c Advanced Functions Handbook" page 56-58. A program that evaluates the continued-fraction approximation.

Calculating the nth Roots of a Complex Number
See "hp-15c Advanced Functions Handbook" page 67-69.

Solving an Equation for Its Complex Roots
See "hp-15c Advanced Functions Handbook" page 69-72.

hp-15c Matrix test routines - 2 Programs - Download

## hp-15c Matrix test routines - Documentation

Matrix Example test 0 - Function test - J E Patterson
Tests f MATRIX 0 to f MATRIX 9 functions. Scalar operations 2 x, 1 -, 2 + and 10 ÷. Matrix multiplication and division.

Matrix Example test 0b - Function test - J E Patterson
This program uses 1 as a random number seed so the same results are always obtained. Tests f MATRIX 0 to f MATRIX 9 functions. Scalar operations 2 x, 1 -, 2 + and 10 ÷. Matrix multiplication and division. hp-15c Owner's Handbook - Pages 181-184

hp-15c Owner's Handbook Matrix examples - 9 Programs - Download

## hp-15c Owner's Handbook Matrix examples - Documentation

Solving a system of linear equations
Matrix Example 1, HP15c Owner's Handbook - Pages 138-140

Complex matrix in Zc form converted to Zp partitioned form
Matrix Example 2, HP15c Owner's Handbook - Pages 163-168.

Electric circuit calculation
Matrix example 3, HP15c Owner's Handbook - Pages 169-171.

Make an identity matrix
Matrix Example 4, HP15c Advanced Functions Handbook Page 100.

Matrix Example test 5, Function test
Matrix example 5. Tests MATRIX 0 to MATRIX 9 functions. Scalar operations 2x, 1-, 2+ and 5÷. Matrix multiplication and division

Matrix Example test 5b, Function test
Matrix example 5b. I have used random number entry to avoid problems with matrices containing numbers derived from 1, 2, 3, 4 etc which makes the intervals between derived numbers in other Matrices the same. This causes problems with some operations. I saved a copy of [C] in [E] for later use. This avoids problems with the LU form.

Cabbages and broccoli
Matrix example 6 - HP15c Owner's Handbook - pages 157-159 Cabbages and broccoli are sold. Total weekly weight, total weekly value and the price per kg of each are known. The program enters the sales data over 3 weeks and outputs the total weights of each vegetable, for each week, in matrix [D]

Simple matrix divide test
Matrix example 7

Matrix division
Matrix example 8. Matrix division [A]/[A] returns a close approximation to the identity matrix. Email: replace at with @
jepattersonatactrix.co.nz

### Programs

The following material is intended for use with computers rather than phones or tablets. The hp-15c Simulator at this stage only runs on a computer running Windows, Linux or macOS.

Clicking on any of the following links will cause a ZIP file to be downloaded. The extracted folder contains hp-15c program files, as well as documentation.

Use the hp-15c Simulator to open the program file, which can also be transferred to a SwissMicros DM15 calculator.

Composite - 12 programs

Maths1 - 8 Programs

Maths2 - 12 Programs

Physics1 - 8 Programs

Bike1 - 4 Programs

StraylightP - Curve Fitting

CurveP - Curve Fitting

Stat4P.15c - Statistical curve fitting

HgCalP - Calibrate Mercury Analyser

ReactanceP.15c - Reactance calculations

BisectionP - Root finding equation solver

SecantP - Root finding equation solver

BisecnewtP - Root finding equation solver

hp-15c Program Examples - 14 Programs

hp-15c Owner's Handbook - 14 Programs

hp-15c Advanced Functions Handbook - 7 Programs

hp-15c Matrix test routines - 2 Programs

hp-15c Owner's Handbook Matrix examples - 14 Programs