微積分学では、その多くでソフトウェアが使える。パッケージだとより良い。どのプログラムを使うべきかは(使うとすれば)価格と利便性と目的による。使い方はもっと難しい問題だ。このページではいくつかの目標、また特定のパッケージと計算機を同一に扱う。それでは (まだ1章だが) コンピュータと微積分学の関係を始める。
この議論は非公式である。マニュアルのコピーでは意味がない。われわれの目的は例や情報でもって、コンピュータを学習に使うことを支援することだ。
微積分学において、コンピュータの最も大きな利点は図表の提供である。ただの式ではない、関数を見る。ƒ(x) が最大、最小、ゼロをとるのが見える。分離したグラフはその導関数を示す。少しの関数を打ち込むとすぐに誰でも分かるように、これらは100%真実であるとまでは言えない。しかしこの対象 (subject) を見る力は大きい。調整できるので。図が気に入らなければ新しい閲覧画面に変える。
これはコンピュータに基づく図だ。コンピュータの数値計算と画像処理を結び付けている。数値と同じように画像を得る—強力な結合だ。コンピュータは関数の実際の働きの実験を提供する。変数と値域はただの抽象概念ではない。自分で選ぶ。少し例を挙げる。
例 1 x = 3 のとき x³ と 3x は当然等しい。 これらのグラフは再び交わるだろうか? この問題で x が適当な値の場合を除いて 3x は完全には分からない。 (コンピュータも同じ。) x = 2 と 4 のときを調べると関数 x³ はどちらの場合も小さい: 2³ は 3² より小さく 4³ = 64 は 34 = 81 より小さい。x³ が常に 3x より小さいのであれば、分かるはずだ。—これらは数学の基礎的な関数である。
コンピュータは数値やグラフで答える。コマンドで x³ = 3x を解く。別のコマンドでは2つの関数を描画する—これはより詳しい。スクリーンは、われわれが逃したロジック (あるいは数学) の問題を解決する。グラフが1度交わるのならば、再び交わるはずだ— 3x は 2 と 4 で上にあるのだから。2.5の近くの交点は拡大によって見える。正確な数値よりも、その位置に興味がある。—x = 3 の後ろというよりは前だ。
このような基本的な例の結果:
3つめはあまり聞こえが良くない。別の表現をする: 数学を行いながら学ぶことができる。 微積分学を教える上で最も困難なことは観客を仕事に向かわせることだ。コンピュータはそれを可能にする。
例 2 (頭で計算) x² と 2x を比べる。関数は x = 2 で交わる。再び交わるのはどこか? 2 より前か後ろか?
これは頭の中の計算だ。たまたま答えが完全数 (whole number) である 4 になるので。今度は違うコースにいる。24 = 4² のような偶然はもう起こらないのか? マシンは完全数について教えてくれるだろうか? おそらく xb = bx の解を描画できるだろう。私はマセマティカ (Mathematica) に式を尋ねた。b の関数として x を見つけるのを期待して—しかしそのプログラムは式を与えただけだ。ただ使用者の代わりにHELP
を打ち込んだだけだ。
さて、数学は役立たずではない。私は微積分学を誇りに思っている。まだ見ていない完全数のために、6.4節の終りに新しい演習がある。
例 3 xb = bx の解がただ一つ (x = b) となるような b を求めよ。
b が 3 であるとき、2つめの解は 3以下だ。b が 2 であるとき、2つめの解 (4) は 2以上だ。b を 2 から 3 へ動かせば、「二重点(double point)」があるに違いない—その点でグラフはかろうじて触れるが交差はしない。この特定の—そしてただ一つの— b に対して、曲線 xb は bx を超えない。
この特別な点 b はコンピュータのグラフで求まる。あらゆる方法の中で、それは「微積分学の中心 (center point of calculus)」だ。 曲線が交差せずに触れるとき、それは接線である。二重点で同じ接線を持つ。微積分学は接線のために作られ、われわれは既に x² の傾きを知っている。すぐに xb も出る。そのうち bx の傾きを見つけ、微積分学のもっとも重要な数を明らかにする。
要点はこの点が実験によって初めて発見されたことだ。
例 4 グラフ y(x) = ex − xe の最小値を示せ。
次の例はドン・スモール氏 (Don Small) によって提案された。x4 − 11x³ + 5x − 2 = 0 を解け。最初の道具は代数学だ—この多項式を因数分解してみる。2次方程式では成功するが、それからはきわめて難しくなる。たとえコンピュータが我々より代数が出来るとしても、因数分解はとるべき方法ではない。現実的には2つの良い選択肢がある:
どちらもコンピュータが使えるだろう。どちらにも潜在的な問題がある! ニュートン法は速いが、それは失敗も速いということだ。 (大抵はもの凄い。) グラフを描くのも速い—しかし解はウィンドウから外れることもある。この特別な関数はかつてゼロだけだった。-10から10までの標準のウィンドウでは。グラフはゼロから離れていくようだが、数学は再び2つめの交点を予言する。だから拡大の前に縮小する。
ズームの利用はグラフで最良のものだ。変域と値域を選ぶだけでなく変えるのだ。ウィンドウは4つの数値で支配される。A≤x≤B と C≤y≤D が限界となり得る。2つの対角にある座標: (A, C) と (B, D) となり得る。中心点 (a, b) と大きさの要素 c と d となり得る。ズームボックスの対角をクリックするのが速い。中心を変えずに大きさだけ変えるのでなければ。 (もっと速くするにはデフォルトの大きさを使う。) 3.4節では discusses the センタリング (centering transform) と ズーム (zoom transform) を論じる—スクリーン上の画像の変化と関数における変数の変化だ。
例 5 x4 − 11x³ + 5x − 2 = 0 のすべての実数解を求めよ。
例 6 y = cos 40x and y = x sin (1/x) のグラフを拡大縮小せよ。見た感想を述べよ。
例 7 y = (tan x − sin x) ⁄ x³ は x = 0 でどうなるか? 小さい x ではそのうち tan x と sin x は分けられなくなる。y = 0 になるかもしれない。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.
例 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.
例 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.
例 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."
プログラミング 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.
例 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.
例 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.
例: 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 |