You are on page 1of 29

2DVEC+ hp32sII A small program to add two planar vectors given their magnitudes and polar angles (from

some line). The answer gives the magnitude and angle of the sum. Input in the stack T: angle of first vector Z: magnitude of first vector Y: angle of second vector X: magnitude of second vector Output in the stack Y: angle of sum X: magnitude of sum This program does not use any variables. It only manipulates the stack. Memory requirements: Total: 12 bytes. Program: 12 bytes. Variables: 0. Left free: 372 bytes. No Flags used. CHKSUM=7A0B 012.0 -----------------A01 LBL A A02 theta,r->y,x A03 Rdown A04 Rdown A05 theta,r->y,x A06 CMPLX+ A07 y,x->theta,r A08 RTN ******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* LINEAR3 hp32sII A program to solve a linear system of 3 equations with 3 unknowns. System: Ax+By+Cz = E Gx+Hy+Iz = K Mx+Ny+Oz = P (A NOT ZERO)

The program stores all coefficients in the memory of the same letter variable. The input is by row including the independent terms: A,B,C,E, G,H,I,K, M,N,O,P. The results for x,y,z are shown in the corresponding stack registers (use roll to see them). WARNINGS: The program clears ALL variables (not sums) before starting. To save memory the program is very primitive; it does not do pivoting, and it may fail in some few instances even for non singular matrices (change the order of the rows if this happens or if A is zero). You can also use this program to solve systems with only 2 unknowns. For example, to solve a 2x2 system (x,y unknowns) enter the

equivalent 3x3 system: Ax+By+0z = E Gx+Hy+0z = K 0x+0y+1z = 0 (A NOT ZERO)

Memory requirements: Total:193.5 bytes. Program:97.5 bytes. Variables:96 bytes (8x12). Left free: 43.5 bytes. No Flags used. C CHKSUM=F0b4 097.5 x--------------x--------------x--------------x--------------x----------C01 LBL C C11 INPUT M C21 STOx P C31 RCL B C41 STOx O C02 CLVARS C12 INPUT N C22 RCL B C32 RCLx M C42 STOx P C03 INPUT A C13 INPUT O C23 RCLx G C33 STO- N C43 RCL I C04 INPUT B C14 INPUT P C24 STO- H C34 RCL C C44 RCLx N C05 INPUT C C15 RCL A C25 RCL C C35 RCLx M C45 STO- O C06 INPUT E C16 STOx H C26 RCLx G C36 STO- O C46 RCL K C07 INPUT G C17 STOx I C27 STO- I C37 RCL E C47 RCLx N C08 INPUT H C18 STOx K C28 RCL E C38 RCLx M C48 STO- P C09 INPUT I C19 STOx N C29 RCLx G C39 STO- P C49 RCL O C10 INPUT K C20 STOx O C30 STO- K C40 RCL H C50 STO/ P C51 C52 C53 C54 C55 C56 C57 C58 C59 C60 RCL P STOx I STOx C RCL K RCL- I RCL/ H STO K RCLx B RCL+ C STO- E C61 C62 C63 C64 C65 RCL P RCL K RCL E RCL/ A RTN

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* LINEAR4 hp32sII A program to solve a linear system of 4 equations with 4 unknowns. System: Ax+By+Cz+Dw Fx+Gy+Hz+Iw Kx+Ly+Mz+Nw Px+Qy+Rz+Sw = = = = E J O T (A NOT ZERO)

The program stores all coefficients in the memory of the same letter variable. The input is by row including the independent terms: A,B,C,D,E, F,G,H,.... There is a small pause before input the last row (P,Q,R,S,T) due to the need to do some calculations to empty four variables (i,G,M,N) because of the memory limitations of the hp32sII. The results for x,y,z,w are shown in the corresponding stack registers (use roll to see them). WARNINGS: The program clears ALL variables (not sums) before starting.

To save memory, the program is very primitive; it does not do pivoting, and it may fail in some few instances even for non singular matrices (change the order of the rows if this happens or if A is zero). You can also use this program to solve systems with only 3 or 2 unknowns. For example, to solve a 2x2 system (x,y unknowns) enter the equivalent 4x4 system: Ax+By+0z+0w Fx+Gy+0z+0w 0x+0y+1z+0w 0x+0y+0z+1w = = = = E J 0 0 (A NOT ZERO)

Memory requirements: Total:340.5 bytes. Program:204.5 bytes. Variables:136 bytes (8x17). Left free: 43.5 bytes. No Flags used. B CHKSUM=56F9 23.0 L CHKSUM=8112 181.5 x--------------x--------------x--------------x--------------x----------B01 LBL B L01 LBL L L11 RCL C L21 RCLx K L31 STO- O B02 CLVARS L02 INPUT(i) L12 RCLx F L22 STO- L L32 RCL G B03 7.015 L03 RCL A L13 STO- H L23 RCL C L33 STOx M B04 STO i L04 STOx (i) L14 RCL D L24 RCLx K L34 STOx N B05 INPUT A L05 ISG i L15 RCLx F L25 STO- M L35 STOx O B06 INPUT B L06 GTO L L16 STO- I L26 RCL D L36 RCL H B07 INPUT C L07 STO/ K L17 RCL E L27 RCLx K L37 RCLx L B08 INPUT D L08 RCL B L18 RCLx F L28 STO- N L38 STO- M B09 INPUT E L09 RCLx F L19 STO- J L29 RCL E L39 RCL I B10 INPUT F L10 STO- G L20 RCL B L30 RCLx K L40 RCLx L L41 L42 L43 L44 L45 L46 L47 L48 L49 L50 STO- N RCL J RCLx L STO- O 0 STO i STO F STO K STO L INPUT P L51 L52 L53 L54 L55 L56 L57 L58 L59 L60 L101 L102 L103 L104 L105 L106 L107 L108 L109 L110 INPUT Q INPUT R INPUT S INPUT T RCL A STOx P STOx Q STOx R STOx S STOx T RCL O RCL- N RCL/ M STO O STOx H STOx C RCL J RCL- I RCL- H RCL/ G L61 L62 L63 L64 L65 L66 L67 L68 L69 L70 L111 L112 L113 L114 L115 L116 L117 L118 L119 L120 RCL B RCLx P STO- Q RCL C RCLx P STO- R RCL D RCLx P STO- S RCL E STO J RCLx B RCL+ D RCL+ C STO- E RCL T RCL O RCL J RCL E RCL/ A L71 L72 L73 L74 L75 L76 L77 L78 L79 L80 RCLx P STO- T RCL G STOx R STOx S STOx T RCL H RCLx Q STO- R RCL I L81 L82 L83 L84 L85 L86 L87 L88 L89 L90 RCLx Q STO- S RCL J RCLx Q STO- T RCL M STOx S STOx T RCL N RCLx R

L91 STO- S L92 RCL O L93 RCLx R L94 STO- T L95 RCL S L96 STO/ T L97 RCL T L98 STOx N L99 STOx I L100 STOx D

L121 RTN

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* Distance and Direction for the HP-32SII

Written by Dave Coffin around 1992. Overview This program calculates the distance and initial heading of the shortest path be tween two points on the Earth's surface. Usage A Moslem must always face toward Mecca during prayer. Which way should a Moslem in Boston face? XEQ D N? 42.3566 E? -71.0569 N? 21.426 E? 39.838 5397.33132593 x<>y 60.420494571 Downtown Boston Always negative in USA!! Mecca, Saudi Arabia Distance in nautical miles Compass heading (30 degrees north of east)

This is counter-intuitive because, on a flat map of the world, Mecca appears far to the east and a little south of Boston. But if you find these two cities on a globe and connect them with a tight string, you can see that the shortest path goes north before it goes south. Program Distance output is in nautical miles. Change line D30 to 111.12 for kilometers, or 69.046767 for statute miles. D01 D02 D03 D04 D05 D06 D07 D08 D09 D10 D11 D12 D13 D14 D15 D16 D17 D18 D19 D20 D21 D22 D23 D24 D25 D26 D27 D28 D29 D30 D31 D32 LBL D DEG INPUT N STO X INPUT E INPUT N 1 ?,r?y,x INPUT E R? x<>y ?,r?y,x R? x<>y y,x??,r x<>y RCL- X x<>y ?,r?y,x 180 R? R? +/y,x??,r R? x<>y ACOS 60 RTN

HP-32SII: checksum = AAAA, length = 48.0

HP-33S:

checksum = EE88, length = 132

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* Composite Body: Neutral Axis and Moment of Inertia for the HP-32SII This program is by Eric Lundgren and is used here by permission. This program is supplied without representation or warranty of any kind. Eric Lu ndgren and The Museum of HP Calculators therefore assume no responsibility and s hall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof. Overview For a buildup of n rectangular sections (ibeam, c-channel, sandwich, etc.), this program computes the location of neutral axis (measured from bottom of section) , and the moment of inertia. NOTE: One can model two plates with open space between by assigning B=0, H=dista nce between for the section between the plates. The program was written for the new hp33s, but has been tested on the 32sii and works. Should also work for most HPs supporting keystroke rpn programming, like the hp42s. Hope it is of some use! Listing LBL I 123456789 RCL Z X != Y ? CLVARS 123456789 RCL Z X != Y ? INPUT N 123456789 STO Z INPUT B INPUT H RCL H 2 / RCL +T RCL B RCL * H * RCL +Q STO Q RCL B RCL H * RCL +R STO R 1 RCL +V STO V

RCL Q RCL / R RCL - C X^2 RCL *A RCL + I STO I RCL T RCL H 2 / + RCL Q RCL / R X^2 RCL *B RCL *H RCL H 3 Y^X RCL *B 12 / + RCL + I STO I RCL Q RCL / R STO C RCL B RCL * H RCL + A STO A RCL T RCL +H STO T RCL V RCL N X>Y? GTO I RCL C **location of neutral axis** RCL I **value of composite Ix ** CLVARS RTN ChecksumsHP32sii: CK=576B 138.0 HP33s: CK=C3CC LN=321 ******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* Date calculations and TVM calculations for the HP-32Sii This program is by Andy Schick and is used here by permission. This program is supplied without representation or warranty of any kind. Andy Sc

hick and The Museum of HP Calculators therefore assume no responsibility and sha ll have no liability, consequential or otherwise, of any kind arising from the u se of this program material or any part thereof. Overview Here is a program designed specifically for the hp-32sii calculator. This progra m converts a Date to/from a Julian Day Number, calculates days between two dates , determines the day of the week, gives you the MOD function, and determines you r Physical-Intellectual-Emotional Biorhythm. Also included here is a second reduced size version of the program so date calcu lations can still be performed and leave room in the calculator s 384 bytes of mem ory to also be able to run the Time Value of Money (TVM) equation for the HP Sol ver. With the reduced code, you loose the ability to convert a Julian Day Number back to a Date, but you can still calculate the days between two dates, determi ne the day of week, have the MOD function, and still calculate your Intellectual Biorhythm. The date calculations use the formulas published by HP for the hp-67 in 1976. Th e program is original code written by Andy Schick. The TVM equation is below and can be entered as an equation to be solved with th e HP Solver. No further TVM or HP Solver instructions are provided here. P*100*(1-(1+I/100)^-N)/I+F*(1+I/100)^-N+B To save memory, this date program uses the same variables as in the TVM equation . The specific functions are as follows: XEQ C Just a function to initialize Julian numbers. XEQ N Convert a Date in the format of mm.ddyyyy to a Julian Day Number. XEQ A, E, F, G, H, I Just secondary labels with no useful purpose to the user. XEQ D Convert a Julian Day number to a Date in the format mm.ddyyyy. XEQ M Modulo (MOD) function. XEQ W Calculate the Day of Week from Julian Day Number. (S=0, M=1, T=2, W=3, Th= 4, F=5, Sa=6). XEQ B From days old, determine Physical, Intellectual, and Emotional Biorhythm n umbers. Example Usage: Example 1. Using the Modulo (MOD) function. 14 MOD 5 = 4. 14 ENTER 5 XEQ M

X stack register now displays the answer 4.

Example 2. Calculating the number of days old a person is. If today is Dec 27 20 06, and a person was born on Feb 13 1962. 12.272006 XEQ N 2.131962 XEQ N in days. X stack register now displays 2,454,097. X stack register now displays 2,437,709. X stack register now displays 16388, the age of the person

Example 3. Calculation of Biorhythm numbers.

With 16388 still in the X stack register: XEQ B Now displayed is P= -14. This is the persons Physical Biorhythm number. The range is from a low of 100 to a high of +100. R/S Now displayed is I= -62. This is the persons Intellectual Biorh ythm number. R/S Now displayed is E= 97. This is the persons Emotional Biorhythm number. R/S The display returns to FIX 4 mode. Example 4. To calculate what date is 1000 days after May 24 1985. 5.241985 XEQ N 1000 + XEQ D X stack register now displays 2,446,210. X stack register now displays the calculated date 2.181988.

Example 5. What day of week was Dec 31 1999? 12.311999 XEQ N XEQ W

X stack register now displays 5. (S=0, M=1, T=2, W=3, Th=4, F=5, Sa=6). It was a Friday.

To have full Date to/from Julian Day Number calculation capability and no TVM ca pability enter the code listed below. Program checksum and size info. Total program size is 288.0 Bytes. C N A F D E G H M W I B CK= CK= CK= CK= CK= CK= CK= CK= CK= CK= CK= CK= 1955 F723 8660 7AB9 CBD8 21EF 3F39 C554 2330 F42C 5B29 9DA6 36.0 43.5 4.5 27.0 63.0 4.5 10.5 19.5 19.5 9.0 24.0 27.0

Program variables: B, D, E, F, I, N, P. Listing LBL C 365.25 STO B 30.6001 STO D 1,720,982 STO E RTN

LBL N X<>Y STO N ROLLD ENTER IP STO I ROLLD FP 100 * ENTER IP STO F ROLLD FP 4 1O^X * STO P RCL I 2 X<Y? GTO A 13 STO+ I 1 STO- P GTO F LBL A 1 STO+ I LBL F XEQ C RCL P RCL B * IP RCL I RCL D * IP + RCL F + RCL E + RCL N X<>Y RTN LBL D RCL E STO F 122 10 1/X RCL B

/ IP STO P RCL B * IP +/RCL F + RCL D / IP STO I RCL D * IP RCL P RCL B * IP + +/RCL F + STO F 14 RCL I X<Y? GTO E 13 STO- I GTO G LBL E 1 STO- I LBL G RCL I 2 X<Y? GTO H 1 STO+ P LBL H RCL P 6 10^X / RCL F 100 / + RCL I + FIX 6 RTN LBL M STO I X<>Y STO P X<>Y

/ IP RCL I * RCL P X<>Y RTN LBL W 1 + 7 XEQ M RTN LBL I STO I RCL B X<>Y XEQ M RCL I / 180 * 2 * SIN 100 * RND RTN LBL B DEG FIX 0 STO B 23 XEQ I STO P VIEW P 33 XEQ I STO I VIEW I 28 XEQ I STO E VIEW E FIX 4 RTN # # # # # # # # # # # # # # # # # # To have date calculation capability, without Julian Day Number to Date capabilit y, and still have memory space to run the TVM equation, enter only the code list ed below. Program N A F checksum and size info. Total program size is 147.0 Bytes. CK= F723 43.5 CK= 8660 4.5 CK= CB54 49.5

M W I

CK= 2330 CK= F42C CK= 8F99

19.5 9.0 21.0

Program variables: F, I, N, P. With this reduced version there is no longer functions D or B, but there is new function I. XEQ I From days old, determine Intellectual Biorhythm number. LBL N X<>Y STO N ROLLD ENTER IP STO I ROLLD FP 100 * ENTER IP STO F ROLLD FP 4 1O^X * STO P RCL I 2 X<Y? GTO A 13 STO+ I 1 STO- P GTO F LBL A 1 STO+ I LBL F RCL P 365.25 * IP RCL I 30.6001 * IP + RCL F + 1,720,982 + RCL N X<>Y RTN LBL M

STO I X<>Y STO P X<>Y / IP RCL I * RCL P X<>Y RTN LBL W 1 + 7 XEQ M RTN LBL I DEG 33 XEQ M 33 / 180 * 2 * SIN 100 * RTN

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* Motion Program for the 33S This program is by Ed Mooney and is used here by permission. This program is supplied without representation or warranty of any kind. Ed Moon ey 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. Overview Motion Program (with constant acceleration): Five variables: Enter any three var iables, finds remaining two variables . Note that usually either the initial or final velocity is known to be equal to "0 . Variables: This program works for both linear and rotational systems. X: Distance (rotational: Angular Position), (flag 0) I: Initial velocity (rotational: Initial Angular Velocity), (flag 1) F: Final velocity (rotational: Final Angular Velocity), (flag 2) A: Acceleration (rotational: Angular Acceleration), (flag 3) T: Time (rotational: Time), (flag 4)

To use: XEQ V Unknowns are entered as "0". If a variable is known to be equal to "0", Press &# 8595; (rolldown) and Enter 1E-99 (1E-99 virtually equals 0). Listing V01 V02 V03 V04 V05 V06 V07 V08 V09 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 V34 V35 V36 V37 V38 V39 V40 V41 V42 V43 V44 V45 V46 V47 V48 V49 V50 E01 E02 E03 LBL V CF 0 CF 1 CF 2 CF 3 CF 4 1E-99 Input X X=0? SF 0 1E-99 Input I X=0? SF 1 1E-99 Input F X=0? SF 2 1E-99 Input A X=0? SF 3 1E-99 Input T X=0? SF 4 FS?0 GTO E FS?1 GTO F FS?2 GTO I RCL X 2 X RCL I RCL F + STO T VIEW T RCL F RCL I RCL T STO A VIEW A GTO V RTN LBL E FN=J FS?1

X unknown

I unknown

F unknown

A unknown

T unknown X unknown I unknown, X known F unknown, X and I known T and A unknown, X, I and F known

LN= 222, CK= 52DE X unknown

E04 E05 E06 E07 E08 E09 E10 E11 E12 E13 E14 E15 E16 E17 E18 E19 E20 E21 E22 E23 E24 E25 E26 E27 E28 E29 J01 J02 J03 J04 J05 J06 J07 J08 J09 F01 F02 F03 F04 F05 F06 F07 F08 F09 F10 F11 F12 F13 F14 F15 F16 F17 F18 F19 F20 F21 F22 F23 K01 K02

SOLVE I FS?2 SOLVE F FS?3 SOLVE A FS?4 SOLVE T RCL I RCL F + RCL T X 2 STO X VIEW X FS?1 VIEW I FS?2 VIEW F FS?3 VIEW A FS?4 VIEW T GTO V RTN LBL J RCL F RCL I RCL T RCL A RTN LBL F FN=K FS?2 SOLVE F FS?3 SOLVE A FS?4 SOLVE T RCL F RCL A RCL T X STO I VIEW I FS?2 VIEW F FS?3 VIEW A FS?4 VIEW T GTO V RTN LBL K RCL F

Solve for X

Display results

LN= 99, CK= 8A1C 4 vars: I, F, A, and T

LN= 27, CK= F918 I unknown, X known

Solve for I

Display results

LN= 69, CK= 4E01 4 vars: X, F, A, and T

K03 K04 K05 K06 K07 K08 K09 K10 K11 K12 K13 K14 K15 I01 I02 I03 I04 I05 I06 I07 I08 I09 I10 I11 I12 I13 I14 I15 I16 I17 I18 I19 H01 H02 H03 H04 H05 H06 H07 H08 H09 H10 H11 H12 H13 H14

2 X RCL A RCL T X RCL T X 2 RCL X RTN LBL I FN=H FS?3 SOLVE A FS?4 SOLVE T RCL I RCL A RCL T X + STO F VIEW F FS?3 VIEW A FS?4 VIEW T GTO V RTN LBL H RCL I RCL T X RCL T X^2 RCL A X 2 + RCL X RTN

LN= 69, CK= 3F54 F unknown, X and I known

Solve for F

Display results

LN= 57, CK= 92A8 4 vars: X, I, A, and T

LN= 54, CK= BC2C

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* VECTORX hp32sII A small program to find the vector product of two vectors in cartesian coordenat es. V1 = (A,B,C) V2 = (X,Y,Z) V1xV2 = (x,y,z) [stack]

Input is in variables ABC, XYZ. Answer is in the stack (x,y,z) Memory requirements: Total: 82.5 bytes. Program: 34.5 bytes. Variables: 48=6x8. Left free: 301.5 bytes. No Flags used. CHKSUM=D190 034.5 -----------------X01 LBL X X02 INPUT A X03 INPUT B X04 INPUT C X05 INPUT X X06 INPUT Y X07 INPUT Z X08 RCL Y X09 RCLx A X10 RCL X X11 RCLx B X12 z component X13 RCL X X14 RCLx C X15 RCL A X16 RCLx Z X17 y component X18 RCL Z X19 RCLx B X20 RCL Y X21 RCLx C X22 x component X23 RTN ******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* *******************************************************************

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* Feet-Inches-Fractions Calculator for the HP-41CX This program is 1984 by Fred E. Lusk III, PE and is used here by permission. Introduction FEET performs feet-inches-fractions (F-I-F) calculations using a two-register RP N stack ("XX" and "YY"). The program handles addition and subtraction of two F-I -F numbers (as long as the result isn't negative), multiplication and division o f an F-I-F number by a non-negative constant, and F-I-F to decimal and decimal t o F-I-F conversions. The program also provides one data storage register ("RR"). One interesting feature of the program is that the user is not limited to 16ths of an inch, though that is the default, or even the binary fractions 1/2, 1/4, 1 /8, etc. FEET can work with ANY fraction, including 1/10, 1/31, 1/88, etc. The p rogram handles incompatible fractions by rounding values off to the nearest mult iple of the selected fraction. For example, if FEET is set for 8ths of an inch, an entry of 17/23" will be rounded to 6/8", then reduced to 3/4" and displayed.

In addition, an entry such as 1'15-25/8" will be corrected to 2'6-1/8". The prog ram also provides a feet-inches (F-I) only mode that eliminates the need to ente r fractions. F-I mode is set by entering an initial fraction value of 0 or 1. As written, FEET requires an HP-41CX with at least 438 bytes of available progra m space plus 15 data registers. The program uses several extended functions, inc luding X<>F, XTOA, and REGMOVE, though there are workarounds. The heart of the p rogram (the part that reduces the fractions) is based on the fraction reduction routine in the PPC ROM. However, a PPC ROM is not required. As well as this program works and as "cool" as I think it is, I am planning a ma jor rewrite. FEET currently stores separate numbers for the feet, inches, numera tor, and denominator that comprise each dimension value. The next version will s tore just one number for each dimension (e.g. 1'2-3/4" would be stored as 236 if the fraction is set to 16ths or 59 if the fraction is set to 4ths). The origina l programming decision was based on the false notion that big numbers with small fractions would lead to inaccuracies if the entire dimension was reduced to a s ingle number. The reality is that 10000'1-1/16" (an absurdity) would reduce to 1 ,920,017 16ths, which is well within the non-scientific-notation dynamic range o f the HP-41CX. This change will simplify data handling and eliminate the need fo r the REMOVE command. I may even expand the FEET stack to three or four register s, permit the use of negative numbers, and clean up the program structure. This will also accomplish what I was trying to do in creating an HP-42S version, but never got around to finishing. Function Keys RESET [a] + [A] STO [b] [B] RCL [c] * [C] D>F [d] / [D] F>D [e] ENTER [E]

RESET Restart the program. This is a quick alternative to XEQ "FEET", and is useful for changing the fraction setting, although the contents of XX and YY are cleared. STO Copy the contents of XX to RR. XX and YY are left undisturbed. F lag 0 is set as a reminder that RR is in use. RCL Recall the contents of RR to XX. The previous contents of XX are moved to YY. The original contents of YY are lost. D>F Convert the decimal value in X (in the regular RPN stack) to F-I -F or F-I and place in XX. The previous contents of XX are moved to YY. The orig inal contents of YY are lost. F>D Convert the F-I-F or F-I contents of XX to decimal feet. The FEE T stack is left undisturbed. + Add the contents of XX and YY. The result is placed in XX. Becau se YY is the top of the two-register FEET stack, YY remains intact. Subtract XX from YY (YY must be greater than XX). The result is placed in XX. Because YY is the top of the two-register FEET stack, YY remains i ntact. * Multiply the contents of XX by the constant in X. The result is placed in XX. YY is undisturbed. / Divide the contents of XX by the constant in X. The result is pl aced in XX. YY is undisturbed. ENTER ENTER: Process the contents of the four-register RPN stack and p lace in XX and YY RPN stack for F-I-F mode X: Denominator Y: Numerator Z: Inches T: Feet RPN Stack for F-I mode

X: Inches Y: Feet General Instructions To run program: XEQ [ALPHA] FEET [ALPHA] Enter the desired fraction at the FRACTION ? prompt and hit [R/S]. If calcul ations will be performed using 16ths, the user may skip entering 16 and just hit [R/S] because the default value of 16 is already in X. The program can use any value for the fraction. Use 0 or 1 to set F-I mode, which does not use fractions at all. Data Entry For F-I-F mode: Feet [ENTER^] Inches [ENTER^] Numerator [ENTER^] Denominator [E] For F-I mode: Feet [ENTER^] Inches [E] See the following examples for additional instructions. Examples 1. a) Find the missing dimension to the nearest 1/16". b) Multiply the result by 2/3 (just for kicks). c) Convert to decimal feet and back again. (drawing not to scale) <- 2'3-5/8" -> <- 2'3-5/8" -> <-- 7/16" --> <- 30" -> <- 1' -> <----- ??? -----> <- 2'0-32/100" -> <- 15-1/2" -> <- 39/16" -> KEYBOARD DISPLAY Notes -------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ? [R/S] FT^, IN^, N^, D {1.1} 2 [ENTER^] 3 [ENTER^] 5 [ENTER^] 8 [E] 2'3-5/8" [A] 4'7-1/4" {1.2} 7 [ENTER^] 16 [A] 0'0-7/16" {1.3} 4'7-11/16" 30 [ENTER^] 0 [ENTER^] 1 [A] 2'6" {1.4} 7'1-11/16" 1 [ENTER^] 0 [ENTER^] 0 [ENTER^] 1 [A] 1'0" 8'1-11/16" 39 [ENTER^] 16 [B] 0'2-7/16" 7'11-1/4" 15 [ENTER^] 1 [ENTER^] 2 [B] 1'3-1/2" 6'7-3/4" 2 [ENTER^]

0 [ENTER^] 32 [ENTER^] 100 [B] 2 [ENTER^] 3 / [C] [e] [d] Notes {1.1} {1.2} {1.3} {1.4} {1.5} {1.6} {1.7} The Or: The For The The The

2'0-5/16" 4'7-7/16" 3'0-15/16" 3.0781' 3'0-15/16"

{1.5} {1.6} {1.7} "

default value is 16, so no entry is needed this time. 2 [C] new number is displayed while the result is calculated (typ). a dimension without any fraction, any denominator will do. result for a). result for b). results for c).

2.

A circle has a diameter of 1'6". Find the circumference and the quarter circle length to the nearest 1/8" and to the nearest 1/100". KEYBOARD DISPLAY Notes -------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ? 8 [R/S] FT^, IN^, N^, D 1 [ENTER^] 6 [ENTER^] 0 [ENTER^] 1 [E] 1'6" [b] {2.1} [pi] [C] 4'8-1/2" 4 [D] 1'2-1/8" {2.2} [a] FRACTION ? 100 [R/S] FT^, IN^, N^, D [c] 1'6" {2.3} [pi] [C] 4'8-11/20" 4 [D] 1'2-7/50" {2.4}

Notes {2.1} {2.2} {2.3} {2.4}

The display shows F00 as set, indicating use of RR. The first result. Even though [a] clears F00, RR remains intact. The second result.

3.

A 24'0" long Archimedes screw pump is to be installed at an angle of 38. What are the horizontal and vertical distances between the supports, first to the nearest inch, then to the nearest 1/4"? This is based on the real-life example that prompted me to write FEET: the headworks pumps at the Arvin, CA, wastewater treatment plant. KEYBOARD DISPLAY Notes -------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ? 0 [R/S] FT^, IN {3.1} 24 [ENTER^] 0 [E] 24'0" [b] 38 [COS] [C] 18'11" {3.2}

[c] 38 [SIN] [C] [a] 4 [R/S] [c] 38 [COS] [C] [c] 38 [SIN] [C]

24'0" 14'9" FRACTION ? FT^, IN^, N^, D 24'0" 18'11" 24'0" 14'9-1/4"

{3.2}

{3.3} {3.3}

Notes {3.1} Or: 1 [R/S]. The display shows F01 as set, indicating F-I mode. (3.2} The first two results. {3.3} The second two results. Program Listing The annotations included with the program listing are intended to explain genera lly how FEET works, and are by no means exhaustive. LINE 01 * 02 * 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 * 37 38 39 40 41 KEYS LBL "FEET" LBL a 0 STO 01 STO 02 STO 03 STO 04 STO 05 STO 06 STO 07 STO 08 X<>F 1.005004 STO 09 16 "FRACTION ?" PROMPT ABS INT X=0? SIGN STO 00 1 X=Y? SF 01 FIX 0 CLST CF 22 SF 27 CF 29 "FT^, IN" FC? 01 "^, N^, D" AVIEW RTN LBL b 1.011004 REGMOVE SF 00 CLST CF 22 ; ### FEET ### ; ### RESET ### ; [03-11] Clear XX (R01-R04) and YY (R05-R08)

; Clear flags 0-7 ; REGMOVE constant for XX and YY ; Default "Fraction" (FF) ; [16-17] Prompt for FF ; [18-19] Ensure FF is non-negative integer ; [20-21] Convert FF=0 to FF=1 ; Store FF ; [23-25] If FF=1 (or previously 0) program sets ; F-I mode ; [26-30] Initialize remaining program settings

; [31-35] Display data entry prompt for F-I and ; F-I-F calculations

; ### STO ### ------------------------------------; [37-38] Copy contents of XX into RR ; Indicate storage register is in use ; Clear data entry flag

42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101

* *

AVIEW RTN LBL c RCL 09 REGMOVE 11.001004 REGMOVE GTO 99 LBL d RCL 09 REGMOVE X<>Y INT STO 01 LASTX FRC 12 * FS? 01 GTO 15 INT STO 02 LASTX FRC RCL 00 * RND STO 03 GTO 98 LBL e XEQ 02 RCL 01 RCL 02 FS? 01 GTO 10 RCL 03 RCL 04 / + LBL 10 12 / + FIX 4 CLA ARCL X 39 XTOA X<>Y FIX 0 AVIEW RTN LBL A SF 06 LBL B XEQ 02 FS?C 06 GTO 01 -1 ST* 01

; Redisplay XX ; ### RCL ### ------------------------------------; [45-46] Copy contents of XX to YY ; [47-48] Copy contents of RR to XX ; Go to routine to display XX ; ### D>F ### ------------------------------------; [51-52] Copy contents of XX to YY ; Bring input decimal value back to X ; [54-69] Parse decimal value into F-I-F and store ; components

; [60-61] Jump out if only working with F-I

; ; ; ;

Go to routine to display XX ### F>D ### -------------------------------------Data handling [73-78] Fill RPN stack with XX components

; [75-76] Skip [77-80] if in F-I mode

; [79-84] Convert F-I-F or F-I to decimal feet

; [85-92] Display result

; ; ; ; ; ;

Result kept in X so [d] will "reverse" process ### + ### --------------------------------------Set addition flag ### - ### XEQ routine to convert RPN stack to F-I-F or F-I [98-103] Subtraction = adding -XX to YY

102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161

ST* 02 ST* 03 LBL 01 RCL 05 ST+ 01 RCL 06 ST+ 02 FS? 01 GTO 98 RCL 03 RCL 04 / RCL 07 RCL 08 / + RCL 00 * RND STO 03 GTO 98 LBL 02 FS? 22 XEQ 21 FS?C 22 XEQ 97 RTN LBL C ST* 01 ST* 02 ST* 03 GTO 03 LBL D ST/ 01 ST/ 02 ST/ 03 LBL 03 RCL 01 INT STO 01 LAST X FRC 12 * ST+ 02 RCL 02 FS? 01 GTO 15 INT STO 02 LASTX FRC RCL 03 RCL 04 / + RCL 00 * RND STO 03

; [105-121] XX + YY

; ------------------------------------------------; [124-125] If data entered into RPN stack, XEQ 21 ; to raise FEET stack ; [126-127] if data entered into RPN stack, XEQ 97 ; to process data in RPN stack ; ### * ### ---------------------------------------

; ### / ### ---------------------------------------

; [139-166] Reduce XX to proper components

162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221

GTO 98 * LBL 15 RND STO 02 GTO 98 * LBL E SF 05 * LBL 97 FS? 01 GTO 07 / RCL 00 * RND STO 03 RDN * LBL 07 STO 02 RDN STO 01 * LBL 98 RCL 03 X<0? DSE 02 . -12 RCL 02 X=Y? GTO 03 X<0? DSE 01 . * LBL 03 RCL 03 RCL 00 RCL 03 RCL 00 XEQ 08 ST/ Z / STO 04 X<>Y STO 03 X<>Y / INT ST+ 02 RCL 03 RCL 04 MOD STO 03 RCL 02 12 / INT ST+ 01 RCL 02 12 MOD STO 02

; ; ; ;

### ENTER ### ----------------------------------Set FEET data entry flag Jump-in point for other subroutines [170-171] If in F-I mode, skip fraction

; [172-175] Convert fraction to multiple of FF

; Store fractional part of XX ; Store inches part of XX ; Store feet part of XX ; [183-...] Normalize XX, incl. reducing fraction ; The fasted NOP available

; XEQ fraction reduction subroutine

222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259

RCL 01 X<0? SQRT FS?C 05 XEQ 21 LBL 99 CLA ARCL 01 39 XTOA ARCL 02 RCL 03 X=0? GTO 09 "-" ARCL 03 "/" ARCL 04 LBL 09 34 XTOA CLST CF 22 AVIEW RTN LBL 08 MOD LASTX X<>Y X!=0? GTO 08 + RTN LBL 21 X<> 09 REGMOVE X<> 09 END

; [222-224] After normalizing, if the feet part of ; XX is negative, then it's all wrong. Create ; an error in lieu of writing more code. ; ; ; ; ------------------------------------------------[228-246] Display XX as F-I-F or F-I Feet [230-231] Append feet (') symbol

; Append Inches ; [233-235] If no fraction, skip fraction display ; Append hyphen (between inches and fraction) ; Append numerator ; Append virgule ; Append denominator ; [241-242] Append inches (") symbol ; [243-244] Clean-up ; Display XX ; ------------------------------------------------; [248-254] Part of fraction reduction routine ; (see FR in the PPC ROM User's Manual) ; X not equal to 0?

; ------------------------------------------------; [256-258] Raise stack

Program Resources Registers R00: R01: R02: R03: R04: R05: R06: R07: R08: R09: R10: R11: R12: R13: R14: Flags Fraction (FF) XX Feet XX Inches XX Numerator (reduced) XX Denominator (reduced) YY Feet YY Inches YY Numerator (reduced) YY Denominator (reduced) REGMOVE constant for XX and YY Not used RR Feet RR Inches RR Numerator (reduced) RR Denominator (reduced)

F00: RR in use F01: F-I mode set F22: Data entry F27: USER Mode F29: Digit separators (F02-F07 cleared for "clean" display) ******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* ******************************************************************* HP-35S Multiple cashflow / NPV / IRR / NFV / NUS program Hello all, Please find below my financial program for the HP-35s calculator for multiple ca shflows / investment analysis. Note: - indirect registers are used for the multiple cashflows - indirect registers are NOT cleared after end of program - when run again previous values of the cashflows are recalled to stack level T (ready to be used again), the cashflow counter is shown on stack level X - after entering each cashflow value press the [R/S] key to continue - the number of cashflows is limited by memory only - two labels are used because the solver is used with a program to calcu late the IRR (label R program) - obviously you can use different labels (instead of C and R) - to continue after solution for P etc is shown just press [R/S] key C001 C002 C003 C004 C005 C006 C007 C008 C009 C010 C011 C012 C013 C014 C015 C016 C017 C018 C019 C020 C021 C022 C023 C024 C025 C026 C027 C028 LBL C SF10 INPUT N 1 + STO J 1 STO (J) INPUT I STO R 0 STO J EQN CF0,CF1, ,CFN PSE RCL J RCL (J) STOP STO (J) 1 STO+ J RCL J RCL N x<y? GTO C027 Rdown GTO C015 0 STO P

C029 C030 C031 C032 C033 C034 C035 C036 C037 C038 C039 C040 C041 C042 C043 C044 C045 C046 C047 C048 C049 C050 C051 C052 C053 C054 C055 C056 C057 C058 C059 C060 C061 C062 C063 C064 C065 C066 C067 C068 C069 C070 C071 C072 C073 C074 C075 C076 C077 C078 C079 C080 C081 C082 C083 C084 C085 C086 C087 C088

0 STO J RCL (J) 1 RCL I 100 / + RCL J ^ / STO+ P RCL J RCL N x=y? GTO C048 1 STO+ J GTO C031 VIEW P 0 STO F 0 STO J RCL (J) 1 RCL I 100 / + RCL N RCL J ^ * STO+ F RCL J RCL N x=y? GTO C072 1 STO+ J GTO C053 VIEW F CF 10 EQN P/((1-(1/(1+I/100)^N))/(I/100)) STO U VIEW U 0 STO Q 0 STO J FN= R SOLVE R VIEW R RCL P RCL F RCL U RCL R RTN

R001 R002 R003 R004 R005 R006 R007 R008 R009 R010 R011 R012 R013 R014 R015 R016 R017 R018 R019 R020 R021 R022 R023 R024 R025 R026

LBL R RCL (J) 1 RCL R 100 / + RCL J ^ / STO+ Q RCL J RCL N x=y? GTO R019 1 STO+ J GTO R002 RCL Q 0 STO J 0 STO Q Rdown Rdown RTN

variables N I J P F U R Q

used: = number of periods, excluding investment at t=0 = interest or cost of capital in % = loop counter for cashflows = NPV = NFV = NUS = IRR in % = temporary variable for solver

An example: *INPUT* N=8 I=10 CF0=-130000 CF1=7000 CF2=-10000 CF3=20000 CF4=20000 CF5=20000 CF6=12000 CF7=-8000 CF8=178500 *OUTPUT* NPV=-4855.85 NFV=-10408.94 NUS=-910.20 IRR=9.37%

The output is available in the aforementioned registers and on the 4 stack level s. Note that NPV<0 (and IRR<I), thus the project is not worth undertaking. Have fun with the program. In case of questions or suggestions, please send an e -mail. Caspar ******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* *******************************************************************

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* *******************************************************************

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* *******************************************************************

******************************************************************* ********************* BEGIN PROGRAM LISTING ********************* *******************************************************************

You might also like