The Museum of HP Calculators

# HP-22S: Some Useful Formulae

This program is supplied without representation or warranty of any kind. The author and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

## Description

The customizing formulae that I developed and regularly use are as follows:

• Vector addition and subtraction. The HP-22S has a built-in rectangular to polar coordinates transform, on blue-SHIFTed keys 1 (X COORD), 2 (Y COORD), 3 (RADIUS), and - (ANGLE). However, using them to convert polar to rectangular, then \Sigma+ to sum the rectangular from two such executions, recover the sums, and finally convert back to polar seemed a lot of typing, and furthermore I ran into something in the straigforward algorithm that ended up requiring some alphabetic memory (precisely what I was trying to avoid). So in desperation, I derived formulae to do this instead, and as I was already used to looking at those keys above, I used memories W through Z, those keys falling on 1 through 3, and the Z on 0.

• The HP-22S's built-in equation LIBRARY contains a wealth of information in very few characters. However, I've been perennially baffled by one particular one (well, one particular one that I'd like to use), that for radioactive decay:

```-K*T=LN(N/I) ---> where K = a constant
T = time
N = current amount / level of radioactivity
I = initial amount / level of radioactivity
```
So the other units merely require consistency, but what about that K? It's obviously a function of time T, but what function, and more specifically, what value would I use for a specific situation, how could I compute K? Asked that way, the answer was just a "turn the crank" away.

• Percent heart rate for exercise used to be derived as that percent of 220 minus your age. But the lower percentages revealed are then quite unrealistic. I heard at an exercise club an obvious way to treat this, with 220 minus my age as my maximum, 100%, and my resting heart rate as 0%. Although there are an infinity of curves that pass through two points even with a monotonic increase constraint, it seemed reasonable to make this a linear relationship. Note that I'm not a medical professional, I merely pass along the concepts, you bear all the responsibility for interpretation and use (YMMV as they say :).

• Body-mass index, or BMI. This purports to be a better measure of a healthy weight than merely noting height and weight on a recommended chart; I've read that a recommended BMI is 25, and anything over 30 is weigh, I mean 'way too much (but the same disclaimer as above goes, I ain't no doctor, etc.). When you use Metric, this is absurdly simple.

• There are several English to Metric conversions that I wished had been included; the formulae for kilometers to miles and to nautical miles, and that for meters to feet, have only modest memory requirements.

## Notes

• The HP-22S's built-in SOLVEr provides non-procedural programming; one merely supplies an expression or an equation (the former contains no equals sign, the latter has one), and then either EVALs it or SOLVEs it. The distinction can best be shown by example:

2+3
EVALs to EXPR=5.0000; SOLVE will yield "NO VARS USED".
A+B
EVALs to EXPR=5.0000; SOLVE will treat as if A+B=0 (see below).
A=B+C
EVAL will request values for the unknowns on the right side of the equation, then solve for A; SOLVE will request which variable to solve for, then the values of the unknowns, and solve the equation.
A+B=C
Both EVAL and SOLVE will exhibit the same behavior, requesting which variable to solve for, then the values of the unknowns, and finally solving the equation.
2*A=B
As with A+B=C; only a naked variable to the left of the equals sign, as is done in many programming languages, will give results as in A=B+C.
0=A+B
As with A+B=C.

• For vector addition, there's no need for a separate vector subtraction. Instead of subtracting one vector from another, you merely complement the one being subtracted, and add that to the first. By complement I mean add or subtract 180_deg., PI/2_radians, or 200_grads, as appropriate, to bring the angle into the "first circle". You can alternately think of this as adding a half-circle of angle then performing a full-circle modulus. To illustrate, here's a vector subtraction transformed to addition where 180_deg. had to be added:

(13 angle 32.6) - (5 angle 100) <=> (13 angle 32.6) + (5 angle 280)

• As regards the requirement that BMI be calculated in Metric, if you don't have a science background (remember the MKS system?) or have spent time in a foreign country, you may not be familiar with meters or kilograms. However, of these two conversions, kilograms to pounds is available directly on the keyboard, SHIFT 4 SQRT(X) (units conversion, mass) will take you right there. And meters to feet, that's one of the conversion formulae I added in this webpage. Note that as your weight is more likely to change than your height :), you can use the conversion formula for height to meters, save that in M, then as needed compute kilograms right off the keyboard for K.

## Example

• Three right-triangle examples from the realm of decimal degrees:

• (4 angle 0) + (3 angle 90)
W=4, X=0, Y=3, Z=90
(5.0000 angle 36.8699)

• (12 angle 10) + (5 angle 100)
W=12, X=10, Y=5, Z=100

(13.0000 angle 32.6199)
• and a subtraction of the above (note angle rounded to one digit for a variation of parameters, so that the answer isn't just the inverse of the above addition, but instead reflects that something's really happening):

• (13 angle 32.6) - (5 angle 100) <=> (13 angle 32.6) + (5 angle 280)
W=13, X=32.6, Y=5, Z=280
(12.0017 angle 9.9801)
(would have been (12.0000 angle 10.0000) if we had used the angle computed above rather than the rounded one)

• Sodium 22 has a half-life of 2.605_yrs; how long will a sample take to decay to 25% of its current radioactivity? Use my equation, with T=2.605 yielding K=0.2661, then without rounding K switch to the LIBRARY equation, and solve for T given I=1 & N=0.25. The result will be T=5.2100 (two half-lives, 50% of 50%, no Rocket Science here).

• I'm 54, measured a resting 88 BPM before exercise, want to aim for 80%, and stop for only 10 seconds; how many beats should I count? Solve for H, and see 25.0667 (roughly 150 BPM illustrated here).

• I'm lately 1.7 meters, 87.7 kilograms, and compute my BMI as 30.3460 (so why do you think I'm going to exercise clubs, ehh? :).

• Ten "klicks" (kilometers) are 6.2137 miles and 5,3996 nautical miles, while 1.7 meters is 5.5774 feet (better known as 5'7", as in my BMI example above).

## Program Listing

• Vector addition (& subtraction by angle complement):
```r(x(W:X)+x(Y:Z):y(W:X)+y(Y:Z))      where W is 1st vector's radius
\Theta(x(W:X)+x(Y:Z):y(W:X)+y(Y:Z))       X is 1st vector's angle
Z is 2nd vector's angle
```
• Complementary equation to the HP-22S's LIBRARY equation for radioactive decay, -K*T=LN(N/I):
```K*T=LN(2)
```
• Percent of maximum heart rate as a linear function of heart rate where 0% is your resting heart rate, 100% is 220 minus your age:
```((220-A-R)*C/100+R)*S/60=H where A is your age
R is your resting heart rate
C is percent of maximum heart rate
S is the number of seconds that you
count beats, and
H is the number of beats counted
```
• Body-mass index, or BMI, computed from Metric height and weight:
```B*M^2=K where B is your resultant BMI
M is your height in meters
K is your weight in kilograms
```
• Three English - Metric conversions unfortunately not built-in:
```1.609344*M=K where M is miles, K is kilometers,
1.852*N=K    and N is nautical miles

.3048*F=M where F is feet, M is meters (no leading zero saves one byte)
```

## Resources Used

• Vector addition (& subtraction by angle complement):

• Registers W, X, Y, and Z.

• Angle mode (affects calculations).

• Complementary equation to the HP-22S's LIBRARY equation for radioactive decay, -K*T=LN(N/I):

• No additional resources beyond registers already required for the LIBRARY equation.

• Percent of maximum heart rate as a linear function of heart rate where 0% is your resting heart rate, 100% is 220 minus your age:

• Registers A, C, H, R, and S.

• Body-mass index, or BMI, computed from Metric height and weight:

• Registers B, K, M.

• Three English - Metric conversions unfortunately not built-in:

• Registers F, K, M, and N.