Why Audit an Euler Calculation?
An Euler table can contain plausible-looking numbers and still be wrong. A time step may have been used in minutes when the rate is given per hour; a negative slope may have been added as a positive change; or the first table entry may not be at the point specified by the initial condition.
Unit, sign, and initial-value checks are quick ways to detect these problems. They do not prove that an approximation is accurate, but they can show that a calculation is internally inconsistent before it is used for further conclusions.
The Checks to Make
For an initial-value problem \(y'=f(t,y)\), the forward Euler update from a point \((t_n,y_n)\) with step size \(h\) is
Here the slope is evaluated at the current point \((t_n,y_n)\). If \(t\) has units \(U_t\) and \(y\) has units \(U_y\), then the slope \(f(t_n,y_n)\) must have units \(U_y/U_t\). The step size \(h\) has units \(U_t\), so their product has units \(U_y\), as a change in \(y\) must.
The sign check asks whether the update moves in the direction indicated by the slope. For a positive step \(h\), a positive slope gives a positive change \(h f(t_n,y_n)\), and a negative slope gives a negative change. If \(h\) is negative, as in backward integration, the change has the opposite sign to the slope. In all cases, the sign of the change is the sign of the product \(h f(t_n,y_n)\).
Finally, the initial condition must match the first row in both coordinates. If the problem states \(y(t_0)=y_0\), the table must begin with \(t_0\) and \(y_0\) paired together. The value \(y_0\) cannot be assigned to a different time merely because it is the first entry in a table.
Why the Unit and Sign Checks Work
The Euler formula estimates the change in \(y\) over one step by using the slope at the start of that step. The slope is a rate of change: it describes change in \(y\) per unit change in \(t\). Multiplying by a step in \(t\) therefore produces an estimated change in \(y\).
The sign follows from the same update. The estimated change is \(\Delta y=h f(t_n,y_n)\). A positive \(\Delta y\) means the next Euler value is above the current value; a negative \(\Delta y\) means it is below. This is a check on the calculation, not a guarantee that the Euler value closely matches the exact solution.
Worked Examples
Worked Example: Checking a Cooling Step
A temperature \(T\), measured in degrees Celsius, satisfies \(T'=-k(T-20)\), where \(k=0.02\ \text{min}^{-1}\). At time \(t_0=0\ \text{min}\), the stated initial temperature is \(T_0=80^\circ\text{C}\). Use one forward Euler step of \(h=5\ \text{min}\).
First check the initial value: the starting row is \((t_0,T_0)=(0\ \text{min},80^\circ\text{C})\), which agrees with the stated condition. The temperature difference in the rate equation is
The slope at the starting point is
The units are temperature per time, as required. The Euler change is
The negative sign predicts a decrease. Therefore,
Check the update by recovering its change: \(T_1-T_0=74^\circ\text{C}-80^\circ\text{C}=-6^\circ\text{C}\). Dividing by the step gives \((-6^\circ\text{C})/(5\ \text{min})=-1.2^\circ\text{C}/\text{min}\), the starting slope used in the Euler step. The units, sign, and initial row are consistent.
Worked Example: Converting a Time Step Before Using It
An amount \(A\), measured in milligrams, has rate \(A'=12-0.5A\), with the constants interpreted so that \(12\) has units \(\text{mg}/\text{hour}\) and \(0.5\) has units \(\text{hour}^{-1}\). The initial condition is \(A(0\ \text{hour})=8\ \text{mg}\). Take one forward Euler step of 30 minutes.
The rate is given per hour, so first convert the step:
At the initial value, the rate is
The rate is positive, so over this positive step the Euler change should be positive. Its value is
Thus the next time and amount are
Check: the change is \(12\ \text{mg}-8\ \text{mg}=4\ \text{mg}\), and \(4\ \text{mg}/0.5\ \text{hour}=8\ \text{mg}/\text{hour}\), matching the starting rate. The initial row also agrees with \(A(0)=8\ \text{mg}\).
If 30 were inserted directly as though it were a step measured in hours, the computed change would be \(30\ \text{hour}\times 8\ \text{mg}/\text{hour}=240\ \text{mg}\), giving \(248\ \text{mg}\). The arithmetic follows that incorrect input, but the input represents 30 hours, not 30 minutes. Keeping the units attached to the step exposes the mistake.
Worked Example: Checking a Concentration Step and Its Starting Row
A concentration \(C\), measured in \(\text{mmol}/\text{L}\), satisfies
The given initial condition is \(C(3\ \text{min})=1.2\ \text{mmol}/\text{L}\). Use a forward Euler step of \(h=0.5\ \text{min}\) starting from that condition.
The first table entry must be \(t_0=3\ \text{min}\), \(C_0=1.2\ \text{mmol}/\text{L}\). The slope there is
The units reduce to concentration per minute, and the negative sign predicts a decrease for a positive time step. The change is
The Euler update gives
To check the calculation, \(C_1-C_0=1.128-1.2=-0.072\ \text{mmol}/\text{L}\); dividing by \(0.5\ \text{min}\) recovers \(-0.144\ \text{mmol}/(\text{L}\cdot\text{min})\). If a table instead labels \(1.2\ \text{mmol}/\text{L}\) as the value at \(t=0\), it violates the stated initial condition even if the later arithmetic is performed consistently.
A Practical Audit Sequence
When checking a numerical IVP table, work through the following in order. These checks are especially useful when values have been copied into a spreadsheet or transferred between calculations.
Confirm that the first time and state values are exactly the stated pair \(t_0\) and \(y_0\).
Confirm that \(f(t_n,y_n)\) is expressed in units of \(y\) per unit of \(t\).
Convert \(h\) if necessary before multiplying it by the rate.
Use the signs of \(h\) and \(f(t_n,y_n)\) to determine whether the next state should increase or decrease.
Calculate \(h f(t_n,y_n)\), check its units, and confirm that adding it gives the displayed next value.
Common Pitfalls and Limits of These Checks
A common sign error is to calculate a negative increment and then add its absolute value. For example, if \(y_n=10\) and the Euler increment is \(-2\), the incorrect calculation \(10+|-2|=12\) moves upward. The update requires the signed increment: \(10+(-2)=8\). Checking the sign before addition reveals that the predicted change must be downward.
A different error is to treat a correct sign as proof that a step is reasonable. A negative concentration or temperature prediction may be physically implausible, but units and sign alone do not establish whether a step is small enough to avoid it. Conversely, an unusual result is a reason to recheck the setup and the step, not by itself proof of an arithmetic error.
The checks also depend on using the slope at the correct Euler point. For a forward Euler step from \((t_n,y_n)\), use \(f(t_n,y_n)\), not the slope at the unknown next point. A table can have correct-looking units and signs but still be inconsistent if it uses the wrong evaluation point or the wrong initial row.
Check Your Understanding
For each question, state what you would check before accepting the numerical result.
- A rate is given in \(\text{m}/\text{s}\), but the step is entered as 200 milliseconds. What conversion should be made before forming the Euler increment?
- If \(h>0\) and \(f(t_n,y_n)<0\), what sign must \(y_{n+1}-y_n\) have?
- An IVP states \(y(4)=7\), but the first table row pairs \(y_0=7\) with \(t_0=0\). What is inconsistent?
- A rate has units \(\text{mg}/\text{hour}\), and \(h\) has units of hours. What units should \(h f(t_n,y_n)\) have?
- Why does passing unit and sign checks not prove that an Euler approximation is accurate?