Skip to main content

Section 7.3 Euler's method

In Section 7.2, we saw how a slope field can be used to sketch solutions to a differential equation. In particular, the slope field is a plot of a large collection of tangent lines to a large number of solutions of the differential equation, and we sketch a single solution by simply following these tangent lines. With a little more thought, we can use this same idea to approximate numerically the solutions of a differential equation.

Preview Activity 7.3.1.

Consider the initial value problem

dydt=12(y+1), y(0)=0.
  1. Use the differential equation to find the slope of the tangent line to the solution y(t) at t=0. Then use the given initial value to find the equation of the tangent line at t=0.

  2. Sketch the tangent line on the axes provided in Figure 7.3.1 on the interval 0t2 and use it to approximate y(2), the value of the solution at t=2.

    Figure 7.3.1. Grid for plotting the tangent line.
  3. Assuming that your approximation for y(2) is the actual value of y(2), use the differential equation to find the slope of the tangent line to y(t) at t=2. Then, write the equation of the tangent line at t=2.

  4. Add a sketch of this tangent line on the interval 2t4 to your plot Figure 7.3.1; use this new tangent line to approximate y(4), the value of the solution at t=4.

  5. Repeat the same step to find an approximation for y(6).

Subsection 7.3.1 Euler's Method

Preview Activity 7.3.1 demonstrates an algorithm known as Euler's 1  Method, which generates a numerical approximation to the solution of an initial value problem. In this algorithm, we will approximate the solution by taking horizontal steps of a fixed size that we denote by Δt.

“Euler” is pronounced “Oy-ler.” Among other things, Euler is the mathematician credited with the famous number \(e\text{;}\) if you incorrectly pronounce his name “You-ler,” you fail to appreciate his genius and legacy.

Before explaining the algorithm in detail, let's remember how we compute the slope of a line: the slope is the ratio of the vertical change to the horizontal change, as shown in Figure 7.3.2.

In other words, m=ΔyΔt. Solving for Δy, we see that the vertical change is the product of the slope and the horizontal change, or

Δy=mΔt.
Figure 7.3.2. The role of slope in Euler's Method.

Now, suppose that we would like to solve the initial value problem

dydt=ty, y(0)=1.

There is an algorithm by which we can find an algebraic formula for the solution to this initial value problem, and we can check that this solution is y(t)=t1+2et. But we are instead interested in generating an approximate solution by creating a sequence of points (ti,yi), where yiy(ti). For this first example, we choose Δt=0.2.

Since we know that y(0)=1, we will take the initial point to be (t0,y0)=(0,1) and move horizontally by Δt=0.2 to the point (t1,y1). Thus, t1=t0+Δt=0.2. Now, the differential equation tells us that the slope of the tangent line at this point is

m=dydt|(0,1)=01=1,

so to move along the tangent line by taking a horizontal step of size Δt=0.2, we must also move vertically by

Δy=mΔt=10.2=0.2.

We then have the approximation y(0.2)y1=y0+Δy=10.2=0.8. At this point, we have executed one step of Euler's method, as seen graphically in Figure 7.3.3.

Figure 7.3.3. One step of Euler's method.

Now we repeat this process: at (t1,y1)=(0.2,0.8), the differential equation tells us that the slope is

m=dydt|(0.2,0.8)=0.20.8=0.6.

If we move forward horizontally by Δt to t2=t1+Δ=0.4, we must move vertically by

Δy=0.60.2=0.12.

We consequently arrive at y2=y1+Δy=0.80.12=0.68, which gives y(0.2)0.68. Now we have completed the second step of Euler's method, as shown in Figure 7.3.4.

Figure 7.3.4. Two steps of Euler's method.

If we continue in this way, we may generate the points (ti,yi) shown in Figure 7.3.5. Because we can find a formula for the actual solution y(t) to this differential equation, we can graph y(t) and compare it to the points generated by Euler's method, as shown in Figure 7.3.6.

Figure 7.3.5. The points and piecewise linear approximate solution generated by Euler's method.
Figure 7.3.6. The approximate solution compared to the exact solution (shown in blue).

Because we need to generate a large number of points (ti,yi), it is convenient to organize the implementation of Euler's method in a table as shown. We begin with the given initial data.

ti yi dy/dt Δy
0.0000 1.0000

From here, we compute the slope of the tangent line m=dy/dt using the formula for dy/dt from the differential equation, and then we find Δy, the change in y, using the rule Δy=mΔt.

ti yi dy/dt Δy
0.0000 1.0000 1.0000 0.2000

Next, we increase ti by Δt and yi by Δy to get

ti yi dy/dt Δy
0.0000 1.0000 1.0000 0.2000
0.2000 0.8000

We continue the process for however many steps we decide, eventually generating a table like Table 7.3.7.

ti yi dy/dt Δy
0.0000 1.0000 1.0000 0.2000
0.2000 0.8000 0.6000 0.1200
0.4000 0.6800 0.2800 0.0560
0.6000 0.6240 0.0240 0.0048
0.8000 0.6192 0.1808 0.0362
1.0000 0.6554 0.3446 0.0689
1.2000 0.7243 0.4757 0.0951
Table 7.3.7. Euler's method for 6 steps with Δt=0.2.
Activity 7.3.2.

Consider the initial value problem

dydt=2t1, y(0)=0
  1. Use Euler's method with Δt=0.2 to approximate the solution at ti=0.2,0.4,0.6,0.8, and 1.0. Record your work in the following table, and sketch the points (ti,yi) on the axes provided.

    ti yi dy/dt Δy
    0.0000 0.0000
    0.2000
    0.4000
    0.6000
    0.8000
    1.0000
    Table 7.3.8. Table for recording results of Euler's method.
    Figure 7.3.9. Grid for plotting points generated by Euler's method.
  2. Find the exact solution to the original initial value problem and use this function to find the error in your approximation at each one of the points ti.

  3. Explain why the value y5 generated by Euler's method for this initial value problem produces the same value as a left Riemann sum for the definite integral 01(2t1) dt.

  4. How would your computations differ if the initial value was y(0)=1? What does this mean about different solutions to this differential equation?

Hint
  1. Small hints for each of the prompts above.

Answer
  1. \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0\) \(0\) \(-1\) \(-0.2\)
    \(0.2\) \(-0.2\) \(-0.6\) \(-0.12\)
    \(0.4\) \(-0.32\) \(-0.2\) \(-0.04\)
    \(0.6\) \(-0.36\) \(0.2\) \(0.04\)
    \(0.8\) \(-0.32\) \(0.6\) \(0.12\)
    \(1.0\) \(-0.2\) \(1\) \(0.2\)
  2. \(y = t^2 - t\text{,}\) with errors \(e_1 = 0.04\text{,}\) \(e_2 = 0.08\text{,}\) \(e_3 = 0.12\text{,}\) \(e_4 = 0.16\text{,}\) \(e_5 = 0.2\text{.}\)

  3. If we first think about how \(y_1\) is generated for the initial value problem \(\frac{dy}{dt} = f(t) = 2t-1, \ y(0) = 0\text{,}\) we see that \(y_1 = y_0 + \Delta t \cdot f(t_0)\text{.}\) Since \(y_0 = 0\text{,}\) we have \(y_1 = \Delta t \cdot f(t_0)\text{.}\) From there, we know that \(y_2\) is given by \(y_2 = y_1 + \Delta t f(t_1)\text{.}\) Substituting our earlier result for \(y_1\text{,}\) we see that \(y_2 = \Delta t \cdot f(t_0) + \Delta t f(t_1)\text{.}\) Continuing this process up to \(y_5\text{,}\) we get

    \begin{equation*} y_5 = \Delta t \cdot f(t_0) + \Delta t f(t_1) + \Delta t f(t_2) + \Delta t f(t_3) + \Delta t f(t_4) \end{equation*}

    This is precisely the left Riemann sum with five subintervals for the definite integral \(\int_0^1 (2t-1)~dt\text{.}\)

  4. Solutions to this differential equation all differ by only a constant.

Solution
  1. Using Euler's Method with \(\Delta t = 0.2\text{,}\) we find the results shown in the table and graph below.

    \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0\) \(0\) \(-1\) \(-0.2\)
    \(0.2\) \(-0.2\) \(-0.6\) \(-0.12\)
    \(0.4\) \(-0.32\) \(-0.2\) \(-0.04\)
    \(0.6\) \(-0.36\) \(0.2\) \(0.04\)
    \(0.8\) \(-0.32\) \(0.6\) \(0.12\)
    \(1.0\) \(-0.2\) \(1\) \(0.2\)
  2. The exact solution to the initial value problem \(\frac{dy}{dt} = 2t-1, \ y(0) = 0\) is \(y = t^2 - t\text{,}\) which we find by integrating both sides with respect to \(t\) and then applying the fact that \(y(0) = 0\) to determine that the integration constant is \(0\text{.}\) From here, we can see that the errors are \(e_1 = y(0.2) - y_1 = 0.04\text{,}\) \(e_2 = y(0.4) - y_2 = 0.08\text{,}\) \(e_3 = y(0.6) - y_3 = 0.12\text{,}\) \(e_4 = y(0.8) - y_4 = 0.16\text{,}\) \(e_5 = y(1.0) - y_5 = 0.2\text{.}\)

  3. If we first think about how \(y_1\) is generated for the initial value problem \(\frac{dy}{dt} = f(t) = 2t-1, \ y(0) = 0\text{,}\) we see that \(y_1 = y_0 + \Delta t \cdot f(t_0)\text{.}\) Since \(y_0 = 0\text{,}\) we have \(y_1 = \Delta t \cdot f(t_0)\text{.}\) From there, we know that \(y_2\) is given by \(y_2 = y_1 + \Delta t f(t_1)\text{.}\) Substituting our earlier result for \(y_1\text{,}\) we see that \(y_2 = \Delta t \cdot f(t_0) + \Delta t f(t_1)\text{.}\) Continuing this process up to \(y_5\text{,}\) we get

    \begin{equation*} y_5 = \Delta t \cdot f(t_0) + \Delta t f(t_1) + \Delta t f(t_2) + \Delta t f(t_3) + \Delta t f(t_4) \end{equation*}

    This is precisely the left Riemann sum with five subintervals for the definite integral \(\int_0^1 (2t-1)~dt\text{.}\)

  4. Since \(\frac{dy}{dt} = 2t-1\text{,}\) the slope of the tangent line depends only on \(t\text{.}\) Thus, the different initial condition of \(y(0) = 1\) simply adds \(1\) to every value of \(y_i\) in our computations, which shifts every point we compute by Euler's Method up by 1 unit. This tells us that the solutions to this differential equation all differ by only a constant. We can see that both in our computations with Euler's Method and if we solve the differential equation to get \(y = t^2 - t + C\text{.}\)

Activity 7.3.3.

Consider the differential equation dydt=6yy2.

  1. Sketch the slope field for this differential equation on the axes provided in Figure 7.3.10.

    Figure 7.3.10. Grid for plotting the slope field of the given differential equation.
  2. Identify any equilibrium solutions and determine whether they are stable or unstable.

  3. What is the long-term behavior of the solution that satisfies the initial value y(0)=1?

  4. Using the initial value y(0)=1, use Euler's method with Δt=0.2 to approximate the solution at ti=0.2,0.4,0.6,0.8, and 1.0. Record your results in Table 7.3.11 and sketch the corresponding points (ti,yi) on the axes provided in Figure 7.3.12. Note the different horizontal scale on the axes in Figure 7.3.12 compared to Figure 7.3.10.

    ti yi dy/dt Δy
    0.0 1.0000
    0.2
    0.4
    0.6
    0.8
    1.0
    Table 7.3.11. Table for recording results of Euler's method with Δt=0.2.
    Figure 7.3.12. Axes for plotting the results of Euler's method.
  5. What happens if we apply Euler's method to approximate the solution with y(0)=6?

Hint
  1. Small hints for each of the prompts above.

Answer
  1. \(y = 0\) or \(y = 6\text{.}\)

  2. The solution will tend to \(y = 6\text{.}\)

  3. \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0.0\) \(1.0000\) \(5.0000\) \(1.0000\)
    \(0.2\) \(2.0000\) \(8.0000\) \(1.6000\)
    \(0.4\) \(3.6000\) \(8.6400\) \(1.7280\)
    \(0.6\) \(5.3280\) \(3.5804\) \(0.7161\)
    \(0.8\) \(6.0441\) \(-0.2664\) \(-0.0533\)
    \(1.0\) \(5.9908\) \(0.0551\) \(0.0110\)
  4. The value of \(y_i = 6\) for every value of \(i\text{.}\)

Solution
  1. The slope field for this differential equation is shown in the following figure.

  2. If \(y\) is an equilibrium solution, then \(y\) is constant so \(\frac{dy}{dt} = 0\text{.}\) Solving \(0 = 6y - y^2\text{,}\) we see that either \(y = 0\) or \(y = 6\text{,}\) which is also consistent with what we see in the slope field.

  3. The long-term behavior of the solution that satisfies the initial value \(y(0) = 1\) is that the solution will tend to \(y = 6\text{.}\)

  4. Using Euler's method with \(\Delta t = 0.2\text{,}\) we approximate the solution of the IVP at \(t_i = 0.2, 0.4, 0.6, 0.8\text{,}\) and \(1.0\) as shown in the following table and figure. We see that our estimates actually jump slightly above the equilibrium solution before being pulled back down.

    \(t_i\) \(y_i\) \(dy/dt\) \(\Delta y\)
    \(0.0\) \(1.0000\) \(5.0000\) \(1.0000\)
    \(0.2\) \(2.0000\) \(8.0000\) \(1.6000\)
    \(0.4\) \(3.6000\) \(8.6400\) \(1.7280\)
    \(0.6\) \(5.3280\) \(3.5804\) \(0.7161\)
    \(0.8\) \(6.0441\) \(-0.2664\) \(-0.0533\)
    \(1.0\) \(5.9908\) \(0.0551\) \(0.0110\)
  5. If we apply Euler's method to approximate the solution with \(y(0) = 6\text{,}\) the value of \(y_i = 6\) for every value of \(i\) since \(y=6\) is an equilibrium solution and the slope of the tangent line will always be \(0\text{.}\)

Subsection 7.3.2 The error in Euler's method

Since we are approximating the solutions to an initial value problem using tangent lines, we should expect that the error in the approximation will be smaller when the step size is smaller. Consider the initial value problem

dydt=y, y(0)=1,

whose solution we can easily find.

The question posed by this initial value problem is “what function do we know that is the same as its own derivative and has value 1 when t=0?” It is not hard to see that the solution is y(t)=et. We now apply Euler's method to approximate y(1)=e using several values of Δt. These approximations will be denoted by EΔt, and we'll use them to see how accurate Euler's Method is.

To begin, we apply Euler's method with a step size of Δt=0.2. In that case, we find that y(1)E0.2=2.4883. The error is therefore

y(1)E0.2=e2.48830.2300.

Repeatedly halving Δt gives the following results, expressed in both tabular and graphical form.

Δt EΔt Error
0.200 2.4883 0.2300
0.100 2.5937 0.1245
0.050 2.6533 0.0650
0.025 2.6851 0.0332
Table 7.3.13. Errors that correspond to different Δt values.
Figure 7.3.14. A plot of the error as a function of Δt.

Notice, both numerically and graphically, that the error is roughly halved when Δt is halved. This example illustrates the following general principle.

If Euler's method is used to approximate the solution to an initial value problem at a point t¯, then the error is proportional to Δt. That is,

y(t¯)EΔtKΔt

for some constant of proportionality K.

Subsection 7.3.3 Summary

  • Euler's method is an algorithm for approximating the solution to an initial value problem by following the tangent lines while we take horizontal steps across the t-axis.

  • If we wish to approximate y(t¯) for some fixed t¯ by taking horizontal steps of size Δt, then the error in our approximation is proportional to Δt.

Exercises 7.3.4 Exercises

1. A few steps of Euler's method.
2. Using Euler's method for a solution of y=4y.
3. Using Euler's method with different time steps.
4.

Newton's Law of Cooling says that the rate at which an object, such as a cup of coffee, cools is proportional to the difference in the object's temperature and room temperature. If T(t) is the object's temperature and Tr is room temperature, this law is expressed at

dTdt=k(TTr),

where k is a constant of proportionality. In this problem, temperature is measured in degrees Fahrenheit and time in minutes.

  1. Two calculus students, Alice and Bob, enter a 70 classroom at the same time. Each has a cup of coffee that is 100. The differential equation for Alice has a constant of proportionality k=0.5, while the constant of proportionality for Bob is k=0.1. What is the initial rate of change for Alice's coffee? What is the initial rate of change for Bob's coffee?

  2. What feature of Alice's and Bob's cups of coffee could explain this difference?

  3. As the heating unit turns on and off in the room, the temperature in the room is

    Tr=70+10sint.

    Implement Euler's method with a step size of Δt=0.1 to approximate the temperature of Alice's coffee over the time interval 0t50. This will most easily be performed using a spreadsheet such as Excel. Graph the temperature of her coffee and room temperature over this interval.

  4. In the same way, implement Euler's method to approximate the temperature of Bob's coffee over the same time interval. Graph the temperature of his coffee and room temperature over the interval.

  5. Explain the similarities and differences that you see in the behavior of Alice's and Bob's cups of coffee.

Answer
  1. Alice's coffee: \(\frac{dT_A}{dt} \vert_{T = 100} = -0.5(30) = -15\) degrees per minute; Bob's coffee: \(\frac{dT_B}{dt} \vert_{T = 100} = -0.1(30) = -3\) degrees per minute.

  2. Consider the insulation of the containers.

  3. Alice's coffee:

    \begin{equation*} \frac{dT_A}{dt} = -0.5(T_A-(70+10\sin t))\text{,} \end{equation*}

    with the inital condition \(T_A(0) = 100\text{.}\)

    \(t\) \(T_A(t)\)
    \(0.0\) \(100\)
    \(0.1\) \(98.5\)
    \(0.2\) \(97.12492\)
    \(0.3\) \(95.86801\)
    \(0.4\) \(94.72237\)
    \(\vdots\) \(\vdots\)
    \(49.6\) \(65.56715\)
    \(49.7\) \(65.48008\)
    \(49.8\) \(65.43816\)
    \(49.9\) \(65.44183\)
    \(50\) \(65.49103\)
  4. \(t\) \(T_A(t)\)
    \(0.0\) \(100\)
    \(0.1\) \(99.7\)
    \(0.2\) \(99.41298\)
    \(0.3\) \(99.13872\)
    \(0.4\) \(98.87689\)
    \(\vdots\) \(\vdots\)
    \(49.6\) \(69.39515\)
    \(49.7\) \(69.33946\)
    \(49.8\) \(69.29248\)
    \(49.9\) \(69.25467\)
    \(50\) \(69.22638\)
  5. Compare the rate of initial decrease and amplitude of oscillation.

Solution
  1. The differential equation for Alice's coffee is

    \begin{equation*} \frac{dT_A}{dt} = -0.5(T-70)\text{,} \end{equation*}

    so at the instant \(t = 0\text{,}\) \(T = 100\text{,}\) and thus \(\frac{dT_A}{dt} \vert_{T = 100} = -0.5(30) = -15\) degrees per minute. For Bob's coffee,

    \begin{equation*} \frac{dT_B}{dt} = -0.1(T-70)\text{,} \end{equation*}

    so \(\frac{dT_B}{dt} \vert_{T = 100} = -0.1(30) = -3\) degrees per minute. These are the initial rates of change of the respective cups of coffee.

  2. The difference between the cups of coffee could be explained by how insulated the containers are: Bob's coffee loses temperature less quickly, so his is likely better insulated.

  3. With this varying temperature, the governing differential equation for Alice's coffee is

    \begin{equation*} \frac{dT_A}{dt} = -0.5(T_A-(70+10\sin t))\text{,} \end{equation*}

    with the inital condition \(T_A(0) = 100\text{.}\) Implementing Euler's Method with \(\Delta t = 0.1\text{,}\) we get the following (abbreviated) table of data.

    \(t\) \(T_A(t)\)
    \(0.0\) \(100\)
    \(0.1\) \(98.5\)
    \(0.2\) \(97.12492\)
    \(0.3\) \(95.86801\)
    \(0.4\) \(94.72237\)
    \(\vdots\) \(\vdots\)
    \(49.6\) \(65.56715\)
    \(49.7\) \(65.48008\)
    \(49.8\) \(65.43816\)
    \(49.9\) \(65.44183\)
    \(50\) \(65.49103\)

    Plotting the data points that result from Euler's Method along with the room temperature function, we see how the room temperature drives the temperature of the coffee up and down as time goes on, as pictured in the figure above, where the data points for the coffee's approximate temperature are shown in dark blue, while the room temperature function, \(T_R(t) = 70 + 10\sin(t)\) is shown in green.

  4. Similar work with the differential equation for Bob's coffee yields the following abbreviated table of approximate function values along with the plot of the data and the temperature function.

    \(t\) \(T_A(t)\)
    \(0.0\) \(100\)
    \(0.1\) \(99.7\)
    \(0.2\) \(99.41298\)
    \(0.3\) \(99.13872\)
    \(0.4\) \(98.87689\)
    \(\vdots\) \(\vdots\)
    \(49.6\) \(69.39515\)
    \(49.7\) \(69.33946\)
    \(49.8\) \(69.29248\)
    \(49.9\) \(69.25467\)
    \(50\) \(69.22638\)
  5. The behaviors of both cups of coffee are similar in that each decreases toward the room temperature initially and then is driven in an osciallating way by the room temperature function as it rises and falls. We see that Alice's coffee is more susceptible to being influenced away from the average room temperature, which is consistent with her mug being less well insulated, while in Bob's coffee, we see much less radical oscillations (and a slower overall rate of decrease to get near room temperature), which is consistent with being better insulated.

5.

We have seen that the error in approximating the solution to an initial value problem is proportional to Δt. That is, if EΔt is the Euler's method approximation to the solution to an initial value problem at t¯, then

y(t¯)EΔtKΔt

for some constant of proportionality K.

In this problem, we will see how to use this fact to improve our estimates, using an idea called accelerated convergence.

  1. We will create a new approximation by assuming the error is exactly proportional to Δt, according to the formula

    y(t¯)EΔt=KΔt.

    Using our earlier results from the initial value problem dy/dt=y and y(0)=1 with Δt=0.2 and Δt=0.1, we have

    y(1)2.4883=(0.2Ky(1)2.5937=(0.1K.

    This is a system of two linear equations in the unknowns y(1) and K. Solve this system to find a new approximation for y(1). (You may remember that the exact value is y(1)=e=2.71828.)

  2. Use the other data, E0.05=2.6533 and E0.025=2.6851 to do similar work as in (a) to obtain another approximation. Which gives the better approximation? Why do you think this is?

  3. Let's now study the initial value problem

    dydt=ty, y(0)=0.

    Approximate y(0.3) by applying Euler's method to find approximations E0.1 and E0.05. Now use the idea of accelerated convergence to obtain a better approximation. (For the sake of comparison, you want to note that the actual value is y(0.3)=0.0408.)

Answer
  1. \(K = 1.054\text{;}\) \(y(1) = 2.6991\text{.}\)

  2. \(K = 1.272\text{;}\) \(y(1) = 2.7169\text{.}\)

  3. \(K = 0.122\) and \(y(0.3) = 0.0412\text{.}\)

Solution
  1. To solve the linear system

    \begin{align*} y(1) - 2.4883 =\mathstrut \amp 0.2K\\ y(1) - 2.5937 =\mathstrut \amp 0.1K \end{align*}

    we subtract the second equation from the first to eliminate \(y(1)\text{.}\) Doing so, we find that

    \begin{equation*} -2.4883 - (-2.5937) = 0.2K - 0.1K \end{equation*}

    so that

    \begin{equation*} 0.1054 = 0.1K \end{equation*}

    and thus \(K = 1.054\text{.}\) Substituting this value into the first equation in the system, it follows that

    \begin{equation*} y(1) - 2.4883 = 0.2(1.054) \end{equation*}

    so \(y(1) = 0.2(1.054) + 2.4883 = 2.6991\text{.}\)

  2. Recalling that \(E_{0.05} = 2.6533\) and \(E_{0.025} = 2.6851\text{,}\) it follows that this data generates the similar linear system given by

    \begin{align*} y(1) - 2.6533 =\mathstrut \amp 0.05K\\ y(1) - 2.6851 =\mathstrut \amp 0.025K\text{.} \end{align*}

    Solving this system yields \(K = 1.272\) and \(y(1) = 2.7169\text{.}\) Knowing that the true value of \(y(1)\) is \(e = 2.71828\ldots\text{,}\) we see that the approximation here in (b) is much better. That is expected because we are already working with better approximations that come from using \(\Delta t = 0.05\) and \(\Delta t = 0.025\text{,}\) which have been twice halved from the smaller \(\Delta t\) value in (a).

  3. To compute \(E_{0.1}\) and \(E_{0.05}\text{,}\) we first compute the estimates to \(y(0.3)\) using \(\Delta t = 0.1\) and \(\Delta t = 0.5\text{.}\) Doing so and making similar assumptions about the error as we did in (a) and (b), we find that for \(\Delta t = 0.1\text{,}\) \(y(1) \approx 0.0290\) and for \(\Delta t = 0.05\text{,}\) \(y(1) \approx 0.0351\text{,}\) and therefore we consider the system

    \begin{align*} y(0.3) - 0.0290 &= 0.1K\\ y(0.3) - 0.0351 &= 0.05K\text{.} \end{align*}

    Solving the system, it follows that \(K = (-0.0290 + 0.0351)/0.05 = 0.122\) and \(y(0.3) = 0.1(0.122) + 0.0290 = 0.0412\text{,}\) which is much closer to the actual value of \(y(0.3) = 0.0408\text{.}\)

6.

In this problem, we'll modify Euler's method to obtain better approximations to solutions of initial value problems. This method is called the Improved Euler's method.

In Euler's method, we walk across an interval of width Δt using the slope obtained from the differential equation at the left endpoint of the interval. Of course, the slope of the solution will most likely change over this interval. We can improve our approximation by trying to incorporate the change in the slope over the interval.

Let's again consider the initial value problem dy/dt=y and y(0)=1, which we will approximate using steps of width Δt=0.2. Our first interval is therefore 0t0.2. At t=0, the differential equation tells us that the slope is 1, and the approximation we obtain from Euler's method is that y(0.2)y1=1+1(0.2)=1.2.

This gives us some idea for how the slope has changed over the interval 0t0.2. We know the slope at t=0 is 1, while the slope at t=0.2 is 1.2, trusting in the Euler's method approximation. We will therefore refine our estimate of the initial slope to be the average of these two slopes; that is, we will estimate the slope to be (1+1.2)/2=1.1. This gives the new approximation y(1)=y1=1+1.1(0.2)=1.22.

The first few steps look like what is found in Table 7.3.15.

ti yi Slope at (ti+1,yi+1) Average slope
0.0 1.0000 1.2000 1.1000
0.2 1.2200 1.4640 1.3420
0.4 1.4884 1.7861 1.6372
Table 7.3.15. The first several steps of the improved Euler's method
  1. Continue with this method to obtain an approximation for y(1)=e.

  2. Repeat this method with Δt=0.1 to obtain a better approximation for y(1).

  3. We saw that the error in Euler's method is proportional to Δt. Using your results from parts (a) and (b), what power of Δt appears to be proportional to the error in the Improved Euler's Method?

Answer
  1. \(y(1) \approx y_5 = 2.7027\text{.}\)

  2. \(y(1) \approx y_{10} = 2.7141\text{.}\)

  3. The square of \(\Delta t\text{.}\)

Solution
  1. Continuing with this method, we find \(y(0.6) \approx y_3 = 1.8156\text{,}\) \(y(0.8) \approx y_4 = 2.2153\text{,}\) and \(y(1) \approx y_5 = 2.7027\text{,}\) which is an approximation for \(y(1) = e\text{.}\)

  2. Updating this method with \(\Delta t = 0.1\text{,}\) we find \(y(0.1) \approx y_1 = 1.105\text{,}\) \(y(0.2) \approx y_2 = 1.221\text{,}\) \(\ldots\text{,}\) \(y(1) \approx y_{10} = 2.7141\text{,}\) which is an even better approximation for \(y(1) = e\text{.}\)

  3. We have halved the value of \(\Delta t\) in these two approximations of \(y(1)\) in the Improved Euler Method. Using the notation \(I_{0.2} = 2.7027\) and \(I_{0.1} = 2.7141\) for the estimates generated by the method with the respective \(t\)-values, we see that the following occurs with the error (using the known value of \(y(1) = e\text{:}\)

    \begin{gather*} y(1) - I_{0.2} = 2.7183 - 2.7027 = 0.0156\\ y(1) - I_{0.1} = 2.7183 - 2.7141 = 0.0042 \end{gather*}

    Computing \(I_{0.05}\text{,}\) we find \(I_{0.05} = 2.7172\text{,}\) and thus \(y(1) - I_{0.05} = 0.0011\text{.}\) Experimenting with powers of \(\Delta t\text{,}\) it appears that these errors are each approximately \(0.4 \Delta t^2\text{,}\) and thus the error in the Improved Euler Method seems to be proportional to the square of \(\Delta t\text{.}\)