Math Insight

Solving pure-time differential equations with the Forward-Euler algorithm

Math 201, Spring 2015
Name:
ID #:
Due date:
Table/group #:
Group members:
  1. In this problem, we will explore a method for approximating solutions to differential equations. Let's consider the pure-time differential equation \begin{align*} x'(t) &= f(t)\\ x(0) &= -5 \end{align*} where $f(t) = 2 t - 1$.
    1. Recall that the derivative, along with a point, can be used to find the linear approximation (or tangent line) to a function. Even though we might not know what $x(t)$ is, we can still use the initial condition and the derivative to find the linear approximation. Remember that the formula for the linear approximation at $t=a$ is $L_a(t) = x(a)+x'(a) (t-a)$. Write down the linear approximation for $x(t)$ at $t=0$.
      $L_0(t) =$
      $+$
      $($
      $)$

      Suppose we want to know what $x (4)$ is. We could estimate it by plugging $4$ into the linear approximation. What does that give us?
      $L_0(4) =$
      $+$
      $($
      $)=$

      In general, what do we know about the error of the linear approximation (in other words, the difference between a function and its linear approximation)?

    2. Is this close to the actual value? Probably not, because $4$ is not very close to $0$. Is there a way we can use the idea of linear approximation to get a closer estimate? Can we use the linear approximation at some point close to $4$? Why or why not?

      Maybe we could use the linear approximation at $t=0$ to find an estimate for some $t$ between $0$ and $4$, and then use that estimate to form an approximation to the linear approximation at this intermediate $t$. Even if it isn't quite the actual linear approximation, we can still use it to estimate $x (4)$. Let's try this with $t=2$ and see what happens. Plug $t=2$ into the linear approximation you found in part a:
      $L_0(2)=$
      $+$
      $($
      $)=$

      Now take this to be $x(2)$ and create a new linear approximation at $t=2$.
      $L_2(t)=$
      $+$
      $($
      $)$
      Use $L_2(t)$ to estimate $x(4)$.
      $L_2(4) =$
      $+$
      $($
      $)=$

      This estimate is quite different from the estimate in part a. Does that necessarily mean that it is a better estimate?

    3. The only way to tell which estimate is better is to know the actual value. In general, we use this method because we don't know how to find the actual value. If we magically pick the answer out of a hat, though, we can compare the estimates with the actual answer and understand the process better. The solution to our particular differential equation is $x(t)=t^{2} - t - 5$, so the actual value is $x (4) = $
      . Which of our estimates is closer?
      Is either one a good estimate?
      .

      The problem with the second estimate is that $2$ is still not close to $0$, so the estimate for $x(2)$ is not close to the actual value. How can we fix this problem?
      As we decrease the time intervals, the estimate for $x (4)$ will approach the actual value. If we wanted to, we could take the time intervals to be very small (perhaps getting estimates at $t=.001$, $t=.002$, $t=.003$, all the way up to $t=3.999$ and $t=4$), which would result in a very close estimate. What is the problem with this approach?
      This tradeoff between accuracy and computational time can be quite important. In order to keep the error small, we often have to take time steps that are smaller than $1$. We can use a computer program to do the computation for us, but even then, there are time steps so small that the computer will take too long to come up with an answer.

      Use the applet below to visualize this. Start by plotting the initial condition. Then use the first slider to step through the process of finding the linear approximations and the points used in part b. Next, move the second slider over to $\Delta t=1$, and find the slopes and points that would correspond to an approximation using $\Delta t=1$. Repeat with $\Delta t=.5$. Click the checkbox labeled exact to view the exact solution.

      Feedback from applet
      Initial condition:
      Points for curve 1:
      Points for curve 2:
      Points for curve 3:
      Slopes for curve 1:
      Slopes for curve 2:
      Slopes for curve 3:
    4. The approach to estimating solutions described so far is known as the Forward Euler method for solving differential equations. Let's write down an algorithm to describe this method a bit more directly. First, we need to know the step size, which we often call $\Delta t$, our starting point (the initial condition $x(a)$), and ending time $b$. Once we have that, we can just plug things in to the algorithm. We'll denote our estimates by $\hat{ x }(t_n)$, where $t_n$ denotes the time at the $n$-th step.

      First, identify the starting values: $t_0=a$ is the time given in the initial condition, and $\hat{ x }(t_0)=x(a)$. Then, starting with $n=1$, repeat the following steps until you have found $\hat{ x }(b)$.

      1. Compute $t_n$ by adding $\Delta t$ to $t_{n-1}$.
      2. Use the following formula to calculate $\hat{ x }(t_n)$:
        $\hat{ x }(t_n) = \hat{ x }(t_{n-1})+ x'(t_{n-1}) \Delta t$

      Let's look at how this connects to parts a and b. In part a, $\Delta t =$
      and we had to take
      step(s) to reach the desired value. In part b, $\Delta t = $
      and we had to take
      step(s) to reach the desired value.

    5. Use $\Delta t = \frac{1}{2}$ to estimate $x(4)$ for the differential equation from the start of this problem. What do we need to add to $\hat{ x }(t_{n-1})$ to get $\hat{ x }(t_{n})$?
      . So
      $t_1=$

      $t_2=$

      $t_3=$

      etc. and we can stop when $t_n=4$, which is when $n=$
      .

      $\hat{ x }(t_1) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_2) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_3) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_4) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_5) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_6) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_7) = $
      $+$
      $($
      $)=$

      $\hat{ x }(t_8) = $
      $+$
      $($
      $)=$

    1. Consider the differential equation \begin{align*} \frac{d y}{d t} &= f(t)\\ y(0) &= 2 \end{align*} where $f(t) = e^{\sqrt{t}}$.

      Use the Forward Euler method with step size $0.1$ to approximate $y(1)$. Note: Answers must be accurate to at least 4 significant digits. To prevent round-off error, though, make sure you use more than that in your computations.

      How many steps do you need to take?

      $\hat{ y }_1 = $
      $+$
      $($
      $)=$

      $\hat{ y }_2 = $
      $+$
      $($
      $)=$

      $\hat{ y }_3 = $
      $+$
      $($
      $)=$

      $\hat{ y }_4 = $
      $+$
      $($
      $)=$

      $\hat{ y }_5 = $
      $+$
      $($
      $)=$

      $\hat{ y }_6 = $
      $+$
      $($
      $)=$

      $\hat{ y }_7 = $
      $+$
      $($
      $)=$

      $\hat{ y }_8 = $
      $+$
      $($
      $)=$

      $\hat{ y }_9 = $
      $+$
      $($
      $)=$

      $\hat{ y }_{10} = $
      $+$
      $($
      $)=$

    2. Consider the differential equation \begin{align*} \frac{d z}{d t} &= g(t)\\ z(1) &= -1 \end{align*} where $g(t) = \sqrt{t} + t$.

      Use the Forward Euler method with step size $0.2$ to approximate $z(3)$. Note: Answers must be accurate to at least 4 significant digits. To prevent round-off error, though, make sure you use more than that in your computations.

      How many steps do you need to take?

      $\hat{ z }_1 = $
      $+$
      $($
      $)=$

      $\hat{ z }_2 = $
      $+$
      $($
      $)=$

      $\hat{ z }_3 = $
      $+$
      $($
      $)=$

      $\hat{ z }_4 = $
      $+$
      $($
      $)=$

      $\hat{ z }_5 = $
      $+$
      $($
      $)=$

      $\hat{ z }_6 = $
      $+$
      $($
      $)=$

      $\hat{ z }_7 = $
      $+$
      $($
      $)=$

      $\hat{ z }_8 = $
      $+$
      $($
      $)=$

      $\hat{ z }_9 = $
      $+$
      $($
      $)=$

      $\hat{ z }_{10} = $
      $+$
      $($
      $)=$