billw@hpcvra.cv.hp.com. (William C Wickes) (02/21/91)
HP 48 Insights I. Principles and Programming Many people have been asking me about the status of HP 48 Insights, the long-promised revision of HP 28 Insights for the HP 48. Because of this interest, I will take the liberty of posting a filthy commercial message on this otherwise untainted newsgroup. HP 48 Insights (Part I) is currently being printed, and should be available by about March 15. It is "Part I" because I realized sometime after embarking on the HP 28 Insights rewrite that I had better break it into two volumes if I a) wanted to have books of reasonable spiral binding size, and b) wanted to have something published by now. (Another part of this strategy was to extract all of the HP 41-related material in HP 28 Insights into yet another book, HP 41/HP\|48 Transitions, which is already published.) As you may conclude from looking at the table of contents below, Part I concentrates on the toolbox aspects of the HP 48. Part II, which is likely to appear at the end of this year, will cover the integrated systems, such as plotting, time, HP Solve, etc. Part I is 394 pages, and lists for $25.95. Many bookstores, and EduCalc, have already ordered the book (and have been breathing down my neck for six months). You can also order direct from the source (Larken Publications, 4517 NW Queens Ave, Corvallis OR 97330) by sending a check or m.o. in $US for the above amount plus $1 for surface mail postage (if you can wait 'till March 15 but no longer and want air mail, it's $2.50 for US, $9 for Europe, or $12 elsewhere). Early orders will be filled as soon as the books are available. If you have a copy of HP 28 Insights, be aware that you will see a lot of material repeated in HP 48 Insights--the new book is a revision of the old in much the same way that the HP 48 is a revision of the HP 28. If you have read Transitions, you might even see some material a third time. Below is the table of contents (to third level headings) that should give you a reasonable idea of the subject matter of Part I. Bill Wickes HP Corvallis (Note: my books are written with HP's blessing and subject to their review, but they are otherwise independent of HP. In short, complain to me, not to them.) CONTENTS 1. Introduction...................................... 1 1.1 The Evolution of the HP48.................. 2 1.2 About This Book............................ 5 1.3 Notation................................... 8 1.4 Terminology................................ 12 1.5 Easy to Use or Easy to Learn?.............. 13 2. Understanding RPN................................. 15 2.1 The Evaluation of Mathematical Expressions................................ 16 2.2 Calculator RPN............................. 19 2.3 RPL RPN.................................... 21 3. Objects and Execution............................. 25 3.1 Operations................................. 25 3.2 Objects.................................... 27 3.2.1 Operations as Objects 29 3.3 Execution and Evaluation................... 30 3.3.1 When are Objects Executed? 31 3.4 Data Objects............................... 32 3.4.1 Real Numbers 33 3.4.2 Complex Numbers 34 3.4.3 Strings 36 3.4.4 Arrays 40 3.4.5 Lists 40 3.4.6 Binary Integers 40 3.4.7 Graphics Objects 42 3.4.8 Tagged Objects 42 3.4.9 Unit Objects 44 3.4.10 Directories 45 3.4.11 Libraries 45 3.4.12 Backup Objects 46 3.5 Procedure Objects.......................... 47 3.5.1 Program Objects 47 3.5.2 Algebraic Objects 47 3.5.3 Lists as Procedures 51 3.5.4 Commands and Functions 51 3.5.5 Function Execution 52 3.5.6 Symbolic Constants 56 3.6 Name Objects............................... 58 3.6.1 Global Names 59 3.6.2 Local Names 61 3.6.3 XLIB Names 61 3.7 Quoted Names............................... 62 3.8 Quotes in General.......................... 62 3.9 EVAL....................................... 64 3.10 System Objects............................. 64 3.10.1 SYSEVAL 64 4. The HP48 Stack.................................... 67 4.1 Clearing the Stack......................... 68 4.2 Rearranging the Stack...................... 69 4.2.1 Exchanging Two Arguments 69 4.2.2 Rolling the Stack 69 4.2.3 Copying Stack Objects 70 4.2.4 How Many Stack Objects? 71 4.3 Recovering Arguments....................... 72 4.4 Stack Manipulations and Local Variables.................................. 73 4.5 The Interactive Stack...................... 74 4.6 Managing the Unlimited Stack............... 76 4.6.1 Stack Housekeeping 77 4.6.2 A Really Empty Stack 79 4.6.3 Disappearing Arguments 79 4.7 Design Insights............................ 81 5. Storing Objects................................... 83 5.1 Global Variables........................... 83 5.1.1 DEFINE 86 5.1.2 Deleting and Renaming a Variable 86 5.1.3 Cancelling STO and PURGE 87 5.2 Directories................................ 88 5.2.1 Organizing User Memory 92 5.2.2 Directory Objects 93 5.2.3 Purging Multiple Variables and Directories 96 5.3 Ports...................................... 96 5.3.1 Port Variables 97 5.3.2 Libraries 100 5.3.3 Plug-In Ports 105 5.3.4 Archiving Memory 106 5.4 Local Variables............................ 109 5.5 Name Resolution............................ 110 5.5.1 Command Line Entry 111 5.5.2 Executing Name Objects 112 5.5.3 Path Names 113 5.6 Named Objects vs. Registers and Files...... 115 5.7 Additional Global and Local Variable Operations................................. 116 5.7.1 Recalling Values 116 5.7.2 Altering the Contents of Variables 117 5.7.3 Cataloging and Finding Variables 121 5.7.4 Moving A Variable 122 5.8 Calculator Resets.......................... 123 6. Methods........................................... 125 6.1 The Basic Interface........................ 125 6.2 Keyboard Mastery........................... 127 6.2.1 Keystroke Strategies 128 6.2.2 Navigating the Menus 129 6.2.3 ATTN 133 6.3 Hidden Operations.......................... 133 6.3.2 Shift Key Meanings 134 6.4 Object Entry............................... 139 6.4.1 Key Definitions and Entry Modes 140 6.4.2 Controlling the Entry Mode 142 6.4.3 ENTER in Detail 143 6.5 Object Editing and Viewing................. 147 6.5.1 Viewing Objects 148 6.6 The Matrix Writer.......................... 149 6.6.1 Array Entry 151 6.6.2 Editing Cells 154 6.7 The EquationWriter......................... 156 6.7.1 The EquationWriter Display 158 6.7.2 Basic Expression Entry 160 6.7.3 Special Forms 165 6.7.4 Correcting Mistakes 168 6.7.5 Stack Access 169 6.7.6 Subexpression Operations 170 7. Customization..................................... 175 7.1 Modes and Flags............................ 175 7.1.1 Flag Commands 176 7.1.2 System Flag Assignments 178 7.2 Key Assignments............................ 180 7.2.1 Single Key Assignments 180 7.2.2 Multiple Key Assignments 182 7.2.3 Key assignments and memory 184 7.3 Custom Menus............................... 185 7.3.1 Built-in Menus 186 7.3.2 Custom Menu Object Types 186 7.3.3 Menu Key Labels and Shifted Menu Key Actions 189 7.4 Vectored ENTER............................. 190 7.4.1 Examples 192 8. Problem Solving................................... 195 8.1 HP Solve................................... 196 8.2 Symbolic Manipulations..................... 197 8.3 Programs................................... 201 8.4 Summary.................................... 203 8.5 User-Defined Functions..................... 204 8.5.1 User-Defined Function Structure 206 8.5.2 User-defined Functions as Mathematical Functions 207 8.5.3 Defining Programs 210 8.5.4 Additional Examples: Geometric Formulae 210 9. Programming....................................... 213 9.1 Program Basics............................. 214 9.1.1 The << >> Delimiters 214 9.1.2 The Program Body 215 9.1.3 Structured Programming 216 9.2 Program Structures......................... 219 9.3 Tests and Flags............................ 221 9.3.1 HP48 Test Commands 223 9.3.2 Equality 223 9.4 Conditional Branches....................... 225 9.4.1 Simple Branches: The IF structure. 225 9.4.2 RPN Command Forms 227 9.4.3 The CASE Structure 228 9.5 Loops and Iteration........................ 230 9.5.1 Definite Loops 230 9.5.2 Indefinite Loops 235 9.6 Error Handling............................. 239 9.6.1 The ATTN Key 241 9.6.2 Custom Errors 241 9.6.3 Error Handling and Argument Recovery 242 9.6.4 Exceptions 243 9.7 Local Variables............................ 245 9.7.1 Comparison of Local and Global Variables and Names 248 9.8 Local Name Resolution...................... 249 9.8.1 Resolution Speed 253 10. Display Operations and Graphics................... 255 10.1 Controlling the Display.................... 256 10.1.1 Postponing the Standard Display 257 10.2 Text Displays.............................. 258 10.3 Graphics Displays.......................... 260 10.3.1 Graphics Object Operations 260 10.3.2 Graphical Text 265 10.3.3 Displays on the Graph Screen 266 10.3.4 Logical Coordinates 269 10.3.5 Pixel Drawing 270 11. Arrays and Lists.................................. 277 11.1 Arrays..................................... 277 11.2 Arrays and Algebraic Objects............... 281 11.3 Vectors and Coordinate Systems............. 282 11.3.1 Coordinate Systems 284 11.3.2 Example: Coordinate Transformations 288 11.4 Lists...................................... 289 11.4.1 List Operations 290 11.5 List Applications.......................... 293 11.5.1 Input Lists 294 11.5.2 Output Lists 296 11.5.3 Lists of Intermediate Results 296 11.6 Composite Objects and Memory............... 299 11.7 Symbolic Arrays............................ 301 11.7.1 Utilities 301 11.7.2 Symbolic Array Arithmetic 305 11.7.3 Determinants and Characteristic Equations 307 12. Program Development............................... 311 12.1 Program Editing............................ 311 12.1.1 Low Memory Editing Strategies 312 12.2 Starting and Stopping...................... 313 12.2.1 ATTN, DOERR and KILL 315 12.2.2 Single-Stepping 316 12.3 Debugging.................................. 317 12.4 Program Optimization....................... 323 12.5 Memory Use................................. 326 12.5.1 Using BYTES 327 12.6 Obtaining Input............................ 329 12.6.1 Halting for Input 329 12.6.2 Protected Entry. 335 12.6.3 Using INPUT. 335 12.6.4 Keystroke Input 339 12.7 Displaying Output.......................... 344 12.7.1 Tagged Objects 345 12.8 Programs as Arguments...................... 346 12.9 Timing Execution........................... 349 12.9.1 Erratic Execution 351 12.10 Recursive Programming...................... 352 12.11 Additional Program Examples................ 354 12.11.1 Random Number Generators 354 12.11.2 Prime Numbers 359 12.11.3 Simultaneous Equations 361 12.11.4 Infinite Sums 364 Program Index.......................................... 371 Subject Index.......................................... 373 List of Programs: ADDV Concatenate Vectors AGXOR Animate with GXOR APLY1 Apply Program to 1 Symbolic Array APLY2 Apply Program to 2 Symbolic Arrays APVIEW Animation with PVIEW AREPL Animation with REPL ASN41 ASN HP41-style ASTO Animation with STO BINCALC Binary Integer Calculator BOUNCE Bouncing Ball Demo BS? Bit Set? CB Clear Bit CEQN Characteristic Equation CHARDISP Display HP48 Characters CHKINPUT Prompt and Check Input CI Cosine Integral CINT Circle in a Triangle COUNT4 Count in 4 Ranges CROSSF CROSS Function CSEG Circle segment function DATENAME Create a Name from the Current Date DELROW Delete a Matrix Row DFACT Double Factorial DIM Symbolic Array Dimensions DIST Distance function DOTF DOT Function DRAWPIX DRAW using PIXON FIB Fibonacci Series Generator FIND Find a Variable FRACALC Fraction Calculator FRAME Frame the Graph Screen GCD Greatest Common Divisor GSAMP Graphics Samples GSORT General-purpose Sort INFSUM Compute an Infinite Sum KEEP Keep n Objects KEYHALT Halt if a Key is Pressed KEYTIME Wait a Specific Time for a Key LCM&GCD LCM and GCD MINFSUM Compute an Infinite Sum (Monitor) MINISTK Small-font Stack Display MINL Minimum of a List MINOR Minor of a Determinant MNDROP DROP m through n MNORM Modified Normal Distribution Generator MOVE Move a Variable MSGSHOW Show Messages NORM Normal Distribution Generator N->S Numeric to Symbolic OLABEL Object Labeling Utility POIS Poisson Generator PPER Polygon perimeter function PRIMES Find Prime Numbers PROMPTCONT Prompt with CONT Display PTINFSUM Infinite Sum from Previous Term QU Quadratic Root Finder RC->R Real/Complex to Real RMINL Recursive Minimum of a List ->SA Stack to Symbolic Array SA-> Symbolic Array to Stack SADD Add Symbolic Arrays SB Set Bit SCOF (Unsigned) Symbolic Cofactor SCONE Cone surface function SDET Symbolic Determinant of a Matrix SEC Secant function SI Sine Integral SIMEQ Simultaneous Equations SKETCH Sketch Lines SMINOR Minor of a Symbolic Matrix SMS Scalar Multiply Symbolic Arrays SMUL Multiply Symbolic Arrays S->N Symbolic to Numeric SORT Sort a List in Increasing Order SSUB Subtract Symbolic Arrays STAR Draw a Star STRN Transpose Symbolic Array SUBCOL Subtract Columns SUM4 Sum 1/x^4 SUMTERM Compute an Infinite Sum from TERM TIMED Timed Execution TPIX Toggle a Pixel VANGLE Angle Between Two Vectors VCYL Cylinder volume function VSUM Sum Vector Elements XARCHIVE Extended Archive XFORM Coordinate Transformation XPTINFSUM Infinite Sum in x from Previous Term