Computer Algebra and Mathematics with the HP40G Version 1.0
Total Page:16
File Type:pdf, Size:1020Kb
Computer Algebra and Mathematics with the HP40G Version 1.0 Renée de Graeve Lecturer at Grenoble I Exact Calculation and Mathematics with the HP40G Acknowledgments It was not believed possible to write an efficient program for computer algebra all on one’s own. But one bright person by the name of Bernard Parisse didn’t know that—and did it! This is his program for computer algebra (called ERABLE), built for the second time into an HP calculator. The development of this calculator has led Bernard Parisse to modify his program somewhat so that the computer algebra functions could be edited and cause the appropriate results to be displayed in the Equation Editor. Explore all the capabilities of this calculator, as set out in the following pages. I would like to thank: • Bernard Parisse for his invaluable counsel, his remarks on the text, his reviews, and for his ability to provide functions on demand both efficiently and graciously. • Jean Tavenas for the concern shown towards the completion of this guide. • Jean Yves Avenard for taking on board our requests, and for writing the PROMPT command in the very spirit of promptness—and with no advance warning. (refer to 6.4.2.). © 2000 Hewlett-Packard, http://www.hp.com/calculators The reproduction, distribution and/or the modification of this document is authorised according to the terms of the GNU Free Documentation License, Version 1.1 or later, published by the Free Software Foundation. A copy of this license exists under the section entitled “GNU Free Documentation License” (Chapter 8, p. 141). 2 Acknowledgments Table of Contents 3 Exact Calculation and Mathematics with the HP40G Preface The HP40G marks a new stage in the democratisation of the use of symbolic calculation—on the one hand by its very competitive price, and on the other hand by making it possible to execute, step-by-step, the principle algorithms taught in mathematics at secondary schools and in the first years of university. But it was still necessary to add adequate documentation, preferably written by a teacher of mathematics. That is what you find in this guide, written by Renée De Graeve, Lecturer at the University of Grenoble I and founder of the Grenoble IREM. It contains, naturally, a complete reference of the functions for symbolic calculation, but also demonstrates, using examples taken from study for both certificate and diploma, how to take smart advantage of the calculating power of the HP40G. The guide ends with two chapters dedicated to programming: the first for learning to program, and the second to illustrate the application of algorithmic language to arithmetic programs as taught in French tertiary schools. Bernard Parisse Lecturer at the University of Grenoble I Terms and Conditions Use of the CAS program implies an appropriate knowledge of mathematics. Within the limits prescribed by legislation, this program is not subject to any guarantee. Unless expressly arranged to the contrary, the holder of the copyright provides the program “as is”. The program is not subject to any guarantee, express or implicit, including (but not limited to) any tacit or material guarantee of quality of merchandise or suitability for a particular purpose. Hewlett-Packard guarantees neither the quality nor the performance of the CAS program. Should this program prove to contain faults, the user takes upon himself any costs relating to technical support, fixes or changes. Unless expressly arranged, the holder of the copyright is not responsible to the user for any damages arising from the use or the inability to use the CAS manual (including, but not limited to, loss or incorrectness of data, eventual losses by the user or a third party, or incompatibility of the program with other programs), as the user and any third parties are advised to be aware of any associated risks. Should a lawsuit prevail, the maximum amount that the holder can be fined may not exceed the fine paid by Hewlett-Packard. 4 Table of Contents Exact Calculation and Mathematics with the HP40G Table of Contents 0 To Begin 13 0.1 General Information 13 0.1.1 Starting the Calculator 13 0.1.2 What You See 13 0.2 Notation 15 0.2.1 Line-Based Help 15 1 Aplets 17 1.1 APLET Key 17 1.2 The Various aplets 17 1.3 Examples using the Sequence aplet 18 1.4 The SYMB NUM PLOT Keys 21 2 The Keyboard and CAS 23 2.1 What is CAS? 23 2.2 The current variable 23 2.3 How do you perform a symbolic calculation? 23 2.4 CAS in the Equation Editor 24 2.5 The keyboard in the Equation Editor 25 2.5.1 MATH key 25 2.5.2 SHIFT MATH (CMDS) keys 26 2.5.3 VARS key 26 2.5.4 SHIFT 2 (SYNTAX) keys 26 2.5.5 HOME key 27 2.5.6 SHIFT SYMB keys 27 2.5.7 SHIFT key 28 2.5.8 PLOT key 28 2.5.9 NUM key 29 2.5.10 VIEWS key 29 2.5.11 Short-cut keys 29 2.6 CAS in the HOME screen 30 2.6.1 PUSH 30 2.6.2 POP 31 2.7 The keyboard in the HOME screen 31 2.7.1 MATH key 31 2.7.2 SHIFT F6 keys 31 Table of Contents 5 Exact Calculation and Mathematics with the HP40G 2.7.3 SHIFT 2 (SYNTAX) keys 31 2.7.4 SHIFT 1 (PROGRAM) keys 32 3 Writing expressions in the Equation Editor 35 3.1 Equation Editor 35 3.1.1 Access to the Equation Editor 35 3.1.2 How do you select? 35 3.1.3 How to modify an expression 40 3.1.4 The cursor mode 41 3.1.5 To see everything 41 3.2 Accessing the CAS functions 41 3.2.1 How to type ∫ and Σ 41 3.2.2 How to call infix functions 43 3.2.3 How to call prefix functions 43 3.3 Variables 46 3.3.1 STO1 46 3.3.2 STORE 47 3.3.3 Predefined CAS variables 48 4 Computer Algebra Functions 49 4.1 CAS Toolbar 49 4.1.1 CFG 49 4.1.2 TOOL 50 4.1.3 ALGB 50 4.1.4 DIFF&INT 51 4.1.5 REWRITE 51 4.1.6 SOLVE 51 4.1.7 TRIG 52 4.1.8 The MATH Key 52 4.2 Step by Step Mode 53 4.3 General Use 53 4.3.1 DEF 53 4.4 INTEGERS (and Gaussian Integers) 54 4.4.1 DIVIS 55 4.4.2 EULER 55 4.4.3 FACTOR 55 4.4.4 GCD 56 4.4.5 IEGCD 56 4.4.6 IQUOT 57 4.4.7 IREMAINDER MOD 57 6 Table of Contents Exact Calculation and Mathematics with the HP40G 4.4.8 ISPRIME? 58 4.4.9 LCM 58 4.4.10 NEXTPRIME 59 4.4.11 PREVPRIME 59 4.5 Modular Calculations 59 4.5.1 ADDTMOD 59 4.5.2 DIVMOD 60 4.5.3 EXPANDMOD 60 4.5.4 FACTORMOD 60 4.5.5 GCDMOD 61 4.5.6 INVMOD 61 4.5.7 MODSTO 61 4.5.8 MULTMOD 61 4.5.9 POWMOD 62 4.5.10 SUBTMOD 62 4.6 Rational Numbers 62 4.6.1 PROPFRAC 63 4.7 Real Numbers 63 4.7.1 FLOOR 64 4.7.2 MOD 64 4.8 Complex Numbers 64 4.8.1 ARG 65 4.8.2 CONJ 66 4.8.3 DROITE 67 4.9 Algebraic Expressions 67 4.9.1 COLLECT 67 4.9.2 EXPAND 68 4.9.3 FACTOR 68 4.9.4 | 69 4.9.5 SUBST 69 4.10 Polynomials 69 4.10.1 DEGREE 70 4.10.2 EGCD 70 4.10.3 FACTOR 70 4.10.4 GCD 71 4.10.5 HERMITE 71 4.10.6 LCM 72 4.10.7 LEGENDRE 72 4.10.8 PARTFRAC 73 4.10.9 PROPFRAC 73 4.10.10 PTAYL 74 4.10.11 QUOT 74 Table of Contents 7 Exact Calculation and Mathematics with the HP40G 4.10.12 REMAINDER 75 4.10.13 TCHEBYCHEFF 75 4.11 Functions 76 4.11.1 DEF 76 4.11.2 IFTE 77 4.11.3 DERVX 77 4.11.4 DERIV 78 4.11.5 TABVAR 79 4.11.6 FOURIER 79 4.11.7 IBP 80 4.11.8 INTVX 81 4.11.9 LIMIT 83 4.11.10 LIMIT and ∫ 84 4.11.11 PREVAL 85 4.11.12 RISCH 85 4.12 Limited and Asymptotic Expansions 85 4.12.1 DIVPC 85 4.12.2 LIMIT 86 4.12.3 SERIES 86 4.12.4 TAYLOR0 89 4.12.5 TRUNC 90 4.13 Conversion Functions 90 4.13.1 DISTRIB 90 4.13.2 EPSX0 91 4.13.3 EXP2POW 91 4.13.4 EXPLN 92 4.13.5 FDISTRIB 92 4.13.6 LIN 92 4.13.7 LNCOLLECT 93 4.13.8 POWEXPAND 93 4.13.9 SIMPLIFY 94 4.13.10 XNUM 94 4.13.11 XQ 95 4.14 Equations 95 4.14.1 ISOLATE 95 4.14.2 SOLVEVX 96 4.14.3 SOLVE 96 4.15 Linear Systems 97 4.15.1 LINSOLVE 97 4.16 Differential Equations 98 4.16.1 DESOLVE and SUBST 99 8 Table of Contents Exact Calculation and Mathematics with the HP40G 4.16.2 LDEC 100 4.17 Trigonometric Expressions 100 4.17.1 ACOS2S 100 4.17.2 ASIN2C 100 4.17.3 ASIN2T 101 4.17.4 ATAN2S 101 4.17.5 HALFTAN 102 4.17.6 SINCOS 102 4.17.7 TAN2CS2 103 4.17.8 TAN2SC 103 4.17.9 TAN2SC2 103 4.17.10 TCOLLECT 104 4.17.11 TEXPAND 104 4.17.12 TLIN 105 4.17.13 TRIG 105 4.17.14 TRIGCOS 106 4.17.15 TRIGSIN 106 4.17.16 TRIGTAN 107 5 Worked Exercises with the HP40 109 5.1 Introduction 109 5.2 Exercises on Brevet 110 5.2.1 Exercise 1 110 5.2.2 Exercise 2 110 5.2.3 Exercise 3 112 5.2.4 Exercise 4 113 5.2.5 Exercise 5 114 5.3 Exercises on Bac 116 5.3.1 Exercise 1 116 5.3.2 Exercise 2 (specialty) 122 5.3.3 Exercise 3 (non-specialty) 126 5.4 Conclusion 132 6 Programming 133 6.1 Implementation 133 6.1.1 How to edit and save a program 133 6.1.2 How to correct a program 133 6.1.3 How to run a program 133 6.1.4 How to modify a program 133 6.2 Comments 134 Table of Contents 9 Exact Calculation and Mathematics with the HP40G 6.3 Variables 134 6.3.1 Their names 134 6.3.2 The concept of local variables 135 6.3.3 The concept of parameters 135 6.4 User entry 135 6.4.1 Algorithmic syntax 135 6.4.2 HP40G syntax 135 6.5 Output 135 6.5.1 Algorithmic syntax 135 6.5.2 HP40G syntax 136 6.6 The sequence of statements, or “action” 136 6.6.1 Algorithmic syntax 136 6.6.2 HP40G syntax 136 6.7 The assignment statement 136 6.7.1 Algorithmic syntax 136 6.7.2 HP40G syntax 136 6.8 Conditional statements 137 6.8.1 Algorithmic syntax 137 6.8.2 HP40G syntax 137 6.9 FOR statement 138 6.9.1 Algorithmic syntax 138 6.9.2 HP40G syntax 138 6.10 WHILE statement 138 6.10.1 Algorithmic syntax 138 6.10.2 HP40G syntax 138 6.11 Boolean Expressions 138 6.11.1 Algorithmic syntax 138 6.11.2 HP40G syntax 138 6.12 Logical Operators 139 6.12.1 Algorithmic syntax 139 6.12.2 HP40G syntax 139 6.13 Lists 139 6.13.1 Algorithmic syntax 139 6.13.2 HP40G syntax 139 6.14 Example: Eratosthenes’ Sieve 140 6.14.1 Description 140 6.14.2 Algorithmic syntax 140 6.14.3 HP40G syntax 141 10 Table of Contents Exact Calculation and