Lecture Notes 10 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

182 Chapter 10.

Differential Equations (LECTURE NOTES 10)

10.3 Euler’s Method


Difficult–to–solve differential equations can always be approximated by numerical
methods. We look at one numerical method called Euler’s Method. Euler’s method
uses the readily available slope information to start from the point (x0 , y0) then move
from one point to the next along the polygon approximation of the graph of the
particular differential equation to ultimately reach the terminal point, (xn , yn ). Al-
though interested in determining all of the points along the differential equation, it
is often the case that the value of yn at the terminal point is of most interest. More
specifically, let y = f (x) be the solution to the differential equation
dy
= g(x, y), with y(x0 ) = y0
dx
xn −x0
for x0 ≤ x ≤ xn and let xi+1 = xi + h, where h = n
and
yi+1 = yi + g(xi , yi )h,
for 0 ≤ i ≤ n − 1, then
f (xi+1 ) ≈ yi+1 .

Exercise 10.3 (Euler’s Method)


dy
1. Approximate dx
= y − 2x, start at (x, y) = (0, 1), 0 ≤ x ≤ 2.
dy
(a) approximate dx
= y − 2x, when subinterval h = 0.4

Since
dy
= y − 2x, then g(x, y) =
dx
1
(i) y − 2x (ii) 2x + 2 − ex (iii) 3e 2

and since x0 = 0, y0 = 1, then


g(x0 , y0 ) = y0 − 2x0 = 1 − 2(0) =
(i) 0 (ii) 1 (iii) 2,

and since h = 0.4,


y1 = y0 + g(x0 , y0)h = 1 + 1(0.4) =
(i) 1 (ii) 1.4 (iii) 1.8,

but, now, since x1 = x0 + h = 0 + 0.4 = 0.4 and


g(x1 , y1 ) = y1 − 2x1 = 1.4 − 2(0.4) =
Section 3. Euler’s Method (LECTURE NOTES 10) 183

(i) 0.6 (ii) 0.8 (iii) 1.0,

and since h = 0.4,

y2 = y1 + g(x1 , y1)h = 1.4 + 0.6(0.4) =

(i) 1.64 (ii) 1.84 (iii) 2.04

Remainder of (xi , yi ) values given in table.

Euler’s Approximation Actual Solution Difference


y0 = 1
i xi yi = yi−1 + (yi−1 − 2xi−1 )(0.4), i ≥ 1 f (xi ) = 2xi + 2 − exi yi − f (xi )
0 0 1.00 1.00 0.00
1 0.4 1.40 1.31 0.09
2 0.8 1.64 1.37 0.27
3 1.2 1.66 1.08 0.58
4 1.6 1.36 0.25 1.11
5 2.0 0.62 −1.39 2.01
TI-84 calculator: For Euler’s approximation, define Y1 = Y − 2X, initialize X and Y with -0.4 and
1, respectively: −0.4 → X, 1 → Y ; type Euler’s approximation: X + 0.4 → X : Y + Y1 × 0.4 → Y
dy
ENTER for 1.4, then ENTER for 1.64, and so on. Recall dx
= y − 2x is a first order linear differential
equation whose particular solution, where (x, y) = (0, 1), is y = 2x + 2 − ex as explained in previous
section 10.2 of the lecture notes. So, for actual solution, define Y2 = 2x + 2 − eX , then VARS, Y-VARS
ENTER Y2 ENTER Y2 (0.4) ENTER for 1.31, and so on.

y1 = y0 + g(x0, y0) h
(0.4, 1.4) y1 = 2x1 + 2 - ex1
= y0 + (y0 - 2x 0) h
= 2(1) + 2 - e1
= 1 + (1 - 2(0)) (0.4)
º 1.3
= 1.4

(0,1) (0.4, 1.3) Euler’s approximation

difference between approximation and actual solution

actual differential equation, dy/dx = y - 2x


with solution y = 2x - 2 - e x

0 0.4 0.8 1.2 1.6 2.0

x1 = x 0 + h
= 0 + 0.4 = 0.4

dy
Figure 10.3 (Euler approximation to dx
= y − 2x, h = 0.4)
184 Chapter 10. Differential Equations (LECTURE NOTES 10)

dy
(b) approximate dx
= y − 2x, when subinterval h = 0.1

As before,
dy
= y − 2x, then g(x, y) =
dx
1
(i) y − 2x (ii) 2x + 2 − ex (iii) 3e 2

and since x0 = 0, y0 = 1, then


g(x0 , y0 ) = y0 − 2x0 = 1 − 2(0) =
(i) 0 (ii) 1 (iii) 2,

and since h = 0.1 (instead of h = 0.4),


y1 = y0 + g(x0 , y0)h = 1 + 1(0.1) =
(i) 1.1 (ii) 1.4 (iii) 1.8,

but, now, since x1 = x0 + h = 0 + 0.1 = 0.1 and


g(x1 , y1 ) = y1 − 2x1 = 1.1 − 2(0.1) =
(i) 0.6 (ii) 0.8 (iii) 0.9,

and since h = 0.1,


y2 = y1 + g(x1 , y1)h = 1.1 + 0.9(0.1) =
(i) 1.19 (ii) 1.84 (iii) 2.04

Euler’s Approximation Actual Solution Difference


y0 = 1
i xi yi = yi−1 + (yi−1 − 2xi−1 )(0.1), i ≥ 1 f (xi ) = 2xi + 2 − exi yi − f (xi )
0 0 1.00 1.00 0.00
1 0.1 1.10 1.09 0.01
2 0.2 1.19 1.18 0.01
.. .. .. .. ..
. . . . .
19 1.9 −0.32 −0.89 0.57
20 2.0 −0.73 −1.39 0.66
For Euler’s approximation, define Y1 = Y − 2X, initialize X and Y with -0.1 and 1, respectively:
−0.1 → X, 1 → Y ; type Euler’s approximation: X + 0.1 → X : Y + Y1 × 0.1 → Y ENTER for 1.1,
then ENTER for 1.19, and so on. For actual solution, define Y2 = 2x + 2 − eX , then VARS, Y-VARS
ENTER Y2 ENTER Y2 (0.1) ENTER for 1.09, Y2 (0.2) for 1.18 and so on.

Euler’s method (i) improves (ii) worse for smaller h subintervals.


Section 3. Euler’s Method (LECTURE NOTES 10) 185

dy
2. Approximate dx
= xy, start f (1) = 3, over [1, 2], using 10 subintervals.

Since
dy
= xy, then g(x, y) =
dx
1 1 2
(i) 3e− 2 e 2 x (ii) 2x + 2 − ex (iii) xy

and since x0 = 1, y0 = 3, then

g(x0 , y0) = x0 y0 = 1(3) =

(i) 0 (ii) 1 (iii) 3,

and since [1, 2] has 10 subintervals


2−1
h= =
10
(i) 0 (ii) 0.1 (iii) 0.2,

and so
y1 = y0 + g(x0 , y0 )h = 3 + 3(0.1) =
(i) 3.1 (ii) 3.3 (iii) 3.8,

but, now, since x1 = x0 + h = 0 + 0.1 = 0.1 and

g(x1 , y1) = x1 y1 = 0.1(1.1) =

(i) 0.10 (ii) 0.11 (iii) 0.12,

and since h = 0.1,

y2 = y1 + g(x1 , y1 )h = 3.3 + 0.11(0.1) ≈

(i) 3.11 (ii) 3.31 (iii) 3.51

Fill in the missing (xi , yi ) values given in table.


186 Chapter 10. Differential Equations (LECTURE NOTES 10)

Euler’s Approximation Actual Solution Difference


y0 = 3
1 1 2
i xi yi = yi−1 + (xi−1 yi−1 )(0.1), i ≥ 1 f (xi ) = 3e− 2 e 2 xi yi − f (xi )
0 1 3.00 3.00 0.00
1 1.1 3.30 3.33 -0.03
2 1.2 3.66 3.74 -0.08
3 1.3 4.10 4.24 -0.14
4 1.4 4.64 4.85 -0.21
5 1.5 5.28 5.60 -0.40
6 1.6
7 1.7
8 1.8
9 1.9
10 2.0

TI-84 calculator: For Euler’s approximation, define Y1 = XY , initialize X and Y with 0.9 and 3, respectively:
0.9 → X, 3 → Y ; type Euler’s approximation: X + 0.1 → X : Y + Y1 × 0.1 → Y ENTER for 3.3, then
dy
ENTER for 3.66, and so on. Recall dx
= xy is a separable differential equation whose particular solution,
1 1 2
where (x, y) = (1, 3), is y = 3e− 2 e2x as explained in previous section 10.1 of the lecture notes. So, for actual
1 1 2
solution, define Y2 = 3e− 2 e 2 X , then VARS, Y-VARS ENTER Y2 ENTER Y2 (1.1) ENTER for 3.33, . . . .

3. Approximate bear population Assume bear population grows according to fol-


lowing differential equation.
dy
= 0.02y(y + 1)(y + 3)
dt
Assume initial population at time t = 0 is y = 5, use Euler’s method, where
h = 1 year, to approximate bear population at time t = 3 years.

Since
dy
= 0.02y(y + 1)(y + 3), then g(t, y) =
dt
(i) 0.02y(y − 1)(y + 3) (ii) 2x + 2 − et (iii) ty

and since t0 = 1, y0 = 5, then

g(t0 , y0) = 0.02y0 (y0 + 1)(y0 + 3) = 0.02 × 5(5 + 1)(5 + 3) =

(i) 4.7 (ii) 4.8 (iii) 4.9,

and since h = 1 and so

y1 = y0 + g(t0 , y0 )h = 5 + 4.8(1) =
Section 4. Applications of Differential Equations (LECTURE NOTES 10) 187

(i) 9.6 (ii) 9.7 (iii) 9.8,

but, now, since t1 = x0 + h = 0 + 1 = 1 and

g(t1 , y1 ) = 0.02y1(y1 + 1)(y1 + 3) = 0.02 × 9.8(9.8 + 1)(9.8 + 3) ≈

(i) 27.0 (ii) 27.1 (iii) 27.2,

and since h = 1,

y2 = y1 + g(t1 , y1 )h ≈ 9.8 + 27.1(1) ≈

(i) 36.9 (ii) 37.3 (iii) 40.2

Fill in the missing (ti , yi ) value given in table.

Euler’s Approximation
y0 = 5
i ti yi = yi−1 + (0.02yi−1 (yi−1 + 1)(yi−1 + 3))(1), i ≥ 1
0 0 9.800
1 1 36.895
2 2 1152.471
3 3

For Euler’s approximation, define Y1 = 0.02Y (Y + 1)(Y + 3), initialize X and Y with -1 and 5, respectively:
−1 → X, 5 → Y ; type Euler’s approximation: X + 1 → X : Y + Y1 × 1 → Y ENTER for 9.8, then ENTER
dy
for 36.895, and so on. Notice there is no actual solution because, although dt
= 0.02y(y + 1)(y + 3) is a
50
separable differential equation where, with the aid of wolfram’s integrator web site, gives 3
ln y − 25 ln(y +
25
1) + 3
ln(y + 3) = t, there is no closed analytic solution for y that I am aware of.

10.4 Applications of Differential Equations


We look at a variety of applications of differential equations.

Exercise 10.4 (Applications of Differential Equations)

1. Application: limited growth rate model, dy


dt
= k(N − y).
After 10 days, 40% of the 24000 viewers of a local TV station had seen an
advertisement on car parts. How long must the advertisement air to reach 80%
of the station’s viewers?
188 Chapter 10. Differential Equations (LECTURE NOTES 10)

(a) General Solution.


Since dy
dt
= k(N − y),

1
dy = k dt separation of variables
N −y
1
Z Z
dy = k dt integrate both sides
N −y
1 0+1
− ln(N − y) = k · t + C notice − ln(N − y) not ln(N − y) because of −y
0+1
ln(N − y) = −kt + C
eln(N −y) = e−kt+C
N − y = e−kt+C

so (i) y = N e−kt + M (ii) y = N + eM t (iii) y = N − M e−kt

(b) Particular Solution.


Since no viewers see advertisement before it airs, at t = 0, y = 0,
so solve dy
dt
= k(N − y), given f (0) = 0.
Since y = N − Me−kt = 24000 − Me−kt ,

0 = 24000 − Mek(0) since t = 0, y = 0

or M = (i) 24000 (ii) 25000 (iii) 10000

and so the particular solution is y = N − Me−kt =


(i) 2500 − 2500e−kt (ii) 24000 − 24000e−kt (iii) 25000 − 10000e−kt

(c) What is k when t = 10, y = 0.4(24000) = 9600?

9600 = 24000 − 24000e−k(10)

so e−10k = 14400
24000
or −10k = ln 0.6, so
k ≈ (i) 0.05108 (ii) 0.08244 (iii) 0.09232.

(d) What is t when k ≈ 0.05108, y = 0.8(24000) = 19200?

19200 = 24000 − 24000e−0.05108t


4800
so e−0.05108t = 24000 or −0.05108t = ln 0.2, so
t ≈ (i) 29.5 (ii) 30.5 (iii) 31.5.
Section 4. Applications of Differential Equations (LECTURE NOTES 10) 189

 
2. Application: logistic growth rate model, dy
dt
= k 1 − Ny y.
After 4 days, an initial butterfly population of 15 grows to 56. If the restricted
ecosystem supports 300 butterflies, how many butterflies will there be in 12
days? Assuming the butterfly population grows fastest when there are N2 =
300
2
= 150 butterflies, when does this happen?

(a) Particular Solution.  


dy y
Assume particular solution to dt
=k 1− N
y, y(0) = y0 is

N N − y0
y= , b=
1 + be−kt y0
in other words, since
N − y0 300 − 15
b= = = 19,
y0 15
N 300 300 300
so y = 1+be−kt
= (i) 1+19e−kt
(ii) 1+20e−kt
(iii) 1+21e−kt

(b) What is k when t = 4, y = 56?


300
56 =
1 + 19e−k(4)
300
1 + 19e−4k =
56
300
19e−4k = −1
56
300
56
−1
e−4k =
19
300
!
56
−1
−4k = ln
19
 300 
−1
ln 56
19
k = ≈
−4
(i) 0.368 (ii) 0.743 (iii) 0.876.

(c) What is y when k ≈ 0.368, t = 12?


300
y≈ ≈
1 + 19e−(0.368)(12)
(i) 113 (ii) 214 (iii) 244.
round up
190 Chapter 10. Differential Equations (LECTURE NOTES 10)

(d) Time of maximum growth rate of butterflies, when y = 150? Since


300
150 =
 
1 + 19e−0.368t
150 1 + 19e−0.368t = 300
150 + 19(150)e−0.368t = 300
300 − 150
e−0.368t =
19(150)
  1
ln e−0.368t = ln
19
1
−0.368t = ln
19
1
ln 19
t = − ≈
0.368
(i) 8 (ii) 9 (iii) 10 days.

3. Application: predator-prey models.


Consider the following system of differential equations which describe two com-
peting species such as foxes (x) and rabbits (y), where each species keeps the
other species in check, or, as one population increases, the other decreases,
dy
= 3y − 3xy prey (rabbit) differential equation
dt
dx
= −2x + xy. predator (fox) differential equation
dt
Rabbit differential equation equals rate of increase of rabbits (since no foxes
around to eat rabbits) minus rate of rabbit-fox encounters (negative because
foxes eat rabbits during encounters), whereas fox differential equation equals
negative rate of predators (since no rabbits for foxes to eat) plus rate of rabbit-
fox encounters. Determine equation relating x to y, assume y = 1 when x = 1.

(a) General Solution.

dy dy/dt
=
dx dx/dt
dy 3y − 3xy
=
dx −2x + xy
dy y(3 − 3x)
=
dx x(−2 + y)
−2 + y 3 − 3x
dy = dx separation of variables
y x
Section 4. Applications of Differential Equations (LECTURE NOTES 10) 191

!
2 3
Z Z  
− + 1 dy = − 3 dx
y x
1 0+1 3
−2 ln y + y = 3 ln x − x0+1 + C
1+0 1+0
so (i) 2 ln y + 12 y 2 = 3 ln x − 32 x3 + C
(ii) −2 ln y + y = 3 ln x − 3x + C

(b) Particular Solution, at (x, y) = (1, 1).


Since −2 ln y + y = 3 ln x − 3x + C,
−2 ln 1 + 1 = 3 ln 1 − 3(1) + C since x = 1, y = 1

and so
C = (i) 2 (ii) 3 (iii) 4

and so particular solution is


(i) −2 ln y + y = 3 ln x − 3x + 2
(ii) −2 ln y + y = 3 ln x − 3x + 3
(iii) −2 ln y + y = 3 ln x − 3x + 4
graph of this equation of number of foxes, x, and number of rabbits, y, given in figure

(c) Equilibrium and particular solution at (x, y) = (1, 1).


x´ = -2x + xy
y´ = 3y - 3xy
-2 ln y + y = 3 ln x - 3x + 4 when (x,y) = (1,1)
4

3.5

2.5

y
(1,2)
2

1.5

1
(1,1)

0.5

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

Figure 10.4 (Rabbit-Fox plot, (http://math.rice.edu/ dfield/dfpp.html))

Equilibrium occurs when number of foxes and rabbits does not change;
when both differential equations equal zero:
dy
= 3y − 3xy = 0
dt
192 Chapter 10. Differential Equations (LECTURE NOTES 10)

dx
= −2x + xy = 0,
dt
either if both (x, y) = (0, 0) when there are no rabbits or foxes
or 3y − 3xy = 3y(1 − x) = 0 and −2x + xy = x(−2 + y) = 0 so

equilibrium (x, y) = (i) (1, 2) (ii) (1, 1) (iii) (2, 1)


In this case, rabbit-fox population starting at (x, y) = (1, 1) spirals indefinitely around equilibrium
(x, y) = (1, 2), different starting points give different spirals; different differential equations can give
different behaviors such as spiraling outwards from or inwards to equilibrium.

4. Application: Wine mixture.


Five grams of crushed pepper is dissolved in 200 liters of wine. Wine is added
at a rate of 3 liters per hour and also the solution is drained at 2 liters per hour.
Determine the equation describing the mixture at time t. How much crushed
pepper is present after 25 hours?

(a) Mixture equation. If y = f (t) is the amount of pepper in wine then change
in pepper over time is, since no pepper is being added,
dy
= (rate of pepper in) - (rate of pepper out)
dt
dy y
 
= 0− grams per liter (2 liters per hour) ,
dt V
dy 2y
= − ,
dt V
and also the change in volume of wine is
dV
= (rate of wine in) - (rate of wine out)
dt
dV
= 3−2 =1
dt
dV = 1 dt, separation of variables
Z Z
dV = 1 dt
V (t) = t + C,
200 = 0 + C since V = 200, t = 0

so C = (i) 0 (ii) 100 (iii) 200

and so particular solution is


(i) V (t) = t (ii) V (t) = t + 100 (iii) V (t) = t + 200
Section 4. Applications of Differential Equations (LECTURE NOTES 10) 193

so combining with first equation


dy 2y
= −
dt V
dy 2y
= −
dt t + 200
1 2
dy = − dt separation of variables
y t + 200
!
1 2
Z Z  
dy = − dx
y t + 200
ln y = −2 ln (t + 200) + C
ln 5 = −2 ln (0 + 200) + C since y = 5, t = 0
ln 5 + 2 ln 200 = C since y = 5, t = 0

so C = (i) ln(10 × 200) (ii) ln(5 × 200) (iii) ln(5 × 2002 )

and so particular solution is


(i) ln y = ln (t + 200) + ln(5 × 2002 )
(ii) ln y = −2 ln (t + 200) + ln(5 × 2002 )
(iii) ln y = −2 ln (t + 200) − ln(5 × 2002 )

or

ln y = −2 ln (t + 200) + ln(5 × 2002 ) = ln (t + 200)−2 (5 × 2002 )


2002 5×2002 5×2002
and so y = (i) (t+200)2
(ii) (t+200)2
(iii) (t+200)

(b) Crushed pepper after 25 hours?

5 × 2002 5 × 2002
y= = ≈
(t + 200)2 (25 + 200)2

(i) 3.85 (ii) 3.95 (iii) 4.05 grams

You might also like