Software is available for calculus courses—a lot of it. The packages keep getting better. Which program to use (if any) depends on cost and convenience and purpose. How to use it is a much harder question. These pages identify some of the goals, and also particular packages and calculators. Then we make a beginning (this is still Chapter 1) on the connection of computing to calculus.
The discussion will be informal. It makes no sense to copy the manual. Our aim is to support, with examples and information, the effort to use computing to help learning.
For calculus, the greatest advantage of the computer is to offer graphics. You see the function, not just the formula. As you watch, ƒ(x) reaches a maximum or a minimum or zero. A separate graph shows its derivative. Those statements are not 100% true, as everybody learns right away as soon as a few functions are typed in. But the power to see this subject is enormous, because it is adjustable. If we don't like the picture we change to a new viewing window.
This is computer-based graphics. It combines numerical computation with graphical computation. You get pictures as well as numbers—a powerful combination. The computer offers the experience of actually working with a function. The domain and range are not just abstract ideas. You choose them. May I give a few examples.
EXAMPLE 1 Certainly x³ equals 3x when x = 3. Do those graphs ever meet again? At this point we don't know the full meaning of 3x, except when x is a nice number. (Neither does the computer.) Checking at x = 2 and 4, the function x³ is smaller both times: 2³ is below 3² and 4³ = 64 is below 34 = 81. If x³ is always less than 3x we ought to know—these are among the basic functions of mathematics.
The computer will answer numerically or graphically. At our command, it solves x³ = 3x. At another command, it plots both functions—this shows more. The screen proves a point of logic (or mathematics) that escaped us. If the graphs cross once, they must cross again—because 3x is higher at 2 and 4. A crossing point near 2.5 is seen by zooming in. I am less interested in the exact number than its position—it comes before x = 3 rather than after.
A few conclusions from such a basic example:
The third point doesn't sound so good. Write it differently: We can learn mathematics while doing it. The hardest part of teaching calculus is to turn it from a spectator sport into a workout. The computer makes that possible.
EXAMPLE 2 (mental computer) Compare x² with 2x. The functions meet at x = 2. Where do they meet again? Is it before or after 2?
That is mental computing because the answer happens to be a whole number (4). Now we are on a different track. Does an accident like 24 = 4² ever happen again? Can the machine tell us about integers? Perhaps it can plot the solutions of xb = bx. I asked Mathematica for a formula, hoping to discover x as a function of b—but the program just gave back the equation. For once the machine typed HELP instead of the user.
Well, mathematics is not helpless. I am proud of calculus. There is a new exercise at the end of Section 6.4, to show that we never see whole numbers again.
EXAMPLE 3 Find the number b for which xb = bx has only one solution (at x = b).
When b is 3, the second solution is below 3. When b is 2, the second solution (4) is above 2. If we move b from 2 to 3, there must be a special "double point"—where the graphs barely touch but don't cross. For that particular b—and only for that one value—the curve xb never goes above bx.
This special point b can be found with computer-based graphics. In many ways it is the "center point of calculus." Since the curves touch but don't cross, they are tangent. They have the same slope at the double point. Calculus was created to work with slopes, and we already know the slope of x². Soon comes xb. Eventually we discover the slope of bx, and identify the most important number in calculus.
The point is that this number can be discovered first by experiment.
EXAMPLE 4 Graph y(x) = ex − xe. Locate its minimum.
The next example was proposed by Don Small. Solve x4 − 11x³ + 5x − 2 = 0. The first tool is algebra—try to factor the polynomial. That succeeds for quadratics, and then gets extremely hard. Even if the computer can do algebra better than we can, factoring is seldom the way to go. In reality we have two good choices:
Both will be done by the computer. Both have potential problems! Newton's method is fast, but that means it can fail fast. (It is usually terrific.) Plotting the graph is also fast—but solutions can be outside the viewing window. This particular function is zero only once, in the standard window from -10 to 10. The graph seems to be leaving zero, but mathematics again predicts a second crossing point. So we zoom out before we zoom in.
The use of the zoom is the best part of graphing. Not only do we choose the domain and range, we change them. The viewing window is controlled by four numbers. They can be the limits A≤x≤B and C≤y≤D. They can be the coordinates of two opposite corners: (A, C) and (B, D). They can be the center position (a, b) and the scale factors c and d. Clicking on opposite corners of the zoom box is the fastest way, unless the center is unchanged and we only need to give scale factors. (Even faster: Use the default factors.) Section 3.4 discusses the centering transform and zoom transform—a change of picture on the screen and a change of variable within the function.
EXAMPLE 5 Find all real solutions to x4 − 11x³ + 5x − 2 = 0.
EXAMPLE 6 Zoom out and in on the graphs of y = cos 40x and y = x sin (1/x). Describe what you see.
EXAMPLE 7 What does y = (tan x − sin x) ⁄ x³ become at x = 0? For small x the machine eventually can't separate tan x from sin x. It may give y = 0. Can you get close enough to see the limit of y?
For these examples, and for most computer exercises in this book, a menu-driven system is entirely adequate. There is a list of commands to choose from. The user provides a formula for y(x), and many functions are built in. A calculus supplement can be very useful—MicroCalc or True BASIC or Exploring Calculus or MPP (in the public domain). Specific to graphics are Surface Plotter and Master Grapher and Gyrographics (animated). The best software for linear algebra is MATLAB.
Powerful packages are increasing in convenience and decreasing in cost. They are capable of symbolic computation—which opens up a third avenue of computing in calculus.
In symbolic computation, answers can be formulas as well as numbers and graphs. The derivative of y = x² is seen as "2x." The derivative of sin t is "cos t." The slope of bx is known to the program. The computer does more than substitute numbers into formulas—it operates directly on the formulas. We need to think where this fits with learning calculus.
In a way, symbolic computing is close to what we ourselves do. Maybe too close—there is some danger that symbolic manipulation is all we do. With a higher-level language and enough power, a computer can print the derivative of sin(x²). So why learn the chain rule? Because mathematics goes deeper than "algebra with formulas." We deal with ideas.
I want to say clearly: Mathematics is not formulas, or computations, or even proofs, but ideas. The symbols and pictures are the language. The book and the professor and the computer can join in teaching it. The computer should be non-threatening (like this book and your professor)—you can work at your own pace. Your part is to learn by doing.
EXAMPLE 8 A computer algebra system quickly finds 100 factorial. This is 100! = (100)(99)(98)... (1). The number has 158 digits (not written out here). The last 24 digits are zeros. For 10! = 3628800 there are seven digits and two zeros. Between 10 and 100, and beyond, are simple questions that need ideas:
For Question 1,the computer shows more than N digits when N = 100. It will never show more than N² digits, because none of the N terms can have more than N digits. A much tighter bound would be 2N, but is it true? Does N! always have fewer than 2N digits?
For Question 2, the zeros in lo! can be explained. One comes from 10, the other from 5 times 2. (10 is also 5 times 2.) Can you explain the 24 zeros in loo!? An idea from the card game blackjack applies here too: Count the fives.
Hard question: How many zeros at the end of 200!?
The outstanding package for full-scale symbolic computation is Mathematica. It was used to draw graphs for this book, including y = sin n on the back cover. The complete command was List Plot [Table [Sin [n], (n, 10000)]]. This system has rewards and also drawbacks, including the price. Its original purpose, like MathCAD and MACSYMA and REDUCE, was not to teach calculus—but it can. The computer algebra system MAPLE is good.
As I write in 1990, DERIVE is becoming well established for the PC. For the Macintosh, Calculus TIL is a "sleeper" that deserves to be widely known. It builds on MAPLE and is much more accessible for calculus. An important alternative is Theorist. These are menu-driven (therefore easier at the start) and not expensive.
I strongly recommend that students share terminals and work together. Two at a terminal and 3-5 in a working group seems to be optimal. Mathematics can be learned by talking and writing—it is a human activity. Our goal is not to test but to teach and learn.
Writing in Calculus May I emphasize the importance of writing? We totally miss it, when the answer is just a number. A one-page report is harder on instructors as well as students-but much more valuable. A word processor keeps it neat. You can't write sentences without being forced to organize ideas-and part of yourself goes into it.
I will propose a writing exercise with options. If you have computer-based graphing, follow through on Examples 1-4 above and report. Without a computer, pick a paragraph from this book that should be clearer and make it clearer. Rewrite it with examples. Identify the key idea at the start, explain it, and come back to express it differently at the end. Ideas are like surfaces—they can be seen many ways.
Every reader will understand that in software there is no last word. New packages keep coming (Analyzer and EPIC among them). The biggest challenges at this moment are three-dimensional graphics and calculus workbooks. In 30, the problem is the position of the eye—since the screen is only 20. In workbooks, the problem is to get past symbol manipulation and reach ideas. Every teacher, including this one, knows how hard that is and hopes to help.
The most valuable feature for calculus—computer-based graphing—is available on hand calculators. With trace and zoom their graphs are quite readable. By creating the graphs you subconsciously learn about functions. These are genuinely personal computers, and the following pages aim to support and encourage their use.
Programs for a hand-held machine tend to be simple and short. We don't count the zeros in 100 factorial (probably we could). A calculator finds crossing points and maximum points to good accuracy. Most of all it allows you to explore calculus by yourself. You set the viewing window and define the function. Then you see it.
There is a choice of calculators—which one to buy? For this book there was also a choice—which one to describe? To provide you with listings for useful programs, we had to choose. Fortunately the logic is so clear that you can translate the instructions into any language—for a computer as well as a calculator. The programs given here are the "greatest common denominator" of computing in calculus.
The range of choices starts with the Casio ∫x 7000G—the first and simplest, with very limited memory but a good screen. The Casio 7500,8000, and 8500 have increasing memory and extra features. The Sharp EL-5200 (or 9000 in Canada and Europe) is comparable to the Casio 8000. These machines have algebraic entry—the normal order as in y = x + 3. They are inexpensive and good. More expensive and much more powerful are the Hewlett-Packard calculators—the HP-28s and HP-48SX. They have large memories and extensive menus (and symbolic algebra). They use reverse Polish notation—numbers first in the stack, then commands. They require extra time and effort, and other books do justice to their amazing capabilities. It is estimated that those calculators could get 95 on a typical calculus exam.
While this book was being written, Texas Instruments produced a new graphing calculator: the TI-81. It is closer to the Casio and Sharp (emphasis on graphing, easy to learn, no symbolic algebra, moderate price). With earlier machines as a starting point, many improvements were added. There is some risk in a choice that is available only Δt before this textbook is published, and we hope that the experts we asked are right. Anyway, our programs are Jbr the TI-81. It is impressive.
These few pages are no substitute for the manual that comes with a calculator. A valuable supplement is a guide directed especially at calculus—my absolute favorites are Calculus Activities for Graphic Calculators by Dennis Pence (PWS-Kent, 1990 for the Casio and Sharp and HP-28S, 1991 for the TI-81). A series of Calculator Enhancements, using HP's, is being published by Harcourt Brace Jovanovich. What follows is an introduction to one part of a calculus laboratory. Later in the book, we supply TI-81 programs close to the mathematics and the exercises that they are prepared for.
A few words to start: To select from a menu, press the item number and ENTER. Edit a command line using DEL(ete) and INS(ert). Every line ends with ENTER. For calculus select radians on the MODE screen. For powers use ^. For special powers choose x², x-1, √x. Multiplication has priority, so (-)3 + 2 x 2 produces 1. Use keys for SIN, IF, IS, ... When you press letters, I multiplies S.
If a program says 3 → C, type 3 STO C ENTER. Storage locations are A to Z or Greek 0.
Functions A graphing calculator helps you (forces you?) to understand the concept of a function. It also helps you to understand specific functions—especially when changing the viewing window.
To evaluate y = x² − 2x just once, use the home screen. To define y(x) for repeated use, move to the function edit screen: Press MODE, choose Function, and press Y =. Then type in the formula. Important tip: for X on the TI-81, the key X | T is faster than two steps Alpha X. The Y = edit screen is the same place where the formula is needed for graphing.
Example Y1 = X² − 2X ENTER on the Y = screen. 4 ST0 X ENTER on the home screen. Y1 ENTER on the Y-VARS screen. The screen shows 8, which is Y(4). The formula remains when the calculator is off.
Graphing You specify the X range and Y range. (We should say X domain but we don't.) The screen is a grid of 96 x 64 little rectangles called "pixels." The first column of pixels represents Xmin and the last column is Xmax. Press RANGE to reset. With Xres = 1 the function is evaluated 96 times as it is graphed. Xscl and Yscl give the spaces between ticks on the axes.
The ZOOM menu is a fast way to set ranges. ZOOM Standard gives the default -1O≤x≤10, -10≤y≤10. ZOOM Trig gives -2n≤x≤h, -3≤y≤3.
The keystroke GRAPH shows the graphing screen with the current functions.
Example Set the ranges (-)2≤X≤3 and (-)150≤Y≤50. Press Y = and store Y1 = X (in MATH)³ − 28X² + 15X + 36 ENTER. Press GRAPH. You won't see much of the graph! Press RANGE and reset (-)10≤X≤30, (-)4000≤Y≤2300. Press GRAPH. See a cubic polynomial.
"Smart Graph" recalls the graph instantly without redrawing it, if no settings have changed. The DRAW menu is for points, lines, and shaded regions. This is perfect for our piecewise linear functions—just connect the breakpoints with lines. In Section 3.6 the lines show an iteration by its "cobweb."
Programming This book contains programs that you can type in once and save. We chose Autoscaling, Newton's Method, Secant Method, Cobweb Iteration, and Numerical Integration. You will create others—to do calculations or to add features that are not available as single keystrokes. The calculator is like a computer, with a fairly small set of instructions. One digerence: Memory is too precious to store comments with the code. You have to see the logic by rereading the program.
To enter the world of programming, press PRGM. Each PRGM submenu lists all programs by name—a digit, a letter, or θ(37 names). The program title has up to eight characters. Select the EDIT submenu and press G for the edit screen. Type the title GRAPHS and press ENTER. Practice on this one:
:"X²+X" STO (Y-VARS) Y1 ENTER
:"X-1" STO (Y-VARS) Y2 ENTER
:(PRGM) (I/O) DispGraph
The menus to call are in parentheses. Leave the edit screen with QUIT (not CLEAR—that erases the line with the cursor). Set the default window by ZOOM Standard.
To execute, press PRGM (EXEC) G ENTER. The program draws the graphs. It leaves Y1 and Y2 on the Y = screen. To erase the program from the home screen, press (PRGM)(ERASE)G. Practice again by creating Prgm2:FUNC. Type :√X ST0 Y and :(PRGM) (I/O) Disp Y. Move to the home screen, store X by 4 ST0 X ENTER, and execute by (PRGM) (EXEC) 2 ENTER. Also try X = -1. When it fails to imagine i, select 1 :Goto Error.
Piecewise functions and Input (to a running program). The definition of a piecewise function includes the domain of each piece. Logical tests like "IF X≥7" determine which domain the input value X falls into. An IF statement only affects the following line-which is executed when TEST = 1 (meaning true) and skipped when TEST = 0 (meaning false). IF commands are in the PRGM (CTL) submenu; TEST calls the menu of inequalities.
An input value X = 4 need not be stored in advance. Program P stops while running to request input. Execute with P ENTER after selecting the PRGM (EXEC) menu. Answer ? with 4 and ENTER. After completion, rerun by pressing ENTER again. The function is y = 14 − x if x < 7, y = x if x ≥ 7.
:Disp "X=" | PGRM (I/O) Ask for input |
:Input X | PGRM (I/O) Screen ? ENTER X |
:14-X→Y | First formula for all X |
:If 7≤X | PRGM (CTL) TEST |
:X+Y | Overwrite if TEST = 1 |
:Disp Y | Display Y(X) |
Overwriting is faster than checking both ends A≤X≤B for each piece. Even faster: a whole formula (14−X)(X<7) +(X)(7≤X) can go on a single line using 1 and 0 from the tests. Compute-store-display Y(X) as above, or define Y1 on the edit screen.
Exercise Define a third piece Y = 8 + X if X<3. Rewrite P using Y1 =. A product of tests (3≤X)(X <7) evaluates to 1 if all true and to 0 if any false.
TRACE and ZOOM The best feature is graphing. But a whole graph can be like a whole book—too much at once. You want to focus on one part. A computer or calculator will trace along the graph, stop at a point, and zoom in.
There is also ZOOM 0UT, to widen the ranges and see more. Our eyes work the same way—they put together information on different scales. Looking around the room uses an amazingly large part of the human brain. With a big enough computer we can try to imitate the eyes—this is a key problem in artificial intelligence. With a small computer and a zoom feature, we can use our eyes to understand functions.
Press TRACE to locate a point on the graph. A blinking cursor appears. Move left or right—the cursor stays on the graph. Its coordinates appear at the bottom of the screen. When x changes by a pixel, the calculator evaluates y(x). To solve y(x) = 0, read off x at the point when y is nearest to zero. To minimize or maximize y(x), read off the smallest and largest y. In all these problems, zoom in for more accuracy.
To blow up a figure we can choose new ranges. The fast way is to use a ZOOM command. Forapresetrange,use ZOOM Standard or ZOOM Trig. To shrink or stretch by XFact or YFact (default values 4), use ZOOM In or ZOOM Out. Choose the center point and press ENTER. The new graph appears. Change those scaling factors with ZOOM Set Factors. Best of all, create your own viewing window. Press ZOOM Box.
To draw the box, move the cursor to one corner. Press ENTER and this point is a small square. The same keys move a second (blinking) square to the opposite corner—the box grows as you move. Press ENTER, and the box is the new viewing window. The graphs show the same function with a change of scale. Section 3.4 will discuss the mathematics—here we concentrate on the graphics.
EXAMPLE 9 Place :Y1 = X sin (1/X) in the Y = edit screen. Press ZOOM Trig for a first graph. Set XFact = 1 and Y Fact = 2.5. Press ZOOM In with center at (0,0). To see a larger picture, use XFact = 10 and YFact = 1.Then Zoom Out again. As X gets large, the function X sin (1/X) approaches .
Now return to ZOOM Trig. Zoom In with the factors set to 4 (default). Zoom again by pressing ENTER. With the center and the factors fixed, this is faster than drawing a zoom box.
EXAMPLE 10 Repeat for the more erratic function Y = sin (1/X). After ZOOM Trig, create a box to see this function near X = .01. The Y range is now .
Scaling is crucial. For a new function it can be tedious. A formula for y(x) does not easily reveal the range of y's, when A≤x≤B is given. The following program is often more convenient than zooms. It samples the function L = 19 times across the x-range (every 5 pixels). The inputs Xmin, Xmax, Y1 are previously stored on other screens. After sampling, the program sets the y-range from C = Ymin to D = Ymax and draws the graph.
Notice the loop with counter K. The loop ends with the command IS > (K,L), which increases K by 1 and skips a line if the new K exceeds L. Otherwise the command Goto 1 restarts the loop. The screen shows the short form on the left.
Example: Y1 = x³ + 10x² − 7x + 42 with range Xrnin = −12 and Xmax = 10. Set tick spacing Xscl = 4 and Yscl = 250. Execute with PRGM (EXEC) A ENTER. For this program we also list menu locations and comments.
PrgmA :AUTOSCL | Menu (Submenu) Comment |
:All-Off | Y-VARS (OFF) Turn off functions |
:Xmin→A | VARS (RNG) Store Xmin using STO |
:19→L | Store number of evaluations (19) |
:(Xmax-A)/L→H | Spacing between evaluations |
:A→X | Start at x = A |
:Y1→C | Y-VARS (Y) Evaluate the function |
:C→D | Start C and D with this value |
:1→K | Initialize counter K = 1 |
:Lbl 1 | PRGM (CTL) Mark loop start |
:A+KH→X | Calculate next x |
:Y1→Y | Evaluate function at x |
:IF Y<C | PGRM (CTL) New minimum? |
:Y→C | Update C |
:IF D<Y | PRGM (CTL) New maximum? |
:Y→D | Update D |
:IS>(K,L) | PRGM (CTL) Add 1 to K, skip Goto if >L |
:Goto 1 | PRGM (CTL) Loop return to Lbl 1 |
:Y1-On | Y-VARS (ON) Turnon Y1 |
:C→Ymin | STO VARS (RNG) Set Ymin = C |
:D→Ymax | STO VARS (RNG) Set Ymax = D |
:DispGraph | PRGM (I/O) Generate graph |