|
Math 122 - Calculus for Biology II |
|
---|---|---|
San Diego State University -- This page last updated 01-Mar-04 |
This section examines several examples of differential equations that are solved numerically using Euler's method. It cannot be emphasized enough that these numerical methods are best studied in a computer laboratory. (See the Excel worksheet that has been provided for working Euler's method and Improved Euler's method problems by computer.) For practical examples, numerical techniques are often the best method for studying a differential equation. This is why many software programs, including Maple and MatLab, contain special programs for numerically solving a differential equation. It is also very important to remember that Euler's method is great for both a beginning point in studying numerical differential equations and helping to understand the theory behind these methods, but is rarely of any practical value in real applications. If you really need to numerically solve a differential equation, then some other method, such as the Runge-Kutta-Fehlberg method (used by Maple and MatLab and discussed in almost any modern numerical analysis text), should be used. Still for pedagogical purposes, it is valuable to go through a couple of examples by hand, which is what we do below, and you should do with the homework assignment.
Example 1: Consider the initial value problem given by
With a stepsize of h = 0.2, use Euler's method to approximate y(t) at t = 1, i.e., take five Euler steps. Show that the actual solution of this problem is
Determine the percent error between the approximate solution and the actual solution at t = 1.
Solution: The Euler's formula for this initial value problem is given by
The initial condition y(0) = 2 implies that t0 = 0 and y0 = 2. Below we simulate the differential equations with Euler's method by setting up a table. Here are the first five iterates to reach t = 1.
tn |
|
|
|
|
|
|
|
|
|
|
|
|
|
If the solution is given by y(t) = 2(4t + 1)-1, so y '(t) = -2(4t + 1)-2(4) = -8(4t + 1)-2. By computing -2y(t)2, we see that -2y(t)2 = -2(2(4t + 1)-1)2 = -8(4t + 1)-2. Thus, the differential equation is satisfied by the solution that is given. By substituting t = 1 into the solution, we have y(1) = 0.4. The percent error is found by the formula below
Example 2: Consider the initial value problem given by
With a stepsize of h = 0.25, use Euler's method to approximate y(t) at t = 1, i.e., take four Euler steps. Show that the actual solution of this problem is
Determine the percent error between the approximate solution and the actual solution.
Solution: This problem is similar to the last example. The Euler's formula for this initial value problem is given by
The initial condition y(0) = 2 implies that t0 = 0 and y0 = 2. Below we simulate the differential equations with Euler's method by setting up a table. Here are the first five iterates to reach t = 1.
tn |
|
|
|
|
|
|
|
|
|
|
|
If the solution is given by y(t) = (2t2 + 4)0.5, so y '(t) = 0.5(2t2 + 4)-0.5(4t) = 2t(2t2 + 4)-0.5. By computing 2t/y(t), we see that 2t/y(t) = 2t/(2t2 + 4)0.5= 2t(2t2 + 4)-0.5. Thus, the differential equation is satisfied by the solution that is given. By substituting t = 1 into the solution, we have y(1) = 61/2 = 2.4495. The percent error is found by the formula below
Example 3: Our discrete model for the population growth of the U. S. showed that the rate of growth has been declining for most of the census counts. Below is a Malthusian growth model with a time varying growth rate.
where t is in years. Use Euler's method with a stepsize of h = 0.2 to approximate P(t) at t = 1, i.e., take five Euler steps. Show that the actual solution of this problem is
Determine the percent error between the approximate solution and the actual solution. Use the actual solution to find the maximum population of this growth model and when this occurs.
Solution: We begin by showing that the solution above satisfies the differential equation. Clearly, it satisfies the initial condition (substituting t = 0). Upon differentiation, the chain rule gives
Thus,
The Euler's formula for this problem becomes
As we have done in previous problems, we create a table beginning with the initial conditions t0 = 0 and P0 = 5000.
tn |
|
|
|
|
|
|
= 5200 + 0.2(0.2 - 0.02(0.2))5200 = 5403.84 |
|
= 5403.84 + 0.2(0.2 - 0.02(0.4))5403.84 = 5611.35 |
|
= 5611.35 + 0.2(0.2 - 0.02(0.6))5611.35 = 5822.33 |
|
= 5822.33 + 0.2(0.2 - 0.02(0.8))5822.33 = 6036.60 |
Combining the results in the table above with the actual solution given above, we can create a table that shows the percent error.
tn |
Euler's Pn |
Actual P(t) |
% Error |
0 |
5000 |
5000 |
0 |
0.2 |
5200 |
5202.0 |
0.04 |
0.4 |
5403.8 |
5407.8 |
0.07 |
0.6 |
5611.35 |
5617.2 |
0.10 |
0.8 |
5822.3 |
5830.1 |
0.13 |
1 |
6036.6 |
6046.2 |
0.16 |
Since this population begins by growing, its maximum can be found by determining when the derivative is equal to zero. Since
and because P(t) is positive, the derivative is zero (growth rate falls to zero) when 0.2 - 0.02t = 0 or t = 10 years. This is substituted into the actual solution for the differential equation giving