CAS, an Introduction to the HP Computer Algebra System
Total Page:16
File Type:pdf, Size:1020Kb
CAS, An introduction to the HP Computer Algebra System Background Any mathematician will quickly appreciate the advantages offered by a CAS, or Computer Algebra System1, which allows the user to perform complex symbolic algebraic manipulations on the calculator. Algebraic integration by parts and by substitution, the solution of differential equations, inequalities, simultaneous equations with algebraic or complex coefficients, the evaluation of limits and many other problems can be solved quickly and easily using a CAS. Importantly, solutions can be obtained as exact values such as 5−1, 25≤ x < or 4π rather than the usual decimal values given by numeric methods of successive approximation. Values can be displayed to almost any degree of accuracy required, allowing the user to view, for example, the exact value of a number such as 100 factorial. The HP CAS The HP CAS system was created by Bernard Parisse, Université de Grenoble, for the HP 49g calculator. It was improved and adapted for inclusion on the HP 40g with the help of Renée De Graeve, Jean-Yves Avenard and Jean Tavenas2. The HP CAS system offers the user a vast array of functions and abilities as well as an easy user interface which displays equations as they appear on the page. It also includes the ability to display many algebraic calculations in ‘step-by-step’ mode, making it an invaluable teaching tool in universities and schools. Functions are grouped by category and accessed via menus at the bottom of the screen. Copyright© 2005, Applications in Mathematics Learning to use the CAS Learning to use the CAS is very easy but, as with any powerful tool, truly effective use requires familiarity and time. On the HP the learning process is greatly aided by an incredibly detailed help system which offers a detailed explanation, in both French and English, of the syntax of each function. These syntax pages include cross references to related functions and examples which can be pasted into the CAS with the press of a single button. Simply press , [SYNTAX] from within the CAS to access the help. Some introductory examples The examples which follow are designed to illustrate the functioning of the CAS on the HP 40G. Other models operate in a very similar fashion, with minor differences relating to how the CAS is launched and how its history3 is accessed. In this text buttons which appear on the keyboard are represented as far as possible using images of the button: or . When the function is ‘shifted’, appearing above or below a key, then it is written as, for example, [CLEAR] or , [T]. Screen menu buttons such as the ones on the right are shown as {TOOL} or {CAS}. A choice from a menu is shown in italics as ISOLATE or LINSOLVE. On the HP 40G, enter the Computer Algebra System by pressing {CAS} in the HOME view. You should see the screen right. To exit again, press [ON]. In the examples which follow it will be assumed that the CAS is in its default settings. To ensure this, enter the CAS, press the {ALGB} screen button and, from the menu, choose the first entry of CFG. Press and scroll down to the end of the resulting menu. Choose Default cfg and press . Then choose Quit config and again press . Copyright© 2005, Applications in Mathematics Example 1: Algebraic entry and manipulation The task we will be performing in this example will be to expand and then factorise the expression ()xx−+45( ) −( x−40) over the set of complex numbers. • Press , , then press , , to highlight this expression. Enclose it in brackets by pressing then add another factor to the expression by pressing , , , , . Highlight the entire binomial expression by pressing , , , then append another expression to this by pressing , , , , , . At this point the screen should appear as shown right. • Assume that we want to show working by evaluating the binomial expression separately. Press , , , , to highlight the right hand bracket and the subtract, then press to transfer the highlight to the left hand expression. The screen should appear as shown right. Press to evaluate this portion of the expression by expanding the brackets without affecting the rest of the expression. • Now simplify the entire expression. Press , . The result is shown right. Copyright© 2005, Applications in Mathematics • We now wish to factorise this expression. It is already highlighted so choosing the FACTOR command will apply it to the entire expression as we require. Press the {ALGB} screen key, choose FACTOR from the menu that appears and press . The screen should now appear as shown to the right. • Press again to evaluate the highlighted expression. The result will simply be a return of the expression x2 + 20 . The reason for this is that the default setting of the CAS is to only factorise over the set of real numbers. This needs to be altered using the CAS configuration menu. • To change the CAS configuration, press the {ALGB} screen key and, from the resulting menu, choose “CFG R= X S” and press . In the resulting menu choose Complex and press . Now choose the Quit config entry and press to return to the CAS editing screen. • To re-use the previous command press and highlight the FACTOR(X^2+20) line as shown right. Press {ECHO} to copy it to the screen, replacing the highlighted region. Pressing this time will result in the screen shown below right which displays the two complex roots. • Press , , [CLEAR] to clear the CAS editing screen. Copyright© 2005, Applications in Mathematics Example 2: Linear systems of equations In this task we will use the default setting of “step-by-step” mode to show working as we solve the 3 by 3 system of linear equations with algebraic coefficients shown right. If desired, this default setting can later be changed to Direct if that is more convenient. • Enter the CAS by pressing {CAS} in the HOME view as usual. From the {SOLV} menu, choose the LINSOLVE function and press . The resulting function will contain dots as place holders to be replaced by the expressions involved. • Begin by entering the expression 3x + y+ 2z with the following key sequence. , , , , [Y], , , , [Z]. Now press , , to highlight this expression. Press , [=], . The screen should now appear as shown. • Press , to highlight the entire equation. Then press , [AND]. Note: [AND] can be found on the button. You should now see the screen on the right. • Enter the second equation using the key sequence below. As before, you must highlight the expression to the left of the equality before pressing , [=]. , , , , [Y], , , [Z], , , , [=], . • Press , , to highlight the two equations entered so far and then press , [AND] to continue entering equations. Copyright© 2005, Applications in Mathematics • Enter the last equation using the sequence of keys below. Note that you must press between the [P] and the [Z] or the CAS will interpret it as a variable called “pz”. , , , , , [Y], , , [P], , , [Z], , , , , [=], , [Q] The screen should now appear as shown right. • We now need to tell the LINSOLVE function what variables are ‘active’ by entering them as the second parameter. Press , , to highlight the entire set of three equations then press to move onto the placeholder for the second parameter. • Enter the three active variables using the key sequence below. , , [AND], , [Y], , [AND], , [Z] When this is done, press , , , to highlight the entire function as shown right. Finally, press to begin the process of solving the problem. Copyright© 2005, Applications in Mathematics • The series of screen captures below show the working displayed by the CAS as it solves the problem. Press {OK} after each screen is displayed. The final two screens extend beyond the right hand border. Press repeatedly to view the remainder. • The final result is displayed right. Press to display the solution in a form that will scroll left and right. As can be seen below, the system is inconsistent for P=2. Copyright© 2005, Applications in Mathematics Further information More information on the CAS can be found in your manual. In addition to this a detailed manual in both French and English by Renée de Graeve, a colleague of Bernard Parisse, can be found on the web4. 1 CAS systems for personal computers began to appear in the 1970s as an outgrowth of research into artificial intelligence. Current market leading products are Mathematica® and Maple®. 2 The HP CAS ancestors were two programs for the HP48: Erable and ALG48, by Mika Heiskanen and Claude-Nicolas Fiechter, both available at www.hpcalc.org. The part deriving from Erable is also available as a free software for the HP49G at www-fourier.ujf-grenoble.fr/~parisse/english.html#hpcas. 3 The HP CAS records all calculations performed in a ‘history’ view. These can be accessed and re- used by pasting to the editing screen. Methods of accessing this history may vary between models. 4 Documentation by Renée De Graeve, in both French and English, explaining the use of the HP CAS in considerably more detail than appears in the calculator manual can be found at www-fourier.ujf-grenoble.fr/~parisse/english.html#hpcas. Copyright© 2005, Applications in Mathematics .