Math Insight

Using the Forward Euler algorithm to solve pure-time differential equations

 

Introductory video

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

More information about video. Video transcript. Video slides.

A pure-time differential equation

A pure-time differential equation is an equation of the form \begin{align} \diff{y}{t} &= f(t)\label{pure_time}\\ y(t_0) &= y_0, \notag \end{align} where the second equation is the initial condition. We prescribe that $y(t_0)$ is the value $y_0$, and we need to determine $y(t)$ for $t > t_0$. We can think of $f(t)$ as a measurement of the rate of change of $y(t)$ at the time $t$. Given this measured rate of change, we want to “add up” all the changes that have happened to $y$ since the initial time $t_0$ in order to determine the value $y(t)$ at time $t$.

If we can find an antiderivative $F(t)$ of $f(t)$, i.e., a function $F(t)$ such that $\diff{F}{t}=f(t)$, then the solution to the differential equation \eqref{pure_time} is simple. We can use the indefinite integral to calculate $y(t)$. We know that \begin{align*} y(t) = \int f(t) dt = F(t) + c, \end{align*} for some arbitrary constant $c$. The value of the constant is determined by the initial condition, i.e., $c$ is chosen so that \begin{align*} y_0=y(t_0) = F(t_0) + c \end{align*} is satisfied, i.e., $c = y_0-F(t_0)$. The solution to the pure-time differential equation is \begin{align} y(t)= F(t) + y_0 - F(t_0). \label{antidervative_solution} \end{align}

Finding an antiderivative $F(t)$ of $f(t)$, however, isn't always the simplest thing to do. And, for some (most?) functions $f(t)$, it's an impossible task. Here we introduce an approximate method, the Forward Euler method, to determine the solution $y(t)$. Now only does the Forward Euler method give us a way to estimate $y(t)$, it will also help us understand how an integral works.

The basis of Forward Euler: keeping the rate of change constant

Given the differential equation \eqref{pure_time}, we know what the initial rate of change of $y$ must be. This initial slope of $y(t)$ is $f(t_0)$. Unless $f(t)$ happens to be a constant function, $f(t)$ will change to different values for $t>t_0$. But, let's not worry about such realities. Let's close our eyes and pretend that $f(t)$ does not change and is frozen at the number $f(t_0)$. If $\diff{y}{t}$ is the constant $f(t_0)$, then $y(t)$ must be a line with slope $f(t_0)$. The equation for this line is \begin{align} y(t) \approx y_0 + f(t_0)(t-t_0),\label{tangentline_t0} \end{align} which is actually the formula for the tangent line to $y(t)$ at $t=t_0$ (since $y'(t_0)=f(t_0)$). By closing our eyes and pretending that $f(t)$ was a constant fixed at its initial value $f(t_0)$, we've replaced the true solution $y(t)$ with its tangent line calculated at $t=t_0$.

To be concrete, we'll think about the example differential equation \begin{align} \diff{y}{t} &= t^2-10\label{exampletsquared}\\ y(0) &= 50. \notag \end{align} Starting at $t=t_0=0$, the initial slope is $-10$, as $\diff{y}{t}=f(t_0) = f(0)=-10$. Its tangent line at $t=0$ is \begin{align*} y(t) &\approx y_0 + f(0)(t-0)\\ &=50 -10t. \end{align*} This tangent line is shown thin gray line in the right panel of the below applet when it is first started.

The tangent approximation will be a bad approximation of $y(t)$ for $t$ much larger than $t_0$. But, if we choose a small enough $\Delta t$ so that the slope $f(t)$ doesn't change much in the range $t_0 < t < t_0 + \Delta t$, then the approximation shouldn't be too bad if we don't go past $t=t_0+\Delta t$. The idea is that we'll just close our eyes for a short period of time, pretending that $f(t)$ is constant. After an interval of length $\Delta t$, we are allowed to open our eyes again.

When we open our eyes at time $t_0+\Delta t$, we can take stock of the situation. We had started at $y(t_0)= y_0$, and having followed the tangent line approximation \eqref{tangentline_t0} for a time of $\Delta t$, we see that we have arrived at \begin{align} y(t_0+\Delta t) &\approx y(t_0) + f(t_0)((t_0+\Delta t)-t_0)\notag\\ &= y(t_0) + f(t_0) \Delta t. \label{step1} \end{align}

In terms of the example system \eqref{exampletsquared}, we find ourselves at \begin{align*} y(0+\Delta t) &\approx y(0) + f(0)((0+\Delta t)-t_0)\\ &= 50 -10 \Delta. \end{align*} With $\Delta t=1$, as in the default setting of the applet, we estimate that $y(1)$ is approximately $50-10\cdot 1=40$.

Control panel (Show)
Step details (Show)
Error calculation (Show)

Details of the Forward Euler approximation to a pure time differential equation. Illustration of how the Forward Euler algorithm estimates the solution to a pure time differential equation $\diff{y}{t}=f(t)$ with initial condition $y(t_0)=y_0$. The function $f(t)$ is plotted by the blue curve in the left panel. In the Forward Euler algorithm, the function $f(t)$ is approximated as though it were constant on intervals of length $\Delta t$, as illustrated by the horizontal length segments coming from the graph of $f$. The height of each line segment is determined by the value of $f(t)$ at its left (green dots). When we assume $f(t)$ is a constant, the solution to $\diff{y}{t}=f(t)$ is a line whose slope is the value of $f$. The approximate solution is illustrated by the green curve in the right panel. Each segment of the green curve has a slope given by the height of the corresponding line segment in the left panel. To see this correspondence, you can move the pink points in either panel. The matching segments of the approximated $f(t)$ (at left) and estimate of $y(t)$ (at right) are highlighted in pink. Gray lines emphasize how we are are viewing $y(t)$ as a line with slope given by the constant value of $f(t)$, i.e., we make $y(t)$ be a tangent line to what the true solution would be. The calculation for the value of $y(t)$ at the end of the highlighted segment can be seen by opening the step details section. The calculation is based on the tangent line formula using the slope $f$. If you check the “exact” box, the exact solution computed by the antiderivative is $f$ is shown in red (assuming $f(t)$ is simple enough for its antiderivative to be computed). The error estimate section shows the approximate and exact value of $y(t)$ at the position of the pink point along with the error between them. Clearing the “details” box hides the points indicating the endpoints, as well as the line segments and pink point in the left panel. This view reduces the clutter when $\Delta t$ is small and the number of segments is large. You can change the function $f(t)$, the initial condition $y_0$, and other parameters by typing values in the corresponding boxes in the control panel section. You can also change the initial condition $y_0$ by dragging the blue point in the right panel and the axes bound by holding down Shift and dragging. (Shift-dragging on an axis stretches that axes; shift-dragging on the background moves the entire graph.)

More information about applet.

When we open our eyes after time $\Delta t$, not only do we discover our new position $y(t_0+\Delta t)$, but we also look and discover that $f(t)$ has changed during the interval we had our eyes closed. We observe its new value of $f(t+\Delta t)$ and realize we need to change our slope $\diff{y}{t}$ to match the new information. Rather than following the tangent line \eqref{tangentline_t0} calculated at $t=t_0$, we instead will follow the tangent line based on our new position $y(t_0+\Delta)$ and our new slope $f(t_0 + \Delta t)$. This new tangent line is \begin{align} y(t) \approx y(t_0+\Delta t) + f(t_0 + \Delta t)(t-(t_0+\Delta t)).\label{tangentline_t1} \end{align} With this calculation, we close our eyes again and move along the tangent line for another time step of $\Delta t$. At the end of that interval, i.e., at time $t_0 + 2 \Delta t$, we arrive at the position \begin{align} y(t_0+2\Delta t) &\approx y(t_0+\Delta t) + f(t_0 + \Delta t)(t_0+2\Delta t-(t_0+\Delta t))\notag\\ &= y(t_0+\Delta t) + f(t_0 + \Delta t)\Delta t \label{step2} \end{align}

In terms of our example system \eqref{exampletsquared}, since $t_0=0$ and $\Delta t=1$, the new slope is $$f(t_0+ \Delta t)=f(1)= 1^2-10 = -9.$$ Since our position at the end of the first step was $y(1) \approx 40$, the new tangent line equation is \begin{align*} y(t) &\approx y(t_0+\Delta t) + f(t_0 + \Delta t)(t-(t_0+\Delta t))\\ &= y(1)+f(1)(t-1)\\ &=40 -9(t-1). \end{align*} Plugging in $t=t_0+2\Delta t = 0 + 2\cdot 1 = 2$, our new location is \begin{align*} y(2) &\approx 40 -9(2-1) = 31. \end{align*}

By closing our eyes during each of these two steps, we were taking steps according the Forward Euler algorithm. To write this algorithm more clearly, we combine step one \eqref{step1} with step two \eqref{step2} by substituting the estimate $y(t_0) + f(t_0) \Delta t$ for $y(t_0 + \Delta t)$ obtained in step one into the equation for step two. The result is \begin{align*} y(t_0+2\Delta t) &\approx y(t_0+\Delta t) + f(t_0 + \Delta t)\Delta t\\ &\approx y(t_0) + f(t_0) \Delta t + f(t_0 + \Delta t)\Delta t \end{align*} This equation shows that to go from $y(t_0)$ to $y(t_0+2\Delta t)$, we add $f(t_0) \Delta t$ from the first step plus $f(t_0 + \Delta t)\Delta t$.

We can continue this process. To go $t=t_0+3\Delta t$, we take another step, closing our eyes for an interval of width $\Delta t$. During this interval, we fix the slope at $\diff{y}{t}=f(t_0+2\Delta t)$, the value of the slope before closing our eyes. In this step we will add $f(t_0+2\Delta t)\Delta t$, and our estimate will be \begin{align*} y(t_0+3\Delta t) &\approx y(t_0) + f(t_0) \Delta t + f(t_0 + \Delta t)\Delta t + f(t_0+2\Delta t)\Delta t. \end{align*}

Do you see the pattern? In the Forward Euler algorithm, to go from $y(t_0+i\Delta t)$ to $y(t_0 + (i+1)\Delta t)$, we add $f(t_0+i\Delta t)\Delta t$. So far, we took steps for $i=0$, $i=1$, and $i=2$. You can follow this pattern and write out the Forward Euler formula to estimate $y(t_0+5\Delta t)$ by taking two more steps. The formula should be the same as the previous equation, only with two more terms added on the end. After writing the general formula, use it to compute $y(5)$ for the example system \eqref{exampletsquared} with $\Delta t=1$. You answer should agree with the above applet.

Summation notation

If we asked you to write out the formula for $y(t_0+20 \Delta t)$, you could do it, but it'd be a pain and you might get writer's cramp. You'd get a nice result that looked something like \begin{gather*} y(t_0+20\Delta t) \approx y(t_0) + f(t_0) \Delta t + f(t_0 + \Delta t)\Delta t + f(t_0+2\Delta t)\Delta t + f(t_0+3\Delta t)\Delta t + f(t_0+4\Delta t)\Delta t + f(t_0+5\Delta t)\Delta t + f(t_0+6\Delta t)\Delta t + f(t_0+7\Delta t)\Delta t + f(t_0+8\Delta t)\Delta t + f(t_0+9\Delta t)\Delta t + f(t_0+10\Delta t)\Delta t + f(t_0+11\Delta t)\Delta t + f(t_0+12\Delta t)\Delta t + f(t_0+13\Delta t)\Delta t + f(t_0+14\Delta t)\Delta t + f(t_0+15\Delta t)\Delta t + f(t_0+16\Delta t)\Delta t + f(t_0+17\Delta t)\Delta t + f(t_0+18\Delta t)\Delta t + f(t_0+19\Delta t)\Delta t. \end{gather*}

To make writing such sums easier, we can use summation notation. In summation notation, a capital Greek sigma, $\Sigma$, is used to stand for “sum.” An example of such a sum is $$\sum_{i=1}^3 i^2 = 1^2+2^2+3^3$$ The $i=1$ below the $\Sigma$ means that $i$ is the variable that we are going to sum over, and its first value is 1. The 3 above the $\Sigma$ means the last value of $i$ is 3. The $i^2$ means for each value of $i=1,2,3$, we will add the term $i^2$. Putting this together, we see that the sum represented above is $1^2+2^2+3^2$.

Here are other such sums. \begin{align*} \sum_{j=1}^5 \frac{1}{j} &= 1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5}\\ \sum_{k=0}^3 g(k) &= g(0) + g(1)+g(2) +g(3)\\ \sum_{\bigstar=5}^7 z^{\bigstar} &= z^5 + z^6 + z^7 \end{align*} In the last sum, the variable $z$ was not given as a variable to sum over, so we just leave it alone as a $z$.

As a quick practice, write out the sums \begin{gather*} \sum_{i=1}^5 i\\ \sum_{j=2}^4 e^j\\ \sum_{\clubsuit = 0}^2 h(\clubsuit y). \end{gather*} Can you rewrite the $\ln(x) + \ln(2x) + \ln(3x)$ in summation notation?

Forward Euler in summation notation

The Forward Euler algorithm can be written nicely using summation notation. If we take three steps of size $\Delta t$ starting at $t_0$, we showed the results was \begin{align*} y(t_0+3\Delta t) &\approx y(t_0) + f(t_0) \Delta t + f(t_0 + \Delta t)\Delta t + f(t_0+2\Delta t)\Delta t. \end{align*} The only thing that changes in these terms is the coefficient in front of the $\Delta t$ inside $f$. If we use $i$ to represent the coefficient, then each term is of the form $f(t_0 + i \Delta t)\Delta t$. To estimate a solution for Forward Euler, you just start with $y(t_0)$ and sum up the steps you make with closed eyes, which we can write with summation notation: \begin{align*} y(t_0+3\Delta t) &\approx y(t_0) + \sum_{i=0}^2 f(t_0 + i\Delta t)\Delta t. \end{align*} Now it's easy to write the formula for a fourth step. \begin{align*} y(t_0+4\Delta t) &\approx y(t_0) + \sum_{i=0}^3 f(t_0 + i\Delta t)\Delta t, \end{align*} or even to go all way to an arbitrary number $n$ steps \begin{align} y(t_0+n\Delta t) &\approx y(t_0) + \sum_{i=0}^{n-1}f(t_0 + i\Delta t)\Delta t. \label{fe_sum}\tag{8} \end{align} We just have to remember that the last value of the index $i$ is $n-1$, not $n$, as we don't need to evaluate the slope $f(t_0+n\Delta t)$ if we aren't going past $t=t_0+n\Delta t$.

For the example system \eqref{exampletsquared} with $\Delta t=1$, write out the formula for using Forward Euler to estimate $y(10)$ using summation notation. What should the top value of the summation index $i$ be? What is your estimate of $y(10)$? (The applet can help here, as it'd be a bit laborious to do by hand.) If you change $\Delta t$ to 0.5, how does the formula change? What's your new estimate of $y(10)$?

Error analysis

For a simple function $f(t)$ such as $f(t)=t^2-10$, it's easy to compute an antiderivative $F(t)$. For this $f(t)$, what is one possibility for $F(t)$? Using this value and the analytic solution \eqref{antidervative_solution}, calculate the exact solution $y(t)$ to the example system \eqref{exampletsquared} and the exact value of $y(10)$. Your answer should agree with the exact solution calculated by the applet.

With the exact solution in hand, it's a simple matter to calculate the error in the Forward Euler estimates. Just subtract off the exact solution from the estimated solution and take the absolute value. What errors did your Forward Euler estimates have for $y(10)$ with $\Delta t=1$ and $\Delta t=0.5$?

When you cut the time step in half, going from $\Delta t=1$ to $\Delta t=0.5$, by approximately what factor did the error in $y(10)$ shrink? (We are looking for a round answer here, not the exact ratio in the measured errors.) Use this observation to predict the error if you cut $\Delta t$ in half once again to $\Delta t = 0.25$. Is your prediction born out? How small must you make $\Delta t$ to get the error less than 1?

Does it seem reasonable that as $\Delta t$ shrinks to zero, the error in the estimate of $y(t)$ will shrink to zero?

Looking ahead

A friend tells you that it's pretty stupid to close your eyes and fix the slope at $f(t_0 + i \Delta t)$ when going from $t=i\Delta t$ to $t=(i+1)\Delta t$. If you do this, you've fixed the slope to be the value at the beginning of the interval. Why not, before you close you eyes, look ahead and see what the slope is at the end of the interval? So, starting out, you'd use the slope $f(t_0 + \Delta t)$ (rather than the slope $f(t_0)$) to take the first step to $f(t_0 + \Delta t)$. The resulting algorithm is called the Backward Euler algorithm or the Implicit Euler Algorithm. We can write the formula as \begin{align*} y(t_0+n\Delta t) &\approx y(t_0) + \sum_{i=0}^{n-1}f(t_0 + (i+1)\Delta t)\Delta t. \end{align*} where the only difference is that the slope is the ending slope $f(t_0 + (i+1) \Delta t)$ rather than the beginning slope $f(t_0 + i \Delta t)$.

The following applet implements the Backward Euler algorithm. You can see that it fixes the value of $f(t)$ over an interval using the value of $f$ from the right side of the interval. Does this do any better than the Forward Euler algorithm? How does the error compare? We are particularly interested in what happens if you cut the step size $\Delta t$ in half. What happens to the error in the estimate of $y(10)$ if you cut $\Delta t$ from 1 to 0.5? By what factor does the error go down? How about if you cut $\Delta t$ in half again? If you make $\Delta t=0.1$, how does the error compare to Forward Euler?

Details of the Backward Euler approximation to a pure time differential equation. Illustration of how the Backward Euler algorithm estimates the solution to a pure time differential equation $\diff{y}{t}=f(t)$ with initial condition $y(t_0)=y_0$. The function $f(t)$ is plotted by the blue curve in the left panel. In the Backward Euler algorithm, the function $f(t)$ is approximated as though it were constant on intervals of length $\Delta t$, as illustrated by the horizontal length segments coming from the graph of $f$. The height of each line segment is determined by the value of $f(t)$ at its right (green dots). When we assume $f(t)$ is a constant, the solution to $\diff{y}{t}=f(t)$ is a line whose slope is the value of $f$. The approximate solution is illustrated by the green curve in the right panel. Each segment of the green curve has a slope given by the height of the corresponding line segment in the left panel. To see this correspondence, you can move the pink points in either panel. The matching segments of the approximated $f(t)$ (at left) and estimate of $y(t)$ (at right) are highlighted in pink. Gray lines emphasize how we are are viewing $y(t)$ as a line with slope given by the constant value of $f(t)$. The calculation for the value of $y(t)$ at the end of the highlighted segment is shown in the upper right corner, which is based on the equation for a line with slope $f$. The estimate of the value of $y$ at the pink point is also shown. If you check the “exact” box, the exact solution computed by the antiderivative is $f$ is shown in red (assuming $f(t)$ is simple enough for its antiderivative to be computed). In addition, the exact value of $y(t)$ at the position of the pink point is displayed along with the error between the approximate and exact values. Clearing the “details” box hides the points indicating the endpoints, as well as the line segments and pink point in the left panel. This view reduces the clutter when $\Delta t$ is small and the number of segments is large. You can change the function $f(t)$ and other parameters by typing values in the corresponding boxes. You can also change the initial condition $y_0$ by dragging the blue point in the right panel.

More information about applet.

Another friend says you are both stupid. You shouldn't close your eyes and fix the slope to either the slope at the beginning or the slope at the end. Instead, you should fix the slope to a value at the middle of the interval. When taking a step from $t=t_0+i\Delta t$ to $t=t_0+(i+1)\Delta t$, take the slope at some intermediate time $t= t_0 + (i+p)\Delta t$, where $p$ is a number between 0 and 1. If $p=0$, you get Forward Euler, and if $p=1$, you get Backward Euler. Maybe some intermediate value works better.

The following modified scheme \begin{align*} y(t_0+n\Delta t) &\approx y(t_0) + \sum_{i=0}^{n-1}f(t_0 + (i+p)\Delta t)\Delta t. \end{align*} is implemented in the following applet. Verify that you get the same results as above when you set $p=0$ and $p=1$.

Can you find a value of $p$ that is better than $p=0$ or $p=1$? What would be really great would be to find a value of $p$ that reduces the error by a lot more when you cut the step size $\Delta t$ in half. Find a value of $p$ that reduces the error in $y(10)$ by the largest value when you cut $\Delta t$ from 1 to 0.5. Is the error further reduced by the same factor when you cut $\Delta t$ in half again? For the best value of $p$, if you make $\Delta t=0.1$, how does the error compare to Forward Euler and Backward Euler?

Modifying the Euler approximation to a pure time differential equation. Illustration of modifications of Euler algorithm to estimate the solution to a pure time differential equation $\diff{y}{t}=f(t)$ with initial condition $y(t_0)=y_0$. The function $f(t)$ is plotted by the blue curve in the left panel. Like the forward and backward Euler algorithms, the function $f(t)$ is approximated as though it were constant on intervals of length $\Delta t$, as illustrated by the horizontal length segments coming from the graph of $f$. In this modification, the height of each line segment is determined by the value of $f(t)$ at a fraction $p$ from the left of the interval (green dots). In this way, $p=0$ corresponds to Forward Euler and $p=1$ corresponds to Backward Euler. When we assume $f(t)$ is a constant, the solution to $\diff{y}{t}=f(t)$ is a line whose slope is the value of $f$. The approximate solution is illustrated by the green curve in the right panel. Each segment of the green curve has a slope given by the height of the corresponding line segment in the left panel. To see this correspondence, you can move the pink points in either panel. The matching segments of the approximated $f(t)$ (at left) and estimate of $y(t)$ (at right) are highlighted in pink. Gray lines emphasize how we are are viewing $y(t)$ as a line with slope given by the constant value of $f(t)$. The calculation for the value of $y(t)$ at the end of the highlighted segment is shown in the upper right corner, which is based on the equation for a line with slope $f$. The estimate of the value of $y$ at the pink point is also shown. If you check the “exact” box, the exact solution computed by the antiderivative is $f$ is shown in red (assuming $f(t)$ is simple enough for its antiderivative to be computed). In addition, the exact value of $y(t)$ at the position of the pink point is displayed along with the error between the approximate and exact values. Clearing the “details” box hides the points indicating the endpoints, as well as the line segments and pink point in the left panel. This view reduces the clutter when $\Delta t$ is small and the number of segments is large. You can change the function $f(t)$ and other parameters by typing values in the corresponding boxes. You can also change the initial condition $y_0$ by dragging the blue point in the right panel.

More information about applet.

Summary of questions

To aid you in writing up a report on your results, we summarize the main questions posed above that you should be able to answer and added a few more questions.

  1. The basis of Forward Euler: keeping the rate of change constant

    1. Why does closing our eyes and pretending that $f(t)$ does not change equivalent to following the tangent line for $y(t)?
    2. Follow the pattern outlined above and write out the general Forward Euler formula to estimate $y(t_0+5\Delta t)$.
    3. Using this formula, compute $y(5)$ for the example system \eqref{exampletsquared} with $\Delta t=1$. Does your answer agree with the above applet?
  2. Summation notation

    1. Write out the sums $\displaystyle \sum_{i=1}^5 i$, $\displaystyle\sum_{j=2}^4 e^j$, and $\displaystyle\sum_{\clubsuit = 0}^2 h(\clubsuit y)$.
    2. Rewrite the $\ln(x) + \ln(2x) + \ln(3x)$ in summation notation
  3. Forward Euler in summation notation

    1. For the example system \eqref{exampletsquared} with $\Delta t=1$, write out the formula for using Forward Euler to estimate $y(10)$ using summation notation. What should the top value of the summation index $i$ be?
    2. What is your estimate of $y(10)$? (The applet can help here.)
    3. If you change $\Delta t$ to 0.5, how does the formula change? What's your new estimate of $y(10)$?
  4. Error analysis

    1. For $f(t)=t^2-10$, what is one possibility for $F(t)$?
    2. Using this value and the analytic solution \eqref{antiderivative_solution}, calculate the exact solution $y(t)$ to the example system \eqref{exampletsquared} and the exact value of $y(10)$. Your answer should agree with the exact solution calculated by the applet.
    3. What errors did your Forward Euler estimates have for $y(10)$ with $\Delta t=1$ and $\Delta t=0.5$?
    4. When you cut the time step in half, going from $\Delta t=1$ to $\Delta t=0.5$, by approximately what factor did the error in $y(10)$ shrink? (We are looking for a round answer here, not the exact ratio in the measured errors.)
    5. Use this observation to predict the error if you cut $\Delta t$ in half once again to $\Delta t = 0.25$. Is your prediction born out? How small must you make $\Delta t$ to get the error less than 1?
    6. Based on these observations, does it seem reasonable that as $\Delta t$ shrinks to zero, the error in the estimate of $y(t)$ will shrink to zero? Why or why not?
  5. Looking ahead

    1. Does the Backward Euler algorithm do any better than the Forward Euler algorithm? How does the error compare? Is it much better or much worse, or does it give approximately the same amount of error? (If their performances are with 10%-20% of each other, categorize as approximately the same.)
    2. What happens to the error in the estimate of $y(10)$ if you cut $\Delta t$ from 1 to 0.5 using Backward Euler? By what factor does the error go down? How about if you cut $\Delta t$ in half again?
    3. If you make $\Delta t=0.1$, how does the error in Backward Euler compare to Forward Euler?
    4. For the method where you can use the slope in the middle of the interval, were you able to reproduce Forward Euler and Backward Euler with $p=0$ and $p=1$?
    5. Can you find a value of $p$ that is better than $p=0$ or $p=1$?
    6. For what value of $p$ does the error in $y(10)$ get reduced by the largest value when you cut $\Delta t$ from 1 to 0.5. Is the error further reduced by the same factor when you cut $\Delta t$ in half again?
    7. For the best value of $p$, if you make $\Delta t=0.1$, how does the error compare to Forward Euler and Backward Euler? Is it much better or much worse, or does it give approximately the same amount of error? (If their performances are with 10%-20% of each other, categorize as approximately the same.)