# solution 1

```Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
In each problem, draw a direction field for the given differential equation. Based on the direction field,
determine the behavior of y as t 7→ ∞. If this behavior depends on the initial value of y at t = 0, describe
this dependency.
1
Problem 1.1 (20 pts):
y ′ = y(2 − y)
Consider the initial condition y(0) = y0 .
• For y0 &gt; 2, the slope of the solution is initially negative, so the solution is decreasing (in magnitude)
close to 2, then it converges to y = 2.
• For y0 = 2, equilibrium, slope is zero, then solution remains constant y = 2.
• For 0 &lt; y0 &lt; 2 , the slope of the solution is negative, so the solution is decreasing (in magnitude)
approaching 2, therefore, it converges to y = 2.
• For y0 = 0, equilibrium, slope is zero, then solution is y = 0.
• For y0 &lt; 0 , the slope of the solution is negative, then the solution diverges to y = −∞.
Below is matlab script.
% Problem 1a from hw1
% Direction field for y’=y(2-y)
5
clear a l l
close a l l
[t, y] = meshgrid(0:0.2:7,-2:0.2:5);
10
dy = y.*(2 - y);
dt = ones( s i z e (dy));
dyu = dy./sqrt(dt.ˆ2 + dy.ˆ2);
dtu = dt./sqrt(dt.ˆ2 + dy.ˆ2);
quiver(t,y,dtu,dyu,1);
y ′ = y(y − 1)2
let the initial condition be y(0) = y0 .
• For y0 &gt; 1, the slope of the solution is positive, then the streamline diverges to y = +∞.
• For y0 = 1, equilibrium, slope is zero, the solution remains constant y = 1.
• For 0 &lt; y0 &lt; 1 , the slope of the solution is positive and the solution curve increases (in magnitude)
approaching 1, so the solution converges to y = 1.
• For y0 = 0, equilibrium, slope is zero, the solution is y = 0.
• For y0 &lt; 0 , the slope of the solution is negative, then the solution curve diverges to y = −∞.
% Problem 1b from hw1
% Direction field for y’=y(y-1)^2
5
clear a l l
close a l l
Page 1 of 8
Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
[t, y] = meshgrid(0:0.2:7,-2:0.2:5);
10
dy = y.*(y - 1).ˆ2;
dt = ones( s i z e (dy));
dyu = dy./sqrt(dt.ˆ2 + dy.ˆ2);
dtu = dt./sqrt(dt.ˆ2 + dy.ˆ2);
quiver(t,y,dtu,dyu,1);
2
Problem 1.2 (10 pts):
A spherical raindrop evaporates at a rate proportional to its surface area. Write a differential equation for
the volume of the raindrop as a function of time.
4
Solution: The surface area of a sphere is A = 4π r2 and its volume is V = π r3 . Expressing volume
3
through the area, we get
3/2
4
4
A
.
V = π r3 = π
3
3
4π
Therefore, the required differential equation becomes
dV
= −k V 2/3
dt
for some constant k.
3
Problem 1.3 (10 pts):
Newton’s law of cooling states that the temperature u(t) of an object changes at a rate proportional to the
difference between the temperature of the object itself and the temperature of its surroundings (the ambient
air temperature in most cases):
u̇(t) = −k(u − T ),
where T is the ambient temperature and k is a positive constant. Suppose that the initial temperature of
the object is u(0) = u0 , find its temperature at any time t.
Solution We compute:
du
u−T
ln(u − T ) − ln(u0 − T )
u(t)
= −kdt
= −k(t − t0 )
= T + (u0 − T )e−k(t−t0 )
Or, since we have t0 = 0:
u(t) = T + (u0 − T )e−kt
4
Problem 1.4 (20 pts):
A certain drug is being administrated intravenously to a hospital patient. Fluid containing 6 mg/cm3 of
the drug enters the patient’s bloodstream at a rate of 120 cm3 /h. The drug is absorbed by body tissues or
otherwise leaves the bloodstream at a rate proportional to the amount present, with a rate of 0.5 (h)−1 .
(a) Assuming that the drug is always uniformly distributed throughout the bloodstream, write a differential
equation for the amount of the drug that is present in the bloodstream at any time.
Page 2 of 8
Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
(b) How much of the drug is present in the bloodstream after a long time?
Solution:
(a) Let m(t) mg be the total amount of drug in bloodstream at time t. Consider a short time interval
[t, t + ∆t]. The increment of the amount of the drug that is present in the bloodstream can be calculated in
two ways:
m(t + ∆t) − m(t)
and
6 &times; 120∆t − 0.5m∆t
Therefore, we have
m(t + ∆t) − m(t) = 6 &times; 120∆t − 0.5m∆t.
Dividing both sides by ∆t and taking the limit: ∆t → 0, we get
m′ (t) = 720 − 0.5m(t)
(b)
First, we plot the direction field using Mathematica:
StreamPlot[{1, 720 - 0.5*m}, {t, 10, 20}, {m, 1430, 1450}]
From the direction field, we know that after a long time, the drug present in bloodstream should be stable,
and there should be m′ (t) = 0. Then we have
720 − 0.5m(t) = 0
=⇒
m(t) = 1440.
1450
1445
1440
1435
1430
10
12
14
16
18
20
Figure 1: Direction field for Problem 1.4, plotted with Mathematica.
Page 3 of 8
Prof. Dobrushkin
5
APMA 0330: Solution to Homework 1
September 23, 2015
Problem 1.5 (20 pts):
Consider the falling object of mass 5 kg that experiences the drag force, which is assumed to be proportional
to the square of the velocity:
v̇ = 492 − v 2 /245.
(a) Determine an equilibrium solution.
(b) Plot a slope field for the given differential equation using one of your lovely software package. Provide
the codes of your plot or state what resources did you use. Based on the direction field, determine the
behavior of v(t) as t → ∞.
(c) Find the limiting velocity v∞ = limt→∞ v(t) if initially v(0) = 0, and determine the time that must
elapse for the object to reach 98% of its limiting velocity.
(d) Find the time it takes the object to fall 300 m.
Solution:
(a)
The equilibrium is achieved when
492 − v 2
= 0,
245
i.e., v = &plusmn;49. However, note that v = −49 is nonphysical: we designate positive velocity as downwards
velocity, so v = −49 would be falling upwards. Thus, the only equilibrium in which we are interested is
v = 49.
(b) We have that v → 49 as t → ∞ for all physical trajectories. Note that with this model, if the
object were moving upwards fast enough, it would continue to accelerate upwards forever!
Now we plot using Mathematica:
VectorPlot[{1, (49ˆ2 - yˆ2)/245}, {x, -100, 100}, {y, -100, 100},
VectorPoints -&gt; 20, VectorStyle -&gt; Arrowheads[0.028]]
Then we do the same job using matlab:
5
[t, v] = meshgrid(0:.5:10,40:1:60);
dv = (49ˆ2-v.ˆ2)/245;
dt = ones( s i z e (dy));
dvu = dv./sqrt(dt. 2 + dv. 2 );
dtu = dt./sqrt(dt. 2 + dv. 2 );
quiver(t,v,dtu,dvu,1);
Page 4 of 8
Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
100
50
0
-50
-100
-100
-50
0
50
100
Figure 2: Direction field for Problem 1.5, plotted with Mathematica.
(c)
If v(0) = 0, then v∞ is indeed 49. To find the elapsed time we first solve the differential equation
dv
492 − v 2
dv
1
1
+
98 49 + v 49 − v
Z 1
1
dv
+
49 + v 49 − v
1
[ln(49 + v) − ln(49 − v)]
98
49 + v
ln
49 − v
49 + v
49 − v
49 + v
=
=
=
=
=
dt
245
dt
245
Z
2
dt
5
t
245
2t
5
2
=
e5t
=
(49 − v)e 5 t
v(1 + e 5 t )
=
49(1 − e 5 t )
v
=
2
=
2
2
1 − e2t/5
1 + e2t/5
t
49 tanh
5
49
Page 5 of 8
Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
V
Figure 3: The electric circuit of Problem 1.6.
We seek t such that v(t) = 0.98 &middot; v∞ = 0.98 &middot; 49, i.e.,
t
5
0.98 &middot; 49
=
49 tanh
t
=
≈
5 tanh−1 (0.98)
11.5
(d) We can arbitrarily define the starting point as x0 = x(0) = 0. then the position of the object is the
same as the distance traveled, and is given by
Z t
Z t
s
t
49 tanh
v(s)ds =
x(t) =
.
ds = 245 ln cosh
5
5
0
0
We seek t such that x(t) = 300, then
300 = 245 ln cosh
6
t
5
=⇒
t = 5 cosh−1 e300/245 ≈ 9.48.
Problem 1.6 (20 pts):
Consider an electrical circuit containing a capacitor, resistor, and battery. The charge Q(t) on the capacitor
satisfies the equation
dQ Q
R
+
= V,
dt
C
where R is the (constant) resistance, C is the (constant) capacitance, and V is the constant voltage supplied
by the battery.
(a) If Q(0) = 0, find Q(t) at any time, and sketch the graph of Q versus t.
(b) Find the limiting value QL that Q(t) approaches after a long time.
(c) Suppose that Q(t1 ) = QL and that at time t = t1 the battery is removed and the circuit is closed
again. Find Q(t) for t &gt; t1 and sketch its graph.
Solution:
(a)
The corresponding initial value problem is:

dQ Q


R dt + C = V



Q(0) = 0
Page 6 of 8
Prof. Dobrushkin
We subtract
Q
C
APMA 0330: Solution to Homework 1
September 23, 2015
from both sides:
dQ
Q
=− +V
dt
C
The equation is clearly separable. Gathering the Q terms on the left-hand side and the t terms on the
right-hand side, we get
dQ
= dt
R Q
−C + V
R
Now integrate both sides:
Z
dQ
=
R Q
−C + V
Z
dt
The right-hand side is a simple integral, the left-hand side is a little trickier but still doable:
Q
−RC ln − + V = t + k1
C
In the above question, k is the constant of integration. Moving the −RC to the right-hand side:
Q
t + k1
ln − + V = −
.
C
RC
Exponentiate both sides:
−
t+k1
k1
t
t
Q
+ V = e− RC = e− RC e− RC = k2 e− RC .
C
k1
Here, k2 = e− RC is a new constant, for convenience. Now, solving for Q:
t
Q = −C k2 e− RC − V
Now we apply the initial condition Q(0) = 0 to solve for the constant k2 :
0
0 = −C k2 e− RC − V = −C (k2 − V ) =⇒ C = 0 or k2 − V = 0.
Presumably our capacitance C is nonzero, we thus have that k2 = V . So the solution to our initial value
problem is:
t
Q(t) = −C V e− RC − V
Cleaning it up a bit:
t
Q(t) = CV 1 − e− RC
t≥0
25
20
15
10
5
0
0
2
4
6
8
10
12
14
16
18
20
Page 7 of 8
Prof. Dobrushkin
APMA 0330: Solution to Homework 1
September 23, 2015
In order to sketch a graph of Q versus t, we need to pick some actual values for C, V , and R. The specific
values don’t matter too much here; we just want to get an idea of what the graph looks at. Arbitrarily
choosing C = 2.5, V = 8, R = 1, we obtain: The above graph was generated using the following matlab
code:
t = linspace(0,20,10000);
C = 2.5;
V = 8;
R = 1;
Q = C*V*(1-exp(-t/(R*C)));
plot(t,Q)
axis([0, 20, 0, 25])
5
(b)
t
t
= lim CV − CV e− RC
CV 1 − e− RC
t→∞
t→∞
t
− RC
= lim (CV ) − lim CV e
= CV − 0 = CV
QL = lim
t→∞
t→∞
So, since the exponential term goes to zero as t goes to infinity, we find that QL = CV .
(c) We now have a different initial value problem. Since the battery has been removed, the voltage
V = 0. So our initial value problem is:

dQ Q


R dt + C = 0



Q(t1 ) = QL = CV
Our differential equation is again separable, and is relatively straightforward:
R
dQ Q
dQ
Q
dQ
Q
+
= 0 =⇒ R
=−
=⇒
=−
dt
C
dt
C
dt
RC
Z
Z
1
1
1
t
dQ
=−
dt =⇒
dQ = −
dt =⇒ ln (Q) = −
+ k1
=⇒
Q
RC
Q
RC
RC
t
t
t
=⇒ Q = e− RC +k = e− RC ek1 = k2 e− RC
We now apply the initial condition to solve for the constant of integration k2 :
t1
t1
QL = CV = k2 e− RC =⇒ k2 = CV e RC
Cleaning things up
t1
t
Q(t) = CV e RC e− RC = CV e
t1 −t
RC
= CV e
−(t−t1 )
RC
So the solution to our initial value problem is C = 2.5, V = 8, R = 1, t1 = 10:
Q(t) = CV e
−(t−t1 )
RC
,
t ≥ t1
To plot, we again arbitrarily pick values. Using C = 2.5, V = 8, R = 1, t1 = 10: The above graph was
generated using the following matlab code:
5
t = linspace(0,20,10000);
C = 2.5;
V = 8;
R = 1;
t1 = 10;
Q = C*V*exp(-(t-t1)/(R*C));
plot(t,Q)
axis([0, 20, 0, 25])
Page 8 of 8
```