Beruflich Dokumente
Kultur Dokumente
R & D Publishing
Honolulu, Hawaii
May 7, 2001
Contents
Preface
Calculus Reform and Computers .
How To Teach From The Manual .
Advice For The Students . . . . .
Setting Up The Computer Lab . .
World-Wide Web Site For Our Lab
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
ix
ix
x
xiii
xiii
xv
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
1
2
3
4
5
6
6
8
9
12
14
16
17
18
20
21
22
1 Curve Sketching
1.1 Introduction . . . . . . . .
1.2 Working with Graphs . . .
1.3 Exponential vs Polynomial
1.4 Laboratory Exercises . . .
2 The
2.1
2.2
2.3
. . . . .
. . . . .
Growth
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
25
25
26
29
32
Derivative
37
The Derivative as a Limit of Secant Lines . . . . . . . . . . . . 37
Local Linearity and Approximation . . . . . . . . . . . . . . . 41
Laboratory Exercises . . . . . . . . . . . . . . . . . . . . . . . 44
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
4 Curve Fitting
4.1 Introduction . . . . . . . . . . . . . . . .
4.2 Fitting Polynomials to Data Points . . .
4.3 Exponential Functions and
Population Growth . . . . . . . . . . . .
. . . . .
. . . . .
. . . . .
Chaos
. . . . .
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
47
47
47
49
50
52
55
. . . . . . . . . . . . 55
. . . . . . . . . . . . 55
. . . . . . . . . . . . 60
. . . . . . . . . . . . 61
. . . . . . . . . . . . 63
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
69
69
69
73
78
86
89
6.4
6.5
6.6
7 Taylor Polynomials
7.1 Polynomial Approximations . . . . . .
7.2 Examples . . . . . . . . . . . . . . . .
7.3 Taylors Theorem with Remainder . . .
7.4 Computing the Sine Function . . . . .
7.5 Computing the Exponential Function. .
7.6 Taylor Expansions About x = c . . . .
7.7 Interval of Convergence . . . . . . . . .
7.8 Laboratory Exercises . . . . . . . . . .
8 Series
8.1 Introduction . . . . . . . . . .
8.2 Geometric Series . . . . . . .
8.3 Applications . . . . . . . . . .
8.4 Approximating Infinite Series
8.5 Laboratory Exercises . . . . .
9 Approximating Integrals
9.1 Introduction . . . . . . . . .
9.2 The Basic Error Estimate .
9.3 The Logarithm Series . . . .
9.4 An Integral Approximation .
9.5 Laboratory Exercises . . . .
10 Polar and Parametric Graphs
10.1 Introduction . . . . . . . . .
10.2 Polar Coordinates . . . . . .
10.3 Rotating Polar Curves . . .
10.4 Complex Numbers . . . . .
10.5 Parametric Curves . . . . .
10.6 Laboratory Exercises . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
109
. 109
. 110
. 115
. 116
. 118
. 120
. 122
. 124
.
.
.
.
.
131
. 131
. 132
. 133
. 137
. 147
.
.
.
.
.
153
. 153
. 154
. 154
. 156
. 158
.
.
.
.
.
.
161
. 161
. 161
. 164
. 166
. 167
. 172
11 Differential Equations
11.1 Introduction . . . . . . . . . . . . . . . .
11.2 Examples . . . . . . . . . . . . . . . . .
11.3 Approximation of Solutions . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
177
. 177
. 177
. 182
. 186
. 187
. 191
.
.
.
.
.
195
. 195
. 196
. 198
. 206
. 211
A Utility Files
217
A.1 The Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
A.2 Listings of the Utility Files . . . . . . . . . . . . . . . . . . . . 223
B DfW Version 5
227
B.1 Whats New In DfW5 . . . . . . . . . . . . . . . . . . . . . . . 227
List of Figures
Part of M206L World-Wide Web page . . . . . . . . . . . . . . xvi
0.1
0.2
0.3
0.4
0.5
0.6
0.7
1.1
1.2
1.3
2.1
2.2
3.1
3.2
4.1
4.2
4.3
5.1
5.2
5.3
5.4
5.5
5.6
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
complex
. . . . .
.
.
.
.
.
.
.
.
.
.
.
.
4
10
11
14
15
18
19
70
73
82
83
84
. 85
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
111
113
114
118
120
122
123
Polar Coordinates . . . . . . . . . . . .
Plotting points in polar coordinates . .
Showing that y = 1/x is a hyperbola .
Parametric plot of a semi-ellipse . . . .
More parametric plots . . . . . . . . .
The cycloid curve and the rolling wheel
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
162
163
165
168
171
175
11.1
11.2
11.3
11.4
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
183
185
187
189
12.1
12.2
12.3
12.4
12.5
12.6
The pendulum . . . . . . . . . . . . . . . . .
Spring motion starting at different positions
Under Damped Oscillations . . . . . . . . .
Euler and the 2nd Runge-Kutta methods . .
Rabbits and Foxes . . . . . . . . . . . . . .
Pendulums . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
197
203
205
208
210
212
Preface
Calculus Reform and Computers
This lab manual is the result of more than a decade of experimenting with the
use of computers as an enhancement to learning calculus. In the beginning we
were working with Albert Rich and David Stoutemyer, founders of the Soft
Warehouse Inc. here in Honolulu, and their muMATH computer program.
This program was the precursor to Derive. It was a PC-version of the big
mainframe computer program macsyma. They could symbolically integrate,
differentiate and do other calculus type problems. There were no menus or
graphics at that time, so we developed a small enhancement program which
included these features and distributed it to several university mathematics
departments in the United States and elsewhere.
This effort took place in the middle to late 1980s. Since then, there has
been a national movement to include computers in the teaching of calculus
and in fact to reform the teaching of calculus by discussing new ideas using
not only the traditional algebraic approach but also by exploring the ideas
graphically and numerically. In response to this movement, new computer
programs were written such as Derive, Mathematica and Maple. Computer calculus labs were created at most universities and colleges to take
advantage of this new technology and to start experimenting with new ideas
for teaching calculus.
Calculus textbooks are now starting to include substantial supplements
on computer experiments and some have been completely rewritten to involve
computers as an integral component of the course. It is hard to say right now
what calculus instruction will look like in ten years but there is no doubt that
computers are completely changing the teaching approach to certain topics
with intensive use graphics or computation components.
In this book we try to highlight those areas of calculus, which are best
ix
is also a brief review of the algebra of complex numbers and applications of Newtons method to finding complex roots to polynomials. A
discussion of fractals and chaos is given toward the end of the chapter.
Chapter 6 discusses the various methods for numerically approximating
integral and a comparison of the rates of convergence. The last section
shows how to derive Simpsons method using the tools from Chapter 4.
Chapter 7 introduces Taylor polynomials as a means of approximating
trigonometric and exponential functions. Pattern recognition is used to
suggest infinite series representations. Emphasis is given to the analysis
of the error and how many terms are needed to achieve a given accuracy.
Graphical methods are used to discuss the interval of convergence in
an elementary manner.
Chapter 8 introduces infinite series and gives several applications of the
geometric series. There are discussions of the error that results when a
series is approximated by its partial sums.
Chapter 9 combines the techniques of both Taylor polynomials and
infinite series to discuss on the approximation of integrals using Taylor
polynomials. As an application, the representation and approximation
of the logarithm function is studied.
Chapter 10 shows how to plot polar and parametric curves. There are
discussions of rotations of graphs, speed of particles traveling along a
parametric curve and some connections with complex numbers.
Chapter 11 is a basic treatment of first order differential equations.
Population growth models and Newton cooling are used as motivating
examples. Graphical representations using slope fields and the Euler
approximation method are discussed.
Chapter 12 discusses second order linear differential equations with
constant coefficients such as the mass-spring system. The chapter ends
with a treatment of the Runge-Kutta method of approximation.
The latest versions of these files are available for downloading from our
web site at: http://www.math.hawaii.edu/CalcLabBook/
Chapter 0
Introduction and Derive Basics
0.1
Overview
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, ana1
lyzing 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.
This manual assumes that you will be using Derive for Windows (DfW)
Version 4. The recently released DfW Version 5 (DfW5) can also be used but
there have been some changes to the menus and buttons that we try to point
out using footnotes. See also Appendix B for more information on Version 5.
0.2
Starting Derive
you click the Author menu and then click Expression. In this manual we will
indicate that two step combination by simply Author/Expression.1
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 Enter (the return key) and Tab. Most of Derive has easy to
use menus and buttons which we will described below. It only takes a few
minutes of practice to become capable at using DfW. You can skim over this
section now or then come back to it later as the need arises.
0.3
Entering an Expression
In DfW5, authoring has been improved and simplified but the above methods still
works. See Appendix B for details.
Table 1:
You enter:
You get:
(1)
25
25
(2)
x^2
x2
(3)
a^2x
a2 x
(4)
a^(2x)
a2x
(5)
sin x
sin(x)
(6)
sin a x
sin(a)x
(7)
sin(a x)
sin(ax)
(8)
(5x^2 - x)/(4x^3 - 7)
5x2 x
4x3 7
(9)
(a + b)^(1/2)
(a + b)
(10)
0.4
(a + b)1/2
(a + b)
In DfW all the special characters are on the author form and you just click
on them to enter them in an expression. There are also key equivalent such
as pi for and #e for Eulers constant2 e which is displayed by Derive as
e.
0.5. EDITING
0.5
Editing
Suppose that you author an expression, click OK and then observe that you
typed something wrong. To enter a correction you would click the
button again and then click the right mouse button. A menu opens up with
several options, one of which is Insert Expression.3 Clicking this option puts
the highlighted expression of the current algebra window into the author box.
You edit this expression as you would in any windows program. That is you
position the cursor either by clicking or using the arrow keys. By highlighting
or selecting a subexpression and typing you replace the selected text with the
new text. One can use the Edit/Copy Expressions4 menu or Cntl-C to place
a highlighed expression from any algebra window onto the clipboard and
then in the authoring form right click the mouse and click Paste to copy the
clipboard contents. The simpler method of just right clicking the mouse and
then Insert is the best way as long as your expressions are in a single window.
There is also an option for inserting the expression enclosed in parenthesis.
A key equivalent to these techniques is to press either the F3 or the F4 key.
You select or highlight expressions in the algebra window by clicking on
them. For more complicated expressions you can click several times until the
desired subexpression is selected. This requires a little practice but you can,
x2
by clicking on
for example, select the x + 2 part of the expression sin x(x+2)
it 4 times (each click takes you deeper into the expression).
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)/x2 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
3
In DfW5 you click in the Author box first and then right click Insert. A new feature
is to right click the erroneous expression, choose Edit and press the Enter key after you
make the corrections.
4
This is simply Copy in DfW5.
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.
0.6
0.7
Solving Equations
Expression/Action
Type:
Menu:
#e
pi
inf, -inf
sqrt(x)
,
The square sign:
ln x, logb x
ln x , log(x, b)
Calc/Differentiate
dif(f(x), x, n)
Calc/Differentiate
int(f(x), x)
Calc/Integrate
int(f(x), x, a, b)
Calc/Integrate
Simplify an expression
Simplify
Approximate
Simplify/Approx
Esc-key
Tab-key
N, H-key
Click expression
F3 , F4 with ( )s
(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 by using the SOLVE function. To do this we highlight
. If you forget the function
the equation, say x2 x2 = 0 and click the
of a button just hold the cursor on it and a brief explanation will appear.
An alternate method is to choose Solve/Algebraically from the drop down
menu. 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., x2 + 1
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 x = m 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 2).
Finally, the simple equation sin x x2 = 0 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 x 1. In order to approximate this
solution we need to choose Solve/Numerically.6 You will then be asked for a
range of xs (initially it is the interval [10, 10]). Since there are (at least)
2 solutions in [10, 10], you 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.
Note that Solve/Numerically will only give one solution (or none if there
are none) even if the interval you choose cantains several solutions. To find
additional solutions you need to use Solve/Numerically again but with an
interval avoiding the first solution.
0.8
Substituting
If you have an expression like x2 + 1/x and you want to evaluate this
with say x = 3 or if you solved an equation f (x) = 0 and you want to
substitute that value of x back into f (x), you start by highlighting the desired
6
In DfW5 you choose Solve/Expression and then select the Numerically solution
method option.
0.9. CALCULUS
0.9
Calculus
This menu item is very important for us. After choosing the Calculus drop
down menu, you get a submenu with Limit, Differentiate, Taylor series,
Integrate, Sum, Product, and Vector. There are also buttons for most of
these operators. After you have authored an expression, you can differentiate it by either clicking the
button or choosing Calculus/Differentiate
from the drop down menu. The form will have entries for what variable to
use and how many times to differentiate, but it usually guesses right so you
can just click OK. Then simplify.
To integrate an expression, first author it or highlight it if it is already
button or else choose
in the algebra window, then either click the
Calculus/Integrate. The form will have entries for what expression to integrate; it will guess you want to integrate the highlighted expression. It will
have an entry for what variable you what to integrate with; again it will probably guess right. It will also have entries for the limits of integration. If you
want an indefinite integral, just click the appropriate button and click OK.
For a definite integral click the appropriate button, type in the upper/lower
limit, then click OK. See Figure 0.2 on the next page for several examples
using Differentiate and Integrate on the Calculus menu.
The options Calculus/Limits is similar to the above. To find
x2 1
x1 x + 1
lim
10
ai = a1 + + an
i=1
and
n
Y
ai = a1 an .
i=1
ai = a1 + + an .
i=1
P
The symbol on the left, ni=1 ai , is read as the sum of ai as i runs from 1
to n. Often ai is a formula involving i. So
5
X
i=0
i 2 = 02 + 12 + 22 + 32 + 42 + 52 = 55.
0.9. CALCULUS
11
or using the
. Fill
Sum option on the Calculus menu. Just author i^2 then click
in the required variable i along with the starting value 0 and end value 5.
Simplify to get 55.
P As an interesting aside, edit the above sum and have
Derive Simplify ni=1 i to get the formula:
n
X
i=1
i=
n(n + 1)
.
2
xi = x x2 x3 = x6 .
i=1
12
0.10
Plotting
Supposed you want to graph the function x sin x. You simply author the
expression, by clicking the pencil button
, to be plotted and then
click the
button
bar will change to a new set of buttons. You then click the
again (its position is different in the plot window) and the graph will be
drawn. There are several different ways to view the algebra and plot window
together. The one we used to produce the pictures in the manual is to first
select the algebra window (if you are currently in the plot window you can
button) and then choose
go to the algebra window by clicking the
Window/Tile Vertically from the menus. 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
have several plot windows associated with a single algebra window but you
cannot plot together expressions from different algebra windows. You can
switch windows by either clicking the top strip of the window or clicking the
or
buttons. Actually you can click anywhere in the window to
select it but the top strip avoids changing the highlighted expression in the
algebra window or moving the cross in the plot window.
You can plot several functions in the same plot window. Move to the
algebra window, highlight the expression you want to plot, switch to the plot
in the plot window. Now both expressions
window and then click the
will be graphed. You can plot as many as you want this way. The plot
window also has a menu option, Edit/Delete Plot, for removing some or all
of the expressions to be plotted. Pressing the Delete-key also removes the
current plot.
When you plot, there is a small crosshair in the plot window, initially at
the (1, 1) position. You can move the cross around using the arrow keys or
by clicking at a new location. The coordinates 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. In order to center
the graph so that the cross is in the center of the window, click the
button. This is useful for zooming in and out to get a better view of the
graph. There are several buttons for doing this in the plot window. Take a
, and for zooming
look and you will see a button for zooming in, namely
0.10. PLOTTING
13
and various ways of changing just the x-scale or just the y-scale.
out
You should try clicking these buttons to see exactly what happens.
In general, these buttons change the scale of the plot window by either
button7
doubling or halving it. You can customize these by using the
(thats a picture of a balance scale). Just click this button and fill out the
form the appears with your own numbers. You can see the current scale at
the bottom of the screen.
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 square brackets. For example, plotting the
expression [x, x^2, x^3] will graph the three functions: x, x2 , and x3 .
In order to plot a collection of individual points one enters the points as a
matrix, for example authoring the expression [[-2,-2], [0,-3], [1,-1]]
and then plotting it will graph the 3 points: (2, 2), (0, 3) and (1, 1).
A quick way of authoring a vector is to use the
This functionality has been replaced in DfW5 with the Set/Plot Region and Set/Plot
Range menu options.
8
The default is for points to be connected but if data points are to be plotted then it
is usually best to select No.
14
0.11
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) = x2 + 2x + 1, for example,
you could Author f(x) := x^2 + 2x + 1. Note that we use := for assignments and = for equations. Alternately, you could choose Declare/Function,
and then fill in the form with f(x) for the function name and x^2 + 2x +
1 for its value. Derive will then enter this as above with the :=-sign. See
Figure 0.5 on the facing page.
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 are names
like gravity. This can be done by declaring the variable, for example, to
use the variable x1 we author x1:=. Now any use of these letters will be
15
n = 1, 2, . . .
16
0.12
0.13
17
2x + 1 for x < 1
f (x) = x2
for 1 x 2
4
for 4 < x
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 limx1+ f (x)
(should get x2 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.6 that the function y = f (x) is continuous at all
x 6= 1. 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
0 for x a
CHI(a, x, b) = 1 for a < x < b
0 for b x
Then except for x = 1 our function f (x) above satisfies:
18
0.14
Vectors
Vectors are quite useful in Derive, even for calculus. They are also useful
in plotting. To enter the 3 element vector with entries a, b, and c, we can
Author [a, b, c] directly. It is important to note the square brackets which
are used in Derive for vectors; commas are used to separate the elements.
An easier approach is just click the
button and fill in the three values
on the vector input form.
Derive also provides a useful function for constructing vectors whose
elements follow a specific pattern. 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
0.14. VECTORS
19
20
0.15
You can save the expressions in an algebra window to either a floppy disk
or the hard drive and come back later to continue working on them. Unfortunately, the plot windows are not saved10 but the pictures can be put on
the clip board and saved as graphics files using suitable graphics software.
To save to a floppy, put a the diskette in say the A: drive and activate the
algebra window that you want to save. Click File/Save As and fill out the
menu of options with the drive A: and a file name such as Lab5 or just save
to A:LAB5 and enter. Derive will add the extension .MTH11 to indicate
that this is a file consisting of Derive expressions. After the file has been
saved you can update it by simply pressing the
button.
You will most likely save your files to the network harddisk. For example,
suppose your network harddisk is the H:-drive. To save a file, just refer to it
as say H:LAB5 or switch to the H:-drive and view your files.
Later, you can recall these expressions by using either the File/Open
or File/Load/Math options. The second method is used primarily to add
10
In DfW5 plots can be embedded in the algebra window and are saved along with the
expressions using the new DFW file format.
11
DfW5 has added a new file format with the DFW extension. The MTH files can still
be used.
0.16. HELP
21
expressions to an existing window. If you forget the name of your files just
type either A: or H: and press the enterkey to see 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 unneeded
can be used for
entries and clean up the file. The three buttons
this purpose. For example, if you select several expressions by say dragging
the mouse pointer over them with the left button held down and then press
button these expression will be removed. Clicking
will undo
the
the last delete. You can move a block of highlights lines by holding down
the right mouse button and dragging the block to a new location. Of course,
when you delete or move some lines then the line numbers will no longer be
in a proper sequence of #1, #2, . . . . You can correct this by pressing the
renumbering button
. You should practice these commands on some
scratch work to make certain you understand them.12
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.". Then,
move this comment to the appropriate location.
You can print all the expressions in the algebra window (even the ones
you cant see) by pressing the
. Typically,
print a graph. Just activate the plot window and press
students turn in the labs by printing out the algebra window and penciling in
remarks and simple graphs. More extensive graphs can be printed out. Some
combination of hand writing and printouts should be the most efficient.13
0.16
Help
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.
12
DfW5 has changed the methods for moving expressions, correcting expressions and
adding comments. See Appendix B for details.
13
The new functionality of embedded graphics in DfW5 allows for more flexibility in
these matters.
22
0.17
Common Mistakes
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?
Q1. I tried to plot the line ax + b and instead I got an error message about
too many variables. What did I do wrong? You must define a, b
to have numerical values, otherwise Derive treats your function as
f (a, b, x) which it cannot plot.
Q2. I tried to plot the family of parabolas x2 + c and I got an error about too
many variables. What did I do wrong? Same problem as above, except
now Derive is trying to plot a surface z = f (x, c)in 2-dimensional
space. You probably want to enter and Simplify a vector of functions
such as
VECTOR(x^2 + c, c, 0, 4).
Now Plot this vector of 5 functions: x2 , x2 + 1, x2 + 2, x2 + 3, and x2 + 4.
23
24
Chapter 1
Curve Sketching
1.1
Introduction
26
1.2
27
and the Plot Window appears. Notice that there are a different set of buttons
at the top. The most important ones are the plot button
, the various
which doubles the scale in each direction and
zoom buttons such as
which centers the plot on the cross. The
the cross buttons such as
cross is the little reference point whose coordinates are shown in the lower
left corner of the DfW window. You move the cross by either pointing and
clicking or else using the arrow keys.
Clicking the
See Section 0.14 on page 18 for more information about the vector function
28
at 1 although in other examples you might want to change this. Press OK.
Next we need to simplify the resulting expression
VECTOR( SIN(x) + c, c, -2, 2)
button or by using the Simplify menu. The button
by clicking the
method is faster. With the vector of five expressions highlighted, click the
button twice and all five graphs are plotted. One problem with this
technique is that you cant see the pattern, i.e., each successive graph is
shifted up one unit. On the other hand, we can compute the 5-vector above
and plot the individual elements in the vector by clicking on them and then
plotting. This way you can plot say the first two or three until you see the
pattern and then plot the entire vector to plot the rest.
Another interesting technique is to define our function f (x) = sin x. But
unlike a Calculus text that uses the equal sign both for equations and definitions in Derive we need to make a distinction. You must remember that
the := symbol is for assignment whereas the = sign is used for equations and
comparisons. To make a definition we author f(x):=sin x. We can then
enter expressions such as f(x)+c which clearly shows the modifications we
have in mind. Many other options are also possible; for example, editing
the vector formula above by replacing the expression with f(x + c)gives
an interesting result upon graphing. See if you can see a traveling wave in
the plot window. Is it traveling from left to right or right to left?
Warning You can change the function definition by simply Authoring f(x)
:= with a new expression. One problem with making definitions is that you
tend to forget them, especially as you move on to a new problem. Thus, if you
use the same letter f (x) in every problem you will definitely have problems
and get confused as to the current definition of the expression f (x). A good
strategy is to use definitions as little as possible and only when necessary.
Use different letters, say f1(x):= for the first problem and f2(x):= for the
second, and so on. You might also want to eliminate a definition as soon
as you are done with it. It is important to note that once you define a
function by this method it will not go away if you simply erase that line
from your algebra window because it is in the computers memory. The
way to completely remove a definition using the letter f is to author the
expression f:=. This gives f an empty definition.
29
You might note that after you have defined a function in Derive it
thereafter is displayed with uppercase letters. This is just a visual cue and
it is not necessary to type expressions using uppercase letters2
1.3
Suppose we want to compare the behavior of the function x4 and with the
exponential ex . For example, suppose we want to know which function grows
the most as x gets large. If we graph x4 we see it has the same basic shape
as the parabola x2 (you probably guessed this). It is a little flatter than the
parabola between 1 and 1 and it grows more quickly for |x| > 1.
If we now graph ex (be sure to use the special symbol e and not the
letter e) on the same graph and zoom out once, we see that the graph seems
to get close to the xaxis as x gets larger in the negative direction (as x
approaches ); that it crosses x4 at least twice; and it grows quickly when x
is positive, but not as quickly as x4 ; see Figure 1.2 on the next page. One
way to verify that the xaxis is a horizontal asymptote of ex is to highlight
ex in the algebra window and choose Calculus/Limit and enter -inf for the
Point, as we did in Figure 1.2.
To see where the curves cross we need to solve the equation x4 = ex . There
are several ways to attack this problem. The most obvious is to simply look at
the graph and estimate the coordinates of the intersection points. Using the
cross is most helpful for this because we can click on the point of intersection
and read off the coordinates in the Plot Window. The arrow keys can also be
used to more precisely position the cross. Further accuracy can be obtained
button and then zooming in
by centering on the cross by clicking the
button.
several times by pressing the
In order to get an exact solution to an equation we return to the Algebra
button. Note that the little icon is a magnifying
Window and use the
glass. For example, a simple quadratic equation such as x2 + x 2 = 0 can
solved in this manner by entering the equation in the solve form and setting
the variable to x. Pressing OK and then simplifying by clicking the
button yields the two answers in a vector:
[ x = 1, x = -2] .
2
lab.
Derive does have a special mode in which case matters but we dont use it in the
30
In DfW5 you choose Solve/Expression and then select the Numerically solution
method option.
31
Are there any other solutions? It is pretty clear that there are no other
solutions for x < 0 but what about large x? From the graph it appears that
x4 grows much faster than ex . But of course ex has exponential growth so
perhaps ex > x4 for large enough x. To test this we try zooming out several
times in the Plot Window by clicking
. But both functions grow very
quickly and it is a little difficult to be successful with this method. Back in
the Algebra Window we can try to numerically solve x4 = ex for larger x.
If we choose the interval to be 2 to 20, we get the solution x = 8.61316.
So the graphs cross at this point. To find the y value of this point, we
to substitute 8.61316 into x4 . The result
use the substitute button
approximates to 5503.64.
To see this on the graph we need to zoom out once so that the xscale
includes x = 8.61316. Then we need to zoom out on the yaxis without
zooming out on the xaxis. The need to do this is why there are those
extra zoom buttons. After zooming out several times we obtain the graph
of Figure 1.3. Another approach is to use the Set/Scale menu and enter an
x-scale of 5 and a y-scale of 5000.
32
There are a couple things this demonstration shows. First that in order
to see the important features of a graph it may take some skill at moving
around and manipulating the scale of the graph. Moreover, even though we
can clearly see the two graphs intersecting at x = 8.61316 in Figure 1.3, we
can no longer see the other two solutions. So it may not be possible to see
all the important features in one plot. In the exercises you will learn how to
move and scale in the plot window and to use the algebra window in order
to find all the important features of one or more graphs.
1.4
Laboratory Exercises
33
34
your graphs show the main features such as the x and yintercepts, the
critical points, and the inflection points.
3x
4x2 + 1
a.
sin(x) cos(20x)
b.
c.
1
1 + 5000(x 1)2
d.
x sin(1/x)
x6 + 3x5 + x4 + 1
2x4 1
2x3 + 6x2 3x + 5
4x2 6x 7
a. Graph g(x) so that your graph shows the main features of this
function.
b. This graph has a slant asymptote, i.e., an asymptote which is a
line with nonzero slope. Zoom out a few times until you can see
this slant asymptote.
c. Find the formula for the slant asymptote by using Simplify/Expand.
*11. In reading this chapter you might have wondered if ex and x4 intersect
some place beyond c = 8.61316 . You could use Derive to verify
35
that there is no solution say between 8.7 and 100 and this would be
strong evidence that they dont intersect beyond c, but not a proof. So
in this problem you are to find a proof that ex and x4 dont intersect
beyond c (without using Derive). Hint: By taking 4th roots we must
show ex/4 > x for all large x. Now using Calculus, show that the slope
of ex/4 x is positive for all x 8, i.e., the derivative is positive. Use
this to show ex > x4 for all x > c.
36
Chapter 2
The Derivative
2.1
38
39
If the drawing is too quick to see the animation, try the following method
instead. Erase the 5 secant lines in the plot window by pressing the Del key
5 times. In the algebra window select an individual line in the vector by
.
repeatedly clicking on it. Then, activate the plot window and press
Finally, repeat this process several times to see the pattern evolving in the
plot window; namely, that the lines are rotating about the point (1, 13 ) on
the graph. Moreover, the lines appear to be tending to the tangent line.
In Figure 2.1 on the preceding page this pattern is clearly shown: the
secant lines tend to the tangent line by rotating in a clockwise manner, i.e.,
with decreasing slope. We can use Derive to illustrate this effect using
calculus. That is, as h tends to 0, the secant line tends to the tangent line
by taking the limit: Author SL(1,h) and choose Calculus/Limit, taking the
variable to be h (not x). After Simplifying we get
2
3x 2
=x .
lim SL(1, h) =
h0
3
3
3
which, in fact, yields the tangent line to x /3 at x = 1. Check this out for
yourself by plotting this function on your previous graph. Since the slope
of the secant line is (f (a + h) f (a))/h, this explains why we define the
derivative as
f (a + h) f (a)
(1)
f 0 (a) = lim
h0
h
and why the derivative is the slope of the tangent line.
A quicker way of entering the 5 lines above is to observe that there is
a pattern to the values 1, 12 , 14 , . . . ; namely 21n for n = 0, 1, . . . , 4. We can
use this fact and the VECTOR function on the Calculus menu to simplify this
task. Select Calculus/Vector and enter SL(1,1/2^n) in the form. Note that
using uppercase letters is not necessary and that the highlighted expression
will be replaced with whatever you type. For the Variable, scroll down and
select n. Next we take the Starting value to be 0 since 20 = 1 and the Ending
value to be 4 since 24 = 16. Click OK and simplify the resulting expression
VECTOR(SL(1, 2^-n), n, 0, 4). The result is a vector of five secant lines
as above. You will find that this is a convenient method of producing a large
number of expressions without typing them individually.
We can later change the definition of f (x) to a different function and
use the SL(a, h) function to get secant lines to the new function. The file
F-SECANT.MTH contains the definitions of SL(a, h) and the tangent line
function, TL(a), discussed below.
40
Tangent Lines In order to get a function TL(a) for the tangent line at a
analogous to the secant line function SL(a,h), we need to be a little careful
since the most obvious definition; namely,
TL(a) := F(a) + DIF(F(a),a) (x - a)
doesnt work. This is because the order of evaluation is wrong. Consider
what would happen if we evaluated TL(5). First 5 would be substituted for
a and then the resulting expression,
F(5) + DIF(F(5),5) (x - 5),
would be evaluated. But DIF(F(5),5) doesnt make sense.
To solve this problem and to keep thing as simple as possible we use a
special utility file ADD-UTIL.MTH. This file contains several new functions
that we will be using for now on and so we suggest adding a few lines to start
of every DfW session. This can be done by Opening or using Load/Math on
the file ADD-HEAD1 Once this has been done, these new functions can be
used. See Appendix A for a more detailed explanation.
For example, the function SUBST(u, x, a)2 simplifies the expression u
and then substitutes the value a for x in u. The three variables in the SUBST
function are the expression, the variable and the evaluation point. It has the
button to replace
same effect as first Simplifying u and then using the
x with a.
To define the TL function we first make a function DF(x) of the derivative
and enter F(u) with the variable set to
using the SUBST function. Click
and type in SUBST(). Then,
u. With this expression highlighted click
click in-between the parenthesis and insert the derivative by right-clicking and
selecting Insert from the menu. Finally, type in next two arguments u and
x separated by commas to complete the three arguments for this function.
1
All DfW4 files have the MTH extension although sometimes Windows doesnt explicitly show the file extensions. However, DfW5 has added a new file format with the DFW
extension which allows for the inclusion of graphics. The MTH files can still be used. The
default extension used when Saving or Opening files depends on the version with DfW5
using the newer format. In this manual we usually drop the reference to the extension
since it is assumed to be MTH.
2
This function was added to DfW5.
41
2.2
One of the important properties of a function is that its graph can be approximated near a value x = a, or more precisely near the point (a, f (a)) on
its graph, by the tangent line at that point. This means that as you zoom
in closer to the point, the graph appears to be getting closer to the tangent
line. Typically, the graph and the tangent line are eventually so close together that they are plotted as the same curves. This local linearity is very
useful in many applications. To see this local flatness in action, move the
crosshair in the plot window we obtained above to the point (1, 1/3) where
all the lines intersect, then center on the cross by clicking the
button.
42
button.
Notice how flat the curve appears. Try clicking The zoom out button
several times and then repeating to completely visualize this process.
Approximating the Sine Function One of the most important functions
in calculus is sin x and yet, with the exception of a handful of points such as:
, ...
sin 0 = 0, sin = 1, sin =
2
4
2
we need either a calculator or Derive to obtain approximate numerical
values. For example, Author sin( 13 ) and press the
button. Derive
does nothing with this expression other than to repeat it. On the other
button and we get the approximate numerical value
hand, pressing the
sin( 13 ) 0.327194.
To use local linearity we need to compute the tangent line at say a = 0
by authoring (make sure you Loaded ADD-HEAD) our new function
TANGENT(sin x, x, 0) .
The answer is y = x. You should verify this visually by plotting sin x and x
together on the same graph. Now center the cross at the origin and zoom in
several times. On the other hand, using the formulas
d
sin x = cos x and
dx
sin 0 = 0, cos 0 = 1
we can easily derive the above formula for the tangent line.
The point is that we now have a powerful tool for approximating the
values of sin x as long as x is small; namely,
sin x x for x 0 .
Looking back at our sin( 13 ) example above, we see that this simple technique
has given a result which is accurate to roughly 2 decimal places.
We can also use the above approach to approximate the derivative of a
function and plot the result. For example, we know that the derivative of
f (x) = x3 is 3x2 by using the standard formulas. On the other hand, the
(x)
with h fixed at some value like h = .01
function of x, g(x, h) = f (x+h)f
h
43
is a good approximation to 3x2 as one can see from Figure 2.2. The figure
actually shows both plots although they appear to be only one curve. In
Derive you should enter and Simplify the above expression (it sometimes
helps to Expand the result to further simplify it). Then compare the graph
with 3x2 by plotting both expressions together.
44
visually: plot the functions
sin(x + h) sin(x)
and cos x
h
for some small value of h, say h = .01. Can you tell the difference in the
graphs?
2.3
Laboratory Exercises
Start off your lab by Loading the ADD-HEAD file (use File/Load/Math).
Note that the syntax of the SECANT and TANGENT functions are displayed on
the second line of the ADD-HEAD file.
1. For each functions f (x) below
(i) Plot the graph y = f (x).
(ii) Use the function TANGENT(u,x,a) to calculate the tangent lines
at the points a = 0, 2.
(iii) Plot these tangent lines and turn in a sketch. Label the approximate slope of each tangent line by visual inspection.
(iv) In the Algebra Window, compute the derivative f 0 (x) and use the
button to plug in the values a = 0, 2.
(v) Determine the exact slope of each of these tangent lines using part
(v) and compare with your estimate for part (iii).
2.
x
2
a.
c.
1 2
x x
2
b.
1
2x x2
2
d.
sin x
3
x at a = 8. Estimate
b. In
part
a
you
found
the
tangent
line
to
3
9 by finding the yvalue of this line when x = 9. Compare your
answers with DfWs own approximation to this quantity obtained
button.
by clicking the
45
Simply Author the expression GM:=4.002 10^14 and similarly for RAD.
The horizontal scale should reflect the value of RAD and the vertical scale can be
determined from the numerical value of a(RAD)
4
46
button.
e. Make a new graph of f (x) and by zooming in several times convince yourself that f 0 (x) oscillates wildly between approximately
1 as x approachs zero.
Chapter 3
Basic Algebra and Graphics
3.1
Introduction
3.2
As an example, consider the function f (x) = 2x4 3x3 . In order to understand the behavior of this function we can plot it using Derives plot window
(see Section 0.10 for instructions on plotting.). The resulting graph can be
seen in Figure 3.1 on the next page. The graph suggests f (x) has one local
minimum which is the absolute minimum. Using the crosshair in the plot
window (see Section 0.10) we can determine that the location of the minimum
point has coordinates approximately given by x = 1.125 and y = 1.0625.
We can get exact results by switching to the algebra window and doing some
47
48
49
3.3
Max-Min Problems
The typical max-min problems requires finding either the absolute maximum
value or the absolute minimum value of a function, f (x), on an interval
a x b. Our first step is plot the graph. We want the x-values to contain
the interval [a, b] but not much larger. The y-values need to scaled in such
a way that we get a clear picture of the largest and smallest values. If the
function takes on negative values then the absolute minimum will be the
largest negative value (the lowest point on the graph in any case).
Using either the crosshair for precise approximations or just using the
labels on the y-axis to obtain a rough answer are both good first steps to
solving the problem. To obtain exact answers we need calculus and critical
button to calculate
point theory. In the Algebra Window we use the
button to find the critical points from the
f 0 (x). Next we use the
0
equation f (x) = 0. Once that value is found it can be substituted back into
the expression for f (x) by pressing the
Three problems arise:
button.
50
First we are only interested in those points x which lie on our interval
[a, b]. It probably will be necessary to obtain decimal approximations
to our critical points x to see if they satisfy a x b.
The second problem is that the absolute maximum may not occur at
the critical points at all. Instead, it occurs at either the left or right
endpoint, i.e., x = a or x = b. This situation should be clear from the
graph.
The third problem is that perhaps Derive can not solve the equation
f 0 (x) = 0. As you look at the graph, you should be able to guess the
critical point, at least approximately. Then you can ask Derive to
approximate the critical point by using the Solve/Numerically1 menu.
You will need to specify an interval on which Derive will search for
a solution. But this should be obtained by again looking the graph
and choosing a convenient interval containing the approximate critical
point. Choosing too big of an interval can get you into trouble because
Derive may end up finding a solution which is not the one you want.
You would then need to refine your interval to exclude the undesired
critical points.
3.4
In DfW5 you choose Solve/Expression and then select the Numerically solution
method option.
51
which button does this? Another way is change the scale, say x = 100 (click
the button with the balance scale on it). Use the cross-hair to estimate the
value of y that g(x) is tending to for large x. You should get y = 3 (see
Figure 3.2).
. We want to verify
. When
that limx g(x) = 3. Now choose Calculus/Limit or click
asked for the point, type in inf or click symbol on the form. Simplify the
answer; you should get 3. This means that as x gets large, g(x) approaches 3,
i.e., the line y = 3 is a horizontal asymptote. We can check this calculation
by the method of polynomial division which is accomplished in Derive using
the Expand option. As we see at the bottom of Figure 3.2,
8
3x3 + 5x2 x + 1
=3+
+
3
x 1
3(x 1)
where all the terms other than the 3 are small near x = . This is because
the denominator of each term has a larger power of x than the numerator.
52
(The answer above is too wide for the window to display completely so you
will need to scroll to see the 3. Use the horizontal scroll bar at the bottom
of the window to do this.)
3.5
Laboratory Exercises
a.
c.
1 2
x x
2
b.
1
2x x2
2
d.
sin x
53
d. In the algebra window find the derivative f 0 (x) and use it to find
the exact coordinates of the local minimum you approximated in
Part (a). (This will give you the critical value x; to get the y
coordinate substitute the value of the xcoordinate into f (x) by
or by using the Simplify/Substitute/Variable menu;
clicking
see Section 0.8.)
3. Consider the class of all function of the form f (x) = x3 + bx2 + cx.
a. Author the expression form x3 + bx2 + cx. Click the
substitution button
and enter some specific values for b,
2
c, then plot the result . Do this for several different choices for b
and c and observe the critical points and inflection points of the
different graphs.
b. Using Derives calculus facilities in the algebra window, show
that the function f (x) = x3 + bx2 + cx always has exactly one
inflection point, regardless of the values of b, c.
c. Again using Derives calculus facilities, show that f (x) can have
either 0, 1 or 2 critical points. Determine for what values of b and
c does f (x) have no critical point?
d. Choose values b, c which demonstrate that f (x) may have either
0, 1 or 2 critical points and plot their graphs.
x
7
4. Graph the function f (x) = ( 1+x
2 ) . At first there appears to be no
part of the graph showing in the graphics window but this can not be
since f (0) = 0. Try replotting the graph in another color by either just
and
buttons.
Derive cant plot the function unless the values are provided.
54
c. In the Graphics window, use the Zoom buttons or else the Set/Range
menu in such a way that both the local maximum and local minimum points are visible. Furthermore, make the y-scale comparable to the y-coordinate of the local maximum.
d. After you get a good looking graph, print out the result.
5. The volume of a tin can is V = r2 h where r is the radius of the
top (and the bottom) and h is the height. The surface area is A =
2rh + 2r 2 . (The first term is the area of the side and the second is
the area of the top and bottom.)
a. A manufacturing company wants to make cans with volume 42 in3 .
To minimize their costs they want to minimize the area of the can.
What values of r and h do this? (Hint: Author the formula for the
area, 2rh + 2r 2 ; use the equation for the volume, 42 = r 2 h, to
solve for h in terms of r and substitute this into you expression for
the area. Now find the value of r that minimizes the area using
calculus techniques and use this value of r to find what h is.)
b. You may have noticed that h = 2r for the can of minimum area
you found in part a. Show that this relation always holds for
the can of least surface area (not just for cans with volume 42).
(Hint: Do this just as in part a except dont replace V by 42 in
the equation for the volume.)
*6. Suppose we have the situation of the previous problem except that now
the metal for the top and the bottom of the can costs 1.5 times as much
as the metal for the side. What is h/r for the can of minimun cost?
7. Integrate each expression using the
(See Section 0.9 for instructions.)
Z
x2
dx
b.
a.
(x3 1)2
Z /4
c.
x sin(x2 ) dx
d.
0
/2
(1 + cos x)2 dx
0
x 1 + x dx
Chapter 4
Graphing Data and Curve
Fitting
4.1
Introduction
4.2
56
lets consider the problem of finding a polynomial function f (x) which goes
through these points. That is, we want f (x) to satisfy f (xi ) = yi for i =
1, . . . , n. If xi 6= xj , for i 6= j, then it turns out that we can always find a
unique polynomial of degree at most n 1 going through these points. This
is quite obvious when n = 2 since there is a unique line passing through any
2 distinct points.
If we are given 3 points, (x1 , y1), (x2 , y2), and (x3 , y3 ), and want to find a
quadratic polynomial passing through these points, we let f (x) = ax2 +bx+c
be an arbitrary quadratic. Since f (xi ) = yi for i = 1, 2, and 3, we obtain
three (linear) equations
ax21 + bx1 + c = y1
ax22 + bx2 + c = y2
ax23 + bx3 + c = y3
(1)
in the unknowns a, b, and c. (Remember, we are given the points (xi , yi) so
they are known and we want to find the unknowns a, b, and c.) We then
solve this system of 3 equations for the 3 unknowns a, b, and c.
For example, suppose we want to find a quadratic polynomial f (x) =
ax2 + bx + c passing through (0, 0), (1, 2), and (2, 8). The way to do this with
DfW is to first author f(x) := ax^2 + bx + c then choose Solve/System
from the menu bar, set the number of equation to be 3, and then enter the
three equations (you can either use the Tab-key after entering an equation
or click the next equation box)
f(0) = 0
f(1) = 2
f(2) = 8
Click on the Equation Variables box and select the variables to solve for as a,
b, and c. Click OK and then simplify the resulting expression SOLVE( [F(0)
= 0, F(1) = 2, F(2) = 8], [a, b, c]) (see Section 0.7 on page 6). Derive returns
[a = 2
b = 0
c = 0]
0 0
1 2
2 8
57
58
use single characters for our variables. But to solve (1) we need the variables
x1, x2, etc. When we enter x1, Derive will think of this as x times 1, which
is not what we want. So we need to declare that x1, x2, etc., are variables.
To declare x1 as a variable you can author x1 :=. You need to do this for
all three xs and ys. Be sure to use the assignment characters := and not
the equation character =.
As a convenience for the exercises the ADD-HEAD file has provided declarations for x0, . . . , x4 and y0, . . . , y4. But if you need more variables or
if you use a different letter other than x or y then you will need to declare
them.
button and selecting 3
Now enter the data matrix by clicking the
rows and 2 columns. Then, enter x1 press Tab and enter y1. Continuing,
enter all the remaining xi s and yi s. Click the OK button and the result
should be
x1 y1
x2 y2
x3 y3
Now we Author CURVEFIT(x,data) where data is the above matrix of
points. Simplifying yields a complicated looking answer that is a little difficult to digest. However, if you examine the denominators of each of the
expressions you will notice that they cannot be 0 since we are assuming that
x1 , x2 , and x3 are distinct. This is the only thing that can go wrong with the
formula in general so our assumption gives us a valid solution. See Figure 4.2
on the facing page. You might try increasing the number of points to see
that the same principle applies.
As an interesting variant on the above, suppose we want to find a, b, and
c for a function f (x) = ax2 + bx + c when we know
(2)
f (x1 ) = y1
f (x2 ) = y2
f 0 (x3 ) = y3
In other words we specify that f (x) must pass through (x1 , y1) and (x2 , y2 )
and that its slope at x = x3 is y3 . We define f(x) as before and define g(x)
59
g(x) := 2ax+b
Now if we solve the system of equations
f(x1) = y1
f(x2) = y2
g(x3) = y3
as before and then factor the answer, we see that the denominator of each of
the 3 fractions is
(x1 x2 )(x1 + x2 2x3 )
(You can do this just as in Figure 4.2 except you need to define g(x) and
use g(x3) = y3 in place of f(x3) = y3.) Of course we are assuming that
1
Note that you cant simply define g(x):=DIF(f(x),x). We ran into this problem
earlier on page 41 (see Section 0.12 on page 16 for a complete explanation). One solution
to this problem is to use the utility file and define g(x):= SUBST( DIF(f(u),u), u, x).
60
x1 + x2
2
This means we can always find f (x) except possibly if x3 = (x1 + x2 )/2.
This is somewhat surprising since one expects to be able to solve for 3 unknowns satisfying 3 equations just as one can solve for 2 unknowns satisfying
2 equations. However, in both cases there are exceptional cases that need
to be considered. In this case, the difficulty is related to the mean value
theorem and is explored in Exercise 3. Related results for cubic functions
are examined in Exercises 4 and 7.
The solution to curve fitting problems involving the derivative can also
be found using the CURVEFIT(x,data,ddata) function. As before x is the
variable and data is a matrix of points satisfied by the function. The matrix
ddata represents the points satisfied by the derivative. In the above example,
we would author
CURVEFIT(x,[[x1,y1],[x2,y2]],[[x3,y3]])
and simplify to get the answer.
4.3
P (t) = aer(tt0 )
Population models are studied more thoroughly in Chapter 11 using the theory of differential equations but for now we will just consider the exponential
model. Here P (t) is the population at time t and a is the population at the
starting time, t0 . Problem 7 uses this model.
There are two parameters in (4), a and r. These parameters can be
determined if we know the population at two different times, t1 and t2 , i.e.,
if we know P (t1 ) = y1 and P (t2 ) = y2 . This gives the equations
aer(t1 t0 ) = y1
aer(t2 t0 ) = y2
61
but solving for a and r is a little more difficult since this is not a linear
system of equations. Hence, we can not solve this system using the function.
Instead, the way to do it is to use the first equation to solve for a and then
substitute that value into the second equation and then solve the resulting
equation for r. You can use SOLVE on any single equation but not systems.
Another approach is to observe that the equations are linear in the quantities ln a and r because, if we let c = ln a, they are equivalent to:
c + r(t1 t0 ) = ln y1
c + r(t2 t0 ) = ln y2
Of course, once we find c then a = ec , so youre done. Problem 6 will require
solving these equations.
4.4
0 0
1 1
data :=
2 0 .
3 1
We want to find a smooth function f (x) whose graph passes through the
data points. One solution to this problem is to use CURVEFIT(x, data)
which gives us a degree n 1 polynomial passing though the given data
points. Unfortunately, for problems with a large number of data points this
can take a long time to solve because it requires solving a large system of
equations (n 1 equations and n 1 unknowns).
One simple technique that doesnt involve solving large systems of equations is to use a piecewise quadratic polygonal approximation to the graph.
The idea is find a quadratic polynomial connecting each pair of consecutive
data points but the catch is that in order for the graph to be smooth you
need to make the derivatives match at each data point.
Heres how we do it: We start with an arbitrary slope, say m = 2, at the
first data point, which is (0, 0) in our example, and use the second form of
CURVEFIT to find a quadratic polynomial f1 (x) which satisfies the equations
f1 (0) = 0,
62
This solution is
f (x) =
3
X
k=1
In our example we can solve for the three quadratics and get
f1 (x) = 2x x2 ,
f2 (x) = 2x x2
63
The definition behind the SPLINE function (see the file ADD-UTIL) is
fairly straightforward. The function fk (x) depends on the previous function
0
(xk ), where the k th interval
fk1 (x) and more specifically on the quantity fk1
is [xk , xk+1 ]. It turns out that it is more efficient to make a vector out of the
n 1 slopes m = [m1 , m2 , . . . ] using the formula
(6)
mk = 2
yk+1 yk
mk1
xk+1 xk
k = 2, . . . , n 1 .
which can be derived using DfW(see the file F-SPLINE.MTH). Using this
formula one produces the vector of slopes using the ITERATES function. The
formula looks a little complicated at first but should look straigtforward
after some careful examination (see either the file ADD-UTIL or the SLOPE
function in the file F-SPLINE.MTH).
Using these quantities one then computes fk (x) using
CURVEFIT(x, [datak, data(k+1)], [[datak1, mk]])
.
See Figure 4.3 where we use this method of approximation to approximate
the function y = sin x using n = 7, which is the smallest integer greater than
2. Thus, based on the numbers sin 1, . . . , sin 7 plus the derivative at x = 0,
i.e., m0 = 1, we get a good approximation to the sine function.
4.5
Laboratory Exercises
Start off your lab by Loading the ADD-HEAD file (use File/Load/Math).
Note that the syntax of the CURVEFIT function is displayed on the second
line of the ADD-HEAD file. There are two possibilities: CURVEFIT(x, data)
where data is a matrix of data points satisfied by the function or CURVEFIT(x,
data, ddata) where now the derivative satisfies the matrix of data points
ddata.
1.
64
65
For the following problems you will need to use the variables x1, x2, x3, x4,
y0, y1, y2, y3, and y4. As long as you have loaded the ADD-HEAD file these
variable will be declared. On the other hand, if you use a variable such as
z0 then you will need to declare it by authoring z0:=. See the discussion on
page 57.
3. Let (x1 , y1) and (x2 , y2 ) be two points in the plane with x1 6= x2 . Let
1
m = xy22 y
be the slope of the line through these points. The Mean
x1
Value Theorem says that if f (x) is a differentiable function which passes
through these points then f 0 (x3 ) = m for some x3 between x1 and x2 .
Show that if f (x) has the form ax2 + bx+ c then we can take x3 = (x1 +
x2 )/2, i.e., show that f 0 ((x1 + x2 )/2) = m if f (x) has this form. Hint:
Solve the system f (x1 ) = y1 , f (x2 ) = y2 for b and c and substitute
those values back into ax2 + bx + c. Then show that the derivative of
the resulting expression is m when x = (x1 + x2 )/2. Of course this
means that all quadratic functions through (x1 , y1 ) and (x2 , y2 ) have
the same slope at (x1 + x2 )/2.
4. Use the CURVEFIT function to find the quadratic function f (x) = ax2 +
bx + c that satisfies
f (x0 ) = y0
f (x1 ) = y1
f (x2 ) = y2
Integrate the resulting function over the interval [x0, x2]. Observe that
your answer is a pretty big expression that requires scrolling to view.
Now substitute in this expression x1 = (x0+x2)/2 using the
button and simplify. Note that x1 is the midpoint of the interval [x0, x2].
The answer should be a very simple formula in terms of x0 , x2 , y0 , y1
and y2 . In the next chapter this calculation will be the basis for the
Simpson Method of numerical integration.
*5. Suppose we want to find a cubic function f (x) = ax3 + bx2 + cx + d
66
such that
f (x1 ) = y1
f (x2 ) = y2
f (x3 ) = y3
f 00 (x4 ) = y4
Show that this is always possible if x1 , x2 , and x3 are all distinct and
x4 6= (x1 + x2 + x3 )/3. The algebra in this problem gets fairly messy.
6. Let (x1 , y1 ) and (x2 , y2 ) be two points in the plane with y1 > 0, y2 > 0,
and x1 6= x2 . Let f (x) = aerx be an exponential function. Show that
it always possible to find a and r so that f (x) passes through these
points. Hint: you need to solve the equations
aerx1 = y1
aerx2 = y2
To do this first solve for a in one of these and substitute the answer
into the other and then solve for r. Make sure that your formulas for
a and r only involve the data points.
7. Table 4.1 on page 68 shows the population of the US for every decade
from 18001900. Consider two models for the data: an exponential
model P (t) = aert and a linear model L(t) = bt + c.
a. Use the data for 1800 and 1810 to determine 2 linear equations in
the 2 unknowns b and c. Use
to find b and c.
b. Do the same thing for the a and r but this time you will need to
apply the previous exercise to solve for a and r.
c. Show that your model in Part (b) is the same as 5.3er(t1800) where
r is the value you obtained in Part (b). Use properties of the
exponential function to explain why this is true.
d. What does each model predict for 1830?
e. How do the models compare during the first 50 years? 100 years?
Do this by graphing both functions and the population data. Adjust the scale to get a good picture. Note: The data in Table 4.1
can be copied from the file F-population.
67
x1 y1
x2 y2
data := ..
.
.
xn yn
where x1 , y1 , . . . have numerical values and x1 < x2 < . . . . We know
that plotting this vector in connected mode gives a piece-wise linear
graph. You can test this using a sample value for data. Write a function
f(x) in DfW which will have the same graph, i.e., between any two
consecutive x-values, xk x xk+1 , f (x) linearly interpolates the
data points. (Hint: Look at equation 5 on page 62 for doing spline
function interpolation and use the CHI function as is done there. You
will need to use subscript notation to refer to the x, y values. For
example, data11 is x1 and data32 is y3 .)
*9. Let (x1 , y1), (x2 , y2), and (x3 , y3 ) be three points in the plane
with x1 6= x2 , x1 6= x3 , and x2 6= x3 . Show that all cubic functions,
f (x) = ax3 + bx2 + cx + d which go through all three of these points
have the same second derivative at x1 +x32 +x3 . (Hint: Just solve the 3
equations in the 3 unknowns b, c, and d in terms of the 4th unknown a.
Differentiate twice and substitute in the above value of x. Check that
the answer does not depend on a.)
68
Population (millions)
1800
5.3
1810
7.2
1820
9.6
1830
12.8
1840
17.0
1850
23.0
1860
31.4
1870
38.5
1880
50.0
1890
62.9
1900
76.2
1910
92.2
1920
106.0
1930
123.2
1940
132.2
1950
161.3
1960
179.3
1970
203.3
1980
226.5
1990
248.7
Chapter 5
Finding Roots Using
Computers
5.1
Introduction
This lab explains two techniques for numerically solving equations, Newtons
famous method and the bisection method. If we have any equation we want
to solve for x, we can subtract one side from the other to get an equation of
the form f (x) = 0. Of course, in case f (x) is a polynomial then solving this
equation means finding the roots of f (x).Thus, for quadratic polynomials we
would ordinarily use the quadratic formula. However, we will be considering
very general functions which typically involve trigonometric functions, logarithms and exponentials and hence algebraic methods are usually hopeless.
Newtons method is called a dynamic process and is related to interesting
topics such as chaos and fractals. We will explore these concepts later in this
chapter.
5.2
Newtons Method
70
to r.
Since y y0 = m(x x0 ) is the equation of the line through (x0 , y0 ) with
slope m, the equation for the tangent line of f (x) through (x0 , f (x0 )) is
y f (x0 ) = f 0 (x0 )(x x0 ).
Solving for x when y = 0 gives x = x0 f (x0 )/f 0(x0 ). Thus we get the
(n + 1)st approximation from the nth by the formula:
(1)
xn+1 = xn
f (xn )
f 0 (xn )
71
(x1 , 0) (2.36363, 0). The process is now repeated, starting with the guess
x1 .
It is convenient to view the computations as an iteration process:
(2)
NG(x) = x
f (x)
f 0 (x)
which changes a guess x into a (hopefully) better guess NG(x). (Note that
xn+1 = NG(xn ).) You can think of NG as standing for Newton guess or
for next guess. To make a Derive function to do this for our function
f (x) = x2 + x 1 we define
(3)
NG(x) := x-(x^2+x-1)/(2x+1)
Now starting with x0 and successively applying this function to the previous
result produces a sequence of approximations:
x0
x1 = NG(x0 )
x2 = NG(x1 ) = NG(NG(x0 ))
x3 = NG(x2 ) = NG(NG(x1 )) = NG(NG(NG(x0 )))
..
.
which we hope get closer and closer to the exact answer. In the limit we
want this sequence of approximations to converge to the root.
We can compute several approximates by first Authoring NG(5), and then
approximating. Now we can author NG, press the right mouse button and then
click (Insert expression) or press F4. This will bring down the highlighted
expression in parentheses giving NG(2.36363) which we approximate (just
press Simplify instead of OK) again and then repeat this process.
A somewhat fancier method is to use the Derives ITERATES function. ITERATES(u,x,a,n) simplifies to an (n + 1)-vector whose first entry is a and each subsequent entry is obtained by substituting the previous entry for x in u. Thus, ITERATES(x^2,x,2, 4) returns the vector
[2, 4, 16, 256, 65536]. (The function ITERATE is similar, but just gives the
last value, so ITERATE(x^2,x,2,4) gives 65536.) We can get the first 4
approximates by authoring ITERATES(NG(x), x, 5, 4) and approximating
the result.
72
Loading the utility file ADD-HEAD adds two functions to the system that
make computing the Newton iterations easier. The function NEWT(u,x,a)
computes the Newton guess of the expression u, in the variable x, starting
with an initial guess at x0 = a. In our previous example of f (x) = x2 + x 1
with starting point x0 = 5 we would enter NEWT(x^2+x-1,x,5). To get a
vector containing the starting point and the first 4 Newton iterates you author
and simplify NEWT(x^2+x-1,x,5,4). The general syntax is NEWT(u,x,a,k).
Looking at the algebra window in Figure 5.1 we see the above function
along with the first 4 iterates starting at x0 = 5. The graphic demonstration
shows the Newton method in action by plotting a part of the tangent line
until it crosses the x-axis. The picture clearly shows how well the Newton
method works since one has to zoom-in several times near the actual root in
order to see the last two iterations. The utility function DRAW NEWT(u,x,a,k)
simplifies to a matrix which plots the figure shown in Figure 5.1.
Alternately, that file contains the necessary definition for doing the graphics directly. The basic idea is to make a vector out of several triples of points
which have the form (x, 0), the initial guess on the xaxis, (x, f (x)), the corresponding point on the curve, and (NG(x), 0), the place where the tangent
to the curve at (x, f (x)) intersects the xaxis. When we graph these points
we want the lines connecting them to be drawn. If this is not the case then
adjust the Options/Points menu.
You might note that a little trick is used in the above of DRAW N in
the file F-NEWT. The special form of the VECTOR(u,x,v) function sets x
equal to each value in the vector v = [v1 , . . . , vn ] and makes the new vector
[u(v1 ), . . . , u(vn )].
x2 2
x2 + 2
x 1
f (x)
=
x
=
= +
0
f (x)
2x
2x
2 x
NEWT(x^2-2,x,2,5)
ITERATES(x/2+1/x,x,2,5)
73
which is accurate to 10 decimal places. In fact, Figure 5.2 shows a remarkable property about Newton approximation: the number of decimal place
accuracy approximately doubles with each iteration!
5.3
74
75
In general, the same sort of thing will occur with any 0 < < 1. If is
greater than 0.1 then the number of decimals mn will increase at a slower rate
but nevertheless it can be shown to increase without bound. For example,
in Derive if we approximate VECTOR(1/2^n,n,1,16,3) then we get
[0.5, 0.0625, 0.0078125, 0.000976562, 0.000122070, 1.52587105]
which suggests that mn n/3. In fact, if your numerically solve the equation
2n = 10m for m using Derive you will get m = 0.301029n.
If we assume that f 00 (x) exists and that f 0 (x) 6= 0 on I we can compute
NG0 (x) as follows:
f (x)
d
0
x 0
NG (x) =
dx
f (x)
0 2
f (x)f 00 (x)
f (x) f (x)f 00 (x)
=
.
=1
f 0 (x)2
f 0 (x)2
Since f (r) = 0 we see that NG(r) = 0! Thus, not only is | NG0 (x)| less than
one near r but it can be made as small as you like. This follows from the
continuity of the function NG(x) which in turn follows from the continuity
of f 0 (x) and the fact that it is never zero near r. The implication of this fact
is a much faster rate of convergence, i.e., the mn increases much faster than
the above computations suggest.
Theorem 1. Suppose f (r) = 0 and that f 00 (x) is continuous in some open
interval I which has r as its midpoint. If f 0 (r) 6= 0 then the iterates of
NG(x) = x
f (x)
f 0 (x)
76
the exact value r, i.e., |x r| < .01. The above relationship then says that
our Newton guess starting at x, NG(x), satisfies:
| NG(x) r| < M|x r|2 < 50(.01)2 = .005
and since .005 is much smaller than .01 we have a big improvement over our
initial guess of x. Moreover, since our new guess is closer to r than our initial
guess we see that it is also in the interval I and hence we can repeat the same
calculation using NG(x) in place of x.
We could make further calculations, as above, to see how rapidly the
sequence of approximates converges to the exact root r or we could have
Derive do it for us. If we author the expression
ITERATES(50 t^2, t, .01, 5)
and simplify we get
[0.01, 0.005, 0.00125, 7.8125105, 3.05175107, 4.656611012]
which clearly shows the very rapid rate of convergence to the exact answer r.
Proof. By making the interval I a little smaller if necessary we may assume
that both f 0 , f 00 are continuous and bounded on I. Let us assume that
|f 0 (x)| A and |f 00 (x)| B
for x in I. Similarly, since f 0 (r) 6= 0 we may assume, again by making I a
little smaller if necessary, that
|f 0 (x)| C > 0 or equivalently
1
|f 0(x)|
1
C
for x in I. Note that in particular this means that NG(x) is defined for x in
I. Put M = AB/C 2 .
We have observed that NG(r) = r and NG0 (r) = 0. Hence, by using the
Mean Value Theorem twice and our formula for NG0 (x) we get
NG(x) r = NG(x) NG(r) = NG0 (c1 )(x r)
f (c1 )f 00 (c1 )
f 00 (c1 )
=
(x
r)
=
(f (c1 ) f (r))(x r)
f 0 (c1 )2
f 0 (c1 )2
f 00 (c1 ) 0
= 0
f (c2 )(c1 r)(x r)
f (c1 )2
77
where c1 , c2 are between x and r and hence in the interval I. Using the
bounds for f 0 , f 00 and 1/f 0 above shows that (7) holds because
| NG(x) r|
A
B|c1 r||x r| M|x r|2
C2
(8)
and since g(r) 6= 0 it is easy to see that the bracketed expression above can
not be zero for all x near to r and hence the same is true of f 0 (x) provided
x 6= r.
78
Now using (8) to simplify NG(x) (do this using Derive) we get
(m 1)g(x) + (x r)g 0(x)
NG(x) r
=
.
xr
mg(x) + (x r)g 0 (x)
When x = r, the right hand side above simplifies to (m 1)/m which is less
the one. This means that we can find an interval I, with midpoint r, and a
number 0 < < 1 such that
| NG(x) r| |x r|
for all x in the interval I. As we argued earlier in this section, this means
that starting at x0 in I we get the sequence of approximates xn satisfying
|xn r| n |x0 r| which shows that the xn s converge to r.
5.4
2
Which
root
79
c +d
c +d
c + d2
The formula for the quotient is then given by
(a + b i)(c d i)
a + bi
=
c+di
(c + d i)(c d i)
(ac + bd) + (bc ad) i
=
c2 + d 2
ac + bd bc ad
= 2
+ 2
i
c + d2
c + d2
Distance: The modulus or absolute
value of a complex number z, where
z = a + b i, is defined as |z| = a2 + b2 . The distance between two
complex numbers z, w is defined as |z w|, i.e., the modulus of their
difference. When we plot complex numbers as points in the plane (see
below) then this distance formula is the same as the usual distance formula between points in the plane. In Derive the modulus is computed
using ABS which is the absolute value function.
Real and Imaginary Parts: In the representation of a complex number
as z = a + b i; where a,b are real numbers, we say that a is the real part
of z and that b is the imaginary part of z. Using the complex conjugate
defined above we have the following formulas:
z z
z + z
and b = =z =
.
2
2i
In Derive the corresponding these are computed as RE(z) and IM(z).
a = <z =
80
The formulas may look a little complicated at first but nevertheless the
usual rules of algebra hold for complex numbers and we can use them just as
we would ordinary real numbers. Of course, it is easier to make computations
using Derive then it is to compute with the formulas above. You should
verify the above formulas using Derive.
You probably have already encountered complex numbers in Derive
when, for example, you try to Solve an equation such as x2 + 1 = 0 or
something more complicated, while trying to find extreme points. The result
is that Derive computes the two solutions x = i. Of course, in calculus we
usually ignore complex solutions since they are not relevant to max-min theory or graphics. Nevertheless, they do play an important role in algebra since
they provide a complete theory for the solution to polynomial equations.
Complex numbers can be represented as points in the plane: (a, b) for
a + b i. When we are plotting complex numbers we usually refer to the
plane as the complex plane. Derive does not directly plot complex numbers
as points in the plane but we have a utility function DRAW COMPLEX which
converts a vector of complex numbers into a matrix of points in the plane,
using the RE and IM functions, which can then be plotted as usual.
Example In order to plot the powers of i, we enter:
[#i, #i^2, #i^3, #i^4, #i^5]
and then simplify to get [i, 1, i, 1, i]1 . Now we apply our utility function
to this vector and simplify to get the matrix
0
1
1 0
0 1
1
0
0
1
Notice that the row entries (x, y) corresponds to the complex numbers x + y i
from the above vector. Now plotting these five (x, y)-points as usual gives us
an interesting picture of how complex multiplication is quite different from
ordinary real numbers. Notice that the powers are rotating in the counterclockwise direction about the origin. Also notice that the last point is the
1
81
same as the first since i5 = (1)2 i = i. Which real numbers x have the
property that xn = x for some integer n?
Using the same function f (x) = x2 2, lets see what happens if we start
with a complex number for x0 like 3 + 2 i. The formula (1) 1 on page 70 for
Newtons method involves arithmetic operations with the complex number
x0 = 3 + 2 i and hence is valid. This time we Author
data := NEWT(x^2-2,x,3+2 #i,5)
and then we approximate this with precision set to 6 decimal places, to obtain
[3 + 2 i, 1.73076 + 0.846153 i, 1.33170 + 0.195097 i,
1.40099 0.0101504 i, 1.41423 + 9.59747 105 i, 1.41421]
so that it still converges to 2. Notice how the i parts tend to zero rapidly.
We can get a picture of this convergence by authoring
DRAW COMPLEX(data)
and then simplifying. The result will be a matrix of 6 points.
We plot this
matrix to observe how the iterates converge to the point ( 2, 0) on the x-axis,
see Figure 5.3 on the following page.
2 whenever we
Its a fact that the Newton method will converge
to
82
83
84
fails to converge, is called the Julia set for NG(x). In the example f (x) =
x3 1 these are the points on the edge or boundary of the basin of attraction.
As the picture in Figure 5.5 shows this set can be very complicated, it looks
a little like a necklace with infinitely many smaller and smaller loops coming
out in many different directions.
There are two basic methods for constructing this set. Since NG(x0 ) is
not even defined when f 0 (x0 ) = 0 this is a good place to start. If x is a
solution of
NG(x) = x0
then the third term of the sequence (9) is not defined and so x will be in
the Julia set. In the case when f (x) = x3 1 the equation above has
85
three solutions. For each of these there are three more obtained by solving a
similar equation or in other words finding the points where NG(NG(x)) = x0 .
Continuing in this way we get a close approximation to the Julia set. The
actual set is obtained by taking limits of these points. This method is called
the backward method and is done in the file F-JULIA-BACKWARD for the
polynomial x3 3x which hascritical points at 1. This function has three
real roots at x = 0 and x = 3 and the Julia set somehow has to separate
the three basins of attraction corresponding to these roots. See Figure 5.6
for a picture of its Julia necklace.
Figure 5.6: Bad Newton starting points for x3 3x = 0 in the complex plane
The trouble with the backward method is that it uses the cubic formula
for solving 3rd order equations and this formula is pretty complicated. Even
worst is the fact that there is no analogous formula for degrees 5 or greater.
To get around this problem there is the forward method which involves
simply looking at the sequence:
NG(x0 ), NG(NG(x0 )), NG(NG(NG(x0 ))), . . .
86
and checking whether it gets closer and closer to root or else just wanders
around forever. Since you have to do this for each point or pixel in the graph
this can be a very lengthy computation. A number of shortcuts and tricks
are typically employed and you can study the file F-JULIA-FORWARD to
see how we did it. Or you can just check out the pictures; see Figure 5.7.
5.5
Bisection Method
87
and apply the bisection method to it; otherwise we use [(a + b)/2, b]. At each
stage the root lies in an interval that is only half the size of the previous
stage. So we can eventually find the root to any number of decimal places.
We can automate this process by authoring two functions:
F(x) :=
BIS2(a,b) := IF(f(a)f((a+b)/2)<0, [a, (a+b)/2], [(a+b)/2, b])
BIS(v) := BIS2(v SUB 1, v SUB 2).
The main function is BIS(v) and BIS2(a,b) is a helper function. The argument v to BIS is a vector with two entries, e.g., [a, b]. The Derive
function SUB, which we discussed in the previous section, returns the parts
of a vector so that [a,b] SUB 1 = a and [a,b] SUB 2 = b. So BIS starts
with a vector like [a,b] and calls BIS2(a,b). This then uses the values f (a)
and f ((a + b)/2) to decide if there is a root in [a, (a + b)/2] or in [(a + b)/2, b].
In the discussion above we assumed that f (x) < 0 and that f (b) > 0. The
way we have defined BIS it will work also in the case f (x) > 0 and f (b) < 0.
To do this we test if the product f (a)f ((a + b)/2) is negative. If it is, then
one of f (a) and f ((a + b)/2) is negative and the other is positive. In this
, f ( a+b
)) lie on opposite sides of the xaxis
case the points (a, f (a)) and ( a+b
2
2
and so there must be a root in the interval [a, (a + b)/2]. In the other case,
f (a)f ((a + b)/2) is positive and so they have the same sign. In this case
f ((a + b)/2) and f (b) must have the opposite signs (why?) and so there is a
root in [(a + b)/2, b].
Let us try the equation ln x = 1 which has the (unique) solution x = e =
2.718 . . . . Of course we are finding the root of ln x 1 so we author f(x)
:= ln(x) - 1 and apply BIS. Graphing f (x) shows that there is a root
between 2 and 3 so we author BIS([2,3]). This returns [2.5, 3], indicating
that 2.5 < e < 3.
Now we want to apply BIS to the answer [2.5, 3]. You can do this several
times by choosing author, typing BIS, and then inserting the highlighted
vector. Once again we have an iteration process and we can use the ITERATES
function that does this for you.
Using this technique, we author
ITERATES(BIS(v),v,[2,3],10)
and then approximate it to see how well this approximates e, see Figure 5.8
on the following page.
88
An easier way to see the bisection method in action is to use the function
BISECT(u,x,v,k) in the utility file ADD-UTIL. To get the above results
we would simply enter BISECT(ln x-1,x,[2,3],10) and the press the apbutton. It is interesting to compare the results of the
proximation
bisection method with the Newton method of the previous section. The bisection method is fairly fast at getting a good approximation but not nearly
as fast as the Newton method.
The bisection method will work for any f that is continuous on the interval
[a, b] and f (a) and f (b) have opposite signs. It is easy to see that after n
iterates the error is at most (b a)/2n . (In fact this is the width of the
resulting interval. If we choose the midpoint as our estimate, the error will
be at most (b a)/2n+1 .)
5.6
89
Laboratory Exercises
Start off your lab by Loading the ADD-HEAD file (use File/Load/Math).
Note that the syntax of the NEWT function is displayed on the second line
of the ADD-HEAD file. There are two possibilities: NEWT(u,x,a) where a
is the starting point in Newtons method applied to the expression u in the
variable x. Alternately, the function NEWT(u,x,a,k) gives a vector containing the intial guess a followed by the first k approximates. The function
DRAW NEWT(u,x,a,k) produces the graphical demonstration of the Newton
method.
2
1. The equation x2 = 2 has
solutions x = 2. Use the function x 2
and NEWT to estimate 2.
a. Give the 5th iterate starting at x = 10
b. Plot the graph of x2 2 and the output to DRAW NEWT(x^2-2, x,
10, 5).
c. What happens when your start at x = 10?
d. Whats wrong with the starting point x = 0? Explain this both
numerically and graphically.
2. In a manner similar to Problem 1, use NEWT to estimate
7.
90
In DfW5 you choose Solve/Expression and then select the Numerically solution
method option.
91
(1 + 2i) + (3 i)
b.
(1 + 2i) + (3 i)
c.
(1 + 2i)(3 i)
d.
(1 + 2i)(3 i)
e.
f.
g.
1 + 2i
3i
h.
2+i
i.
j.
<(2 + i
1 + 2i
3i
1 + 2i
3i
1 + 2i
)
3i
z + w = z + w
b.
z w = z w
c.
zw = wz
d.
zw = zw
e.
z
|z|2 = z
f.
|zw| = |z||w|
P (z) = P (
z)
92
1
+ 12 i and plot the result.
2
1 + 1 i and plot the result.
2
2
93
1
10M
where M is the above constant. Use pencil and paper (and perhaps
mathematical induction) to prove:
a. Each xn is in the interval I.
b. The inequality
n
|xn r| M 1 102
holds for n = 0, 1, 2, . . . .
94
Chapter 6
Numerical Integration
Techniques
6.1
Introduction
Even though sin(x2 ) has no elementary antiderivative, the area defined by the
integral certainly exists. So how do we find it? We use numerical integration.
Rb
Consider the integral a f (x) dx, and for simplicity assume f (x) 0 and
that a < b. The idea of numerical integration is to choose intermediate points
a = x0 < x1 < x2 < < xn = b and estimate the area in the strip below
f (x) for xi x xi+1 and then add up these estimates; see Figure 6.2 on
page 100. Of course the width of this strip is xi+1 xi . The height varies
with x. Some of the most common ways of estimating the area of the strip
95
96
are:
Left endpoint:
f (xi ) (xi+1 xi )
Right endpoint:
f (xi+1 ) (xi+1 xi )
Midpoint:
f(
Trapezoid:
1
[f (xi+1 ) + f (xi )] (xi+1 xi )
2
1
xi+1 + xi
f (xi+1 ) + 4f (
) + f (xi ) (xi+1 xi )
6
2
Simpsons Rule:
xi+1 + xi
) (xi+1 xi )
2
The last one, Simpsons Rule, is based on the best quadratic approximation
to f (x). This basic idea was derived in Exercise 4 on page 65 in Chapter 4.
Section 6.5 on page 104 has a detailed explanation.
Usually we choose the xi s equally spaced, so that
(1)
xi = a +
ba
i
n
ba
. Thus, if we use the left endpoint
Of course, in this case, xi+1 xi =
n
approximation, we get
Z b
n1
baX
(2)
f (x) dx
f (xi )
n i=0
a
Notice that we factor out the term
than multiplying every term.
6.2
ba
and multiply by the sum rather
n
An Example
6.2. AN EXAMPLE
97
98
6.2. AN EXAMPLE
99
can be shown that error in using the left endpoint method is no greater than
1
(b a)2
0
(3)
max |f (x)| .
x[a,b]
2
n
On the other hand, the error in using the trapezoid method is no greater
than
(b a)3
1
00
max |f (x)| 2 .
(4)
12 x[a,b]
n
In our example (with f (x) = 1/x, a = 1 and b = 2) we have the bracketed
quantity in (4) is equal to 1/6 so that the error is no greater than n2 /6.
Thus, n = 100 indeed yields an error of less than .00002 or approximately
4 decimal digits. You might want to modify the previous table we did in
Derive to add another column displaying this theoretical error estimate
(3) (and (4) for the trapezoid method) and compare it to the actual error.
Although the trapezoid method is quite accurate and fairly efficient, the
Simpsons Rule is vastly more efficient. The error in using the Simpson
method is no greater than
1
(b a)5
(4)
max |f (x)| 4 .
(5)
180 x[a,b]
n
Notice the main difference between (4) and (5) is that we now have an
error which is roughly 1/n4 (the bracketed quantity in our example is 24/180).
Thus, with n = 10 we obtain the same accuracy as n = 100 in the trapezoid
method or n = 10, 000 in the left endpoint method. A table illustrating these
differences can be obtain by approximating
vector([LEFT(1/x,x,10^n,1,2) - LN(2), TRAP(1/x,x,10^n,1,2)
- LN(2),SIMP(1/x,x,10^n,1,2) - LN(2)], n,1,4).
These functions are available by doing Load/Utility with the file ADD-UTIL.
Seeing the accuracy of SIMP(1/x, x, 104 , 1, 2) requires 16 digits of accuracy.
Recall from Section 0.6 how to increase the accuracy of a calculation.
To get a geometric feeling for why the trapezoid method is so much better
than the left endpoint method one need only draw a sketch comparing the two
methods. Its possible to graphically represent these approximations using
Derive. Recall from Chapter 4 that one can plot a collection of points,
100
6.3
Let us indicate how one obtains some of these error estimates by proving the
following theorem:
101
(b a)
.
n
This bounds how much f (x) and f (xk1 ) can differ for x between xk1 and
xk ; and this means the error in using the left endpoint estimate for the strip
between xk1 and xk is at most the width of the strip, (b a)/n, times this
bound. Adding this over all n strips gives
Z b
1
2
0
f (x) dx LEFT(f (x), x, n, a, b) (b a) max |f (x)|
x[a,b]
n
a
which is the desired result. This completes the proof of part (a).
The proof of part (b) is similar except it uses the Mean Value Theorem
three times. We estimate the error from approximating f (x) by the linear
function obtained from the endpoints values f (xk1 ) and f (xk ). Thus, for
xk1 x xk we have
f (x) f (xk ) f (xk1 ) (x xk1 ) + f (xk1 )
xk xk1
f (xk ) f (xk1 )
= (f (x) f (xk1 ))
(x xk1 )
xk xk1
0
0
= |f (c1 )(x xk1 ) f (c2 )(x xk1 )| = |f 00 (c3 )||c1 c2 ||x xk1 |
2
ba
00
max |f (x)|
x[a,b]
n
102
and thus at each point the error is proportional to 1/n2 and so is the integral
over [a, b]. More precisely,
Z b
1
3
00
f (x) dx TRAP(f (x), x, n, a, b) (b a) max |f (x)| 2
x[a,b]
n
a
We note that the error estimates above differ from (3) and (4) only in the
constant term and not the power of n. To obtain the better constant more
careful estimation needs to done in the above argument. On the other hand,
the constants obtained above suffice for most applications.
6.4
In order for any method of approximation to be useful we must know something about the error. The error estimates given in equations (4) and (5)
usually work quite well. But they do require certain boundedness assumptions which are not always true. Consider
Z 1
dx
(6)
3/2
0 1+x
Use Derive to graph g(x) = 1/(1 + x3/2 ). Notice that the graph is pretty
tame; there are no wild oscillations and it would appear that the trapezoid
method could be used to obtain a good approximation of (6). In fact it does
give a good approximation.
In order to use (4) to estimate the error in using the trapezoid rule to
. Use Derive to do this. Note that g 00 (0)
evaluate (6) we need to find g 00
is undefined; but that limx0+ xg 00 (x) = 34 . This means that g 00 (x)
34 x1/2 and hence is not bounded on [0, 1] so that (4) gives us no information
about the error.
We can work around this problem by noticing that for each n we can
apply (4) to the interval [ n1 , 1] instead and use a different technique for that
first interval. Thus, using |g 00 (1/n)| for the maximum on [1/n, 1] (check that
this is valid for all large n), we obtain from (4) that
Z 1
1
c
g(x) dx TRAP(g(x), x, n 1, 1/n, 1) c n
.
(n 1)2
n3/2
1/n
103
On the small interval we observe that g(x) is decreasing for x > 0 and that
g(0) g(x) = x3/2 /(1 + x3/2 ) x3/2 . Thus, by comparing areas we see that
Z
1
1/n
1
1
g(x)
dx
TRAP(g(x),
x,
1,
0,
1/n)
(g(0) g( )) 5/2 .
n
0
n
n
Combining these estimates shows that the error obtained using the trapezoid
method is proportional to n3/2 (which is the larger of the two errors). This is
a better result than 1/n but not as good as 1/n2 . Actually, one can improve
the 3/2-power a little by refining these estimates.
The next question is what can you do without explicit estimates like the
above but only using monotonicity or convexity of the graph. If f Ris increasb
ing on [a, b] notice that the left endpoint method of estimating a f (x) dx
always underestimates the integral while the right endpoint method overestimates it. Similarly, if f is decreasing the opposite inequalities hold. If we
let LEFT(f (x), x, n, a, b) and RIGHT(f (x), x, n, a, b) be the left and right
endpoint estimates then:
Z
if f 0 (x) 0 on [a, b]
and
Z
if f 0 (x) 0 on [a, b]
See Figure 8.2 on page 143 which makes these relations quite obvious.
A similar relation holds between the trapezoid and midpoint methods
but depends on the concavity, i.e., the second derivative of f rather than
the slope, i.e., the first derivative of f . If we let TRAP(f (x), x, n, a, b) and
MID(f (x), x, n, a, b) be the trapezoid and midpoint estimates then
Theorem 2. If f is concave up on [a, b], i.e., f 00 (x) 0, then
Z
MID(f (x), x, n, a, b)
104
Figure 6.3 shows why this is true. It has two graphs of the same function
which is concave up. the line in the left part shows the trapezoid used in the
trapezoid rule. Clearly it overestimates the integral. The midpoint rule is
illustrated in the right graph. The midpoint rule gives the area under the line
AB. The line CD is the tangent line through the midpoint. The area below
AB is the same as the area below CD (why?). So both are the midpoint
estimate. But clearly the area under CD is less than the area under the
curve.
D
A
6.5
105
Rx
to approximate x12 f (x) dx. The can be derived by solving for the quadratic
g(x) = ax2 + bx + c which passes through the 3 points (x1 , y1 ), (x2 , y2) and
(x3 , y3 ); where yi = f (xi ) and x3 = (x1 + x2 )/2 Rwhich is simply the midpoint
x
or average of x1 and x2 . One then computes x12 g(x) dx and uses this for
our approximation. Now the algebra involved in this computation is fairly
formidable and yet the beauty of it is that the answer (given in (9)) is so
simple. Thats why the formula for Simpsons Rule looks hardly any different
from the formula for the left endpoint rule and as a result the computation
times are approximately the same.
Now the algebra involved is the same as that of Chapter 4. We solve 3
equations for the unknowns a, b and c, then we integrate the result. Alternately, we can make the derivation into a two step process by using the
function CURVEFIT(x,data) where the data matrix is
y1
x1
y2
data := x2
x1 +x2
y3
2
The resulting quadratic polynomial contains some pretty large expressions
involving xi and yi . Nevertheless, one need only integrate this expression
over the interval x1 x x2 to get the desired result.
6.6
Laboratory Exercises
Start off your lab by Loading the ADD-HEAD file. After you have done this
the functions described in Section 6.2: LEFT, MID, TRAP, and SIMP, which
compute the integral approximations using respectively the left endpoint
method, the midpoint method, the trapezoid method and Simpsons rule, will
all be defined. In addition the functions DRAW LEFT and DRAW TRAP,
which draw the rectangles and trapezoids used in the graphical demonstration of Figure 6.2 on page 100, will be defined.
1.
106
e2
a.
ln x dx
b.
Z
c.
0
107
2
1
2
1
dx
1 + x2
1
dx
1 + x2
6. Do the same as the last problem, but use Simpsons Rule this time and
of course use formula (5) instead of (4).
7. Suppose that f (x) = cx + d for some constants c and d.
a. Use the MID function to verify that
Z
2
1
TRAP(f (x), x, n, a, b) + MID(f (x), x, n, a, b)
3
3
108
10. Do the calculations needed to verify Simpsons rule as outlined in Section 6.5. This is the same problem as Exercise 4 in Chapter 4.
11. Suppose that f (x) = cx2 + dx + e for some constants c, d and e.
a. Use the SIMP function to verify that
Z b
f (x) dx = SIMP(f (x), x, n, a, b)
a
Chapter 7
Taylor Polynomials
7.1
Polynomial Approximations
n
X
ak xk .
k=0
One natural way to to do this is to require that f (0) = Pn (0), f 0 (0) = Pn0 (0),
(k)
f 00 (0) = Pn00 (0), etc., i.e., f (k) (0) = Pn (0) for k = 0, . . . , n. This gives n + 1
equations for the n + 1 unknowns a0 , . . . , an . If we differentiate, say P3 (x),
several times these equations become quite clear:
(1)
(2)
(3)
(4)
P3 (x) = a0 + a1 x + a2 x2 + a3 x3
P30 (x) = 1 a1 + 2 a2 x + 3 a3 x2
P300 (x) = 2 1 a2 + 3 2 a3 x
P3000 (x) = 3 2 1 a3
ak =
f (k) (0)
k!
for
109
0kn
110
Pn (x) =
n
X
f (k) (0)
k=0
k!
xk
The coefficient of xk in Pn (x) is just f (k) (0)/k! (which is the same for all n
as long as n k). This quantity is called the k th Taylor coefficient for f (x).
As our first application, notice that it follows from (5) that the graph of
y = P1 (x) is just the tangent line to the curve y = f (x) at the point (0, f (0)).
We studied this method of approximation extensively in Section 2.2. Thus,
since the tangent line yields the best degree-one approximation to the function, near the point x = 0, it is reasonable that guess that Pn (x) is the best
nth degree approximation, near x = 0.
To have Derive compute a Taylor polynomial for a function first select
the Calculus/Taylor menu, then enter the function in the form, enter some
integer n, say n = 5, for the Degree and leave the Point1 value at its default
value of 0. This results in the expression TAYLOR(f(x),x,0,5). An alternate
approach after becoming familiar with its syntax is to simply author this
expression. See Figure 7.1 on the facing page for some of the basic examples
and a comparison of the graph of f (x) = 1/(1 x) and its 5th degree Taylor
polynomial approximation. An interesting exercise is to load the file F-TAY0
which contains the expressions from Figure 7.1 and compare graphically the
various functions with their Taylor polynomials of different degrees.
7.2
Examples
As we see from Figure 7.1 on the next page, the formulas for the Taylor
polynomials for the function f (x) = 1/(1 x) are pretty easy to guess after
looking at a few examples:
Pn (x) = 1 + x + x2 + x3 + + xn .
Since the graphs of these polynomials appear to approximate the graph of
the function f (x) to a high degree of accuracy as n gets larger and larger (at
1
For now we just take the Point value to be 0. Later, in Section 7.6 we discuss how to
use this variable.
7.2. EXAMPLES
111
n
X
X
1
= 1 + x + x2 + x3 + = lim
xk =
xk .
n
1x
k=0
k=0
The three dots in the above formula means that you are to keep adding more
and more terms forever. Since adding an infinite list of numbers together
looks like an impossible task, we define this in terms of limits. That is what
we mean by the last expression above. More generally, we denote an infinite
series by
n
X
X
ak = lim
ak .
k=0
k=0
112
that our conjecture in (7) above is in fact the most famous example of an
infinite series; namely, it is the geometric series.
We got the form of the Taylor polynomials above by the method of pattern
recognition, looking at lots of examples using Derive and then guessing at
the general result. To verify this result we must use (5) to compute the
Taylor coefficients. We will need to show f (k) (0) = k!. Using Derive we can
make a table of derivatives by authoring
VECTOR([k, DIF((1-x)^-1,x,k)], k, 0, 4)
and then simplifying. The answers seem to follow the pattern k!/(1 x)k+1
which can be verified by having Derive check that:
DIF((1-x)^(-k-1) k!,x) = (1-x)^(-k-2) (k+1)!
(Try this for yourself).
Note that in Figure 7.1 the 5th degree Taylor polynomial approximation
gives a very good approximation on the interval [.5, .5]. As we mentioned
earlier, you should Load the file F-TAY0 and experiment with higher degree
approximations to see how the interval size improves, but the graphical evidence suggests the infinite series representation is only valid for 1 < x < 1
(even though the function appears well behaved near x = 1). We will
demonstrate this fact later.
Three other important examples are the series for ex , sin x, and cos x. If
we look carefully at Figure 7.1 we might guess the pattern for the exponential
function because the denominators 1, 1, 2, 6, 24, 120 are just k! as k varies
from 0 k 5. On the other hand, equation (5) gives the required formula
Thus, in this
easily since all derivatives f (k) (x) = ex and so are 1 at x = 0. P
(k)
th
case f (0)/k! = 1/k! so the n Taylor polynomial is simply nk=0 xk /k! =
1 + x + x2 /2! + + xn /n!. Now, if we can also take the limit as in the case
of the geometric series, then
(8)
e =
X
xk
k=0
n
X
x2
xk
=1+x+
+ = lim
.
n
k!
2!
k!
k=0
In fact, the series above does converge, for all values of x, to the exponential
function. Moreover, it is this series that forms the basis for numerical calculations of the exponential function on computers and calculators. Section 7.5
will give a complete explanation of this matter.
7.2. EXAMPLES
113
114
X
x3 x5
x2n+1
+
+ =
(1)n
sin x = x
3!
5!
(2n + 1)!
n=0
(10)
X
x2 x4
x2n
cos x = 1
+
+ =
(1)n
2!
4!
(2n)!
n=0
115
7.3
|x|n+1
|x|n+1
=M
(n + 1)!
(n + 1)!
(x t)m
dt =
g(t)
m!
Z
0
g 0(t)
(x t)m+1
dt
(m + 1)!
m = 0, 1, . . .
Just put u = g(t) and v = (x t)m+1 /(m + 1)! and apply the integration by
parts formula. Notice that the integrated terms, i.e., the uv|x0 terms, vanish
because g(0) = 0 at the left endpoint and (x t)m+1 is zero when t = x.
116
Proof. Put g(t) = f (t) Pn (t) let M be the maximum of |f (n+1) | on the
interval [0, x]. By the definition of the Taylor polynomial, observe that
g (m) (0) = 0 for m = 0, 1, . . . , n and g (n+1) (t) = f (n+1) (t)
where the second fact follows since the (n + 1)st derivative of any degree n
polynomial is zero (look back at (1) on page 109). Now we get to apply (12)
to g 0 , g 00 , . . . , g (n) with the result that
Z x
Z x
Z x
(x t)2
0
00
000
dt
g (t) dt =
g (t)(x t) dt =
g (t)
2
0
0
0
Z x
(x t)n
dt
= =
g (n+1) (t)
n!
0
and hence that
dt = M
M
n!
(n + 1)!
0
which proves the theorem.
7.4
First observe that we dont need to compute, for example, sin 100 directly
since the sine function is 2 periodic. We just set x = 100 2k where
the integer k is chosen so 0 x < 2. In Derive we simplify the function
MOD(100, 2) to get k = 15 and x = 5.75221 approximately. Now its
an interesting exercise to use the properties of the sine function to reduce
the computation to the interval [0, ]. For example, if < x < 2 then
sin x = sin(2 x) where now 0 2 x < . Similarly, you can use
117
the identity sin( x) = sin x to reduce the problem to the smaller interval
[0, /2]. Its even possible to reduce the interval to [0, /4].
We can use formula (11) to estimate the error in using the Taylor polynomial to estimate sin x. The computation of M = max |f (n+1) | might look
a little formidable at first but we observe that any derivative is equal to either sin t or cos t and in either case M 1. Thus, we can take M = 1
and achieve 6 decimals of accuracy by determining the smallest integer n
satisfying
|x|n+1
106
(n + 1)!
(13)
For approximations on the interval [0, /2] we could just take the worst case
by setting x = /2 in the above.
We now have reduced the problem to solving (13) for the smallest possible
integer n. Unfortunately, the factorial expression means that we cant use
simple algebra to solve this inequality. A simple numerical approach would
be to make a table with n in the first column and the above expression in the
second column. Examining the data will result in an answer provided n is
reasonably small. We did this earlier on page 138 when we studied the ratio
test. If this fails, as with the 1/k 2 series, you might try testing various powers
of 10. Both of these techniques are easy to do using the vector function. (In
the next section we present another way of finding n.) In Figure 7.4, see the
file F-TAY3, we analyze sin 100 by reducing the computation to a smaller
value of x (x = 0.530973), determining which n yields an error of less than
106 (n = 7) and then computing using P7 (0.530973). Observe that for the
sine function P2n+1 (x) = P2n+2 (x) and so for the error computation (13) we
use the higher power 2n + 3 instead 2n + 2 and hence
(14)
| sin x
n
X
k=0
(1)k
|x|2n+3
x2k+1
|
(2k + 1)!
(2n + 3)!
for n = 0, 1, . . .
Lastly, let us observe that the right hand side of (14) tends to zero for
any x. After all, for x fixed, the ratio of terms above is
1
|x|2
|x|2n+5 (2n + 3)!
=
2n+3
(2n + 5)! |x|
(2n + 5)(2n + 4)
2
for all large n. Thus, |x|2n+3 /(2n + 3)! cx /2n (or for that matter |x|n /n!
cx /2n ) for some constant cx and the sequence tends to zero because 1/2n 0.
118
By applying Theorem 1 we see that the Taylor series converges for all x and
we indeed have the representation
X
x2n+1
x3 x5
+
+ =
(1)n
3!
5!
(2n + 1)!
n=0
(15)
sin x = x
which is valid for all < x < . In a similar manner we establish (10)
on page 114.
7.5
Now lets repeat the above procedure for ex . We use the partial sums of
(8) for approximating and (11) for determining the number of terms to use.
Lets assume x > 0. Since f (n+1) (x) = ex is an increasing function, we can
take M = ex or more conveniently we will replace e with the larger value 3.
119
Thus,
(16)
2
n
x n+1
x
e (1 + x + x + + x ) < 3 x
2!
n! (n + 1)!
and so we need only find n so that the right-hand side is sufficiently small.
We would like to define a function in Derive to determine the number of
terms n necessary to achieve 6 decimals places, rather than looking at tables.
First of all, recall from the previous section that
3x xn+1
=0
lim
n (n + 1)!
for all values of x. Hence we are guaranteed that there is a first n for which
the above quantity is less than 106 . Moreover, this proves that the Taylor
series converges for all x, by Theorem 1, to ex . Thus, as stated earlier
x
e =
X
xk
k=0
n
X
x2
xk
=1+x+
+ = lim
n
k!
2!
k!
k=0
3x xk
< 106 , k-1, N1(x,k+1))
N1(x,k) := IF(
k!
N(x) := N1(x,1)
and consider what happens when you Simplify N(5). The N-function computes the N1-function with a starting value of k = 1. The error expression
is compared to 106 and if successful then k 1 is the value of N(5); otherwise, k is increased by one and the process continues. Eventually, we get
to a large enough k so that the comparison with 106 is successful and that
value of k 1 is returned as the value of the function. The function N1 is
called a recursive function because its definition refers to itself. Care has
to exercised with such functions to make sure that they eventually return a
value and dont continue computing forever (press the Esc if this happens).
See Figure 7.5 and load the file F-TAY4 where these functions are used to
define a new version of the exponential function (for x 0) which is accurate
to 6 decimal places. A comparison of this function with the built in version
obtained by approximating shows that the build in function is faster but the
accuracy is the same for the first 6 decimals using P25 (x).
120
7.6
n
X
ak (x c)k
k=0
f (k) (c)
g (k) (0)
=
.
k!
k!
n
X
f (k) (c)
k=0
k!
(x c)k
121
X
f (k) (c)
k=0
k!
(x c)k
(17)
1 < x 1
although the proof that the series converges to ln x on the interval 0 < x
1/2 is straightforward, see Exercise 2, is quite a bit harder than our earlier
examples to get the full interval 0 < x 1. You can load the file F-LOG
and try approximating ln x with higher degree Taylor polynomials to see if
you can confirm the above representation. The full convergence problem for
the logarithm function will be studied in Chapter 9.
122
7.7
Interval of Convergence
The Taylor series for f (x) = sin x, cos x, or ex converges to f (x) for all
values of x. This means that, by taking the degree large enough, the Taylor
polynomials of these functions will approximate f (x) accurately on arbitrarily
large intervals. However, the geometric series (7) only converged for |x| < 1
and so the Taylor polynomial will approximate 1/(1x) only on this interval.
Of course, 1/(1 x) is not continuous at x = 1 and hence it is not surprising
that the Taylor polynomials will not converge at x = 1. Surprisingly, this
divergence at x = 1 turns out to influence the convergence of the series for
negative values of x! It is an important basic theorem about the convergence
of Taylor series that if the series converges at a point x1 6= 0, then it also
converges at all |x| < |x1 |. Thus, any Taylor series which diverges at x = 1
cannot converge at any x < 1. Why? If it did converge say at x1 = 2,
then it would also converge at x = 1. But it diverges for x = 1 so it cannot
possibly converge at x1 = 2 (or any |x| > 1). This fact also leads to the
observation that the set of points x where the Taylor series converges must
123
be an interval which is centered about the origin. Actually, there are four
possibilities for the interval of convergence: (r, +r), (r, +r], [r, +r) or
[r, +r] for some 0 r +.2 This number r is called the radius of
convergence.
Now consider the function 1/(1 + x2 ). We can obtain the Taylor series
for this function by substituting x2 for x in (7):
X
1
2
4
6
=
1
x
+
x
x
+
=
(1)k x2k
1 + x2
k=0
(18)
As before we can use Derive to plot several of the Taylor polynomials for
this function; see Figure 7.7.
We need to allow the notation r = + so that the set of all real numbers can be
represented as the interval (r, r).
124
7.8
Laboratory Exercises
125
their graphs are getting closer and closer to the graph of f (x).
You might need to scale your pictures appropriately.
(iv) Simplify the second vector function to make a 7 2table that
has the degrees n in the first column and Pn (x) in the second
column.
(v) Use your table to guess what the infinite Taylor series expansion
is.
*(vi) Prove that in each case, the Taylor series expansion converges to
the function and determine the interval of xs for which it is valid.
In parts (b), (c) use the geometric series (2) on page 132 and the
fact that the series converges only for 1 < x < 1.
x2
x8
++
+x
8
2
1
b. f (x) =
3x
1
(Hint: For the pattern recognition you will need
c. f (x) = 2
x +2
to change the output mode to Rational. Use the Declare/Algebra
state menu to access the Output menu.)
a. f (x) =
2. Let f (x) = ln(1 x). We want to determine the Taylor series for
f (x) and prove that it converges to f (x) using Theorem 1 on page 115.
a. Compute the first several derivative of f (x) and guess at a general
formula for f (n) (x) for all n = 0, 1, 2, . . . .
b. Use part a to establish the Taylor series of f (x) and hence if the
Taylor series converges to f (x) we would have:
(19)
ln
1
1x
=
X
xk
k=1
=x+
x2 x3
+
+ ...
2
3
c. Use Theorem 1 to show that the (1) holds for any 1 x 1/2.
(Hint: Carefully compute the right-hand side of (11) on page 115.
Then, show that the error estimate tends to zero as n only
for 1 x 1/2.)
126
1
1 1
+ + (1)n+1
2 3
n
Analyze how quickly these approximates converge to ln 2 by making tables of numerical computations. What value of n is needed
for 2-decimal place accuracy?
e. It turns out that (19) actually holds for all 1 x < 1 and the
radius of convergence is r = 1. By computing Pn (x) for several
n and comparing their graphs with f (x), show that the Taylor
polynomials seem to converge to f (x) on the full interval 1
x<1
3. For each of the functions below do the following:
(i) Do parts (i)(iv) of Problem 1 using these functions.
(ii) By comparing the graph of the function with several Taylor polynomials make a guess at the interval of xs for which the Taylor
expansion is valid, see Section 7.7.
(iii) Give further support for your answer in (ii) by picking some nonzero
x1 (where the Taylor representation is valid) and numerically comparing the functions value at x1 with that of several of its Taylor
polynomials. Recall that tan1 x is entered as atan x in Derive.
a.
1
(x + 1)2
c.
ex
b.
tan1 x
4. Load the file F-TAY3 and following the methods of Section 7.4 compute
sin 7. Which degree Taylor polynomial should you use to get an error
of less than 106 ?
5. In this problem we approximate e5 using the methods in Section 7.5.
a. Express e5 using the Taylor series representation of the exponential function.
127
d x
e = ex
dx
128
In fact, this is the Euler Formula which is one of the most fundamental equations with complex numbers. Verify that using this
definition, (20) with = i is valid.
f. Lastly, use the definition
(22)
129
*8. In this problem we use the Taylor polynomials for the arc tangent
function tan1 x to estimate . Recall that tan1 x is entered as atan x.
a. Use Derive to verify the formula
130
Chapter 8
Series
8.1
Introduction
We define
P
i=0
ai = a0 + a1 + a2 +
i=0
ai = s to mean that
lim
n
X
ai = s,
i=0
if this limit exists. If the limit does exist we say the series converges; otherwise we say it diverges. There are two basic techniques for showing that
a series is convergent. One method is to show directly that the above limit
exists. There are not many examples when we can do this but a particularly
important one is geometric series which will be discussed in the next section.
The second method for showing convergence applies to series with nonnegative terms, i.e., the case that ai 0 for all i = 1, 2, . . . . In this case the
partial sums,
sn = a0 + a1 + + an =
n
X
ai ,
n = 0, 1, . . .
i=0
form an increasing sequence, s0 s1 s2 . . . . Hence, by a fundamental property of real numbers, the limit limn sn exists if and only if the
131
CHAPTER 8. SERIES
132
8.2
Geometric Series
sn =
n
X
xi = 1 + x + x2 + + xn =
i=0
1 xn+1
,
1x
if x 6= 1
Its instructive to verify this formula in DfW. You start by clicking the sum
button and enter x^k. Make sure the variable is k (not x) and set the
Start value to 0 and the End value to n. Click OK and edit the resulting
expression SUM( x^k, k, 0, n) by multiplying it by the factor (1 x).
Lastly, use Simplify/Expand to get the desired 1 xn+1 .
If |x| < 1, then limn xn+1 = 0. Thus, we get that limn sn exists
and so the series is convergent. In addition, the following simple formula for
evaluating geometric series holds:
(2)
X
i=0
axi = a + ax + ax2 + =
a
,
1x
if |x| < 1
If |x| 1 then the series diverges because limn sn does not exist.
We can verify this formula in Derive by entering, as we did above or
directly, the expression SUM( ax^k, k, 0, inf) which displays as the left
hand side of (2). Now we must declare that 1 < x < 1. We do this using
8.3. APPLICATIONS
133
the Declare/Variable Domain menu for the variable x and the open interval
(1, 1). If you do this right the expression x : Real (-1,1) will be the
result. If not you should be able to edit the expression until it is right.
Finally simplify the infinite series to get a/(1 x) which is the desired result.
8.3
Applications
Geometric series are useful in several areas, for example, business and finance.
We will give some of the important examples.
Interest. If you start with p dollars (p for principal ) in a bank account
which earns 6% per year how much money will you have after n years?
Assuming the interest is compounded yearly, you will be given an interest
payment of 0.06 p after one year. You will still have the original p dollars
so that the amount of money in the account after one year will be p(1.06).
Notice that this is saying that each year the amount of money in the account
gets multiplied by 1.06. Thus after n years the account will have p(1.06)n
dollars. If we let r denote the interest rate, the amount after n years is
p(1 + r)n .
An interesting alternative to this formula is obtained by focusing on the
year to year change in the savings account balance. Let s bal(k,p,r) denote
the balance after k years, starting with an amount p which is compounded
annually at a rate r. This function can be defined in DfW by
s bal(k,p,r):=IF(k=0,p,(1+r)*s bal(k-1,p,r)).
Notice how we use the function IF(test,true,false). To compute say
s bal(2,p,r) the first thing that happens is the test k = 0 fails and hence we
get (1+r)*s bal(1,p,r). But then s bal(1,p,r) is computed in a similar
manner, i.e., the test k = 0 fails again so now
s bal(2,p,r)=(1+r)*s bal(1,p,r)=(1+r)*((1+r)*s bal(0,p,r)).
Finally, s bal(0,p,r) is evaluated but this time the test k = 0 succeeds
and so the answer is p. Combining the answers we get the same result as
before (1 + r)2 p. This type of computation has a fancy name; its called
recursive programming and it is particularly useful in situations where you
have a sequence of numbers which change one to the next by a fixed rule.
CHAPTER 8. SERIES
134
Now suppose that the bank compounds your money quarterly instead of
annually. This means that they give you 6/4 = 1.5% interest four times a
year. So the amount of money in your account after n years is p(1.015)4n .
For a general rate r compounded k times a year, the amount of money after n
years is
(3)
p 1+
r kn
k
8.3. APPLICATIONS
135
Here we used (1) with x = r1 = 1 + r. Thus, the geometric series arises naturally in compound interest problems and provides us with a useful formula.
CHAPTER 8. SERIES
136
k1
X
(1 + r)i = (1 + r)k p a
1 (1 + r)k
1 (1 + r)
= (1 + r)k p a
(1 + r)k 1
r
i=0
(4)
Using this formula we can easily get the general formula for a by solving
l bal(k,p,r,a) = 0 for a. Thus, the monthly payments a on a loan of p
dollars at a monthly interest rate r (divide the annual rate by 12) for a period
of n years (so k = 12n payments) is:
(5)
a=
r(1 + r)k p
(1 + r)k 1
where k = 12n.
Repeating Decimals. What exactly is meant by the decimal representation of a number x = 0.d1 d2 d3 , where each of the digits dk are integers
0 dk 9? One explanation is that there is no difficulty as long as it is a
d2
d1
d1
+
, etc. For the infinite case,
finite decimal, i.e., 0.d1 = , 0.d1 d2 =
10
10 100
we can think of our decimal as the limit of an increasing sequence which is
bounded from above:
0.d1 0.d1 d2 0.d1 d2 d3 1 .
and hence this sequence has a limit, as mentioned above.
Another approach is to view the decimal as an infinite series as follows:
X dk
d2
d1
d3
+ 2 + 3 + =
x = 0.d1 d2 =
10 10
10
10k
(6)
k=1
Now clearly, the partial sums form an increasing sequence since the terms
are nonnegative numbers. However, maybe it is not completely obvious that
137
=
1 = 1.
10 10 10 10 102
1 10
Note
P that thek key step above was recognizing that the geometric series
k=0 a(1/10) , where a = 9/10, sums to 1 by (2) on page 132.
Of course, we also notice that repeating decimals like 0.999 = 1 and
0.333 = 1/3 are all geometric series when represented as above. Try to
figure out the a, x in (2) in each case. This turns out to be true of any
repeating decimal and hence by the formula (2) these decimal numbers must
be fractions a/b where a, b are integers. In fact, the converse is also true,
namely, a decimal is a fraction if and only if it is eventually repeating.
Example. Consider the eventually repeating decimal x = 0.5010101 .
We express this as
k
1
1
1 X 3
5
+ 3 + 5 + = +
102
10
x=
10 10
10
2
k=0
103
1
248
1
1
+
=
.
= +
=
2 1 102
2 990
495
We might notice that it is not possible to enter x in Derive as a decimal
but we can define it by means of the infinite series above. Then, simplifying
we get the above result.
8.4
We can determine the sum of a geometric series exactly but for mostPconvergent infinite series this is impossible. If the series converges to s =
k=0 ak ,
then by
P definition s can be approximated arbitrarily closely by the partial
sums nk=0 ak for large enough n. In this section we investigate two methods
for approximating infinite series, with a given precision.
CHAPTER 8. SERIES
138
ai converges.
(b) Suppose that 0 < x < 1 and that for some n, ai+1 /ai x for all i > n.
Then
(7)
ai
i=1
n
X
i=1
ai
an+1
1x
Proof. If limi ai+1 /ai = < 1, then for any x satisfying < x < 1,
we know that the ratios will be less than x for all large i. Thus, given x
there is an n for which ai+1 xai whenever i > n. So an+2 xan+1 and
an+3 xan+2 x2 an+1 . In general, an+1+k xk an+1 and hence for all m > n
0
m
X
i=1
ai
n
X
ai = an+1 + an+2 + + am
i=1
an+1 (1 + x + x2 + ) =
an+1
.
1x
Thus, the partial sums {sm } are bounded and the series is convergent. Moreover, the inequality (7) follows by taking limits as m .
Example. Suppose we want to use Theorem 1 to prove that the series
X
2k
k=0
k!
1 2 4
+ + + ...
1 1 2
converges and estimate its value with an error of at most 106 . The first
step is to show that limk ak+1 /ai < 1. We think of the terms as a
139
=
ak
k+1
2
for all k > 2. Thus, limk ak+1 /ak = limk 2/(k + 1) = 0 < 1 so the series
converges and furthermore we can take x = 1/2 and n = 2 in Theorem 1(b).
Now we must determine n so that
an+1
= 2an+1 < 106 .
1x
We do this by authoring
VECTOR([n,2*term(n+1)],n,2,20) ,
approximating the result and then searching the entries (by scrolling) until
we find one smaller than 106 . It P
turns out n = 13 works. The last step is
k
to compute the partial sum s13 = 13
k=0 2 /k! giving 7.38905.
We might observe how fortunate we were that k turned out to be so small.
Recall some of our computations using the trapezoid method or Simpsons
rule where similar accuracy required thousands or even millions of computations (using the left endpoint method, for example). It is one of the fundamental properties of geometric series that they converge very rapidly. Think
about it, 6decimal place accuracy with just 15 computations!
As it turns out this series is rather special since
X
2k
k=0
k!
= e2 = 7.38905
X
k!
kk
k=1
140
CHAPTER 8. SERIES
with error again of at most 106. Proceeding as before we author the formula
term(k):=k!/k^k. Now by first simplifying and then taking limits we see
that
1
1
ak+1
kk
= lim
= <
lim
k
k ak
k (k + 1)
e
2
since e > 2. Thus, the limit is less than 1 so the series converges. Furthermore, we can take x = 1/2 in Theorem 1(b). But now we need to find an
integer n so that ak+1 /ak = k k /(1 + k)k < 1/2 for all k > n.
This step is harder than before. If we graph f (x) = (x/(x+1))x it appears
to be decreasing for all x 0. See Figure 8.1.
141
after some rearrangement (see the file F-RATIO for the step-by-step procedure). Since xx /(x + 1)x is positive for x > 0, we need to show that
ln(x + 1) ln x 1/(x + 1) is positive. At this point Derive cant help so
we need an idea from calculus. One quick way to solve this problem is to
use the Mean Value Theorem for the function g(x) = ln x. The Mean Value
Theorem says: g(b) g(a) = g 0(c)(b a) for some a < c < b. For a = x and
b = x + 1 this gives ln(x + 1) ln x = 1/c for some x < c < x + 1. Thus
ln(x + 1) ln x
1
1
1
=
>0
x+1
c x+1
where we obtain the desired inequality since c < x + 1. Thus, f 0 (x) < 0 for
all x > 0 and so f is decreasing.
Now that we have established that the ratios decrease we need to know
when they are less than 1/2. Since
kk
1
ak+1
=
= f (k) f (1) = .
k
ak
(k + 1)
2
for all k 1, it follows that we may apply the theorem for any n. Finally,
by (7), we must determine n so that
an+1
6
.
1 = 2an+1 < 10
1 2
As before we author
VECTOR([n,2*term(n+1)],n,2,20) ,
approximate the result and then search the entries until we find one smaller
than 106 . It turns out in this case that k = 16. Computing the partial sum
s15 gives 1.87985.
P
Now suppose that your series
ak satisfies lim ak+1 /ak = but that
1. The case > 1 is pretty much like the case < 1 except that now
the series diverges. The idea is to pick 1 < x < and observe that
= an + an x + an x2 an + an+1 + an+2 + . . .
for some large n since now ak+1 /ak x for all k n. The case = 1 is
much harder since, as we see in the next section, there are examples in which
the series converges and examples where it diverges.
CHAPTER 8. SERIES
142
m+1
X
(8)
ai
f (x) dx
n
i=n+1
m
X
ai
i=n
The sum on the left is the right endpoint estimate and the sum on the right
is the left endpoint estimate, when we use x = 1 as the subinterval size.
From this inequality, we obtain the following theorem:
Theorem 2. Suppose that f (x) is a continuous, nonnegative, decreasing
function for x 1. Put an = f (n).
P
(a) The
infinite
series
i=1 ai converges if and only if the improper integral
R
f
(x)
dx
does.
1
(b) Moreover, the inequality
(9)
n
X
i=1
ai
n
X
ai +
f (x) dx
n+1
i=1
i=1
ai
n
X
ai +
f (x) dx
n
i=1
(10)
X
i=1
ai
n
X
i=1
ai +
!
f (x) dx
n+1
an
143
i=n+1
and hence the partial sums {sm } are bounded (the first n terms are irrelevant).
Thus, the series converges and the second inequality in (9) follows from
Z
n
X
X
X
X
ai =
ai +
ai
ai +
f (x) dx .
i=1
i=1
i=n+1
i=1
A similar argument shows that the integral is convergent if the series is and
that the first inequality in (9) holds.
The first inequality in (10) is an immediate consequence of R(9) and simin+1
larly it follows that the middle expression in (10) is bounded by n f (x) dx.
But since f (x) is decreasing this integral is less than or equal to f (n) = an
and the theorem is proved.
CHAPTER 8. SERIES
144
n
X
X
ai
ai
f (x) dx
0 s sn =
i=1
i=1
and the second one is the more refined estimate (10) which uses the quantity
n
X
i=1
ai +
f (x) dx
n+1
X
1
1
1
= 1 + 2 + 2 + ...
2
k
2
3
k=1
is convergent. First note that = 1 in the ratio test so we cannot use that
approach. Next, we take f (x) = 1/x2 and observe (say using Derive) that
n
Z n
1
1
dx
= = 1 1 as n
2
x 1
n
1 x
R
and hence the P
improper integral 1 dx/x2 is convergent. Now, by the integral
is the series is convergent. Actually, a similar
test the series 1/i2 <
P, that
p
argument shows that
1/i < whenever p > 1.
Now it is a remarkable fact that
(11)
X
2
1 1
1
+
+
=
.
=
1
+
2
i
4
9
6
i=1
You have to wonder how the term can possibly be involved in this computation. The proof of this fact is beyond the scope of this text but Derive
can help us believe this result. One way to do this is to have Derive simplify
the series and get 2 /6 as the answer. It works, try it. A more independent
145
approach would be to compute the partial sums sn for several n and compare
with a decimal approximation to 2 /6. In Figure 8.3 on the following page
we have Derive make these comparisons with n = 100, 1000, and 10,000.
We also observe that Derive knows about (11) and simplifies the series
accordingly.
Problem: Compute this series to m decimal places. We solve this
problem by using (10) which in this case says:
!
n
X
X
1
1
1
1
2.
(12)
+
0
2
2
i
i
n+1
n
i=1
i=1
Thus, to solve our problem we need only find n so that right-hand side of
(12) is less than 10m , and then use
n
X
1 1
1
1
1
1
= 1+ + ++ 2 +
+
2
i
n+1
4 9
n
n+1
i=1
for our estimate. For example, with m = 6 we need to take n2 > 10m or
n > 1000.
Something rather amazing occurred in this problem. In Figure 8.3 on the
next page we used the partial sums {sn } to approximate the sum s. This is
the natural thing to do since s = lim sn . But the accuracy in Figure 8.3 is
only 3 or 4 decimal places with n = 1000. This error is to expected since (8)
yields
Z
X
1
1
dx
=
0 s sn =
i2
x2
n
n
i=n+1
and the right-hand side is just less than 103 . On the other hand, adding
the term 1/(n + 1) (which is the integral in (10)) increases the accuracy to
1/n2 = 106. This accuracy is 1000 times better than the other estimate.
Put another way, suppose for example that both computations take about 3
seconds with n = 1000 on your PC, the amount of computation time needed
to produce 6 decimal place accuracy using the less efficient method is almost
an hour! See the file F-2-SER which contains a comparison of these methods.
This problem illustrates the potential value of a innovative approach to a
computation compared to the conventional solution.
CHAPTER 8. SERIES
146
1/i2
The Harmonic Series Let us apply the integral test to the harmonic
series, namely,
X
1 1
1
= 1 + + + ...
i
2 3
i=1
We take f (x) = 1/x in the theorem and observe that
Z
x
1
dt
= ln x
t
as
147
100 < ln n =
1
dt X 1
t
i
1
n
so that any n > e100 2.6 1043 is certainly large enough. On the other
hand, using (8) again we have
100
n
X
1
1
=1+
n
X
1
2
Z
1+
1
n1
dt
< 1 + ln n
t
so that when combined with the above we see that the best n satisfies: e99 <
n < e100 .
8.5
Laboratory Exercises
For these problems it is a good idea to have more digits of precision: choose
Declare/Algebraic State/Simplification and the Digits box to 10 or 12.
1. Formula (3) on page 134 shows the amount of money in an account
after n years if the interest rate is r, the original amount is A, and
the interest is compounded k times a year. In Problem 1 on page 191
you showed that if interest is compounded continuously, the amount of
money would be Aern .
a. Show that the limit as k of compounding k times a year is
the same as compounding continuously.
b. If you put $1000.00 into an account earning 4.5% interest, how
much money will be in the account after one year if the interest
is compounded yearly? quarterly? daily? continuously?
c. Do the previous part only assume that the bank is paying 9%.
2. Suppose you get a 30 year mortgage loan for $200, 000 which is to be
repaid in 30 12 equal monthly payments, based on an annual interest
rate of 7.5%.
a. Find your monthly payment.
CHAPTER 8. SERIES
148
b. How much do you still owe after your first payment? How much
of your first years payment went to interest and how much went
to paying off the principal?
c. Formula (4) gives the amount you still owe after k months. Replace the k with 12k in Formula (4) so that k now represents years,
approximate the resulting expression and then plot. (Youll need
to adjust the range in such a way that the visible x-axis contains
the range 0 to 30 and the yaxis contains the range 0 to 200, 000.)
Notice that at the beginning the amount you owe changes slowly
but that near the end of the 30 years it changes quickly.
3. In some problems involving monthly payments or interest the monthly
interest rate is computed by dividing the annual rate by 12. But sometimes the monthly rate m is not specified and instead the effective
annual rate r is given. This means that compounding the monthly rate
m 12 times gives the annual rate r, i.e. (1 + m)12 = 1 + r. Consider
the previous problem but now suppose that the effective annual rate is
7.5%.
a. Calculate the monthly rate for this problem.
b. Find the monthly mortgage payments using this new rate.
4. The bank says that it will give you a car loan of $6,000 provided you
make monthly payments of $135 for 5 years. What interest rate is the
bank charging? (Hint: You may need to be a little careful how you
compute this.)
5. Consider the fraction 1/7.
a. Using Derive show that 1/7 appears to have a repeating decimal
expansion. What is it?
b. Express this repeating decimal from part a as an infinite series,
see the example on page 137.
c. Have Derive simplify this series.
d. Identify the a and x terms from (2) and verify using that formula
that your infinite series simplifies to 1/7.
149
P
2
6. Have Derive evaluate the sum
n=1 1/n . (Make sure you use Exact
mode.) Evaluate the left and right sides of formula (9) in Theorem 2
for n = 1000. You should approximate the sum rather than Simplify,
otherwise the computation time is fairly long. Use these to estimate
giving upper and lower bounds.
P
7. For each of the following series
k=0 ak find = limi ak+1 /ak and
show that < 1/2. Now
Pn use Theorem 1(b) with x = 1/2 to find n
large enough so that
k=0 ak approximates the series with error at
6
most 10 .
a.
X
k3
k=0
b.
4k
X
(k!)2
(2k)!
k=0
X
k=2
c.
X
k=1
1
k(ln k)2
b.
X
1
k3
k=1
1
1 + k2
9. Some of the following series converge and some diverge. Decide which
do which and state the required Theorem needed to prove your conclusion.
a.
c.
2k
b.
1
k ln k
k=0
k=2
X
1
ek
k=0
X
2 4 2k
d.
k=1
P
k=0
(2k)!
1/k!.
CHAPTER 8. SERIES
150
b. Have Derive simplify this series.
1+2
k 2 /t
1+2
k=1
!
k 2 2 t
k=1
is known to hold for all t > 0. The formula is derived from an important technique in the theory of Fourier transforms called Poisson
summation. We will not attempt to prove this formula but instead try
to use it as a method of approximating more efficiently than in an
earlier problem. It has a number of other useful applications too. We
will fix the value of t = 2 for the rest of this problem.
a. Using the ratio test, show that both infinite series in (13) are
convergent.
P
2
2k 2 2
that
b. Use Theorem 1 with x = e6 and n = 1 to show
k=1 e
X
2
ek /2
0< 1+2
1+2
k=1
=2
ek
2 /2
6
X
!
ek
2 /2
k=1
< 1010
k=7
and hence
1
1+2
6
X
!2
k 2 /2
k=1
151
e10k
2 2
< 1042
k=1
152
CHAPTER 8. SERIES
Chapter 9
Approximating Integrals with
Taylor Polynomials
9.1
Introduction
f (x) dx
0
Pn (x) dx =
0
Z bX
n
0
ak x dx =
k=0
n
X
k=0
ak
bk+1
k+1
154
9.2
P
Recall from (11) of Chapter 7 on page 115 that if nk=0 ak xk is the nth Taylor
polynomial for f (x), then an upper bound for the error made in estimating
f (x) with this Taylor polynomial is given by
n
X
|x|n+1
(1)
ak xk M
f (x)
(n + 1)!
k=0
where M is the maximum of |f (n+1) (t)| on the interval connecting 0 to x.
This can be written as
X
|x|n+1
|x|n+1
M
f (x)
ak xk M
(n + 1)!
(n + 1)!
k=0
n
(2)
b
M
f (x) dx
M
(n + 2)!
k+1
(n + 2)!
0
k=0
Writing this with absolute values:
Z
n
b
X
|b|n+2
a
k
(4)
bk+1 M
f (x) dx
0
k+1
(n + 2)!
k=0
This technique
works for integrals going from 0 to b. If you want to
Rb
approximate a f (x) dx, you can make the substitution u = x a so the
R ba
integral becomes 0 f (u) du.
9.3
1
where we shift the variable
1x
so that x = 0 yields ln 1 = 0. First of all, we have the integral representation:
Z x
1
dt
=
for
< x < 1.
ln
1x
0 1t
155
Now, the idea is to approximate the integrand by its Taylor series but in
this case we recognize the connection with the geometric series; namely,
tk =
k=0
1
1t
for
1 < x < 1.
Well actually use the following more refined estimate from Section 8.2:
(5)
X
X
tn+1
1
tk =
tk = tn+1 + tn+2 + =
1 t k=0
1t
k=n+1
(6)
tk dt
ln
1 x k=0 k + 1
1
t
0
k=0
Z x n+1
t
(7)
dt .
=
0 1t
Taking absolute values of the above we need to evaluate the integral in (7).
Since this looks complicated, we instead try to obtain an upper bound. For
1
1
1x
to obtain that
positive x, we uses the inequality 0 < 1t
Z x k+1 Z x n+1
xn+2
t
t
(8)
dt
dt =
.
(1 x)(n + 2)
0 1t
0 1x
1
On the other hand, for negative x, we instead use 0 < 1t
1 to get a similar
bound:
Z 0 k+1 Z 0
|x|n+2
t
n+1
(9)
dt
.
|t|
dt
=
(n + 2)
x 1t
x
0x<1
|x|n+2
= 0 whenever
n (n + 2)
1 x 0
lim
and
lim
156
One small point, the polynomial approximations in (6) look a little different from the standard Taylor polynomials because the powers are expressed
with the index k + 1. This is just an artificial difference since
Pn+1 (x) =
n+1 j
X
x
j=1
X xk+1
x2
xn+1
=x+
++
=
j
2
n + 1 k=0 k + 1
n
xn+1
, 0 x < 1;
(1 x)(n + 1)
1
ln
(10)
1 x Pn (x) n+1
|x|
,
1 x 0
(n + 1)
which tends to zero as n . This leads to the Taylor series representation
X xj
1
ln
=
1x
j
j=1
(11)
9.4
for
1 x < 1.
An Integral Approximation
for all < x < +. Now for x 6= 0 we can divide both sides by x to get
x2 x4
sin x
=1
+
... .
x
3!
5!
157
x
3 3! 5 5! 7 7!
0
Z
! Z
3
1 sin x X
1 |x|8
n 2n
1
(1)
x
=
dx
dx =
.
0
x
(2n
+
1)!
9!
9
9!
0
n=0
Finally, since 1/(9 9!) 3.0619 107 we get 6 decimal place accuracy by
approximating the integral using 4 terms from the series.
In Figure 9.1 on the next page we have Derive approximate our integral
using 20 digit precision. This computation, which uses Simpsons rule, is
actually quite slow, Load the file F-SININT and try this yourself. On the
other hand, we enter the partial sums of the series solution and make a table
comparing the first several sums with the answer from Derive. Notice that
the theoretical error that we calculated above is practically the same as the
actual error when n = 3.
158
9.5
Laboratory Exercises
1. Use (17) on page 121 and (11) on page 156 to prove that
X
x2k+1
1+x
ln
(14)
=2
for 1 < x < 1
1x
2k + 1
k=0
2. Let f (x) = ln 1+x
for 1 < x < 1. In this exercise we will use the
1x
representation (14) above to compute ln 3.
a. Determine the value of x in the standard representation of the
logarithm function (17) on page 121 that makes the left hand side
of that relation equal to ln 3. Explain why the infinite series on
the right hand side can not be used to compute ln 3.
and show that y = g(x) is a strictly increasing
b. Plot g(x) = 1+x
1x
function on 1 < x < 1 with range 0 < y < .
c. Solve
1+x
1x
159
X
dt
2
= ln 2 =
.
2k+1
t
(2k
+
1)3
1
k=0
In Chapter 6 we studied numerical integration techniques for approximating the above integral with the most efficient method being Simpsons rule. One the other hand, using the ratio test on page 138 we
approximated the infinite series similar to the above.
a. Using the error in Simpsons rule, formula (5) on page 99, determine approximately how many subdivisions (and hence how many
computations) are needed to obtain 8 decimal place accuracy.
b. For completeness, also do part (a) using the left endpoint method
and the trapezoid method.
c. Show that the ratio of terms in the above series is less than 1/9.
d. Using formula (7) of Theorem 1 on page 138 with x = 1/9, determine how many terms are needed to approximate ln 2 to 8 decimal
places.
e. Now compare all four approximation techniques. Which method
is the most efficient?
Z
dt
2
0 1+t
and the techniques of this chapter to prove that the Taylor representation
X
x3 x5
(1)k 2k+1
1
x
+
. . . for 1 x 1
=x
tan x =
2k + 1
3
5
k=0
1
tan
x=
holds. Look back at Problem 6 on page 129 and also Problem 3b.
What are the implications of this problem to the earlier ones?
160
Instead of starting with the Taylor polynomial for ex , start with the
Taylor polynomial of ex .
Chapter 10
Polar and Parametric Graphs
10.1
Introduction
10.2
Polar Coordinates
We can specify a point in the plane by how far it is from the origin and what
angle the line from the point to the origin makes with the xaxis. If r is the
distance from the origin and is the angle, we say that [r, ] are the polar
coordinates of the point; see Figure 10.1 on the next page. Thus, for example,
the
point with rectangular coordinates (1, 1) would have polar coordinates
[ 2, /4]. The way to envision plotting a polar point [r, ] is to stand at
the origin facing out towards the positive xaxis and then turn counterclockwise by the angle and then move r unit in the direction you are now
facing. We usually think of r as being nonnegative, but if r is negative, we
simply go backwards |r| units. Similarly, we plot negative angles by turning
161
162
[r, ]
163
164
menu (or just press F3 to toggle the Trace mode) and the cross will turn into
a box and it will be moved onto the last curve plotted. Now press and hold
down the right arrow key and watch the little car drive around the curve.
You can see the value of , which we can also interpret as time, as it increases,
as well as the r and coordinates, on the lower part of the screen. If you
have more than one graph you can switch between curves by using the up or
down arrow keys.
When plotting the cardioid a = 1 pay particular attention to the way the
plotting slows down as we approach the cusp. It turns out that the only way
for cusps or corners to occur in the graph, when r() is differentiable, is for
the plotting to slow to a stop and then to start up again. This notion of
speed will be discussed in Section 10.5.
10.3
A nice feature of polar coordinates is the ease with which we can rotate a
figure. For example, if we plot r = () and we want to rotate the picture
clockwise by an angle we simply plot r = ( + ) instead. Try this out in
for yourself using Derive.
Here is an interesting application of this idea. Did you know that the
curve y = 1/x, which is used to define the natural logarithm, is a hyperbola.
The equation does not make this apparent since using the usual convention;
namely, the axes should be chosen parallel and perpendicular to the axes of
symmetry, we are supposed to have the equation of the form:
x2 y 2
2 = 1.
a2
b
We need to discuss converting polar graphs to rectangular graphs and
vice versa. Figure 10.1 on page 162 makes it clear how to do this. The
algebraic relationship between the polar coordinates [r, ] and the rectangular
coordinates (x, y) is given by the right triangle formed from the 3 points:
(0, 0), (x, y) and (x, 0). The equations are:
p
(1)
x = r cos , y = r sin and r = x2 + y 2, = tan1 (y/x)
In Figure 10.3 on the facing page we enter xy = 1, convert to polar
coordinates by using the above equations and then rotate by = /4 in the
165
166
10.4
Complex Numbers
Recall that we can also think of the points in the plane as complex numbers.
Thus, the point (a, b) in rectangular coordinates can also be considered to
be the complex number a + b i. This raises the question of whether the polar
coordinate representation of points in the plane might have an interesting
application to visualizing complex numbers.
The connection between these two ideas is provided by the Euler Formula
that we discussed in an earlier problem (see Problem 6 on page 127). The
formula, which essentially defines the complex exponential function, is given
by
ei = cos + i sin
By looking at this formula we now realize that any complex number
z = x + y i can be expressed as
z = |z|ei
where |z| =
p
x2 + y 2
and the angle comes from its polar coordinate representation. Note that
the modulus |z| is simply the r in the polar coordinate representation. Thus,
z = |z|ei = r cos + ir sin
so that z has the polar coordinate representation [r, ].
1
Derives function ATAN has a two-variable form ATAN(y, x) which does the right
thing.
167
10.5
Parametric Curves
As we saw in the last section we obtain many interesting curves by plotting r = () with in polar coordinates. However, there are
still limitations on the shape of a polar curve (just as there are limitations
on the shape of a rectangular graph) although these limitations are not as
transparent since we have seen examples of looping in the limacon curves.
To study general curves we need the idea of parametric curves. To specify
the motion of a particle in the plane; for example, the position of the ant
crawling around on the plane, we return to rectangular coordinates and give
the xcoordinate as a function, x = x(t), of a parameter t (which is usually
thought of as time) and similarly for y = y(t). This means that at time t0
the particle is at the point (x(t0 ), y(t0 )).
As an example, the equations (1) on page 164 show that the polar graph
r = () for can be thought of as a parametric graph if we set
x(t) = (t) cos t,
where
t .
168
Of course, this makes the plotting problem harder since we probably wouldnt
use the geometry of polar coordinates to plot points. The computer on the
other hand doesnt use geometric consideration since it just plots lots of
points and connects them with line segments.
Let us consider the non-polar example
x(t) = 4 cos t,
y(t) = sin t,
where 0 t .
169
the parameter interval and then plot the curve. You might have thought that
Derive would plot the two functions 4 cos t and sin t since we know that this
happens for 3 or more functions in a vector. But when a vector contains only
two functions, it is treated as a parametric curve.
Looking at the picture you might have guessed that the curve in Figure 10.4 was an ellipse (even if you didnt read the caption) because of its
oval shape. Of course, not all oval shaped curves are ellipses but indeed this
example is one since one easily checks that
x(t)2 y(t)2
+ 2 = sin2 t + cos2 t = 1 for all t
42
1
and hence the particle travels along the ellipse x2 /4 + y 2 = 1 centered at
the origin with semi-major axis 4 and semi-minor axis 1. Observe that this
information does not tell you how the particle travels around on this ellipse.
For instance, is it going clockwise or counterclockwise? Does it ever stop?
See Figure 10.4 again and try the slow down technique to understand
how the parametric curve can be thought of as a particle moving along a
curve (like a car traveling over a roadway). By using this technique it is
apparent that the motion is counterclockwise (as time t increases) and it
never stops. This interpretation will be extremely important in later courses
when Newton famous F = ma law is used to analyze the forces acting on a
moving particle.
Tracing parametric curves. Let us recall the tracing technique from
Section 10.2, which we used for polar curves. We now want to drive around
a parametric curve and observe its speed. After plotting the parametric curve
above press F3. The cross will turn into a box on the curve and pressing and
holding down the right arrow key will move the little car drive around the
curve. You can see the time parameter as it increases, as well as the x and
y coordinates, on the lower part of the screen.
By watching the particle move while you press and hold down the right
arrow key, you can see that the particle is traveling in the counterclockwise
direction and a careful inspection will reveal that the speed (rate of change of
distance with respect to time) is slower on the sides than the top and bottom
parts of the curve. This is actually a consequence of one of Keplers laws of
planetary motion. This law states that certain moving bodies revolving about
a central point (such as the origin in this example) sweep out equal area in
170
equal time. Assuming this fact, then the particle needs to be faster near the
top and bottom since these points are closer to the origin and hence sweep
out less area. Whereas the left and right portions of the curve are further
from the origin and hence require less time to sweep out an equal amount of
area.
One can calculate the speed directly as follows: Over a small time interval
t the x-position changes by x (= x(t + t) x(t)) and the y-position
changes by y.p Thus, the distance traveled during that time interval is
approximately x2 + y 2 and hence the average speed is given by
s
p
2
2
2
2
p
x + y
x
x
=
+
x0 (t)2 + y 0 (t)2
t
t
t
Taking limits as t 0 leads to the formula:
p
Speed at time t = x0 (t)2 + y 0(t)2 .
(2)
Derive has an alternate approach for curves described by [x(t),y(t)];
namely, one uses Calculus/Differentiate on the vector and then
applies ABS
to the result. This works because ABS([a,b]) simplifies to a2 + b2 .
Another use of Derives tracing feature is for curves that retrace themselves and hence make motion on the curve difficult to see. Try the example,
x = sin t cos t and y = sin 2t for 0 t 2. That is, plot the vector [sin
t cos t, sin(2t)]. Surprisingly, the picture is simply a line segment with
endpoints (1/2, 1) and (1/2, 1). But how does the particle travel around
this curve? By pressing F3 and tracing the curve we see a back and forth
motion which reminds us of a swinging pendulum. In fact, by carefully observing the motion near the endpoints we see the particle slow down and
stop. Then, it turns around and goes back in the opposite direction gaining
speed as it approaches the center of the line segment and then slowing down
as it approaches the other endpoint. A point where the speed is zero is actually the only way a smoothly parametrized curve, i.e., one for which x(t)
and y(t) are continuously differentiable, can have cusps (like the cardioid) or
corners (as in this example) or otherwise exhibit nonsmooth behavior. Check
directly the speed at the endpoints.
As a last example, enter x = 2 cos2 t and y = 2 sin t cos t for 0 t . In
this case we have another surprising picture of a circle, which we can verify
by showing
(x(t) 1)2 + y(t)2 = 1 for all t.
171
172
10.6
Laboratory Exercises
ed
1 + e cos
173
c. Plot the curve with e = 2 with 2.09 < < 2.09. Can you
identify this conic?
d. In the last plot, what is the significance of the number = 2.09?
What curves do you get when < < 2.10 or 2.10 < < ?
(Warning: If you try plotting with the default range [, ] it will
eventually graph the complete conic but it takes a very long time!
Press Esc if you cant wait.)
6. Let x = (cos t)3 and y = (sin t)3 for t .
a. Plot the parametric curve.
b. Use Derives tracing method described on page 169 to find where
the speed is 0 on the graph.
c. Switch to the algebra window and verify your empirical observations by using (2) on page 170 to determine exactly where the
speed is zero.
7. Let x = t sin t and y = t cos t for 3/2 t 3/2
a. Plot the parametric curve.
b. Use tracing to determine how a particle (ant) traverses the curve
over the given t interval. Sketch arrows on the graph to indicate
the motion.
c. What will happen if t is allowed to exceed 3/2? Does it go around
the curve again?
*8. Start by authoring
r(, a) := a(esin 2 cos(4))
where we think of this function as a polar curve in with a paramenter a. Use Derives vector function to make a vector of the function r(, a) where the parameter a goes from 1 to 2 in increments of
size 0.25. (So after you simplify it, the vector will contain 5 functions.)
Plot this vector of 5 functions using polar coordinates. Does it look
like a butterfly? (This curve is similar to one described by T. H. Fay,
174
175
y(t) = 4t 5,
t0
y(t) = 3 cos(t/2),
t0
Plot both of these curves. Find where the curves intersect. But just
because the curves cross does not mean the particles collide; they might
arrive at the intersection point at different times. Where do the particles collide?
176
Chapter 11
Exponential Growth and
Differential Equations
11.1
Introduction
11.2
Examples
178
that y 0 (x) = ky(x) for some fixed constant k and all x. Now it is easy to
check that y(x) = y0 ekx satisfies the relations
(1)
dy
= y 0 = ky
dx
y(0) = y0
as
dy
=k
y
11.2. EXAMPLES
179
ln 3
1.
4
Finally, we substitute this value in the above equation and then have Derive
solve for y to get the answer to the differential equation.
180
You should always check your answer to make sure it satisfies the differential equation and the initial conditions. In Derive you could differentiate
the answer and set that equal to xy 2 4x where you use your answer in
place of y. Now Simplify, you should get the value true which indicates that
Derive was able to verify that the equation is an identity. You might also
try this problem with pencil and paper ! The y-integral part involves some
work since this is a partial fractions integration problem.
Be CarefulR With Logarithms Since Derive gives the answer ln y, for
the integral dy/y, instead of ln |y| this can cause some problems. From our
definition of the logarithm it doesnt make sense to take the log of a negative
number. But Derive uses a more advanced definition which uses complex
numbers and might cause some confusion for you. For example, Derive uses
the formula ln(1) = i when it simplifies expressions. You have two choices:
use Derive to solve the equations (potentially using complex numbers) or
else change the answer to the integrals involving logarithms by inserting
absolute values.
In the previous example if we change the initial conditions to y(1) = 1
then we should change the equation resulting from the integrals above to the
following:
x2
1 y+2
ln
=
+c.
4 2y
2
Now proceeding as before will give the solution. Well give several other
examples of how to do this in the following sections.
Newtons Law of Cooling. Another important example of differential
equations is Newtons Law of Cooling. According to this law a hot pan of temperature yhot will have a temperature of y(t) at time t which decreases, i.e.,
will cool down, when placed in a vat of cool water of temperature ycool < yhot .
The key point of the law is that the rate of change in the temperature, y 0 , is
proportional to y(t)ycool , which is the difference in the current temperature
of the (hot) pan and the (cool) water. This says that
(2)
dy
= k(y ycool )
dt
where
11.2. EXAMPLES
181
would be larger. Notice that the derivative dy/dt above is negative since the
temperature is decreasing.
We solve (2) by separating variables and integrating:
Z
Z
dy
= k
dt + c .
y ycool
Simplifying this equation in Derive, we then solve for the unknown constant
c by substituting in the initial conditions x = 0 and y = yhot . Note that we
assume the quantity y ycool to be positive; hence, we can take its logarithm.
We now Substitute this value for c back into the relation above and solve for
y. This gives the solution
(3)
A(t) = A0 ekt
182
11.3
Approximation of Solutions
The general first order differential equation has the form y 0 = f (x, y) with
initial conditions (x0 , y0 ), i.e., y = y0 when x = x0 . The separation of
variables technique for solving differential equations that we discussed in the
previous sections do not extend to all differential equations. In fact, many
important differential equations cannot be solved explicitly by any technique
what so ever. We encountered this situation earlier with integrals1 and this
suggests trying to find numerical approximations to the solution. The critical
observation to make is that the equation y 0 = f (x, y) tells us the slope of
the tangent line to the solution y(x). Thus, by drawing many small line
segments of slope f (x, y), through the point (x, y) in the plane, we obtain an
approximate picture of the solution whose graph contains the point (x, y). By
drawing several of these partial tangent lines we get an approximate picture
of y(x) by drawing a curve which conforms to these slopes. These diagrams
are called slope or direction fields.
The file ADD-UTIL adds the function DF (for direction field) which will
make a matrix. When this matrix is plotted it draws the slope field. The
form of DF is
DF(r,x,x0,xm,m,y,y0,yn,n)
where the first argument r is f (x, y) and x0, xm, m represent the initial
and final x-values in a rectangular grid with m x-values plotted. Similarly,
y0, yn, n represent the initial and final y-values in a rectangular grid with
n y-values. Hence, the total number of line segments plotted will be m
n. In order that line segments are plotted, not just the endpoints, we put
the plotting window into connected mode by choosing Options/Points and
setting Connect to Yes.
As an example, we can take the cooling problem above, namely,
y0 + y = 1
so that f (x, y) = (y 1) = 1 y. We simplify the expression
df(1-y,x,0,4,8,y,0,4,8)
1
f (x) dx so
183
to get the slope field. In the plot window select Option/Plot Color and set
it to Off so that all slope lines will be in one color. Of course, if you like
colorful diagrams then you can skip that last step. Also choose Option/Points
to set the Connected Mode and to set Size to Small. Make sure to delete
all existing graphs and then plot the slope field. Try to picture the solution
though a given initial point (0, y0) by following the slope field. Finally, plot
some actual solutions that we obtained above using the DE function and see
how it conforms to the slope field. See Figure 11.1 where we have graphed
the solution y = 3ex +1, which corresponds to the initial condition y(0) = 4.
Try several other initial conditions to see how the slope lines approximate
the solution.
184
This works well for many populations. But the population cannot continue
to grow forever. When a country no longer has room for expansion the rate of
growth slows. For example, a bacteria culture in a petri dish will satisfy the
above differential equation for awhile, but as the dish fills the above equation
becomes invalid. Verhulst, a Belgian mathematician, proposed a model using
the differential equation
P
dP
= kP 1
(5)
.
dt
P1
Notice that when P is small compared to P1 , the derivative is approximately
kP , as before. But as P approaches P1 , P 0 approaches 0.
We study this equation by looking at the direction field. Lets take a
numerical example
P
dP
=P 1
where P (0) = 1 ,
dt
5
so that the population starts out at a value of 1 and has a maximum value
of 5. Well guess as to how long of a time interval to look at, say 0 t 12.
Thus, we enter
df(p(1-p/5),t,0,12,12,p,0,6,6)
and Approximate to get a large direction field matrix. See Figure 11.2 on
the facing page for a picture of the direction field.
Looking at the picture of the direction field you should be able to see the
solution approximately by starting at the point (0, 1) and following along
in the direction of the tangent lines. The picture makes it appears that it
takes only about 6-7 time units before the population reaches its maximum
value of 5.
To solve (5) exactly we separate variables and integrate
Z
Z
dP
= k dt + c .
P (1 PP1 )
In Derive we would first declare the variables P0 and P1 by entering [p0:=,
p1:=] and then entering each of the integrals. Then, we Author the above
equation. Notice that we added the integration constant c. After simplifying
we get
ln P ln(P P1 ) = c + kt
185
186
a power where the power is the above equation and then Simplifying. This
yields the equation
P0 ekt
P
=
P1 P
P1 P0
which Derive can solve for P . The result is
(6)
P =
P0 P1 ekt
P0 ekt + (P1 P0 )
11.4
187
11.5
In Derive you can multiply both sides of an equation by an expression by right clicking
the equation, inserting with parentheses into the author box and then multiplying.
188
as we claimed.
Equation (1) is a special case of the general equation
(8)
y 0 + p(x)y = q(x),
y(x0 ) = y0
where y(0) = 5
y 0 + ky = kycool
y(0) = yhot
and thus we can solve this equation with Derive by using the DE function.
We will use the variables yh and yc in place of yhot and ycool . So that these
189
are treated as single variables (and not as y h) we first Author the vector
[yh:=,yc:=]. Then we Author
de(k,k*yc,t,y,0,yh)
Simplifying the expression gives the solution
y(t) = (yh yc)ekt + yc.
(10)
See Figure 11.4 for a demonstration of these functions and observe how
rapidly the temperature y(t) tends to the water temperature yc. Use Derive
to calculate limt y(t).
190
e y(x) =
(x) = e
p(x) dx
0 (x) = p(x)(x).
since
q(u)e 0
du + y0 .
y=e 0
x0
Rx
p(u) du
y=e
Rx
x0
Z
p(u) du
Ru
q(u)e
x0
p(v) dv
du + C .
x0
191
As we said, the solution (12) to the differential equation can be made into
a Derive function quite easily. You should look at the formula above and
see if you can write a Derive function that will produce the solution. Then
compare your answer with the following definition of the function DE.3
(13) de(p,q,x,y,x0,y0):= y =
e^(-int(p,x,x0,x)) * (int(q*^
^
e^int(p,x,x0,x),x,x0,x)+y0)
11.6
Laboratory Exercises
The functions discussed in this chapter, DE, DF, and EULER, are all defined
once you Load in the file ADD-HEAD.
1. If money earns interest compounded continuously and y(t) is the amount
of money at time t, then y satisfies the differential equation y 0 = ry,
where r is the interest rate.
a. What is the solution to the differential equation y 0 = ry?
b. Find how long it takes for your money to double for r = 3%, 5%,
and 10%? (This means that r = 0.03, 0.05, and 0.1 in the above
equation.)
2. Normal body temperature is 98.6 F. If someone dies, then the body
cools according to Newtons law of cooling. It is known that, if the
surrounding temperature is a constant 64 , then the body will cool to
92 in 3 hours.
3
You might notice that the formula for the solution to the differential equation in
Theorem 1 is careful about the dummy
R x variables in the integrals. This is because in
calculus we avoid integrals of the form a f (x) dx because the integration variable x might
be mistaken for the upper limit x. Since the integration variable is completely arbitrary
we usually take it to be t or u in such a situation. On the other hand, for the Derive
function de above we used expressions like int(f(x),x,0,x) because the integration is
done before the limits of integration are substituted. The computer does this correctly
but it is usually foolhardy for students to try this since it is so easy to make mistakes such
as
Z x
Z x
x dx = x
dx = x2
0
192
with
y(1) = 1.
with
y(1) = 1.
193
194
Chapter 12
Harmonic Motion and
Differential Equations
12.1
Introduction
where g is the force due to gravity (which we assume is constant). The initial
conditions in this case are the initial height y0 and the initial velocity v0 . By
integrating twice and solving for the initial conditions we get the solution
y = y0 + v0 t 12 gt2 . Here are the steps:
195
196
Z
y =
Z
y=
g dt = gt + c1 = gt + v0
1
1
gt + v0 dt = gt2 + v0 t + c2 = gt2 + v0 t + y0
2
2
(1)
These equations are linear differential equations because of they only involve
y 00 , y 0 and y in a linear relation. It turns out that to solve these equations
we need to use the complex exponential function ex which was discussed
earlier in Problem 6 on page 127 in Chapter 7. Here = a + b i is in general
a complex number (see Section 5.4 on page 78 for a brief tutorial on complex
numbers).
12.2
Examples
y 00 +
k
y=0
m
As an example suppose we pull the particle down d units and let go.
Then, the initial condition would be: y0 = d and v0 = 0
12.2. EXAMPLES
197
y 00 +
b 0 k
y + y = 0.
m
m
198
The component of the force in the direction of the pendulum rod is cancelled out by the rod. The force along the arc is gm sin . Newtons law,
F = ma says md2 s/dt2 = gm sin . In terms of we get the differential
equation:
(4)
g
d2
= sin
2
dt
l
This is not a linear equation because of the sin . But the Taylor series is
sin = 3 /6 + , so if is small we can approximate sin with . Using
this (4) becomes
(5)
d2 g
+ =0
dt2
l
12.3
d
= 0 when t = 0 .
dt
r 2 + br + c = 0
b + b2 4c
b b2 4c
r1 =
(7)
and r2 =
2
2
and so both y = er1 t and y = er2 t are solutions to (1).
199
Now, we take advantage of the fact that our differential equation is linear.
We claim that if y1 , y2 are solutions to (1) then so is any function of the form
y = C1 y1 + C2 y2 where C1 , C2 are arbitrary constants. This is easy to verify:
y 00 + by 0 + cy = (C1 y1 + C2 y2 )00 + b(C1 y1 + C2 y2 )0 + c(C1 y1 + C2 y2 )
= (C1 y100 + C2 y200 ) + b(C1 y10 + C2 y20 ) + c(C1 y1 + C2 y2 )
= C1 (y100 + by10 + cy1 ) + C2 (y200 + by20 + cy2 ) = C1 0 + C2 0 = 0 .
Finally, we take y1 = er1 t , y2 = er2 t above and then use the two arbitrary
constants C1 , C2 to solve for the two initial conditions:
y(t0) = y0
y 00 y 0 2y = 0 where y(0) = 3,
y 0 (0) = 0 .
200
y 00 + y = 0 where y(0) = 3,
y 0 (0) = 0 .
201
mass-spring system (see (2)) and this couldnt possibly have complex numbers in the solution. Let look at the computation:
3
3
y = eit + eit
2
2
3
3
= (cos t + i sin t) + (cos t i sin t)
2
2
= 3 cos t
and hence the i-term drops out of the solution. Although we were convinced
of this fact from a physical point of view it was far from obvious from an
algebraic point.
To see why this is always the case we make an important observation
about (1). Since we tacitly assume that the coefficients b, c are real numbers
observe that if y is a solution to (1) then so are the real part <y and the
imaginary part =y of y also solutions to this equation. Lets verify this for
the real part (you may need to refer back to Section 5.4 and Problem 8 on
page 91). Recall that we have already shown that solutions can be combined
by multiplying them by constants and then adding them. Since <y = (y +
y)/2 we need only show that given a solution y that its complex conjugate
y is also a solution. Let verify this fact:
y )0 + c(
y ) = y 00 + by 0 + c
y
(
y )00 + b(
= y 00 + by 0 + cy = 0 = 0 .
This means that instead of using complex exponentials for the two solutions
y1 , y2 and then solving for complex C1 , C2 so that C1 y1 + C2 y2 satisfies the
initial conditions we could instead solve the initial value equations
y = C1 cos t + C2 sin t where y(t0 ) = y0 and y 0(t0 ) = v0
which would not involve complex numbers at all. Of course, since we ultimately use Derive to do the algebra, i.e., DE2(b, c, t,t0, y0, v0) this
is mostly important for hand calculations.
Let us return to the general equation (1) with characteristic equation
r 2 + br + c = (r r1 )(r r2 ) = 0
with solutions r1 , r2 given by (7). If b2 4c 0 then these are real solutions.
If b2 4c < 0 then both r1 and r2 are complex numbers. We can write
202
y = C1 er1 t + C2 er2 t
if b2 4c > 0
(11)
y = C1 er1 t + C2 ter1 t
if b2 4c = 0
(12)
y = C1 et cos(t) + C2 et sin(t)
if b2 4c < 0
Using this form of the general solution we solve for the two arbitrary
constants C1 , C2 using the initial conditions as above. Again, assuming you
have loaded the ADD-HEAD file, you can solve (1) subject to these initial
conditions by authoring
DE2(b, c, t, t0, y0, v0)
Springs and Hookes Law. Returning to our mass-spring example, suppose we have a mass m attached to the end of a spring hanging from the
ceiling. If we pull the mass down a little it will bounce (oscillate) up and
down. We image it moving along the yaxis with y = 0 denoting the rest
position. Hookes Law for the spring force differential linear equation:
(13)
y 00 +
k
y = 0.
m
As an example suppose we pull the mass down d units and let go. Then
y0 = d and v0 = 0 so we can find the motion by authoring DE2(0, k/m,
t, 0, -d, 0) but first we need to tell Derive that the two constants k,
203
m are both positive numbers. You use the Declare/Variable Domain to tell
Derive that k is positive and do the same for m. Now simplifying the DE2
function gives the answer
!
k
d cos t
m
Figure 12.2 shows the graph of this function when k = 2 and m = 1 and
d varies between 2 and 2 in increments of 0.5. Notice all of the graphs
cross the xaxis at the same place; that is, at the same time. So it doesnt
matter how far the spring is pulled down it will take
q the same amount of
k
then time to return
time to return to its original position. If we let = m
to the original position is 2/ independent of d. This is called the period
of oscillation. is called the angular frequency while the reciprocal of the
period, /2 is the frequency. In Exercise 4 on page 213 you investigate
what happens if we start with y0 = 0 but vary the velocity.
204
Damped oscillation. Recall that the frictional force due to the oil in the
vat is proportional to the velocity of the mass. This extra force changed the
differential equation (2) to
(14)
y 00 +
b 0 k
y + y=0
m
m
k
b
r+
=0
m
m
b2 4km
2m
b2 4km < b
0 < b2 4km < b2 so
and thus, both r1 and r2 are negative. So the general solution is the sum of
two decaying exponentials.
If b2 = 4km the spring is critically damped. The solutions are given
by (11). Again r1 is negative. If b2 4km the spring is under damped. The
solutions are given by (12).
205
2
15
15
15
t +
sin
t
et/2 2 cos
2
15
2
We use the Declare/Algebra State/Simplification menu to set Trigonometry
to Collect and simplify again we get
!
8 15 t/2
15
15
e
t + 2 arctan
sin
15
2
5
2.06559et/2 sin(1.93649 t + 1.31811)
206
d2 g
+ sin = 0
dt2
l
Since this is not a linear equation we approximate sin with to get (5), i.e.,
(16)
d2 g
+ =0
dt2
l
12.4
207
y 0 = r(t, y, z)
z 0 = s(t, y, z)
These can be solved exactly if r(t, y, z) has the form ay + bz and s(t, y, z)
has a similar form. (When r and s have this form, the system of equations
(18) is called linear.) Since the examples we are interested are not linear, we
concentrate on finding approximate solution to (18).
In Chapter 11 we described Eulers method for finding an approximate
solution of a single first order equation y 0 = f (t, y) subject to the initial
conditions y(t0 ) = y0 . We start with the point (t0 , y0). Since we know the
slope of y at this point is f (t0 , y0) we draw a short line segment from (t0 , y0 )
to (t1 , y1) = (t0 + h, y0 + hf (t0 , y0 )), where h is a small increment. The
(n + 1)st point is obtained the nth by
(tn+1 , yn+1 ) = (tn + h, yn + hf (tn , yn ))
Figure 12.4 on the following page gives the direction field for the simple
differential equation y 0 = 4(t 1). Of course we can find the solutions
by integration. If y(0) = 0 this gives y = 2t(2 t), which we have also
graphed. If we use Eulers method with h = 1/2 the first three points are
(0, 0), (1/2, 2), and (1, 3). As the graph indicates these points are not very
close to the true solution.
208
If instead of using the slope at (tn , yn ) we average this slope with the slope
at the next point (tn+1 , yn+1) we obtain a much more accurate approximation
of the solution. This is known as the second order Runge-Kutta method. The
precise formulae for tn+1 and yn+1 are
(19)
tn+1 = tn + h = t0 + (n + 1)h
h
yn+1 = yn + f (tn , yn ) + f (tn + h, yn + hf (tn , yn ))
2
As we can see from Figure 12.4 this is much more accurate. If we also take into
account the slope at the midpoint of the two points we obtain the fourth order
Runge-Kutta method . This is usually just called the Runge-Kutta method .
209
RK is the same as the one in Derives utility file ODE-APPR so the description of it
in Derives Help applies.
2
This example is taken from J. Callahan and K. Hoffman Calculus in Context,
W. H. Freeman, 1995.
210
population will decrease which in turn will cause the fox population to decrease and so on.
The window in the lower left of Figure 12.5 shows the results of extracting
columns 2 and 3. The point near the crosshair in that window is (2000, 10),
the initial rabbit and fox populations. At the beginning both the rabbit and
fox populations increase. When they reach the point furthest to the right
the rabbit population starts to decrease while the fox population continues
to increase. As we continue along the curve it spirals inward indicating that
the oscillation in the populations get smaller. In Exercise 6 on page 213 your
find the point to which the spiral approaches.
211
g
w 0 = sin
l
12.5
Laboratory Exercises
The functions discussed in this chapter, DE2 and RK are defined once you
Load in the file ADD-HEAD.
1. For each of the differential equations below solve the characteristic
equation and enter the general solution with constants C1 , C2 . Verify
212
y 00 2y 0 8y = 0
b.
y 00 = 4y 0 4y
c.
y 00 = 16y
d.
y 00 4y 0 + 5y = 0
213
214
b. The curve in the lower left window of Figure 12.5 on page 210
spirals inward. Use your answer from the previous part with the
constants on page 209 to guess where it is heading.
7. Suppose in our rabbits and foxes example instead of (17) we use the
simpler equations
R0 = kR cRF
F 0 = dRF eF
without the Verhulst modification.
a. In Figure 12.5 on page 210 we used RK and EXTRACT 2 COLUMNS to
make 3 graphs. Make the same 3 graphs but using these simpler
equations. Describe the differences between your graphs and those
of Figure 12.5.
b. Find the solutions which are constant as in the previous problem.
8. We saw in the lower right frame of Figure 12.6 on page 212 on page 212
that for 0 = 15/16 the solution to (15) and to the linear approximation (5) were quite different. In this exercise we will compare the
solution to (15) with a cos function of the same amplitude and period.
a. Author the expression (21) with 0 = 15/16 and then approximate it. Then graph the result.
b. Using this graph estimate the period P of this function
c. Graph
15
16
cos( 2
t) using the P you found in the previous part.
P
d. Notice the graph you found in the first part is pretty flat at the
top and bottom compared to the cos curve. What is the solution
of (15) if 0 = (and w0 = 0, of course)? You should be able to
just guess the solution.
9. In this problem we explore what happens to a pendulum with initial
position 0 = 0 but with a nonzero value for w0 . If the initial velocity
is not too large the pendulum will swing up to an angle and then
swing back. The motion will be the same as if we started with 0 =
215
and w0 = 0 except that starting place for the graph will be different.
That is, the curves will be the same except one will be shifted to the
right. However if w0 is large enough, the pendulum will swing all the
way over the top.
a. Author
EXTRACT 2 COLUMNS(
RK([w,-25 SIN()],[t,,w],[0,0,w0 ],.05,60),1,2)
Substitute w0 = 9.5 and approximate and then graph the result.
Do the same for w0 = 10 and w0 = 10.5.
b. The behavior of the solutions of the previous part are quite different depending on whether w0 is large enough to send the pendulum
over the top (so it keeps spinning around and around) or it doesnt
make it to the top and so falls back. In this problem we look for
a value of w0 so that it never falls back but also never goes over
the top. We will try to choose w0 so that it will have the exact
amount of energy to just get to the top. Since we are assuming our
pendulum is frictionless, there are two kinds of energy in our system, kinetic and potential energy. Kinetic energy is 12 mv 2 which
in our case is 12 m(ds/dt)2 = 12 ml(d/dt)2 . Potential energy gained
as the pendulum swings above its rest position is mgh where h is
the height above the rest position. So the potential energy at the
top is 2mgl. Use the law of conservation of energy to show that
if the kinetic energy at the bottom equals the potential energy at
the top then
r
g
0
w0 = (0) = 2
l
which is 10 when g/l = 25.
c. While the solution to (15) on page 206 cannot be expressed in
terms of p
elementary functions, the solution when (0) = 0 and
0
(0) = 2 gl can. Show that
g
(t) = 4 arctan(e l t )
216
Appendix A
Utility Files
This book defines 19 Derive functions. All of these functions are defined in
the utility file ADD-UTIL which is quietly loaded; which means the formulas
are not displayed, whenever you load the file ADD-HEAD. This file and its
companion, ADD-HEAD, can be downloaded from our web page
http://www.math.hawaii.edu/lab/
Listings of these files are given at the end of this appendix in the (hopefully
unlikely) event you have trouble downloading them. Additional information
on the use of the functions as well as examples are included on the web site
above.
How to use these files. When a student first starts to work on a lab
assignment he should:
1. Enter (Author) his name and the lab number as a comment. (Comments are entered using the double quotes, ".)
2. Do File/Load/Math add-head.
3. Begin working on his assignment.
The file ADD-HEAD has only four lines. Two of these are comments
and one gives the variable syntax for the commands. The other line is
LOAD("add-util"). This automatically silently loads ADD-UTIL.1 . For
1
This assumes that this file is in the default directory. A default directory should be
established and all F-*.MTH files placed in that directory along with ADD-HEAD and
ADD-UTIL
217
218
A.1
The Functions
Table A.1 on page 221 and A.2 on page 222 list the functions defined in
ADD-UTIL. In each of the examples below it is assumed that the utility file
ADD-UTIL has been loaded as described above. Here are some examples on
their use.
Example 1. If you want to compute a tangent line for say f (x) = x3 /3 at
the point x = 1 you would Author and Simplify TANGENT(x^3/3, x, 1).
The result will be y = x 2/3. We describe the variables for this and the
other functions typically as TANGENT( u, x, a) where the u refers to any
expression in the variable x and a is a parameter in the function which in
this case it is the point we are interested in.
Example 2. Suppose that you want to find the quadratic polynomial ax2 +
bx + c that passes through the three points (0, 0), (1, 2), and (2, 8). You
Author CURVEFIT( x, [[0,1], [1,2], [2,8]]). After simplifying the result will be 2x2 . Probably the best way to do this is to start by defining
the 3 2 matrix of points using the matrix button
and then plotting
the 3 points on a graph. Next you Author the CURVEFIT(x, part and then
right click and insert the matrix of data points. Simplify and plot to make
sure the answer function does indeed pass through the 3 data points. The
219
220
the integral of the expression u, in the variable x over the interval [a, b], using
Simpsons rule with n subdivisions. You Author SIMP(u,x,n,a,b) and press
.
Example 7. Suppose that you want to solve a Newton cooling type differential equation: y 0 = (y 2) with initial conditions y(0) = 4. You start by
manipulating the equation to the form y 0 + py = q where p = 1 and q = 2.
The function DE(p,q,x,y,x0,y0) solves this equation so we just substitute
in the right values which in this case means that we Author DE(1,2,x,y,0,4)
.
and press
Example 8. Suppose that you want to look at the direction field for the
equation y 0 = r where r is an expression in x and y. You use the function
DF(r,x,x0,xm,m,y,y0,yn,n))
where the grid of points is determined by x0 < x < xm with m subdivisions
and y0 < y < yn with n subdivsions. Doing this for the previous example
would mean Authoring say DF(-(y-2),x,0,6,12,y,-2,4,12) and then ap. You get a graph with a slope
proximating the expression by pressing
line at every half integer in an appropriate range of x and ys by plotting the
result.
221
SECANT(u, x, a, h)
TANGENT(u, x, a)
CURVEFIT(x, data)
CURVEFIT(x, data, ddata)
NEWT(u, x, x0)
NEWT(u, x, x0, k)
DRAW COMPLEX(v)
BISECT(u, x, v)
BISECT(u, x, v, k)
LEFT(u, x, n, a, b)
MID(u, x, n, a, b)
222
RIGHT(u, x, n, a, b)
TRAP(u, x, n, a, b)
SIMP(u, x, n, a, b)
DRAW LEFT(u, x, n, a, b)
DRAW RIGHT(u, x, n, a, b)
DRAW TRAP(u, x, n, a, b)
A.2
223
In the event you are unable to download these files, you can type them in.
Probably the easiest way to do this is to start Derive and author each line.
Then save the first as add-head and the second as add-util.
A.2.1
A.2.2
224
ANS(x,data,ddata,a,n):=IF(DIMENSION(ans_:=SOLVE(EQNS(data,ddata,a,n),[a]))=0,~
[],POLY(x,(RHS(ans_)) SUB 1,n))
"Finds the polynomial of the right degree through the nx2-data matrix."
CURVEFIT1(x,data):=ANS(x,data,[],UNK(DIMENSION(data)),DIMENSION(data)-1)
CURVEFIT2(x,data,ddata):=ANS(x,data,ddata,UNK(DIMENSION(data)+DIMENSION(ddata~
)),DIMENSION(data)+DIMENSION(ddata)-1)
CURVEFIT(x,data,ddata):=IF(DIMENSION(ddata)>0,CURVEFIT2(x,data,ddata),CURVEFI~
T1(x,data),CURVEFIT1(x,data))
"Quadratic spline function interpolating data points with initial slope m1."
SPLINE_AUX(x,data,m):=SUM(CURVEFIT(x,[data SUB k,data SUB (k+1)],[[data SUB k~
SUB 1,m SUB k SUB 2]])*CHI(data SUB k SUB 1,x,data SUB (k+1) SUB 1),k,1,DIME~
NSION(data)-1)
SLOPE(data,m1):=ITERATES([v SUB 1+1,2*(data SUB (v SUB 1+1) SUB 2-data SUB (v~
SUB 1) SUB 2)/(data SUB (v SUB 1+1) SUB 1-data SUB (v SUB 1) SUB 1)-v SUB 2]~
,v,[1,m1],DIMENSION(data)-1)
"Note that SLOPE returns the matrix [[1,m1], [2,m2], ...]."
SPLINE(x,data,m1):=SPLINE_AUX(x,data,SLOPE(data,m1))
"Newton algorithm"
NEWT_ITERATES(u,x,x0,k):=ITERATES(x-u/DIF(u,x),x,x0,k)
NEWT(u,x,x0,k):=IF(k>0,NEWT_ITERATES(u,x,x0,k),?,SUBST(x-u/DIF(u,x),x,x0))
"This produces a vector which when plotted demonstrates Newtons method."
DRAW_NEWT(u,x,x0,k):=VECTOR([[v,0],[v,SUBST(u,x,v)],[NEWT(u,x,v),0]],v,ITERAT~
ES(NEWT(u,x,w),w,x0,k))
DRAW_COMPLEX(v):=VECTOR([RE(z),IM(z)],z,v)
"Bisection method helper"
BIS_AUX(u,x,a,b):=IF(SUBST(u,x,a)*SUBST(u,x,(a+b)/2)<0,[a,(a+b)/2],[(a+b)/2,b~
])
"Bisection method"
BISECT(u,x,v0,k):=IF(k>0,ITERATES(BIS_AUX(u,x,v SUB 1,v SUB 2),v,v0,k),?,BIS_~
AUX(u,x,v0 SUB 1,v0 SUB 2))
"Formula for the left-endpoint method for integrating u(x) over [a,b] with n ~
subdivisions."
LEFT(u,x,n,a,b):=(b-a)/n*SUM(SUBST(u,x,a+k*(b-a)/n),k,0,n-1)
"Formula for the midpoint method for integrating u(x) over [a,b] with n subdi~
225
visions."
MID(u,x,n,a,b):=(b-a)/n*SUM(SUBST(u,x,a+(k+0.5)*(b-a)/n),k,0,n-1)
"Formula for the right-endpoint method for integrating u(x) over [a,b] with n~
subdivisions."
RIGHT(u,x,n,a,b):=(b-a)/n*SUM(SUBST(u,x,a+k*(b-a)/n),k,1,n)
"Formula for the trapezoid method for integrating u(x) over [a,b] with n subd~
ivisions."
TRAP(u,x,n,a,b):=(b-a)/(2*n)*(SUBST(u,x,a)+SUBST(u,x,b)+2*SUM(SUBST(u,x,a+k*(~
b-a)/n),k,1,n-1))
"Formula for Simpsons rule for integrating u(x) over [a,b] with n subdivisio~
ns."
SIMP(u,x,n,a,b):=(b-a)/(6*n)*(SUBST(u,x,a)+SUBST(u,x,b)+2*SUM(SUBST(u,x,a+k*(~
b-a)/n),k,1,n-1)+4*SUM(SUBST(u,x,a+(k+1/2)*(b-a)/n),k,0,n-1))
"The box and trapezoid drawing functions used in the graphical demonstrations~
of numerical integration techniques."
D_BOX(x1,y1,x2,y2):=[[x1,y1],[x2,y1],[x2,y2],[x1,y2],[x1,y1]]
D_TRAP(x1,y1,x2,y2,x3,y3,x4,y4):=[[x1,y1],[x2,y2],[x3,y3],[x4,y4],[x1,y1]]
DRAW_LEFT(u,x,n,a,b):=VECTOR(D_BOX(t,0,t+(b-a)/n,SUBST(u,x,t)),t,a,b-(b-a)/n,~
(b-a)/n)
DRAW_RIGHT(u,x,n,a,b):=VECTOR(D_BOX(t,0,t+(b-a)/n,SUBST(u,x,t+(b-a)/n)),t,a,b~
-(b-a)/n,(b-a)/n)
DRAW_TRAP(u,x,n,a,b):=VECTOR(D_TRAP(t,0,t+(b-a)/n,0,t+(b-a)/n,SUBST(u,x,t+(b-~
a)/n),t,SUBST(u,x,t)),t,a,b-(b-a)/n,(b-a)/n)
"The solution to the differential equation (DE) y+p(x)y=q(x) with y(x0)=y0."
DE(p,q,x,y,x0,y0):=y=(y0+INT(q*#e^INT(p,x,x0,x),x,x0,x))/#e^INT(p,x,x0,x)
"Direction field helper function."
SEG(rc,x,y,x,y):=IF(ABS(rc)>1 AND y<ABS(rc)*x,[[x-y/rc,y-y],[x+y/rc,y+~
y]],[[x-x,y-rc*x],[x+x,y+rc*x]])
"The direction field (DF) for the differential equation: y=r(x,y) with a
termined by x0<x<xm with m subdivisions and y0<y<ym with n subdivisions."
de~
DF(r,x,x0,xm,m,y,y0,yn,n):=VECTOR(VECTOR(SEG(LIM(r,[x,y],[x0+j*(xm-x0)/m,y0+k~
*(yn-y0)/n]),x0+j*(xm-x0)/m,y0+k*(yn-y0)/n,(xm-x0)/(4*m),(yn-y0)/(4*n)),j,0,m~
),k,0,n)
"The EULER function gives an approximate solution to: y=r(x,y) with y(x0)=y0~
."
EULER(r,x,y,x0,y0,xn,n):=ITERATES(v+(xn-x0)/n*[1,LIM(r,[x,y],v)],v,[x0,y0],n)
226
Appendix B
DfW Version 5
In 1999, the Soft Warehouse became a part of Texas Instruments Corporation (TI) and the business office for the Derive software in Honolulu was
moved to Texas. Nevertheless, the software itself is still being developed and
maintained by its creators and the sales and promotional aspects are done
by TI. In addition, the math engine inside of Derive is being installed into
all of TIs calculator products.
In the year 2000, Version 5 of Derive was released. The new version
has an improved interface, embedded graphics, embedded text (for making
workbooks) and a new DFW file format to support the new features.
B.1
See Figure B.1 on the next page for a look at DfW5. The first thing to
notice is that the authoring form is now a permanent part of the window,
along with the special symbol bar. You can either click the
button as
in Version 4 or just simply click your mouse pointer in the new author box.
You can still right-click to insert expressions (or press F3) but there are now
several options for adding expressions to the algebra window. You can return
the unsimplified expression or the simplified (or approximated) expression as
in Version 4 but there is a new option: returning the unsimplified expression
first aligned with the left side of the window and then that same expression
is returned, simplified and centered in the window. This makes it easy to
see what expressions are input and what expressions have been simplified by
Derive.
227
228
229
230
Index
angular frequency, 203
asymptote, 50
attractor, 77
super, 77
basin of attraction, 81
bisection method, 8688
fixed point, 92
attractive, 81
frequency, 203
chaos, 82
character input mode, 57
characteristic equation, 198
complex conjuagate, 91
complex conjugate, 79, 128, 202
complex exponential, 127
complex numbers, 78, 166
conjugate, 79, 91, 128
exponential, 127, 166
imaginary part, 79, 91
modulus, 79, 91
multiplication, 167
real part, 79, 91
roots, 80, 92
complex plane, 80
complex roots, 8, 80
critical points, 48
Gamma function, 45
half-life, 181
Hookes Law, 196
imaginary part, 79, 91
integral test, 132, 142147
interest, 133135
continuous, 147
effective annual rate, 148
loan repayment, 135136
modulus, 79, 91
Newtons Law of Cooling, 180181
Newtons method, 6983
damping, 204
defining variables, 14
differential equations, 60, 177191,
195211
linear first order, 188
period, 203
Poisson summation, 150
population growth, 55, 177180, 183
186
231
232
radioactive decay, 181
ratio test, 132, 138141
real part, 79, 91
recursion, 15
right mouse button, 5
Runge-Kutta method, 208
series
convergent, 131
divergent, 131
geometric, 131, 132
harmonic, 146
Simpsons rule
derivation, 104105
error estimate, 99
slope field, 182
solving equations, 68
numerically, 30
spline functions, 62
subscripts, 20
super attractor, 77
tangent line, 40
trapezoid rule
error estimate, 99
vectors, 18
web page, xv
INDEX