108 Ordinary Differential Equations
The numerical results and graphical output presented in examples 8, 9, 10, and
11 were generated using MAPLE software. We selected the default integration
technique which is the fourth order Runge-Kutta method with fixed stepsize.
The stepsize is determined by the software. Included with this text is a
computer program named SOLVEIVP. It numerically solves the initial value
problem y' = f(x, y); y(c) =don the interval [a, b] where a:::; c:::; b. After the
numerical integration process is completed, SOLVEIVP will graph the solution
in the rectangle R bounded by the lines x =Xmin, x =Xmin, y =Ymin, and
y =Ymax, where the values for Xmin, Xmin, Ymin, and Ymax are specified by
the user. Complete details for running the program SOLVEIVP are contained
in Appendix A. Results for the initial value problems of examples 8 and 9
obtained using SOLVEIVP are given in Appendix A. Compare those results
with the ones appearing in examples 8 and 9. You should also use SOLVEIVP
to solve the initial value problem in example 10 and compare those results with
the ones given in example 10.
EXAMPLE 8 Numerical Approximation and Graph of the IVP:
y' = x - y; y(O) = 2
Calculate and graph a numerical approximation of the solution to the initial
value problem y' = x - y; y(O) = 2 on the interval [-1, 4] using MAPLE.
SOLUTION
The following four MAPLE statements produced the output shown in
Figure 2.14.
with(DEtools) :with(plots):
de:=diff(y(x), x)=x-y(x):
p:=DEplot(de, y(x), x=-1..4, y=0 .. 10, {[y(0)=2]}, arrows=LINE, axes=
BOXED):
display(p);
The second statement specifies the differential equation to be solved is y' =
x - y. The third statement instructs MAPLE to graph the solution in the
rectangle bounded by the lines x = -1, x = 4, y = 0, and y = 10. The third
statement also specifies the initial condition is y(O) = 2, the direction field is
to be displayed as lines (arrows=LINE), and the x and y axes are to appear
as a box outside the rectangle (axes=BOXED).
We did not encounter any difficulties in generating the solution to the given
initial value problem, because y' = x - y is a linear differential equation-
recall, y' = f (x, y) is linear if and only if j(x, y) = a(x)y + b(x )- and because
the functions a( x) = -1 and b( x) = x are defined and continuous on the
interval [-1, 4].