> restart;
First-Order Differential Equations
Recall that if
F
'(
x
) =
f
(
x
), then the indefinite integral
consists of antiderivatives
F
(
x
) +
C
of
f
(
x
), where
C
may be any constant. The definite integral
=
F
(
x
) -
F
(
a
) is the antiderivative of
f
(
x
) having value 0 when
x
=
a
; here
. Written in the language of differential equations, we can summarize by saying that the solution of the initial-value problem
y
=
f
(
x
),
y
(a) = 0, is given by
y
=
. (1)
Using Maple, this integral expression (1) allows us to graph the solution of an initial-vlaue problem
y ' = f ( x ), y ( a ) = b without having to compute an indefinite integral F ( x ) of f ( x ). We illustrate with
the simple problem y ' = 2 x , y (0) = 0, so that f ( t ) = 2 t and a = 0 in the integral (1).
> F := x->int(2*t, t = 0..x);
> plot(F(x), x = -3..3);
Of course, we know the solution of
y
' = 2
x, y
(0) = 0 is
y =
, and the graph Maple produced
is consistent with this result.
It can be shown that none of the elementary functions with which we are familiar is an antiderivative of sin(
). Indeed, an attempt to comput
using Maple produces
> int(sin(t*t), t = 0..2);
which does not tell us much. However, Maple can graph the solution of the initial-value problem
y' =
sin(
),
y
(0) = 0 by representing the solution in the form of the integral (1).
> G := x->int(sin(t*t), t = 0..x);
> plot(G(x), x = -5..5);
You should graph sin(
) and think why the graph Maple produced above has this appearance. In particular, understand why the waves are decreasing in amplitude and getting closer together as
increases.
Problem 1
Graph the solution of the initial-value problem
y' =
cos(
),
y
(1) = 4 by a suitable selection of
f
(
t
) and
a
in the integral (1), and an upward translation so that
y
(1) will be 4 rather than 0.
Maple provides us with another way to solve differential equations, namely, using the dsolve command. We illustrate by solving y' = 2 x using dsolve .
> dsolve(diff(y(x), x) = 2*x, y(x));
Here C1 is an arbitrary constant. We can also use dsolve to solve an initial-value problem. We illustrate with y' = 2 x , y (1) = 2.
> dsolve({diff(y(x),x) = 2*x, y(1) = 2}, y(x));
Notice that the initial-value problem is enclosed in braces, { }.
We know that if
y =
, then
y' = y
and
y
(0) = 1. Thus
is a solution of the initial-value problem
y' = y, y
(0) = 1. A
first order differential equation
is an equation of the form
y' = g
(
x, y
), where
g
(
x, y
) may involve either or both of the variables
x
and
y
. We can use
dsolve
to solve some such equations. We illustrate with the initial-value problem
y ' = - x/y, y (0) = 5. Notice that y always appears as y(x).
> dsolve({diff(y(x),x) = -x/y(x), y(0) = 5}, y(x));
We should recognize
y =
as the function having as graph the top half of the
circle
, with center at (0, 0) and radius 5. Pencil and paper computation of
y'
as a check indeed yields
y' =
=
=
.
Problem 2 Use dsolve to find the solution of the differential equation y' = x + y.
Problem 3
Use
dsolve
to find the solution of the initial-value problem
y' =
,
y
(1) = -5.
We can try to use
dsolve
to find the solution of the initial-value problem
y' =
sin(
),
y
(0) = 0,
but in view of our attempt using the command
int
with sin(
) above, we don't really expect success.
> dsolve({diff(y(x),x) = sin(x*x), y(0) = 0}, y(x));
This is consistent with what we obtained before. However, we can use dsolve with the numeric option to find specific values of the solution function at specific points.
> soln := dsolve({diff(y(x),x)=sin(x*x), y(0)=0}, y(x), numeric);
> [soln(2), soln(4.5)];
The expression that appears as soln denotes an algorithm that Maple can use to compute specific solution values y ( a ),
y ( b ), etc. However, because we selected soln as the name for this algorithm, we must request them in the form soln ( a ), soln ( b ), etc.
Maple has a command odeplot that can be used to plot the solution to an initial-value problem obtained numerically; ( ode stands for ordinary differential equation ). However, the command with(plots) must be given first to access odeplot .
> with(plots):
> odeplot(soln,[x,y(x)], -5..5, numpoints = 200);
This is the same graph that we obtained earlier. Without the option numpoints = 200, the graph would have appeared quite jagged; the default number of points for plotting was not sufficient to create a smooth graph.
Problem 4
Consider the initial-value problem
y' =
,
y
(0) = 0.
a) Attempt to solve this using dsolve without the numeric option, and see if you get anything useful.
b) Use dsolve with the numeric option and then use odeplot to plot the graph of the solution over the interval [-20, 20]. Use enough points in plotting to get a smooth graph.
c) For the solution
y
of this initial-value problem, the values
y
(
x
) for
sufficiently large are approximately equal to
f
(
x
) +
b
where
f
is a trigonometric function and
b
is a constant. By looking at the graph and by considering the approximate value of
y'
(
x
) for
large, find the function
f
. Check your answer by computing several values
y ( a ) - f ( a ) for values of a in the interval [10, 100].; the values should be roughly constant, namely, the constant b . when you are satisfied that you have the correct function f , estimate b by computing y (150) - f (150). Be sure to check from your graph that your answer makes sense.
This MTH 141 worksheet written by J. B. Fraleigh, Copyright 1999