# Math Insight

### Applet: The Euler algorithm or approximating area with a Riemann sum

Demonstration of the link between the Euler approximation to a pure-time differential equation and calculating the area under a curve. When the “area” box is checked, the area underneath the graph of $f(t)$ (blue curve in left panel) over the interval $[a,b]$ is calculated via a Riemann sum. The Riemann sum of $n$ subintervals is illustrated by the rectangles superimposed with the graph of $f$. As you move the pink points, the region of the rectangles to the left is highlighted, and this area $\hat{A}(t)$ is plotted as a function of $t$ by the green curve in the right panel.

When “area” box is unchecked, the solution to the pure-time differential equation $\diff{A}{t}=f(t)$ via the Euler algorithm is illustrated. Only the tops of the rectangles remain, which form an approximation to $f$ that is constant along each subinterval. The green curve in the right panel remains, but its interpretation is an approximation solution to the differential equation where the slope is held constant on each subinterval. This slope is illustrated by the gray lines: constant at the slope in the left panel and a tangent line in the right panel. Unlike for the area calculation, an initial condition $A(a)$ can be changed by dragging the blue point in the right panel or typing a value in the box.

In either mode, calculations for $\hat{A}(t)$ for the current subinterval are shown, as well as the exact solution and corresponding error when the “exact” box is checked. The exact solution is also shown by the red curve, and, for the area case, by red shading of the area underneath $f(t)$.

Applet file: euler_area_riemann_sum.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.