Why Compare an Euler Polygon with an Exact Curve?
Euler’s method produces approximate values at selected times. Joining those values by straight line segments gives an Euler polygon, a continuous piecewise-linear approximation to the solution of an initial-value problem. When an exact solution is known, placing the polygon beside its solution curve lets us inspect how well the approximation represents the solution across an interval.
A fair comparison uses the same time for both values. At a grid point, compare the Euler value with the exact solution there. Between grid points, compare the point on the relevant line segment with the exact solution at that interior time. The sign of the difference says which graph is higher; its absolute value gives the size of the vertical discrepancy.
Definitions for a Point-by-Point Comparison
Consider an initial-value problem \(y'=f(t,y)\), \(y(t_0)=y_0\), and a grid \(t_0<t_1<\cdots<t_N\). Write \(h_n=t_{n+1}-t_n\) for the length of the \(n\)-th step. Forward Euler computes approximations \(y_n\) by
Suppose the exact solution \(y(t)\) is known on the interval being considered. The Euler polygon \(P(t)\) is the continuous function that has value \(y_n\) at \(t_n\) and is linear from \(y_n\) to \(y_{n+1}\) on each grid interval.
The distinction between signed and absolute discrepancy matters. For instance, \(E(t)=-0.2\) means the polygon is \(0.2\) units below the curve, while \(|E(t)|=0.2\) reports only the vertical distance. If the solution has physical units, these discrepancies have the same units as \(y\).
What the Polygon Does Between Grid Points
On the interval from \(t_n\) to \(t_{n+1}\), the polygon is the line joining \((t_n,y_n)\) and \((t_{n+1},y_{n+1})\). Its value is therefore
Here \(h_n>0\), and the formula works for a uniform or nonuniform grid. Substituting the Euler update gives an equivalent expression that makes the segment’s slope explicit:
This identity explains why the polygon segment has the slope used at the start of that Euler step. It also shows exactly how to find a polygon value at an interior time: use the starting approximation and the step’s slope, not a new Euler update at the interior time.
Worked Examples
Worked Example: Growth with \(y'=y\)
Compare forward Euler with the exact solution of \(y'=y,\ y(0)=1\), using step size \(h=0.5\) on \([0,1]\). The exact solution is \(y(t)=e^t\), since its derivative is \(e^t\) and \(y(0)=e^0=1\).
At \(t_0=0\), the Euler value is \(y_0=1\). The slope for the first step is \(f(0,1)=1\), so
At \(t_1=0.5\), the slope is \(f(0.5,1.5)=1.5\). Thus
Now compare at the matching grid times. At \(t=0.5\), the exact value is \(e^{0.5}\approx1.648721\), so
At \(t=1\), the exact value is \(e\approx2.718282\), giving
At the interior time \(t=0.75\), the polygon is halfway along its second segment:
The exact value is \(e^{0.75}\approx2.117000\), so \(E(0.75)\approx1.875-2.117000=-0.242000\). In all three comparisons the polygon is below the exact curve. The values are checked against the Euler update and the exact solution at precisely the same times.
Worked Example: Decay and a Decreasing Nodal Discrepancy
Use forward Euler with \(h=1\) for \(y'=-y,\ y(0)=1\), on \([0,2]\). The exact solution is \(y(t)=e^{-t}\), because its derivative is \(-e^{-t}\) and its initial value is \(1\).
At \(t_0=0\), the slope is \(-1\), so \(y_1=1+1(-1)=0\). At \(t_1=1\), the slope is \(-y_1=0\), so \(y_2=0+1(0)=0\). The Euler values are therefore \(1,0,0\) at times \(0,1,2\).
At \(t=1\), the signed nodal discrepancy is
At \(t=2\), it is
The polygon is below the exact curve at both nodes, but the absolute nodal discrepancy decreases from about \(0.367879\) to \(0.135335\). Thus, even across one fixed interval, nodal discrepancy need not grow at every step.
For an interior check, on \([0,1]\) the polygon is \(P(t)=1-t\). At \(t=0.5\), \(P(0.5)=1-0.5=0.5\), whereas \(y(0.5)=e^{-0.5}\approx0.606531\). Hence \(E(0.5)\approx-0.106531\). On \([1,2]\) the polygon is \(P(t)=0\); at \(t=1.5\), its discrepancy is \(0-e^{-1.5}\approx-0.223130\). The interior comparison is made from the appropriate segment in each case.
Worked Example: Comparing at an Interior Time
Consider \(y'=t,\ y(0)=0\), with step size \(h=1\) on \([0,2]\). Integrating the slope gives the exact solution \(y(t)=t^2/2\), which satisfies \(y'(t)=t\) and \(y(0)=0\).
Starting with \(y_0=0\), the first Euler slope is \(f(0,0)=0\), so \(y_1=0+1(0)=0\). The next slope is \(f(1,0)=1\), so \(y_2=0+1(1)=1\). The Euler polygon is constant at \(0\) on \([0,1]\), then joins \((1,0)\) to \((2,1)\) on the second interval.
At \(t=1\), the Euler value is \(0\) and the exact value is \(1^2/2=0.5\), so \(e_1=-0.5\). At \(t=2\), the Euler value is \(1\) and the exact value is \(2^2/2=2\), so \(e_2=-1\).
At \(t=1.5\), use the segment beginning at \((1,0)\), whose slope is \(1\):
The exact value there is \(y(1.5)=(1.5)^2/2=2.25/2=1.125\). Thus \(E(1.5)=0.5-1.125=-0.625\). The polygon lies below the exact curve at this interior time as well. Substituting into the segment formula and the exact solution verifies both values.
A Common Mistake: Comparing Different Times
A discrepancy is meaningful only when the two compared values belong to the same time. For example, in the growth example, one might incorrectly compare the Euler value \(y_1=1.5\) at \(t=0.5\) with the exact value \(e^1\approx2.718282\) at \(t=1\). That gives \(1.5-2.718282\approx-1.218282\), but it is not an error at either time: it subtracts values from different times.
The correction is to evaluate the exact solution at \(t=0.5\): \(e^{0.5}\approx1.648721\). The matching-time discrepancy is \(1.5-1.648721\approx-0.148721\). A related mistake is to call a negative signed discrepancy a negative distance. Distance is nonnegative; the sign instead records which graph is higher.
What the Comparison Can—and Cannot—Show
Plotting both graphs and calculating discrepancies at selected times helps describe the approximation on a fixed interval. The signed values indicate whether the polygon is above or below the curve at those times; absolute values allow comparisons of vertical separation. Interior evaluations are useful because matching grid-point values alone do not describe every point along the straight segments.
These comparisons describe what happens for the chosen equation, initial value, grid, and interval. They do not by themselves prove that the polygon stays on one side of the curve between sampled times, nor that the discrepancy changes monotonically throughout the interval. A visual impression is useful, but it is not a general error bound. The later analysis of Euler error addresses questions of local and accumulated error more systematically.
Check Your Understanding
Use the definitions and segment formula to answer the following questions.
- If \(P(t)-y(t)=0.3\) at a particular time, which graph is higher, and what is the absolute discrepancy?
- On a nonuniform grid interval \([t_n,t_{n+1}]\), what formula gives the Euler polygon value at an interior time \(t\)?
- Why must an Euler value and an exact value be evaluated at the same time before their difference is called a discrepancy?
- Can the absolute nodal discrepancy decrease from one grid point to the next? Explain using the decay example.
- In the growth example, what is the Euler polygon’s value at \(t=0.75\), and how does it compare with the exact value there?