In this course you will learn to use the computer mathematics program DERIVE. This program, along with others such as Maple and Mathematica, are very powerful tools for doing calculus. They are capable of doing exact computations with arbitrary precision. This means that you can work with numbers of any size or number of decimal places (most spreadsheets only use 10-20 significant digits). These programs can simplify mathematical expressions by canceling common factors and doing other algebraic operations. They can do symbolic calculus such as differentiation and integration, solve equations and factor polynomials. When possible these programs solve these problems exactly and when exact solutions do not exist, such as factoring high degree polynomials or integration of some non-polynomial expressions, then numerical methods are applied to obtain approximate results.
Probably the most important numerical technique is to graph and compare functions. This will be a key feature of the labs. Typically we will explore a topic by first graphing the functions involved and then trying to do symbolic calculus on them using the insight gained from the picture. If the problem is too difficult algebraically we then try numerical techniques to gain further insight into the problem. It is this combination of graphics, algebra and numerical approximation that we want to emphasize in these labs.
Calculus is a hard subject to learn because it involves many ideas such as slopes of curves, areas under graphs, finding maximums and minimums, analyzing dynamic behavior and so on. On the other hand, many computations involve algebraic manipulations, simplifying powers, dealing with basic trig expressions, solving equations and other techniques. Our goal is to help you understand calculus better by concentrating on the ideas and applications in the labs and let the computer do the algebra, simplifying and graphing.
Another important goal of the lab is to teach you a tool which can used from now on to help you understand advanced work, both in mathematics and in subjects which use mathematics. There are many features such as matrices and vector calculus which we will not discuss but can be learned later as you continue with your studies in mathematics, physics, engineering, economics or whatever. Any time you have a problem to analyze you can use the computer to more thoroughly explore the fundamental concepts of the problem, by looking at graphs and freeing you from tedious calculations.
This chapter contains a brief introduction on how to use DERIVE. We suggest you sit down at the computer and experiment as you look over the material. DERIVE is very easy to learn thanks to its system of menus. The few special things you need to remember are discussed below and can also be found using the help feature in DERIVE.
At any IBM-PC computer in the lab
start DERIVE by just typing derive. There will be several menu
items at the bottom of the screen. We will say more about these later.
The one that is highlighted is Author. Choose this either by
Enter key or by typing a (or
A but uppercase doesn't matter to DERIVE on input so
don't bother). This allows you to enter a mathematical expression.
In this manual we use a typewriter like font, eg.,
a(b + c) to indicate something you might type in.
We use a sans serif
font for special keys on the keyboard like
return key) and
DERIVE has easy to use menus described below. Each menu item has
one capital letter (usually, but not always, the first). You can
choose that menu item by pressing that letter. We denote this by
showing the capital letter in bold; for example, Simplify or
After selecting Author, you enter a mathematical expression, i.e.,
you type it in and then press the
Enter key. You enter an
expression using the customary syntax: addition +-key,
subtraction --key, division /-key, powers
^}-key and multiplication *-key (however;
multiplication does not require a *, i.e., 2x is the same as 2*x). DERIVE then displays it on the
screen in two-dimensional form with raised superscripts, displayed
fractions, and so forth. You should always check to make sure the
two-dimensional form agrees with what you thought you entered
(see Editing below to see how to correct typing errors).
Table 1 gives some examples.
Note from (3) and (4) and from (6) and (7) of Table 1 that
it is sometimes necessary to use parentheses. Also note in (8), that
to get the fraction you want, it is necessary to put parentheses around
the numerator and denominator. See what happens if you enter (8)
without the parentheses. Also try entering some expressions of your
own. (9) and (10) show you two ways to enter square roots.
Alt-q means hold down the
To get the symbol for infinity
, type inf. To get the symbol for the Greek letter , type pi or
Alt-p. Euler's constant e is
displayed by DERIVE as ê. It is obtained by typing either
Alt-e or #e. It is important to
distinguish this from just e, which DERIVE takes to just be some
constant like a. To get the functions arctan(x), arcsin(x),
etc., you type atan x and asin x.
The help feature can be used at any time to remind you how to type these constants. Just select Help and then select either constants or functions. For now you can click to see the list of special constants in the Derive reference. The list of functions is very large and you might want to avoid that in the beginning.
When you are `Authoring' an expression, you can use the arrow
Home-key to move forward and back.
The Delete key will delete characters. The
between insert and overstrike mode. If you press the
the expression highlighted on the screen will be inserted;
will insert it with parentheses around it. You can use the up and down
arrows to change which expression is highlighted on the screen. The
help feature explains these techniques, just select Help and then
choose E for edit. You can see this now by clicking edit. Try it.
The displayed expressions are numbered. You can refer to them as #n. So, for example, with the expressions in Table 1, you could get sin(x)/x² by Authoring #5/#2.
When you start DERIVE it is in a character mode. This means it treats each single character as a variable, so if you type ax DERIVE takes this to be a times x. This mode is what is best for calculus. The exception to this are the functions DERIVE knows about. If you type xsinx, DERIVE knows you want x sin(x). Actually on the screen you will see x SIN (x): DERIVE displays all variables in lower case and all functions in upper case.
After you enter an expression, DERIVE displays it in two-dimensional
form, but does not simplify it. Thus, integrals are displayed with the
integral sign and derivatives are displayed using the usual notation.
To simplify (that is evaluate) it, choose Simplify from the menu
by pressing the s-key. You can have the expression directly
evaluated by pressing
Ctrl-Enter instead of
when you Author an expression. It is usually best not to bother
with this fast simplification technique since there is a tendency to
forget what was simplified when you look back at you work later.
DERIVE uses exact calculations. If you Author
Alt-q 8, 8 will be displayed. If you Simplify this, you get 22. If you want to see a decimal
approximation, choose the approXimate menu item by pressing the
x-key. See Figure 1 for several examples.
Notice that the number of places can be changed by choosing
Options/Precision and changing Digits by pressing the
Tab-key and entering a number.
An important problem is to find all solutions to the equation f(x)=0. If f(x) is a quadratic polynomial such as , then this can be done using the quadratic formula or by factoring. In DERIVE we choose Factor after highlighting the above expression, press the Enter-key and ignore the other options for now. The result is that f(x) = (x+1)(x-2). This means that the roots of f(x) are x=-1, 2, i.e., these are the only solutions to f(x)=0. We can also do this in DERIVE by choosing Solve with the quadratic expression highlighted. The quadratic formula is used to solve for the roots so it is possible the answer will involve square roots (and even complex solution, e.g., has no real roots but it does have two complex ones, namely, x = ± i, ).
If f(x) is not a quadratic polynomial then DERIVE may not be able to factor it; nevertheless, it may be able to solve the equation f(x)=0. As an example, sin x = 0 has infinitely many solution where m is any integer. If we use DERIVE to solve this equation it gives the 3 solutions corresponding to m=-1,0,1 (these are the principle solutions and all others are obtained by adding or subtracting multiples of ).
Finally, the simple equation cannot be solved exactly in DERIVE although it is obvious that x=0 is one solution and by viewing the graph we see another one with . In order to approximate this solution we need to choose Option/Precision and then set Mode to Approximate (by pressing the a-key). Then, when we choose Solve we are asked for a range of x's (initially it is the interval [-10,10]). Since we have (at least) 2 solutions we should restrict the interval to say [.5,1] which seems reasonable based on the graphical evidence. The result is that DERIVE gives the solution x=.876626. We will discuss how this computation is done later in Chapter 5.
If you have an expression like and you want to evaluate this with x=3 or if you solved an equation f(x)=0 and want to substitute in that value of x, you Author the expression and then choose Manage/Substitute. This will ask you for the expression. It will guess the highlighted expression, which is usually what you want so you can just hit return in this case. It then gives the name of a variable occurring in the expression. In this example x is the only variable. You then type over x with the value you want to substitute, in this case 3. You can then Simplify or approXimate. You do not have to substitute a number for x; you can substitute another expression.
This menu item
is very important for us. After pressing the c-key, you get a
After you have Authored an expression, you can differentiate
it by choosing Calculus, then choosing Differentiate.
It will ask you
what expression you want to differentiate and with respect to which
variable and how many times to differentiate,
but it usually guesses right so you can just hit
To integrate an expression, first Author it, then choose Calculus, then Integrate. It will ask you what expression to
integrate; it will guess you want to integrate the highlighted
expression. It will then ask you what variable you what to integrate
over; again it will probably guess right. Then it will ask for the
limits of integration. If you want an indefinite integral, just press
Enter. For a definite integral type in the lower limit, then
Tab-key to move to the upper limit field and enter it.
See Figure 1 for several examples using Differentiate and Integrate on the Calculus menu.
Figure 1. Using the Calculus menu.
The options Calculus/Limits is similar to the above. To solve
you must enter the expression, then choose Limits from the Calculus menu. You must tell DERIVE the variable (which is x) and the limit point which is -1 since x-1. Then Simplify to get the answer. In a similar manner DERIVE does summation and product problems. Special notations are used; namely,
See Figure 2 for some examples. Note that in Figure 2
Let us discuss the summation notation which may be new to you. If are numbers then
The symbol on the left, , is read as ``the sum of as i runs from 1 to n.'' Often is a formula involving i. So
You can do this computation in DERIVE using the Sum option on the Calculus menu. Just Author i^2 then choose Calculus, then Sum. Follow the menu and let i start at 0 and end at 5. Simplify to get 55. As an interesting aside, edit the above sum and have DERIVE Simplify to get the formula:
This formula is used in many calculus texts to evaluate certain Riemann sums.
Figure 2. Examples of Limits, Products and Sums
The option Calculus/Taylor will be explained later in Chapter 10.
|e||Alt-e or #e|
|Alt-p or pi|
|The square sign:||alt-q|
|,||ln x , log(b, x)|
|Inverse trigonometric functions||asin x, atan x, etc.|
|dif(f(x), x, n)||Calc/Diff|
|int(f(x), x, a, b)||Calc/Int|
|Simplify an expression||s||Simplify|
|Cancel a menu choice||Esc-key|
|Move around in a menu||Tab-key|
|Change highlighted expression||up, down arrow keys|
|Insert highlighted expression||F3 , F4 with ( )'s|
Supposed you wanted to graph the function x sin x. You would first
Author this and then choose Plot. You then get the submenu:
Beside, Under, Overlay. You will usually want Beside. After choosing this (by pressing the b--key or
Enter key), you are asked for the column. You can
Enter to get column 40. This will split the screen into
two windows: an Algebra window on the left and a Plotting window on the
right. These windows each have a number in their upper left
hand corner. You
can tell which window you are in by which number is highlighted. You
can switch windows by pressing the
F1-key or choosing
Algebra when you are in the plot window or choosing Plot from the
After you have created the plot window, you are in that window. You
need to choose Plot from that window to actually do the
plotting. This will plot the expression highlighted in the algebra
window. You can plot several functions in the same plot window.
Move to the algebra window, use the up and down arrows to highlight
the expression you want to plot, switch to the plot window (by
F1 or choosing Plot), and then choose Plot from
the plot window. Now both expressions will be graphed. You can plot
as many as you want this way. The plot window also has a Delete option for removing some or all of the expressions to be
When you plot, there is a small crosshair in the plot window, initially at the (1,1) position. You can move it around using the arrow keys. The coordinates of the position of the cross are give at the bottom of the screen. This is useful for such things as finding the coordinates of a maximum or a minimum, or where two graphs meet. The Center option will redraw the graph so that the cross is in the center of the window. You can use the Zoom option to move in or out.
We mentioned above how to plot any number of graphs simultaneously by
repeatedly switching between the algebra window and the graphics
window. Another technique for plotting three or more functions is to
plot a vector of functions. This just means Authoring a
collection of functions, separated by commas and surrounded by
For example, Plotting the expression [x, x^2,
x^3] will graph the three functions: x, x², and x³. In
order to plot a collection of individual points one enters the points
as a matrix, for example Authoring the expression
[[0,0], [1,1], [2,0]] and then Plotting it will graph
the 3 points: (0,0), (1,1) and (2,1). In the graphics window
choose Option}/State then press the
followed by Connected. Then choosing Plot again will
graph the 3 points above but also draw the line segment between them.
See the Figure 4 where each of these techniques is
demonstrated. The color of a plot is controlled by choosing
Option/Color/Plot and then making sections
on the menu.
Click 2D-Plot to see a summary of these of these commands or choose 2D-Plotting for the online Help menu.
Figure 5. Using Plot for graphics
The main tools for manipulating the view of your graph are:
|Switch windows||F1||Algebra or Plot|
|Zoom in, zoom out||F9, F10||Zoom|
|Move Crosshair||4 arrow keys||Move|
|Move crosshair quickly||Ctrl- , Ctrl- , PgUp, PgDn||Move|
|Center on crosshair||c||Center|
|change the scale||s||Scale|
If you Author f(x), DERIVE will put f x on the screen because it thinks both x and f are variables. If you wish to define f(x)=x² + 2x + 1 for example, you could Author f(x) := x^2 + 2x + 1, or you could choose Declare from the main menu at the bottom, then choose Function, and then fill in the information asked for. See Figure 4.
Figure 4. Examples of Declare, Simplify and ApproX
Constant are treated just like functions except there are no arguments. In order to set a = 2 for example you type a := 2 pi. Then, whenever you simplify an expression containing a, each occurrence is replaced with 2. In many problems you find it useful to have constant names with more than one letter or symbol, which is the default in DERIVE. For example variables with names like x1, y2, etc. will be used frequently as our names like ``gravity". This can be done by changing to word input mode by choosing Options/Input/Word. In this mode variables can have several letters but when in word input mode you have to be more careful with spaces: to get you should enter a x^2, not ax^2 (otherwise will be treated as a variable). DERIVE indicates multiplication with a centered dot. So on the screen you should see , not .
An interesting function defining technique is provided by the factorials. For n = 1, 2, ... we define n-factorial, denoted by n!, as
and for completeness we define 0! = 1. These numbers are important in many formulas, e.g., the binomial theorem. One observes the important recursive relationship n! = n (n-1)! which gives the value of n! in terms of the previous one (n-1)!. Thus, since 5! = 120 we see immediately that 6!= 720 without multiplying all 6 numbers together.
In DERIVE we can recursively define a function F(n) satisfying F(n)=n! by simply typing
F(n) := IF(n=0, 1, n F(n-1))
We will give several other examples of this technique in the text.
In calculus functions are typically described by giving a formula like but another technique is to describe the values restricted to certain intervals or with different formulas on different ranges of x-values. As an example, consider the function
which defines a unique value f(x) for each value of x. The problem is how do we define such a function using DERIVE?
One basic technique is to use the logical IF statement. The syntax is IF(test, true, false). For example, if we enter and simplify IF(1 < 2, 0, 1) we get 0 whereas IF(1 = 2, 0, 1) simplifies to 1. Now our function above is entered as:
f(x):= IF(x < 1, 2x + 1, IF(x <= 2, x^2, 4))
Notice how we use nested IF statements to deal with the three conditions and that with four conditions even more nesting would be required. Now once f(x) has been defined we can make computations such as Simplifying F(1) (should get 1), computing limits such as the right-hand limit (should get x² =x^2 evaluated at x=1) or definite integrals using approX to simplify. We can also plot f(x) in the usual manner described in the previous section.
Notice from Figure 0.5 that the function y=f(x) is continuous at all . At x=1, both left and right limits exist but they are not equal so the graph has a jump discontinuity.
As the number of table entries increases we are forced into using nested IF statements and the formulas become quite difficult to read and understand. An alternate approach is to use the DERIVE function CHI(a,x,b) which is simply
Then except for x = 1 our function f(x) above satisfies:
F(x):=(2x+1) CHI(-inf,x,1) + x^2 CHI(1,x,2) + 4 CHI(2,x,inf)
Vectors are quite useful in DERIVE, even for calculus. The next section shows how they are used in plotting. To enter the 3 element vector with entries a, b, and c, Author [a, b, c]. It is important to note the square brackets which are used in DERIVE for vectors; commas are used to separate the elements.
DERIVE also provides a useful function for constructing vectors. The vector function is a good way to make lists and tables in DERIVE. For example, if you Author vector(n^2, n, 1, 3), it will Simplify to [1, 4, 9]. The form of the vector function is vector(u,i,k,m) where u is an expression containing i. This will produce the vector [u(k),u(k+1),...,u(m)]. You can also use the Calculus/Vector menu option to create a vector. So, for example, to obtain the same vector as before, you Author n^2 and highlight this. Now choose Calculus/Vector and setting Variable: n (not x), Start: 1 and End: 3.
A table (or matrix) can be produced by making a vector with vector entries. If we modify the previous example slightly by replacing the expression n^2 with [n, n^2] and then repeating the above we get [[1, 1], [2, 4], [3, 9]] which displays as a table with the first column containing the value of the index n and the second column containing the value of the expression n². This is a good technique for studying patterns in data. See Figure 6 for some examples. Click VECTOR for more information on this function.
Figure 6. Using the Calculus/Vector command
We have already seen two important applications of vectors in Section 0.10; namely,
We will have other application that will require us to refer to the individual expression inside of a vector. This is done with the DERIVE SUB function (which is short for subscript). Thus, for example, [a,b,c] SUB 2 simplifies to the second element b. DERIVE will display this as which explains the name. For a matrix or vector of vectors then double subscripting is used so that, for example, if
then Authoring y SUB 2 SUB 1 will be displayed as and simplify to 3 (because it's on row 2 and column 1).
You can save your expressions to a floppy disk or the hard drive H: and come back later to continue working on them. To do this, put a floppy in say the A: drive and, from the algebra window, choose Transfer, then choose Save, then Derive and then enter a file name such as A:LAB5 or A:LAB5.MTH or H:LAB5 for the hard drive. If you don't type the extension .MTH; DERIVE will add it anyway. Later, you can reenter these expressions by starting DERIVE and choosing Transfer, then Load, then Derive, and then entering the file name A:LAB5 or A:LAB5.MTH. If you forget the name of your files just type either A: or H: and press the F1-key to select from a listing of your files.
During the course of your session with the computer you will make lots of typing and mathematical mistakes. Before saving your work to a file or before printing and turning your lab in for grading you should erase the unneed entries and clean up the file. You do this with the Remove and the moVe commands. You should practice these commands on some scratch work to make certain you understand them. There is also an Unremove command for correcting mistakes. One way to use the moVe command is to write comments in the file and placing them before computation. Many of the *.MTH files that we wrote for this lab manual use this technique. To do it, just Author a line of text enclosed in double quotes, for example, "Now substitute x=0.".
You can print all the expressions in the algebra window (even the ones you can't see) or you can do a screen dump which will print the whole screen including your graphs. If you are working at home, be sure you to first configure your printer (this is not necessary in the Bilger labs). Choose Transfer, then Print, then Option. You will probably want to choose Some for the range, Extended for the character set and Dotmatrix for the printer. The next menu you can ignore unless you want sideways printout (Landscape), just press Enter. Now choose Printer, then choose either Expressions (to print the expressions), or Screen or Window. Printing the screen or window is quite slow, so only do it when you want to include a graph.
Usually you just want to print a graph. To print just a window with a graph in it, make that its the current window, and then press Shift-F9. Typically, students turn in the labs by hand writing most of the exercise answers and then including some graphs using this method. Another technique for longer labs is to make a file as discussed above and then printing the file. Some combination of hand writing and printouts should be the most efficient.
You can obtain on-line help by choosing Help. This help feature provides information on all DERIVE functions and symbols. Suppose that you want to know how to enter the second derivative of a functions f(x) by typing. For example, maybe this expression is to be used as part of another function. There are three techniques for learning how to do this.
The first method is to use the menus with Calculus/Differentiate to enter the second derivative by typing 2 after the Order entry. Then, press Author followed by the pull-down key F3 which will enter DERIVE's way of typing the expression, in this case it's DIF(g(x),x,2). The second method is to use the online help, either by choosing Help on the main menu or pressing F1 while authoring an expression. On then, selects F (for functions) and then by pressing Enter several times one finds the appropriate page of explanations.
The third method is use our Web page, see the index at the top of this file, which also is linked to DERIVE's online help file. The advantage of this last method is that the relevant page, once found, can be kept available for further consultation. One just flips between the DERIVE window and the help window by pressing the Alt-Tab or Alt-Esc keys on your PC.
We have included a few quick reference tables with common keys used for entering things like , and Euler's constant e. Table 0.2 gives a summary of commands that can be issued from the Algebra window and Table 0.3 gives a summary of useful commands that can be used in the Plot window.
Here are a few common mistakes that everyone makes, including the authors, every once in a while. It just takes practice and discipline to avoid these problems, although, it is human nature to blame the computer for your own mistakes. Fortunately, the computer never takes insults personally and it never takes revenge by creating sticky keys, erasing files, locking up, or anything else like that ... or does it?
VECTOR(x^2 + c, c, 0, 4)