You are on page 1of 132
Getting Started (page 16} Memory Stack, LAST X, and Data Storage (age 26) Numeric Functions page 42) Display Control (page 67) Programming Basics (page 74) Program Editing (page 96) Program Decisions. and Control (page 110) Subroutines (page 119) The index Register (page 127) Applications Pregrams (pace 140) Programming Techniques (page 206) Caeser PACKARD Portable Camputer Division 1000 NLE. Cirele Blvd., Corvallis, OR 97990, U.S.A. 00011-90001 Rev. G English Printed in Canada 11/85 a me ee el eee et ee HEWLETT-PACKARD HP-11C OWNER’S HANDBOOK AND PROBLEM-SOLVING GUIDE Notice Hewlett-Packard Company makes no express or implied warranty with regard to the keystroke procedures end program material offered or their merchantability or their fitness for any particular purpose. The keystroke procedures and program mat 1@ user. Should the keystroke procedures or program material prove defective, the user (and not Hewlett-Packai Company nor any other party) necessary correction and damages. Hewlett-Packard Company shall not be liable for any incidental or consequential damages in connection with or arising out of the furnishing, use, or performance of the keystroke procedures or program material. weve Caests3 PACKARD HP-11C Owner’s Handbook and Problem Solving Guide November 1985 00011-90001 Rev. G Printed in Canada 11/85 ® Hewlett-Packard Company 1982 Introduction Congratulations! Your selection of an HP-11C calculator with Continuous Memory demonstrates your interest in quality, capability, and ease of use. This handbook describes the calculator’s many features and can help you to quickly learn how to use the features you are not already familiar with. Fundamentals, Programming, Applications Programs. Your HP-11C handbook is divided into three main parts. Parts I and II cover the use of keyboard and programming features you may be familiar with if you have used other HP programmable calculators. Part III provides you with a variety of applications programs, plus some additional information on fundamental programming practices. However, before you begin reading in any of the three main parts, we suggest that you gain some experience using your HP-11C by working through the introductory material entitled Your HP-11C, A Problem Solver, on page 9. Programming Sections in Brief. At or near the beginning of each section in part II (sections five through nine) is a brief cussion of the operating characteristics covered in that section. This information may be all you need to read in the section if you already know how to create, run, and edit programs on another HP calculator. If you are new to HP calculators, you'll want to also read the remaining material in each section for a more tutorial dizeussion and/or examples that highlight xalacted tapiex Additional Applications. Also available from many authorized Hewlett-Packard dealers is the HP-11C Solutions Handbook. This accessory handbook contains a comprehensive collection of HP-11C programs covering applications in mathematics, statis- tics, electrical engineering, chemistry, business, and games. oily eo ao» a! eo nD € i » = WvuvuvvvvVvVvVvUHEYUUEUY SEnnoorgoaoooss t Contents Introducti : The HP-11¢ Keyboard and Continuous Memory Your HP-11C: 4 Problem Solver - . Manual Solutions . Programmed Solutions . Partl: HP-11C Fundamentals foe 15 Section 1: Getting Started vo tteseeee 16 Power On and Off .... woes ve 16 Display ceceecteeseee 16 Radix Mark and Digit Separator... cittettrrersnee 16 Annunciators 5.0... 16 Negative Numbers sete 7 Display Clearin 7 Running . 18 Overflow and Underfiow - oe cee 18 Error Messages .. bitters 19 Low Battery Indicator . cites 19 Memory ..esceceeerees see 19) Continuous Memory... 19 Resetting Memory 20 Keyboard Operation ......- 20 Primary and Alternate Functions . cevees 20 Clearina Prefixes : vee 24 One-Number Functions. 21 Two-Number Functions .. 22 Section 2: The Automatic Memory Stack, LAST X, 1 and Data Storage ......---.+ wee “The Automatic Memory Stack and Stack Manipulation ......... 26 Stack Manipulation Functions 27 Calculator Functions and the Stack . 29 29 Two-Number Functions .......6.00+5 Chain Calculations .. : LASTX oo Constant Arithmetic 4 Contents Storage Register Operations 37 Storing Numbers... 37 Recalling Numbers . 38 Storage and Recall Exercises 38 Clearing Data Storage Registers .. 38 Storage Register Arithmetic .. . so 39 Storage Register Arithmatic Exercises foes 40 Problems ............ ve . 40 Section 3: Numeric Functions ... Pi... Number Alteration Functions One-Number Functions . General Functions .... Trigonometric Operations Time and Angle Conversions : Degrees/Radians Conversions ...............00.. 2 AT Logarithmic Functions .... Hyperbolic Functions ... Two-Number Functions .. Exponential . Percentages . cetteeeenees Polar-Rectangular Coordinate Conversions Probability .............. Statistics Functions ........ Random Number Generator ‘Accumulating Statistics . - Correcting Statistics Accumulation... Mean cee Standard Deviation ....... vere BT Linear Regression . : see 6B Linear Estimation and Correlation Coefficient ............... 64 Section 4: Display Control Display Mode Control ...... Fixed Decimal Display . Scientific Notation Display . Engineering Notation Display . Keying In Exponents sete Rounding at the Tenth Digit .... ~~~ eew revere Vereen He eur euevvus a vu eee Contents 5 Part [: HP-11C Programming Section 5: Programming Basica . What Is a Program? Why Write Programs? . Program Control ..... : ‘Automatic Memory Reallocetion (MEM) . Keycodes: and Line Numbers . Abbreviated Key Sequences Program Control Functions User Mode ....- Program Memory Interpreting Keycodes ........ Programming Operations .... Beginning and Ending a Program ....... The Complete Program - Loading a Program . Running a Program User Mode Operation Program Stops and Pauses . Planned Stops During Program Execution Pausing During Program Execution . Unexpected Program Stops sees Labels : Problems .- Section 6: Program Editing . Finding Program Errors ...... Editing Functions... : Editing Example : Single-Step Execution of a Program ... ng and Control -...-........ 110 Section 7; Program Deci Program Conditional Tosts .......- 110 Flags veces : 11 Program Control . 112 GoTo. vette : 112 Branching and Looping... 2.0... esses 112 Using Flags .....seceeceeceeee 116 | | | | | 6 Contents Seetion 8: Subroutines ... coe WI GoTo Subroutine .... - 119 Subroutine Limits ..... . 120 Subroutine Usage 121 Section 9: 'The Index Register 127 Direct Index Register Functions . os 127 Indirect index Register Functions ....... ve 130 Loop Control Using (ISG) ve 132 Direct Ry Operations ......... 134 Indirect R, Operations feces 135 Indirect Program Control 136 Indirect Label Branches and Subroutines . 136 Indirect Line Number Branches and Subroutines . 137 Part Il; Programmed Problem Solving ...........06.. 139 Section 10: Applications Programs 140 Matrix Algebra... seen 140 Systems of Linear Equations With Three Unknowns 149 Newton's Method (Solution to f(x) = 0} . 154 Numerical Integration by Discrete Points + 159 Curve Fitting . tee +. 162 Triangle Solutions ..... - 169 tStatistics ..... . = 176 Chi-Square Evaluation . +. 182 Finance: Annuities and Compound Amounts coos 185) Submarine Hunt . . 194 Section 11: Programming Techniques 206 Structure . 206 The Problem Statement cesses 206 The Algorithm -. 208 Flowcharts . 208 Subroutines 210 (SG}with au Data input .. 212 Looping ... 214 Flags esses - 215 Random Numbers... 217 User-Definable Keys... 2.2.0.5 217 StOFING DBA vee seeecesesereseeeees 218 Selecting Different Routines... 6... 218 “yyy weve yeueve Contents 7 Appendix A: Error Conditions 219 Appendix B: Stack Lift and LAST X . 224 Digit Entry Termination . : 221 StackLift ... 221 Disabling Operations « oe 22 Enabling Operations . . 222 Neutral Operations woe : 222 LASTX . we veces 229 Appendix C: How Automatic Memory Reallocation Operates cece, 22M Converting Storage Reyisters to Program Memory 224 Converting Program Memory to Storage Registers 227 Using (MERA)... 227 Appendix D: Battery, Warranty, and Service Information ....1....5+ peceetet eeeeeeeesee, 280 Batteries ss 230 Low Power indication ... : . 2a Installing New Battorios ..........+ vee 231 Verifying Proper Operation (Self Tests) . » 234 Limited One-Year Warranty ........+ 236 What is Not Covered... .+..++ sees 236 Warranty for Consumer Transactions in the United Kingdom .......2 ++ Obligation to Make Changes Warranty Information . Service Obtaining Repair Service in the United States Obtaining Repair Service in Europe . International Service Information Service Repair Charge ..... Service Warranty . Shipping Instructions .. Further Information ......-.- veeteeeeeeeeeeeeees 244 When You Need Help a 2at Temporature Specifications ..... a 241 Potential for Radio and Television Interference (for U.S.A. Only) . : 242 Programming Techniques Index . o . 243 Function Key Index ..-...0..050++ ce 248 Programming Key Index ........ ceseeseeceeee 289 Subject Index cette . 254 The HP-11C Keyboard and Continuous Memory AUTOMATIC MEMORY STACK ™ zs Yo xe Displayed LASTX C PROGRAM MEMORY STORAGE REGISTERS Permanent Shared Permanent ‘Shared ooo- }foea— so L__] Ro L_ 001- 065— Ry Ry 002- o66- RL] 0 [ —— C= i Re | ce eS 7 Ry a ‘The basic program memory-storage register allocation is 63 lines of programming and 20 data storage registers, plus the Index register {R), The calculator automatically converts one data storage register into seven lines of program memory, one register at a time, as you need them. Conversion begins with Ry and enda with Ro 8 Your HP-11C A Problem Solver Your HP-11C Programmable Scientific Calculator is a powerful problem solver you can carry with you almost anywhere to handle problems ranging from the simple to the complex, and to remember important data. The HP-11C is so easy to program and use that it requires no pricr programming experience or knowledge of programming languages. ‘The HP-11C helps you to conserve power by automatically shutting itaelf off if it is left on and inactive for more than 8 to 17 minutes. But don’t worry about losing data~any information you have keyed into your HP-11C is saved by Continuous Memory. We're different! Your Hewlett-Packard calculator uses a unique operating logic, represented by the (ENTER) key, that differs from the logic in most other calculators. The power in HP calculator logic becomes obvious through use. Later we will cover the detail of (ENTER) and your HP-11C’s logic, but right now let's get acquainted with by seeing how easy it is to perform calculations with your HP-11C, Answers appear immediately after you press a numerical function key. For example, let's look at the arithmetic functions. The (=]key adds the last entry to whatever is already in the machine, and the Elkey subtracts the last entry; the [x]key multiplies what's in the machine by the last entry, and the [=]key divides by the last entry. First we have to get the numbers into the machine. To do this, key in the first number, press (ENTER}to separate the first number from the second, then key in the second number and press [+], (-], [=], or a. 10 Your HP-11C: A Problem Solver To get the feel of your new calculator turn it on by pressing the (ON) key’ If any nonzero digits appeaz, press [€) — to clear the display to.0000. Iffour [eqn] zeroes are not displayed to the right of the decimal point, press [7 your display will match those in the following problems. (All displays illustrated in this handbook are set to the [Fx) 4 display setting unless otherwise specified.) 0.0000 Note: An asterisk (+) flashing in the lower-left corner of the display when the calculator is turned on signifies that the available battery power is nearly exhausted. To install new batteries, refer to appendix D. Manual Solutions Tt is not necessary to clear the calculator between problems, But if you make a digit entry mistake, press [+] and key in the correct digit. To Solve Keystrokes Display 9+6=15 9 (ENTER) 6 (2) 15.0000 9 6 3.0000 9x6=54 9 [ENTER)6 84.0000 9+6=15 9 fenteR)6 (=) 1.5000 Notice that in the four examples: © Both numbers are in the calculator before you press [+], (), Li, orf. s used only to separate two numbers that are keyed in one after the other. © Pressing a numerical function key, in this case (F), [=], [2], or (), causes the function to execute immediately and the result to be displayed. Note that the [ inadvertantly Teey is lower than the other keys ta help prevent its being prossed eee ee Yee YourHP-11C:AProblem Solver 17 ‘To see the close relationship between manual and programmed problem solving, let's first calculate the solution to a problem manually, that is, from the keyboard. Then we'll use a program to calculate the solution to the same problem and others like it. Most conventional home water heaters are cylindrical in shape. You can easily calculate the heat loss from such a tank using the formula g =h XA XT, where: qis the heat loss from the water heater (Btu per hour). his the heat-transfer coefficient. Ais the total surface area of the cylinder. Tis the temperature difference between the cylinder and the surrounding air Example: Assume you have a 52- gallon cylindrical water heater and you wish to determine how much energy is being lost because of poor insulation. In initial measurements, you found an average temperature difference between the heater surface and surrounding air of 15 degrees Fahrenheit. The surface area of the tank is 30 square feet and the heat transfer coefficient is approximately 0.47. To caleulate the heat loss of the water heater, simply press the follow- ing keys in order. Keystrokes Display 16 18.0000 Input temperature 30 30 difference (7) and area of water heater (A). @ 450.0000 Calculates A x T. 47 0.47 Heat-transfer coefficient (A). a 211.5000 Heat loss in Btu per hour (AX(AT). ic 0.0000 Clears display. 12 Your HP-11C: A Problem Solver Programmed Solutions ‘The heat loss for the water heater in the preceding example was calculated for a 15-degree temperature differonce. But suppose you want to calculate the heat loss for several temperature differences? You could perform each heat loss calculation manually. However, an easier and faster method is to write a program that will calculate the heat loss for any temperature difference. Writing the Program. The program is the same series of keystrokes you executed to solve the problem manually. Two additional instructions, a label and a return, are used to define the beginning and end of the program. Loading the Program. To load the instructions of the program into the HP-11C press the following keys in order. The calculator records (remembers) the instructions as you key them in, (The display gives you information you will find useful later, but which you can ignore for now.) Keystrokes Display DEA 000- Places HP-11C in Program mode. (Program annunciator appears.) (CLEAR [PREM] 000- Clears program memory. ce) 001-42,21,11 Label “A” defines the beginning of the program. 3 002- 3 ° 003- ° @ o04- 20 | The same keys you a 005- 48 } pressed to solve the 4 006- 4 problem manually. 7 007- 7 ls 008- 20, wen 009- 43 32 “Return” defines the end of the program. OER 0.0000 Places HP-11C in Run mode. (Program annunciator is cleared.) vue Ce Your HP-11C: Problem Solver 13/14 Running the Program. Press the following keys to run the program. Keystrokes Display 15 16 ‘The first temperature difference. oA 211.5000 ‘The Btu heat loss you calculated earlier by hand. 180) 253.8000 ‘The Btu heat loss for a new temperature difference. With the program you have loaded, you can now quickly calculate the Temp. | Bu Btu heat loss for many temperature Dit. | Heat Loss | differences. Simply key in the desired 10 ? difference and press [1 [A]. For 12 2 example, complete the table at the 14 ? right. 16 2 18 ? The answers you should see are 20 ? 141.0000, 169.2000, 197.4000, 225.6000, 253.8000, and 282.0000. Programming is that easy! The calculator remembers a series of keystrokes and then executes them whenever you wish. Now that you have had some experience in using your HP-11C, let's take a ook at some of the calculator's important operating details. PartI HP-11C Fundamentals Section 1 Getting Started Power On and Off The (Gti) key turns the HP-11C on and off. And, to conserve power, the HP-11C automatically turns itself off (time-out) after 8 to 17 minutes of inactivity. Display Radix Mark and Digit Separator A radix mark is the divider between the integer and fractional portions of | oq 12-248-678-91 ‘a number. A digit separator dis. |~’-O* tinguishes the groups of digits in a 12,345.678.91 large number, In some countries the | . radix is a decimal point and the digit Radix Mark/Digit separator is a comma, while in other | _ Separator Exchange countries, the reverse is true. To change the radix/digit separator convention on your HP-11C, turn off the calculator, then hold down the [7] key, turn the calculator back on, and release the [-] key (Q/(oN). Annunciators ‘Your HP-11C’s display contains six annunciators that tell you the status of the calculator during certain operations. The annunci- ators are described, with the operations they refer to, in the appropriate sections of this handbook. %* USER fg GRAD PRGM Display Annunciator Set yw ) ) Q ) d Section 1; Getting Started 17 Negative Numbers ‘To make a displayed number negative—cither one that has just been keyed in or one that has resulted from a caleulation— simply press change sign). When the display shows a negative number—that is, the number is preceded by a minus sign— pressing [CHS] removes the minus sign from the display, making the number positive. Display Clearing: (cLxJand (#) The HP-11C has two types of display clearing operations, (clear X) and [#] (back arrow). When pressed in Run mode, [9 ][CLx] clears any displayed numbers to zero. When pressed in Program mode, [3] (€L:Jis stored in the calculator as a program instruction. (#Jis a nonprogrammable function that enables you to clear the display in either Program or Run mode, as follows: 1. In Run mode: A. Pressing (@]a/ter executing almost any function clears all digits in the display to zero.” (Exeenting almost any HP-1IC function terminates digit entry—that is, tells the calculator the number in the display is complete— and causes (] to acton the complete number.) Keystrokes Display 12345 12.345 we 114.1081 fl 0.0000 executing a function clears all digits in the display to zero. * Unseen trailing dite of the number inthe dieplay may be held internally and will also be cleared | | | 18 Section 1: Getting Started B. After keying in a new number, if you press [] before executing a function (that is, before terminating digit entry) the last digit you keyed in is deleted. After you delete one or more digits, you can, if you want, key in new digits to replace them. Keystrokes Display 12345 12,345 fw 1,234 When digit entry has not 123 _been terminated, [#Jacts 1,233 on each digit separately. 2. In Program mode, pressing (#] deletes the entire program instruction currently in the display. Running While a program is running, or during execution of [Fyx] (permuta- tion) or (Gxx) (combination), running flashes in the display. running Overflow and Underflow Overflow. When the result of a calculation in the displayed X- register is a number with a magni- tude greater than 9.999999999 x 10%, all 9's are displayed with the appro- priate sign. When overflow occurs in a running program, execution halts and the overflow display appears. 9.999999 99 Overflow Display Underflow. If the result of « calculation is a number with a magnitude less than 1.000000000 x 10%, zero will be substituted for that number, Underflow will not halt the execution of a running program. we Section 1: Getting Started = 19 Error Messages If you attempt a calculation using an improper parameter, such as attempting to find the square root of a negative number, an error message will appear in the display. Keystrokes Display -4 Error 0 te 4.0000 For a complete listing of error messages and their causes, refer to appendix A, Error Conditions. A summary of error messages is printed on the calculator’s back label. To clear any error message. press (#)(or any other key), then resume normal calculator operation, Low Battery Indicator Whenever a flashing asterisk, which indicates low power, appears in the lower left-hand side of the display, . refer to Installing New Batteries, page 231. 0.0000 Memory Continuous Memory ‘The Continuous Memory feature in your HP-11C maintains the following even when the calculator is turned off: © Allnumeric data stored in the calculator. # Allprograms stored in the caleulator. © Display mode and setting. «Flag settings. © Position of the calculator in program memory. © Any pending subroutine returns. © Trigmode (Degree, Radian, or Grad) 20 Section 1: Getting Started When the HP-11C is turned on, it alwaya “wakes up” in Run mode (PRGM annunciator cleared), even if it was in Program mode (PRGM annunciator displayed) when last turned off. Continuous Memory is preserved for a short time when the batteries are removed, allowing you to replace a set of low batteries without losing any data or programs you want preserved in the calculator. Reset 19 Memory If at any time you want to reset (entirely clear) the HP-11C’s Continuous Memory, do the following: 1. Turn the HP-11C off. a 2, Press and hold the [ON)kcy. / 3. Press and hold the [)key. 4. Release the (ON) key and Resetting then release the (-]key Continuous Memory When you perform the memory reset operation the error mossage shown to the right is displayed. Press [+] (or any other key) to clear the message. PrError Note: Continuous Memory can be inadvertently reset if the calculator is dropped or otherwise traumatized, or it power is interrupted. Keyboard Operation Primary and Alternate Functions Most keys on your HP-11C perform one primary and two alternate functions. The primary function of any key is indicated by the character on the horizontal face of the key. The two alternate functions are indicated by the characters above and on the slanted face of the key. > ' Section 1: Getting Started = 21 © To select the alternate function printed in gold above the key. first press the gold prefix key ), T ‘then press the function key: for example:[F[} eS) <— © To select the primary funetion as on the face of the key, press only that key; for example: (CHS) © To select the alternate function printed in blue on the slanted face of the key, first press the blue prefix key [8], then press ‘the function key; for example: (o)(48S) Notice that when you press the [1] or (G]prefix keys, the f org annunciator appears and remains in the display ‘ until a function key is pressed to complete the sequence. 0.0000. Clearing Prefixes Ifyou make a mistake while keying in a prefix for a function, press [AICLEAR [PREFIX] to cancel the error. (CLEAR (PREFIX) also cancels the (STO), [RoLI, (GTOl, [GSB], [HVP], and [HYP") keys.) Since the kkey is also used to display the mantissa of a displayed number, all ten digits of the number in the display will appear for a moment after [PREFIX)is pressed (in Run mode only). One-Number Functions Aone-number function is any numerical function that performs an operation using only one number. To use any one-number function: 1. Key in the number (if it is not already in the display). 2. Press the function keys). Keystrokes Display 45 45 wi 1.6532 22 Section 1: Getting Started Two-Number Functions A two-number function must have two numbers present in the calculator before executing the function. (+), (=), (4), and (7) are examples of two-number functions. ‘The [ENTER)Key. [fone of the numbers you need for a twonumber function is already in the calculator as the result of a previous function, you do not need to use the (ENTER) key. However, when you must key in two numbers before performing a function, use the [ENTER] key to separate the two numbers. To place two numbers into the calculator and perform a two- number function such as 2 1. Keyin the first number. 2, Press [ENTER)to separate the first number from the second. 3. Keyin the second number. 4. Press the function key(s). Keystrokes Display 2 2 (EMER) 2.0000 3 3 a 0.6667 Order of Entry. As you know from basic arithmetic, reversing the order of the numbera in addition and multiplication examples will not affect the answer. But for subtraction or division, the number you are subtracting or dividing by is always the second number keyed in. Toperform Keystrokes Display 10-3 10 35) 7.0000 3-10 -7.0000 10+8 3.3333 3510 0.3000 i ’ > 3 3 3 3 > > > > > > > 3 3 3 3 > > > 2 9 > . . 7? sennooseees Ve, Section 1: Getting Stated 23 When working with your HP-11C’s other two-number functions (euch as [=)), remember that the number designated by x on the key is always the last number to be keyed in. For example, to calculate the value of 2 raised to the power of three (2"), key in 2, press (ENTER), key in the exponent, 3, then press [1"] Keystrokes Display 2 (ENTER) 2.0000 3 3 Bis the x-value. @ 8.0000 2(y) raised to the third (x) power. Now try these problems. Notice that you have to press (ENTER) to separate numbers only when they are being keyed in one immediately after the other. A previously calculated result (intermediate result) will be automatically separated from a new number you key in. To solve (2 +4) +8 Keystrokes Display 2 (ENTER) 2.0000 4 4 6.0000 (244) 8 a 0.7500 (244) +8 To solve (9 +17—4 +23) +4: Keystrokes Display 9 [ENTER] 9.0000 7 26.0000 @+17) 22.0000 @+17~4) 45.0000 @+17-4+23) 48 11.2600 +1744 29) 64 Even more complicated problems are solved in the same simple manner—using automatic storage of intermediate results. 24 Section 1: Getting Started Example: Solve (6 +7) x(9- 3). First solve for the intermediate result of (6 +7): Keystrokes Display 6 6.0000 7 13.0000 6+7 Now perform (9 ~ 3). Since another pair of numbers must be keyed in, one immediately after the other, use the (ENTER) key again to ‘separate the first number (9} from the second (3). (There is no need to press (ENTER) to separate the 9 from the previous intermediate result of 13 that is already in the calculator—the results of previous calculations are stored automatically.) To solve (9 — 3): Keystrokes Display 9 3 9.0000 3 3 o 8.0000 @-3) ‘Then multiply the intermediate results (13 and 6) together for the final answer: Keystroke Display a ‘78.0000 6+x(9-3)=78 Notice that the HP-11C automatically stored the intermediate results for you and used them on a last.in, first-out basis when it was time to multiply. No matter how complicated a problem may look, it can always be reduced to a series of one- and two-number operations. Remember: + The (ENTER) key is used for separating the second number from the first in any operation requiring the sequential entry of two numbers. « Any new digits keyed in following a calculation are automatically treated as a new number. ? ) 5 Section 1 Getting Started 25 ‘¢ Intermediate results are stored on a last-in, first-out basis. Now try these problems, Work through them as you would with pencil and paper. Don't be concerned about intermediate answers—they are handled automatically by your HP-11C. (16x 38)-(13 x11) = 465.0000 (27463) +(83x9) = 0.8030 (V6.38X 0.55) +.05 = 60.0300 4x(17—12)+(10—5) = 4.0000 Section 2 The Automatic Memory Stack, LAST X, and Data Storage The Automatic Memory Stack and Stack Manipulation Automatic retention and return of intermediate results is the reason your HP-11C takes you through complex calculations 80 easily. The features supporting this ease of use are the automatic memory stack and the [ENTER] key. ‘The Automatic Memory Stack Registers ™ Zz Y> x> 0.0000 | Always displayed When your HP-11C is in Run mode (when the PRGM annunciator is not displayed), the number that appears in the display is always the number in the X-register. ‘Any number keyed in and the result of executing a numeric function is placed in the displayed X-register. Executing a function or keying in a number will cause numbers already in the stack to lift, remain in the same register, or drop, depending upon the type of operation being performed. Numbers in the stack are available ona last-in, first-out basis, If the stack was loaded as shown on the left of the following illustrations (as the result of previous 26 Section 2: Memory Stack, LAST X, and Data Storage 27 calculations), pressing the indicated keys would result in the stack arrangement shown on the right of each illustration.” Stack Lift tost by T-| No Stack Change ™ 2 1)J—+G zeta] fa] zal] Yals | 4 y+(3 |__-[3 xe a4 | p> Pes xe[4 |—-[2 Keys > 789 Koys > ire} Stack Drop Te[a] zof 2] =< 4 7 yea], ~~ [2 xa ho 7 Keys > Stack Manipulation Functions separates two numbers keyed in one after the other. When is pressed the calculator lifts the stack by copying the number in the displayed X-register into the Y-register. For example, to fill the stack with the numbers 1, 2, 3, 4 (assume that the stack registers have already been loaded with the numbers shown as the result of previous calculations): ost lost los Tee + 3 beth EE yee] ee IZ Els { Keys > (ENTER) 2 (ENTER) (llustration continued on next page.) + Tosimplify the illustration of featurve described in this section, a single digit number format is used in most of the dingrams instead of the decimal nam ber (FR). format used elaesore inthis handbook 28 Section 2: Memory Stack, LAST X, and Data Storage lost lost T™ fe j—fa]-7 JL] z+ [a |—-[i ft fz |—-f2 | yo [2 |—~[2 | 3 |—~[3 | x [2] be at pid Keys 3 ENTER) 4 (He) (rott down), (8#) (roll up), and (=v) /X exchange Y). (R¥)and [R#] rotate the contents of the stack registers down or up one register, No values are lost. [v=] exchanges the numbers in the X- and Y-registers, If the stack were loaded with the sequence 1, 2, 3, 4, the following shifts would result from pressing [R#), (3)/R41, and (=). tTefa [4 | [a }—[4 J sec Yels xe POR Ee < cy Bry Keys > LAST 8). When a numeric function is executed, a copy of the value occupying the displayed X-register before the function was executed is stored in the LAST X register. Pressing [@]((ST«]places a copy of the current contents of the LAST X register into the displayed X-register. (Refer to appendix B, Stack Lift and LAST X for a listing of the functions that save x in the LAST X register.) For example, if the stack was loaded as shown on the left, below: lost, tee] [oJ z>[o]—[ol rf eo] Yo[o}—>[ol” +[r6| xe[e]—fe} Ce ke | OR) OT LasTx> 4) —+-) Section 2: Memory Stack, LASTX, and Data Storage 29 Calculator Functions and the Stack When you want to key in two numbers, one after the other, you press [ENTER] between entries of the numbers. However, when you want to key in a number when the number already in the displayed X-register is the result of a previous calculation or other function (like ED, etc.), you do not need to use [ENTER]. Why? Executing almost any HP-11C function has two results: 1. The specified function is executed. 2. The automatic memory stack is enabled; that is, the stack will lift automatically when the next number is keyed in. For example, with 4 already keyed into the X-register: Jost T+[o}-+[o] pol fe] z{o}t—>[ol fo} “fo | y+[fo}t—-[o pz [0 | x* 2recbi- a 5 & Keys > ° There are four functions—(ENTER], (Cx), [Ez], and (E=J—which disable the stack.* They do not provide for the lifting of the stack when the next number is keyed in. Following the execution of one of these functions, keying in a new number will simply write over the currently displayed number instead of causing the stack to lift (Although the stack lifts when (ENTER) is pressed, it will not li when the next number is keyed in. The operation of (ENTER) illustrated on pages 27 and 28 shows how [ENTER] thus disables the stack.) In most cases, the above effects will come so naturally that you won’teven think about them. Two-Number Functions An important aspect of two-number functions is the positioning of the numbers in the stack. To execute an arithmetic function, the numbers should be positioned in the same way that you would * When preasing [3 clears the entire display it operates the same as [CIi?and disables the stack. Otherwise, [6] is neutcal; that ix it doen not affect the stack, Far a further discuasion of thestack, refer so appendix B, Stack Lift and LAST X, 30 Section 2: Memory Stack, LAST X, and Data Storage write them on paper. For example, to subtract 15 from 98 you first write 98 on paper, then write 15 underneath it, like this: 98 us ‘Then you would perform the subtraction, like thi 98 us &3 ‘The numbers are positioned in the calculator in the same way, with the first number, the minuend, in the Y-register and the second number, the subtrahend, in the displayed X-register. When the subtraction function is executed, the 15 in the X-register is subtracted from the 98 in the Y-register, and the stack drops, leaving the result in the X-register. Here is how the entire operation is executed (assume that the stack registers have already been loaded with the numbers shown as the result of previous calculations): lost lost 2 ze[3 | 2 ae: 98 1 xe | ‘cel-ct 98 83 Keys > 98 For any arithmetic function, the numbers are always positioned in their natural order first, then the function is executed and the stack drops. In the above example, we subtracted 15 from 98. The same number positioning would be used to add 15 to 98, multiply 98 by 15, and to divide 98 by 15, that i Section 2: Memory Stack, LASTX, and Data Storage 31 98 tis > 98 zs YY xIs xe be 46 Ss Chain Calculations Whether you use your HP-11C mostly for direct keyboard solutions or programmed solutions, you are likely to use chain calculations frequently. It ia in this area that the simplicity and power of your HP-11C’s logic system becomes very apparent. Even during extremely long calculations, you still perform only one operation at atime, The automatic memory stack stores up to four intermediate results until you need them, then inserts them into the calculation, Thus, working through a problem is as natural as if you were working it out with pencil and paper. You have already learned how to key in a pair of numbers using the (ENTER) key and then perform a calculation. You have seen how the stack drops as a result of executing some functions and how the stack lifts automatically when you key in a number after executing a function. To see how these features operate in a chain calculation, let’s solve 3+ 6 — 4 +2 =? (Assume the stack cleared to zeros by pressing (+) [ENTER] [ENTER)[ENTER].) es , zZ>| oH Ory Keys > 32 Section 2: Memory Stack, LAST X, and Data Storage ATA ar T+ 0 o ° 0 zeLo | 0 x> keys > o o 3 3 o 7 6 6 @ [w]e |e} o| + |alolol of @ je! [e} o} (ENTER) ENTER, ™ Zz Yo x* Keys > alalalulo ° ° 7 2 a LASTX ‘The HP-11C’s LAST X register, a separate data storage register, preserves the value that was last in the display before execution of weeuevevevevenr Section 2; Memory Stack, LASTX, and Data Storage 33 anumeric function.* ‘This feature saves you from having to re-enter numbers you want to use again and can assist you in error recovery. Example: To multiply two separate values, such as 45.575 meters and 25.331 meters by 0.175: T [0.0000 | 0.0000 | 0.0000 2 0.0000 | 0.0000 | 0.0000 Y +(_0.0000 | 45.5750 | 45.5750 x >[(45.575 [45.5750] 0.175 Keys 45(1575 (ENTER) = [175 w (0.1750) T »[0.0000 | 0.0000 | 0.0000 Z| 0.0000 | 7.9756 | 0.0000 Y [79756 [25.3310 | 7.9756 x > [28.331 | 0.1760 | 4.4329 Keys 25.331 [Hl LAsTX> [01750] LasTx> +The exeuptions ave the statistics functions [Z], [and [CI], 34 Section 2: Memory Stack, LAST X, and Data Storage makes it easy to recover from keystroke mistakes, such as executing the wrong function or keying in the wrong number. For example, divide 287 by 13.9 after you have mistakenly divided by 129: Keystrokes Display 287) 287.0000 12.97) 22,2481 Oops! The wrong divisor. Oem 12.9000 Retrieves from LAST X the last entry to the X- register (the incorrect divisor) before | executed, A 287.0000 —_—_—Perform the reverse of the function that produced the wrong answer. 1396) 20.6475 The correct answer, Constant Arithmetic Because the number in the T-register remains there when the stack drops, this number can be used as a constant in arithmetic operations ™! c € z> c e Yel € xe x on Keys> B To insert a constant into a calculation, load the stack with the constant by keying the constant into the X-register and pressing three times. Use the constant by keying in your initial argument and executing your planned series of arithmetic operations. Each time the stack drops, a copy of the constant will be made available for your next calculation and a new copy of the constant is reproduced in the T-register. weve evs Section 2: Memory Stack. LAST X, and Data Storage 38, Example: A bacteriologist tests a certain strain of microorganisms whose population typically increases by 15% each day (a growth factor of 1.15). If he starts a sample culture of 1000, what will be the bacteria population at the end of each day for five consecutive days? Method: Use [ENTER]to put the constant growth factor (1.15) in the Y., Z., and T-registers. Then put the original population (1000) in the displayed X-register. Thereafter, you calculate the new daily population whenever you press [i]. To set your calculator ta the same display format as is shown in the following example, press [7 (Fe the first time, you calculate 1.15 x 1000. The result (1,150.00) is displayed in the K-regiater, the stack drops, and 36 Section 2: Memory Stack, LAST X, and Data Storage 8 new copy of the constant is generated in the T-register, that each time you press {2}: 1. A new calculation involving Tele the X- and Y-registers takes ze Le place. Yolo befor x) xo[x 2. The result of the calculation is Tofey) placed in the displayed X- zelot register and the contents of the yet] rest of the stack drop. xo Po ox 3. A new copy of the number last TS] oc je—newc in T Gin this case, our constant) zele is generated in T. velo Xe] ox Since a new copy of the growth factor is duplicated in the T-regiater each time the stack drops, you never have to re-enter it. Press (1)[FiX)4 to return the HP-11€ to the 4 display format, Alternate Method: Constant arithmetic can also be performed using the LAST X register. To use this method to calculate the result of the preceding example: 1. Keyin the original population (1,000) and press (ENTER). 2. Keyin the constant growth factor (1.15). 3. Press (Z]to calculate the population at the end of one day. 4. Press [9] {LsTx}(x] to calculate the population at the end of each succeeding day. Section 2; Memory Stack, LAST X, and Data Storage 37 Storage Register Operations Storing and recalling numbers are operations involving the displayed X-register and the HP-11C's 21 data storage registers. Data storage registers are entirely separate from the stack and LAST X registers. Storing Numbers fatore), When followed by a storage register address (0 rough 9, [7] 0 through [=)9, or (i), copies a number from the displayed X-register into the data storage register specified by the storage register address. Data Storage Registers nL al x»C—] aol aL) a: nC] ae, xO] 2zC_ Rs Rs _] ro) wreL— eC] «a ro eC rc] «1 a CI If... Data Data Stack Storage Stack Storage to{i} af e] Tet] a f=] ze{2] af oe] zef2) Oe) yes] ao] y*(3] 2,09] xe[4] af xe[] 2.007 3B Section 2: Memory Stack, LAST X, and Data Storage A copy of the stored number remains in the storage register until a new number is stored there or until the storage registers are cleared or Continuous Memory is reset. Recalling Numbers recall), When followed by a storage register address (0 through 9, [}0 through (-)9, or (i]) places a copy of the number in the specified data storage register into the displayed X-register. If the stack is not disabled, executing a operation causes the stack to lift, Th. and you preas (ReL)2, then. Data Dats ‘Stack Storage Stack Storage 1 — lost Te[1] xo io 8 rele] no] 23 “Ee Ce Y+ = i xele] BC yo! 3] pf xXo[4 | Rs ‘Storage and Recall Exercises Execute the following operations: Keystrokes Display 123 123 123.0000 Stores 123 in Ry. 678 678.0000 Stores 678 in R. Recalls 123 from Ry, Recalls 678 from R.;. ~ vue wees Section 2: Memory Stack. LASTX, and Data Storage 39 LAST X registers, (To clear a single data storage register, store zero in that register.) Storage Register Arithmetic |, EB, ) a (storage register arithmetic). Uses the number in the displayed X register to perform arithmetic upon the contents of a specified atorage register n. The key sequence is followed by an arithmetic function key, followed in turn by the register address (0 through 9)." The result of any storage register arithmetic operation is placed in the specified data storage register. Storage Registers Stack If... T®] 2 ze[o | Rr; Lok yee] Cd xefa ] t= and... Ro represent the current status of the memories, executing results in: T+] | zl 2 | a, Led yo] a. xe[ a] a Co The same numbers Contents of R, changed inthe atack from k to(k Xd). registers. “Storage reginter arithmetic can be performed in Rg through Rg using indirect addressing. which is covered in section 9, The Index Register. Storage resister arithmetic cannot be performed in Ry. 40 Section 2: Memory Stack, LAST X, and Data Storage ) Storage Register Arithmetic Exercises , y Keystrokes Display 18(STa)o 18.0000 Stores 18 in Ro. > 3.0000 Divides number in R18) ) by3. 6.0000 Recalls copy of new yy} number in Ro. , 4.0000 Multiplies new number in Ro (6.0000) by 4. ) 24.0000 Recalls copy of new i number in Ro, “? 24.0000 ‘Adds 24 to number in Ro, } 48,0000 Recalls copy of new number in Ro, a) 40.0000 Subtracts 40 from number in Ry, ry 8.0000 Recalls copy of new ) number in Ry. J Problems ) 1. Calculate the value of x in the following equation. ) ) Answer: 4.5728 | A possible keystroke solution ) ) ) ) ) 2 Use constant arithmetic to calculate the remaining balance of a $1000 loan after six payments of $100 each and an interest rate of 1% per payment period. Vee eye eV Ve weeny Section 2: Memory Stack, LAST X, and Data Storage 41 Procedure: Load the stack with (1 +i) and key in the initial Joan balance. Use the following formula to find the new balance after each payment: ‘New Balance = (Old Balance) x (1 +3)) - Payment Answer: 446.3186 Store 100 in Ry. Then: Divide the contents of Rs by 25. Subtract 2 from the contents of Rs. Multiply the contents of Rs by 0.75. Add 1,75 to the contents of Rs. ;. Recall the contents of Rs. Answer: 3.2500. yee Section 3 Numeric Functions ‘Your HP-11C's numeric function set enables you to perform a wide range of operations involving number alteration, math, and statistics. Each function is used in the same way for both keyboard and program execution. Pi Pressing [f] (=) places a 10-digit approximation of the value of pi (3.141592654) in the displayed X-register. If the stack is not disabled, pressing [7)/F] causes the stack to lift, Number Alteration Functions In addition to (CHS) (refer to page 17, Negative Numbers) your HP-11C has four functions for altering numbers: tn), (FRAC), and Absolute Value. Pressing (J) (A853) changes the number in the displayed X register to the absolute value of that number. Integer Portion. Pressing (@] (INT) replaces the number in the displayed X-register with its integer portion, that is, it replaces all digits to the right of the decimal with zeroes. Fractional Portion. Pressing [7] replaces the number in the displayed X-register with its decimal portion, that is, it replaces any digits to the left of the decimal with zeroes. Rounding. Pressing [3] {RND) rounds the internally held 10-digit mantissa of any displayed value to the number of digits specified by the current [Fix], [SCI], or [ENG] display setting. Example i To Calculate Keystrokes | Display Absolute value 712,345 12,345.0000 Integer portion 123.4567 123.0000 , ) ) Section 3: Numeric functions 43 Example i To Calculate Keyatrokes Display | Fractional portion 123.4567 123.4567 0.4567 | Round (Assumes (FX) 1.23456789 | 1.23456789 | display setting.) (3 (ND) 1.2346 Inspect rounding. (FXs 1.23460000 Reset to (FX) 4. 1.2346 One-Number Functions ‘The HP-11C’s one-number math functions have the following characteristics: * Use the number in the displayed X-register as the argument for the function. © Replace the number in the displayed X-register with the result of executing the function. ® Do not affect numbers in the Y-, Z-, and T-registers. General Functions Reciprocal. Pressing [777}calculates the reciprocal of the number in the displayed X-register, thats, it divides 1 by the number in the displayed X-register. Factorial and Gamma. Pressing! Gamma value as follows: 1, Factorial. When executed with a nonnegative integer n (0.< n < 69) in the displayed X-register, [zi]calculates the factorial of n, that is, it calculates the product of the integers from 1 to n. 44 Section 3: Numeric Functions 2 Gamma Funetion. key can also be used to calculate the Gamma funetion, denoted by T(x), which occurs in certain problems in advanced mathematics and statistics." Pressing [x1] gives you (x +1), To ealeulate the Gamma function of a number, subtract 1 from the number. Then, with the result in the displayed X-register, press (La). Square Root. Pressing [| calculates the square root of the number in the displayed X-reyister. Squaring. Pressing (7)[] calculates the square of the number in the displaved X-register. Keystroke To Calculate Example Display Reciprocal 25 0.0400 | Factorial 8 8 | at 40,320.0000 Gamma 27 27 {eureR) 1] 1.7000 i OB 1.5447 Square Root 39 3.9 1.9748 ‘Square 123 12.3 [ea] 161,2900 _— “Cilean be used for both the Factorial and Gamma functions because when x is ‘nonnegative integer n, Ns +1) = T\n +1) snl. The Gamma function can beregarded ‘enralization ofthe Factorial fonction, since the number in the X-register isnot l to nonnegative integers. Conversely, the factorial function can be regarded as 9 special case of sma function, weve wees eV EEL Section 3; Numeric Functions 48 Trigonometric Operations The six basic trigonometric functions operate in the trigonometric mode you select. Trigonometric Modes. Selecting a specific trig mode does not convert any number already in the calculator to that mode. Selecting a specific trig mode is simply telling the calculator what, unit of measure (degree, radian, or grad) to use when executing a ‘trig function. Pressing (3) selects the Degree trig mode. No annunciator appears in the display. Pressing [@](RAD) selects the Radian trig mode. While [HAD mode is set, the RAD annunciator appears in the display. (aRAD) 9.0000 Pressing (3) [GAD) selects the Grad trig mode. Whi mode is set, the GRAD annunciator appears in the display. (ay(gRD} ‘The calculator is always set to one of the three trig modes. Continuous Memory maintains the last trig mode eclected, oven when the calculator is turned off, then on again. If a power loss. occurs, or if you reset Continuous Memory (refer to page 20), the calculator will automatically reset to (DEG}mode. ‘Trigonometric Functions. Pressing Calculates sine are sine cosine are cosine tangent are tangent 46 Section 3: Numeric Functions ‘To use any of the trig functions, ensure that the calculator is set to the desired trig mode ((BEG), [RAD], or then execute the desired trig funetion. Keystroke . ToCalculate Exempla Display (Examples assume [EG] trig mode.) All Trig functions, for example: Sine 335 1 33.6 (SIN) 0.6519 Arc Sine 7982 0.7982 @sw) 52.9586 —_ = Time and Angle Conversions Numbers representing time or angles are interpreted by the HP-11C in a decimal or minutes-seconds format, depending upon the conversion being executed: Hours.DecimalHours | Hours.Minutes Seconds Decimal Seconds (Huh) (H.MMSSs) or Degrees Minutes Seconds Decimal Seconds (0.MMSSs) Hours (or Degrees), Minutes, Sec- onds Conversion. Pressing [7] —— (SMS) converts the number in the H.h~H.MMSSs displayed X-register from a decimal or hours (or decimal degrees) format to D.d~D.MMSSs an hours (or degrees), minutes, sec: ———— onda, decimal seconds format. ~vve~ Section 9; Numeric Functions 47 Decimal Hours (or Degrees) Conver sion. Pressing [3] [SH] converts the number in the displayed X-register from an hours (or degrees), minutes, seconds, decimal seconds format to decimal hour (or degrees) format. H.MMSSs —H.h or D.MMSSs ~D.d Degrees/Radians Conversions and functions are used to convert angles between decimal degrees and radians (D.d — Rr and Rr ~ Dd). Degrees to Radians Conversions. Pressing converts, the number in the displayed X-register from a decimal degree value to its radian equivalent, Radians to Degrees Conversion. Pressing [3] converts the number in the displayed X-register from a radian value to its decimal degree equivalent. Example TeConvert Keystrokes Decimal hours (H.h) | ‘or degrees (D.d}t0 H.MMSSs or D.MMSSs format 17.553 17.553 Pras) 17.3311 To view decimal seconds white in [FIK]}4 setting, pres (O(REFX) 1733108000 17.3311 H.MMSSs or D. MMSSs j to decimal hours (H.h) | ‘or degrees (D.d) format. 12.3045 12.3045 | Geax 12.5125 Degrees to Radians 405 40.5 (RAD? 0.7069 | Radians to Degroos 1.1746 1.4746 | ene) 67.2996 48 Section 3, Numeric Functions Logarithmic Functions Natural Logarithm. Pressing (9) (EN) calculates the natural logarithm of the number in the displayed X-register, that is, the logarithm to the base ¢ (2.718281828) of the number in the displayed X-register. Natural Antilogarithm, Pressing (J calculates the natural antilogarithm of the number in the displayed X-register, that is, it raises ¢ (2.718281828) to the power of the value in the X-register. calculates the common X-register, that is, the Common Logarithm, Pressing (7) logarithm of the number in the display: logarithm to the base 10. Common Antilogarithm.,, Pressing (105 calculates the common antilogarithm of the number in the displayed X-register, that is, i raiges 10 to the power of that number. Example . To Calculate Koyst Display Natural Log 45 45 om 3.8067 Natural Antilog 3.4012 3.4012 30.0001 Common Log 12.4578 1.0954 Common Antilog 3.1354 3.1354 1,365.8405 Hyperbolic Functions Hyperbolic sine /sinhy Inverse hyperbolic sine (sinh?) Hyperbolic cosine (cosh) Section 9: Numeric Functions 49 Calculates Inverse hyperbolic cosine (cosh ') Hyperbolic tangent /tanhy Inverse hyperbolic tangent (tanh!) — Example | To Calculate Keystrokes | Display All hyperbolic functions; for example: Hyperbolic sine 2.53 6.2369 inverse hyperbolic sine 1.95 195 GIGYPISN)| 1.4210 Two-Number Functions Your HP-11C’s two-number math functions use the values in the displayed X-register and in the Y-register to calculate a result. To use any of these functions, key in the Y-register value first, press to lift the value into the Y-register, key in the diaplayed ‘X-register value, then execute the function. Exponenti Pressing (3) raises the number in the Y-register to the power of the number in the X-register. To Calculate ca Display Exponential 2 “2.0000 | 3 w 8.0000 Percentages Percent. To find a specified percentage of a number: 1. Key in the base number. 2. Press [ENTER]. 8. Key in the percent rate, 4. Press (5). BO — Section 3: Numeric Functions ™ zs Yo 160 | 160 160 xX ["i50 | 150 265 375 Keys> 150 25 we LAsTX> ‘The percentage will appear in the displayed X-register, the base ‘number will remain in the Y-register, and the percentage rate will, be placed in LAST X. The stack does not lift, so any values held in the Z- and T-registers before pressing [9 |[%] will remain. The above illustration shows the use of the [%) key to calculate 25% of 150. Percent Difference. The function calculates the percent difference—the relative increase or decrease—between two num- era. To find the percent difference: 1. Key in the base number (typically, the number that occurs first in time). 2. Press (ENTER). 3. Key in the second number. Using the above order of entry, a positive result signifies an increase of the second number over the first; a negative result signifies a decrease of the second number below the first. The preceding illustration shows the use of [A%to calculate the percent. Section 3: Numeric Functions 51 increase realized between 150 (the base number) and 225 (the second number in time). Example a | To Caloulate Keystrokes Display Percent Base Number | 200.0000 Percent Rate 75 | 76 Percentage we) | 150.0000 Percent Difference i | Base Number 40 (ENTER) 40.0000 | Second Number 160 160 | Percent Increase es) 300.0000 uN aL oat —__ Polar-Rectangular Coordinate Conversions Two functions ($F), (A]) are pro- vided in your HP-11C for polar/ rectangular coordinate conversions. Angle @ is assumed to be in decimal degrees, radians, or grads, depending upon which trigonometric mode ((DEG), [RAD], or (GRD) the calculator is set to. Angle 6 is measured as shown in the illustration to the right. ‘The answer returned for dis between 180° and —180°, Polar Conversion. Pressing @] T» [71 ]—» [7 (SE) (polar) converts values inthe X- > t and Y-regiaters representing rectan- [2 }— gular coordinates (x, y) to polar Y¥> @ coordinates (magnituder, angle 4). X=» | ol Keys (JF) $2 Section 3: Numeric Functions Rectangular Conversion. Press. ing (rectangular) converts To [7 ]—» values in the X- and Y-registers 7 y [— representing polar coordinates (mag: ~ nitude r, angle 0), to rectangular Y*| ¢ x> ae EI: -F] coordinates (x, ¥) Keys (GH) sonvert Example . | TeConvert Keysroves | Play | Rectangular coordinates to polar: ly 5 [ENTER] r 6 Polar coordinates to rectangul a 30 [ENTER] 30.0000 Door 12 12 * ole) 10.3923 y 6.0000 Probability Permutation. Pressing [Z)[P.x| calculates the number of possible arrangements of y different items taken in quantities of x items at a time, where different orders of the same x items are counted separately. (No item occurs more than once in an arrangement.) Jealculates permutations by the following formula: yt we yr at Section 3: Numeric Functions 53 Combination. Pressing [@) calculates the number of possible sets of y different items taken in quantities of x items at a time regardless of order (where no item occurs more than once in & set). (Gx) calculates combinations by the following formul: y xMy—2)! To execute a permutation or combinatic 1. Key in the number of items (y). 2. Press (ENTER). 3. Key in the quantity of items required (x) per arrangement or or GC] or (9 )(Cyr] LASTX ‘The result, p or c, will appear in the displayed X-register, the stack will drop, and the quantity per arrangement or set (x) is placed in the LAST X register. i , All permutation and combination inputs must be non- ive integers. Note: The execution times for (Fizz) and (Eizx) calculations can be several seconds or longer, depending on the magnitude of your y and x inputs. The maximum value you can input for a [Fix] or calculation is 10° — 1, The running message will flash in the display during execution of (EesJand (GxysJeatculations, 64 — Section 3: Numeric Functions vy) Section 3: Numeric Functions 88 yyy — Example Random Number Example To Calculate Kevetrones Display Yi) | Gonaration _ Keystrokes | Permutation yoy To store 0.5764 as a Example: 10 items random number seed: arrangements of 3 at yoy 0.5764 atime. 10 (ENTER) 10.0000 3HEna) 720.0000 yo 0.8764 Combination ) Example: 10 items in 7 number series based on sets of 3 at a time. 10 [ENTER] 10.0000 yyy the above seed: (RANA) 0.3422 3fa)[onx 120.0000 9 (O(RANE) 0.2809 Statistics Functions yo) yo) ndom Number r Random Number Generator ; ) For a further discussion of the random number generator, refer to ‘The HP-11C’s random number generator uses either an auto- ) page 217, Random Numbers, in part II[ of this handbook. matically stored seed (zero), or a seed you key in, to initiate a uniformly distributed pseudo-random number sequence in the > range 0 failure occurs, the random number seed is set to zero. (Repeated use of the same value for a random number seed will produce dp) repetitions of the eame random number sequence.) 15 3 remaining in Rp through Rs from previo IS OF storage operations will be included in *Passen the spectral test (Knuth, Vol. 2 yy) subsequent statistics accumulations. To ensure that all ee : . ‘ accumulations registers are set to zero before beginning a A eee tnt winelen aeleeareclgifenetnian Fonewennle dy} > new series of accumulations, press [f] CLEAR [3] (clears Ro 1249, 123, and 0-128 would all bestored as 0.123 by VANE " 15 through Rs and the stack) before beginning the operation. Mo) 56 Section 3: Numeric Functions When you press the [z]key, the following statistics are placed in the indicated data storage registers: Register Contents Ro m7 _ Number of data points (pairs) accumulated. (1 also appears in the displayed X-register.) Ry Xx | Summation of x values Ro ‘3x? | Summation of squares of x values, Rs Ey_ Summation of y values. Ry Zy? : Summation of squares of y values. Rs Sxy : Summation of products of x and y values. When you execute [Z=], the number previously in the X-register is placed in the LAST X register and the updated n-value is placed in X. The number previously in the Y-register is not changed. BHA zele | Yoel | xo[e] Le] Keys> Ge LASTX When you key in a new number, the n-value in the displayed X- register will be written over; the stack does not lift. If your statistics problem involves only one variable (x) instead of two (x and y), ensure that the Y-register holds for each execution of the (Z=) function. (Pressing [f] CLEAR [3] once, just before beginning a new accumulations series, ensures a clear Y- register for a one-number series by clearing the stack as well as the E registers (Ry through R;). Some sets of data points consist of a series of x-values (or y-values) that differ from each other by a comparatively small amount. You can maximize the precision of any statistical calculation involving M “we Section 3: Numeric Functions 57 such data by keying in only the differences between each value and a number approximating the average of the values. This number must be added to the result of calculating Z, 3, or the y-intercept of LR. For example, if your x values consist of 665999, 666000, and 666001, you should enter the data as ~1, 0, and 1. If afterwards you calculate X, add 666000 to the answer. In some cases the calculator cannot computes, r, L-R., or 9 with data values that are too close to each other; and if you attempt to do ao, the calculator will display Error 2. This will not happen, however, if you normalize the data as described above. Note: Unlike storage register arithmetic, the (Zs) and (E=) ‘operations allow overflow to occur in storage registers Ro through Rs without indicating Error 1 in the display. You can recall any of the statistics accumulations to the displayed Xregister by pressing nd the number of the data storage register holding the desired statistical accumulation. If. recall both the 3x and Sy statistics, press simultaneously copies Ex from R, into the displayed X-1 copies Zy from Rs into the Y-register. (Preasing | stack to lift in the same way that it would if you keyed in two numbers in sequence.) Example. Electrical energy re- searcher Helen L Voltz suspects a possible relationship between the rise in worldwide coal production in the years 1972 through 1976 and a similar rise in worldwide electricity output for the same period. To assist in a study of the data, Voltz will use her HP-11C to accumulate the coal production and electrical output sta- tistics. Find 3x, Yx?, xy, Ey’, and Exy for the paired x and y values of Voltz’s data. ‘ion meric Functions , ‘Year 1972 | 1973 | 1974 | 1975 | 1976 i > Key the incorrect data pair into the X- and Y-registers. Coal Production (y) 1.761 | 1.775 | 1.792] 1.884 | 1.943 yy Press [Z—to delete the incorrect data, {Billions of Metric Tons) yoy Key in the correct values for x and y. Ifone value of an (sx, ¥) Electricity Output (x) 5.552 | 5.963 | 6135) 6.313 | 6.713 data pair is incorrect, you must delete and re-enter both {Billions of Megawatt Hours) yoy values an 4. Press yyy | yoy Keystrokes Display Note: Although [@][S=] can be used to delete an erroneous (@cueaR Cz) 0.0000 Clear statistical data dy (x, y} pair, it will not delete any rounding errors that may have Siorage ropintere (Re ity ‘occurred when the stotistics of that pair were added into See ond ote, accumulating registers Ry through Rs. Consequently, 1761 1.7610 ) y subsequent results may be different than they would have been if the erroneous pair had not been entered via 5.552 1.0000 1972 data. 9 then deleted via However, the difference will not be 1.775 (ENTER) 1.7760 serious unless the erroneous pair has a magnitude that is 5.963 (E+) 2.0000 1973 data y ) enormous compared with the correct pair: and in such acase: 4.792 (ENTER) 1.7920 it may be wise to start over again and re-enter the data again 6.135 (2+) 3.0000 1974 data ie) {and more carefully!) 1.8840 4.0000 1975 data dy > 19430 yf y Example. After keying in the preceding data, Voltz found new 8.0000 1976 data } information aca erat fre coal onu as last data pair 30, +) should have been 1.946 instead of 1.943. Use [=] to remove the 0.6760 on nef ee (Ex) from > statitical data that was accumulated as a result of using the older, 1 incorrect data pair. The it the ct i 188.9386 Sumof squares of x values > att Then input the correct data pair (Sx!) from register Ro, yy) Keystrokes Display 9.1550, Si f il om of y valuon (Sy) from yh 1.943 1.9430 Key in the data pair we register Ra, “ 6.713 4.0000 want to replace and delete 16.7877 Sum of squares of y values rt» the pair’s unwanted (29°) from register Ry. statistics. Number of pair 56.2924 Sum of products of x and y 7) entries then drops to 4. ane (Sxy) from register ) ) og (ENTER) 1.9460 Key in and accumulate 7 13 5.0000 the replacement data pair. vty ‘Number of pairs Correcting Statistics Accumulations. accumulated is again five, If you discover that you have entered data incorrectly, the Sy Retain the preceding statisti accumulated statistics can be easily corrected. yo followingexamples. salentator for use in the Jo 60 Section 3: Numeric Functions Mean ‘The (¥] function computes the artithmetic mean (average) of the x and y statistics accumulated in registers R, and Ra, respectively. When you press (3J(2): 1. The contents of the stack registers lift in the same way as when you press [RCL][Z+1], as described on page 57. 2. The mean of the x values (2) is calculated using the statistics accumulated in Ry(2x) and Ro(n). The mean of the y values @) is calculated using the data accumulated in registers Ra(Sy) and R,(n). The formulas used are shown below, 2 n p= 3. The values for % and 5 are placed in the X- and Y-registers of the stack. t+ (_] ze] yo Ti xe [EF ] Example. From the five year statistical data you accumulated (and corrected) in the previous example, calculate the average coal production and electrical output for the entire period. Keystrokes Display 6.1362 Average electrical output (average of X-register inputs) for the five-year period, Average coal production (average Y-register inputs) for the five-year period. rep 1.8316 vee ) ) ) ) ) ) ) > Section 3: Numeric Functions 61 The illustration below shows what happens in the stack when you execute [i] (assumes stack disabled, as it would be following a [3+] operation): lost Te Le] z z+] ¥ yoy] 7 xe [ed BL _ ~ lost Retain the preceding statistics in your HP-11C for use in the next example. Standard Devi Pressing [7] [5] computes the standard deviation (a measure of dispersion around the mean) of the accumulated statistics data. ‘The formulas used by the HP-11C to compute s,, the standard deviation of the accumulated x values, and a,, the standard deviation of the accumulated y values are: Gx? mn=1) nix? Fe ndy nD ‘These formulas give the best estimates of the population standard deviations from the sample data. Consequently, the standard deviation given by these formulas is termed by convention the sample standard deviation. When you press (3(s): 1. The contents of the stack registers are lifted in the same way as they are when you presa described on page 57. 2. The standard deviation of the x values (s,) is calculated using the data accumulated in registers R, (2x*), R, (Ex), and Ro (n) according to the formula shown above. The resultant value for s, is placed in the X-register. 62 Section 3: Numoric Fur ions 3 The standard deviation of the y values (s,) is calculated using the statistical data accumulated in registers Ry(Sy2), Ray), and Re(n) according to the formula shown above. ‘The resultant value for s, is available in the Y-register. Example, Calculate the standard deviation for the corrected coal production and electrical output accumulations used in the previous examples. Keystrokes Display mo 0.4287 Standard deviation of electrical output (X- register inputs) for the five year period. 0.0800 Standard deviation of coal production (Y-register inputs) for the five-year period. Retain the preceding statistics in your HP-11C for use in the next example. ‘When your data constitutes not just a sample of a population but rather ali of the population, the standard deviation of the data is ‘the true population standard deviation (denoted o). The formula for the true population standard deviation differs by a factor of [in — 1/n}* from the formula used for the (5) function, The difference between the values is small, and for most applications can be ignored. Nevertheless, if you want to calculate the exact value of the population standard deviation for an entire population, you can easily do eo with just a few keystrokes on your HP-11C. Simply add, using the the mean (£) of the data to the data and then pross (a) (s). The result will be the true population standard deviation of the original data. ~wee www eevee Section 3: Numeric functions 63. Linear Regression Linear regression is a statistical method for finding a straight line that best fits a set of two or more data, " pairs, thus providing a relationship between two variables, Afier the statistics of a group of data pairs has been accumulated in register Ry through Rj, you can caleulate the | __ coefficients in the linear equation y = Ax + B using the least squares method by pressing (1) To use the linear regression function on your HP-11C, use the (22) key to accumulate the statistics of a series of two or more data pairs. Then execute (CA). When you press [7] 1. The contents of the stack registers are lifted just as they are when you press 2. Theslope(A) and the y-intercept (B) of the least squares line of the data are calculated using the equations: dydxt— ee xey nxx?— (sx)? ‘The slope A is placed in the Y-register; the ™ yintercept, B, is Qa) — 2 placed in the dis- a Y> [slope(4y played X-register. X=» [y-intercept (B) Example: Calculate the y-intercept and slope of Voltz's corrected data. Solution: Voltz could draw a plot of coal production against electrical output, like the one in the following illustration, However, with her HP-11C, Voltz has only to accumulate the statistics (as we have already done) using the [=] key, then press 84 — Section 3: Numeric Functions Coal Praduction Billions of Metric Tons) 20 ete 18 WwW 55 60 65 7.0 Electrical Output (Billions of Megawatt Hours} Display 0.7773 Y-intercept of the line. 0.1718 Slope of the line. Retain the preceding statistical accumulations in your calculator for use in thenext example, Linear Estimation and Correlation Coefficient When you execute the [Fii]function, the linear estimate (3) is placed in the displayed X-register, and the correlation coefficient r is placed in the Y-register. Linear Estimation. With statistics accumulated in registers Ry through Ry, an estimated value for y (denoted ¥) can be calculated by keying in a known value for x and pressing (f)Li1). wwuuen wee ee Section 3: Numeric Functions 66 ST i 4 3 wa, (45,20) 7740,)) Y 2 A73.0,20) ; / Us 1.0) fp 1 2 a 4 5 6 7 An estimated value for x (denoted 2) can be calculated as follows: 1. Press (EE. 2. Key in the known y-value, 3. Press exy|[=]GayIG). Correlation Coefficient, Both linear regression and linear estimation presume that the relationship between the x and y data values can be approximated, to some degree, by a linear function that is, a straight line). The correlation coefficient (r) is a determination of how closely your data “fits” a straight line. The correlation coefficient can range from +1 to 1 Atr=+1 the data falls exactly onto a straight line with positive slope. Atr = 1, the data falls exactly on a straight line with negative slope, At 7 = 0, the data cannot be approximated at all by a straight line. With statistics accumulated in registers Ry through Rs, the correlation coefficient r is calculated by pressing [f) [ix]. The number that appears in the displayed X-register will be a y value (meaningless, unless you keyed in a specific x-value, as described above). To view the correlation coefficient value (7), exchange the contents of the X- and Y-registers by pressing (7 5.) 66 Section 3: Numeric Functions Recall from the discussion of LAST X in section 2 that (iJ, (3), and {LR} do not place a copy of the x-value in the LAST X register. However, because 9 is calculated from the value in the displayed X-register, when you press [7/71 a copy of the x-value is placed in the LAST X register and the stack—in all cases—tifta only once. x + LastTx > Example. Using the statistics saved from the previous example, if Voltz wishes to predict coal production (9) for 1977, she keys in an estimate of electrical production (a “known” x-value) for 1977 and presses [F)[fir]. Because the correlation coefficient for Volta’s data is automatically included in the calculation, she can view how closel her data fits a straight line by simply pressing [x23] after the prediction appears in the display. Keystrokes Display 71417 7AaI7 Voltz's estimate of 1977 electrical output. 2.0046 Predicted eoal produetion for 1977. 0.9211 ‘The data closely approximates a straight line. d ) ) wes Section Display Control When you turn on your HP-11C, because of Continuous Memory, the display setting will be the same as it was before you last turned off the calculator. But regardless of the display options in effect, the HP-11C always internally represents each number as a 10-digit mantissa and a two-digit exponent of 10. Thus, when the calculator is set to display only four digits past the decimal point, the fixed constant pi, for example, appears in the display as 3.1416. However, piis always represented internally as 3.141592654 10™, 3.141592654 X 10% SS You see only these digits But these digits are also (rounded to the 4" decimal). present. Display Mode Control ‘Your HP-11C has three display modes, and (EWG), that use a variable (0 through 9) to specify display setting. The following illustration shows how the number 123,456 would be displayed by a 4-digit setting in each of the three modes. (HEX) 4: 123.456.0000 (iSc] 4: 1.2346 08 (HIENG)}4: 123.46 03 Fixed Decimal Display (fixed decimal) displays numbers using a fixed decimal mode without 34.567890 exponents. In any [FixX} display set a tc ting, the calculator will automa f ~~ cally switch to (SCi) mode to allow sign of TO-digit viewing of a displayed number that number number is too large or too small to be viewed in the current (FIX) mode. The calculator will automatically switch back to the specified [Fix] mode when a number is displayed that can be viewed in that particular [Fix]mode display setting. 67 68 = Section 4: Display Controi Fixed decimal display is selected or modified by pressing [7] followed by the appropriate number key to specify the number of decimal places (0 to 9) to which you want the display rounded. Keystrokes Display 123.45678 (ENTER) (123.4868 Display is rounded to four decimal places. However, internally the number is intaii original 123.486780 ‘The display is rounded upward if the first undisplayed digit is 5 or greater. 123. 123.4568 Usual [FIX]4 display. Scientific Notation Display (ecientific) displays numbers in scientific notation mode. To select or modify a [SCI] mode, press [F)[Sci] followed by the number key (0 through 6) that specifies the number of decimal places you want the display rounded to. For display rounding, 7, 8, and 9 can also be used, but no more than ix digits can be displayed to the .234667-11 AF Sign of 7-digit Signof Exponent number mantissa_—_-Exponent Keystrokes Display 123.4567895 123.4568 Display is rounded to 4 decimal places. Miscl2 1.23 02 1.23 10% display rounded down. 9 are stored in program memory a8 (SU)) and {ERC wwe Section 4: Display Contro 69. Keystrokes Display sens 1.2346 02 1.2346 10% display rounded up. Gals 1.234568 02 1.234568 x 10% display rounded up. As indicated in the above examples, display rounding occurs on the last decimal place you specify when you place the calculator in mode. Specifying more than six digits to the right of the deci, ‘will not increase the number of digits displayed to the right of the decimal beyond six. However, specifying seven or more to the right of the decimal will move rounding into the digits (held internally) that follow those allowed by the largest (SCi] display. Using the display remaining from the previous example, the following operation does not increase the number of digits in the display, but does move rounding beyond the displayed digits.* Keystrokes a Display 1.234567 02 Rounding occurs at seventh decimal place; display cannot show seventh decimal place in mode, so no rounding occurs in the display. Rounds to 8" decimal place. No change in displayed digits Rounds to 9*" decimal place. No change in displayed digits. 1.234567 02 1.234667 02 + 1foneor more trailing "sexist internally following the leat digit allowed inthe display ‘setting, rounding may be propagated in the displayed digit for (Sci) 7 and 8 dinplay settings. For example, 100000094 in [SEI] 7 will not couse rounding in the displayed ‘Version of the number, but 1.000095 (..95 to. 99) i [SCI]? will eause rounding in the Alsplayed digit. 70 Section 4: Display Controt Engineering Notation Display (ENG) /engineering) displays numbers in an engineering notation format that operates the same as [SCi]notation format except: * Engineering notation shows all exponents in multiples of three. © The number of digits specified for the display setting refers to the number of significant digits you want to appear after the leading digit. 12,34567-09 Signof 7-Digit. —Signof__ Exponent Number Mantissa Exponent In engineering notation, the first significant digit is always present in the display. The number key you press after (1) [ENG] specifies the number of additional significant digita to which you want the display to be rounded. For example: Keystrokes Display 012345 0.012345 (ENG) 12. -03 Engineering notation. play is rounded to one significant digit after the leading digit. Power of 10 is proper multiple of three. (ENE)3 12.38 -03 Display is rounded to third significant digit after the leading digit, CENa)s 12.34500-03 (HleNsjo 10. -03 Display is rounded to firet significant digit. Notice that in (ENG) display mode the decimal automatically shifts to maintain the exponent of 10 as a multiple of three, as in the case of the following example: Section 4: Display Control 71 Keystrokes: Display Wins2 12.3. -03 Display from previous example changed to| 2 format. 10) 123. -03 Decimal shifts to maintain multiple of 3in exponent. Keying In Exponents (FER) enter exponent) is used whenever an exponent is part of a number you are keying in, To use [EEX], first key in the mantissa, then press (EEX] and key in the exponent. For example, divide ‘95,600 by Avogadro's number (6.0222 x 10° kmol 1): Keystrokes Display @mms Reset to [FIK]}4 display mode. 95600) 195.600.0000 6.0222 6.0222 (x 6.0222 00 The 00 prompts you to key in the exponent, 26 6.0222 26 (6.0222 x 106) a 1.5875 -22 kmol To key in a number having a negative exponent of 10, first key in the number and press [EEX], then press (CHS)(change sign) to make the exponent negative, and key in the exponent, For example, key in Planck’s constant (6.6262 x 10-™ Joule-seconds) and multiply it by 50: Keystrokes Display 6.6262 [EEX] 6.6262 00 (Gs) 6.6262 -00 3 6.6262 -03 4 6.6262 -34 (Eres) 6.6262 -34 50/5) 3.3131 -32 Joule-seconds. Note: Decimal digits keyed into the exponent field will disappear from the display when you press (EEX), but will be retained internally. 72 Section 4: Display Control (EEX will not operate with a number having more than seven integer digits or a decimal number having more than five zeros preceding the first significant digit. To key in such a number, use a form having a higher or lower exponent value, as appropriate. For example, 123456789.8 X 10” can be keyed in as 1234567.898 x 105, 0.00000025 x 10"! can be keyed in as 2.5 x 10°. Mantissa. All numbers held in the calculator’s stack and data storage registers are represented internally as 10-digit mantissas with a two-digit exponent. When you want to view the full ten-digit mantissa of a number held in the displayed X-register, press [7] CLEAR (PREFIX) and hold the [PREFIX] key. The mantissa of the currently displayed number wil] appear and remain in the display until you release the [PREFIX] key Keystrokes Display 3.1416 (OCLEAR (PREFIX) {hold) (3141592654 Rounding at the Tenth D ‘As you read earlier, your HP-11C holds every value to 10 digits internally, regardless of the number of digits specified in the lisplay setting. The final result of every calculation or series of calculations is rounded to the tenth digit For example, pi and 2/3 have nonterminating decimal representa- tions (3.1415926535... and 0.6666666666...) Because the HP-11C can provide only a finite approximation of such numbers (10 digits), a ‘small error due to rounding can occur in the tenth digit. This error can be increased through lengthy calculations, but in the majority of cases, it does not enter the practical range of significant digits for a particular application. Accurately assessing the effects of roundoff error for a given calculation requires the use of numerical analysis methods that are beyond the scope of this handbook. | Part II HP-11C Programming Section 5: Programming Basics 75 does not affect the display or your keyboard operations. For this Section 5 | reason, you need be concerned only with: Programming Basics ) 1. What causes reallocations, and 5 2. What happens in memory when a reallocation takes place. The Basics In Brief vi When program memory is cleared, or when Continuous . Memory is reset, the calculator’s memory configuration is 20, What Is a Program? ) data storage registers (plus the L-register) and 63 lines of A program is a sequence of keystrokes that is remembered by the y available program memory. calculator. You can execute a given program as often as you like— with just one or two keystrokes. The stack responds to instructions } in a running program in exactly the same way it responds to an HP-11 MEMORY CONFIGURATION identical set. of instructions executed from the keyboard. The ) Permanent Memory answer displayed at the end of program execution is likewise the same as the one you would obtain by executing the instructions dy} 3 a [] — [00- from the keyboard. No prior programming experience is necessary y) 3 0012 tolearn HP-11C programming. ) . ) z Why Write Programs? | se Programs save you time on repetitive calculations. Once you have >) 3 written the keystroke procedure for solving a particular problem ty 063— and recorded it in the caloulator, you need no longer devote attention to the individual keystrokes that make up the procedure. | You can let the calculator solve each problem for you, And because you can easily check the procedure in your program, you have more | ) Shared (Convertible) Memory—Initial Configuration Zero Additional 20 Data Registers Program Lines confidence in your final answer since you don't have to worry each time about whether or not you have pressed an incorrect key. ‘The following information covers the operation of your HP-11C’s programming features. For guidelines that can help you in planning and developing your programs, refer to page 206, Structure, in part II! of this handbook. Program Control Automatic Memory Reallocation ‘The HP-11C’s reallocation of memory space between program memory and data storage is controlled automatically by the yf) calculator. Because of this internal control, memory reallocation (UU TT 7 76 — Section $: Programming Basics. ‘As instructions are keyed into program memory, they are stored sequentially in the available space. If ail 63 lines of the initial program epace are already occupied and you key in a 64" program instruction, data storage register R gis automatically reallocated to seven more lines of program memory to make room for the new instruction (plus up to six more), The HP-11C'’s memory configuration would then be 70 lines of program memory and 20 data storage registers, Keying in a 71" program instruction automatically reallocates storage register R.g to seven additional lines of program memory. This pattern can he repeated until all 20 convertible data storage register (Rg through Ro, Ry through Ry) have been reallocated to program memory. If all convertible data storage registers are reallocated to program memory, the memory configuration will be 203 program lines and one data storage register (the Index—R,—register). The following table shows the allocation of the lines of program memory to their respective storage registers. Ry 064-070 Ry 134—140 Rg 071-077 R, 141-147 R, 078-084 R, 148-154 Re 085—091 Re 155-161 Ry 082-098 R; 162—168 Rg 099-105 Ry 169-175 Rs 106-112 Ry 176—182 R, 119-118 Ry 183-189 Ry 120-126 R, 190-196 Ro 127-133 Ro 197203 Storage Register /Progrem Memory Allocation Deleting lines of program memory one by one from any location in program memory causes the calculator to automatically reallocate ) Section 5, Programming Basics 77 program memory to data storage registers in the reverse of the order described above Data Storage to Program Memory Conversion Order —_—_——__—_—______» RoR gR7..RiRoRgReR; Ro —— eee Program Memory to Data Storage Conversion Order For additional text and illustrations describing Automatic Memory Reallocation, refer to appendix C, How Automatic Memory Reallocation Operates, (Mem) To display the current allocation of memory at any time in or out of program mode, press (@], then press and hold (MEM). While you hold (MEM), the calculator will display (1), the number of available program lines to fill before conversion of the next storage register and (2), the name of the next storage register to be converted. (For a more graphic coverage of [MEM] operation, refer to appendix C, How Automatic Memory Reallocation Operates. Next Register | { to Convert Available 3 Program Lines p-63 9 (MEM Display With Program Memory Cleared Keycodes and Line Numbers ‘When you place the calculator in Program mode and key in a program instruction, the keycode for the keys you pressed and the Tine number of the complete instruction will appear in the display. ‘The keycode for any program instruction will have one, two, or 78 — Section 5: Programming Basics three elements, depending upon whether the instruction required one, two, or three keystrokes. Each element in a keycode is composed of two digits that describe the row/column matrix position of the key represented by the element (except numeric keys, which are represented by a single digit element). Line \ Number v O17, 42, Key Row 4 2 1 Key Col 2 1 1 Abbreviated Key Sequences In Run or Program modes, the [F]prefix keystroke you would expect to include in the keystroke sequences for some instructions is not needed. (An unnecessary (f} prefix keystroke pressed as part of a program instruction will not appe: ‘the keycode for that instruction.) For example, pressing will produce the same results as pressing (STO) [1] References to other keys that can be used in abbre ‘key sequences are included in the appropriate sections. Program Control Functions Program/Run. Pressing [9] switches the calculator between Program and Run modes. When the calculator is in Program mode, the PRGM annunciator appears in the display and program instructions can be inserted or deleted. In Run mode either programs stored in program memory or individual keyboard functions can be executed. Clear Program Memory. Pressing [I] CLEAR in Program mode clears all programs from Continuous Memory and auto- matically reallocates Continuous Memory to 21 data stora; registers and 63 lines of available program memory. Pressing CLEAR ‘in Run mode resets the calculator to line 000 but does not clear program memory. Section 5 Programming Basics 79 Go to Line 000. Pressing [GTO] [7] 000 in Program or Run mode sets the calculator to line 000 (top of program memory). Labels. The HP-11C’s labels are addresses for programe, program branches, and program subroutines. The alphs labels ((A] through [E)) and the numeric labels (0 through 9) are keyed into program memory by pressing (1) numeric key. With the calculator in Run mode, a program addressed by an alpha label is executed by preasing the [i)shift key and the label key. Labels 0 through 9 can also be used to address programs, but are usually reserved for program subdivisions (branches and subroutines). Numeric labels can be executed by pressing [G58] and the desired number key. Return, The (return) instruction, when used to end a program, causes program execution to tranafer to line 000 and halt. Run/Stop. When encountered in a running program, [R75] (Run/Stop) causes program execution to halt. When a program is halted, pressing [A/S] causes program execution to begin with the line of program memory the calculator is currently positioned to. Pause. When {i][PSE](pause) is encountered in a running program, execution halts temporarily (approximately one second) to allow viowing of the number currently in the displayed X-register. Program execution then resumes. User Mode User mode is a convenience feature you can use to save keystrokes during program operations. Pressing [1] (USéa) exchanges the primary math and the alternate [7] prefix alpha key assignments on the calculator’s top row keys, While (USER) mode is set, the USER annunciator appears in the display. (USER! 0.0000 mp ws mono : Primary ited) & 1.) (@)prefix > x? LOG % a% In Run mode, this exchange enables you to execute any programs labeled [A] through [E) by pressing only the appropriate alpha 80 Section 5: Programming Basics function key instead of having to first press the { Note: To avoid inadvertently executing or programming a wrong function, User mode should be activated only when specifically desired. ‘To deactivate User mode, preas ()(USER) again. Program Memory ‘As you may remember from the heat loss program you keyed in at the beginning of this handbook, the keystrokes used to calculate a solution manually are also used when you write a program to calculate the solution automatically. These keystrokes are stored in the calculator's program memory. Press (GTO) [-]000 now to return. the calculator to the top of program memory. If you have not already done so, set the calculator to Program mode by pressing [3] P7A]. (Remember, whenever the calculator is in Program mode, the PRGM annunciator will be visible in the display.) The display should now show 000-, which is the top of (program) memory marker. |<-Top-of-Memory Marker “Downward” in Program Memory 7 063- |< Minimum Program Line Allocation 202- 203- J<€- Maximum Program Line Allccation Program memory is separate from the stack, LAST X, R;, and any data storage registers that have not been converted to lines of program memory. ~~~ wees Section 5: Programming Basics 81 When the calculator is in program mode, the number that you eee on the left side of the display indicates the line number in program memory to which the calculator is set. Press [f) CLEAR [PRGM), then (A)[L8L)[A)—the first keystroke of the heat lose program (page 12)— and the display will change to: 001-42,21,11 Ragemiakdeaas LineNumber-—4 A Keyeode The calculator is now set to line 001 of program memory, as indicated by the 001 that you see on the left side of the display. The other numbers in the display are keycodes for the keystrokes that have been loaded into that line of program memory. Press 3. Your display shows: o02- 3 Line Number —4 A Keycode ‘The 002 on the left side of the display indicates that you are now at line two of the program. Each line of program memory “remembers” a single program instruction, whether that instruction consists of one, two, or three keystrokes. ‘Thus, one line of program memory might contain a single-keyatroke instruction like |, while another line of memory could contain the three-keystroke instruction 6 (adds the number in the displayed X-register to the number in Rq). The keystrokes in program instructions are represented in the calculator by keycodes, Interpreting Keycodes Most keycodes for HP-11C key positions are determined by a simple row/column matrix. The key rows are numbered 1 through 4. The key columns are numbered 1 through 10. (The tenth column is represented in HP-11C keycodes as a 0, for example, “20” represents row 2, column 10, and corresponds to the (x) key. The only key positions which do not conform to the matrix code are functions assigned to the 0 through 9 digit keys. The codes for functions on these keys are simply the single digit on the face of the key, 82 Section 5: Programming Basics Leer] aotoug Bo5ae@ HEWLETT PACKARD! Keycode: A program line can consiat of one to three keycode elements. For example: 053- 23 054- 4333 055-44,40, 5 A A 4 fa (SN) @ a 5 Row 2 Row4 Row3 Row4 Row4 “S’ digitkey Col3 Col. Col.3— Col Col. 10 Let's take another look at the program instructions we just keyed in (page 81). Press (9) [BST}. Your display will now show the first line of the heat loss progra 001~42,21,11 —— es Number—* — -4___ keycode ‘The number code 001- designates the line number of program memory. The next digit pair, 42, represents [7] (row 4, column 2); 21 represents [LBL] (row 2, column 1); 11 represents [A] (row 1, column 1). In this manner all programmable keystrokes except functions assigned to digit keys are represented by a two-digit keycode. Let’s Li vee Section 5. Programming Basics = 83 ‘see an example. Press nce. Your HP-11C's display will now show the keycode for the second instruction of the heat loss Program: o02- 3 Line Number ——4 1 — Keyoode We know that 002- is the program line number, The “3” denotes, in this Keys Keycode case, the number 3. The box at the | (SAAD) + 42 3 right shows how the keycode would 3a.) 3 change when the “3” key is used with or without the (7]and [prefix keys. (IRD) + 433 The remaining keystrokes for the heat loss program are shown below with their corresponding displays. Press each key in turn and verify the keycodes shown in the display. Keystrokes Display ° 003- © TheO" digit key. 004- 20 The 2" row, 10 key. a o0s- 48 Thed'* row, 8 key. 4 006- 4 The“4” digit key. 7 007- 7 The?" digit key. wy 008- 20 The 2nd row. 10th key. By) 009- 4332 Denotes end of program. @ Sets calculator to Run mode. Programming Operations The preceding topic, keycodes, covered individual program instructions. Now let’s take some time to examine the details of a complete programming process. The following paragraph describes a new program we can create to help illustrate the steps involved in programming. If you want to manually calculate the area of a circle using the formula A = rr® you could first key in the radius r, then square it by pressing [9 [x7]. Next you would place z in the display by pressing 84 — Section §: Programming Basics (@G). Finally you would multiply the squared radius and = together by pressing [:). The resulting keystroke sequence is shown, below. Ge & Beginning and Ending a Program To define the beginning of a program use an (f) (Ai) (label) instruction followed by one of the alpha or numeric keys to specify which label. The use of labels permits you to have several different programs or parts of programs loaded into the calculator at any time, and to run them in the order you choose. To define the end of a program, you can use a (3) [TN] (return) instruction. In a running program, a {RTN] instruction used in this manner causes the calculator to immediately transfer execution to Tine 000 and halt, Program Memory (EBD begins program, instruction fa(FTN) [BTWjends program. Note: When a running program encounters the end of occupied program memory, the effect is the same as if a (9) [RIN] had been encountered. This means that if your last instruction in occupied program memory will be a[a)(TN], it ‘can be eliminated, saving you one line of memory space. wevevevevevnr weve Section 5: Programming Basics 8B The Complete Program The complete program to caleulate the area of any circle given its radius is: Assigns name to and defines beginning of program. Squares the radius you input (stack does not lift or drop). OG) Summons = into the display (stack lifts). Ba Multiplies the squared radius by x (stack drops) and displays answer. Defines end of program: calculator returns to line 000 and halts, Loading a Program A program can be loaded in memory ahead of or after other programa already in memory. If a new program is loaded ahead of an existing program (by going to line 000 and keying in the new instructions), the existing program will be bumped downward in memory, one line at a time, as you key in the new program's instructions ‘To prepare for loading the preceding Area of a Circle program: 1. Press (@) (F7R] to toggle into Program mode. The PRGM annunciator will appear in the display. 2. Press [F)CLEAR [BAGH] to clear program memory of previous, unwanted programs, (If you want to save a program already in the calculator, press © 000 instead of (1) CLEAR [PRGM) 000 sets the calculator to line 000 without affecting the contents of program memory.) You can tell that the calculator is at the top of program memory because the digits 000 appear at the left of the display. The keys you press to load the program to calculate the area of a circle are: Atom (all Press the first key, (J, of the program. 86 = Section 5: Programming Basics Keystroke Display a 000. You can see that the display of program memory has not changed. It will not change until you press all of the keys required for the complete instruction. Now press the rest of the keys for the first instruction. Keystrokes Display Lat, 000- @ 001-42,21,11 [i)(TBLllonded into program memory. ‘When a new program memory line number and keycode appear in the display, they indicate that a complete operation has been loaded into that line. Remember, nothing is loaded into program. memory until a complete instruction (whether one, two, or three keystrokes) has been keyed in. ‘Now load the remainder of the program by pressing the following keys. Keystrokes Display @e) 002-4311 003- 4216 004- 20 ) 006- 4332 ‘The program for solving the area of a circle given its radius is now loaded into your HP-11C’s program memory. Running a Program Programs are executed in Run mode only. To prepare to run the Area of a Circle program you loaded in the preceding example, set the HP-11C to Run mode now by pressing (3 |[P/R). To run a program, you need press {i} and the alpha key key in any required data and ‘through (E]) that labels your vee Vee SY Section 5, Progamming Basics 87 program. To run the circle area program, key in the radius data and press (1[A). Example Execution. Calculate the areas of circles having radii of 7.5 centimeters, 9 inches, and 15.3 meters: Keystrokes Display 7s0@) 176.7146 Square Centimeters 304) 254.4690 Square Inches 15.3 H(A) 738.4164 Square Meters: How the Calculator Searches For a Label. When you set the HP-1IC to Run mode, the calculator was positioned at line 005 of Program memory (the last line you filled with an instruction when you were loading the program.) When you pressed ([f) [A], the calculator began to search sequentially downward throu, Program memory, beginning with line 005, for a (LBL) instruction. When the calculator searches, it does not execute program instructions. 3 did not contain the instruction, and "7 [000— 2 No further lines of program | 001-42,21,11 memory were occupied, ! 02-4317 your HP-11C returned toline000.and | 003-4216 resumed searching downward ! 004-20 through program memory. When the 4332 caleulator found the [1] @ instruction at line 001 it then began ‘executing your program. of End of Occupied Program Memory Executing Program Instructions. The calculator executes the instructions in the order you keyed them in, performing the [8]("] operation in line 002 first, then (i) (£) in line 003, ete., until it executes a [0] [RTN) instruction, a (R/S) (run/stop) instruction, or encounters the end of occupied program memory. Since there is a inetruetion in line 005, execution returns to line 000 and halts. The result of the calculation, the value in the X-register, is 88 Section 5: Programming Basics then displayed. In programs having lengthier execution times, running will flash in the display while execution is in progress. Non-programmable Functions. When the calculator is in Program mode (PRGM annunciator displayed) almost every function on the keyboard can be recorded as an instruction in Program memory. However, the following keyboard instructions are designed for use as non-programmable functions. (OCLEAR (PRGM) wr GcLeaR (PREF) = (gIMEM) «= Ee] D(x} (o}(est) ‘User Mode Operation Let's set the calculator to User mode now and run the Area of a Circle program you just ran in the preceding example, then execute the keyboard functions affected by User mode. Keystrokes Display (USER) User Activates User mode; USER annunciator appears 176.7146 In User mode} (254.4690 [E)become the primary 735.4164 functions of their Tespective keys. 2.0000 2.7183 In User mode, the top row 10.0000 math functions become 2.0000 the alternate (f] prefix 286.0000 —_— functions of their 2.0000 respective keys, 2.0000 Deactivates User mode, Program Stops and Pauses When programming, there may be occasions when you want a program to halt during execution so that you ean key in data. Or wee eves Section 5: Programming Basi 89 you may want the program to pause ao that you can quickly view results before the program automatically resumes running. Two keys, [R73] (run/stop) and [PSE] (pause), are used for program interruptions, Planned Stops During Program Execution ‘The [75)(run/stop) function can be used either as an instruction in ‘8 program or as an operation pressed from the keyboard. When pressed from the keyboard: 1. Ifa program is running, 2. Ifa program is stopped or not running, and the calculator is in Run mode, pressing [873] starts the program running. Execution then begins with the first line of program memory following the [R75] instruction. (When [R75] is pressed and held in Run mode, it displays the line number and keycode of + that current line—when released, execution begins with that line.) halts program execution. ‘You can use these features of the (R/S ]instruction to atop a running program at points where you want to key in data. After the data has been keyed in, restart the program using the (87S) key from the keyboard. Example: Universal Tins, a can- ning company, needs to calculate the volumes of various cylindrically shaped cans. Universal would also like to be able to record the area of the base of each can before the volume is calculated. The following program calculates the area of the base of each can and then stops. After you have written down the result, the program can be restarted to calculate the final volume. The formula used is: Volume = base area x height = nr? x A 90 Section S: Programming Basics ‘The radius (r) and the height (4) of the can are keyed into the X-and Y-registers, respectively before the program is run. ‘To record this program, set the HP-11C to Program mode, then key in the following program instructions, Keystrokes Display (UCLEAR (IGM) © 000- Clears program memory and displays line 000, (BLA) 001-42,21.11 J) 002- 4311 Square the radius. OG 003-4216 Place winx. 004- 20 Calculate the area of the base, 005- 31 Stop to record the area. 006- 20 Calculate the final volume. 007- 4332 Set the HP-11C to Run mode. Then use the program to complete the table below: Keystrokes Display 25.0000 Enter the height into the Y-register. 314.1593 Key therradius into the X- register and calculate area, Program stops to display the area. R/S. 7,853.9816 Volume of first can is calculated. 8.0000 Enter the height into the Y-register, wee eve . weve ~~ Section : Programming Basics 91 Keystrokes Display 63.6173 Key the radius into the X- register and calculate area. Program stops to display the area, wes 508.9380 Second volumeis calculated. With the height in the Y-register and the radius in the X-register, pressing (1)(A] in Run mode calculates the area of the can’s base, the program stops at the first [R75] instruction encountered. Pressing lculates the volume of the ean. Program execution then returns to line 000 and halts, For a discussion of techniques for data inputs in programs, refer to page 212, Data Input, and page 217, the User-Definable Keys, in part ITI of this handbook. Pausing During Program Execution An [f) [PSE] instruction executed in a program interrupts program execution to display results momentarily before execution is resumed. The length of the pause is about 1 second, but you can use more than one consecutive {f] [PSE] instruction to lengthen the pause duration. To see how [i] can be used in a program, we'll modify the cylinder volume program in the previous example, In the new Program the area of the base will be briefly displayed before the volume is calculated. This example will also show how different programming approaches can be taken to solve the same problem. To key in the program, set the HP-11C to Program mode. Press [7] CLEAR (PRGM)}to clear program memory and display line 000. Then key in the following program instructions. Keystrokes Mctea Display 000- (NSU) 001-42,21,11 we) 002-4311 Squares the radius in X. 92 Section 5: Programming Basics d, >? Section 5: Programming Basics 93 Keystrokes Display ') 1) Unexpected Program Stops Ow) 003-4216 Places win X. V) )Attimes « mistake of some kind in your program wil stop program @ 004- 20 Calculates the area of the yh execution. To help you determine why the calculator stopped in the base. ' middle of a program, possible reasons are listed below. (Ose) 006-4231 Pauaes toshow the base ) Executing (9)(FW). Unless in a subroutine, whenever [@][ATMis area for one second. \ |) executed in a program, the calculator immediately returns to line al 008- 20 Calculates final volume of » |) a0 and halts. can. : '| ) Encountering the End of Program Memory. When the final wim) 007-4382 ) | 9 __ insizuction in program memory is not (G10, (688) [Mor (R75), ‘ j and is not in a subroutine, a running program will encounter the eee ie eituc hes heen keved into the Xeewiater Ifyou | >) td efaccuped program memory, transfer immediately to line O00 have stored the instructions, set the HP-11C to Run mode. Now an " complete the table below using the new program. ))| ) Pressing Any Key. Pressing any key halts program execution. ‘The calculator has been designed so that program execution will }) > not halt in the middle of a digit entry sequence. If you press any ) |) key while a numbor is boing placed in the X-rogistor by a running program, the entire number will be “written” and the following line ) y will be executed by the program before the calculator halts. When a program is halted, you can resume execution by pre i) from the keyboard in Run mode. When you press (8/5), the . program resumes execution where it left off as though it had never Keystrokes Display dy) 9 stopped at all. 20.0000 Enter the height into the )| ) — Error Stops. If the calculator attempts to execute any error- ‘Yeregister. causing operation (refer to appendix A, Error Conditions) during a 18H 706.8683 Key the radius into the X- )| ) running program, execution immediately halts and the calculator regiater and calculate. displays the word Error and a number, To see the line number and Area of baseis displayed )| 2 keycode of the error-causing instruction, you can set the HP-11C to for 1 second. yl 3 Program mode by first pressing any key to clear the error message, 14,137.1669 Program stops, ‘| 4 then pressing (0}| displaying the volume. ) ) If tte ted stor ‘ister arithmetic u iid result i ? an attempted storage register arithmetic operation would res! 10 (ENTER) 10.0000 Bates the second height )| 9 imoverftow in a storage register, the calculator halts and displays co Error 1. The number in the affected storage register remains s1@) 78.5398 Key the radius into the X- ) |) unchanged from its previous value. When you clear the error register and calculate. message, the last number in the display returns. Area of base is displayed rt» oe i for 1 second. If the result of a calculation is a number with a magnitude less 705.2982 Program aicpa, displaying y |) than 1000000000 x 10°, zero will be substituted for that number : thoevclume and a running program will continue to execute normally, This is e volume. \] known as an underflow. ) ) 94 Sectio Labels As you read earlier, the labels in your programs act as addresses. they tell the calculator where to begin or resume execution, Notice that when a label is encountered as part of a program, execution merely “falls through” the label and continues onward. For example, in the program segment shown below, if you press (f) execution would begin at (¥] ([8t) (A) and continue downward through program memory, on through the [f) 3 instruction, until the (RTN] was encountered and execution returned to line 000 and halted. n 5: Programming Basics When you press [FIA]... execution begins here. here ... so execution }3 instruction falls through the ... and continues to the [RTN], then transfers. to line 000 and halts, Problems 1. Write and load a program that converts temporature in degrees Celsius to Fahrenheit, according to the formula F = 1.8°C + 32. Define the program with (A) and (a1 and run it to convert Celsius temperatures of -40°, 0°, and Te. Answers: ~40.0000°F, 32.0000°F, 161.6000°F. vw Section 5; Programming Basics 95. 2. Create a program to calculate the length of a chord & subtended by angle @ on a circle of r radius using the equation @ Q=2rein sing Design your program for an r, 6 order of data entry. and use it to Define this new program with [] complete the following table: (meters) o £ g 25 30 ? @ 50 45 ? 100 90 ? (Answers: 12,9410 meters, 38.2683 meters, 141.4214 meters.) 3. What are the program keycodes for the following instruc: 1, (SiN), EBL) ©), ($79) Answers: 4314; 423; 44,401; 23; 42,21,14; 44.36%. 4. How many lines of program memory are required to load the following sections of programs? Answers: a, 4;b,5;¢, 10. + Refer to page 8, Abbreviated Key Sequences, Section 6 Program Editing Editing in Brief Even the most experienced programmers find errors in their programs. These errors range from mistakes in the original formulas to mistakes in recording the program. Whenever errors occur they need to be found and corrected. Your HP-11C is designed to make this error-checking process as easy as possible. A program that us flags or trigonomet torage registers or status settings (such as modes) may give rise to errors if auch information is incorrect when you run the program. However, you can eliminate the possibility of this type error using an initializing—clearing or resetting—procedure. One method of itializing a program is to execute the necessary clearing and resetting instructions from the keyboard before beginning program execution. Another method is to make the program self.initializing by including the necessary instructions at the beginning of the Program. Finding Program Errors. One of the easiest ways to help verify that a program is working properly is to run a test case in which you either know the answer or the answer can be easily determined. Another option is to test a program for proper responses at its intended limits of applications and accuracy. For some types of calculations, you may even want to teat the program for proper responses to illegal data. ‘To help locate any potential problems in a self-nitializing program, try running the program several times with all data registers loaded with meaningless data, in different trig modes, and with the flags set, and then cleared, ‘The editing features of your HP-11C have been designed to provide you with quick and easy access to any part of a program, whether for editing, debugging, or documentation. If a program stops running because of an error or because of an overflow, you can simply clear the error message, then switch the calculator to Program mode to see the line number and keycode of the operation Section 6: Program Editing 97. that caused the error or overflow. If you suspect that a portion of your program is faulty you can check execution step by step, then use the other editing features to make any necessary changes. Editing Functions Your HP-11C’s function set includes the following four nonpro- grammable editing and manipulation functions to aid you in modifying and correcting your programs: (Sst) (B81) [6tO|Elann [e] (Sst)(Single-Step). In Program Mode: When you press and release (S87) gg9- the calculator moves to and displays the next line in occu- SE pied program memory. If you preas and hold [EST]in program mode, the calculator will con- tinuously scroll through the instructions in py until you release the (SST) key. When using ‘mode, no program instructions are executed. 001-42,21,11 In Run Mode: When you press [SST] the calculator moves to and displays the next line of program memory. When you release [SST], the calculator executes the instruction loaded in that line. (Back Step). Pressing (3) causes the calculator to step or scroll 002-4313 backwards through program memory in the same way that [SST]causes the en calculator to step or scroll forward. (No program instructions are 001-42,21,11 executed.) [Jann (Go To Line nnn). Pressing (GTO) (nnn in Program or Run mode causes the calculator to go to the program line number 98 Section 6: Program Editing specified by nnn, (In Run mode only, pressing (GTO) and an alpha or numeric label name causes the calculator to go to the specified label in the same way that (GTO)-]nnn causes the calculator to go to a specified line number.) (4) Backarrow). Pressing (#) in Program mode deletes the displayed program instruction from program memory, Any program instructions following the deleted instruction will then automatically move upward one line and be renumbered. Pressing (e]in Run mode does not affect program memory, but does affect the contents of the displayed X-register (refer to Display Clearing: Jand [+] page 17). Example Program Memory Before After Pressing [#): Pressing [#): 001-42,21,11 —————_» 001-42.21.11 (Display) 002- 4313 002- 23 003- 29 a0 450 004- 45 0 004- 45 1 “61 (Display) 005- Editing Example To provide an example for editing, load the following Pythagorean theo- rem program for calculating the length of the hypoteneuse (side c) of a right triangle, given the lengths of sides a and }, The formula used is c = va! + 6%, Assume that the calcula- tion begins with side a in the Y- register and side 6 in the displayed X-register. ‘To begin, set the HP-11C to Program mode. Section 6: Program Editing 99 Keystrokes Display (CLEAR 000- Clears program memory. (eeu) 001-42.21.15 Labels the program. we) 002- 4311 Squares side 2(b”), Gey) 003- 34 Moves b? from displayed Xregister to Y-register and a from Y-register to displayed X-register. @ 004-4311 Squares side 1 (a”). 005- 40 (a? + 0%), 006- 11 va? +b). 007- 43.32 Terminates the program. @ Set the HP-11C to Run mode. To test the program, calculate the hypoteneuse of a right triangle with side a of 22 meters and side 6 of 9 meters. Keystrokes Display 22 (ENTER) 22.0000 Key ina. 9 9 Key in b, Gel 23,7697 Length in meters of the hypoteneuse. Single-Step Execution of a Program In longer programs a wrong test-case answer will seldom pinpoint a mistake. For these cases, you can slow down program execution. Single-step execution begins with the line the calculator is currently positioned to. Since the [BTN] instruction at the end of the program positioned the calculator to line 000 after you ran the program, we need only key in our initial values to begin single-step execution. Each time you press hold the key down momentarily to view the line number and keycode of the next instruction to be executed; then release the (SST) key to execute the instruction. 100 Section 6: Program Editing Keystrokes Display 22 (ENTER) 22.0000 Load a into the Y-register. 9 9 Load b into the X-register. 001-42,21,15, 9.0000 002-4311 81.0000 Sr 003- 34 22.0000 004-4311 484.0000 (@[Flexecuted. 008- 40 565.0000 Glexecuted. 006- " 23.7697 (executed. 007- 4332 23.7697 (W[Rivjexecuted. Program completed; calculator returns to line 000 and halts. Note: will not advance into unoccupied tines of program memory. If you single-step from the last occupied line of program memory, and the last instruction is not {go to) or [GSB] (go to subroutine), the calculator will “wrap around” to line 000. If the last instruction is a (GTO) or the calculator will execute the (GTO] or [G58] instruction by ‘moving to the designated position in program memory. Using Program Mode Line by Line Stepping Through Program Memory. In Program mode, when you press and release [SST], the calculator My Section 6: Program Editing 101 moves to and displays the next line of occupied program memory. No instructions are executed. ({8] [BST] operates in the same way, except that the previous line of program memory is displayed.) Keystrokes Display Dem 000- Set the HP-11C to Program mode. SST 001-42,21.15 002- 4311 003- 34 004-4311 Sst) 005- 40 006- uN 007- 4332 rm Set the HP-11C to Run mode, Scrolling Through Program Memory. In Program mode, pressing and holding (SST]or [BST] scrolls the calculator forward or backward through program memory. (The calculator displays the current program line for approximately two seconds, then displays each succeeding line for approximately one-half second.) Modifying @ Program ‘To illustrate how to use the HP-11C’s editing features, let's modify the Pythagorean Theorem program shown on page 99 so that the Xregister contents will automatically be displayed at certain points in the program. We will do this by inserting an (7) (pause) instruction in the indicated locations in program memory. 001-42,21,15 002-43. 11~ { Wewill insert an [I[PSE] 003- 34} instruction after these 004- 43. 11~/| three instructions. 005- 40 006- 1" fe 007- 43.32 Inserting Instructions. A new program instruction can be inserted anywhere from line 000 through the end of occupied program memory. To insert a new instruction: 102 Section 6: Program Editing 1. Set the calculator to Program mode. 2. Move to the program line number immediately preceding the position where you want to ingert the new instruction, 3. Key in the new instruction. It will be loaded into the next line of program memory. All subsequent instructions will be “bumped” down (renumbered) one line in program memory. Because each new instruction you insert causes all subsequent instructions to be renumbered, inserting changes in a program is simplified by beginning with the change farthest from line 000, then working back toward the beginning of the program. Example, To insert a (PSE)instruction after the [z)instruction: Keystrokes Display Set the calculator to program line 000, Ora o00- Line 000. su) 001-42,21,15 Go toline 005, 002- 4311 (Sst) 003- 34 004- 4311 005- 40 Line 005. (caltesia) oo6- 42.31 instruction inserted at line 006. With the calculator set at line 005, when you pressed [7] program memory was altered... .from this... «to this, [oi= (OTE |—> [oor Titan] 002-[9)7) |—»|002-(alir) 003— —» [oo3s- 004-[aj7] | > | 004- [ste] (@SElinstruction 005— —» [08 i inserted here; eub- (006- [vs XY 006- [1)[PSE sequent instructions (ser \~ [r= ae 008- (RTM) | memory. Section 6: Program Editing 103 Going To a Line Number. It is easy to see that if you wanted to single-step or scroll to some remote line in program memory it could take an inconvenient amount of time. However, using the (G10)L) nnn procedure you used previously to jump to line 000, you can avoid unnecessary waiting. When you press (GTO)(-] and the desired three-digit line number in occupied program memory, the calculator immediately jumps to the line number specified by the three digite. (You can use (GTO)() nan in Program or Run mode— no program instructions are executed.) For example, to go to line 004 to insert a [PSE] instruction after the second [9][Jinatruction: Keystrokes Display [E004 004- 4311 Gotoline0o4. 005- 42 31 Insert [PSEJafter line 004. When you inserted the (7) PSE] instruction after line 004, program memory was altered... from this... 001- ts 002- (3) pocs- Gee] 004- (3)7) 005-(-] ] 7) | >| 002-7) 003- [[PSE]_|——>] 003- TIFSE) ZI 003- (25) | "| 004- Gen) “- 004- (@)E) 008-(a) || 008- fart Wa (005- [=] 006- (HIFSE] > 006- [5] 7 [oos- (tese) 007- (+) “> 007- [f)[PSE} wa 008- (1) PSE] VAI 008- (7) Vr x 009- [0 ][RTN) 010-[a]IATN) wwe Section 6: Program Editing 107 If you modified the Pythagorean Theorem program as described above, the program now pauses only once, to display the sum of the squares. The length of the hypoteneuse is then calculated and execution halts, Run the program for a right triangle having sides a and 6 of 17 and 84 meters respectively, Keystrokes Display @ Set the HP-11C to Run mode, 7 34 34 He 1,445.0000 Pause to display sum of the squares of sides a and b. 38.0132 Length of hypoteneuse. When deleting instructions from a program of more than 63 lines, the process of automatically allocating storage registers to Program lines works in reverse. For example, deleting any instruction from a ‘71-line program automatically converts program lines 71-77 back to storage register Rs, (Refer to appendix C, How Automatic Memory Reallocation Operates.) Problems 1. The following program is used by the manager of a savings CT and loan company to compute = | — the future values of savings 2° accounts according to the for Yo mula FV = PV (1 + i)", where xe [n_]| FV is future value or amount, PV is present value, i is the periodic interest rate expressed as a decimal, and n is the number of periods. Assuming PV and n keyed in as shown before beginning execution, and an annual interest rate of 7.5%, the program is: Keystrokes Display @@0m) 001-42,21,11 frx)2 002-42, 7, 2 108 — Section 6; Program Editing Keystrokes Display 1 003- 1 a oos- 48 0 005- © Interest 7 006- 7 5 007- 5 rey 008- 34 & o09- 14 +i & o10- 20 PVa+iP aw O11- 4332 a. Load the program into the caleulator. b. Run the program to find the future amount of $1,000 invested for 5 years; (Answer: $1,435.63) of $2,300 invested for 4 years, (Answer: $3,071.58) c. Alter the program to account for a change of the annual interest rate from 7.5% to 8%, d. Run the program for the new interest rate to find the future value of $500 invested for 4 years; of $2,000 invested for 10 years, (Answers: $680.24; $4,317.85) 2. The following program calculates the time it takes for an ubject to fall to the earth when dropped from a given height. (Friction from the air is not taken into account.) When the height A in meters is keyed into the displayed X-register and (B)is pressed, the time t in seconds the object takes to fall to earth is computed according to the formula: Clear all previously recorded programs from the calculator, reset the display mode to [Fix}4, and load the following program. wee eye vee YL Vee VyVeVeVeV eV eY Section 6: Program Editing 109 Keystrokes Display neo 001-42.21.12 2 002- 2 a 003- 20 9 004- 9 Q 005- 48 8 006- 8 a 007- 10 Qa o08- WwW (ojtarn} 009-43 32 b. Run the program to compute the time taken by a stone to fall from the top of the Riffel Tower, 300.61 meters high; and from a blimp stationed 1000 meters in the air. (Answers: 7.8313 seconds; 14.2857 seconds.) © Alter the program to compute the time of descent when the height in feet is known, according to the formula: 2h 32.1740 d. Run the altered program to compute the time taken by a stone to fall from the top of the Grand Coulee Dam, 550 feet high; and from the 1350-foot height of the World ‘Trade Center buildings in New York City. (Answers: 5.8471 seconds; 9.1607 seconds.) Section 7 Program Decisions and Control Decisions and Control In Brief Program Conditional Tests The HP-11C’s eight conditional teste are true/false tests used in programs to enable your HP-11C to make decisions. In a running Program, when the result of a conditional test is true, program execution continues with the first instruction following the conditional test. When the result of a conditional test is false, execution bypasses the first instruction following the test and resumes with the second instruction following the test. Is the test true? Conditional Test “Doif True" Rule Your HP-11C’s conditionals operate by comparing the value in the X-register to either the number in the Y-register or to zero in the following manner: tests to see if the value in the X-register is less than or equal to the value in the Y-register. tests to see if the value in the X-register is greater than the value in the Y-register, tests to see if the value in the X-register is not equal to the value in the Y-register. 110 weve Veueveyvvervvvr Section 7: Program Decisions and Control 114 tests to see if the value in the X-register is equal to the value in the Y-register. tests to see if the value in the X-register is less than zero. tests to see if the value in the X-register is greater than oro. tests to see if the value in the X-register is not equal to zero. tests to see if the value in the X-register is equal to zero. Flags Another type of decision-making test for use in programs is a flag test. A flag is actually a status indicator that is in either a set (true) or clear (false) status. A running program can test a flag and make a decision based upon whether the flag is set or clear. Flag tests affect program execution in the same way as conditional tests. ‘The two flags in your HP-11C are numbered 0 and 1. To set a flag, press (0][SF](set flag) followed by the proper digit key (0 or 1) of the desired flag. To clear a flag, press (6) (CF) (clear flag) followed by the proper digit key. To test a flag use (31 flag set?) followed by the digit key specifying the flag to be test A flag that has been set by a [T][SF)n command remains set until it is cleared by a [8)(CF)n command or until Continuous Memory is reset. Is flag 1 set (True)? Yes , [instruction No L, Instruction t Instruction 4 Instruction { 112 ion 7: Program Decisions and Control Program Control GoTo instruction you have used earlier to position the calcula- tor to a specific program line for viewing or editing is also used to transfer execution to a label elsewhere in program memory. When used as an instruction in a program {GTO} is followed by an alpha or numeric label address, 1S | Tinstton | Instruction | Instruction When a running program encounters a label instruction, execution is auspended while the calculator searches downward in memory for the specified label. Program execution resumes at the first line found to contain the label. Branching and Looping Unconditional Branching. An unconditional branch is simply instruction that is always executed in a running program to transfer program execution elsewhere in the ‘am, regardless of data status. The preceding illustration of [GTO] operation is an unconditional branch. Conditional Branching. When [GTO] /abel is used in conjuncti with a conditional test, as in the following illustration, th Jabel instruction becomes a conditional branch. That is, the result of the conditional test preceding the [GTO] determines whether or not the [GTO}instruction will be executed. ~~~--~--~ Vevey YY YY EY YY YEE wee vevuvve Section 7: Program Decisions and Control 113 (xy) =True Instruction (cto}7 - instruction { Instruction | (etl? in Instruction When the calculator is in Run mode, pressing (GTO}/abel causes the calculator to go to the specified label and halt. This feature is convenient when you want to review or edit lines of memory following a certain label instead of executing them as part of a program. Looping. Looping is a special case of branching in which a instruction is used to repeat the execution of a series of instructions ‘one or more times. Loops are frequently used for counters and for sequen- tially calculating a series of results using the same set of program instructions. The continuation of a loop for a new iteration or the transfer of execution out of a loop is controlled by a conditional branch. In the following illustration, as long as the result of the conditional test preceding the is true the calculator continues successive iterations of the loop. When the result of the loop conditional test becomes false, execution skips th ‘instruction and continues with the rest of the program. Use of an unconditional branch to control a loop results in an infinite loop, that is, a loop that is reexecuted indefinitely. 114 Section 7: Program Decisions and Control Conditional Branch Control of Program Loop Instruction Instruction Htest true, looping continues. iftest false, looping terminates. Instruction Example of Conditonal Loop Control. The following program calculates and displays the square roots of consecutive whole numbers from 1 to 10. After the square root of an integer is calculated and displayed, an conditional test determines whether or not that integer was leas than 10. If the integer was less than 10, a (GTO) 0 conditional branch is executed and the loop is repeated using the next highest integer. If the test finds thi integer was not less than 10, program execution bypasses the 0 conditional branch and the loop is terminated. (The loop portion of the following program is included in lines 004 through 015,) Keystrokes Display @ o00- Sets HP-11C to Program mode, (CLEAR 000- ta 001-42,21,13 002- 0 } Clears R, of any 003- 44 1J unwanted data from previous calculations. 004-4221, 0 Begins loop. 005- 1 006-44,40, 1 Integer counter/ ‘increment. Section 7: Program Decisions and Control 115 Keystrokes Display 0o7- 45 1 008- 42.31 Displays next integer. 009- 11 Square root of integer. 010- 42.31 Displays square root. 011- 4336 Recalls copy of integer from LAST X register. 1 012- 1 Compares last integer to o 013- © highest integer allowed by OGS5 014- 4220 the program. [sto]o 015- 22 0 Conditional branch. If last integer is less than 10, goto and resume... 016- 43.35 ...otherwise, avoid another 017- 43 32 loop, clear displayed X- register and halt program. Sets HP-11C to Run mode. aa) To run the program press [f]{¢). The calculator will display a table of integers from 1 to 10 with their corresponding square roots. When 0.0000 is displayed, program execution is completed. How It Works: When you press [i (E], the calculator searches through program memory until it encounters the [7] instruction. It executes that label and each subsequent instruction in sequential order through line 014, the [<>] conditional test. If the result of the conditional test ia true—that is, the last integer used was less than 10—the following [GTO] 0 instruction is executed, the calculator returns to the (LBL]0 instruction at line 004, and execution resumes as a new iteration of the loop. However, if the result of the [15] conditional test is false, meaning the last, integer used was 10, the O instruction is bypassed and the loop is terminated. For an additional discussion of looping and loop control techniques, refer to page 214, Looping, in part III of this handbook. Problem. Write a program to calculate and display sales commissions. For sales of less than $100 the commission should be 10% of the sale. For sales of $100 or more the commission should be 15%. Use a conditional branch in your solution. 116 — Section ?: Program Decisions and Control Using Flags Like the x:y and x:0 conditional tests, flags give you the capability to either skip or execute individual lines in program memory. However, while the x:y and x:0 conditionals function by comparing values, flags function by telling the calculator status. That is, if a set flag ((@) (SF) n) instruction is placed in a program. branch, testing that flag elsewhere ((¢) rn) can tell the calculator whether or not that branch has been executed. Example. The following program closely approximates the conversion of an input in miles to kilometers (f(A), or the conversion of an input in kilometers to miles ({)(B)). The calculator uses the status of flag 0 to decide whether to convert a user input to kilometers (multiply input by conversion factor) or to miles (divide input by conversion factor). key les. kilometers. Start Start _/ Clear flag Set flag ‘| Cc — T ¥ Place 1.6093 in X-register. Section 7: Program Decisions and Control = 117 Keystrokes Display RA 000- Sets HP-11C to Program mode. (OCLEAR (FRG 000- Clears program memory. Meow) 001-42.21.11 Program begins with input in miles. Wo 002-43, 6, 0 FlagOcleared (“remembers” miles input for later program control). (ero}1 003- 22 1 Unconditional branch to io (ouet) 004-42,21,12 Program begins with input in kilometers. WGA 005-43, 4, O Flag Oset(“‘remembers” kilometers input for later in program). 006-42,21, 1 ([BL}I begins calculation portion of program. 1 007- 1 a oo8- 48 6 oos- 6 (Place conversion factor ° 010- 0 fin X-register. 9 o11- 9 3 012- 3, wl 013-43, 6, O Flag test. [f true (kilo- 014- 22 2 meters input), goto(LBL]2. o1s- 20 If flag teot falec (miles in wo 016- 43.32 put), calculate conversion tokilometers and halt program. (uarl2 017-42,21, 2. Calculateconversion to a o18- 10 miles and halt program wo 019-4332 ER Sets HP-11C to Run mode, Run the program to convert 26 miles into kilometers; to convert 1.5 kilometers into miles, 118 Section 7: Program Decisions and Control Keystrokes Display 26 26 Input miles. aw 41.8418 Execute Miles to Kilometers option. Result of conversion displayed. 15 16 Input kilometers. OB 0.9321 Execute Kilometers to Miles option. Result of conversion displayed. How It Works. When you input a value and identify the type of conversion you want by pressing [f)[A] (miles to kilometers) or [)(B) (kilometers to miles), the calculator sets or clears flag 0, then executes the main program (beginning at label 1). After placing the conversion factor in the X-register the program tests flag 0. If the flag is set (true), execution transfers to label 2, the conversion to miles is calculated, and execution halts. If the flag is clear (false), the conditional branch to (I8t] 2 is bypassed, a conversion to kilometers is calculated, and execution halts. The function of the flag is to tell the calculator which of the two labels has been executed and, therefore, which conversion is desired. For a further discussion of flag use, refer to page 215, Flags, in part Ti of this handbook. 2 oS 2 Sey ees eS YUVUYUBMYEULLYLEYEULEUUUL wy ~ y % \ Ve ye te te te Oe de NO ND So SD 0 Se OF Oe ve 2 Zz 2 > ‘ > ‘ o Section 8 Subroutines Subroutines In Brief Often a program contains a certain series of instructions that are executed several times during a single execution of the program. When the same set of instructions occurs more than once in a program, memory space can be conserved by executing the instructions as a subroutine. Go To Subroutine A subroutine is executed using (G58) with the desired alpha or numeric label address.* A (G58) instruction transfers execution to the specified label address in the same way as (GTO). However, when a instruction is executed in a running program, a pending return condition is set in the calculator. When a pending return condition exists, the first subsequent (return) instruction encountered by a running program will cause program execution to transfer back to the program instruction immediately following the last (G88). Execution then continues sequentially downward through program memory, (When the (RTN]is executed, the “pending” condition is cleared.) Compare the following illustrations of a branch and a subroutine. Branch Da] f GaSe) (ero)e) | Execution trans- ri fers to line 000 and halts. + & [E$B] followed by an alpha label address axe 78, Abbreviated Key Sequences, abbreviated key sequence. Refer to 119 120 Section 8: Subroutines ee, Subroutine [o(tela)} 4 FOB) | = (csE | 7 \ »~ KS \ Execution trans- Daw) SL Execution trans- fers to line 000 fers back to main ondhatta proprem pending foturnstetus cleared. As you can see, the nly difference between using (go to (go to branch) is the transfer of execution line 000 and halt; after a execution to transfer back tott Subroutine A subroutine can call up another subroutine, and that subroutine can call up yet another subroutine. This “subroutine nesting” —the execution of a subroutine within a subroutine—is limited only by the number of returns ( that can be held pending at any one time in the HP-11C. Here is how the HP-11C operates with nested subroutines. Main Program (ou (aut (03 4 4 4 | + = f , = / (esa t a am] “Can End Section 8 Subroutines 121 The calculator can return back to the main program from subroutines that are nested four deep, as shown. If you attempt to call a subroutine that is nested five levels deep, the calculator will halt and display Error § when it encounters the instruction calling the fifth subroutine level. Note. While any one set of nested subroutines can be up to four levels deep, there is no limit to the number of nested subroutine sets or non-nested subroutines you can include ina program. Subroutine Usage Example. Write a program for cal- culating the average slope between x, and x2 on the graph shown, where y=x!—sinx. ye dxz! ¥2-%y Notice that the solution requires two computations of the expreasion x? — sin x (once for x = x, and again for x = x9). Since the solution includes an expression that must be repeated for both values of x, we can create a subroutine to execute the repetition and save space in program memory. 122 Section 8: Subroutines ‘Main Program 001- (EBt)(E) 002- [sTo}o 003- [x=] 004. (Program assumes [DEG] trig mode.) When you press [f] (C] with x, in the Y-register and x, in the displayed X-register, execution begins with the |(C)instruction in line 001. When the (GS6] 0 instruction in line 005 is encountered, execution transfers to the 0 instruction in line 013 and calculates »;. If for example, we used a value of 2 for x and a value f3 for x2, here is how the solution would be calculated. 001 002 003 004 ™T I zw Y> 2 3 x» 3 2 (STO]E0 (gino) (Exchange) (x2-xy in Ro) Section 8: Subroutines 123, 005 013 014 018 ™ z> 3 yo, 3 [ 3 3 4 xeL2 [2 [4 2 Keye> (sso [Miso WE) isn {Goto (Begin (xy?) ) fabel0) subroutine) 016 017 018 006 Keys (SiN) a Gn) {sinxy) (x? —sinxy (Return to (—(xy =n) main —sinx,)) program) From line 018 execution transfers back to the main program and with the first line after the last (6S8) instruction. When instruction in line 008 is encountered, execution again transfers to the (L8C] 0 instruction in line 013. 007 008 013 014 ™> Zz Y » [-3.9651 | -3.9661 | -3.9667 | -3.9651 xeL 3 3 3 2 Keys so ow (Exchange) (Goto (Begin (x2) label0) Subroutine) 124 — Section 8: Subroutines 015 016 O17 018 T+ Z| -3.9651 | -3.9651 Y> 9 9 xe 3 0.0523 Keys> (JEST) [SiN] 8 (G)(eTN) bx) (sinx,) (x,2—sin x, (Return to main =¥2) program} ‘After the calculator passes through the subroutine under (C81) 0 a second time to compute y2, the f](RTN]instruction at line 018 causes execution to return to line 009, the first instruction after the most recent (G5}0 instruction. At this point, yzis in the X-register; -y, is in the Y-register. The remaining instructions complete the slope calculation. ooo 010 011 012 ™ z Y> 4.9826 x [4.9826 1__| #9826 | 4.9826 Q Ory vn (End of pom Program) When calculation halts, the slope of the line between x and x2 appears in the display. To execute the program yourself, key in the instructions listed on page 122 and calculate the average slope for following values of x, and x9:0.5, 1.25; 2.62,3.72; 5,7. Answers: 1.7325, 6.2226, 11.9826. Section 8: Subroutines 1268 For additional guidelines concerning the use of subroutines, refer to page 210, Subroutines, in part III of this handbook. Notice that and instructions always cause the calculator to search downward in program memory for the specified label. This feature often allows you to write a program in such a way that it uses a given label more than once. Example: The followin, am to calculate the value of the expression Vat + f+ 2 + uses (TL) [A] to identify both the beginning of the program and a subroutine within the program. The program is executed by placing the variables x, y, z, and ¢ in the stack and pressing (A].* Keystrokes Display 000- (CLEAR (PRGM) 000- a 001-42,21.11 Ow) oo2- 4311 x? (Gs8)(A) 003- 3211 Calculates y?and x? + y? (os) 004-3211 Caleulates2"andx? +9? te (38) 005-3211 Calculates? and x?+y?+ 2t+t 006- 11 Calculates vx? + y? +2? +42 DORN 007- 4332 st) 008-42,21,11 009- 34 De) 010- 4311 one 40 012- 4332 ol "While it i generally beat to avoid the uae of identical labels to reduce the possibility of confusion or programming errors, the following program illustrates one way identical Inbela might be used, if necessary. 126 Section 8 Subroutines Key in the following set of variable x=4.3, y=79, 2=13, t= 8.0 Keystrokes Display 8.0000 1.3 (ENTER 1.3000 7.9(ENTER)4.3 (H(A) 12.1074 Section 9 The Index Register The Index Register In Brief ‘The Index register (R) is one of the most powerful programming tools available on your HP-11C. In addition to simple storage and | recall of data, the Index register can also be used for: © Program loop counter and control functions. © Indirectly addressing data storage registers, branches, and | subroutines, Index register control of loops and indirect addressing is performed using a control number you place in the Index register itself. The integer portion of the control number determines the result of each loop iteration or indirect addressing operation. The decimal portion of the control number contains the parameters for altering and Limiting the integer portion. (0 and (i) Abbreviated Key Sequences. The calculator is designed so that you can omit the [1] prefix key in (1) or [fa] key sequences. Even when the [7] prefix key is pressed in an [iJor [{i)key sequence, the calculator will automatically exclude the code for (1) Direct Index Register Functions Direct Index register functions act on the contents of the Index register itself. Index Register Store and Recall. (ST0){I](store D (recat! from R;) operate in the same way as and [RCL] operate with data storage registers Ry through R, and R 9 through Ro. Exchanging X andI. Pressing [F[-=iJexchanges the contents of the displayed ter and the Index register in the same way that pressing xchanges the contents of the displayed X- register and the Y-register. eee 127 128 Section 9: The Index Ragister ISG} (increment, then skip if greater) and (OSE) (decrement, then skip if less than or equal) functions use the loop control number you place in the Index register, | | | Both (ig6) and interpret and compare the components of the | loop control number according to the following format: | tannnn isthe current counter value, nanny, where xxi the counter test value, and w is the increment or decrement value. annnn is the integer portion of the control number and is used for counting successive iterations of a program loop, for determining when to exit from a loop, and for indirectly addressing branches, subroutines, and storage registers. nnnnn can be from | to 5 digits and, if unspecified, defaults to zero. nnnnn is incremented or decremented by executions of [iSG)or (OSE). Example of Loop ControlNumber | nnn xx yy 9.05002 ata ee Begin Count Count ater upto 60 by two's xxx is in the decimal portion of the control number. When you use (50) or to increment or decrement nnnnn, xxx is then compared internally to nnnnn by the calculator to determine when the desired number of increments or decrements have been executed, xxx must be specified as a three-digit number. For example, an xxx value of 10 would be specified as 010. (xxx is a reference value and is not changed by executions of (ISG]or [DSE]. yy is also in the decimal portion of the control number. yy tells the calculator what increments to count in, that is, nnann will be incremented or decremented by the value of yy. A specified yy Incrementing and Decrementing the Index Register. The | | I Section 9: The index Register 129. must be two digits (for example, 02, 03, 55). An unspecified yy | defaults to OL. (vy is a reference value and is not changed by executions of (iSG]or [DSE).) and Operation. The increment and decrement functions use nmnnn/xxx comparisons to control a running program in a manner similar to the conditional tests described in section 7. Each execution of [f)(ISG] increments nnann by yy. Ina running program a test is then made to see if nnnnn is greater than xxx. [f it is, the HP-11C skips the next line in the program before resuming program execution. nnn < xxx Instruction ter OK (50s) Instruction. Instruction | yo “1 1 1 (DSE] decrements nnnnn by yy. In a running progtam it then tests to see if nnnnn is equal to (or less than) xxx If it is, the HP-L1C skips the next line in the program before resuming program execution. pnnnn > xxx Instruction [omens 4 Instruction} | Inairustion | ¢* Chang successive iterations of Iterations > | 9 7 2 3 4 ‘+ | 000802 |200802 | 400602 | 6.00602 | 8.00602 (Skip) TGs) + | 8.00002 |4.00002 | 200002 | 0.00002 | -2.00002 (Skip) | Skip» 130 Section 9; The Index Register indirect Index Register Functions Indirect Index register functions do not affect the contents of Ry. Instead, they use the nnnnn (integer) portion of the number stored in Ry as an address for determining where in memory to execute the function, Indirect functions are frequently used in conjunction with (15G)or (OSE) in programs when it is desirable to use the same program instruction repeatedly to sequentially address storage registers, branches, or subroutines. Indirect Storage and Recall. (S70) [i]) and (RCL [{j)* store or recall numbers using the data storage register addressed by the absolute value of nnnnn. For addressing Ry through Ro, nnn = 0 through 9; for Ro through Ro, nnnnn = 10 through 19; for Ri, nnnnn = 20. (Refer to the Indirect Addressing table on the following page.) Exchange X, Indirect. [7] (©={j] exchanges the contents of the X-register with the contents of the storage register addressed by the absolute value of nannn, Indirect Storage Regi @.0.0.0R) [performs storage register arithmetic on the contents of the storage register addressed by the absolute value of nnnnn. Examples. If 5.01202 is stored in the Index register: nnnnn=5 xxx =012 yy =02 and Re Contents \Indirect Branching to Label or Line Number. In a running [program: 1. Ifnnnnnis > 0, branches execution downward in program memory to the next label specified by nnnnn. | + Rofer to page 127, (and Abbreviated Key Sequences Section 9: The Index Register 131 2 Ifnnnnn is < 0, (GTO) branches execution directly to the occupied line number specified by the absolute value of nnnnn. For example i 1 | Poescteswwcton) | [008-Instruction| | | [006 Instruction] ~> [o07- fietis [008- instruction Indirect Subroutine Label or Line Number. In a running program, [38](i] indirectly transfers execution to a subroutine in the same way that (GTO) [I indirectly transfers execution to a branch. Indirect Addressing Table GTO} or (658 )[1) (Solo al Ifnnnnnis: ‘transfers addresses execution to: storage register: ° 132 Section 9: The Index Register AL? Section 9: The Index Register 133 Loop Control Using [ISG | > Now run the program by pressing [71]. Example: Here is a program that illustrates how [ISG] works. It yy) . contains a loop that pauses to display the current value in Ry and Keystrokes Display uses {ISG] to control the number of passes through the loop and the i) am 2.0000 When the calculator value of a squared number. The program generates a table of ) i ) 4.0000 begins executing, it first squares of even numbers from 2 through 50. | 4.0000 pauses to display the Keystrokes Display yp ‘ number to be squared, ‘ 16.0000 then pauses to display the ee C00 Program mode. y| > : square of the number. + 2 When the loop counter oe) 001-42,21.11 Program label. yt oy 50.0000 increments beyond 50, the 2 002- 2} Current counter value ) 2,600.0000 program halts. (annnn). ) 003- 48 004- ° ) |) Here is what happens when you run the above program. 008- 5 | Counter test value (xxx). yO) 1. Under label (A], the number 2.05002 is stored in the Lregister 006- ° \ 4s the loop control value: 007- 0 ) ) 008. 3} Increment value(yy). 009- 44.25 Store loop control valuein yd fnnnn pox yw R. sl > (00012 050 02 010-42,21, 1 Begin the loop. Current Counter Test Increment 011- 45.25 Recall the number in Ry. a) Value value Value 012- 4344 Take the integer portion. y } 013-4231. Pausetodisplay the 2, Under label 1, the following sequence occurs: integer. yf After 2 and 4 (the square of 2) are displayed, the current 014 43.11 Square the number. counter value in Ry, 00002 (anne, is incremented by the - q 19 increment value 02 (yy). The new number in Ry is 4.05002, (OSE 018-4231 Display the square of the which isinterpreted hy yourenlenlntor ag : »} 2 (sc) 016- 42 6 IncrementRy by 2and check to see that the »} > nnnnn 700 vv counter is not greater than (0004 O50 1 02 thefinal ursber 60) If p> CurentCounter | Test | Increment the final number, skip the yO? Value | vatve Value next line in the program. ) ) 017- 22 1 Loopback to label 1. The new counter value is then compared to the test value 050 oie. 4332 Helewh al (xxx). As the counter value has not exceeded the test value, - falta the program. the calculator proceeds to the next line, , and the Ron mode. sry process is repeated with the new number. 134 = Section 9: The Index Register 3. After 25 even numbers (2-50) and their squares are displayed, the eurrent counter value finally increments beyond 50. This causes the calculator to skip one line after the [SG] at line 16. Ao a result, the (GTO) 1 command at line 17 is bypassed and the ‘ommand at line 18 is executed, causing the calculator to return to line 000 and halt. Afterrunning the program, press{i][Fix)5, then (RCIIII. The recalled Tregister value in your display should now look like this 52,05002_ ‘Current Test Increment Counter Value Value Value (nnn) (xxx) (yw) Press [i)[FiX] 4 to return the calculator to display mode. ISG and DSE Limits, Note that [5G] and [DSE) can be used to increment and decrement any number that the calculator can display. However, the decimal portion of the loop control value will be affected by current counter values exceeding the five-digit nnnnn value. For example, the number 99,950.50055, when incremented using [SG] would become 100,005.5006. The initial number was incremented by 55. But since the new number 100,005.50085, cannot be fully displayed, the decimal portion of the number was rounded. As the calculator assumes a two-digit number for the increment value (yy), the next increment would be by 60, not 55. ‘And when the number becomes 999.945.5006, the next number would be 1,000,005.501, thus rounding the decimal portion of the number again. Since no increment value yy is present, the next increment would default to 01 instead of remaining at 60. Direct Rj Operations Example To Execute Keystrokes Display Store in Ry 12385 12.345, 12,345.0000 ~~~ ww Section 9: The Index Register 135. & To Execute Kaneces | Display (Clear display) i 0.0000 Recall from Ay (the value stored eartier using SoM. (Rc) 12,345.0000 (Clear display) we 0.0000 Exchange X and! 0.0000, (using the value remain- ing in [from above examples) 12,345.0000 Indirect R; Operations To Execute Example Display (Store 3 in R, as an address, that is, nnnnn | =3) 3.0000 Indirect storage and recall of \/7 using Ry (indirectly addressed by first storing 3 in Ry, above). 2.0408 2.6458 9.0000 Ow 2.6458 4 0.0000 Exchange, indirect, the 0.0000 in the X-register and the 2.6488 remain: i ing in Ry. (The nnann address 3 remains in R,,) flea) 2.6458 0.0000 136 Section 9: The index Register | Example , To Execute ae os Display Indirect storage register | (Cz) 3.1416 arithmetic; divide the =SISIn contents of Ry by pi Sow | s1416 eng 0.8422 For an additional discussion of indirect storage register addressing techniques, refer to page 211, (ISG) With (RCL]{{], in part III of this handbook. Indirect Program Control Indirect Label Branches and Subroutines You ean indirectly branch to line numbers and labels in the same way that you indirectly address data storage registers. The table on page 131 shows the numerical address that corresponds to each possible label. Each possible address is the nnnnn portion of a positive loop control value atored in Ry. To indirectly branch to a label use [. When a running program encounters [GTO]|[I], execution is transferred downward in program memory to the label that is indirectly addressed by the current nnnnn value. For example, if 3.005 is the current counter value in the Index register... then... (906- Instruction | R, [3.00500 [006- instruction Annnn oy, (default to 01) (oo7- {sro} 008- instruction 1009- Instruction (010- instruction fo11- (rfcen)3. (012- Instruction (013- instruction 7 [Execution |transfers to [label 3 and jresumes. The same method is used to indirectly execute a subroutine, except that [G38] [is used instead of (67O\L). ~vwve Section 9: The Index Register 137/138 Indirect Line Number Branches and Subroutines Program line numbers can be indirectly addressed by a branch or subroutine instruction in almost the same way that labels are indirectly addressed. As covered earlier, when an indirect branch or subroutine instruction is executed with a positive nnnnn value in Rj, execution transfers to the label addressed by nannn and resumes. However, when an indirect branch or subroutine instruction is executed with a negative nnnnn value in Ry, execution transfers to the line number addressed by the absolute value of —nnnnn. If suthen.. Fu L-Z.00800 001- Instruction | (002- instruction 003-0] “| (004- instruction \ Execution transfers to nnnnn xx yy [006= Instruction if (default [996— Instruction Ye 007 and tool) | resumes. o07- [Gets | p—~ (008- Instruction 009- Instruction Part III Ei 3s E'S gn Sg & 2 £? tI Pa Section 10 Applications Programs Matrix Algebra ‘This program calculates the determinant and inverse of a 3X3 matrix (if it exists, i.e. det. = 0) and, with a minor program manipulation, the solution to the system of linear equations represented by the matrix, Equations: ay m2 a9 by xm A Gz, zy aay by X= | x Aa) agg aay bs x3 Jaze xs) fers asf faw ara! 432 @a5| Qs Gas 222 G23, 1 Jao, anf far aif far aia det A a3) | ta) Ga JZ, 33] Jay axe] fan arf fan a] Jas: ase] Jas: aan] Jan aaa where C is the inverse of A, det A = a4 (g325 ~ ayy) — a9 49;043) ~ 0350) Fagan, 032 — G25) 140 weve we Section 10: Applications Programs 141 AX = Bis solved by X = CB, viz., Jaze a: »,[ 252 Og m1 wef 1 |g, foe 225 x) deta Jas, 3s Jez any by Jas a2 Note: © Matrix operations can be especially prone to roundoff error. In certain cases this error may significantly affect the program results. © If you have several sets of simultaneous equations to solve, key in the determinant routine to find the determinants for each 3X3 matrix. Replace the determinant routine with the simultaneous equations routine and store the respective determinant in Ro for each calculation. a a2 0 * A2X2matrix should bestored as | aq, agg 0 oo 1 © Error 0 will be displayed if the matrix entered is singular. 142 Section 10: Applications Programs Main Program xevstroxes | pispiay | KEYSTROKES | DISPLAY (ictear fac | o00- 027-45 001-42.21, 9 joes. 48 002- [ozs- 45 | 003- 030-45 3 004- o31- 32 8 008- 032-46 i 006- 45 3| 007- 45 oos- 44 | 45 oos- 43 32| (Gsule 32 010-42,21,12| (nct}8 037-45 8 on- 48. 3] (Rt? Ce 012-45 .3| (Rats 038-45 5 13-45 2 040-45 o14- 45 ol (cssle oai- 32 8| 016-32 _8| (GsB)2 042-32 | 16-45 .2| [Rcxs 043-45 | 017-46 7|(actie}2 044-45 2 ore- 45 6 | (CLI) 045-45 1 o19- 45 .3| (Reo 46-45 9 020-32 a (ssble 047-32 8 o2i- 45 6| (Acct as 45 41 022-48 .0| actj6 vas 46 | 023-45. 3] [Rci5 060-45 5 o24- 45 7| ost 45 2 026-32 8] 062-32 | 026— 2| 053-45 5 Section 10: Applications Programs 143 KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY 45 9 0 31 meus joss- 45 8 | aI(RTR) oss- 43 32| mens jose- 46 6 [nuab2 069-42,21, 2 Miele los7-a2.21, @ [cus o70- 45 4 {ba lose. 20 071-43, 6, o| mH loss- 33 o72- 31 a loso. 20 073-42,21, 3 frnceal Josr- 43.33 [1 o74— 1 le Josz- 30 [sTOIN) 076-44 25| loss- 45 0 fo loea- 10 fsvola \065-43, 6, 0 [a7 lose- 22 1 REGISTERS: Ri index Rg: Det Ry: by a:b Rs: by Rents [Reon Re: ave yang i 221 Re: 222 Rea on IR: a0) Rx a Ry: ass Determinant Subroutine KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY Bie feat lo beso (Geo |oso-43, 5. of acticjo pes: 45.0 a4 lost alan as- 45 .2| josz- 44 25 [cselo pse- 32 9 444 Section 10: Applications Programs KEYSTROKES | DISPLAY | KEYSTROKES DISPLAY fare jos7—- 48 8 ACL] }2 095-45 2 jenos lof 48 .3|(Gs8)9 o96- 32 9 (ea 089-32 9 (ficLIS 097-45 6 098-45 3 oss- 32 9 100-45 6 1oI- 45 4 DISPLAY | KEYSTROKES ISPLAY 079-4221, 1 os8- 44 3] oB0- 45 24|(Ra) o8s- 3 osi- 20 090-44 2 (082-44.40, 4] (Re) osi- 33] oas- 42 6| 092-44 7 oB4- 42 31 | (csa)3 093-32 3] 086~ 43 32|{Gsal[e) os¢- 32 12 086-42,21,13|[a)(cr]0 095-43, 6. 087-43, 4, 0|[act}4 096-45 4] mstrucrioNs KEYSTROKES. 1 _ rey inne main program ines 000 078) 2 [serinert Rey in sabroioe ZEA ines 079-102), (G¥9))078 l (HFA. eR] y Section 10: Applications Programs 146 ver] ‘insTRUCTIONS INPUT DATA/UNTTS KEYSTROKES ‘ourPut OATA/UNITS. 3 |Setuser mode, 4-_| S10 the elements ofthe matrix (sims (stBi6 a3 (S57 (os (st0l8 a on (sole so! os eon B55 so08 [Find the determinant w 6 _|toverae (Optional Find the lovers ol (3 7__| Simutaneous Equations (Optional Delete lines 078 10 102 (BST) wz 92 3 (SEE oe. 4332] 8 [Key in subroutine under ono 079-4221, 1 tines 079 036), fore 146 Section 10: Applications Programs iMPUT: ‘ouTeUT ster} INSTRUCTIONS. aravunrrs| KEYSTROKES. | aatayuuirs Hoput the colume mati and find x aes) 10 | For new columa matrix goto simp 9 n 4 11] For new detoominant ot inverse alte ines 079 t 098, {Con RTs) Ce (88) wi @. Sota step 2 uu Example 1: Find the inverse of [ 4 a] then solve salle)-[] Keystrokes Display Set User mode. Mies Key in the determinant routine. 14 (5105 8 (CHS )[STO}6 2 104.0000 0.1154 Det. A Keystrokes (a7S| amo) (eR) Oe. Display 0.0769 0.0000 0.0769 0.1348 9.0000 0.0000 0.0000 1.0000 102- 078- 32 9 43 32 Section 10: Appiications Programs = 147 oe 13 ea 2 Cu 3, 39 3a Key in the simultaneous equations subroutine, Keystrokes rR 20 (ENTER) 5 (ENTER) ° Display 2.6923 2.2115 0.0000 x Ry 5 Example 2: Solve for the loop currents in the following circuit. 19 148 — Section +0: Applications Programs The three loop equations are: Loop 1 4, ~ 41, + 15, -15fg-40= Loop 2 4Ip~ 41, +8ly +10, ~ 101 Loop 3 10Is ~ 101g +11; + 161g — 15, =0 or 191, ~4I,~ 151, =40 41, + 222-101) =0 15h, ~ 10%, +264, or in matrix form 9 4 22 -10}]%]=|0 5 Keystrokes 19 (STo}S (sto) 6 15 |[StO}7 4 8 22(ST0)9 10 (cHs)[STo]Jo 15 (cHs)(sTO}L}1 10([cHS)(StO}-)2 26 (STOI-13 Delete the simultancous equations routine if it is still in program memory, and insert the determinant routine. 2,402.0000 Delete the determinant routine and insert the simultaneous equations routine. Display 40 (ENTER) © (ENTER)(C] 7.8601 4.2298 6.1615 v~ ‘Section 10: Applications Programs = 149. Systems of Linear Equations With Three Unknowns This program uses Cramer's rule to solve systems of linear equations with three unknowns. It has been included here because of the relative ease with which it can be used to solve systems of linear equations compared to the Matrix Algebra program. Equations: A system of linear equations can be expressed as AX=B. ay a2 ay For three unknowns, ay Oy Brg ay dy O35 x X= | a det A = ay,(azgagq ~ 23032) ~ @y2(421493 — 22931) + @y(@21Ag9 ~ @22051) - xis are solved by det (2) Det A for Det A #0 where det (i) is the determinant of the A matrix with the i" column replaced by B. Remarks: If Det A =0, then the system is linearly dependent and this program is not applicable. The program will terminate with Error 0. If Det A is very close to zero, the calculator representation of the number will contain significant round-off error and the ratio (det (i)/Det A) will be in error. FeO | Section TU. Applications Frograms aaa ae] | KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY d [cLeaR (paGM) | 000- (Ges 02-45 6 y eo) 001-42,21,11 |(RCL)7 030- 45 7 058- 4 |RcUo jO75- 45 .0 059-32 _ 7 |G) (RIN) jO76- 43.32 Section 10: Applications Programs 181 KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY 002~ 1 |(es89 jost- 329 [oos- as. [o32— 16 obo~ _31 jf usu8 077-42,21. 8 | { —_ a 061- 7 ° 004~ (Reus 033-45 3 \ - (cs5)7 062-32 7 1) tes 063~ 31 008- rane 034-45 8 008- 3 |(esa}9 036-32 9 036-45 1 Jos7- 45 (064-42,21, 7 i lsmone ———foss- 4a 4 | [sro oss- 4425 |(sB)8 067-32 8 o68- 32 0 09-45 0 008-42,21, 2 009-4526 o10- 43.44 on- 4231 012-4524 013-31 9 038-32 9 039-45 2 7 9 040-45 041-42,21, 042-42 6 ) O14- 4424 043-4231 Os 42 6 044-4524 o1e- 22 2 046- 20 ) 017-32 0 o46- 20 yf) oe 44 0 047-40 o1- at o4s- 43:32 020-42,21, 0 049-42,21,12 ) o21- 050-443 ) 022- os1- 33 ) ) on- 440 o72- 454 073- 44 26 |(STo)3 jo90- 44-3 076-32 8 (HRTw) lost- 4332 REGISTERS Ry; Index 023-45 O52- 44 2 024-45 025-32 026-45 027-45 o2s- 32 053- 33 054-441 yoo oss. ) [are] srmucrons |, POT (GSB) 7 o66- 32 7 AS 067- 31 ‘ouTPUT EYSTRONES | A ATAVUNITS ) 1_| Key in the progr ) 2_ | setUsor made wlolalolmia 182 Section 10: Applications Programs Keyinthe 33 matin in column order (ote to eae the daplayed valve in the ragister press (A7S}). Re % we 5h ts. ws 2h 4 fcr am tn 2) ah ‘Te review the mati press (I. 4 [tnput the colon mats. 5._| For new column manix go to step 4 8_| Fornew3 x3 mavi step 3. Example 1; Find the solution matrix for the following: 19-4 -15 x 40 -4 22 -10] |x.]=] 0 =15 -10 26] [x 0 Keystrokes Display (CLEAR (REG) ‘Set User mode. 1.0000 0.0000 vue Section 10. Applications Programs Keystrokes Display 9 2.0000 0.0000 4 RS) 3.0000 0.0000 16 4.0000 0.0000 4 5.0000 0.0000 22 6.0000, 0.0000 40 [CHS)[RZS) 7.0000 0.0000 15, 8.0000 0.0000 9.0000 0.0000 2,402.0000 Det. 7.8601 oa BS) 4.2298 xp 6.1615 xy Example 2: Find the solution matrix for: 19-4 4 xy 5 5 -12 -10] |x -3 15 8 3 x3 4 Keystrokes Display 1.0000 19.0000 2.0000 -4.0000 3.0000 -15.0000 4.0000 4.0000 6.0000 22.0000 6.0000 ~10.0000 7.0000 -15.0000 8.0000 ~10.0000 9.0000 26.0000 284.0000 Det. ~1.6667 xn 4.4091 a 4.7576 an 153 154 — Section 10: Applications Programs Newton’s Method Solution to f(x) =O ‘One of the most common and frustrating problems in algebra is the solution of an equation like: Inx +3x = 10.8074, in which the 2's refuse to conveniently migrate to one side of the equation and isolate themselves. That is, there is no simple algebraic solution. The following program uses Newton's method to find a solution for f(x) = 0, where f(x) is specified by the user. The user must define the function f(x) by entering into program memory the keystrokes required to find f(x), assuming x is in the X-register. The main program is 68 steps long and requires registers 0-4. The remaining memory and available registers may be used for defining f(x) by the user. In addition, the user must provide the program with an initial guess, xo, for the solution. The closer the initial guess is to the actual solution, the faster the program will converge to an answer. y wey section 10: Applications Programs: 166 ‘The program will halt when the following conditions are satisfied: 1. Loop count > Loop Limit 2 f(x} tolerance (e) 3. Benew —Xotdl S Aa limit The user may choose values for ¢ and Ax or the program will use default values, Equations: _ fix) FQ) ‘This program makes a numerical approximation for the derivative f(x) to give the following equation: fx) F(xi+ 6) fx) Hin = Hy 8 where 6) = 10 5 xp and 6; Note: © After the program has finished, x for f(x) = 0 will be displayed and will also be in register 2. * Error 0 will be displayed if, in the attempt to find a root, there ia a division by zero. If this occurs, try a new guess that is close toyour last guess. © This program also keeps track of the number of iterations that take place when trying to find a root. Rj is initialized to 50 (lines 020, 021 and 022) and an error (Error 4) will occur if that many iterations have taken place, The user may change the maximum number of iterations by deleting lines 020 and 021 and keying in the desired number. ‘© The user may like to see each x;. as it is found by Newton's method. To do this key in [7}[PSE] after (at line 047 if no other modifications have been made to the program). * If the tolerance is too small, round-off error within the calculator will become significant and the roots become erroneous. 166 Section 10: Applications Programs 8 008 8 037-43 40| cos 44 3 ‘fose- 44 | 010-44 4 039-452 ou- at o40- 34 o12- 44 3 oat- 10 o13s- 31 042-45 0} o14- 44 4 oas- 20 015-4335 ou te o16- 43:32 O4s- 45 1 017-42,21,12 oae- 40 o1s- 44 2 47-44 2 019-44,20, 0) 4-43 36 020- 5 o4s- 30 ° o21- os0- 44 | Gan 022- 51-42 6 (sa) 023- os2- 22 2 (eu2 024— os3- 32.9 (Star) 026- }054-42,21, 2 On 026-42,21, 1 oss- 45 2| (a2 027-45 2 lose 32 13| (So) ozs- 44 1| (RBS) los7- 43.16] “~~ wee EY YES Section 10: Applications Programs = 157 KEYSTROKES | DISPLAY os4- 431 065-42 10] 066-43 321 067-22 068-42,21.13] Re: 8) Ry: Loop counter| Rg Axlieit staucTioNs Set Program mode, Key inthe function tobe solved {ntalice tolerances, pata 1 | ey in the program, 2 | Gor (aI). DATA/UMT [| |__| {Optional tpt ‘you do not wih toate the ‘default value of (10°) but wish tc Ing he intl guess nd compute 168 = Section 10: Applications Pragrams: ‘ourPut DATA/URITS sep 10. For nnw toerances goto stop 8 ‘Set program made and delete lines Goto tap 4. Example: Find a root of fx)=2x with x= Keystrokes Display (Gro}(c] (el 068-42,21,13 (Sto) ee) fers) 075- 30 fl (Fix 9 User mode. 0000000010 Default cand Ax. 1.134724138 x, -0.000000004 f(x;) ~ vw Section 10: Applications Programs 159 Numerical Integration by Discrete Points ‘This program will perform numerical integration when a function is known at a finite number of equally spaced points (discrete case). The integrals are approximated by either the trapezoidal rule or Simpson's rule. Equations Let x9, 21, .., ben + 1 equally spaced points (x;= x9 +h, j=0,1, 2, ..., 2) at which corresponding values f(x), f(x;) .... f(x,) of the function f(x) are known. Theintegral: J — f(x)dx may be approximated using: 0 1. The trapezoidal rule: e f ftayax~* rooea(S rs) +Flae) 0 Ft 2 Simpson’s rule: f Aandi ~B (fxg) + Aflay) + 2/029) +. Af lena) + 2f(X pa) + Ap) + flan) In order to apply Simpson's rule, n must be even. Ifit is not, Error 0 will be displayed. KEYSTROKES | DISPLAY | KEVSTROKES | DISPLAY (CLEAR (eRem) [000- foos- 440 BUA (001-42,21.11 [T0165 loos- 44 5 (sral4 (002-44 alo [007 o 003- fc loos- 44 3. 004~42,21, alma foo9-42,21, 1 ‘od d Section 10: Applications Programs: 181 ‘ —ree >) > Gre] wsmucrons | it@UT ] aersmones |, 000 yoy 011~42.21,12 ) 1] Kevin te progam, ) [a [server mote 12-441 [cus los7- 46 5 ova. a2 2 |auaio oa .a2.21, 0 y) 5) [5 [reunite peonen cates | 4 oe as. a8 a 1) Le [rtm att cn ty o15— logo- 30 yy rete i) &) s o1eaao, 6 josie ab ; | cocaine tn integra viahe . oe a2 20 y trapezital ue Top f 018-44,40, 3 04s 34 yo) o* oi. as a 10 hy bySinpsors lea musthae | r 030 3H Wy bean oven. o Sino DDE) 021-42.21.12 lo4e-42.21. 2 | S| fornem ease cover (ial 022-44 1 [ENTER] loa7- 36. a) (esa)2 ozs. 32 2 | loas- 40 )| >) Example: Given the values below for f(x), = 0,1, .. 8, caleulate Haale o28daaor 6 qano 0 5 the approximations to the integral 2 1 026~ 050-43. 32 1 fede asa. 2 means] | f e275 3 sz. SO ) by using the trapezoidal rule and by using Simpson's rule, The | value for h is 0.25. joz8- 22-1 05 3— 10 yt ) Jozs—42,21,13 (i se azeep | j fof s|2{a|s|sjeoj7 je 1030— 2 (oe=o G5 43 40 ) | xy 0 | 0.25 I 05/075] 1 1.251 1574.75 i 2 jost- _46_o faim) os6— 43 32 ) ty) [2 [a8 [se] sz [7 [92 [iar fiee [20 osz- 22 0 > yy o39-42,21.14 |) Keystrokes Display | OlER2 , Set User mode, ) 0.25 REGISTERS Ry Unused y 3 0.00 Ro. Used Ry: fx) Ry: Unused R, 28(8) 1.00 o 2 ) rus 1 )) > ey 2eo Reh Used g-Aig: Unused yy) 82a 300 162 Section 10: Applications Programs Keystrokes Display 4.00 5.00 6.00 7.00 8.00 16.68 16.58 Trapezoidal. Simpson's. Curve Fitting Your HP-11C calculator is equipped with a powerful builtin function, linear regression, |, which quickly and conveniently fits data to a straight line. (See page 63.) ‘This capability is used here in a program to fit dat of curves: to other types 1, Exponential curves; y =ae"* (a>0) 2, Logarithmic curves; y=a+bInx 3. Power curves; y= ax? (a >0) which may be transformed to the general linear form Y=A +X. ‘The regression coefficients A and 4 are found by solving the following system of linear equations no YX Ay_—sx 2X, 1x? b x¥.X) where nis the number of data pairs. ‘The relations of the variables are defined as the following: Regression A X ¥, | Code Exponential | ina | x | In | 1 Logarithmic a Inxy vi 2 Power Ina | inx, | iny, 3 www Vee Vee Yee Section 10: Applications Programs 163 ‘The coefficient of determination is: ALY, +62X,¥,— 1 cry? uyi-t eye n ‘The type of curve fit to be run is determined before data input begins by inputting the code number. The coefficient of determination indicates the quality of fit achieved by the regression. Values of r? close to 1.00 indicate a better fit than values close to zero. The regression coefficients « and 6 define the curve generated, according to the equations at the beginning of this discussion. Logarithmic Curve Fit Code =2 Exponential Curve Fit Code =1 y=atbinx 164 Section 10: Applications Programs yp od Section 10; Applications Programs 165 Power Curve Fit 4D KEYSTROKES yy |_xevstaoxes | DISPLAY Code =3 yo) [ean o12- 22 26| (ai o36- 43.49 | > [Beanz 013-42,21, 7 |(eTo}9 037-22 9 | (wee 014-43, 6, 1 (TERS) 038-42,21.12 1). Terete o1s- 22 sina) _[ess-_aza9 \) ) Iago o16-42.21. 8|(alrn0 ‘Joao-a3, 6.0 \| > [@eAe 017-43, 5. 0[=) ost 12 | ) ) 018-42,21, 9|/R7S 042- 31 ; (ees o19- 31 043-34 | 1) [wre 020-43, 6, 0 oa 31 yy) EN) 021- 4312 Remarks: yl 022-38 * The program applies the least squares method, either to the ° oA 023-43, 6, 1 caustione crponentalcurveandgoweecarwes eermet 3) tern o24- 43:12 3 © Negative and zero values of x, will cause a machine error for >| 9 |tgens 025-48 6 049-42.21,14 logarithmic curve fits. Negative and zero values of y; will »} > jee O26- 43.30 o50- 1 cause a machine error for exponential curve fils. For power 027-22 6 os1- 4a 6 curve fits, both x;and y; must be positive, non-zero values. 1) lee ose 052. 229 © As the differences between x and/or y values become small, oo Ie 028. as 5342.21.18 the accuracy of the regression coefficients will decrease, * During operation of the program all storage registers are d} > [eas 930-22 9 ona-43, 6, 1 cleared. Any data stored in extra registers will therefore be 031-42,21, 6 O65- 43:12 destroyed. uy 032— aa ORR- 47 48 ) 033- o 057-43, 6, 0 DISPLAY KEYSTROKES | DISPLAY ) 034 46 6 jo5e- 12 {cvear (acm) | o00- foos- é ) 35-33 mao) 001-42,21,11 joov- a0 Gciear Res) |ooz- 4234 oos- 44 25| ) Wg2 003-42, 7. 2 loos- a3 | REGISTERS Ri Code 004— 36 010-43, 4, o| yt Ry dx Re: Sx? Rs: By, 005— 36 011-43, 4, 1 ty Re: avi Rg: Tor Ryo! Uni 166 __Section 10: Applications Programs 7) 7 Section 10: Applications Programs 167 wPUT OUTPUT yo ste esTRCTION DATA/URITS | DATA/UNITS: J y 1 | kere pogrom 2_| servsermote WO 2 [Seite eel onee hy i 1 100 | toe ~ a )) ) Keystrokes Display Logartie 2 a 200 i Set User mode. Powe 3 @ 300 apy 1.00 4 | tots; vtn an yl, i ‘ENTER) ))) 7R(ERTER)2.16 (R75) ae 0 1.31 1.61 » ws) i hy (Repetto a data pois i yo) 5 | Gaeta reson oi . see 3.45 a 4 ye) ~0.58 8 and cafe of determination 2 i 0.98 rf > 1.44 9 6 _| Maka projection ot new 7 for 8 | tonwn ae Ei ? 2) ) Bxampte2: {Rape so 6 forall vals ot )) (ogarithmie, Code =2) sane) p> x 3 4 7. | tne corecton yoy yr 16 | 93 | 234 | 488 | 601 Erne inputs arsep 4 ayn i sorrectad by pressing [D)and EoD Solution: a] wen, bana “han onto ep and ara y= 47008 1 41.991n x > 7?=098 core da. _| i 9B > Forx=8, $=39.06 yi) Forx=14.5, }=63.67 Example , ) (Exponential, Cod >|) Kevatrokes Display 2(4) 2.00 0.72 1.31 1.95 2.58 314 )} ) 3 [ENTER] 1.5 y, | 216 116 0s st 4 (Eren}9.3 6 (ENTER)23. 168 Section 10: Applications Programs Keystrokes Display 10 [ENTER)45.8 12 (ENTER]60.1 @ ~47.02 a 41.39 o G3] 0.98 rf af 39.06 y 14.5[6) 63.67 ¥ Example 3: (Power, Code =3) xi 13 | 26 4 54 y, [374] 615 | 721 | 803 | eea Solution: @ = 3.49, 6 =0.50 y= 3.49 x99 ?=0.97 Keystrok Display 3.00 2.6 (ENTER]6.15 [R/S] 4 (ENTER) 7.21 5.4 [ENTER)8.03 7.1 (ENTER)}8.84 (R/S) B 3.49 0.50 0.97 ee Section 10: Applications Programs = 169 Triangle Solutions ‘This program may be used to find the sides, the angles, and the area of a plane triangle. A J \ Sy Sz As Ar Ss In general, the specification of any three of the six parameters of a triangle (3 sides, 3 angles) is sufficient to define a triangle. (The exception is that three angles will not define a triangle). There are thus five possible cases that this program will handle: two sides and the included angle (SAS), two angles and the included side (ASA), two sides and the adjacent angle (SSA—an ambiguous case), two angles and the adjacent side (AAS), and three sides (88s), If the three known input values are selected in a clockwise order around the triangle, the outputs will also follow a clockwise order. Remarks: ¢ Inputs may be in any angular mode (i.c., DEG, RAD, GRAD). Be sure to set the angular mode of the calculator to match that of the inputs, « Note that the triangle described by the program does not conform to standard triangle notation; i.e., A; is not opposite 8). « Angles must be entered as decimals. The (8) [5H] conversion can be used to convert degrees, minutes, and seconds to decimal degrees, © Accuracy of solution may degenerate for triangles containing extremely small angles. 170 Section 10: Applications Programs KEYSTROKES [DISPLAY | KEYSTROKES | DISPLAY | (Octear (racm) | o00- [car 029-45 2| ose) 001-42,21,14 | (RCLI6 030- 45 6| (st0)s 002-44 5] 031- 40) ee 003-33 | (sim) 032-23 (sto}3 oos- 44 3/5) 033-10 fora 008-33. 034-45 1 (01 006-44 1 035-20 (rcx}3 007-45 3 038-44 3 eA oos- 4326 037-22 0 me 008-4311 038~42,21.13 (cas 10-45 5 039-44 4 oe one 4311 o4o- 33 Bo o1z- 30 oai- 44 2 (eu 13-45 1 42-33 (Reus 45 3 oas- 44 1 @ 20 oaa- 45 4 2 2 45-45 2 a 20 oae- 40 10 oa7- 23 ros, 4324 o4s- 45 4 Giz o2zo- 44 2 049- 23 (Gta}o 21-22 0 060-10 022-42,21,12 51-45 1 (sT0)2 023-44 2 052-20 =H 02 33 053-44 3 (sto) 026-44 1 o5a- 22 0 ior) 026— 33 065-42,21,15 (sale 027-44 6 056-44 4 ow 028-23, 057-33, Section 10: Applications Programs: Wt KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY fo7-42,21,14 Joes 44 3 oss 33 jon0- 44 2 osi- 33 os2- 444 (093-42,21, 0 oss 45 2 oss- 45 1 ose- 4226 oo7- 45 3| oss- 34 joss- 30 100-4326 noi- 44 6 oz a8 nos- 4a 4 roa 45 2 hos 40 106-32 9 no7- 44 6 os- 23 os- 20 10-45 1 1-20 a2 2 113-10 oas- 44 2|(sTa10 i14- 44 0 oas- 22 o|) ais- 4B VIZ Section 10: Applications Programs KEYSTROKES: KEYSTROKES: lo 116- 124-22 2 lo we 0 |S 125-42.21, 8 18- 6 |(s)icen 126- 43:35 119-44 26 |(o)/RIN) 127-4332 120-42,21, 2 |Otas 128-42,21, 9 121-46 24 |[605) 129- 122-31 |[eHs) 130-16 123-42 6 |(a)cos) 331-4324 sre] srmucrons | gig | aerernoes | OUTPUT 7 | intern 2 | Surwde 2 | Sa ntt pire [| (DEG, RAD, GRAD) Section TO, Applications Programs = 173 ster sraucTiONS pataruarrs | FEVSTROKES | garavuntrs | S813 aie __ fer [sitet 5 wre | Sin? 3 (ENTER) Seo wl Ae otoste | 5 | asa mon included side} ar Angie 3 Ay (ENTER) | | sae s | | anges A @ ana | Gorosten9 | 5 | SAAT anges + adjacensida} fater | Site 1 Ss: Crna Angle A Angle? A hea Goose 1 | SAS 12 sides + inched ang) tor | Site Ss CENTER Angle 1 AL (eure) Se? S o wer ota sep. 8 | SAD sites + adacont ange} _ fer: | sie 5 ENTER] | Site? 3 oe 174: Section 10: Applications Programs TAPUT iesraucTiONS loarnrunrTs Tote the remaining sides ond angles Ho alternative triangle is possible 9 | second triangle is poste Example 1: A surveyor is to find the area and dimensions of a triangular land parcel. From point A, the distances to B and C are measured with an electronic distunce meter. The angie between AB and AC is also measured. Find the area and other dimensions of the triangle. A 297.35 meters 98° 12" NN —__ c 171.63 meters, Ve ever veer ve Section 10: Appiications Programs 175 ‘Thisis a side-angle-side problem where: $,=171.63, A,=98°12' and S)=297.35. Keystrokes Display (EG) OEn2 Set User mode. 171.63 (ENTER) 171.63 98.12 (0)[-oH) 98.20 297.35 (0) 25,266.21 Area. 171.63 8 A 98.20 Ay 297.35 Ss 27.83 Ay 363.91 Ss 53.97 As Example 2: Given 2 sides and a nonincluded angle, solve for the triangle: Side, = 25.6 Sidey = 328 Angleg 2.3 178 Section 10: Applications Programs Keystrokes Display 28.6 (ENTER) 26.60 32.8 32.80 42.3) 410.85 Area. 26.60 Sy 78.12 Ay 32.80 8, 42.30 Ag 37.22 Sy 59.68 As 2.00 Second Solution, 124.68 Area. 26.60 8, 17.28 A 32.80 8, 42.30 Ay 11.30 83 120.42 Ag t Statistics Paired t Statistics Given a set of paired observations from two normal populations with means 1, #2 (unknown) let sp= Section 10: Applications Programs 177 ‘The test statistic Bb 8D vr which has 1 ~ 1 degrees of freedom (df) can be used to test the null hypothesis, Hy: wy = uo. +t Statistic for Two Means Suppose {2;,.2,-, ¥n,} aNd [Y1, ¥2, .--.Yng! are independent random samples from two normal populations having means 1; and pz (unknown) and the same unknown variance o”. We want to test the null hypothesis Hy: y — 4 =d. Equations: 1 fee? —mi? + Sy — mi me mm =2 We can use this t statistic (which has the t distribution with n, + np — 2 degrees of freedom (df) to test the null hypothesis Ho. References: 1. Statistics in Research, B. Ostle, lowa State University Press, 1963. 2. Statistical Theory and Methodology in Science and Engi- neering, K.A. Brownlee, John Wiley and Sons, 1965. 178 Section 10: Applications Programe KEYSTROKES | DISPLAY KEYSTROKES | DISPLAY MDcuear (PaGM) | 0o0- (sroIe2 029-442 Aww 001-42,21.11 | [ACLIO 030-45 0 el 002- 30 jo o31- 44.0 Ga 003- 4g|o 032- o (cas) oos- 31 |fcuean(s) joss 4232 a (005~42,21.13 034-31 006-43 0 035-42,21,14 007-44 6) 446 oos- 31 451 os 009- 43.48) 45 2 o1o- st a4 fecur) on- 45 6! 34 012-45 0] 443 o- t 430 014-20) aa 8 o1s- 34 34 16-10) 45 0 o7- at 20 o1s- 45 0) 45.0 o18- 1 10 020-30 aa 7 o2t- 31 34 022-2213 30 023-42,21.12 45 6 24-48 30 025-1 45 4 026-45 1 453 27-441 457 o28- 45 2|i0 os7- 20 ~~~ Section 10: Applications Programs 179 KEYSTROKES | DISPLAY KEYSTROKES | DISPLAY a 088. Reo HOO [es Tea (074- 15] [coat] 076-45 0] (mct}e 062-45 Bllid o76- 18 Gl 063- o77- 40 2 064 om [RcLio o6s- 45 olf) 073-20 fcr] e REGISTERS” Rj Unused Ry: 3x Sy 3D [Re unacea | Re: a RyRy Unused ‘Entries before the semiculon indleate ragiater nage fo the t Statietna fue Ban Moan program. Entries atter the semicolon aze for the Puived t Statistics program. A hlank entry represents unused a single entry withaut a semicolon ia valid for both programs INPUT: DATA/UNITS ‘ourPuT DATA/UNITS stmucTiONS Key infines 001-022, Inia the program, Repeat steps 5100) = 1, 2, 10 Repaat step 90 review 91 (8) 103 (8) 180 Section 10: Applications Programs ap oF Saction 10: Applications Programs = 181 arPaT Y} 0) Example 1: wsrauenions DATA/UNITS ae) ; x | 14 |178| 17 [176 [15.4 yd vy | 17 [20.7/ 21-6 [209 |172 Ts @ i )) ) Find D, sp. ¢and df for the above data. 5 | fopnona Yo caret eronoue 1, ) Keystrokes Display She Ae yo) eA )y Setter Mode (CLEAR [REC] 8 _| Tocabelte ast sans: i 14 (ENTER) 17 [4] 1.0000 @ Yi) 47 CeneR} 15 (a) 2.0000 Error. ” yi oy 17RD # I 15 Ell 1.0000 Correction. t t ) 17.5 [ENTER)20.7(@) 2.0000 9 a 17 (ENTER|21.6(&) 3.0000 5 )) ) 17-5 [ENTER}209/2) 4.0000 7 | Repeat top 6 trview the results 154[ENTER}172°%) 6.0000 - 1 Statetic for Two Means a} > -3.2000 DB 1.0000 8 1 | key woes 073-088, )) fee ~7.1854 e 2. | twit the program. (E)CLeAR (REG) jy) &8 4.0000 af 3. | Sat user mode | 4 | Inputs i @ i yl) x| 79] 84|108|114]120)103/122/120 | 5_| Tocorect erraneous mput 1) A ices) ua yf > y} 91] 103) 90]113]108) 87/100) 80 |99| 54 §_{ ton fr he soon a of | Hd =0tie,, Ho 21 ~ uy) find t and df for the above data, wo Repeat pe 8 f00/=1.2 ) ) Keystrokes Display 7 | tpt, ” @ctear bes ) 2 Te(Bje4(a}99 8 | Toconat eroneous nut n iI ) 2.0000 & | tnput tt clei as statisti: | a df | 8.0000 | d 0.0000 ) ) 182 Section 10: Applications Programs Keystrokes Display 90(8)113 B) 108 (5)87 8) 80 (8) 99 (8/54 (8) 10.0000 ofp) 1.7316 t &S) 16.0000 df Chi-Square Evaluation This program calculates the value of the x” statistic for the goodness of fit test by the equation: (df=n-Y) where 0; E, = expected frequency. If the expected values are equal, E=E=——* foralli, n then M20? so WEG, i Note: In order to apply the goodness of fit test to a set of given data, combining some classes may be necessary to ensure that each expected frequency is not too small (say, not less than 5). Reference: Mathematical Statistics, J.E. Freund, Prentice Hall, 1962. weve Section 10: Applications Programs 183 {[ievstaoxes | oisPiay | KEYSTROKES | DISPLAY ctean (ero |ooo- THO 022-2213 Rena (001-42,21,11 (o23-42.21.12 [IEA 002-43, 6. 0 024- 49 [oos-42,21, 0|(RS) 025-31 | cacecite) 026-42,21,14 [RcLlo 027-45 0 een 028-45 2 Ce) o29- 20 (ce) 030-45 1 iG 031- 10 010-43, 6, o|(Rcut 032-45 3 one 16/5 033-30 012-4440, 1 |(WS 034-31 013- 1 036-45 1 014-43, 6, 0 036-45 0 o- 16 o3s7- to 016-44.40, 0 038-31 o17- 45 0 039-2214 fos an | (040242,21.16 019-42.21.13 041-43, 4, 0 20-45 4 42-22 0 ou- at REGISTERS SYS nus] Ry Index Rye 20; Ry SOF Ry Used Ry Used Ag Used Re—Rgi Unused 184 Saction 50: Applications Programs 8_| Toco acneout 0, or fy | Coleiate x1. Repeat step 6 to review the result (Dctean RES) Ropeat steps 3-4 for i=1, 2, 0. 3_| moto, o @ é 4 | To conect eranaaus 0, % fries bt & | catia af o | « £ Aopen sep 510 elo an. Example 1; Find the value of the ,* statistic for the goodness of fit for the following data set: so | 47 | 56 | 5 | 14 46.75 | 61.85 | 64.4 | 8.25 | 9.15 wwe Section 10 Applications Programs — 188 Keystrokes Display (crear falar Set User Mode. 8 9.6 (A) 1.0000 5O[ENTER]46,75 [A] 2.0000 47 51.85 3.0000 S6[ENTER|54.4(A] 4.0000 100 [ENTER](A] 5.0000 Error. 100 [ENTER)(E} 4.0000 Correction. S(ENTER}8.25(A) 6.0000 14(ENTER]9.15[) 6.0000 4.8444 x? Example 2: The following table shows the observed frequencies in toasing a die 120 times. x can be used to test if the die is fair. (df 5) Note: Assume that the expected frequencies are equal. Number 1 2 3 4 5 | 6 Frequency O; 25 17 15 23 24 16 Keystrokes Display (crear 26(8)17(8)19(B] 3.0000 Error. 19[9)(2-) 2.0000 Correction. 15 (6]23 [B24 1 6.0000 @) 8.0000 x? cS 20.0000 E ‘The value of x? for df = 5 and 5% significance (found on p. 438 of Freund’s Mathematical Statistics, Ind edition) is 11.070. Since 5.00 is less than 11.070, no statistically significant differences exist between the observed and expected frequencies. Finance: Annuities and Compound Amounts ‘This program can be used to salve a variety of problems involving money and time. The following variables (except the interest rate, 186 Section 10: Applications Programs which must be given) can be either inputs or outputs: n: The number of compounding periods. (For a 30 year loan with monthly payments, n = 12 X 30 = 360.) i: The periodic interest rate expressed as a percentage. (For other than annual compounding, divide the annual percent- age rate by the number of compounding periods in a year, i.e. 10% annual interest compounded monthly equals 10/12 or 0.83%) PV: The present value of the cash flow or compound amounts. PMT: The periodic payment, FV: The future value; the final cash flow (balloon payment or remaining balance) or the compounded value of a series of cash flows. Accumulated interest and remaining balance may also be computed with this program. The program accommodates payments which are made at the beginning or end of compounding periods. Payments made at the end of compounding periods (ordinary annuity) are common in direct reduction loans and mortgages while payments at the beginning of compounding periods (annuity due) are common in leasing. For ordinary annuity press [A] and then until 1 is displayed. For annuity due press (A) ther juntil 0 is displayed. ‘This program uses the convention that cash outlays are input as negative, and cash incomes are input as positive. Pressing provides a safe, convenient, easy to remember method of preparing the calculator for a new problem. However, it is not necessary to use [f] CLEAR ‘between problems containing the same combination of variables. For instance, any number of n, i, PV, PMT, FV problems involving different numbers and/or different combinations of knowns can be done in succession without clearing the registers. Only the values which change from problem to problem would have to be keyed in. To change the combination of variables without using [#) CLEAR (REG), simply input zero for any variable which is no longer applicable. To go from a problem where a, i, PMT, PV are knowns toa problem where n, i, PV, FV are knowns, a zero would be stored in place of PMT. The following table summarizes these procedures. Ve eV Ve vevVeve Ve VEY Ye Yr YE YY UY Section 10; Applications Programs = 187 Possible Solutions Using Annuities and Compound Amounts Unterest is given) Applications l 1 — Initial | Ordinary Annuity Procedure Variables Annuity 1, PV, PAT, Direct reduc- | Leases Use (input any two | tion loan [CLEAR [REG] and calculate Discounted or set FV tozero the third) notes Mortgages 1, PV, PMT, FV | Directreduc- |Leasewith | None (input any three| tion loan with | residual values! andcalculate | balloon the fourth). Discounted notes with | balloon i PMT.FV | Sinkingfund | Periodic Use (input any two savings, (CLEAR and calculate | or set FV tozero the third}, Insurance L | 7. PV.FV ‘Compound amount | Use { {input any two | Savings | [CLEAR | and calculste | (Annuity mode is not applicable | or set PMT to zero the third) and has no effect) l Equations: PMT. . PV = —— All -(1 si"+ FV +i where aefh ordinary annuity (1 +i) annuity due Note: ‘© Problems with an interest rate of 0 will result in Error 0. * Problems with extremely high (10°) or low values (10°) for n or imay give invalid results. 188 Section 10: Applications Programs 029-44 1 001-42,21.11| (3) 030- 43.32 002-42, 7, 2 031-42,21,13 003-44 a|(sia)3 032-48 3 004-42.21. 4 033-31 oos- ——_33|(G58)1 034-321 o 008 of ase)2 035-32 2 wee 007-43, 6, 0|(cHS) 034 16 1 008 alsros 037-44 3 @EFo 009-43, 6. O|[a)(RTN) 038-4332 {GIR=0) 010-43 40) 039-42,21,14 011-43, 4, olfsral4 o40- 44 4 o12- 22 4 oat- 31 013-42,21,12|1 042— 1 o14- 44 1|STO)4 oag- 44 4| o1s- —_31i{ese)1 4a 321 o1e- 32 1 o4s- 15 017-45 5|(RCL)3 o4e- 45 3 o1B- 43 36|{685}2 047-32 2 o19- 30 oas- 20 020-45 | os9- 16 oz1- 43 36|{876)4 060-44 4 022- 061-4332 023- 052-42,21.15 024- 053-44 5 025- os4- it 026- oss- 32 1 027- ose 45 3 057-40 vv Veevvve VY wee Vee een Section 10: Applications Pragrams 189. KEYSTROKES | DISPLAY | KEYSTROKES | DISPLAY Ren? oss. 48 7/0 [ove ose- 10 (sro)? o77- o7e- 1 086-20 [068-44 o|fajiarw) os7- 4332 ovo- 40 |MTa2 | ose-az.an. 2 o71- ose- 45 5 072-43, 6, 0 [RUT 090-45 7 o73- 44 0 osi- 20 074-45 4 _ [092-40 ome 6 ~ REGISTERS Ri Unused Ro: 1 or 14100] Rn Ry PV Rei 14/100 Ry -+1/100) "| 190 Section 10: Applications Programs ste instructions. pataruurrs | NEVSTAOMES | ADT ta prog. S 2 | Set User mode. “5 | einai ites 4 | papers inerest ate om | @ ‘ts 5 | Serna aay mate 7s) 100 x annuity ve made ws | 00 repeating this step toggles ~ Doxa oo node 6 | Input the known values: - je Number of periods - “ & a © Present value Pp | ig Pv odie payment Pur ae PMT Fue abe a a w Marte fps BRS - # Present value Os) Py +Food pveunt ec Pur Fee i SRS) a B_| To modity the problem, go to st bd charge te spot vatues Input zeta for any valve wt appl | eaten new bi, 2 [ Fornemcave grasp Example 1; If you place $155 in a savings account paying 5%% compounded monthly, what sum of money can you withdraw at the end of 9 years? wee Vee YY Ye YY DY Section 10: Appiications Programs 194 Fv? 4 | 1 2 3 106 107 108} | a — PY =—155 Keystrokes Display (ACLEAR [RES ‘Set User mode. 5.78 12018) 0.48 % monthly interest rate. 0.00 Annuity due. 108.00 # of months. -155.00 Initial deposit, 259.74 FV Example 2: You receive $30,000 from a bank as a 30 year, 13% mortgage. What monthly payment must you make to the bank to fully amortize the mortgage? =] al eal {CASH OUTLAYS) 492° Section 10: Applications Programs Keystrokes Display [MICLEAR (REG) 13 (ENTER)12(1A] 1.08 Yomonthly interest rate. 1.00 Ordinary annuity. 30(ENTER]12(x](6] 360.00 n 30000 [¢) 30,000.00 Py oi -331.86 PMT Example 3: Two individuals are constructing a loan with a balloon payment. The loan amount is $3,600, and it is agreed that the annual interest rate will be 10% with 36 monthly payments of $100. What balloon payment amount, to be paid coincident with the 36 payment, is required to fulfill the loan agreement? (Note the cash flow diagram below is with respect to the lender. For the borrower, the appropriate diagram will be exactly the opposite.) . | os { 36 PMT PMT PMT PMT PMT 100 +100 100 100 100 PV =-3600 Fv? Keystrokes Display (CLEAR TO[ENTERJI2=JA] 0.83 % monthly interest rate. ic] 1.00 Ordinary annuity. 36(B) 36.00 a 3600 (6x8): ~3,600.00 PV 100(B)(E] 675.27 FV (Note that the final payment is $675.27 + $100.00 = $775.27 since the final payment falls at the end of the last period.) Section 10° Applications Programs 193 Example 4: This program may also be used to calculate accumulated interest/remaining balance for loans. The accumu- lated interest between two points in time, n, and no, is just the total payments made in that period less the principal reduction in that period. The principal reduction is the difference of the remaining balances for the two points in time. . For a 360 month, $50,000 loan at a 14% annual interest rate, find the remaining balance after the 24th payment and the accrued interest for payments 13-24 (between the 12th and 24th payments). First we must calculate the payment on the loan: Keystrokes Display (CLEAR [FEC] 360 360.00 a 14 12 1A7 i (Ws) 1.00 Ordinary annuity. 50000 -80,000.00 PV (Bl 592.44 PMT The remaining balance at month 24 is: 24 BEI 49,749.56 © FVat month 24. Store this remaining balance and calculate the remaining balance at month 12: 12 (6) 49,883.48 FV at month 12, ‘The principal reduction between payments 12 and 24 is: a 133.92 ‘The accrued interest is 12 payments less the principal reduction: (Recs 12f) 7,109.23 Total paid out. f200) 6,975.31 Accrued interest, Example 6: A third party leasing firm is considering the purchase of a minicomputer priced at $63,000 and intends to achieve a 13% annual yield by leasing the computer to a customer for a 5-year period. Ownership is retained by the leasing firm, and at the end of the lease they expect to be able to sell the equipment for at least $10,000. (Since lease payments occur at the start of each 194 Section 10: Applications Programs period, this is an annuity due problem.) What monthly payment should the firm charge in order to achieve the 13% yield? stats ve oa! 59 | 80 PMT? PMT? PMT? PMT? FV PV =-63,000 Keystrokes Display (icLEAR ; (ENTER) 12 1.08 i 0.00 Annuity due. 5 12)8) 60.00 2 63000 [CHS](C} ~63,000.00 FV 10000 &)(B)| 1,300.16 PMT the price is increased to $70,000 what should the payments be? [ca] 70,000.00 or 1,487.73 PMT Submarine Hunt Using your destroyer, try to locate the position of the enemy submarine in a 10 x 10 grid, then destroy it with a depth charge. Input a seed (between 0 and 1) and the calculator will position the submarine in the center of the 100 squares (R,C), where R = row, and C= column, and where R and C can each be 0, 1, 2,... 9. Section 10: Appiications Programs 195 Make guesses as to where you think the eubmarine is hiding by taking sonar readings. Input the location of your destroyer (R,C) and press (8). If the submarine is in one of the 8 adjacent squar (or directly under your destroyer), the calculator will display Otherwise, a “0” will be shown. When you think you've located the submarine, move your destroyer directly over it (move to the same square) and drop a depth charge. Blinking “1's” indicate a hit, while a “0” shows a miss. If you miss, the submarine will move randomly to one of the 4 adjacent squares in the same row or column. To make a more challenging game, press mediately after inputting the seed. This allows the submarine to move after each sonar echo as well as after each depth charge miss. The submarine always moves randomly to an adjacent square in the eame row or column. A depth charge has a range of 0.9 squares. When you position your destroyer for a depth charge drop, you may move anywhere on the board, not just to the center of a square. For instance, a depth charge dropped from a (2.5, 6.5) location would destroy any submarine in the center of squares (2, 6) (2, 7)(3, 6)and (3, 7). ‘Try to destroy the submarine using no more than 10 sonar readings and 1 depth charge. You can check your status any time the display is steady by pressing [D). Status format is XX.YY where: XX = Number of depth charges fired. YY =Number of sonar readings. keystrokes | pispLay | KEYSTROKES | DISPLAY (cuear acm) | 000- [mom oos- 43.32 001-42,21.13/ (0S) (006-42,21.15 1 002 a|@cuear Ges) |oo7- 4234 (sT0}0 003-44 o[taiiero 008-43, 6, 0 SFO 004-43, 4, o[sTolmaNi) —foos- 4.36 196 © Section 10: Apptications Programs ay ? Section 10 Applications Programs 197, kevstroxes | vispray | KevsTaoxes | DISPLAY yO KEYSTROKES | DISPLAY KeysTaoKes | _ DISPLAY sat) O10- 32 9 | (IRS) 039-4231 yp) 5 068- 6| HERO 097-42. 7, | on- 441 [(atar) oao- 43.32 ) [eesa o69- 42 20 HIRT o98- 43.32 012-32 8 041~42,21,12 on fac o70- 22 of (Haile 099-42,21, 6 13-44 2/1 042~ 1 ‘ (Ret) o71- 45 4] 100-45 2} 014-42, 7, 0 |StOIGs 043-44,40, 8 } > ea 072-32 1 101- 30] o1s- 43.35 |e) eae 33 yoy [sr 073-44 4 102-34 o16- 43 32 |A(EKIO 045-42, 7. 0 | (ero2 074-22 2 103-45 1 017-42,21,11 046-43, 5, 1 , i 075-42.21. o| 104. 30) o18- 1 |(s86 oa7- 32 6 3 o76- 46 2 105-43 26] 019-4440, 7 o4s- 45 0 yoy 077-32 1 108-44 4] 020-33 049-44 5 shy o7e- 44 2 107-43, 6. 1 021-43, 4, 1 050-43. 6. 0 079-22 2 108-22 0 022-32 6 51-32 5 0 080-42.21. 1] 109- 1 023-4330 052-45 3 oy ost- 45 of O 110-30) 024-22 0 063-43 32 yy oaz- 4 111-42,21, 0| 028 1 064-42,21, 5 ly 083-43 10| (5) 12-48 o2ze- 44 65 |(asele ose- 32 9 oa4- 22 O19 113- 9 027-325 4 dy 3 o8s- Efe 114 30 o2e- 4332 34 Moo ose- 34 115-4310 028-42,21, 0 4220 ly 087-4210] 116-22 0 030- 9 22 0) - (TRTN) ose- 43 32 17 o 031- 18 45 5 > 089-42,21. 0} 118-22 1 Gms 032-42. 7. 3 16 | 090- 45 6 119-42,21, 0 (ESE) 033-4231 224 3 091- alt 120- 1 orms 034-42, 7, 5 063-42,21. 0 092-20) (Ua 121-42,21, 1 OR 035-4231 064-45 5 } 093- 30| (S70)3 122-44 3 036-42. 7. 7 065-42,21, 1 ) 094-43 32| (RIN) 123-4332 037-4231 066-44 6 ) 095~42,21, 2| (aL) 124-42,21,14 038-42, 7, 9 |[cs8]9 967-32 9 96-45 3] (Hir2 125-42. 7. 2 198 ‘Section 10: Applications Programs KEYSTROKES | DISPLAY KEYSTROKES | DISPLAY (RC)? 126- 48 7(7GeD9 133-42,21, 9 (Reve 127-48 8 (DRAW 134-42 36| (x 128. 26/1 136- 1| 2 129- 2|o 136~ ° G 130-10) 137-20 131- 40 |(SILINT) 138-4344 wm) 132-43 32 (aan) 139-43 32 REGISTERS Ry: Unused Ro: 0.1 Ry Py Ry: Po Rg: Response Ryd Rig: Used Re: Used R: Used Ry: Used /sTeP wsTaUCTIONS pataumirs | REVSTROKES | oT re 1 | kay inthe program 2_| serUeer mode, 3_| Input seed between O an). a B ° 4+ | Fraga game, goto step 6 | seac stern game (submarine says moving) a 1 6 | Seow ow (eae) "means no echo, al Dat 1" means ocho reine. on Depth Charge Row (ENTER) 0" means mie al @ oo ‘Binking “1's” means HT ‘ik Section 10: Apy INSTRUCTIONS Neu lOATA/UNITS: cations Programs — 199 ourPuT NEVSTRONES DATA/UMITS 7_[ Repeat step 6 wt submarin is hit Te evi status at oy ti XX = number of dapth charges fed | ¥¥=unber snr ec 8 |For now game gota step 3 4 200 Section 10: Applications Programs aS ayT ] erie “3 mi a Te + ea Ee mi if rst by 2 A i fo io 0 9 3 ary 8! bt i 6B a sit po i [or Playing boards for Submarine Hunt. You might wish to use copies of this page for your games. Section 10: Applications Programs — 204 Example 1: Keystrokes Set User mode. 0.58 (E) °. First move: 3 8 1. Echo. ‘You now know your enemy is in one of the x squares below. Display 12.9 (4 8.6)7/(6|s t { + Sen] or! oa] ORICIES aula 5/6 7/8 3| Diagram of 1" move Second move: 4 (ENTER)? (8) No echo. ‘Thewubmvasine cannot bein the(®)squares below. 1012/3 4/5/6|7.8'9 | wee t 7 jj | [ao oo XxX joespora a Pate Bala [o:112 34/5 [6;7(e/9} Diagram of 2 move 202 Section 10: Applications Programs Third move: 2 (ENTER), °. ‘You've narrowed down the submarine’s location to just 2 squares, those containing an x with no circle. 56 7a 9 No echo. lO = Nioip ool @ ~ CoP oH 1 Asa f alla of 3° move 9 (8) 1. Echo, Fourth move: This eliminates (2, 7) as a submarine location, so you've found it. [Jo 12 2/3415 87. a9 3) f a EJ T 8 7| 7 (6 a) 5) T 7. TS aD {3 3 iE 2 1 4 ol co l oiaa4se7a9 Diagram of 4" move Fifth move: 4 (ENTER) 9) 0.111 0.19114 ) ) Section 10: Applications Programs = 203 0.4919911 O.191999114 0.411999111 Abit! Example 2: Keystrokes Display 0.6 ° oq 1 Submarine will now move on sonar echoes as well as on depth charge misses. First move: 7 (ENTEA)$ 3) 1. Echo. The submarine is in one of the x squares in the left diagram below. But the submarine moves, so now itcould be in any of the x squares in the: wriahy iagram below. = DD i OI =|) e/a Diagrams of 1" move ‘Second move: 6 (ENTER) 4 (8) 9. You've eliminated some positions (left diagram:(x)), but new possible positions have been created by the enemy’s random move (right diagram), No echo. 204 — Section 10: Applications Programs Diagram of 2 move ‘Third move: 7 1. Echo. This eliminates many possible positions (left diagram), but again, new ones are created (right diagram). lnaas 67a Diagram of 3° move ‘Section 10: Applications Programs: Fourth move: You try a depth charge. 8 ENTER)3 0.111 0.11991 onan O.119189191 0.199919411 | Ahit! It pays to be lucky. ‘The submarine used to be here: 205 Section 11 Programming Techniques Structure What we mean by “structure” is the notion that even in a language as far from English as the HP-11C programming language there can be organization. We want you to realize that the programs you run on the HP-11C can be both useful and “friendly”. But itis up to you, the programmer, to make them that way. What is involved is a little forethought and planning to make your programs efficient, readable and correctable. This section is a compilation of techniques and examples that we hope will aid you in writing such programs, The Problem Statement ‘The first step involved in writing a program is stating the problem to be solved. This may seem an obvious step, but often it is completely omitted. The programmer then finds that the program does not produce the desired results because the original objective wag not clear. This first step is always important because it gives both a clear idea of the problem and a definite direction to its solution, It is only then that one can start the logical development ofthe program. Example: Suppose we want to find the roots of the equation ax? + bx +c=0, where a, b and c are constants. Our problem statement ‘might then be: “With inputs of a, 6 and ¢, find both solutions to the equation ax” | bx | ¢=0." Again, such a statement may seem obvious, but it supplies the two fundamental quantities: 1) the data we must supply and 2) the output we desire, With these two essentials and the concept of a solution we can go on to the second step, that of designing the algorithm. The Algorithm An algorithm is not a program, but an outline of the logical steps required to solve the problem. Such an algorithm should be non- specific at first, solving the problem through logical steps but 206 tion 11: Programming Techniques 207 leaving the details out. The necessary details will be filled in later as programming language, space, and personal preference dictate. For now, all we are trying to accomplish is to lay down the foundations of the solution. In the case at hand, we might choose to solve the problem using the quadratic equation, namely: With this equation to guide us, our initial algorithm might look like this Find 6? ~ 4ac. —b + /6*— dae 2a If the difference is positive, find 4 z= Ifthe difference is negative, find "and £¥15"— acl 2a 2a In the case where 6? ~ 4ac is positive, the solution is in the form of two real roots. When the difference is negative, the solution is in the form of two complex numbers. Note that none of the above statements define actual program steps. What.is defined is the sequence of events required to arrive at the solution. Refinement of the basic algorithm will bring out repeating patterns and condensable sequences that suggest the actual program steps that will ultimately be used. ‘The revision process will also help to keep your programming objectives in mind. One such refinement might be: Using the hypothetical registers R., Rp, and Re do the followin 1. Take the negative of b and divide it by twice a. 2, Store this result in R4. 3. Square b, subtract four a times c from it and store the result inRg. 4. Take the square root of the absolute value of Rp and divide it by twice a. 208 Section 11: Programming Techniques 5. Store this result in Re. 6, If the value in Ra is positive or zero add the numbers in Ry. and Ry together and display the (real) result. 7. Ifthe value in Rp is leas than zero display the contents of R and Re separately (the complex root). 8. Change the sign of the value in Re and repeat the previous two steps In this refinement, we realize the importance of using registers to store intermediate results. Also, the operations are better defined and consideration is given to the actual output. ‘The degree of refinement of the final algorithm is up to personal preference, but the more refined the algorithm the less likely the program itself will have to be later modified in order to work properly. Our final algorithm takes us to a satisfactory level. Using the hypothetical registers R4, Ry, Rc, Rp and Ry do the following: 1. Store in Ry, negative d in Rg and cin Re. 2. Divide Rg by twice Ry and store the result in Rp. 3. Subtract four Ry times Re from Rp squared and store the result in Rp. 4, Find the square root of the absolute value of Rx and divide it by twice Ry. Store this value in Ry. 5. If Ryis positive or zero add Ry to Rp and display the result, If Reis negative display Ry and Ry separately. 7. Change the sign of Ry and repeat the previous two step: This algorithm takes into account the initial storage of data and reuses Ry, thereby reducing the total number of storage registers needed. Flowcharts A useful way of visualizing your developing algorithm is to use a “flowchart”. A flowchart is a diagram of the flow of the algorithm, giving form to the train of thought you are developing. An example that uses our developed algorithm ~wwwue / Stor NO Section 11: Programming Techniques 209 fea in Ra bins and in Re. Store Re/2Rain Ro. | DisplayRe——// signof Re | ee ee. been dis- \ played? ‘Add Ra to Rr and i o // display the resul Display Ri [/_Alsplay the result 210 Section 11: Programming Techniques ‘At first glance this may look complicated, but closer inspection reveals a simple logic. To read the chart, start at the upper left- hand corner and follow the arrows, Bach box is connected to the next by one-way arrows. In other words, the flow ie in one direction, generally from top to bottom. Note that at the box marked #1 there choice of exits or a “branch”. The direction of flow at this point is determined by the answer to the question asked within the box, in this case, “Is the value in Rg greater than or equal to zero?” An answer of “yes channels the flow to the right while an answer of “no” channels the flow downward. ‘As you can see, a flowchart can be very useful in eliminating confusion, especially around branches and loops, where there is an option in the direction of program flow. Subroutines Perhaps the first thing you notice when previewing the Matrix Algebra program is its surprising length. It is so long that it cannot be contained, in its entirety, in the memory of the calculator. What is not immediately obvious is that it is also a highly condensed program. This is because the program takes advantage of the many repeated patterns involved in solving the problem. In fact, even the operation of taking the matrix’s inverse is repeated. ‘Therefore, this and several lesser functions have been incorporated ‘into the program as subroutines. ‘Technically, in the language of the calculator, a subroutine can be any series of keystrokes that begins with a label jn) and ends with a return, ) or the end of the program. These boundaries allow entry int exit from the subroutine. (In fact, entry into subroutine may be achieved at any line number. Refer to page 137, Indirect Line Number Branches and Subroutines.) Access is gained to the subroutine via the (GSB) n (go to subroutine n) command. Notice that in the main body (steps 000 through 078) of the Matrix Algebra program 8 is encountered eight times. Each time, the flow jumps from , completes the series of steps between and [RIN], and returns to the step immediately following (G58)}8. The usefulness of the subroutine becomes obvious first in its space savings. It is better to call subroutine 8 with eight (6S6)’s than to VRE EeVeevve Section 11: Programming Techniques = 241 rewrite the subroutine’s steps eight times. What you also notice is an increase in organization from using a subroutine. The program has been broken down into its component parts. Each part, by itself, is easier to read and understand than the unsectioned program. Once the function of each part is understood, the program can be read as a whole with better understanding. This compartmentalization also simplifies error correction. Errors can be more easily isolated and the corrections are less likely to have adverse effects on other parts of the program. (ISG) With (RCL) [(i) When looking for repeating patterns in your algorithms, it is also good practice to look for sequential storage and recall, ie. (STO) 2 ... (STG) & ete. Such sequences may be incorporated into subroutines via the (STO) fi] and (RCL]{fi] functions of the HP-11C, ‘This technique is effectively used in the Matrix Algebra program. Routine “A” (lines 079 through 101) calculates the determinant of the 3 X 3 matrix stored in R; through Ry. Mathematically, the determinant is calculated as: Rs Ry Ry RyRy X Rg Ro XRa) Rg Ry Ro -Rg(Rg X Rg — Ro X Ry) IR, Re Ral + RARg X Ry — Rg XK). Rearrange this to bring out the pattern: ~(RoXRy XR, +RaXRgXR, +R) XRyXR) FRX Re XH, HKG XK XR, + RGR XR, What results is not just the pattern R x R x R + but also the sequential recall R, to Ro. These two features have been combined into subroutine 9 (lines 001 to 009). In this subroutine [ISG] (Increment and Skip of Greater) is used to increment the Lregister (refer to page 128, Incrementing and Decrementing the Index Register). Each call of the subroutine increases the value stored in R; by 1 and recalls the value stored in the register indicated by the value in Ry {RCL {{j)). Since the fractional portion of the number in the L-register is always zero and 212 Section 11; Progremming Tachniques the integer portion is always greater than zero, the step immediately following [ISG] is always skipped. For this reason @ dummy step, [PSE]in this case, occupies that spot. Stepping through the program will illustrate the subroutine’s function. Instructions First Execution Second Execution Oo) 4 155 1=6 Skipped. Skipped. Recalls Rs. Recalls Rg. R2XRs Ra XRe RoXR2XRs Ry XR Ro O+RoXR2XR5 Stores total in Ro. Adds to previous total. Stores new total in Ro. ‘The space savings is clear. Four steps would have been repeated six times, a total of twenty-four steps. The subroutine condensed this to ten (including 4 (STO) 1) and excluding (ST}0 which would have been performed anyway). Data Input In writing a program, once you have decided on what data your program needs, you must then decide on how it will be stored. Indeed, there are several options depending on the space you have and the number of inputs to be stored. wee Ye Saction 11) Programming Techniques 213 Inthe Triangle Solutions program we have three inputs for each of the following five cases: SSS, ASA, SAA, SAS, and SSA. It is clear that we need five similar but definitely different sequences to input the data. In this case, since the HP-11C has five user-definable keys each key may be given the function of inputting the three variables ina particular case, There are several methods of loading the variables via the user keys. One would be to store the three knowns in their appropriate registers by hand (e.g., S; (S16) 1, A; (STO)2, etc.) then select the appropriate routine via the user keys to solve the particular case. Although this is a satisfactory method when dealing with a few variables or when there is not enough space for an input routine, it is tedious and does not take advantage of the time and effort: saving features of the HP-11C. Another, more common method is the “stop-and-store”. What is done is to select the user key corresponding to the case at hand. The program immediately halts waiting for you to key in the first variable. You do so and press resume program execution. ‘The program stores the data in the appropriate register and halts awaiting the next input. This process repeats until all of the variables have been keyed in, More sophisticated versions of stop- and-store include input loops that prompt you for the input variables, and even allow you to review and modify them (see [18] A in The Systema of Linear Equations with Three Unknowns program). ‘The method we have chosen in the Triangle Solutions program is to load the stack with our input values (we only have three) and select the appropriate user key. The first function of each user key is to store the three inputs in appropriate registers via the sequence (STO) Ra, [A¥), (STO) Rp, (R¥}, (STO) Re. This method, though limited to programs requiring few inputs, is quick and easy, and does not require many program steps. 214 = Section 11: Programming Techniques Looping ‘The Newton's Method program deals with the common problem of approximating a solution to an equation. Such approximations are necessary because finding an exact root to certain functions is often difficult and sometimes impossible. In Newton's Method, we choose a point x at which the function f(x) exists and, we hope, is close to a root of the function. (Applying a little basic algebra will help narrow the guessing range.) What goes on nextis to adjust the guess, calculating a closer approximation of the root based on the initial guess. The calculated value is then used to calculate another closer approximation. This process is repeated with the new guess until, in the limit of an infinite number of repetitions, the exact solution may be reached. We see that a section of the program must be repeated over and over again in succession until we get the answer we desire. Such a section is called a “loop”. (The main loop in this program is between lines 026 and 052.) Of course, an infinite number of repetitions implies an infinite period of time, ao we must set a ‘boundary on the number of iterations performed. ‘One method of setting this boundary would be to insert a counter in the loop such that after each pass through the loop a certain register will have been incremented by one. The total number of repetitions is compared with a desired maximum. The program will then exit from the loop when the two values are equal. (In this program, the maximum is decremented each time and the loop terminates when the value has gone to zero. See line 051.) Notice that this method does not ensure any standard of accuracy. Also, depending on the function and the guess, finding a reasonable answer may take an unreasonable number of repetitions. In other words, stopping the process at even one-hundred repetitions may yield an answer so far from the actual root as to be useless. ‘A preferable method is to test the last two computed values to see whether or not they are significantly different. This difference, called the Ax limit, is up to the user and is input when initializing the program. ‘The format for such a loop is as follows: 1. Store the Ax limit and the initial guess. 2 Compute the first approximation from the guess and storeit. Section 11. Programming Techniques 218. 3. Compute the next approximation from the modified guess and store it. 4. Recall the value of the previous approximation and subtract it from the value of the present approximation. 5. Recall the Ax limit and compare its value with the magnitude of the difference just computed, 6. Ifthe magnitude of the difference is greater than that of the Ax limit continue looping. 7. If the magnitude of the difference is less than that of the 4x limit, exit from the loop. Notice that this method does not guarantee an exit from the loop. The first guess may have been very far from the actual root, or the root may not even exist, The best method then is a combination of the two, as is the method used by this program. Not at all obvious is the fact that the nature of certain functions is such that phantom roots may appear. These phantom roots occur when the slope of the function is ao large that the difference between two consecutive approximations falls within the Ax limit. This program provides a safeguard against this by testing not only the loop count and the Ax limit but also the value of the function at the point in question. The functional value is compared with the tolerance to see how close to zero the user wants the solution to be. Flags When writing a program that deals with different problems in similar but not identical fashions, fags can be used to control the differences in the treatment of the data. Flaga serve as reminders. For instance, when the program performs an optional initial calculation, a flag may be set. Later in the program we may need to know whether or not the operation was performed, so we test the flag, ie., Is flag 0 set? (Was the operation performed?) In this way, flags are part of the decision- making power of the calcualtor. In the Curve Fitting program, three very similar processes may be performed depending on the choice of curve to he fit. To illustrate the role of the flags, two more columns may be added to the chart on page 162. 216 — Section 11: Programming Techniques Regression | a | x, | ¥, | Code] Flag | Flag Exponentiat | ina | x, | Iny; | 1 Set | Clear Logeritnic | in |v, | 2 | clear | set Power | ina | ing, | ny, | 3 Set | Set The two flags are initially set by the program and, depending on the choice of curve fit, one or the other may be cleared in accordance with the above table. The status of the two flags determines the treatment of the input data (x; and y,) as follows: 4 Jip Linpurx: and randy. / “is flag Lo YES 1 Iny, The treatment of the output value(A) is similar. ‘The use of flags here is very convenient. A problem that other might have required three separate programs is solved very neatly in one. The use of flags can become a very powerful tool and will enhance your own personal programs. y ) y Section 11. Programming Techaiques 247 Random Numbers ‘The HP-11C has a convenient built-in function that generates pseudo-random numbers ({RAN#)). By pseudo-random we mean that no calculator or computer, no matter how powerful, can generate a totally random number. The nature of the machine is such that it performs a sequence of established steps on an input and produces a predictable result, So the random number generator on the HP-11C takes a random “seed”, stored by the user, and performs an operation on it to produce a generally unpredictable (by the user) result. This result is always a number between 0 and 1, exclusive of 1. ‘There are several common uses for random numbers, but they are very frequently found in game programs. This seems reasonable because no one likes to play against a completely predictable and redundant opponent. Submarine Hunt is a good example of such a game. The game requires a random initial placement of the submarine and random evasive moves. Notice that the program requires two random integers, the x and y coordinates, that fall between 0 and 9 inclusive. But the random number generator only generates numbers between 0 and 1 exclusive of 1, This turns out to be no problem. Multiplying the output of the random number generator by 10 yields numbers from 0 to 10 exclusive of 10, Taking the integer portion of this result gives the set of whole numbers between 0 and 9 inclusive, which is what we want. The subroutine followin; 9 shows the actual keystrokes, To illustrate the ease in which different ranges of random numbers may be generated let’s take another example. Suppose you need a real number between the limits 34.5 and 98.36 including the lower bound and excluding the upper bound. The routine need only generate values between 0 and 63.86 (98.36 - 34.50) to which the value 34.5 will be added. This range is easily generated by multiplying 63.86 by the output from the random number generator. User-Definable Keys Among the most useful features on the HP-11C are the five user definable keys: (4), (B), (C), (D], and (E]. These keys are particularly useful for three applications 1. Storing data in specific registers (see page 213). 218 Section 11: Programming Techniques, 2, Selecting execution of different routines within a program. 3. Selecting execution of different programs in program memory. ‘The first two applications are used in the Finance program. Storing Data In the Finance program, there are five possible inputs: periodic interest (i), number of periods (n), present value (PV), periodic payment (PMT), and future value (FV). Because there are five user-definable keys, we can assign a routine that stores input data in specific registers to each of these keys. For example, the routine associated with key [C) begins with [1] ©, @), (R75). Bach time key [C)is pressed, the value in stack register X is stored in Ry. Up to 5 values, one associated with each key, may be stored in this way. In addition, these values may be stored in any order. Just key in the value to be atored and press the appropriate user-definable key. Selecting Different Routines A program may be written to calculate more than one value. The selection of which value is to be calculated may be done using the user-definable keys. The key pressed would indicate which value is to be calculated. In the Finance program, for example, the value PMT is calculated by pressing the following sequence: (D] (select PM), (R/S) (calculate). When [0] is pressed, the user is telling the calculator to execute the routine beginning with [LBL] (B). In this program, an inconsequential value is stored in Ry and the calculator is positioned to the proper place to calculate PMT. The value stored is inconsequential because when. pressed, PMT will be calculated and the value in R, will be overwritten, As you can see, the user-definable keys are very useful and can serve more than one purpose. Appendix A Error Conditions If you attempt a calculation containing an improper operation— say division by zero—the display will show Error and a number. To clear an error message, press any Key. ‘The following operations will display Error plus a number: Error 0: Improper Mathematical Operation legal argument to math routine; Gi, where x =0. @), where y =0 and x <0, ory 1. [COS"), where |x| is > 1. I), where x =0. (43, where the value in the Y-register is 0. ), where |x| <1. where|x|>1. (Cus), where: 1. xorynon-integer. 2. xoryless than zero. Bey, 4.2210 jsame as Error 1: Storage Register Overflow Storage register overflow (excep! (22). Magnitude of number in storage register would be larger than 9.999999999 x 10°. Error 2: Improper Statistical Operation 219 220 Appendix A Error Conditions Note: Error 2 is also displayed if division by zero or the square root of a negative number would be required during ‘computation with any of the following formulas _ u : | W SN n=) * nin 1) P MSy-P3x (A and B are the values ™- nM returned by the operation where y = Ar +B.) VMN Error 3: Improper Register Number Named storage register currently converted to program memory, or nonexistent storage register. Error 4: Improper Line Number or Label Call Line number called for is currently unoccupied, or nonexistent (203), attempt to load more than 203 lines of program memory, or label called does not exist. Error 6: Subroutine Level Too Deep. Subroutine nested more than four deep. Error 6: Improper Flag Number Attempted flag name> 1. Error 9: Service Refer to page 233, Verifying Proper Operation Pr Error Continuous memory reset because of power failure. ww Appendix B Stack Lift and LAST X Your HP-11C calculator has been designed to operate in a natural manner. As you have seen as you worked through this handbook, you are seldom required to think about the operation of the automatic memory stack—you merely work through calculations in the same way you would with a pencil and paper, performing one operation at a time. ‘There may be occasions, however, particularly as you program the HP-11C, when you wish to know the effect of a particular operation upon the stack, The following explanation should help you. Digit Entry Termination Most operations on the calculator, whether executed as instruc. tion in a program or pressed from the keyboard, terminate digit entry. This means that the calculator knows that any digits you key in after any of these operations are part of a new number. (The (CHS), (1, (EEX), and [+] operations do not terminate digit entry.) Stack Lift ‘There are three types of operations on the calculator, depending upon how they affect the stack lift. These are stack-disabling operations, stack-enabling operations, and neutral operations. Disabling Operations ‘There are four stack-disabling operations on the calculator.* These operations disable the stack lift, so that a number keyed in after one of these disabling operations writes over the current number in the displayed X-register and the stack does not lift. These special disabling operations are: (ENTER) Ga G4 * Refer to footnote, pane 28. 221 222° Appendix B: Stack Lift and LAST X Enabling Operations Most of the operations on the keyboard, including one- and two- number mathematical functions like [17] and [5], are stack enabling operations. These operations enable the stack lift, so that a number keyed in after one of the enabling operations lifts the stack. Note that switching from Program mode to Run mode and turning the calculator off, then on, are enabling operations. > zw Yo 4.0000 4.0000 53.1301 xef 4 4.0000 3 5.0000 Keys > 4 3 Wee) Stack No stack Stack disabled. lift. enabled. ™ zs Ys[s3.1301 | 63.1301 | 53.1301 | 53.1301 x> 0.0000 7 1.0000, 9 Keys —(3)(cLr 7 9 Stack No stack ‘Stack No stack disabled life disabled. lit Neutral Operations Some operations, like (CHS) and (FX), are neutral; that is, they do not alter the previous status of the stack lift. Thus, if you disable the stack lift by pressing (ENTER), then press (1)(Fix}n and key ina new number, that number will write over the number in the X- register and the stack will not lift. Similarly, if you have previ enabled the stack lift by executing, say [7], then execute a instruction followed by a digit entry sequence, the stack will lift, ‘The following operations are neutral on the HP-11C: CLEAR | ‘CLEAR [REG] Appendix B: Stack Lift andLASTX — 223, (in Run mode may execute an instruction that does enable the stack.) LASTX ‘The following operations savex in LAST X: (os) Gory {sin} {sin SB 1, 2,8, (EHS) to enter voables the stack. (6 [CHS|to enter 128 x 10", But otherwise, Appendix ¢ How Automatic Memory Realloeation Operates Converting Storage Registers to Program Memory ‘The automatic memory reallocation designed into your HP-11C gives you increased versatility by converting storage registers to lines of program memory only as needed. You begin programming with 63 lines of program memory and 20 storage registers (plus the Index register described in section 9). With up to 63 instructions in program memory, the allocation looks like this: STORAGE REGISTERS PROGRAM MEMORY Permanent Shared ‘Shared Permanent RC] mln fo (C800 R, Sx Ry 001- Ls? a_] = Rs Sy Rl : Re Ey Ral —— | RL ral L ae Re Re Shared R,| R, none: Re Ra Ry Re 224 Appendix C: Automatic Memory Reatlocation 225 When you key in a 64th program instruction, storage register Ry converts to memory allocation looks like this: STORAGE REGISTERS Permanent Ry Shared Shared rn RoL__] R, 002— Instruction R, ey Ra 7 Ral ey? Ra Rel xy Rig ] 062- instruction a R (063 Instruction 4 . {Shared} a, Ry ] (064- Instruction Ral Re 065- — 066- mol} oA Par 068- 069- 070- 7 lines of additional program memory. Now the PROGRAM MEMORY Permanent 000- je ei _] 001- Instruction used available 226 © Appendix C: Automatic Memory Restlocation When you record a full 203 lines of program memory, the calculator’s memory registers look like this: STORAGE REGISTERS PROGRAM MEMORY Permanent Permanent R ‘000- (001- instruction [002- instruction K (062- Instruction (063- Instruction 1 Shared 064- Instruction ‘066- Instruction 202- Instruction 203- Instruction Notice that instead of the original 21 storage registers (Ry through Rg, Ro through Rg, and Ry) we now have just the non-convertible Ry. What happened to storage registers Ro through Ry and Ro through Rg? They were converted to program memory at the rate of seven lines per register. The table on page 76 shows the allocation of the lines of program memory to their respective storage registers. ‘As you can see, each time currently available programming space is filled, keying in another command automatically converts the next remaining storage register to seven more lines of program Appendix C: Automatic Memory Reatlocation 227 memory. For example, filling the first 70 lines and then keying a command into line 71 converts register Rg to 7 more lines of Program memory (lines 71-77), and soon. Note: Your HP-11C converts storage registers to program fines in reverse numerical order, from Rg to Ro and then from Rg to Ro. For this reason it is good practice to program your (STO) and [RCL] operations using data registers in the opposite order: that is, beginning with register Ro. This procedure helps avoid accidentally programming (STO) and (REC) for data registers which have been converted to lines of program memory. Remember also thet the calculator does not retain data previously stored in registers that are later converted to lines of program memory. Converting Program Memory to Storage Registers Pressing [7] CLEAR [PRGM] in Program mode converts all shared program memory (lines 064-203) to storage registers Ro through Reg. However, deleting individual lines of program memory allows you to convert portions of shared memory to storage registers without clearing all of program memory. (Refer to page 105, Deleting Instructions.) Using [MEM ‘The [MEM] (memory) function on your calculator describes the current memory allocation in or out of program mode. For example, if you press (0 ][MEM] with 44 lines of program memory occupied, ‘you will see the following display: toe r os Lines remaining to be occupied —_—The next storage register to be before the calculator automati- converted. cally converts a storage register to 7 more program lines. 228/229 Appendix C: Automatic Memory Reatlocation If you press (@](MEM] with 173 lines of program memory occupied, you will see this display: [> p-02 os Lines remaining to be occupied The next storage register to be before the calculator automati- converted. cally converts a storage register to 7 more program lines. If you press (7 (MEW) with 198 lines of program memory occupied, you will see this display: —> p05 r- 7 ing to be occupied No more storage registers canbe before all lines of program mem- _converted to program memory. ory are occupied. Because R; is a permanent storage register with special functions, it is not covered by the [MEM] operation. Note: Remember that the st | functions involve registers Ro through Rs. If one or more of these last six registers are converted to lines of program memory, attempts to execute statistical functions will result in an Error 3. display. Appendix D Battery, Warranty, and Service Information Batteries The HP-11C is powered by three batteries. In “typical” use, the HP-11C has been designed to operate 6 months or more on a set of alkaline batteries. The batteries supplied with the calculator are alkaline, but silver-oxide batteries (which should last twice as long) can also be used. A.set of three fresh alkaline batteries will provide at least 80 hours of continuous program running (the most power-consuming kind of calculator use"). A set of three fresh silver-oxide batteries will provide at least 180 hours of continuous program running. If the calculator is being used to perform operations other than running programs, it uses much less power. When only the display is on— that is, if you are not pressing keys or running programs—very little power is consumed. If the calculator remains turned off, a set of fresh batteries will preserve the contents of Continuous Memory for as long as the batteries would last outside of the calculator—at least 1% years for alkaline batteries or at least 2 years for silver-oxide batteries. The actual lifetime of the batteries depends on how often you use the calculator, whether you use it more for running programs or more for manual calculations, and which functions you use.* WARNING Do not attempt to recharge the batteries; do not store batteries near a source of high heat; do not dispose of batteries in fire. Doing so may cause the batteries to leak or explode. * Power consumption in the HP-11C depends on the mode af calculator use: off (with Continuous Memory preserved); idle (with only the display on} or “operating” (ranning ‘program, performing a calculation, or having a key pressed). While the calculator is ‘wed oo, typical calculator use is a mixture of idle time und “operating” time ‘Thereforo, the actun! lifetime of the batteries depends on how much time the calculator pends in each ofthe three modes. 230 Appendix D: Battery, Warranty, and Service 231 upplied with the calculator, as well as the batteries listed below for replacement, are not rechargeable. The following batteries are recommended for replacement in your HP-11C: Alkaline Byeready A76" Union Carbide (UCAR) A76 National or Panasonic LRA4 Silver-Oxide veready 357* Union Carbide (UCAR) 357 Low-Power Indication An asterisk (*) flashing in the lower-left corner of the display when the calculator is on signifies that the available battery power is nearly exhausted, With alkaline batteries installed: © The calculator can be used for at least 2 hours of continuous program running after the asterisk first appears.* ¢ If the calculator remains turned off, the contents of its Continuous Memory will be preserved for at least 1 month after the asterisk first appears. With silver-oxide batteries installed: * The calculator can be used for at least 15 minutes of continuous program running after the asterisk first appears. ¢ If the calculator remains turned off, the contents of its Continuous Memory will he preserved for at least 1 week after the asterisk first appears. Installing New Batt ‘The contents of the calculator’s Continuous Memory are preserved for a short time while the batteries are out of the calculator (provided that you turn off the calculator before removing the batteries). This allows you ample time to replace the batteries ot Kingdom oF Kepunle of Irelad, the minimum awl fr eantinaisn angrom rianing—that i while 6 In the footnote an the preceeding ype) Wat ine using the for manual calculations aintare ofthe idle und “opera ing! min the enlator che wid fora uch Ringer tine after the asterisk frst ape 232 © Appendix D: Battery, Warranty, and Service Appendix D: Battery, Warranty, and Service 233 without losing data or programs. If the batteries are left out of the calculator for an extended period, the contents of Continuous Memory may be lost. ~~~» ) CAUTION In the next step, replace ail three batteries with fresh ones, If Wu replace only one or two of the batteries, an old battery may leak. Furthermore, be careful net to insert any battery To inatall new batteries, use the ) | ) backwards, f you do so. the contents of Continuous Memory following procedure: fo may be fost and the batteries may be damaged | ) | y 1. Ensure that the calculator is yloy Insert three new batteries off. | under the plastic flap or 2, Holding the calculator as , | ) aps (shielding the batters shown, press outward on the ytd be partie ted ey shoul battery compartment door | « Posstfones te tee flat until itepensaishtly. yo facing towerd the nearby ) | ) rubber foot, as shown in the illustration on the calculator yd case 3. Grasp the outer edge of the a) Insert the tab of the battery battery compartment door, compartment door into the slot then tilt it up and out of the a) intheealeulator ease calculator. dy, ) d Note: In the next two steps, be caretul foto pes ry Hoye he eas we 4, Lower the battery compart Out te ar ye 99 0, e cn > ment door unt ite lush with tents of Continuous Mamory may be lost i the case, then push the door ‘and keyboard control may be lost (that % ) | ) inward until itis tightly shut. the calculator may not respond to ly keystrokes) 9 Press [08] to turn the calcula- tor on. If for any reason yo) Continuous Memory has been reset (that is, if its contents 4, Turn the calculator over and d} > have been lost), the display gently shake, allowing the hy will show Pr Error. Pressing batteries to fall into the palm \ any key will clear this message of your hand. Wy from the display. 234 — Appendix D. Battery, Warranty, and Service Verifying Proper Operation (Self-Tests) If it appears that the calculator will not turn on or otherwise is not operating properly, use the following procedures. For a calculator that does not respond to keystrokes: 1. Press the G) and (GW) keys simultaneously and release them ‘This will alter the contents of the X-register, so clear the X- register afterward. If the calculator still does not respond to keystrokes, remove and reinsert the batteries, Make sure that the batteries are properly positioned in the battery compartment: the flat sides (the sides marked +) should all be facing toward the nearby rubber foot 8. If the calculator still does not respond to keystrokes, leave the batteries in the compartment and short the battery terminals together. (The batteries must remain in place to prevent possible internal damage to the calculator.) With a paper clip or a piece of wire, briefly connect the terminals. Only momentary contact is required. The terminals are matching metal strips, or a combination of one spring and ‘one hard edged tab located at either end of the battery compartment. After you do this, the contents of Continuous Memory will be lost, and you may need to press the [ON] key more than once to turn the calculator back on. 4, Lf the calculator does not turn on, install fresh batteries. If there is still no response, the calculator requires service For a calculator that does respond to keystrokes: 1. With the calculator off, hold down the [ON] key and press [=]. 2. Release the (O€) key, then release the [x] key. This initiates a complete test of the calculator’s electronic circuitry. If everything is working correctly, within about 25 seconds (during which the word running flashes) the display should show ~8,8,8,8,8,8,8,8,8,8, and all of the status indicators ~~ ye ~vvey Appendix D: Battery, Warranty, and Service 238 (except the * low-power indicator) should turn on.* If the display shows Error 9, goes blank, or otherwise does not show the proper result, the calculator requires service.t Note: Tests of the calculator’s electronics are also_per- formed if the [=]key or the [=}key is held down when (ON) is released.tt These tests are included in the calculator to be used in verifying that it is operating properly during manufacture and service. If you had suspected that the calculator was not working properly but the proper display was obtained in step 2, it is likely that you made an error in operating the calculator. We suggest you reread the section in this handbook applicable to your caleulation. If you still experience difficulty, write or telephone Hewlett-Packard at an address or phone number listed under Service (page 237). "The status indicators turned on atthe end ofthis test include some that normally are not Alinplayed on the BP-ALC. tif the caiculator displays Error 9s a result ofthe [ON]/{xJtest or the [ON] [test but you wish to continue using your calcalator, you should reset Continuous Memory as described on page 20. 1 The (ON)’(z) combination initiates a text that ia similar to that described above, but ‘continuea indefinitely. The test can be terminated by pressing any key, which will halt ‘the tert within 25 aeconde, The (OR]/ [combination initiater a test ofthe keyboard and the dieplay. When the (ON) key is released, certain segmenta inthe display willbe it. To run the test, the keys are pressed in order from left to right along each row, from the top row tothe bottom row. As each key ia pressed, different segments in the display arolit. If the calculator is operating properly and all the keys are pressed in the proper order, the calculator will dicplay 11 after the lust key is pressed. (The [ENTER] key should be ‘pressed both with the third-row keys and withthe fourthsow keya,) Ifthe calculator ig not working properly, or if key is pressed out of order, the calculator will display Eeror 19 Note that of thi error display’ results from an incorrect key being presved. this does ‘not indicate that your ealeuiator requires service. This test can be terminated by pressing any key out of order (which will, of course, result in the Error 9 digplay). Both the Error9 display and the 11 dieplay can be cleared by preesing any key. 236 «© Appendix D: Battery, Warranty, and Service Limited One-Year Warranty What We Will Do ‘The HP-11C (except for the batteries, or damage caused by the bat teries) is warranted by Hewlett-Packard against defects in materials and workmanship for one year from the date of original purchase. If you sell your unit or give it as a gift, the warranty is automatically transferred to the new owner and remains in effect for the original one-year period. During the warranty period, we will repair of, at our option, replace at no charge a product that proves to be defective, provided you return the product, shipping prepaid, to a Hewlett-Packard service center. What Is Not Covered Batteries, and damage caused by the batteries, are not covered by the Hewlett-Packard warranty. Check with the battery manufacturer about battery and battery leakage warranties. ‘This warranty does not apply if the product has been damaged by accident or misuse or as the result of service or modification by other than an authorized Hewlett-Packard service center. No other express warranty is given. The repair or replacement of a product is your exclusive remedy. ANY OTHER IMPLIED WAR- RANTY OF MERCHANTABILITY OR FITNESS IS LIMITED TO THE ONE-YEAR DURATION OF THIS WRITTEN WARRANTY. Some states, provinces, or countries do not allow limitations on how long an implied warranty lasts, so the above limitation may not apply to you. IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR CON- SEQUENTIAL DAMAGES. Some states, provinces, or countries do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state, province to province, or country to country. Warranty for Consumer Transactions in the United Kingdom This warranty ehall not apply to consumer transactions and shall not affect the statutory rights of a consumer. In relation to such the rights and obligations of Seller and Buyer shall be determined by statute. wwe aoe Appendix 0: Battery, Warranty, and Service 237 Obligation to Make Changes Products are sold on the basis of specifications applicable at the time of manufacture. Hewlett-Packard shall have no obligation to modify or update products once sold. Warranty Information Ifyou have any questions concerning this warranty, please contact, an authorized Hewlett-Packard dealer or a Hewlett-Packard sales and service office. Should you be unable to contact them, please contact: ¢ Inthe United States: Hewlett-Packard Calculator Service Center 1030 N.E. Circle BIvd. Corvallis, OR 97330 ‘Telephone: (503) 757-2002 © InEurope: Hewlett-Packard S.A. 1150 route du Nant-s'Avril PO. Box (CH-1217 Meyrin Geneva Switzeriand ‘Telephone: (022) 83 81 11 Note: Do not send calculators to this address for repair. © Inother countries: Hewlett-Packard Intercontinental 3495 Deer Creek Rd. Palo Alto, California 94304 USA. hone: (415) 857-1501 Do not send calculators to this address for repair th Not 238 Appendix ©: Battery, warranty. and Service: Service Hewlett-Packard maintains service centers in most major countries throughout the world. You may have your unit repaired at a Hewlett-Packard service center any time it needs service, whether the unit is under warranty or not. There is a charge for repairs after the one-year warranty period. Hewlett-Packard calculator products normally are repaired and reshipped within five (5) working days of receipt at any service center. This is an average time and could possibly vary depending upon the time of year and work load at the service center. The total time you are without your unit will depend largely on the shipping time. Obtaining Repair Service in the United States ‘The Hewlett-Packard United States Service Center for handheld and portable calculator products is located in Corvallis, Oregon: Hewlett-Packard Company P.O. Box 998 Corvalis, Oregon 97339, USA. or 1030 NE. Circle Bivd. Corvalis, Oregon 97330, USA. ‘Telephone: (503) 757-2000 Obtaining Repair Service in Europe Service centers are maintained at the following locations. For countries not listed, contact the dealer where you purchased your calculator. ausTRIA Wisnractner- Service Wgiamerstrasse Lebigease 1 1.1220 Wen (Yanna Telophone (0222) 23 85 11 EASTERN EUROPE Rotor fo the acess kstod unde Austra INLAND HEWLETT-PACKARG OF BELGIUM Rovontulentio 7 HEWLETT-PACKARD BELGIO SAY Sr 00100 Fapeo 10 eon vu 10 “none 6 285 02 11 Teopone (02 782 3200 FRANCE Dewan HEWLETT-PACKARD FRANCE REUETT PACKARD a8 Dison noma Person Onto 5 SAV Calum de Poche Ok.3460 Brtroe ‘Cosnnagenh Pere? Teteprone (0861 98 40 “ios www Appendix O: Battery, Warranty. and Service 239 Germany span HEWLETTPACKARD GmbH HEWLETT-PACKARO ESPANOLA S.A soeerechner Service Cate Jorez 3 verabsrentae Entacn 16 emer Strasse 117 Telephone: (1) 488 2500, Postach 580 140 sweoen B00 Fr eT pAckARD SVERIGE a8 Shahan 9, vray fons HEWeTrPACKARD TADANA SP 505 89 Sotge ttn Caan po 8 tn) Teeprone (750900 a's 0 vra9 "ode cama Ngo an ‘eeorene: 2190S NETHERLANDS NEWCET-PACOARD NEDERLAND 8 Van en Contato 13 siete to Asda ‘SWITZERLAND HEWLETT-PACKARD (SCHWEIZ) AG. iersenne-Service Auoend 2 (cH-8967 Widen Telephone: (087) 81 21 11 vniTeo KINGDOM P.O. Box 657 HEWLETT-PACKARD Lid Telephone: (029) 472021 ee NoRway {GBeWnnersh. Wokingham HEWLETRPACKARO NORGE A/S Borashire ROI! BAR P.O. Box Telephone: (0734) 784 774 esternlen 18 1945 Oneteraas (Oat) Tetepnone:(2)17 14 80, International Service Information Not all Hewlett-Packard service centers offer service for all models of HP calculator products. However, if you bought your product from an authorized Hewlett-Packard dealer, you can be sure that serviceis available in the country where you bought it. If you happen to be outside of the country where you bought your unit, you can contact the local Hewlett-Packard servica center ta see if service is available for it. If service is unavailable, please ship the unit to the address listed above under Obtaining Repair Service in the United States. A list of service centers for other countries can be obtained by writing to that address. All shipping, reimportation arrange your responsibility. ants, and customs costs are Service Repair Charge ‘There is a standard repair charge for out-of-warranty repairs. The repair charges include all labor and materials. In the United States, the full charge is subject to the customer's local sales tax. In 240 Appencix D: Battery, Warranty, and Service European countries, the full charge is subject to Value Added Tax (VAT) and similar taxes wherever applicable. All such taxes will ‘appear as separate items on invoiced amounts. Calculator products damaged by accident or misuse are not covered by the fixed repair charges. In these situations, repair charges will be individually determined based on time and material. Service Warranty Any outof-warranty repairs are warranted against defects in materials and workmanship for a period of 90 days from date of service. ‘Shipping Instructions Should your unit require service, return it with the following items: © A completed Service Card, including a description of the problem. © A sales receipt or other documentary proof of purchase date if the one-year warranty has not expired. ‘The product, the Service Card, a brief description of the problem, and (if required) the proof of purchase date should be packaged in the original shipping case or other adequate protective packaging to prevent in-transit damage. Such damage is not covered by the one-year limited warranty; Hewlett-Packard suggests that you ingure the shipment to the service center. The packaged unit should be shipped to the nearest Hewlett-Packard designated collection point or service center. Contact your dealer for assistance. (If you are not in the country where you originally purchased the unit, refer to International Service Information above.) Whether the unit is under warranty or not, it is your responsibility to pay shipping charges for delivery to the Hewlett-Packard service center. After warranty repairs are completed, the service center returns the unit with postage prepaid. On out-of-warranty repairs in the United States and some other countries, the unit is returned C.O.D. (covering shipping costs and the service charge). Appendix D: Battery, Warranty, and Service 241 Further Information Service contracts are available. For information about service con- tracts, please contact the Calculator Service Center in Corvalli Oregon, Calculator product circuitry and design are proprietary to Hewlett- Packard, and service manuals are not available to customers. Should other problems or questions arise regarding repairs, please call your nearest Hewlett-Packard service center. When You Need Help ‘Technical Assistance. For technical assistance with this prod- uct, call: (503) 757-2004 Bam. to3pm. Pacific time or write to: Hewlett-Packard Co. Portable Computer Division Calculator Technical Support 1000 N.E. Circle Bivd. Corvallis, OR 97330 Product Information. For information about Hewlett-Packard products and prices, contact your local Hewlett-Packard dealer. For the name of the dealer nearest you, or to order free literature about Hewlett-Packard products, call toll free: (800) FOR-HPPC (B00) 367-4772 or write to: Hewlett-Packard Co. Personal Computer Group PCG Telemarketing 10520 Ridgeview Court Cupertino, CA 95014 242 — Appondix D Battery, Warranty, and Service Temperature Specifications © Operating: 0° to 55° C (82° to 131° F) © Storage: —40° to 65° C (—40° to 149° F) Potential for Radio/Television Interference (for U.S.A. Only) ‘The HP-11C generates and uses radio frequency energy and if not installed and used properly, that is, in strict accordance with the manufacturer's instructions, may cause interference to radio and television reception. It has been type tested and found to comply with the limits for a Class B computing device in accordance with the specifications in Subpart J of Part 16 of FCC Rules, which are designed to provide reasonable protection against such inter- ference in a residential installation, However, there is not guarantee that interference will not occur in a particular installation, If your HP-11C does cause interference to radio or television reception, which can be determined by turning the calculator off and on, you are encour- aged to try to correct the interference by one or more of the following messures: ¢ Reorient the receiving antenna. © Relocate the calculator with respect to the receiver. © Move the calculator away from the receiver. If necessary, you should consult your dealer or an experienced radio/television technician for additional suggestions. You may find the following booklet prepared by the Federal Communi- cations Commission helpful: How to Identify and Resolve Radio- TV Interference Problems. This booklet is available from the U.S. Government Printing Office, Washington, D.C. 20402, Stock No. 004.000-00345-4. ry}? ) ) yo i] yo Programming Techniques Index The following is a short index of several useful functions and practices used in Part III: Programmed Problem Solving. Each entry is followed by the page numbers (in bold type) and the respective program line numbers (in regular type) that illustrate the use of the technique. Conditionals: 156: 037; 157: 060, 065; 160: 055; 165: 026; 171: 075; 188: 010; 196-197: 023, 058, 069, 083, 087, 115. (50: 042; 156: 051. Flags: 143: 065, 071; 144: 087, 095; 164-165: 010, 011, 014, 017, 020, 023, 040, 054, 057; 183: 002, 010, 014, 041; 188-189: 007, 009, 011, 072; 195-187: 004, 008, 021, 046, 050, 107. : 165: 012. Input Routines: 160: 008-016; 156: 001-016; 159: 001.003, 004- 008; 165: 020-030; 170-171: 001-006, 022-027, 038-043, 055-060, 087-092; 178: 001-004, 023-025; 188: 001-003, 013-015, 031.033, 039-041, 052-054; 196: 017-020, 041-044. 142: 002; 144: 083; 160-161: 015, 081, 086; 172: 123. Loops: 150: 008-016; 156-157: 026.067; 159-160: 009-028; 165: 018-030; 172: 120-124; 178-179: 005-022, 035-085; 183: 019-022, 026-089; 188: 004-012. Statistical Functions: 165: 029, 036, 039, 045, 056; 178: 003, 006, 009, 024, 033, 042; 183: 024. Output Routines: 150-151: 055-063; 165: 038-048; 172: 115-124; 195: 009; 198: 134. Gil: 142: 004; 144: 080; 150: 012, 044; 172: 121. [i 150: 014. Jn: 160: 016, 018, 024, 026, 049; 183: 012, 016; 196: 019, 043. 243 244 — Programming Techniques Index (STO) En: 156: 019. 42-143: 001-009, 010.068, 057-068, 069-078; 144: 51: 020-048, 041.048, 064-076, 077-091; 156-157: 054-066, 068; 160: 046-050, 051-059; 171-172: 093-127, 128-131; 189: 063-087, 088.092; 196-198: 029-040, 054-098, 080-094, 099- 128, 133-139, User Keys: 142: 010; 143; 079; 144: 086; 160: 001, 049; 156-157: 001, 017, 068; 169-160: 001, O11, 021, 029, 033; 164-165: 001, 038, 049, 053; 170-171: 001, 022, 038, 055, 087; 178: 001, 005, 023, 035; 183: 001, 019, 023, 026, 040; 188: 001, 013, 031, 039, 052; 195-197: 001, 006,017, 041, 124, 151: 079, 084, 089. et wee Function Key Index [Gi}Turns the calculator's dispiay on and off (page 18). Conversions ($)Converts polar magnitude r and angle din X- and Y- registers respectively to rectangular x and ¥ coordinates (Page 52). (SE) Converts x y rectangular coordinates placed in X- and Y-registers respectively to polar magnituder and angle #(Page 51). (SHMS)Converts decimal hours—or degrees—to hours, minutes, seconds— or degrees, minutes, seconds—{Page 46). (tl converts hours, minutes, seconds— or degrees, minut ‘seconds—to decimal hours—or degrees— (Page 47). (RAD) Converts degrees to radians (Page 47). (2DEG) Converts radians to degrees (Page 47). Digit Entry (EATER Emers a copy of anumber in displayed X-register Into Y-register: used to separate multiple number entries (Page 27). Changes sign of number or exponent of 10 in displayed X-register (Page 17). [EExJenter Exponent; next digits keyed in are exponents of 10 (Page 71). Othrough 9 Digit keys [Decimal point Display Control [Fix)Setects tixed point display mode (Page 67). 245 (Sai)Setects scientific notation display mode (Page 68). [ENG )Selects ‘engineering notation display mode (Page 70). Mantissa. Pressing (CLEAR (PREFIX) displays all 10 significant digits of the number in the X- register as long as the [PREFIX key is pressed; clears any partial key sequences—reter to CLEAR [PREFIX] (Page 72). ‘Hyperbotics (Hyp) (SiN). Cyr) {HVP)[TAN) Compute hyperbolic sine, hyperbolic cosine, or hyperbolic tangent, respectively, of number in displayed X-register (Page 48). CxS), 8 [HYP*)[FAN] Compute 246. Function Key index JG inverse hyperbolic addressed by the in ciepiiet x y sine, inverse value storedinR, —__‘Fesister (Page 48). ration Prefix hyperbolic cosine, or {Page 130). —_(105)Common yl Number Alte aan meena tmaetwpetele” (Goneemen, skein (EWB)Rounds —_—Pressedbetore a Tepetitions or order oer BDdecremens nies 1 topower y | 3 | mantissa of 10-digit function key, selects {Page 63). react ct Tha Samat Brians Oto "ufnberin eaiporGokdfunetion pleted ie § oe to match display bove ‘Stack Menipulati X-register (Page 48). specifieddecrement “splayed X-register p> setting (Page 42). a ‘marker Page oe “een value fromcounter (Page 48). } } ii : . Gaedexchanges index Register _value.Skipsone —_—[")Raises number [ees}cives absolute (G)Pressedbeforea Comenis ot ang program ine fnew ‘cregieter topower sly je ofnumber in functionkey, selects Stack registers (Page Tina ew seine, sourtr vee is Yeregicer to displayed X-register blue function printed 28)- Binion rete Solio oriessthan played X register y| 50 | WPasea2. onthe slanted face of [R)Rolls down [ReCiasa simple data specie test value (Page. 49). (INT]Leaves only thatkey (Page 21). contents of stack storage register Page 128). ‘Mathematics ) | integer portion of | CLEAR (BREED) (Page 28). Geedelva to hokd {BGlinerement Sky . number in displayed cancels[fJand(3] [R&I control numberfor ‘if Greater. Adds re aa ) X-register by prefix keystrokes and Saat peibobabieyrvalia speolfied increment ate ct operators yb truncating fractional partially entered Page 28 of vic mom operations and value to counter rage 22). portion{Page 42). instructions such as (rege 201. Feindbectesnnstot value.Skipsone (Zz]Computes |). | GeRmetteaves ony — {Sear fe) (HY) [GLa)Clears contenes display and program Programline if new square root of fractional portion of | Also displays 10- of diaplaved X- aaa eneage 27), counter value Saee eee mplayes | ©) |) fmamborinaiepleyos sigitmantissaot — yamerertozero Page neegen estar han X-rogistr (Page 44). X-registr by number incisplayed °7" Se indepevea meveseert value [2}Computes square )} } aruneating integer _-register (Page 21). eae ate age 128). of number in y]} ) | portion Page 42). Statieics humberinRy{Page Lowarithmicand —displayad X-rogister Prosebiney: CLEAR CE] Clears the a Exponential (Page 44). vi [FialPermutation, Statistica registers {(Dindirect (Eilcomputes LAlcatcutates . Percentage Computesthe oeed ory ‘Operations: natural logarithm of _ factorial x! or 2 ()Pe numba of possible oo “(Pope ec). Operas itn "Mba inclsplayed Gamma function yy Feomputes Siders chen fy ea X-register (Page 48). -(1 + x) (Page 43). ) 1 wputes x% of different items taken: }. value in the Y- in quantities of x statistics of numbers Dd} > [register(Page 49). it i recall, and storage Antilogarithm. reciprocal of number . arieti senor trans nae ae Neghand ewan Rr owmr at mdepayeee yb (BilPercent out repetitions (Page registers into storage (Page 130). number in displayed register (Page 43). Difference. ba eee raat agee tater Page 88) )| 9) | Computes percent of [Eiz]Combination. R5(Page 56). Derchanges Girt ale of pi - changebetween —- Computesthe coment Naispaved GOS}Compuiee (3 54) in } umber in Y-register_ number of possible. statistics of numbers Zereitr wt conn en ogee eth isplayed X-register ) and number in setsof y different in X- and Y-registers (Page 42). > aiolaved %-register items taken in from storage x1) rage 60). quantities of x items registers Ro through 2) 2 248" © Function Keyindex Rs for correcting | acoumulations (Page 68). computes mean (average) of x andy. values accumulated by [22 ](Page 60). [S)Computes sample standard deviations of x and y vaiues ‘accumulated by [5] (Page 61). GilLinear Estimate and Correlation Cootticient. Computes estimated value of y (7) for a given value of x by least squares method and places result in displayed X- register. Computes: the correlation coefficient (7) of the linear estimate data by measuring how closely the data pairs would, if plotted on 3 graph, represent 2 ‘straight line, and places result in Y- segister {Page 64). (CBILinesr Regression. ‘Computes y- intercept (A) and slope{A) for linear function y =AX +B that best approximates x and y values accumulated using [2]. The value of the y- intercept is placed in. ‘the X-register; the Value of the slope is placed in the Y- register (Page 63). Places a pseudo-random ‘umber in the digplayed X-register; the pseudo random sequence is generated froma seed stored using (STo)[RANF (Page 54). Storage (iO)Store. Followed by register addrass {0 through 9, Othrough 9, [7], or {)), stores displayed ‘number in the storage register specified. Aiso used to perform storage register arithmetic (Page 37). [RCL)Recaut. Followed by address {O through 9, .0 through 9, (1, GD, recalls number from storage register specified into the displayed X-register (Page 38). CLEAR [FEG} Clears contents of all storage registers to zero (Page 38}. [LSTx}Recalis: fumber displayed: betore the previous. function back into the displayed X- register (Page 28). Trigonometry (BEG)Sets decimal degrees mode for ‘trigonometric functions—indicated by absence of GRAD ‘or RAD annunciator {Page 45): {RAD)Sets radians ‘mode for trigonometric functions—indicated by RAD annunciator (Page 45). (GRD)Sets grads mode tor trigonometric furictions--indicated byGRAD annunciator (Page 45). (SiN), (C08). (FAN) ‘Compute sine, cosine, or tangent, respectively, of Programming Key tndex 249 number in displayed (SiN), (COS"). (TAN) . tangent, X-register (Page 46), Compute arcsine, respectively, of arc cosine, or arc number in displayed X-register (Page 45). Programming Key Index Program/Run mode. — primary[Va). [eJ, O through 9, or [i]. Pressing (@)(PZR} = [70'), [5], and From the keyboard; sets the calculator to key functions andthe causes calculator to Program mode shitted{A]through search downward in [Eluser-defined key. program memory for ‘on—or Run miode— functions are designated label and PRGM annunciator exchanged(Page halt. In a running cleared—(Page 78). 79). program: causes iculator to transfer (HEM) Displays 0123456789. Gewmwadinn current status of Label designations... program memory to program When preceded by designated label and memory/stora define reaushe-progrem Tegister allocation _—_ beginning of a ‘execution (Page112), (Page 77). routine(Page 79). [BEA)Got0 (AILS Eluser. ~ [LaL)iabet. when Subroutine. Used defined program used with [a] with [A] through ‘keys for both: through [E]or Othrough 9, or [i) program labels and through9, denote __Fromtthe keyboard; program execution _the beginning ofa causes calculator to (Page 79), program or search downward in subroutine (Page program memory for (USER)Places 79), designated label and calculator in and out begin program ‘of User mode. In, [GTO]GoTo. Used. execution. Ina User mode the with (@)through (E), running program; 280 |” Programming Key Index causes calculator to transfer downward in program memory to designated label and continue ‘execution until a (BtN)instruction transfers execution back to the first instruction after the (Gs5)(Page 119). (GOO Goto Line Number. Positions calculator to the occupied line number specified by nnn (Page 87). [BeT Back Step. Moves calculator back one fine in program memory (Page 97). [5ST] Single Step Moves calculator forward one line in program memory {Page 87). (ZBockarrow. in Program mode, deletes displayed instruction from program memory. All subsequent instructions are rhoved up one line. In run mode, deletes digits or numbers from displayed X- register (Page 17). CLEAR [PRGMJIn Program mode, clears all instructions from program memory and resets calculator to fine 000. InRun mode, only resets calculator to line 000 (Page 78). (PSE}Pause. Halts program execution for about one second 10 display contents of X-register, then resumes execution {Page 79). Begins program execution from current line number ‘in program memory. Stops execution if program is running (Page 79). calculator toreturn from any line in rogram memory to fine 000, or from subroutine to appropriate line elsewhere in program memory (Page 78). (SE]Set Flag. Followed by flag designator (Or t), sets flag—true— (Page 111). designator (0 or 1), clears flag (Page 119). Followed by flag designator (0 or 1), tests designated flag. flag is set (true) the calculator executes the instruction in the ext line of program memory. I flag is, cleared (faise), calculator skips one ling in program memory before resuming execution {Page 111). [x O}{x=0} Conditionals. Each tests value in X- ragistar against 0 or value in Y-register as indicated. Hf true, calculator executes instruction in next {ine of program ‘memory. If false, calculator skips one lina in program memory before resuming execution {Page 110). Subject Index Page numbers in bold type indicate primary references; page numbers in regular type indicate secondary references. A Abbreviated key sequences, 78, 127 Accuracy (see Round-off error) Address indirect (see Indirect addressing.) label, 79, 94 storage register, 37-39 Algorithm, 206-208 Allocation, memory, 8, 78 Allocation, current memory, 77 Alpha labels, 79 Alternate keyboard functions, 20-21, 79 Annuities; see Finance Annunciator, 16 21 9.21 PRGM, 20, 78, 80, 85, 88 USER. 79, 88 Area of a Circle program example, 83ff. Assistance, technical, 241 Automatic Memory Stack (see Stack). B Backarrow, 17, 29, 98 Backstep, 97, 101, 104 Batteries, 230-233 installing, 231-288 replacement, 231 Beginning a program, 84 Branching conditional, 112-113 unconditional, 112 251 262 — Subject Index c Can volume example program, 89-90 Chain calculations, 31-32 Change sign, 17, 42, 223 exponents, 71 Chi-square evaluation, 182-185 Clearing ‘Continuous Memory. (See Resetting Continuous Memory.) data storage registers, 38-39 display, 17-18 error messages, 19 program line, 78 program memory, 98 stack, 66, statistics registers, 65, 58 Coefficient of determination, 163 Compound amounts (see Finance), Conditional, 110-1165, 243 Constant arithmetic, 34, 35-36 Continuous Memory, 19, 75, 78, 98 ‘clearing (see Resetting Continuous Memory.) display, 67 error, 20, 220, 233 flags, 19,111 logs of, 231, 232 yandom number seed, 54 replacing batteries, 20, 231-233 resetting (see Resetting Continuous Memory.) trig modes, 45 Control number, 127, 1286f. Convertible storage registers, 8, 75-77 Counter, loop, 214 Cramer's rule, 149 Curve fitting, 162-168 program, flags, 215-216 Db. Data storage registers, 8, 37-38 clearing, 88 Decrementing, 128-129, 214, 243 Deleting program instructions, 105-107 Determinant 253 jebra, 140-148 systems of linear equations, 149 Digit entry new number, 17, 24 termination, 17, 18, 221 Digit separator, 16 Disable stack, 29, 221 Display annunciators, 16 automatic (Fx) —[SCi] mode switching, 67 blank, 234-235 clearing, 17,29 mode, 19, 67 rounding, 67, 68, 69, 70 setting, 19, 67 Xregister, 26 DSE limits, 184 Downward, program memory, 80, 87, 125 E Ending a program, 84 Enable stack, 29, 222 Error clearing, 20 Continuous Memory, 20, 220, 233 flag, 220 message, 19, 98, 96, 219-220 recovery, 33 round-off, 72, 155 service, 220, 234, 237-240 Simpson’s rule, 159-162 statistics registers, 219-220, 228 subroutine, 121, 220 Executing labels, 79 Exponent, limitation, 72 sign, 68, 70, 71 Exponential curves, 162, 166-167 F Finance, 185-194 Flag, 19,96, 111, 116-118, 215-216, 243 284 = Subject index Flowchart, 116, 208-210, 216 Function key index, 245-249 Gq Goto indirect, 130-131, 136-137, 243, label, 112 line, editing, 97-98, 103 subroutine, 119-120, 210 subroutine, matrix algebra, 210 Goodness of fit, 182 H ee Halt, program, 79, 89-90, 93 Heat loss program example, 12, 80ff. 1 Improper operation, calculator, 234-235 Incrementing, 128-129, 12-134, 214, 243 limits, 134 use with indirect addressing, 211-212 Index register, 8, 75, 80, 127ff. decrementing, 128-129 direct functions, 127-129 exchange, 127 incrementing, 128-129 loop control number, 128 store and recall, 127 Indirect addressing 127, 130, 211-212 branching, 130-131, 136 exchange, 130, 135, 244 line number, 130, 181, 137 storage and recall, 180, 135, 243 storage register arithmetic, 130, 136 subroutines, 131, 136 table, 131 Initializing, 96 Input routines, 243 Inputting data, 212-213, 217, 218 Intermediate result, 28-25, 26, 31 Internal digit representation, 67,71 Subjectindex 255, Boo Keycodes, 77-78, 81:83 L Label, 79, $4, 94 addresses (see Address.) searching for, 87 LAST X, 8, 28, 32-34, 80, 223 clearing, 38-39 constant, 36 percent difference, 50 percentage, 50 probabilities, 53 statistics, 32-83, 65 (i), 65-46 Least squares, 164 Limit, ax, 214 Line 000 (see Top-of-memory). Line number, 77-78 Linear regression, 162, 243 Loading a program, 85-86 Logarithmic curves, 162, 167-168 Loop, 118-114, 214-215, 243 circuit currents, 147 conditional control, 114-115 conditions, Newton's method, 155 control number, 128 counter, 127, 128ff., 132-134, 214 Ax limit, 214-216 equations, matrix algebra, 148 exit, 113-115,127, 128-130, 132-134, 214-215 Low power indication, 231 Moo Mantisaa, 21, 67, 68, 71,72 Matrix algebra incrementing, 211 indirect addressing, 211 subroutines, 210 Memory allocation, 77 266 Subject index conversion (see Reallocation of program memory.) Converting to storage registers, 227-228 {MEM function, 77, 227-228, reallocation, automatic, 74-77, 224-227 Mode display, 67-71 trigonometric, 45 N ‘Negative numbers, 17 Neutral, stack, 222-223 Newton's method, 154-158 looping, 214 Non-programmable functions, 88 ‘Number alteration functions, 42 Numeric labels, 79 ‘Numerical integration, 159-162 °. Occupied program memory, 93, 100 (GW), 10, 16, 234-235 One-number function, 21, 24, 43-49 Order of entry, 22 Output routines, 243 Overflow, 18, 96, 219 P Pending subroutine returns, 19, 119-120 Permanent program memory, 78, 224226 Permanent Storage Register, 8, 76, 224 Power consumption, 230 curves, 162, 168 failure, 45, 54,220 low, 231 Prefix clearing, 21 keys, 21, 78, 79, 127 PRGM annunciator, 20, 78, 80, 85, 88 Primary keyboard functions, 20, 79 EES EE Problem statement, 206 Program, modifying example, 101-106 Program contro} keys, 249-250 deleting instructions, 18, 98, 105-107 errors, 96 execution, 87, 115, 118 halts, 79, 89-90, 93, inserting instructions, 102, 105 key, 78 labels, 94 mode, 20 modifying example, 101-106 pauses, 91-92 planning, 206-210 self-initializing, 96 stops, 88-91, 93 structure, 206-208 Program memory, 8, 78, 80-81 clearing, 78 deleting instructions, 105-107 downward, 80, 87, 125 end of, 84 occupied, 84, 87,100, 105 top, 79 Programming techniques index, 243-244 Proper operation, calculator, 234-235 Pseudo-random number (see Random number). Pythagorean Theorem example program, 98ff. a a Quadratic equation algorithm, 207-210 Roo Radix mark, 16 Random number, 54-55, 217, 243 Reallocation of program memory, 74-77, 224-227 Recalling numbers, 38 jaccumulations, 57 stack lift, 38 Renumbering program instructions, 102 ee SUbpect index Resetting Continuous Memory, 20, 38, 45, 54, 75, 220, 283, 234-235 Return, pending, 119-120 Roll-down, 28 Roll-up, 28 Round-off error, 72, 155, 169 statistics, 59 Run mode, 12,20 key, 78 running, 18,53, 88 Running a program, 86-88 s. _ Scrolling, 101 Seed, random number, 54-56, 194, 217 Self-initializing, 96 Self-test, calculator, 234 Service, 234, 235, 288-241 shipping instructions, 240 warranty, 240 Shared program memory (see Program memory). Shared storage registers (see Storage registers). Sign of exponent, 68, 71 of number, 17, 68 Simpson’s rule, 159 Simultaneous equations, matrix algebra, 140-148 Single-step, 97, 100-101 program execution, 99-100 Slope example program, 121ff. Specifications, temperature, 242 Stack, 8, 80 automatic memory, 26-27 clearing, 38, 56, 56 disable, 21, 29, 38 drop, 26-27, 30, 31, 32 enable, 29, 221-222 , 63 lift, 26-27, 29, 31, 32, 38, 221 manipulation, 27-28 memory, 221-223 neutral, 221, 222-223 nochange, 26-27 J ) Subjectindex = 259. {Eo 65-66 Statistics accumulations, correcting, 58-59 clearing registers, 55, 58 error, 219, 228, precision, 56-57 registers, 224, 228 storage registers, 55-56 Status indicators, 235 Stop-and-store, 213 Storage Registers, 8, 75-77 addresses, 8, 37-39 arithmetic, 39, 244 clearing, 38-39 convertable, 75-76 statistics, 56-56 Storing numbers, 37 Submarine hunt, 194-205 program, random numbers, 217 Subroutine, 210-211, 244 limits, 120-121 nesting, 120-121 pending, 19, 120 transfer of execution, 119-120, 122ff. ‘Systems of linear equations, 149-153 y ‘Tregister, constant, 34-36 totatistics, 176-181 Terminating digit entry, 17, 18,221 Test, calculator circuits, 234-235 Testing programs, 96 Time, execution, 53 Timeout, 16 Top-of-memory marker, 80 Top row keys, 78 ‘Trapezoidal rule, 159-162 OO ‘Triangle solutions, 169-176 data input, 213 ‘Trigonometric mode, 19, 45, 169 ‘Trouble-shooting, calculator operation, 234-235, ‘True/false tests, 110-111 ‘Two-number function, 22, 24, 29, 49-54 accumulations, 55 Un Unconditional branching, 112 Underflow, 18, 93 USER annunciator, 79, 88. User-definable keys, 213, 217-218, 244 User mode, 79, 88 v _ - Variables, inputting, 212-213 Ww Warranty information, 236-237 if ~~ wy ewe eS wwe ee Ye EY EY YY YY YO YY Mw YM ew YYW

You might also like