Download user guide, user manual, owner manual and instructions guide
5 600 brands
1 870 000 user's guides
Search a brand
Advanced Search



Our partners wish to propose you the following products


Visit HP official site

User manual HP 48GII GRAPHING CALCULATOR - 49G+ & 48GII_ADVANCED USER'S REFERENCE MANUAL__E_F2228-90010.PDF

Diplodocs help download the user guide HP 48GII GRAPHING CALCULATOR - 49G+ & 48GII_ADVANCED USER'S REFERENCE MANUAL__E_F2228-90010.PDF.



Download the user manual HP 48GII GRAPHING CALCULATOR  
Download the complete
user guide (5068 Ko)
Need help, support, reviews, tips or troubleshooting for your HP 48GII GRAPHING CALCULATOR products ?


You may also download the following manuals related to this product:
HP 48GII GRAPHING CALCULATOR
HP 48gii graphing calculator annexe 1

This product, although classified under the brand HP, may have been manufactured by COMPAQ, HEWLETT PACKARD after mergers, acquisitions, or a change in name.

Preview of the first 3 pages of manual

You either have JavaScript turned off or an old version of Adobe Flash Player
Get the latest Flash Player.
User guide HP 48GII GRAPHING CALCULATOR - 49G+ & 48GII_ADVANCED USER'S REFERENCE MANUAL__E_F2228-90010.PDF

Detailed instructions for use are in the User's Guide.

hp 49g+/ hp 48gII graphing calculator advanced user's reference manual H Edition 1.1 HP part number F2228-90010 Printed Date: 2006/3/20 Notice REGISTER YOUR PRODUCT AT: www.register.hp.com THIS MANUAL AND ANY EXAMPLES CONTAINED HEREIN ARE PROVIDED "AS IS" AND ARE SUBJECT TO CHANGE WITHOUT NOTICE. HEWLETT-PACKARD COMPANY MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MANUAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. HEWLETT-PACKARD CO. SHALL NOT BE LIABLE FOR ANY ERRORS OR FOR INCIDENTAL OR CONSEQUENTIAL DAMAGES IN CONNECTION WITH THE FURNISHING, PERFORMANCE, OR USE OF THIS MANUAL OR THE EXAMPLES CONTAINED HEREIN. © Copyright 1993-1998, 2005, 2006 Hewlett-Packard Development Company, L.P. Reproduction, adaptation, or translation of this manual is prohibited without prior written permission of HewlettPackard Company, except as allowed under the copyright laws. Hewlett-Packard Company 4995 Murphy Canyon Rd, Suite 301 San Diego, CA 92123 Acknowledgements Hewlett-Packard would like to thank the following for their contribution: Gene Wright, Tony Hutchins, Wlodek Mier-Jedrzejowicz, Jordi Hidalgo, Ted Kerber, Joe Horn, Richard Nelson, Bruce Horrocks and Jake Schwartz. Printing History Edition 1 September 2005 Edition 1.1 March 2006 Contents Contents........................................................................................................................................................................................ 1 1. RPL Programming................................................................................................................................................................. 1-1 Understanding Programming .............................................................................................................................................1-1 The Contents of a Program ......................................................................................................................................... 1-1 Calculations in a Program ........................................................................................................................................... 1-2 Entering and Executing Programs......................................................................................................................................1-3 Viewing and Editing Programs ..........................................................................................................................................1-6 Creating Programs on a Computer .....................................................................................................................................1-7 Using Local Variables........................................................................................................................................................1-7 Creating Local Variables............................................................................................................................................. 1-7 Evaluating Local Names ............................................................................................................................................. 1-8 Defining the Scope of Local Variables ....................................................................................................................... 1-9 Compiled Local Variables......................................................................................................................................... 1-10 Creating User-Defined Functions as Programs......................................................................................................... 1-10 Using Tests and Conditional Structures ...........................................................................................................................1-11 Testing Conditions .................................................................................................................................................... 1-11 Using Conditional Structures and Commands .......................................................................................................... 1-13 Using Loop Structures......................................................................................................................................................1-17 Using Definite Loop Structures ................................................................................................................................ 1-17 Using Indefinite Loop Structures .............................................................................................................................. 1-21 Using Loop Counters ................................................................................................................................................ 1-24 Using Summations Instead of Loops ........................................................................................................................ 1-25 Using Flags.......................................................................................................................................................................1-25 Types of Flags........................................................................................................................................................... 1-26 Setting, Clearing, and Testing Flags ......................................................................................................................... 1-26 Recalling and Storing the Flag States ....................................................................................................................... 1-27 Using Subroutines ............................................................................................................................................................1-28 Single-Stepping through a Program .................................................................................................................................1-29 Trapping Errors ................................................................................................................................................................1-32 Causing and Analyzing Errors .................................................................................................................................. 1-32 Making an Error Trap ............................................................................................................................................... 1-33 Input .................................................................................................................................................................................1-35 Data Input Commands............................................................................................................................................... 1-35 Using PROMPT ... CONT for Input ........................................................................................................................ 1-35 Using DISP FREEZE HALT ... CONT for Input .................................................................................................... 1-37 Using INPUT ... ENTER for Input .......................................................................................................................... 1-38 Using INFORM and CHOOSE for Input.................................................................................................................. 1-42 Beeping to Get Attention .......................................................................................................................................... 1-45 Stopping a Program for Keystroke Input .........................................................................................................................1-46 Using WAIT for Keystroke Input ............................................................................................................................. 1-46 Using KEY for Keystroke Input ............................................................................................................................... 1-46 Output ....................................................................................................................................................................... 1-46 Data Output Commands............................................................................................................................................ 1-47 Labeling Output with Tags ....................................................................................................................................... 1-47 Labeling and Displaying Output as Strings .............................................................................................................. 1-48 Pausing to Display Output ........................................................................................................................................ 1-48 Using MSGBOX to Display Output ......................................................................................................................... 1-49 Using Menus with Programs ............................................................................................................................................1-49 Using Menus for Input .............................................................................................................................................. 1-50 Using Menus to Run Programs ................................................................................................................................. 1-50 Turning Off the hp49g+/hp48gII from a Program ...........................................................................................................1-52 2. RPL Programming Examples ................................................................................................................................................ 2-1 Fibonacci Numbers ............................................................................................................................................................2-1 Contents -1 FIB1 (Fibonacci Numbers, Recursive Version).......................................................................................................... 2-1 FIB2 (Fibonacci Numbers, Loop Version) ................................................................................................................. 2-2 FIBT (Comparing Program-Execution Time)............................................................................................................. 2-3 Displaying a Binary Integer ............................................................................................................................................... 2-5 PAD (Pad with Leading Spaces) ................................................................................................................................ 2-5 PRESERVE (Save and Restore Previous Status) ....................................................................................................... 2-6 BDISP (Binary Display) ............................................................................................................................................. 2-7 Median of Statistics Data ................................................................................................................................................. 2-10 %TILE (Percentile of a list)...................................................................................................................................... 2-10 MEDIAN (Median of Statistics Data) ...................................................................................................................... 2-11 Expanding and Collecting Completely ............................................................................................................................ 2-14 MULTI (Multiple Execution) ................................................................................................................................... 2-14 EXCO (Expand and Collect Completely)................................................................................................................. 2-15 Minimum and Maximum Array Elements ....................................................................................................................... 2-16 MNX (Minimum or Maximum Element--Version 1).............................................................................................. 2-16 MNX2 (Minimum or Maximum Element- Version 2).............................................................................................. 2-18 Applying a Program to an Array...................................................................................................................................... 2-20 Converting Between Number Bases ................................................................................................................................ 2-22 Verifying Program Arguments ........................................................................................................................................ 2-24 NAMES (Check List for Exactly Two Names) ........................................................................................................ 2-24 Converting Procedures from Algebraic to RPN .............................................................................................................. 2-27 Bessel Functions .............................................................................................................................................................. 2-29 Animation of Successive Taylor's Polynomials ............................................................................................................... 2-30 SINTP (Converting a Plot to a Graphics Object)...................................................................................................... 2-31 Techniques used in SINTP ....................................................................................................................................... 2-31 SETTS (Superimposing Taylor's polynomials) ........................................................................................................ 2-32 TSA (Animating Taylor's Polynomials) ................................................................................................................... 2-33 Programmatic Use of Statistics and Plotting.................................................................................................................... 2-34 Trace Mode ...................................................................................................................................................................... 2-37 Inverse-Function Solver................................................................................................................................................... 2-38 Animating a Graphical Image .......................................................................................................................................... 2-39 3. Full Command and Function Reference................................................................................................................................ 3-1 ABCUV.............................................................................................................................................................................. 3-4 ABS ................................................................................................................................................................................... 3-4 ACK ................................................................................................................................................................................... 3-4 ACKALL ............................................................................................................................................................................ 3-4 ACOS ................................................................................................................................................................................ 3-5 ACOS2S ........................................................................................................................................................................... 3-6 ACOSH ............................................................................................................................................................................. 3-6 ADD ................................................................................................................................................................................... 3-7 ADDTMOD ....................................................................................................................................................................... 3-8 ADDTOREAL ................................................................................................................................................................... 3-8 ALGB................................................................................................................................................................................. 3-8 ALOG ................................................................................................................................................................................ 3-8 AMORT ............................................................................................................................................................................. 3-8 AND ................................................................................................................................................................................... 3-8 ANIMATE.......................................................................................................................................................................... 3-9 ANS ................................................................................................................................................................................. 3-10 APPLY............................................................................................................................................................................. 3-10 ARC ................................................................................................................................................................................. 3-10 ARCHIVE........................................................................................................................................................................ 3-11 ARG................................................................................................................................................................................. 3-11 ARIT ................................................................................................................................................................................ 3-12 ARRY .......................................................................................................................................................................... 3-12 ARRY .......................................................................................................................................................................... 3-12 ASIN ................................................................................................................................................................................ 3-12 ASIN2C ........................................................................................................................................................................... 3-14 ASIN2T ........................................................................................................................................................................... 3-14 Contents - 2 ASINH..............................................................................................................................................................................3-14 ASN .................................................................................................................................................................................3-14 ASR .................................................................................................................................................................................3-15 ASSUME.........................................................................................................................................................................3-16 ATAN ...............................................................................................................................................................................3-16 ATAN2S ..........................................................................................................................................................................3-17 ATANH ............................................................................................................................................................................3-17 ATICK ..............................................................................................................................................................................3-18 ATTACH..........................................................................................................................................................................3-18 AUGMENT......................................................................................................................................................................3-19 AUTO...............................................................................................................................................................................3-19 AXES ...............................................................................................................................................................................3-20 AXL ..................................................................................................................................................................................3-20 AXM .................................................................................................................................................................................3-20 AXQ .................................................................................................................................................................................3-20 BAR .................................................................................................................................................................................3-20 BARPLOT .......................................................................................................................................................................3-21 BASIS ..............................................................................................................................................................................3-22 BAUD...............................................................................................................................................................................3-22 BEEP ...............................................................................................................................................................................3-22 BESTFIT .........................................................................................................................................................................3-22 BIN ...................................................................................................................................................................................3-22 BINS ................................................................................................................................................................................3-23 BLANK.............................................................................................................................................................................3-23 BOX .................................................................................................................................................................................3-23 BUFLEN ..........................................................................................................................................................................3-24 BYTES.............................................................................................................................................................................3-24 BR ................................................................................................................................................................................3-24 C2P..................................................................................................................................................................................3-24 CASCFG .........................................................................................................................................................................3-25 CASCMD ........................................................................................................................................................................3-25 CASE...............................................................................................................................................................................3-25 CEIL.................................................................................................................................................................................3-25 CENTR ............................................................................................................................................................................3-26 CF ....................................................................................................................................................................................3-26 %CH ................................................................................................................................................................................3-26 CHINREM .......................................................................................................................................................................3-27 CHOLESKY ....................................................................................................................................................................3-27 CHOOSE ........................................................................................................................................................................3-27 CHR .................................................................................................................................................................................3-27 CIRC ................................................................................................................................................................................3-28 CKSM ..............................................................................................................................................................................3-28 CLEAR ............................................................................................................................................................................3-28 CLKADJ ..........................................................................................................................................................................3-28 CLLCD.............................................................................................................................................................................3-29 CLOSEIO ........................................................................................................................................................................3-29 CL ..................................................................................................................................................................................3-29 CLVAR ............................................................................................................................................................................3-29 CMPLX ............................................................................................................................................................................3-29 CNRM..............................................................................................................................................................................3-30 COL..............................................................................................................................................................................3-30 COL..............................................................................................................................................................................3-30 COL­ ...............................................................................................................................................................................3-30 COL+ ...............................................................................................................................................................................3-31 COLCT ............................................................................................................................................................................3-31 COLLECT .......................................................................................................................................................................3-31 COL ...............................................................................................................................................................................3-31 COMB..............................................................................................................................................................................3-32 Contents - 3 CON................................................................................................................................................................................. 3-32 COND.............................................................................................................................................................................. 3-33 CONIC............................................................................................................................................................................. 3-33 CONJ............................................................................................................................................................................... 3-34 CONLIB........................................................................................................................................................................... 3-34 CONST ........................................................................................................................................................................... 3-35 CONSTANTS................................................................................................................................................................. 3-35 CONT .............................................................................................................................................................................. 3-35 CONVERT ...................................................................................................................................................................... 3-35 CORR.............................................................................................................................................................................. 3-35 COS................................................................................................................................................................................. 3-36 COSH.............................................................................................................................................................................. 3-36 COV................................................................................................................................................................................. 3-37 CR.................................................................................................................................................................................... 3-37 CRDIR............................................................................................................................................................................. 3-37 CROSS ........................................................................................................................................................................... 3-37 CSWP ............................................................................................................................................................................. 3-38 CURL............................................................................................................................................................................... 3-38 CYCLOTOMIC............................................................................................................................................................... 3-38 CYLIN.............................................................................................................................................................................. 3-38 CPX ............................................................................................................................................................................. 3-38 CR................................................................................................................................................................................ 3-39 DARCY ........................................................................................................................................................................... 3-39 DATE............................................................................................................................................................................... 3-39 DATE........................................................................................................................................................................... 3-39 DATE+ ............................................................................................................................................................................ 3-40 DBUG.............................................................................................................................................................................. 3-40 DDAYS............................................................................................................................................................................ 3-40 DEC ................................................................................................................................................................................. 3-41 DECR .............................................................................................................................................................................. 3-41 DEDICACE..................................................................................................................................................................... 3-41 DEF ................................................................................................................................................................................. 3-41 DEFINE........................................................................................................................................................................... 3-41 DEG................................................................................................................................................................................. 3-42 DEGREE......................................................................................................................................................................... 3-42 DELALARM .................................................................................................................................................................... 3-42 DELAY ............................................................................................................................................................................ 3-42 DELKEYS ....................................................................................................................................................................... 3-42 DEPND ........................................................................................................................................................................... 3-43 DEPTH............................................................................................................................................................................ 3-44 DERIV ............................................................................................................................................................................. 3-44 DERVX............................................................................................................................................................................ 3-44 DESOLVE....................................................................................................................................................................... 3-44 DET ................................................................................................................................................................................. 3-44 DETACH ......................................................................................................................................................................... 3-44 DIAG............................................................................................................................................................................ 3-45 DIAG............................................................................................................................................................................ 3-45 DIAGMAP ....................................................................................................................................................................... 3-45 DIFF................................................................................................................................................................................. 3-45 DIFFEQ........................................................................................................................................................................... 3-46 DIR................................................................................................................................................................................... 3-47 DISP ................................................................................................................................................................................ 3-47 DISPXY........................................................................................................................................................................... 3-47 DISTRIB.......................................................................................................................................................................... 3-48 DIV................................................................................................................................................................................... 3-48 DIV2................................................................................................................................................................................. 3-48 DIV2MOD ....................................................................................................................................................................... 3-48 DIVIS ............................................................................................................................................................................... 3-48 Contents - 4 DIVMOD..........................................................................................................................................................................3-48 DIVPC..............................................................................................................................................................................3-48 dn .....................................................................................................................................................................................3-48 DO....................................................................................................................................................................................3-48 DOERR ...........................................................................................................................................................................3-49 DOLIST ...........................................................................................................................................................................3-49 DOMAIN..........................................................................................................................................................................3-50 DOSUBS.........................................................................................................................................................................3-50 DOT .................................................................................................................................................................................3-50 DRAW .............................................................................................................................................................................3-51 DRAW3DMATRIX .........................................................................................................................................................3-51 DRAX...............................................................................................................................................................................3-51 DROITE...........................................................................................................................................................................3-52 DROP ..............................................................................................................................................................................3-52 DROP2 ............................................................................................................................................................................3-52 DROPN ...........................................................................................................................................................................3-52 DTAG...............................................................................................................................................................................3-52 DUP .................................................................................................................................................................................3-53 DUP2 ...............................................................................................................................................................................3-53 DUPDUP.........................................................................................................................................................................3-53 DUPN ..............................................................................................................................................................................3-53 DR ................................................................................................................................................................................3-54 e .......................................................................................................................................................................................3-54 EDIT.................................................................................................................................................................................3-54 EDITB ..............................................................................................................................................................................3-55 EGCD ..............................................................................................................................................................................3-55 EGV .................................................................................................................................................................................3-55 EGVL ...............................................................................................................................................................................3-55 ELSE................................................................................................................................................................................3-55 END .................................................................................................................................................................................3-56 ENDSUB .........................................................................................................................................................................3-56 ENG .................................................................................................................................................................................3-56 EPSX0.............................................................................................................................................................................3-56 EQNLIB ...........................................................................................................................................................................3-56 EQW ................................................................................................................................................................................3-57 EQ ................................................................................................................................................................................3-57 ERASE ............................................................................................................................................................................3-57 ERR0 ...............................................................................................................................................................................3-57 ERRM ..............................................................................................................................................................................3-57 ERRN ..............................................................................................................................................................................3-58 EULER ............................................................................................................................................................................3-58 EVAL................................................................................................................................................................................3-58 EXLR ...............................................................................................................................................................................3-59 EX&LN.............................................................................................................................................................................3-59 EXP..................................................................................................................................................................................3-59 EXP2HYP .......................................................................................................................................................................3-60 EXP2POW ......................................................................................................................................................................3-60 EXPAN ............................................................................................................................................................................3-60 EXPAND .........................................................................................................................................................................3-60 EXPANDMOD ................................................................................................................................................................3-60 EXPFIT............................................................................................................................................................................3-60 EXPLN.............................................................................................................................................................................3-60 EXPM ..............................................................................................................................................................................3-60 EYEPT.............................................................................................................................................................................3-61 F0...................................................................................................................................................................................3-61 FACT ...............................................................................................................................................................................3-61 FACTOR .........................................................................................................................................................................3-62 FACTORMOD ................................................................................................................................................................3-62 Contents - 5 FACTORS ...................................................................................................................................................................... 3-62 FANNING ....................................................................................................................................................................... 3-62 FAST3D .......................................................................................................................................................................... 3-62 FCOEF............................................................................................................................................................................ 3-63 FC?.................................................................................................................................................................................. 3-63 FC?C ............................................................................................................................................................................... 3-63 FDISTRIB ....................................................................................................................................................................... 3-64 FFT .................................................................................................................................................................................. 3-64 FILER .............................................................................................................................................................................. 3-64 FINDALARM .................................................................................................................................................................. 3-64 FINISH ............................................................................................................................................................................ 3-65 FIX ................................................................................................................................................................................... 3-65 FLASHEVAL .................................................................................................................................................................. 3-65 FLOOR............................................................................................................................................................................ 3-66 FONT6 ............................................................................................................................................................................ 3-66 FONT7 ............................................................................................................................................................................ 3-66 FONT8 ............................................................................................................................................................................ 3-66 FONT........................................................................................................................................................................... 3-67 FONT........................................................................................................................................................................... 3-67 FOR ................................................................................................................................................................................. 3-67 FOURIER ....................................................................................................................................................................... 3-68 FP .................................................................................................................................................................................... 3-68 FREE............................................................................................................................................................................... 3-68 FREEZE.......................................................................................................................................................................... 3-68 FROOTS......................................................................................................................................................................... 3-69 FS? .................................................................................................................................................................................. 3-69 FS?C ............................................................................................................................................................................... 3-69 FUNCTION..................................................................................................................................................................... 3-70 FXND............................................................................................................................................................................... 3-71 GAMMA .......................................................................................................................................................................... 3-71 GAUSS ........................................................................................................................................................................... 3-71 GBASIS........................................................................................................................................................................... 3-71 GCD................................................................................................................................................................................. 3-71 GCDMOD ....................................................................................................................................................................... 3-71 GET ................................................................................................................................................................................. 3-71 GETI ................................................................................................................................................................................ 3-72 GOR ................................................................................................................................................................................ 3-73 GRAD.............................................................................................................................................................................. 3-73 GRAMSCHMIDT ........................................................................................................................................................... 3-73 GREDUCE ..................................................................................................................................................................... 3-73 GRIDMAP....................................................................................................................................................................... 3-73 GROB.......................................................................................................................................................................... 3-74 GROB.............................................................................................................................................................................. 3-74 GROBADD ..................................................................................................................................................................... 3-74 GXOR.............................................................................................................................................................................. 3-75 HADAMARD................................................................................................................................................................... 3-75 HALFTAN ....................................................................................................................................................................... 3-75 HALT ............................................................................................................................................................................... 3-75 HEAD .............................................................................................................................................................................. 3-75 HEADER..................................................................................................................................................................... 3-76 HEADER..................................................................................................................................................................... 3-76 HELP ............................................................................................................................................................................... 3-76 HERMITE ....................................................................................................................................................................... 3-76 HESS............................................................................................................................................................................... 3-76 HEX ................................................................................................................................................................................. 3-76 HILBERT......................................................................................................................................................................... 3-77 HISTOGRAM ................................................................................................................................................................. 3-77 HISTPLOT ...................................................................................................................................................................... 3-77 Contents - 6 HMS­...............................................................................................................................................................................3-78 HMS+ ..............................................................................................................................................................................3-78 HMS.............................................................................................................................................................................3-79 HMS.............................................................................................................................................................................3-79 HOME..............................................................................................................................................................................3-79 HORNER ........................................................................................................................................................................3-79 i.........................................................................................................................................................................................3-80 IABCUV...........................................................................................................................................................................3-80 IBASIS.............................................................................................................................................................................3-80 IBERNOULLI ..................................................................................................................................................................3-80 IBP ...................................................................................................................................................................................3-80 ICHINREM ......................................................................................................................................................................3-80 IDN...................................................................................................................................................................................3-80 IDIV2................................................................................................................................................................................3-81 IEGCD .............................................................................................................................................................................3-81 IF ......................................................................................................................................................................................3-81 IFERR..............................................................................................................................................................................3-81 IFFT .................................................................................................................................................................................3-82 IFT....................................................................................................................................................................................3-83 IFTE .................................................................................................................................................................................3-83 ILAP .................................................................................................................................................................................3-83 IM .....................................................................................................................................................................................3-83 IMAGE.............................................................................................................................................................................3-84 INCR ................................................................................................................................................................................3-84 INDEP..............................................................................................................................................................................3-84 INFORM ..........................................................................................................................................................................3-85 INPUT..............................................................................................................................................................................3-86 INT ...................................................................................................................................................................................3-86 INTEGER ........................................................................................................................................................................3-87 INTVX ..............................................................................................................................................................................3-87 INV ...................................................................................................................................................................................3-87 INVMOD..........................................................................................................................................................................3-87 IP......................................................................................................................................................................................3-87 IQUOT .............................................................................................................................................................................3-87 IREMAINDER.................................................................................................................................................................3-87 ISOL.................................................................................................................................................................................3-87 ISOM................................................................................................................................................................................3-88 ISPRIME? .......................................................................................................................................................................3-88 IR..................................................................................................................................................................................3-88 JORDAN .........................................................................................................................................................................3-88 KER .................................................................................................................................................................................3-88 KERRM ...........................................................................................................................................................................3-88 KEY..................................................................................................................................................................................3-89 KEYEVAL........................................................................................................................................................................3-89 KEYTIME ....................................................................................................................................................................3-89 KEYTIME ....................................................................................................................................................................3-89 KGET...............................................................................................................................................................................3-90 KILL .................................................................................................................................................................................3-90 LABEL .............................................................................................................................................................................3-90 LAGRANGE....................................................................................................................................................................3-90 LANGUAGE................................................................................................................................................................3-91 LANGUAGE................................................................................................................................................................3-91 LAP ..................................................................................................................................................................................3-91 LAPL ................................................................................................................................................................................3-91 LAST................................................................................................................................................................................3-91 LASTARG .......................................................................................................................................................................3-91 LCD..............................................................................................................................................................................3-92 LCD..............................................................................................................................................................................3-92 Contents - 7 LCM ................................................................................................................................................................................. 3-92 LCXM .............................................................................................................................................................................. 3-92 LDEC............................................................................................................................................................................... 3-92 LEGENDRE ................................................................................................................................................................... 3-92 LGCD .............................................................................................................................................................................. 3-92 LIBEVAL ......................................................................................................................................................................... 3-92 LIBS................................................................................................................................................................................. 3-93 lim .................................................................................................................................................................................... 3-93 LIMIT ............................................................................................................................................................................... 3-93 LIN ................................................................................................................................................................................... 3-93 LINE................................................................................................................................................................................. 3-93 LINE .............................................................................................................................................................................. 3-93 LINFIT ............................................................................................................................................................................. 3-94 LININ ............................................................................................................................................................................... 3-94 LINSOLVE ...................................................................................................................................................................... 3-94 LIST ............................................................................................................................................................................. 3-94 LIST ............................................................................................................................................................................. 3-94 LIST............................................................................................................................................................................... 3-95 LIST .............................................................................................................................................................................. 3-95 LIST............................................................................................................................................................................... 3-95 LN .................................................................................................................................................................................... 3-95 LNAME............................................................................................................................................................................ 3-96 LNCOLLECT .................................................................................................................................................................. 3-97 LNP1 ............................................................................................................................................................................... 3-97 LOCAL ............................................................................................................................................................................ 3-97 LOG ................................................................................................................................................................................. 3-97 LOGFIT ........................................................................................................................................................................... 3-98 LQ .................................................................................................................................................................................... 3-98 LR .................................................................................................................................................................................... 3-98 LSQ ................................................................................................................................................................................. 3-99 LU .................................................................................................................................................................................... 3-99 LVAR ............................................................................................................................................................................. 3-100 MAD............................................................................................................................................................................... 3-100 MAIN ............................................................................................................................................................................. 3-100 MANT ............................................................................................................................................................................ 3-100 MAP............................................................................................................................................................................... 3-100 MATCH....................................................................................................................................................................... 3-100 MATCH....................................................................................................................................................................... 3-101 MATHS ......................................................................................................................................................................... 3-101 MATR ............................................................................................................................................................................ 3-101 MAX............................................................................................................................................................................... 3-101 MAXR............................................................................................................................................................................ 3-102 MAX ............................................................................................................................................................................ 3-102 MCALC ......................................................................................................................................................................... 3-102 MEAN............................................................................................................................................................................ 3-103 MEM .............................................................................................................................................................................. 3-103 MENU............................................................................................................................................................................ 3-103 MENUXY ...................................................................................................................................................................... 3-104 MERGE......................................................................................................................................................................... 3-104 MIN ................................................................................................................................................................................ 3-104 MINEHUNT .................................................................................................................................................................. 3-104 MINIFONT ................................................................................................................................................................ 3-105 MINIFONT ................................................................................................................................................................ 3-105 MINIT............................................................................................................................................................................. 3-105 MINR ............................................................................................................................................................................. 3-106 MIN.............................................................................................................................................................................. 3-106 MITM ............................................................................................................................................................................. 3-106 MKISOM ....................................................................................................................................................................... 3-106 Contents - 8 MOD ..............................................................................................................................................................................3-106 MODSTO ......................................................................................................................................................................3-107 MODULAR....................................................................................................................................................................3-107 MROOT.........................................................................................................................................................................3-107 MSGBOX ......................................................................................................................................................................3-107 MSLV.............................................................................................................................................................................3-107 MSOLVR.......................................................................................................................................................................3-107 MULTMOD....................................................................................................................................................................3-108 MUSER .........................................................................................................................................................................3-108 NDISP........................................................................................................................................................................3-108 NDIST............................................................................................................................................................................3-108 NDUPN .........................................................................................................................................................................3-109 NEG ...............................................................................................................................................................................3-109 NEWOB.........................................................................................................................................................................3-109 NEXT .............................................................................................................................................................................3-110 NEXTPRIME ................................................................................................................................................................3-110 NIP .................................................................................................................................................................................3-110 NOT ...............................................................................................................................................................................3-110 NOVAL ..........................................................................................................................................................................3-111 N ..................................................................................................................................................................................3-111 NSUB.............................................................................................................................................................................3-111 NUM...........................................................................................................................................................................3-111 NUM...............................................................................................................................................................................3-112 NUMX ............................................................................................................................................................................3-112 NUMY ............................................................................................................................................................................3-112 OBJ ............................................................................................................................................................................3-113 OCT ...............................................................................................................................................................................3-113 OFF................................................................................................................................................................................3-113 OLDPRT........................................................................................................................................................................3-114 OPENIO ........................................................................................................................................................................3-114 OR..................................................................................................................................................................................3-114 ORDER .........................................................................................................................................................................3-115 OVER ............................................................................................................................................................................3-115 P2C ................................................................................................................................................................................3-115 PA2B2 ...........................................................................................................................................................................3-115 PARAMETRIC..............................................................................................................................................................3-116 PARITY .........................................................................................................................................................................3-116 PARSURFACE ............................................................................................................................................................3-117 PARTFRAC ..................................................................................................................................................................3-118 PATH .............................................................................................................................................................................3-118 PCAR.............................................................................................................................................................................3-118 PCOEF ..........................................................................................................................................................................3-118 PCONTOUR.................................................................................................................................................................3-118 PCOV ............................................................................................................................................................................3-119 PDIM..............................................................................................................................................................................3-119 PERM ............................................................................................................................................................................3-120 PEVAL...........................................................................................................................................................................3-120 PGDIR ...........................................................................................................................................................................3-120 PICK ..............................................................................................................................................................................3-121 PICK3 ............................................................................................................................................................................3-121 PICT...............................................................................................................................................................................3-121 PICTURE ......................................................................................................................................................................3-121 PINIT..............................................................................................................................................................................3-122 PIX? ...............................................................................................................................................................................3-122 PIXOFF .........................................................................................................................................................................3-122 PIXON ...........................................................................................................................................................................3-122 PKT ................................................................................................................................................................................3-122 PLOT .............................................................................................................................................................................3-123 Contents - 9 PLOTADD..................................................................................................................................................................... 3-123 PMAX ............................................................................................................................................................................ 3-123 PMIN ............................................................................................................................................................................. 3-123 PMINI ............................................................................................................................................................................ 3-124 POLAR.......................................................................................................................................................................... 3-124 POLYNOMIAL.............................................................................................................................................................. 3-125 POP ............................................................................................................................................................................... 3-125 POS ............................................................................................................................................................................... 3-125 POTENTIAL ................................................................................................................................................................. 3-125 POWEXPAND.............................................................................................................................................................. 3-125 POWMOD..................................................................................................................................................................... 3-125 PR1................................................................................................................................................................................ 3-125 PREDV.......................................................................................................................................................................... 3-126 PREDX.......................................................................................................................................................................... 3-126 PREDY.......................................................................................................................................................................... 3-127 PREVAL........................................................................................................................................................................ 3-127 PREVPRIME ................................................................................................................................................................ 3-127 PRLCD.......................................................................................................................................................................... 3-128 PROMPT ...................................................................................................................................................................... 3-128 PROMPTSTO .............................................................................................................................................................. 3-128 PROOT ......................................................................................................................................................................... 3-128 PROPFRAC ................................................................................................................................................................. 3-129 PRST............................................................................................................................................................................. 3-129 PRSTC.......................................................................................................................................................................... 3-129 PRVAR.......................................................................................................................................................................... 3-129 PSDEV .......................................................................................................................................................................... 3-130 PSI ................................................................................................................................................................................. 3-130 Psi.................................................................................................................................................................................. 3-130 PTAYL........................................................................................................................................................................... 3-130 PURGE ......................................................................................................................................................................... 3-131 PUSH ............................................................................................................................................................................ 3-131 PUT ............................................................................................................................................................................... 3-131 PUTI .............................................................................................................................................................................. 3-132 PVAR............................................................................................................................................................................. 3-133 PVARS.......................................................................................................................................................................... 3-133 PVIEW........................................................................................................................................................................... 3-134 PWRFIT ........................................................................................................................................................................ 3-134 PXC ........................................................................................................................................................................... 3-134 Q ................................................................................................................................................................................ 3-135 Q .............................................................................................................................................................................. 3-135 qr.................................................................................................................................................................................... 3-135 QR ................................................................................................................................................................................. 3-136 QUAD............................................................................................................................................................................ 3-136 QUOT............................................................................................................................................................................ 3-136 QUOTE ......................................................................................................................................................................... 3-136 QXA ............................................................................................................................................................................... 3-137 RAD ............................................................................................................................................................................... 3-137 RAND ............................................................................................................................................................................ 3-137 RANK ............................................................................................................................................................................ 3-137 RANM............................................................................................................................................................................ 3-138 RATIO ........................................................................................................................................................................... 3-138 RCEQ............................................................................................................................................................................ 3-139 RCI................................................................................................................................................................................. 3-139 RCIJ............................................................................................................................................................................... 3-139 RCL ............................................................................................................................................................................... 3-139 RCLALARM.................................................................................................................................................................. 3-140 RCLF ............................................................................................................................................................................. 3-140 RCLKEYS..................................................................................................................................................................... 3-141 Contents - 10 RCLMENU ....................................................................................................................................................................3-141 RCLVX ..........................................................................................................................................................................3-141 RCL .............................................................................................................................................................................3-141 RCWS ...........................................................................................................................................................................3-142 RDM...............................................................................................................................................................................3-142 RDZ ...............................................................................................................................................................................3-142 RE ..................................................................................................................................................................................3-143 RECN ............................................................................................................................................................................3-143 RECT.............................................................................................................................................................................3-143 RECV.............................................................................................................................................................................3-144 REF................................................................................................................................................................................3-144 REMAINDER................................................................................................................................................................3-144 RENAME.......................................................................................................................................................................3-144 REORDER....................................................................................................................................................................3-144 REPEAT........................................................................................................................................................................3-144 REPL .............................................................................................................................................................................3-144 RES ...............................................................................................................................................................................3-145 RESTORE ....................................................................................................................................................................3-146 RESULTANT ................................................................................................................................................................3-146 REVLIST .......................................................................................................................................................................3-146 REWRITE .....................................................................................................................................................................3-147 RISCH ...........................................................................................................................................................................3-147 RKF................................................................................................................................................................................3-147 RKFERR .......................................................................................................................................................................3-147 RKFSTEP .....................................................................................................................................................................3-148 RL...................................................................................................................................................................................3-148 RLB................................................................................................................................................................................3-148 RND ...............................................................................................................................................................................3-149 RNRM............................................................................................................................................................................3-149 ROLL .............................................................................................................................................................................3-150 ROLLD ..........................................................................................................................................................................3-150 ROMUPLOAD ..............................................................................................................................................................3-150 ROOT ............................................................................................................................................................................3-150 ROT ...............................................................................................................................................................................3-151 ROW­............................................................................................................................................................................3-151 ROW+............................................................................................................................................................................3-151 ROW ..........................................................................................................................................................................3-151 ROW ..........................................................................................................................................................................3-152 RPL>..............................................................................................................................................................................3-152 RR..................................................................................................................................................................................3-152 RRB ...............................................................................................................................................................................3-153 rref..................................................................................................................................................................................3-153 RREF.............................................................................................................................................................................3-153 RREFMOD....................................................................................................................................................................3-153 RRK ...............................................................................................................................................................................3-153 RRKSTEP.....................................................................................................................................................................3-154 RSBERR .......................................................................................................................................................................3-155 RSD ...............................................................................................................................................................................3-155 RSWP............................................................................................................................................................................3-156 RULES ..........................................................................................................................................................................3-156 RB ..............................................................................................................................................................................3-156 RC ..............................................................................................................................................................................3-156 RD ..............................................................................................................................................................................3-157 RI................................................................................................................................................................................3-157 SAME ............................................................................................................................................................................3-157 SBRK.............................................................................................................................................................................3-157 SCALE...........................................................................................................................................................................3-158 SCALEH........................................................................................................................................................................3-158 Contents - 11 SCALEW....................................................................................................................................................................... 3-158 SCATRPLOT................................................................................................................................................................ 3-158 SCATTER..................................................................................................................................................................... 3-159 SCHUR ......................................................................................................................................................................... 3-159 SCI................................................................................................................................................................................. 3-160 SCL ............................................................................................................................................................................. 3-160 SCONJ.......................................................................................................................................................................... 3-160 SCROLL ....................................................................................................................................................................... 3-160 SDEV............................................................................................................................................................................. 3-161 SEND ............................................................................................................................................................................ 3-161 SEQ ............................................................................................................................................................................... 3-161 SERIES......................................................................................................................................................................... 3-162 SERVER ....................................................................................................................................................................... 3-162 SEVAL........................................................................................................................................................................... 3-162 SF .................................................................................................................................................................................. 3-162 SHOW ........................................................................................................................................................................... 3-162 SIDENS......................................................................................................................................................................... 3-163 SIGMA........................................................................................................................................................................... 3-163 SIGMAVX ..................................................................................................................................................................... 3-163 SIGN.............................................................................................................................................................................. 3-163 SIGNTAB ...................................................................................................................................................................... 3-164 SIMP2 ........................................................................................................................................................................... 3-164 SIMPLIFY ..................................................................................................................................................................... 3-164 SIN................................................................................................................................................................................. 3-164 SINCOS ........................................................................................................................................................................ 3-164 SINH.............................................................................................................................................................................. 3-164 SINV .............................................................................................................................................................................. 3-165 SIZE............................................................................................................................................................................... 3-165 SL................................................................................................................................................................................... 3-165 SLB................................................................................................................................................................................ 3-166 SLOPEFIELD............................................................................................................................................................... 3-166 SNEG ............................................................................................................................................................................ 3-167 SNRM............................................................................................................................................................................ 3-167 SOLVE .......................................................................................................................................................................... 3-167 SOLVEQN .................................................................................................................................................................... 3-167 SOLVER ....................................................................................................................................................................... 3-168 SOLVEVX..................................................................................................................................................................... 3-168 SORT ............................................................................................................................................................................ 3-168 SPHERE ....................................................................................................................................................................... 3-168 SQ.................................................................................................................................................................................. 3-168 SR.................................................................................................................................................................................. 3-169 SRAD ............................................................................................................................................................................ 3-169 SRB ............................................................................................................................................................................... 3-169 SRECV.......................................................................................................................................................................... 3-169 SREPL .......................................................................................................................................................................... 3-170 START .......................................................................................................................................................................... 3-170 STD ............................................................................................................................................................................... 3-171 STEP ............................................................................................................................................................................. 3-172 STEQ............................................................................................................................................................................. 3-172 STIME ........................................................................................................................................................................... 3-172 STO ............................................................................................................................................................................... 3-172 STOALARM.................................................................................................................................................................. 3-173 STOF............................................................................................................................................................................. 3-173 STOKEYS..................................................................................................................................................................... 3-174 STORE.......................................................................................................................................................................... 3-174 STOVX.......................................................................................................................................................................... 3-174 STO+............................................................................................................................................................................. 3-174 STO­ ............................................................................................................................................................................. 3-174 STO*.............................................................................................................................................................................. 3-175 Contents - 12 STO/ ..............................................................................................................................................................................3-175 STO .............................................................................................................................................................................3-176 STR............................................................................................................................................................................3-176 STR............................................................................................................................................................................3-176 STREAM .......................................................................................................................................................................3-176 STURM..........................................................................................................................................................................3-177 STURMAB ....................................................................................................................................................................3-177 STWS ............................................................................................................................................................................3-177 SUB ...............................................................................................................................................................................3-177 SUBST ..........................................................................................................................................................................3-178 SUBTMOD....................................................................................................................................................................3-178 SVD ...............................................................................................................................................................................3-178 SVL ................................................................................................................................................................................3-178 SWAP ............................................................................................................................................................................3-179 SYSEVAL......................................................................................................................................................................3-179 SYLVESTER ................................................................................................................................................................3-179 SYST2MAT...................................................................................................................................................................3-179 %T..................................................................................................................................................................................3-179 TABVAL ........................................................................................................................................................................3-180 TABVAR........................................................................................................................................................................3-180 TAG............................................................................................................................................................................3-180 TAIL ...............................................................................................................................................................................3-180 TAN................................................................................................................................................................................3-180 TAN2CS2......................................................................................................................................................................3-181 TAN2SC ........................................................................................................................................................................3-181 TAN2SC2......................................................................................................................................................................3-181 TANH.............................................................................................................................................................................3-181 TAYLOR0......................................................................................................................................................................3-181 TAYLR...........................................................................................................................................................................3-181 TCHEBYCHEFF ..........................................................................................................................................................3-182 TCOLLECT...................................................................................................................................................................3-182 TDELTA ........................................................................................................................................................................3-182 TESTS...........................................................................................................................................................................3-182 TEVAL ...........................................................................................................................................................................3-182 TEXPAND.....................................................................................................................................................................3-183 TEXT..............................................................................................................................................................................3-183 THEN.............................................................................................................................................................................3-183 TICKS ............................................................................................................................................................................3-183 TIME ..............................................................................................................................................................................3-183 TIME ..........................................................................................................................................................................3-183 TINC ..............................................................................................................................................................................3-184 TLIN ...............................................................................................................................................................................3-184 TLINE ............................................................................................................................................................................3-184 TMENU..........................................................................................................................................................................3-184 TOT................................................................................................................................................................................3-185 TRACE ..........................................................................................................................................................................3-185 TRAN.............................................................................................................................................................................3-185 TRANSIO ......................................................................................................................................................................3-185 TRIG ..............................................................................................................................................................................3-186 TRIGCOS......................................................................................................................................................................3-186 TRIGO ...........................................................................................................................................................................3-186 TRIGSIN........................................................................................................................................................................3-186 TRIGTAN ......................................................................................................................................................................3-186 TRN ...............................................................................................................................................................................3-186 TRNC.............................................................................................................................................................................3-186 TRUNC..........................................................................................................................................................................3-187 TRUTH ..........................................................................................................................................................................3-187 TSIMP............................................................................................................................................................................3-188 Contents - 13 TSTR ............................................................................................................................................................................. 3-188 TVARS .......................................................................................................................................................................... 3-188 TVM ............................................................................................................................................................................... 3-188 TVMBEG....................................................................................................................................................................... 3-189 TVMEND....................................................................................................................................................................... 3-189 TVMROOT ................................................................................................................................................................... 3-189 TYPE ............................................................................................................................................................................. 3-189 UBASE .......................................................................................................................................................................... 3-190 UFACT .......................................................................................................................................................................... 3-190 UFL1MINIF............................................................................................................................................................... 3-191 UNASSIGN................................................................................................................................................................... 3-191 UNASSUME................................................................................................................................................................. 3-191 UNBIND ........................................................................................................................................................................ 3-191 UNIT .......................................................................................................................................................................... 3-191 UNPICK ........................................................................................................................................................................ 3-191 UNROT ......................................................................................................................................................................... 3-191 UNTIL............................................................................................................................................................................ 3-192 UPDIR ........................................................................................................................................................................... 3-192 UTPC............................................................................................................................................................................. 3-192 UTPF ............................................................................................................................................................................. 3-192 UTPN............................................................................................................................................................................. 3-193 UTPT ............................................................................................................................................................................. 3-193 UVAL ............................................................................................................................................................................. 3-194 V................................................................................................................................................................................. 3-194 V2............................................................................................................................................................................... 3-195 V3............................................................................................................................................................................... 3-195 VANDERMONDE ........................................................................................................................................................ 3-195 VAR ............................................................................................................................................................................... 3-196 VARS............................................................................................................................................................................. 3-196 VER ............................................................................................................................................................................... 3-196 VERSION ..................................................................................................................................................................... 3-196 VISIT ............................................................................................................................................................................. 3-196 VISITB........................................................................................................................................................................... 3-197 VPOTENTIAL............................................................................................................................................................... 3-197 VTYPE .......................................................................................................................................................................... 3-197 WAIT ............................................................................................................................................................................. 3-197 WHILE........................................................................................................................................................................... 3-198 WIREFRAME ............................................................................................................................................................... 3-198 WSLOG......................................................................................................................................................................... 3-199 X .................................................................................................................................................................................. 3-200 X2 ................................................................................................................................................................................ 3-200 XCOL............................................................................................................................................................................. 3-201 XGET............................................................................................................................................................................. 3-201 XMIT.............................................................................................................................................................................. 3-201 XNUM............................................................................................................................................................................ 3-202 XOR............................................................................................................................................................................... 3-202 XPON ............................................................................................................................................................................ 3-202 XPUT............................................................................................................................................................................. 3-203 XQ.................................................................................................................................................................................. 3-203 XRECV.......................................................................................................................................................................... 3-203 XRNG............................................................................................................................................................................ 3-203 XROOT ......................................................................................................................................................................... 3-204 XSEND.......................................................................................................................................................................... 3-204 XSERV.......................................................................................................................................................................... 3-205 XVOL............................................................................................................................................................................. 3-205 XXRNG ......................................................................................................................................................................... 3-205 XY................................................................................................................................................................................ 3-205 Y .................................................................................................................................................................................. 3-206 Contents - 14 Y2 ................................................................................................................................................................................3-206 YCOL.............................................................................................................................................................................3-206 YRNG ............................................................................................................................................................................3-206 YSLICE..........................................................................................................................................................................3-207 YVOL .............................................................................................................................................................................3-207 YYRNG..........................................................................................................................................................................3-208 ZEROS ..........................................................................................................................................................................3-208 ZFACTOR.....................................................................................................................................................................3-208 ZVOL .............................................................................................................................................................................3-208 ^ (Power) ...................................................................................................................................................................3-209 | (Where) ..................................................................................................................................................................3-209 (Square Root) ......................................................................................................................................................3-210 (Integrate) ..............................................................................................................................................................3-211 ? (Undefined) ..........................................................................................................................................................3-212 (Infinity).............................................................................................................................................................3-212 (Summation) ........................................................................................................................................................3-212 + (Sigma Plus) ....................................................................................................................................................3-212 ­ (Sigma Minus) .................................................................................................................................................3-213 (Pi) ..........................................................................................................................................................................3-213 (Derivative) ...........................................................................................................................................................3-213 ! (Factorial)...............................................................................................................................................................3-214 % (Percent)...............................................................................................................................................................3-214 _ (Unit attachment) ................................................................................................................................................3-215 « » (Program delimeters)......................................................................................................................................3-215 < (Less than) ...........................................................................................................................................................3-215 (Less than or Equal).............................................................................................................................................3-216 > (Greater than) ......................................................................................................................................................3-217 (Greater than or Equal)........................................................................................................................................3-218 (Not equal).............................................................................................................................................................3-219 * (Multiply) ................................................................................................................................................................3-219 + (Add) .....................................................................................................................................................................3-220 ­ (Subtract) ...............................................................................................................................................................3-222 / (Divide)...................................................................................................................................................................3-223 = (Equal) ..................................................................................................................................................................3-223 == (Logical Equality) ............................................................................................................................................3-224 ! (Store) ....................................................................................................................................................................3-225 (Create Local)......................................................................................................................................................3-225 4. Computer Algebra Commands .............................................................................................................................................. 4-1 Introduction ........................................................................................................................................................................4-1 CAS Operations .................................................................................................................................................................4-1 CAS Settings ......................................................................................................................................................................4-2 Selecting CAS Settings ............................................................................................................................................... 4-2 The CAS directory, CASDIR...................................................................................................................................... 4-2 Points to note when choosing settings ........................................................................................................................ 4-3 Using the CAS....................................................................................................................................................................4-4 Examples and Help ..................................................................................................................................................... 4-4 Compatibility with Other Calculators ......................................................................................................................... 4-4 Extending the CAS...................................................................................................................................................... 4-4 Dealing with unexpected CAS results or messages .................................................................................................... 4-4 ABCUV ............................................................................................................................................................................4-12 ACOS2S..........................................................................................................................................................................4-12 ADDTMOD......................................................................................................................................................................4-12 ADDTOREAL .................................................................................................................................................................4-13 ALGB ...............................................................................................................................................................................4-13 ARIT.................................................................................................................................................................................4-13 ASIN2C ...........................................................................................................................................................................4-14 ASIN2T............................................................................................................................................................................4-14 ASSUME.........................................................................................................................................................................4-14 Contents - 15 ATAN2S.......................................................................................................................................................................... 4-15 AUGMENT ..................................................................................................................................................................... 4-15 AXL.................................................................................................................................................................................. 4-15 AXM................................................................................................................................................................................. 4-16 AXQ ................................................................................................................................................................................. 4-16 BASIS.............................................................................................................................................................................. 4-16 C2P.................................................................................................................................................................................. 4-17 CASCFG......................................................................................................................................................................... 4-17 CASCMD ........................................................................................................................................................................ 4-17 CHINREM....................................................................................................................................................................... 4-17 CHOLESKY.................................................................................................................................................................... 4-18 CIRC................................................................................................................................................................................ 4-18 COLLECT ....................................................................................................................................................................... 4-19 CONSTANTS................................................................................................................................................................. 4-19 CURL............................................................................................................................................................................... 4-19 CYCLOTOMIC............................................................................................................................................................... 4-20 DEDICACE..................................................................................................................................................................... 4-20 DEF ................................................................................................................................................................................. 4-20 DEGREE......................................................................................................................................................................... 4-21 DERIV ............................................................................................................................................................................. 4-21 DERVX............................................................................................................................................................................ 4-21 DESOLVE....................................................................................................................................................................... 4-22 DIAGMAP ....................................................................................................................................................................... 4-22 DIFF................................................................................................................................................................................. 4-23 DISTRIB.......................................................................................................................................................................... 4-23 DIV................................................................................................................................................................................... 4-23 DIV2................................................................................................................................................................................. 4-23 DIV2MOD ....................................................................................................................................................................... 4-24 DIVIS ............................................................................................................................................................................... 4-24 DIVMOD ......................................................................................................................................................................... 4-25 DIVPC ............................................................................................................................................................................. 4-25 DOMAIN ......................................................................................................................................................................... 4-25 DROITE .......................................................................................................................................................................... 4-26 dn ..................................................................................................................................................................................... 4-26 EGCD.............................................................................................................................................................................. 4-27 EPSX0............................................................................................................................................................................. 4-27 EULER ............................................................................................................................................................................ 4-28 EXLR ............................................................................................................................................................................... 4-28 EXP&LN.......................................................................................................................................................................... 4-28 EXP2HYP ....................................................................................................................................................................... 4-28 EXP2POW...................................................................................................................................................................... 4-29 EXPAND ......................................................................................................................................................................... 4-29 EXPANDMOD................................................................................................................................................................ 4-30 EXPLN ............................................................................................................................................................................ 4-30 FACTOR ......................................................................................................................................................................... 4-30 FACTORMOD................................................................................................................................................................ 4-31 FACTORS ...................................................................................................................................................................... 4-31 FCOEF............................................................................................................................................................................ 4-31 FDISTRIB ....................................................................................................................................................................... 4-32 FOURIER ....................................................................................................................................................................... 4-32 FROOTS......................................................................................................................................................................... 4-33 FXND............................................................................................................................................................................... 4-33 GAUSS ........................................................................................................................................................................... 4-33 GBASIS........................................................................................................................................................................... 4-34 GCD................................................................................................................................................................................. 4-34 GCDMOD ....................................................................................................................................................................... 4-35 GRAMSCHMIDT ........................................................................................................................................................... 4-35 GREDUCE ..................................................................................................................................................................... 4-35 HADAMARD................................................................................................................................................................... 4-36 Contents - 16 HALFTAN........................................................................................................................................................................4-36 HELP ...............................................................................................................................................................................4-36 HERMITE........................................................................................................................................................................4-37 HESS...............................................................................................................................................................................4-37 HILBERT.........................................................................................................................................................................4-37 HORNER ........................................................................................................................................................................4-38 IABCUV...........................................................................................................................................................................4-38 IBASIS.............................................................................................................................................................................4-38 IBERNOULLI ..................................................................................................................................................................4-39 IBP ...................................................................................................................................................................................4-39 ICHINREM ......................................................................................................................................................................4-40 IDIV2................................................................................................................................................................................4-40 IEGCD .............................................................................................................................................................................4-40 ILAP .................................................................................................................................................................................4-41 IMAGE.............................................................................................................................................................................4-41 INT ...................................................................................................................................................................................4-41 INTEGER ........................................................................................................................................................................4-42 INTVX ..............................................................................................................................................................................4-42 INVMOD..........................................................................................................................................................................4-42 IQUOT .............................................................................................................................................................................4-43 IREMAINDER.................................................................................................................................................................4-43 ISOM................................................................................................................................................................................4-43 ISPRIME? .......................................................................................................................................................................4-44 JORDAN .........................................................................................................................................................................4-44 KER .................................................................................................................................................................................4-45 LAGRANGE....................................................................................................................................................................4-45 LAP ..................................................................................................................................................................................4-45 LAPL ................................................................................................................................................................................4-46 LCM .................................................................................................................................................................................4-46 LCXM...............................................................................................................................................................................4-46 LDEC ...............................................................................................................................................................................4-47 LEGENDRE....................................................................................................................................................................4-47 LGCD...............................................................................................................................................................................4-48 LIMIT................................................................................................................................................................................4-48 lim.....................................................................................................................................................................................4-48 LIN ...................................................................................................................................................................................4-48 LINSOLVE ......................................................................................................................................................................4-49 LNAME ............................................................................................................................................................................4-49 LNCOLLECT ..................................................................................................................................................................4-49 LOCAL.............................................................................................................................................................................4-50 LVAR ...............................................................................................................................................................................4-50 MAD.................................................................................................................................................................................4-51 MAIN................................................................................................................................................................................4-51 MATHS............................................................................................................................................................................4-51 MATR ..............................................................................................................................................................................4-52 MENUXY.........................................................................................................................................................................4-52 MKISOM..........................................................................................................................................................................4-53 MODSTO ........................................................................................................................................................................4-53 MODULAR......................................................................................................................................................................4-53 MSLV...............................................................................................................................................................................4-54 MULTMOD......................................................................................................................................................................4-54 NEXTPRIME ..................................................................................................................................................................4-55 P2C ..................................................................................................................................................................................4-55 PA2B2 .............................................................................................................................................................................4-55 PARTFRAC ....................................................................................................................................................................4-56 PCAR...............................................................................................................................................................................4-56 PMINI...............................................................................................................................................................................4-56 POLYNOMIAL................................................................................................................................................................4-57 POTENTIAL....................................................................................................................................................................4-57 Contents - 17 POWEXPAND................................................................................................................................................................ 4-57 POWMOD....................................................................................................................................................................... 4-58 PREVAL.......................................................................................................................................................................... 4-58 PREVPRIME .................................................................................................................................................................. 4-58 PROPFRAC ................................................................................................................................................................... 4-59 PTAYL............................................................................................................................................................................. 4-59 QUOT.............................................................................................................................................................................. 4-59 QXA ................................................................................................................................................................................. 4-60 RCLVX ............................................................................................................................................................................ 4-60 REF ................................................................................................................................................................................. 4-60 REMAINDER.................................................................................................................................................................. 4-61 REORDER ..................................................................................................................................................................... 4-61 RESULTANT.................................................................................................................................................................. 4-61 REWRITE ....................................................................................................................................................................... 4-62 RISCH ............................................................................................................................................................................. 4-62 RREF............................................................................................................................................................................... 4-62 rref ................................................................................................................................................................................... 4-63 RREFMOD ..................................................................................................................................................................... 4-63 SERIES........................................................................................................................................................................... 4-64 SEVAL............................................................................................................................................................................. 4-64 SIGMA............................................................................................................................................................................. 4-65 SIGMAVX ....................................................................................................................................................................... 4-65 SIGNTAB ........................................................................................................................................................................ 4-65 SIMP2 ............................................................................................................................................................................. 4-66 SIMPLIFY ....................................................................................................................................................................... 4-66 SINCOS .......................................................................................................................................................................... 4-67 SOLVE ............................................................................................................................................................................ 4-67 SOLVEVX....................................................................................................................................................................... 4-68 STORE............................................................................................................................................................................ 4-68 STOVX............................................................................................................................................................................ 4-68 STURM ........................................................................................................................................................................... 4-69 STURMAB ...................................................................................................................................................................... 4-69 SUBST ............................................................................................................................................................................ 4-69 SUBTMOD ..................................................................................................................................................................... 4-70 SYLVESTER .................................................................................................................................................................. 4-70 SYST2MAT .................................................................................................................................................................... 4-71 TABVAL .......................................................................................................................................................................... 4-71 TABVAR ......................................................................................................................................................................... 4-71 TAN2CS2 ....................................................................................................................................................................... 4-72 TAN2SC.......................................................................................................................................................................... 4-72 TAN2SC2 ....................................................................................................................................................................... 4-73 TAYLOR0 ....................................................................................................................................................................... 4-73 TCHEBYCHEFF ............................................................................................................................................................ 4-73 TCOLLECT..................................................................................................................................................................... 4-74 TESTS............................................................................................................................................................................. 4-74 TEXPAND....................................................................................................................................................................... 4-74 TLIN................................................................................................................................................................................. 4-74 TRIG................................................................................................................................................................................ 4-75 TRIGCOS ....................................................................................................................................................................... 4-75 TRIGO............................................................................................................................................................................. 4-76 TRIGSIN ......................................................................................................................................................................... 4-76 TRIGTAN ........................................................................................................................................................................ 4-76 TRUNC ........................................................................................................................................................................... 4-77 TSIMP ............................................................................................................................................................................. 4-77 UNASSIGN..................................................................................................................................................................... 4-77 UNASSUME................................................................................................................................................................... 4-78 UNBIND .......................................................................................................................................................................... 4-78 VANDERMONDE .......................................................................................................................................................... 4-78 VER ................................................................................................................................................................................. 4-79 Contents - 18 VPOTENTIAL .................................................................................................................................................................4-79 XNUM ..............................................................................................................................................................................4-79 XQ ....................................................................................................................................................................................4-80 ZEROS ............................................................................................................................................................................4-80 ? .......................................................................................................................................................................................4-81 .......................................................................................................................................................................................4-81 5. Equation Reference ............................................................................................................................................................... 5-1 Columns and Beams (1) .....................................................................................................................................................5-3 Elastic Buckling (1, 1) ................................................................................................................................................ 5-4 Eccentric Columns (1, 2)............................................................................................................................................. 5-4 Simple Deflection (1, 3).............................................................................................................................................. 5-5 Simple Slope (1, 4)...................................................................................................................................................... 5-5 Simple Moment (1, 5) ................................................................................................................................................. 5-6 Simple Shear (1, 6)...................................................................................................................................................... 5-6 Cantilever Deflection (1, 7)......................................................................................................................................... 5-7 Cantilever Slope (1, 8) ................................................................................................................................................ 5-7 Cantilever Moment (1, 9)............................................................................................................................................ 5-8 Cantilever Shear (1, 10) .............................................................................................................................................. 5-8 Electricity (2) .....................................................................................................................................................................5-9 Coulomb's Law (2, 1)................................................................................................................................................ 5-10 Ohm's Law and Power (2, 2)..................................................................................................................................... 5-10 Voltage Divider (2, 3) ............................................................................................................................................... 5-11 Current Divider (2, 4)................................................................................................................................................ 5-11 Wire Resistance (2, 5)............................................................................................................................................... 5-11 Series and Parallel R (2, 6)........................................................................................................................................ 5-12 Series and Parallel C (2, 7)........................................................................................................................................ 5-12 Series and Parallel L (2, 8)........................................................................................................................................ 5-13 Capacitive Energy (2, 9) ........................................................................................................................................... 5-13 Inductive Energy (2, 10) ........................................................................................................................................... 5-13 RLC Current Delay (2, 11) ....................................................................................................................................... 5-14 DC Capacitor Current (2, 12).................................................................................................................................... 5-14 Capacitor Charge (2, 13)........................................................................................................................................... 5-14 DC Inductor Voltage (2, 14) ..................................................................................................................................... 5-14 RC Transient (2, 15).................................................................................................................................................. 5-15 RL Transient (2, 16).................................................................................................................................................. 5-15 Resonant Frequency (2, 17) ...................................................................................................................................... 5-16 Plate Capacitor (2, 18) .............................................................................................................................................. 5-16 Cylindrical Capacitor (2,19)...................................................................................................................................... 5-16 Solenoid Inductance (2, 20) ...................................................................................................................................... 5-17 Toroid Inductance (2, 21).......................................................................................................................................... 5-17 Sinusoidal Voltage (2, 22) ........................................................................................................................................ 5-18 Sinusoidal Current (2, 23)......................................................................................................................................... 5-18 Fluids (3) ..........................................................................................................................................................................5-18 Pressure at Depth (3, 1)............................................................................................................................................. 5-19 Bernoulli Equation (3, 2) .......................................................................................................................................... 5-19 Flow with Losses (3, 3)............................................................................................................................................. 5-20 Flow in Full Pipes (3, 4)............................................................................................................................................ 5-21 Forces and Energy (4) ......................................................................................................................................................5-21 Linear Mechanics (4, 1) ............................................................................................................................................ 5-22 Angular Mechanics (4, 2).......................................................................................................................................... 5-23 Centripetal Force (4, 3) ............................................................................................................................................. 5-23 Hooke's Law (4, 4).................................................................................................................................................... 5-23 1D Elastic Collisions (4, 5) ....................................................................................................................................... 5-24 Drag Force (4, 6)....................................................................................................................................................... 5-24 Law of Gravitation (4, 7) .......................................................................................................................................... 5-24 Mass-Energy Relation (4, 8) ..................................................................................................................................... 5-24 Gases (5) ..........................................................................................................................................................................5-25 Ideal Gas Law (5, 1).................................................................................................................................................. 5-25 Ideal Gas State Change (5, 2).................................................................................................................................... 5-26 Contents - 19 Isothermal Expansion (5, 3)...................................................................................................................................... 5-26 Polytropic Processes (5, 4)........................................................................................................................................ 5-26 Isentropic Flow (5, 5) ............................................................................................................................................... 5-26 Real Gas Law (5, 6) .................................................................................................................................................. 5-27 Real Gas State Change (5, 7) .................................................................................................................................... 5-27 Kinetic Theory (5, 8) ................................................................................................................................................ 5-28 Heat Transfer (6).............................................................................................................................................................. 5-28 Heat Capacity (6, 1) .................................................................................................................................................. 5-29 Thermal Expansion (6, 2) ......................................................................................................................................... 5-29 Conduction (6, 3) ...................................................................................................................................................... 5-29 Convection (6, 4) ...................................................................................................................................................... 5-30 Conduction + Convection (6, 5) ............................................................................................................................... 5-30 Black Body Radiation (6, 6) ..................................................................................................................................... 5-31 Magnetism (7).................................................................................................................................................................. 5-31 Straight Wire (7, 1) ................................................................................................................................................... 5-32 Force between Wires (7, 2)....................................................................................................................................... 5-32 Magnetic (B) Field in Solenoid (7, 3)....................................................................................................................... 5-33 Magnetic (B) Field in Toroid (7, 4) .......................................................................................................................... 5-33 Motion (8) ........................................................................................................................................................................ 5-34 Linear Motion (8, 1) ................................................................................................................................................. 5-35 Object in Free Fall (8, 2)........................................................................................................................................... 5-35 Projectile Motion (8, 3)............................................................................................................................................. 5-35 Angular Motion (8, 4)............................................................................................................................................... 5-36 Circular Motion (8, 5)............................................................................................................................................... 5-36 Terminal Velocity (8, 6) ........................................................................................................................................... 5-36 Escape Velocity (8, 7)............................................................................................................................................... 5-36 Optics (9) ......................................................................................................................................................................... 5-37 Law of Refraction (9, 1) ........................................................................................................................................... 5-37 Critical Angle (9, 2) .................................................................................................................................................. 5-38 Brewster's Law (9, 3)................................................................................................................................................ 5-38 Spherical Reflection (9, 4) ........................................................................................................................................ 5-39 Spherical Refraction (9, 5)........................................................................................................................................ 5-39 Thin Lens (9, 6) ........................................................................................................................................................ 5-39 Oscillations (10)............................................................................................................................................................... 5-40 Mass-Spring System (10, 1)...................................................................................................................................... 5-41 Simple Pendulum (10, 2) .......................................................................................................................................... 5-41 Conical Pendulum (10, 3) ......................................................................................................................................... 5-42 Torsional Pendulum (10, 4) ...................................................................................................................................... 5-42 Simple Harmonic (10, 5) .......................................................................................................................................... 5-42 Plane Geometry (11) ........................................................................................................................................................ 5-43 Circle (11, 1)............................................................................................................................................................. 5-44 Ellipse (11, 2)............................................................................................................................................................ 5-44 Rectangle (11, 3)....................................................................................................................................................... 5-45 Regular Polygon (11, 4)............................................................................................................................................ 5-45 Circular Ring (11, 5)................................................................................................................................................. 5-46 Triangle (11, 6) ......................................................................................................................................................... 5-46 Solid Geometry (12) ........................................................................................................................................................ 5-47 Cone (12, 1) .............................................................................................................................................................. 5-47 Cylinder (12, 2)......................................................................................................................................................... 5-48 Parallelepiped (12, 3)................................................................................................................................................ 5-48 Sphere (12, 4) ........................................................................................................................................................... 5-49 Solid State Devices (13)................................................................................................................................................... 5-49 PN Step Junctions (13, 1) ......................................................................................................................................... 5-51 NMOS Transistors (13, 2) ........................................................................................................................................ 5-52 Bipolar Transistors (13, 3) ........................................................................................................................................ 5-53 JFETs (13, 4) ............................................................................................................................................................ 5-53 Stress Analysis (14) ......................................................................................................................................................... 5-54 Normal Stress (14, 1) ................................................................................................................................................ 5-55 Shear Stress (14, 2) ................................................................................................................................................... 5-56 Contents - 20 Stress on an Element (14, 3) ..................................................................................................................................... 5-56 Mohr's Circle (14, 4) ................................................................................................................................................. 5-57 Waves (15) .......................................................................................................................................................................5-57 Transverse Waves (15,1)........................................................................................................................................... 5-58 Longitudinal Waves (15, 2) ...................................................................................................................................... 5-58 Sound Waves (15, 3)................................................................................................................................................. 5-58 References ........................................................................................................................................................................5-59 6. The Development Library ..................................................................................................................................................... 6-1 Section 1 - Introduction......................................................................................................................................................6-1 Section 2 ­ The tools of the development library ..............................................................................................................6-1 APEEK...............................................................................................................................................................................6-1 PEEK..................................................................................................................................................................................6-1 POKE .................................................................................................................................................................................6-1 PEEKARM.........................................................................................................................................................................6-2 POKEARM ........................................................................................................................................................................6-2 A.....................................................................................................................................................................................6-2 A.....................................................................................................................................................................................6-2 RAM...............................................................................................................................................................................6-2 AH ..................................................................................................................................................................................6-2 HA ..................................................................................................................................................................................6-2 CD ..................................................................................................................................................................................6-3 CD ..................................................................................................................................................................................6-3 H.....................................................................................................................................................................................6-3 H.....................................................................................................................................................................................6-3 SH...................................................................................................................................................................................6-3 HS...................................................................................................................................................................................6-3 SREV .................................................................................................................................................................................6-3 MAKESTR.........................................................................................................................................................................6-4 SERIAL..............................................................................................................................................................................6-4 S2....................................................................................................................................................................................6-4 XLIB~ ................................................................................................................................................................................6-4 CRC....................................................................................................................................................................................6-4 S~N ....................................................................................................................................................................................6-4 R~SB ..................................................................................................................................................................................6-5 SB~B ..................................................................................................................................................................................6-5 LR~R..................................................................................................................................................................................6-5 LC~C..................................................................................................................................................................................6-5 COMP ............................................................................................................................................................................6-5 ALG................................................................................................................................................................................6-5 PRG ................................................................................................................................................................................6-6 LST.................................................................................................................................................................................6-6 Section 3 - CRLIB..............................................................................................................................................................6-6 Section 4 - ASM.................................................................................................................................................................6-8 Section 5 ­ Disassemblers................................................................................................................................................6-34 ASM .............................................................................................................................................................................6-34 ARM.............................................................................................................................................................................6-35 Section 6 ­ The Entry Point Library: Extable ..................................................................................................................6-35 nop....................................................................................................................................................................................6-35 GETNAME ......................................................................................................................................................................6-35 GETADR..........................................................................................................................................................................6-36 GETNAMES ....................................................................................................................................................................6-36 A. Error and Status Messages................................................................................................................................................... A-1 B. Table of Units ...................................................................................................................................................................... B-1 C. System Flags........................................................................................................................................................................ C-1 D. Reserved Variables.............................................................................................................................................................. D-1 Contents of the Reserved Variables .................................................................................................................................. D-2 ENTER............................................................................................................................................................................ D-2 ALRMDAT ....................................................................................................................................................................... D-2 Contents - 21 ENTER............................................................................................................................................................................ D-3 CST ................................................................................................................................................................................... D-3 ENVSTACK ..................................................................................................................................................................... D-4 EQ ..................................................................................................................................................................................... D-4 EXITED ............................................................................................................................................................................ D-4 EXPR ................................................................................................................................................................................ D-4 IOPAR .............................................................................................................................................................................. D-4 MASD.INI ........................................................................................................................................................................ D-6 MHpar............................................................................................................................................................................... D-6 Mpar.................................................................................................................................................................................. D-6 n1, n2, ... .......................................................................................................................................................................... D-6 Nmines .............................................................................................................................................................................. D-6 PPAR ................................................................................................................................................................................ D-6 PRTPAR ........................................................................................................................................................................... D-8 REALASSUME................................................................................................................................................................ D-8 STARTED ........................................................................................................................................................................ D-8 STARTEQW..................................................................................................................................................................... D-9 STARTERR ...................................................................................................................................................................... D-9 STARTOFF ...................................................................................................................................................................... D-9 STARTRECV ................................................................................................................................................................... D-9 STARTSEND ................................................................................................................................................................... D-9 STARTUP......................................................................................................................................................................... D-9 s1, s2, ... ........................................................................................................................................................................... D-9 TOFF................................................................................................................................................................................. D-9 VPAR................................................................................................................................................................................ D-9 ZPAR .............................................................................................................................................................................. D-10 DAT.............................................................................................................................................................................. D-10 PAR .............................................................................................................................................................................. D-11 E. Technical Reference .............................................................................................................................................................E-1 Object Sizes .......................................................................................................................................................................E-1 Symbolic Integration Patterns............................................................................................................................................E-2 Trigonometric Expansions .................................................................................................................................................E-4 Source References..............................................................................................................................................................E-5 F. Parallel Processing with Lists ............................................................................................................................................... F-1 G. Keyboard Shortcuts............................................................................................................................................................. G-1 H. The Menu-Number Table.................................................................................................................................................... H-1 I. The Command Menu-Path Table............................................................................................................................................I-1 J. ASCII Character Codes and Translations...............................................................................................................................J-1 Index .................................................................................................................................................................................. Index-1 Contents - 22 1 1.RPL Programming If you've used a calculator or computer before, you're probably familiar with the idea of programs. Generally speaking, a program is something that gets the calculator or computer to do certain tasks for you -- more than a built-in command might do. In the hp49g+/hp48gII, a program is an object that does the same thing. Understanding Programming An hp49g+/hp48gII program is an object with « » delimiters containing a sequence of numbers, commands, and other objects you want to execute automatically to perform a task. For example, a program that takes a number from the stack, finds its factorial, and divides the result by 2 would look like this: « ! 2 / » or « ! 2 / » The Contents of a Program As mentioned above, a program contains a sequence of objects. As each object is processed in a program, the action depends on the type of object, as summarized below. Actions for Certain Objects in Programs Object Command Number Algebraic or `Algebraic` String List Program Global name (quoted) Global name (unquoted) Action Executed. Put on the stack. Algebraic put on the stack. Put on the stack. Put on the stack. Put on the stack. Put on the stack. ! ! ! ! Program executed. Name evaluated. Directory becomes current. Other object put on the stack. Local name (quoted) Local name (unquoted) Put on the stack. Contents put on the stack As you can see from this table, most types of objects are simply put on the stack -- but built-in commands and programs called by name cause execution. The following examples show the results of executing programs containing different sequences of objects. RPL Programming 1-1 Examples of Program Actions Program «12» « "Hello" {A B}» « '1+2' » « '1+2' NUM» ««12+»» « « 1 2 + » EVAL » Results 2: 1: 2: 1: 1: 1: 1: 1: 1 2 "Hello" {AB} '1+2' 3 «12+» 3 Programs can also contain structures. A structure is a program segment with a defined organization. Two basic kinds of structure are available: Local variable structure. The command defines local variable names and a corresponding algebraic or program object that's evaluated using those variables. ! Branching structures. Structure words (like DO... UNTIL...END) define conditional or loop structures to control the order of execution within a program. ! A local variable structure has one of the following organizations inside a program: « name1 ... namen ' algebraic ' » « name1 ... namen « program » » The " command removes n objects from the stack and stores them in the named local variables. The algebraic or program object in the structure is automatically evaluated because it's an element of the structure ­ even though algebraic and program objects are put on the stack in other situations. Each time a local variable name appears in the algebraic or program object, the variable's contents are substituted. So the following program takes two numbers from the stack and returns a numeric result: « a b 'ABS(a-b)' » Calculations in a Program Many calculations in programs take data from the stack. Two typical ways to manipulate stack data are: Stack commands. Operate directly on the objects on the stack. Local variable structures. Store the stack objects in temporary local variables, then use the variable names to represent the data in the following algebraic or program object. Numeric calculations provide convenient examples of these methods. The following programs use two numbers from the stack to calculate the hypotenuse of a right triangle using the formula x 2 + y 2. « SQ SWAP SQ + » « x y « x SQ y SQ + » » « x y '(x^2+y^2)' » The first program uses stack commands to manipulate the numbers on the stack ­ the calculation uses stack syntax. The second program uses a local variable structure to store and retrieve the numbers ­ the calculation uses stack syntax. The third program also uses a local variable structure -- the calculation uses algebraic syntax. Note that the underlying formula is most apparent in the third program. This third method is often the easiest to write, read, and debug. ! ! 1-2 RPL Programming Entering and Executing Programs A program is an object ­ it occupies one level on the stack, and you can store it in a variable. To enter a program: 1. Press @%.The PRG annunciator appears, indicating program-entry mode is active. 2. Enter the commands and other objects (with appropriate delimiters) in order for the operations you want the program to execute. ! Press # to separate consecutive numbers. ! Press TM to move past closing delimiters. 3. Optional: Press @ë (newline) to start a new line in the command line at any time. 4. Press ` to put the program on the stack. In Program-entry mode (PRG annunciator on), command keys aren't executed -- they're entered in the command line instead. Only nonprogrammable operations such as and J are executed. Line breaks are discarded when you press `. To enter commands and other objects in a program: Press the keyboard or menu key for the command or object. All commands can also be selected from the @µ list. This guide assumes that Flag -117 is clear, so that you see menus rather than choose boxes wherever possible. Also RPN mode should be set. or ! Type the characters using the alpha keyboard. Refer to the hp49g+/hp48gII User's Guide for how to use the alpha keyboard. In this guide an abbreviated convention is used whereby invocations of the alpha keyboard are not always shown. In the next example we show: OVOLK where the alpha "VOL" can be entered as shown: O~~VOL ~K (assuming Flag -60 is clear). ! To store or name a program: 1. Enter the program on the stack. 2. Enter the variable name (with ' delimiters) and press K. ! ! ! You can choose descriptive names for programs. Here are some ideas of what the name can describe: The calculation or action. Examples: SPH (spherical-cap volume), SORT (sort a list). The input and output. Examples: X"FX (x to f (x)), RH"V (radius-and -height to volume). The technique. Example: SPHLV (spherical-cap volume using local variables). To execute a program: Press J then the menu key for the program name. or ! Enter the program name (with no delimiters) and press `. or ! Put the program name in level 1 and press N. or ! Put the program object in level 1 and press N. ! RPL Programming 1-3 To stop an executing program: ! Press -. Example: Enter a program that takes a radius value from the stack and calculates the volume of a sphere of radius r using V= 4 3 r3 If you were going to calculate the volume manually after entering the radius on the stack, you might press these keys: 3Q!ì*4`3/*@ï Enter the same keystrokes in a program. (@ë just starts a new line.) @% 3Q!ì*4#3/* @ë @ï Put the program on the stack. ` Store the program in variable VOL. Then put a radius of 4 on the stack and run the VOL program. OVOL K 4 J %VOL% The program is « 3 ^ oe * 4 3 / * NUM » Example: Replace the program from the previous example with one that's easier to read. Enter a program that uses a local variable structure to calculate the volume of a sphere. The program is « r '4/3*oe*r^3' NUM » (You need to include " NUM because causes a symbolic result, unless Flag -2 or Flag -3 is set) Enter the program. (@ë just starts a new line.) @% @ér # O4 /3 *!ì* r Q3 TM@ë@ï Put the program on the stack, store it in VOL, and calculate the volume for a radius of 4. OVOLK 4 %VOL% 1-4 RPL Programming Example: Enter a program SPH that calculates the volume of a spherical cap of height h within a sphere of radius R using values stored in variables H and R. 12 V = -- h ( 3r ­ h ) 3 In this and following chapters on programming, "stack diagrams" show what arguments must be on the stack before a program is executed and what results the program leaves on the stack. Here's the stack diagram for SPH. Level 1 " " Level 1 volume The diagram indicates that SPH takes no arguments from the stack and returns the volume of the spherical cap to level 1. (SPH assumes that you've stored the numerical value for the radius in variable R and the numerical value for the height in variable H. These are global variables -- they exist outside the program.) Program listings are shown with program steps in the left column and associated comments in the right column. Remember, you can either press the command keys or type in the command names to key in the program. In this first listing, the keystrokes are also shown. Program: « '1/3 *oe*H^2 *(3*R-H)' Keys: @% O1 /3 Comments: Begins the program. Begins the algebraic expression to calculate the volume. *!ì Multiplies by h2. *H Q2 *!Ü Multiplies by 3r - h, completing 3 * R - the calculation and ending the H TMTM expression. @ï Converts the expression with to a number. Ends the program. Puts the program on the stack. Stores the program in variable SPH. NUM » ` OSPH K RPL Programming 1-5 This is the program: « '1/3*oe*H^2*(3*R-H)' NUM » Now use SPH to calculate the volume of a spherical cap of radius r = 10 and height h = 3. First, store the data in the appropriate variables. Then select the VAR menu and execute the program. The answer is returned to level 1 of the stack. 10 O R K 3OHK J %SPH% Viewing and Editing Programs You view and edit programs the same way you view and edit other objects -- using the command line. To view or edit a program: 1. View the program: ! If the program is in level 1, press ~ (or use the EDIT command). ! If the program is stored in a variable, use the Filer (!¡) to select the variable and press EDIT (`), or press J, then @ and the variable's menu key (a shortcut to recall a variable's contents to level 1), followed by ~. Alternatively, with the variable name in level 1 press ,, ~ (or use the EDITB, VISIT or VISITB command). 2. Optional: Make changes. 3. Press ` to save any changes (or press - to discard changes) and return to the stack, or to Filer if you used Filer to select the program. Filer lets you change a stored program without having to do a store operation. From the stack you can change a program and then store the new version in a different variable. While you're editing a program, you may want to switch the command-line entry mode between Program-entry mode (for editing most objects) and Algebraic/Program-entry mode (for editing algebraic objects). The PRG and ALG annunciators indicate the current mode. To switch between entry modes: ! Press @Í. Example: Edit SPH from the previous example so that it stores the number from level 1 into variable H and the number from level 2 into variable R. Select SPH from the soft keys. J @%SPH% ~ Move the cursor past the first program delimiter and insert the new program steps. TMOH TMK OR TMK Save the edited version of SPH in the variable. Then, to verify that the changes were saved, view SPH in the command line. `J!%SPH% 1-6 RPL Programming @%SPH% ~ Press - to stop viewing. Creating Programs on a Computer It is convenient to create programs and other objects on a computer and then load them into the hp49g+/hp48gII. If you are creating programs on a computer, you can include "comments" in the computer version of the program. To include a comment in a program: Enclose the comment text between two @ characters. or ! Enclose the comment text between one @ character and the end of the line. ! Whenever the hp49g+/hp48gII processes text entered in the command line -- either from keyboard entry or transferred from a computer -- it strips away the @ characters and the text they surround. However, @ characters are not affected if they're inside a string. Using Local Variables The program SPH in the previous example uses global variables for data storage and recall. There are disadvantages to using global variables in programs: After program execution, global variables that you no longer need to use must be purged if you want to clear the VAR menu and free user memory. ! You must explicitly store data in global variables prior to program execution, or have the program execute STO. ! Local variables address the disadvantages of global variables in programs. Local variables are temporary variables created by a program. They exist only while the program is being executed and cannot be used outside the program. They never appear in the VAR menu. In addition, local variables are accessed faster than global variables. (By convention, this manual uses lowercase names for local variables.) A compiled local variable is a form of local variable that can be used outside of the program that creates it. See "Compiled Local Variables" on page 1-10 for more information. Creating Local Variables In a program, a local variable structure creates local variables. To enter a local variable structure in a program: 1. Enter the " command (press @é). 2. Enter one or more variable names. 3. Enter a defining procedure (an algebraic or program object) that uses the names. « name1 name2 ... namen ' algebraic ' » or « name1 name2 ... namen « program » » When the " command is executed in a program, n values are taken from the stack and assigned to variables name1 name2, .... namen. For example, if the stack looks like this: RPL Programming 1-7 then a creates local variable a = 20. ab creates local variables a = 6 and b = 20. abc crates local variables a = 10, b = 6, and c = 20. The defining procedure then uses the local variables to do calculations. Local variable structures have these advantages: ! The " command stores the values from the stack in the corresponding variables -- you don't need to explicitly execute STO. Local variables automatically disappear when the defining procedure for which they are created has completed execution. Consequently, local variables don't appear in the VAR menu, and they occupy user memory only during program execution. Local variables exist only within their defining procedure -- different local variable structures can use the same variable names without conflict. ! ! Example: The following program SPHLV calculates the volume of a spherical cap using local variables. The defining procedure is an algebraic expression. Level 2 r Level 1 h " " Level 1 volume Program: « rh Comments: Creates local variables r and h for the radius of the sphere and height of the cap. '1/3*oe*h^2*(3*r-h)' Expresses the defining procedure. In this program, the defining procedure for the local variable structure is an algebraic expression. NUM » OSPHLVK Stores the program in variable SPHLV. Converts expression to a number. Now use SPHLV to calculate the volume of a spherical cap of radius r =10 and height h = 3. Enter the data on the stack in the correct order, then execute the program. 10 `3 J%SPHLV% Evaluating Local Names Local names are evaluated differently from global names. When a global name is evaluated, the object stored in the corresponding variable is itself evaluated. (You've seen how programs stored in global variables are automatically evaluated when the name is evaluated.) 1-8 RPL Programming When a local name is evaluated, the object stored in the corresponding variable is returned to the stack but is not evaluated.When a local variable contains a number, the effect is identical to evaluation of a global name, since putting a number on the stack is equivalent to evaluating it. However, if a local variable contains a program, algebraic expression, or global variable name -- and if you want it evaluated -- the program should execute EVAL after the object is put on the stack. Defining the Scope of Local Variables Local variables exist only inside the defining procedure. Example: The following program excerpt illustrates the availability of local variables in nested defining procedures (procedures within procedures). Because local variables a, b, and c already exist when the defining procedure for local variables d, e, and f is executed, they're available for use in that procedure. Program: « . . . Comments: No local variables are available. Defines local variables a, b, c. Local variables a, b, c are available in this procedure. Defines local variables d, e, f. Local variables a, b, c and d, e, f are available in this procedure. Only local variables a, b, c are available. No local variables are available. abc « ab+c+ def 'a/(d*e+f)' ac/» . . » . RPL Programming 1-9 Example: In the following program excerpt, the defining procedure for local variables d, e, and f calls a program that you previously created and stored in global variable P1. Program: « . . Comments: abc « ab+c+ def 'P1+a/(d*e+f)' Defines local variables d, e, f. Local variables a, b, c and d, e, f are available in this procedure. The defining procedure executes the program stored in variable P1. ac/» . » The six local variables are not available in program P1 because they didn't exist when you created P1. The objects stored in the local variables are available to program P1 only if you put those objects on the stack for P1 to use or store those objects in global variables. Conversely, program P1 can create its own local variable structure (with any names, such as a, c, and f, for example) without conflicting with the local variables of the same name in the procedure that calls P1. It is possible to create a special type of local variable that can be used in other programs or subroutines. This type of local variable is called a compiled local variable. . Compiled Local Variables Global variables use up memory, and local variables can't be used outside of the program they were created in. Compiled local variables bridge the gap between these two variable types. To programs, compiled local variables look like global variables, but to the calculator they act like local variables. This means you can create a compiled local variable in a local variable structure, use it in any other program that is called within that structure, and when the program finishes, the variable is gone. Compiled local variables have a special naming convention: they must begin with a Í. For example, « Íy 'IFTE(Íy<0,BELOW,ABOVE)' » The variable Íy is a compiled local variable that can be used in the two programs BELOW and ABOVE. Creating User-Defined Functions as Programs The defining procedure for a local variable structure can be either an algebraic or program object. A program that consists solely of a local variable structure whose defining procedure is an algebraic expression is a user-defined function. 1-10 RPL Programming If a program begins with a local variable structure and has a program as the defining procedure, the complete program acts like a user-defined function in two ways: it takes numeric or symbolic arguments, and takes those arguments either from the stack or in algebraic syntax. However, it does not have a derivative. (The defining program must, like algebraic defining procedures, return only one result to the stack.) There's an advantage to using a program as the defining procedure for a local variable structure: The program can contain commands not allowed in algebraic expressions. For example, loop structures are not allowed in algebraic expressions. Using Tests and Conditional Structures You can use commands and branching structures that let programs ask questions and make decisions. Comparison functions and logical functions test whether or not specified conditions exist. Conditional structures and conditional commands use test results to make decisions. Testing Conditions A test is an algebraic or a command sequence that returns a test result to the stack. A test result is either true -- indicated by a value of 1. -- or it is false -- indicated by a value of 0.. To include a test in a program: ! ! To use stack syntax, enter the two arguments, then enter the test command. To use algebraic syntax, enter the test expression (with ' delimiters). You often use test results in conditional structures to determine which clause of the structure to execute. Conditional structures are described under Using Conditional Structures and Commands, p.1-13. Example: Test whether or not X is less than Y. To use stack syntax, enter X Y <. To use algebraic syntax, enter 'X%% %#%»%% #%%¼%% ##SAME## == < > SAME Tests equality of two objects. Not equal. Less than. Greater than. Less than or equal to. Greater than or equal to. Identical. Like = =, but doesn't allow a comparison between the numerical value of an algebraic (or name) and a number. Also considers the wordsize of a binary integer. RPL Programming 1-11 The comparison commands return 1. (true) or 0. (false) based on the comparison -- or an expression that can evaluate to 1. or 0.. The order of the comparison is "level 2 test level 1," where test is the comparison function. All comparison commands except SAME return the following: ! If neither object is an algebraic or a name, returns 1. if the two objects are the same type and have the same value, or 0. otherwise. For example, if 6 is stored in X, X 5 < puts 6 and 5 on the stack, then removes them and returns 0.. (Lists and programs are considered to have same value if the objects they contain are identical. For strings, "less than" means "alphabetically previous.") If one object is an algebraic (or name) and the other object is an algebraic (or name) or a number, returns an expression that must be evaluated to get a test result based on numeric values. For example, if 6 is stored in X, 'X' 5 < returns 'X<5', then "NUM returns 0.. ! (Note that = = is used for comparisons, while = separates two sides of an equation.) SAME returns 1. (true) if two objects are identical. For example, 'X+3' 4 SAME returns 0. regardless of the value of X because the algebraic 'X+3' is not identical to the real number 4. Binary integers must have the same wordsize and the same value to be identical. For all object types other than algebraics, names, and binary integers, SAME works just like = =. You can use any comparison function (except SAME) in an algebraic by putting it between its two arguments. For example, if 6 is stored in X, 'X<5' NUM returns 0.. Using Logical Functions Logical functions return a test result based on the outcomes of one or two previously executed tests. Note that these four functions interpret any nonzero argument as a true result. Logical Functions Keys Programmable Command Description !°%TEST% L %AND% %OR% %XOR% AND OR XOR Returns 1. (true) only if both arguments are true (0. otherwise). Returns 1. (true) if either or both arguments are true (0. otherwise). Returns 1. (true) if either argument, but not both, is true (0. otherwise). Returns 1. (true) if the argument is 0 (false); otherwise, returns 0. (false). %NOT% NOT AND, OR, and XOR combine two test results. For example, if 4 is stored in Y, Y 8 < 5 AND returns 1.. First, Y 8 < returns 1. to the stack. AND removes 1. and 5 from the stack, interpreting both as true results, and returns 1. to the stack. NOT returns the logical inverse of a test result. For example, if 1 is stored in X and 2 is stored in Y, X Y < NOT returns 0. You can use AND, OR, and XOR in algebraics as infix functions. For example, '3<5 XOR 4>7' NUM returns 1. 1-12 RPL Programming You can use NOT as a prefix function in algebraics. For example, 'NOT Z4' NUM returns 0. if Z =2. Testing Object Types The TYPE command (!°%TEST% L %TYPE%) takes any object as its argument and returns the number that identifies that object type. For example, "HELLO" TYPE returns 2, the value for a string object. See the table of object types in chapter 3, in the TYPE command, to find hp49g+/hp48gII objects and their corresponding type numbers. Testing Linear Structure The LININ command (!°%TEST% !«%LININ%) takes an algebraic equation on level 2 and a variable on level 1 as arguments and returns 1. if the equation is linear for that variable, or 0. if it is not. For example, 'H+Y^2' 'H' LININ returns 1. because the equation is structurally linear for H. See the LININ command in chapter 3 for more information. Using Conditional Structures and Commands Conditional structures let a program make a decision based on the results of tests. Conditional commands let you execute a true-clause or a false-clause (each of which are a single command or object). These conditional structures and commands are contained in the PRG BRCH menu (!°%BRCH%): IF ... THEN ... END structure. IF ... THEN ... ELSE ... END structure. ! CASE ... END structure. ! IFT (if-then) command. ! IFTE (if-then-else) function. ! ! The IF ... THEN ... END Structure The syntax for this structure is « ... IF test-clause THEN true-clause END ... » IF ... THEN ... END executes the sequence of commands in the true-clause only if the test-clause evaluates to true. The test-clause can be a command sequence (for example, A B ) or an algebraic (for example,'AB'). If the test-clause is an algebraic, it's automatically evaluated to a number -- you don't need " NUM or EVAL. IF begins the test-clause, which leaves a test result on the stack. THEN removes the test result from the stack. If the value is nonzero, the true-clause is executed -- otherwise, program execution resumes following END. See "Conditional Examples" on page 1-15. To enter IF ... THEN ... END in a program: ! Press !°%BRCH% !%IF% . The IFT Command The IFT command takes two arguments: a test-result in level 2 and a true-clause object in level 1. If the testresult is true, the true-clause object is executed -- otherwise, the two arguments are removed from the stack. See "Conditional Examples" on page 1-15. To enter IFT in a program: ! Press !°%BRCH% L!%IFT% . RPL Programming 1-13 The IF ... THEN ... ELSE ... END Structure The syntax for this structure is « ... IF test-clause THEN true-clause ELSE false-clause END ... » IF ... THEN ... ELSE ... END executes either the true-clause sequence of commands if the true-clause is true, or the false-clause sequence of commands if the true-clause is false. If the test-clause is an algebraic, it's automatically evaluated to a number -- you don't need "NUM or EVAL. IF begins the test-clause, which leaves a test result on the stack. THEN removes the test result from the stack. If the value is nonzero, the true-clause is executed -- otherwise, the false-clause is executed. After the appropriate clause is executed, execution resumes following END. See "Conditional Examples" on page 1-15. ! To enter IF ... THEN ... ELSE ... END in a program: Press !°%BRCH% @%#IF#% . The IFTE Function The algebraic syntax for this function is 'IFTE( test, true-clause, false-clause)' If test evaluates true, the true-clause algebraic is evaluated -- otherwise, the false-clause algebraic is evaluated. You can also use the IFTE function with stack syntax. It takes three arguments: a test-result in level 3, a trueclause object in level 2, and a false-clause object in level 1. See "Conditional Examples" on page 1-15. To enter IFTE in a program or in an algebraic: ! Press !°%BRCH% L!%IFTE% . The CASE ... END Structure The syntax for this structure is « ... CASE test-clause1 THEN true-clause1 END test-clause2 THEN truet-clause2 END ... test-clausen THEN true-clausen END default-clause (optional) END ... » The CASE ... END structure lets you execute a series of test-clause commands, then execute the appropriate true-clause sequence of commands. The first test that returns a true result causes execution of the corresponding true-clause, ending the CASE ... END structure. Optionally, you can include after the last test a default-clause that's executed if all the tests evaluate to false. If a test-clause is an algebraic, it's automatically evaluated to a number -- you don't need "NUM or EVAL. When CASE is executed, test-clause1 is evaluated. If the test is true, true-clause1 is executed, and execution skips to END. If test-clause1 is false, execution proceeds to test-clause2. Execution within the CASE structure continues until a true-clause is executed, or until all the test-clauses evaluate to false. If a default clause is included, it's executed if all the test-clauses evaluate to false. See "Conditional Examples" below. 1-14 RPL Programming To enter CASE ... END in a program: 1. Press !°%BRCH% !%CASE% to enter CASE ... THEN ...END...END 2. For each additional test-clause, move the cursor after a test-clause END and press @%CASE% to enter THEN ... END. Conditional Examples These examples illustrate conditional structures in programs. Example: One Conditional Action. The programs below test the value in level 1 -- if the value is positive, it's made negative. The first program uses a command sequence as the test-clause: « DUP IF 0 > THEN NEG END » The value on the stack must be duplicated because the > command removes two arguments from the stack (0. and the copy of the value made by DUP). The following version uses an algebraic as the test clause: « x « x IF 'x>0' THEN NEG END » » The following version uses the IFT command: « DUP 0 > « NEG » IFT » Example: One Conditional Action. This program multiplies two numbers if both are nonzero. Program: « xy « IF 'xS0' 'yS0' AND THEN xy* END » » The following program accomplishes the same task as the previous program: « x y « IF 'x AND y' THEN x y * END » » The test-clause 'x AND y' returns "true" if both numbers are nonzero. The following version uses the IFT command: « x y « 'x AND y' 'x*y'IFT » » Example: Two Conditional Actions. This program takes a value x from the stack and calculates (sin x) /x. At x= 0 the division would error, so the program returns the limit value 1 in this case. « x « IF 'x<0' THEN x SIN x / ELSE 1 END » » The following version uses IFTE algebraic syntax: Creates local variables x and y containing the two numbers from the stack. Starts the test-clause. Tests one of the numbers and leaves a test result on the stack. Tests the other number, leaving another test result on the stack. Tests whether both tests were true. Ends the test-clause, starts the trueclause. Multiplies the two numbers together only if AND returns true. Ends the true-clause. Comments: RPL Programming 1-15 « x 'IFTE(x<0,SIN(x)/x,1)' » Example: Two Conditional Actions. This program multiplies two numbers together if they're both nonzero -- otherwise, it returns the string "ZERO". Program: « n1 n2 « IF 'n1<0 AND n2<0' THEN n1 n2 * ELSE "ZERO" END » » Creates the local variables. Starts the defining procedure. Starts the test clause. Tests n1 and n2. If both numbers are nonzero, multiplies the two values. Otherwise, returns the string ZERO. Ends the conditional. Ends the defining procedure. Comments: Example: Two Conditional Actions. This program tests if two numbers on the stack have the same value. If so, it drops one of the numbers and stores the other in variable V1 -- otherwise, it stores the number from level 1 in V1 and the number from level 2 in V2. Program: « IF DUP2 SAME THEN DROP 'V1' STO ELSE 'V1' STO 'V2' STO END » ` OTST K Puts the program on the stack. Stores it in TST. For the test clause, copies the numbers in levels 1 and 2 and tests if they have the same value. For the true clause, drops one of the numbers and stores the other in V1. For the false clause, stores the level 1 number in V1 and the level 2 number in V2. Ends the conditional structure. Comments: Enter the numbers 26 and 52, then execute TST to compare their values. Because the two numbers aren't equal, the VAR menu now contains two new variables V1 and V2. 26 `52 J %TST% Example: Multiple Conditional Actions. The following program stores the level 1 argument in a variable if the argument is a string, list, or program. 1-16 RPL Programming Program: « y « CASE y TYPE THEN y END y TYPE THEN y END y TYPE THEN y END END » » 2 SAME 'STR' STO 5 SAME 'LIST' STO 8 SAME 'PROG' STO Comments: Defines local variable y. Starts the defining procedure. Starts the case structure. Case 1: If the argument is a string, stores it in STR. Case 2: If the argument is a list, stores it in LIST. Case 3: If the argument is a program, stores it in PROG. Ends the case structure. Ends the defining procedure. Using Loop Structures You can use loop structures to execute a part of a program repeatedly. To specify in advance how many times to repeat the loop, use a definite loop. To use a test to determine whether or not to repeat the loop, use an indefinite loop. Loop structures let a program execute a sequence of commands several times. Loop structures are built with commands -- called structure words -- that work only when used in proper combination with each other. These loop structure commands are contained in the PRG BRCH menu (!° %BRCH%): START... NEXT and START... STEP. ! FOR ... NEXT and FOR...STEP ! DO ... UNTIL ...END. ! WHILE... REPEAT... END. ! In addition, the function provides an alternative to definite loop structures for summations. Using Definite Loop Structures Each of the two definite loop structures has two variations: ! ! NEXT. The counter increases by 1 for each loop. STEP. The counter increases or decreases by a specified amount for each loop. The START ... NEXT Structure The syntax for this structure is « ... start finish START loop-clause NEXT... » START ... NEXT executes the loop-clause sequence of commands one time for each number in the range start to finish. The loop-clause is always executed at least once. RPL Programming 1-17 Syntax Start finish START Flowchart 1:Start 2:finish counter=start Store finish Body of loop counter = counter + 1 loop-clause NEXT Is counter finish? yes no START ... NEXT Structure START takes two numbers (start and finish) from the stack and stores them as the starting and ending values for a loop counter. Then, the loop-clause is executed. NEXT increments the counter by 1 and tests to see if its value is less than or equal to finish. If so, the loop-clause is executed again -- otherwise, execution resumes following NEXT. To enter START ... NEXT in a program: ! Press !°%BRCH% !%START%. Example: The following program creates a list containing 10 copies of the string "ABC": « 1 10 START "ABC" NEXT 10 LIST » The START ... STEP Structure The syntax for this structure is « ... start finish START loop-clause increment STEP ... » START ... STEP executes the loop-clause sequence just like START ... NEXT does -- except that the program specifies the increment value for the counter, rather than incrementing by 1. The loop-clause is always executed at least once. 1-18 RPL Programming Syntax Start finish START Flowchart 1:Start 2:finish counter=start Store finish Body of loop 1:increment counter = counter + increment loop-clause increment STEP Is counter finish? yes no START ... STEP Structure START takes two numbers (start and finish) from the stack and stores them as the starting and ending values of the loop counter. Then the loop-clause is executed. STEP takes the increment value from the stack and increments the counter by that value. If the argument of STEP is an algebraic or a name, it's automatically evaluated to a number. The increment value can be positive or negative. If it's positive, the loop is executed again if the counter is less than or equal to finish. If the increment value is negative, the loop is executed if the counter is greater than or equal to finish. Otherwise, execution resumes following STEP. In the previous flowchart, the increment value is positive. To enter START ... STEP in a program: ! Press !° %BRCH% ... %START%. Example: The following program takes a number x from the stack and calculates the square of that number several times (x/3 times): « DUP x « x 1 START x SQ -3 STEP » » The FOR ... NEXT Structure The syntax for this structure is « ... start finish FOR counter loop-clause increment NEXT ... » FOR ... NEXT executes the loop-clause program segment one time for each number in the range start to finish, using local variable counter as the loop counter. You can use this variable in the loop-clause. The loop-clause is always executed at least once. RPL Programming 1-19 Syntax Start finish FOR Flowchart 1:Start 2:finish counter=start Store finish Body of loop counter = counter + 1 loop-clause NEXT Is counter finish? yes no FOR ... NEXT Structure FOR takes start and finish from the stack as the beginning and ending values for the loop counter, then creates the local variable counter as a loop counter. Then the loop-clause is executed -- counter can appear within the loop-clause. NEXT increments counter by one, and then tests whether its value is less than or equal to finish. If so, the loop-clause is repeated (with the new value of counter) -- otherwise, execution resumes following NEXT. When the loop is exited, counter is purged. To enter FOR ... NEXT in a program: ! Press !°%BRCH% ! %FOR%. Example: The following program places the squares of the integers 1 through 5 on the stack: « 1 5 FOR j j SQ NEXT » Example: The following program takes the value x from the stack and computes the integer powers i of x. For example, when x =12 and start and finish are 3 and 5 respectively, the program returns 123, 124 and 125. It requires as inputs start and finish in level 3 and 2, and x in level 1. ( x removes x from the stack, leaving start and finish there as arguments for FOR.) « x « FOR n 'x^n' EVAL NEXT » » The FOR ... STEP Structure The syntax for this structure is « ... start finish FOR counter loop-clause increment STEP ... » FOR ... STEP executes the loop-clause sequence just like FOR ... NEXT does -- except that the program specifies the increment value for counter, rather than incrementing by 1. The loop-clause is always executed at least once. 1-20 RPL Programming Syntax Start finish FOR Flowchart 1:Start 2:finish counter=start Store finish Body of loop 1:increment counter = counter + increment loop-clause increment STEP Is counter finish? yes no FOR ... STEP Structure FOR takes start and finish from the stack as the beginning and ending values for the loop counter, then creates the local variable counter as a loop counter. Next, the loop-clause is executed -- counter can appear within the loop-clause. STEP takes the increment value from the stack and increments counter by that value. If the argument of STEP is an algebraic or a name, it's automatically evaluated to a number. The increment value can be positive or negative. If the increment is positive, the loop is executed again if counter is less than or equal to finish. If the increment is negative, the loop is executed if counter is greater than or equal to finish. Otherwise, counter is purged and execution resumes following STEP. In the previous flowchart, the increment value is positive. To enter FOR ... STEP in a program: ! Press !° %BRCH% ... %FOR%. Example: The following program places the squares of the integers 1, 3, 5, 7, and 9 on the stack: « 1 9 FOR x x SQ 2 STEP » Example: The following program takes n from the stack, and returns the series of numbers 1, 2, 4, 8, 16, ..., n. If n isn't in the series, the program stops at the last value less than n. « 1 SWAP FOR n n n STEP » The first n is the local variable declaration for the FOR loop. The second n is put on the stack each iteration of the loop. The third n is used by STEP as the step increment. Using Indefinite Loop Structures The DO ... UNTIL ... END Structure The syntax for this structure is RPL Programming 1-21 « ... DO loop-clause UNTIL test-clause END ... » DO... UNTIL... END executes the loop-clause sequence repeatedly until test-clause returns a true (nonzero) result. Because the test-clause is executed after the loop-clause, the loop-clause is always executed at least once. Syntax Flowchart DO loop-clause Body of loop UNTIL test-clause TEST 1: test result END Is test result non-zero? no yes DO ... UNTIL ... END Structure DO starts execution of the loop-clause. UNTIL marks the end of the loop-clause. The test-clause leaves a test result on the stack. END removes the test result from the stack. If its value is zero, the loop-clause is executed again -- otherwise, execution resumes following END. If the argument of END is an algebraic or a name, it's automatically evaluated to a number. To enter DO ... UNTIL ... END in a program: ! Press !°%BRCH% ! %DO%. Example: The following program calculates n + 2n +3n + ... for a value of n. The program stops when the sum exceeds 1000, and returns the sum and the coefficient of n. Program: « DUP 1 nsc Duplicates n, stores the value into n and s, and initializes c to 1. Comments: 1-22 RPL Programming Program: « DO 'c' INCR n * 's' STO+ UNTIL s 1000 > END sc » » The WHILE ... REPEAT ... END Structure The syntax for this structure is Comments: Starts the defining procedure. Starts the loop-clause. Increments the counter by 1. (See Using Loop Counters.) Calculates c × n and adds the product to s. Starts the test-clause. Repeats loop until s > 1000. Ends the test-clause. Puts s and c on the stack. Ends the defining procedure. « ... WHILE test-clause REPEAT loop-clause END ... » WHILE ... REPEAT ... END repeatedly evaluates test-clause and executes the loop-clause sequence if the test is true. Because the test-clause is executed before the loop-clause, the loop-clause is not executed if the test is initially false. Syntax Flowchart WHILE TEST test-clause 1: test result REPEAT Is test result non-zero? no yes loop-clause END Body of loop WHILE ... REPEAT ... END Structure WHILE starts execution of the test-clause, which returns a test result to the stack. REPEAT takes the value from the stack. If the value is nonzero, execution continues with the loop-clause-otherwise, execution resumes following END. If the argument of REPEAT is an algebraic or a name, it's automatically evaluated to a number. RPL Programming 1-23 To enter WHILE ... REPEAT ... END in a program: ! Press !°%BRCH% ! %WHILE%. Example: The following program starts with a number on the stack, and repeatedly performs a division by 2 as long as the result is evenly divisible. For example, starting with the number 24, the program computes 12, then 6, then 3. « WHILE DUP 2 MOD 0 == REPEAT 2 / DUP END DROP » Example: The following program takes any number of vectors or arrays from the stack and adds them to the statistics matrix. (The vectors and arrays must have the same number of columns.) WHILE ... REPEAT ... END is used instead of DO ... UNTIL ... END because the test must be done before the addition. (If only vectors or arrays with the same number of columns are on the stack, the program errors after the last vector or array is added to the statistics matrix.) « WHILE DUP TYPE 3 == REPEAT ...+ END » Using Loop Counters For certain problems you may need a counter inside a loop structure to keep track of the number of loops. (This counter isn't related to the counter variable in a FOR ... NEXT/STEP structure.) You can use any global or local variable as a counter. You can use the INCR or DECR command to increment or decrement the counter value and put its new value on the stack. The syntax for INCR and DECR is « ... 'variable' INCR ... » or « ... 'variable' DECR ... » To enter INCR or DECR in a program: ! Press !° #MEM# %ARITH% %INCR% or %DECR%. The INCR and DECR commands take a global or local variable name (with ' delimiters) as their argument -- the variable must contain a real number. The command does the following: 1. Changes the value stored in the variable by +1 or -1. 2. Returns the new value to the stack. Examples: If c contains the value 5, then 'c' INCR stores 6 in c and returns 6 to the stack. The following program takes a maximum of five vectors from the stack and adds them to the current statistics matrix. Program: « 0c « WHILE DUP TYPE 3 == 'c' INCR 5 AND REPEAT ...+ END » » Comments: Stores 0 in local variable c. Starts the defining procedure. Starts the test clause. Returns true if level 1 contains a vector. Increments and returns the value in c. Returns true if the counter c5. Returns true if the two previous test results are true. Adds the vector to DAT. Ends the structure. Ends the defining procedure. 1-24 RPL Programming

If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Diplodocs provides you a fast and easy access to the user manual HP 48GII GRAPHING CALCULATOR.

HP offer a product for which we do not have the user manual? Let us know what you are looking for: site Internet, histoire, actualité, filiales, site Internet, mode d'emploi, driver, avis des utilisateurs, meilleur prix des produits, forum d'assistance aux problèmes, annuaire des marques, annuaire des constructeurs, répertoire des marques, répertoire des constructeurs, site Internet de la marque, site Internet du constructeur

Diplodocs allows you to download user manual HP 48GII GRAPHING CALCULATOR, user guide HP 48GII GRAPHING CALCULATOR, instructions HP 48GII GRAPHING CALCULATOR, owner's manual HP 48GII GRAPHING CALCULATOR, online manual HP 48GII GRAPHING CALCULATOR.


Access web reviews HP 48GII GRAPHING CALCULATOR, COMPAC, COMPAG, HELWET PACKARD, HELWETT, HELWETT PACKARD, HEWLET PACKARD, HEWLETT-PACKARD, Printer & Plotter.
Include the add-on to download manuals from your site, forum or blog Frequently Asked Questions Contact Diplodocs team Last searches
Last additions
Sitemap
Brands starting with A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Copyright © 2005 - 2008 - Diplodocs - All Rights Reserved.
Designated trademarks and brands are the property of their respective owners.