Math 277
Elementary Differential Equations
Spring 1999
Dr. Constant J. Goutziers
Department of Mathematical Sciences
goutzicj@oneonta.edu
Lesson 4
Analytic Solutions: Separation of Variables
4.1 What is a Solution to a Differential Equation?
A solution to the differential equation
is a function y = y(t), that when substituted in the differential equation, satisfies the equation for all values of t.
Examples
Example 4.1.1
Verify that the function
is a solution to the differential equation
.
Code the differential equation and the solution function.
> deq:=diff(y(t), t)=(y(t)^2-1)/(t^2+2*t); sf:=1+t;
Now substitute "sf" into "deq", and simplify the resulting expression.
> e1:=subs(y(t)=sf, deq);
> e2:=simplify(e1);
>
4.2 Separation of Variables
Examples
Example 4.2.1
Find the general solution of the differential equation
, and sketch some of the solution curves.
Code the differential equation and separate the variables.
> deq:=diff(y(t), t)=t/y(t)^2;
> deq1:=deq*y(t)^2;
Integrate left and right hand side, by mapping the integration routine to the equation. Do not forget to include an integration constant.
> sol1:=map(int, deq1, t)+(0=c);
Solve for y(t).
> sol2:=solve(sol1, y(t));
Extract the Real solution.
> sol3:=sol2[1];
Every choice of the constant c corresponds to one particular integration curve. Let us take c =- 5, - 4, ..., 5.
> curves:=[seq(sol3, c=-5..5)];< /b>
In Maple odd roots of negative Real numbers will by default evaluate to a complex root. In order to force the software to generate the Real function values, we use the "realroot" command in the "oneonta" package.
> with(oneonta):
> plot(realroot(curves), t=-5..5);
>
Example 4.2.2
Compute the solution of the initial value problem
, y(0) = 4, and sketch it.
Code the equation, separate the variables and integrate.
> deq:=diff(y(t), t)=y(t)/(1+y(t)^2);
> deq1:=deq /rhs(deq);
> sol1:=map(int, deq1, t)+(0=c);
Observe that it is not possible to express y in terms of elementary functions of t. We therefore apply the initial condition to this implicit representati on.
> val_c:=solve(subs({t=0, y(t)=2}, sol1), c);
> sol2:=subs(c=val_c, sol1);
In order to be able to plot this curve, we replace y( t) by y. To obtain an appropriate graphics resolution, we increase the number of evaluation points, from the default of 625, to 9000.
> sol3:=subs(y(t)=y, sol2);
> with(plots):
> implicitplot(sol3, t=-5..5, y=0..4, numpoints=9000);
>
4.3 Solving Applied Problems using the dsolve command
Examples
Example 4.3.1
Suppose we deposit $5000 in a saving account with interest accruing at the rate of 5% compounded continuously. After ten years we start to withdraw $1000 (play money) from the account each year. Determine the balance in the account after t years. How long can we continue to withdraw our play money, before running out of funds?
Observe taht we are dealing with two diff erential equations. One is valid for t < 10 and the other for t > 10.
> deq1:=diff(A(t), t)=0.05*A(t); deq2:=diff(A(t), t)=0.05*A(t)-1000;
Solve the first equation with the initial condition A(0) = 5000 and use the result to obtain an initial condition for the second half of the problem.
> ic1:=A(0)=5000;
> sol1:=dsolve({deq1, ic1}, A(t));
> ic2:=simplify(subs(t=10, sol1));
> sol2:=dsolve({deq2, ic2}, A(t));
Make a sketch.
> p1:=plot(rhs( sol1), t=0..10):
> p2:=plot(rhs(sol2), t=10..22):
> display([p1, p2]);
The graph indicates that we run out of funds somewhere between t = 20 and t = 21, which is substantiated by the following computation.
> test:=solve(rhs(sol2)=0, t);
>