Why the Slope Must Be Recalculated
A differential equation can prescribe a slope that changes as the solution changes. In a nonlinear scalar equation, the rate of change may depend on a nonlinear expression in the dependent variable, such as its square or a product involving the dependent variable.
Forward Euler’s method advances an approximate solution one step at a time. At each step, it uses the slope specified by the differential equation at the current estimated point. The new estimate may therefore produce a different slope for the following step. This repeated recalculation is essential: the method does not keep using the initial slope throughout the calculation.
Nonlinear Scalar Initial-Value Problems
A scalar initial-value problem specifies a differential equation for one unknown function \(y(t)\), together with its value at an initial time. We write it as
Here \(t\) is the independent variable, \(y\) is the dependent variable, and \(f(t,y)\) gives the slope at the point with coordinates \((t,y)\). In this tutorial, a problem is called nonlinear in \(y\) when its slope function cannot be written in the linear form \(a(t)y+b(t)\) on the domain under consideration. For example, \(f(t,y)=1-y^2\) is nonlinear in \(y\).
Choose a positive step size \(h\). On a uniform grid, the time values and the forward Euler estimates are defined recursively by
The estimate \(y_n\) approximates the solution value at time \(t_n\). The next time is \(t_{n+1}=t_n+h\). To find \(y_{n+1}\), first evaluate \(f(t_n,y_n)\), then multiply that slope by the step size, and finally add the result to \(y_n\). The recurrence requires \(f\) to be defined at every point \((t_n,y_n)\) reached during the calculation.
Why This Update Uses the Current Slope
At the current estimated point \((t_n,y_n)\), the prescribed slope is \(f(t_n,y_n)\). The line through that point with this slope has equation
Evaluating this line at the next time \(t_{n+1}=t_n+h\) gives
Forward Euler takes this value as the next estimate \(y_{n+1}\). The new point is \((t_{n+1},y_{n+1})\), so the differential equation prescribes the next slope as \(f(t_{n+1},y_{n+1})\). Unless that slope happens to equal the previous one, it must be recalculated. This is the reason the update uses \(f(t_n,y_n)\) at step \(n\), rather than reusing a slope from an earlier step.
A Practical Calculation Sequence
Write down \(t_n\) and \(y_n\), including the initial values for the first step.
Substitute both current values into \(f(t_n,y_n)\).
Multiply the slope by \(h\), giving \(h f(t_n,y_n)\).
Set \(t_{n+1}=t_n+h\) and \(y_{n+1}=y_n+h f(t_n,y_n)\).
Evaluate the slope function at the new pair \((t_{n+1},y_{n+1})\).
Worked Examples
Worked Example: A Slope That Decreases as the Estimate Rises
Use forward Euler with \(h=0.25\) for the initial-value problem
The grid begins at \(t_0=0\), and the recurrence is \(y_{n+1}=y_n+0.25(1-y_n^2)\). At the first point,
Now use the updated estimate \(y_1=0.25\) to find the next slope:
For a third step, the slope is evaluated at \(y_2=0.484375\). Since \(0.484375=31/64\), its square is \(961/4096=0.234619140625\). Therefore
Check each update: \(y_1-y_0=0.25=0.25(1)\); \(y_2-y_1=0.234375=0.25(0.9375)\); and \(y_3-y_2=0.19134521484375=0.25(0.765380859375)\). The estimated value rises at each step, while the recalculated slope decreases.
Worked Example: A Slope Depending on Both Time and the Estimate
Apply two forward Euler steps with \(h=0.1\) to
The slope depends explicitly on \(t\) as well as nonlinearly on \(y\). At the initial point,
At the next step, substitute the new time and new estimate, not the initial values:
Check the increments: \(y_1-y_0=1.1-1=0.1=0.1f(0,1)\), and \(y_2-y_1=1.231-1.1=0.131=0.1f(0.1,1.1)\). Both the change in time and the change in the estimated solution affect the second slope.
Worked Example: A Nonlinear Growth Model
Use two Euler steps of size \(h=0.5\) for the logistic-type equation
The initial slope is
Thus the first updated values are
Recalculate the slope using \(y_1=2.8\):
Therefore the second update is
Check the two solution increments: \(2.8-2=0.8=0.5(1.6)\), and \(3.808-2.8=1.008=0.5(2.016)\). The second increment is larger because the slope at the updated estimate is larger than the initial slope.
Common Mistake: Reusing the Initial Slope
A tempting shortcut is to calculate the slope once and use it for every step. The problem \(y'=t+y^2\), \(y(0)=1\), with \(h=0.1\) shows why this is wrong. The initial slope is \(f(0,1)=1\). If that slope is incorrectly reused, the second estimate would be
But the equation prescribes the slope at the second point \((0.1,1.1)\) as
The incorrect value \(1.2\) has an increment of \(1.2-1.1=0.1\), but the required Euler increment is \(0.1f(0.1,1.1)=0.131\). The correction is to evaluate \(f\) at the current time and estimate at every step.
Reading the Changes in a Nonlinear Euler Table
When completing a table, each row supplies the information needed for the next row. A useful layout keeps the time, estimate, slope, and increment distinct:
| Current time | Current estimate | Current slope | Increment | Next estimate |
|---|---|---|---|---|
| \(t_n\) | \(y_n\) | \(f(t_n,y_n)\) | \(h f(t_n,y_n)\) | \(y_n+h f(t_n,y_n)\) |
For a nonlinear slope function, changes in \(y_n\) can change the value of \(f\), even if the time dependence is absent. If the function also depends explicitly on time, both inputs may change from one row to the next. A growing estimate does not by itself imply a growing slope, and a decreasing slope does not mean that the estimate must decrease: the sign and size of each increment are determined by \(h f(t_n,y_n)\).
Forward Euler provides a sequence of estimates, not a guarantee that the values will follow the exact solution closely for every choice of step size. This tutorial concerns carrying out the recurrence correctly. The key discipline is to distinguish the slope at the current point from the slope at the next point, and to recalculate whenever the point changes.
Check Your Understanding
Use the current time and estimate when evaluating each slope.
- For \(y'=2-y^2\), \(y(0)=1\), and \(h=0.2\), calculate \(y_1\), then calculate the slope at \((t_1,y_1)\).
- For \(y'=t+y^2\), \(y(0)=0\), and \(h=0.5\), find the first Euler estimate and the slope to use for the second step.
- State the forward Euler recurrence for \(y'=f(t,y)\) on a uniform grid with step size \(h\).
- Why is it generally incorrect to reuse the initial slope at every step of a nonlinear scalar equation?
- In an Euler step, what determines whether the next estimate is larger or smaller than the current estimate?