Goal: Introduction to symbolic routines in Maple
to solve differential equations, differences
in linear and nonlinear differential equations, solutions to homogeneous
equations,
particular solutions
Required tools: Solutions of first order linear equations, Maple
routines: diff , int,
dsolve, evalf, subs, Existence and Uniqueness Theorems for First Order
Linear Equations ,
dfield .
Discussion
In this lab you will use the mathematical software program Maple and some of its
routines to study first order linear differential equations:

Here are a few Maple useful routines (use the correct syntax):
(i) Differentiating functions :
> f(x):=diff(x*exp(2*x),x),
Produces
, sets it equal to f(x).
(ii) Integrating functions :
> g(x):=int(f(x),x),
Produces the integral of the function f(x), without the "+C".
(iii) Writing a differential equation :
> equ1:=diff(y(x),x)+x^2*y(x)=x^2,
Sets the differential equation y ' + x2y = x2 as "equ1".
(iv) Solving a differential equation :
> dsolve(equ1,y(x)),
Solves the differential equation defined by "equ1". Note that the constants will
appear as
etc (instead of
).
> yc(x):=rhs(dsolve(equ1,y(x))),
Solves the differential equation and sets solution equal to yc(x).
(v) Solving a differential equation with initial condition :
> dsolve({equ1,y(0)=2},y(x)),
Produces the solution to the initial value problem y' + x2y = x2, y(0) = 2.
(vi) Evaluating solutions at other values :
> soln:=dsolve{equ1,y(0)=2},y(x)),
Sets solution to initial value problem equal to "soln".
> subs(x=3,rhs(soln)),
Produces the value y(3) (may not be a numerical answer ).
> evalf(subs(x=3,rhs(soln))),
Produces a numeric approximation to y(3).
(vii) Simplifying an expression
> simplify(%)
Simplifies the expression immediately preceding the current expression (you may
need to use this to force Maple to simplify the answer obtained by differentiating,
integrating and/or performing substitutions).
Remark: Checking a solution
Suppose you want to check if y = x2 or y = x3 is a solution to the differential
equation
. First check y = x2:
> equ2:=diff(y(x),x)-y(x)/x=2 x^2 , [defines the differential equation]
> subs(y(x)=x^2,lhs(equ2)) , [puts y = x2 into left hand side of equation]
> simplify(%), [Simplifies previous expression]
This last command should produce the answer "x". This is the left hand side of
the differential equation above. However, the right hand side is "2x2". Since
these
are not equal, the function y = x2 is not a solution to the differential
equation.
Go back and check if y = x3 is a solution. It is.
As signment
(1) For practice, use Maple routines as described above to find solutions to these
initial value problems:

(2) Now consider the differential equation
y' + x3y = x3 ( **)
(a) Let f(x) be the solution to ( **) with f(0) = 2. Let g(x) be the solution to
( **) with g(0) = seed. Use dsolve to nd the functions f(x) and g(x).
Hint: f(x):=rhs(dsolve({equ,y(0)=2},y(x))),
(b) Use Maple to substitute f (x) and then g(x) back into
the equation ( **) to
verify that they really do satisfy the differential equation (you may need to
use the simplify routine in Maple).
(c) Let h(x) = f(x) − g(x) in Maple, i.e.,
> h(x):=f(x)-g(x),
Now subsitute h(x) into the left hand side (lhs) of the original differential
equation ( **) (you may need to use simplify). What do you get ?
(d) The differential equation ( *) is said to be homogeneous if q(x) = 0. The
above
problem demonstrates an important fact: any two solutions to ( *) differ at
most by a solution to the corresponding homogeneous equation. Prove this
fact in general: namely, if f(x) and g(x) are solutions to y' + p(x)y = q(x),
then the function h(x) = f(x) − g(x) is a solution to y' + p(x)y = 0.
(e) Use dsolve to find the general solution to the homogeneous differential
equation
y' + x3y = 0. Call the solution yc(x). Add the right side of your answer
to the function g(x) obtained in (d), i.e., let F(x) := yc(x)+g(x). Substitute
F(x) into the left side of the differential equation. What do you get ? This
demonstrates another general fact: if we take any particular solution g(x) to
a nonhohogeneous linear equation and add it to the general solution yc(x) of
the corresponding homogeneous equation, the sum F (x) = yc(x)+g(x) is the
general solution to the original nonhomogeneous linear equation.
(f) Use dsolve to find the general solution to y'+x3y = x3. Does the expression
you obtain describe the same set of solutions as in (e) ? Explain.
(3) According to the basic Existence and Uniqueness Theorems, the nonlinear
differential
equation y' = y2 is wonderful in the sense that given any initial condition
there is one and only one solution. And yet, as you saw in Lab # 3,
the solution y such that y(0) = 1 does not exist for t > 1 (since
). Using
dfield , plot several integral curves corresponding to different initial
conditions.
Does the place where they cease to exist seem to depend upon the initial
condition?
(Do not hand in this graph.)
(4) Consider the first order linear equation with initial condition:

Use dfield to plot the solution (use the window 0 ≤ x ≤ 3, 0 ≤ y ≤ 104). Plot the
integral curves corresponding to y(0) = 100 and y(0) = 1000. Are both solutions
unbounded near x = 2 ? How does the form of the differential equation make you
expect this ? (Hint: Write the differential equation in normal form y' = f(x,
y).)
Hand in your plot.
Remark: The above problems (3) and (4) illustrate a fundamental difference
between
linear and nonlinear differential equations. In a nonlinear differential
equation
it is not easy to determine if and where the solutions become unbounded or
determine the interval of existence without actually solving the differential
equation.
However, for a linear differential equation in standard form ( *), the solutions
can only become unbounded where either p(x) or q(x) are discontinuous. More
precisely, the following theorem is true:
| Existence & Uniqueness Theorem for 1stOrder
Linear Equations: |
If p(x) and q(x) are continuous on the interval (
α , β ) which contains , then the
initial value problem

has a unique solution y(x) which exists for α < x <
β and any value of . |
(5) The above Theorem states, and problem (4)
demonstrated, that the solution for a
linear equation exists on any interval where the coefficients are continuous .
However,
you should not think that just because the function p(x) or q(x) become
unbounded that this necessarily means the solution becomes unbounded. Use
dfield to plot the solution to this initial value problem

with window 0 ≤ x ≤ 3, 0 ≤ y ≤ 3. Describe the behavior of the solution as
x→ 2. Also, plot the solution corresponding to y(0) = 2. Do you see an initial
condition for which the solution is not unique ? Explain why the hypotheses of
the above Theorem do not hold at this point. Plot the solution corresponding
to y(3) = 1. How does the behavior of this solution near x = 2 differ from the
solution for y(0) = 1 near x = 2 ?