Instructions
Head your paper this way:
[ L28 DIFFERENTIAL EQN Your Name (date if
desired) Sorting Number(2 inches from right)
[
We will illustrate the use of Maple to solve differential equation
problems which appear as examples in
the textbook by James Stewart called Calculus, Early Transcendentals.
(Cf. Slide M202-L28??)
Following Stewart's notation on page 587, we use a capital F to describe
a function of two variables which appears in a first-order ordinary differential
equation
y' = F(x,y)
But if we want to represent the solution as y = f (x), then
y' = f ' (x) and the differential equation takes the form
f ' (x) = F(x,y)
Thus we have two functions: f describes the solution, and F describes
the differential equation.
To use the differential equation tools, we must activate the software
with the command
> with(DEtools):
Then we can plot the direction field with a command of this type:
> DEplot(D(f)(x)=F(x,y), x=a..b)
provided we have specified the function F and the interval [a,b] over
which we wish to compute the solution f.
To illustrate the plotting of a direction field, consider the differential
equation
y' = x + y
where F(x,y) = x + y over the interval [-3, 3] of the independent
variable x. (See Stewart, p. 587.)
The command DEplot has four arguments: the differential equation, the
dependent variable (written as a function!), the range of the independent
variable, and the range of the dependent variable. To produce Figure
3 on page 587 of Stewart:
> DEplot(D(y)(x)=x+y,y(x),x=-3..3,y=-3..3);
Now work EXAMPLE 1 on page 588 of Stewart, to produce Figure 7.
Then work EXAMPLE 2 on page 589 of Stewart, to produce Figure 10.
To do this, first solve the differential equation for dI/dt, and then
type in the DEplot command. But now there is an extra problem: we
must use i for electric current, instead of I. This is because MAPLE
reserves I for the constant which is the imaginary unit: the square root
of -1.
In MAPLE, we will design the Euler method algorithm before specifying
a particular function F. If you have previously given F a name, you
must clear that name first.
> F:=evaln(F);
Then you can define the Euler algorithm with the command
> Euler:=(x,y)->(x+h,y+h*F(x,y));
The function Euler takes us from one point on a solution (curve)
to another which is (approximately) on the same curve, but farther along
in x by an amount h called the stepsize.
The y coordinate changes by an amount h*F(x,y), where F(x,y)
is the slope of the tangent to the solution at the point (x,y).
To solve Stewart's EXAMPLE 3, we define F and h
by
> F:=(x,y)->x+y;
> h:=.1;
Then we give the function Euler the point specified by the initial
condition y=1 at x=0.
> Euler(0,1);
to get the next point on the approximate solution. Then Find
the point after that by the command
> Euler(%);
Finally, we repeat the last command to extend the solution to larger
values of x, and CIRCLE your answer for x=1.
Compare your y value for x=1 with Stewart's answer on page 591.
Use the above method to duplicate Stewart's EXAMPLE 4, and CIRCLE your answer for t=0.5.
Use the above method to answer Stewart's EXERCISE 19(a), and CIRCLE
your answerS for x=0.4.