# Math Insight

### Applet: Forward Euler approximation to a pure time differential equation

An approximate solution to the differential equation $\diff{x}{t}=f(t)$ with initial condition $x(t_0)=x_0$ is calculated with the Forward Euler algorithm up to time $t=t_f$. With time step $\Delta t$, the solution $x(t)$ is computed by iterating $x(t+\Delta t) = x(t)+\Delta t \, f(t)$ and is plotted by the green line segments. Specify $f(t)$ by entering a function in the box. Enter values for $\Delta t$, $t_0$ and $t_f$ by entering values in their corresponding boxes. Since the number of iterations $n_{\text{iter}}=(t_f-t_0)/\Delta t$ is limited in this applet to be less than 10,000, $\Delta t$ is increased if the current values would lead to too many iterations. You can specify the initial condition $x(t_0)$ by moving the blue point or entering a value in the box. Clearing the “details” checkbox removes the points showing individual time steps, making the plot more readable for small $\Delta t$. Checking the “exact” box will plot the exact solution by a thick red curve in cases where $x(t)$ can be found by integrating $f(t)$. You can zoom the vertical axis with the + and - buttons and pan up and down with the buttons labeled by arrows.