Math Insight

Applet: Details of the Forward Euler approximation to a pure time differential equation

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

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.)

Applet file: forward_euler_pure_time_details.ggb

Applet links

This applet is found in the pages

List of all applets

General information about Geogebra Web applets

This applet was created using Geogebra. In most Geogebra applets, you can move objects by dragging them with the mouse. In some, you can enter values with the keyboard. To reset the applet to its original view, click the icon in the upper right hand corner.

You can download the applet onto your own computer so you can use it outside this web page or even modify it to improve it. You simply need to download the above applet file and download the Geogebra program onto your own computer.