You are on page 1of 8

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 , 2 x < 5 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 Rene 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
[CLEAR] or
, [T].
or below a key, then it is written as, for example,
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
. Then choose Quit
end of the resulting menu. Choose Default cfg and press
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 ( x 4 )( x + 5) ( x 40 ) over the set of complex numbers.

Press

then press

Enclose it in brackets by pressing


expression by pressing
,

to highlight this expression.

then add another factor to the

Highlight the entire binomial expression by pressing


append another expression to this by pressing
,

then

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 x 2 + 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
screen.

to return to the CAS editing

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 3 x + y + 2 z with the following key sequence.


,

Now press
Press

, [Y],
,

, [=],

, [Z].

to highlight this expression.


.

The screen should now appear as shown.

Press ,
Then press

to highlight the entire equation.


, [AND].

button.
Note: [AND] can be found on the
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
, [=].
,

Press ,
then press

, [Y],

, [Z],

, [=],

to highlight the two equations entered so far and


, [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.
,
,
, [Z], ,

,
,

,
,

, [Y],
, [=],

,
, [P],
, [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],

When this is done, press , ,


entire function as shown right.
Finally, press

, [Z]
to highlight the

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
repeatedly to
two screens extend beyond the right hand border. Press
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 Rene de Graeve, a colleague of
Bernard Parisse, can be found on the web4.
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 reused by pasting to the editing screen. Methods of accessing this history may vary between
models.
4
Documentation by Rene 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.
1

Copyright 2005, Applications in Mathematics

You might also like