Not Accuracy, Stability: Explicit and Implicit Euler
A continuous stirred-tank reactor (CSTR) of 8000 L starts up full of feed, with a first-order liquid-phase reaction, A → products. How long does it take to reach 99 % of its steady-state conversion? The analytic solution says 11,500 s, about 3.2 h. Simulate the same startup with Euler's method and a 1000 s step and you get two more answers: explicit Euler reaches 99 % at 10,000 s, and implicit Euler at 14,000 s. The problem is Example 14-3 of Missen, Mims and Saville [1, pp. 341–342].
That gap, however, is not the one that matters. Stretch the step to 5500 s and, after a single step, explicit Euler gives a conversion of 82.5 %: more than twice the 37.5 % this startup tends to, which is physically impossible. Implicit Euler, at the same step, gives 25.8 %: inaccurate, but possible. Both methods have the same order of accuracy; what separates them is stability.
To see why, you have to start with the methods themselves: first where the two formulas come from, and then how they apply to this reactor, with a demo to try them yourself.
1. Where the Two Eulers Come From
A simulator never sees the reactor's conversion curve. All it has is a rule that tells it, at every instant, how fast the conversion is changing. That rule is the differential equation, and any first-order ODE has this form:
For the reactor in the opening, \(y\) is the conversion of A and \(f(t, y) = 4 \times 10^{-4}\,(0.375 - y)\), with \(t\) in seconds. Where that \(f\) comes from you will see in section 2, with the material balance.
That is the underlying problem. The ODE hands you the slope anywhere, but what you need is the value one step ahead. You know \(y_n \approx y(t_n)\) and you want \(y_{n+1} \approx y(t_{n+1})\), with \(t_{n+1} = t_n + h\).
Both Eulers fall out of a single Taylor expansion, read in two directions. It is worth building it from the ODE instead of taking it on faith, because the error of both methods is born in that construction.
Taking a step is integrating the slope
The idea is simple: if the ODE gives you the slope at every instant, adding up those slopes across one step tells you how much \(y\) changed. Adding up slopes is integrating, so integrate both sides of the ODE from \(t_n\) to \(t_n + h\):
(\(s\) is the time inside the integral: a dummy variable, renamed so it is not confused with the limits.)
The right-hand side deserves a slow read. \(f\big(s, y(s)\big)\) is the slope evaluated along the solution curve itself: at the instant \(s\) the conversion is \(y(s)\), and \(f\) is fed those two things. For the reactor, \(f\big(s, y(s)\big) = 4 \times 10^{-4}\,\big(0.375 - y(s)\big)\).
The left-hand side is easier, because it is the integral of a derivative. The fundamental theorem of calculus reduces it to the difference between the endpoints, approximating nothing:
Substitute that into the left-hand side of the first equation and solve for the value you want. What remains is the exact integral form of the step:
It is exact, but not yet usable. Inside the integral sits \(y(s)\), the solution midway through the step, which is precisely what you do not know.
That knot is also the way out. If taking a step is integrating \(f\), any one-step method is no more than a way of approximating that integral. Euler is the simplest of all: it assumes the slope does not change across the step and uses the one at an endpoint. A rectangle of width \(h\).
From the integral to Taylor
To see how wrong that rectangle is, split the integral in two: a term you can compute with what you know at the start of the step, and a remainder.
First, write the integrand as \(y'(s)\): along the solution, \(f\big(s, y(s)\big)\) is exactly \(y'(s)\), which is what the ODE says. Then integrate it by parts. For that, the only hypothesis of the whole derivation suffices: that \(y\) has a continuous second derivative across the step. The reactor satisfies it easily, because its solution is an exponential.
The key is the antiderivative of \(ds\): instead of \(v = s\), take \(v = s - (t_n + h)\). It is just as valid, because its derivative is still 1, and more convenient, because it vanishes at the upper limit. So the boundary term only gets a contribution from the lower one:
This is still an identity. The first term is exactly Euler's rectangle: the slope at the start of the step times its length. Everything you do not know has gone into the integral on the right.
That remainder cannot be computed, because it needs \(y''\) across the whole interval. But the second mean value theorem for integrals [2, p. 79] rewrites it with a single value of \(y''\). It asks for two things: that \(y''\) be continuous, which is the hypothesis above, and that the weight \((t_n + h - s)\) not change sign, and it is never negative inside the step. With that, \(y''\) comes out of the integral, evaluated at some interior point \(\xi\):
(The integral of the weight is the area of a triangle with base \(h\) and height \(h\).)
Put the three pieces together (the integral form, the by-parts identity and this last result) and write \(t_{n+1} = t_n + h\). Out comes Taylor's expansion with the remainder in what Chapra and Canale call the Lagrange form [2, p. 79]:
The equality is still exact. The price is \(\xi\): you know it exists and lies inside the step, but not where. That is still enough to bound the error, which is all section 5 needs.
Two readings of the same expansion
Both Eulers are born from throwing away the term you cannot evaluate. Depending on which end of the step you read the expansion from, you get one or the other.
Forward. The approximation enters here, and only here. Truncate the quadratic term, the only one that depends on \(\xi\). Use the ODE for the derivative, \(y'(t_n) = f\big(t_n, y(t_n)\big)\), and put the computed value \(y_n\) in place of the exact \(y(t_n)\), which you do not know. That is explicit Euler, by the same route Chapra and Canale take [2, pp. 722–723]:
Backward. Walk the same step in reverse. Integrate \(y'\) from \(t_{n+1}\) to \(t_n\): the fundamental theorem of calculus gives, as before, the difference between the endpoints. Then integrate by parts, now with \(v = s - t_n\), which vanishes at the endpoint you arrive at. The boundary term, the linear one, now comes from \(t_{n+1}\) and flips sign:
The remainder changed too: the weight is now \((s - t_n)\), which grows across the step instead of shrinking. It does not change sign either, so the mean value theorem applies again, and its integral is again the triangle of area \(h^2/2\). But applied to a different integral it gives a different point, which is why it gets its own name, \(\tilde{\xi}\):
This is not a notational detail. For the reactor both can be computed from the exact solution: in the first step, from \(t = 0\) with \(h = 2000\) s, \(\xi \approx 624\) s and \(\tilde{\xi} \approx 1287\) s.
Look at the left-hand side: it is no longer the new value, it is the one you already know. Truncate the same way, use the ODE at the end of the step, \(y'(t_{n+1}) = f\big(t_{n+1}, y(t_{n+1})\big)\), put the computed values in place of the exact ones, and solve for the one you want. That is implicit Euler, which Chapra and Canale also call backward Euler [2, p. 769]:
The difference fits in a subscript: they are two rectangles, one with the slope at the start of the step and one with the slope at the end. The explicit method evaluates the slope where you already are; the implicit one, where you are going to land, a value you do not know yet. That circularity is the whole story: the first is computed, the second is solved.
Here it is on the reactor's first step, from \(t = 0\) with \(h = 2000\) s. The gray ticks are the slope field: what the ODE says at each point.
Animation (needs JavaScript): explicit follows the slope at the starting point and lands at 0.300; implicit looks for the landing point whose slope points back to the start and lands at 0.167; the exact solution is 0.207.
2. The Example: Starting Up a CSTR
Now for the concrete system, exactly as Example 14-3 of Missen, Mims and Saville sets it up [1, pp. 341–342]: the startup of a continuous stirred-tank reactor (CSTR) for the liquid-phase reaction A → products. The reactor is full of feed when, at \(t = 0\), steady flow of feed begins at flow rate \(q_o\). Even though the flow is already steady, the reactor is in unsteady-state operation: the outlet concentration \(c_A\) falls from \(c_{Ao}\), and with it the conversion \(f_A\) rises from 0.
Before writing the balance, watch it happen. Each dot is a parcel of the tank's contents: filled while it is still A, hollow once it has reacted.
Animation (needs JavaScript): the tank starts full of A; with feed and outlet running, the conversion rises from 0 to 0.375 and reaches 99 % of it at 11,500 s.
Take the reactor as a control volume and write the material balance for A. It is the book's equation 14.3-2:
Each term answers to an assumption. The outlet term carries \(c_A\), the reactor's own concentration, because in a CSTR the fluid is perfectly mixed and the output stream has the same properties as the vessel contents [1, pp. 29–30]. The accumulation term can be written as \(V\,dc_A/dt\) because the volume does not change: the same flow \(q_o\) enters and leaves, and the example sits in the book's section on constant-density systems [1, p. 339]. The reaction term uses first-order kinetics, \((-r_A) = k_A\,c_A\), with \(k_A\) constant, so the operation is isothermal.
Divide by \(q_o\), use the space time \(\tau = V/q_o\) [1, p. 26], and write the concentration in terms of conversion, \(c_A = c_{Ao}(1 - f_A)\). This is the book's equation (A):
At steady state the derivative is zero, and solving gives the conversion the startup tends to. With the book's data, \(V = 8000\) L, \(q_o = 2\) L/s and \(k_A = 1.5 \times 10^{-4}\) s⁻¹, the space time is \(\tau = 4000\) s and \(k_A\tau = 0.6\):
To follow the startup in time, the book rewrites (A) in terms of \(f_A\). Since \(dc_A/dt = -c_{Ao}\,df_A/dt\), the feed concentration, \(c_{Ao} = 1.5\) mol/L, cancels from every term, leaving its equation (B) in differential form:
Divide by \(\tau\) and factor out \((1 + k_A\tau)\). What is left inside the parentheses is the distance to \(f_{A\infty}\), and the ODE appears in section 1's form:
The book integrates it with \(f_A = 0\) at \(t = 0\). Solving its result for \(f_A\) gives the analytic solution, which is what lets us measure each method's true error instead of estimating it:
99 % of \(f_{A\infty}\) is reached when \(e^{-at} = 0.01\), that is at \(t = \ln 100 / a \approx 11{,}500\) s, about 3.2 h: the book's answer. The book itself adds that the problem can also be solved by numerical integration [1, p. 342], which is exactly what this article does.
One more number is worth keeping: \(2/a = 5000\) s. It will come back in section 5 as the explicit method's stability limit. (In the code the step is called dt: in process engineering, h already means heat transfer coefficient.)
With the two formulas from section 1 in hand, pick a method below and drag the step size. The sections that follow explain what you are seeing.
This demo needs JavaScript.
3. Explicit Euler
Call \(f_{A,n}\) the conversion computed at step \(n\), section 1's \(y_n\). Take the explicit formula and give it the reactor's slope evaluated where you already are, \(a\,(f_{A\infty} - f_{A,n})\):
Everything on the right is already known, so there is nothing to solve: it is one calculation per step, and the code writes it as is.
import numpy as np
import matplotlib.pyplot as plt
# Example 14-3 of Missen, Mims and Saville: startup of a CSTR, A -> products.
V, q, kA = 8000.0, 2.0, 1.5e-4 # L, L/s, 1/s (cAo cancels out)
tau = V / q # space time: 4000 s
a = (1 + kA * tau) / tau # 4e-4 1/s
fA_inf = kA * tau / (1 + kA * tau) # steady-state conversion: 0.375
def analytic(t):
"""Analytic solution of Example 14-3, solved for fA: fA(t) = 0.375·(1 - e^(-a·t))."""
return fA_inf * (1 - np.exp(-a * t))
def euler_explicit(dt, t_final):
"""fA_{n+1} = fA_n + dt·a·(fA_inf - fA_n) — one evaluation per step, nothing to solve."""
n = int(round(t_final / dt))
t = np.linspace(0.0, t_final, n + 1)
fA = np.zeros(n + 1) # starts full of feed: fA(0) = 0
for k in range(n):
fA[k + 1] = fA[k] + dt * a * (fA_inf - fA[k])
return t, fA
Grouping the two terms that carry \(f_{A,n}\) shows what each step does:
It multiplies the distance to steady state by \(1 - ah\). That factor is what decides everything in section 5.
4. Implicit Euler
Now the slope is evaluated where you are going to land, \(a\,(f_{A\infty} - f_{A,n+1})\), and that is why \(f_{A,n+1}\) appears on both sides:
Since the model is linear, you solve it by hand once and for all. Move the term with \(f_{A,n+1}\) to the left and factor it out:
Dividing by \(1 + ah\) is always allowed, because \(a\) and \(h\) are positive. In code:
def euler_implicit(dt, t_final):
"""fA_{n+1} = (fA_n + dt·a·fA_inf) / (1 + a·dt) — closed form, no iteration."""
n = int(round(t_final / dt))
t = np.linspace(0.0, t_final, n + 1)
fA = np.zeros(n + 1)
for k in range(n):
fA[k + 1] = (fA[k] + dt * a * fA_inf) / (1.0 + a * dt)
return t, fA
That convenience is the exception. With nonlinear kinetics — if the reaction were second order, \((-r_A) = k_A\,c_A^2\), say — you have to solve a nonlinear equation in \(f_{A,n+1}\) at every step, usually with Newton-Raphson: several iterations per step, each needing the function and its derivative, instead of a single evaluation. That is the real cost of the implicit method, and Chapra and Canale sum it up: stability is gained, but paid for in complexity [2, p. 771].
5. Error and Stability
The term truncated from Taylor is what Chapra and Canale call the local truncation error [2, p. 723]: how far off a single step is when it starts from the exact value. It comes from section 1's two expansions, and that is where the symmetry sits:
The two interior points, \(\xi\) and \(\tilde{\xi}\), are not the same, so the magnitudes do not match exactly: at \(h = 2000\) s they differ by 30 %. But both lie inside the step, so as \(h\) shrinks the two \(y''\) tend to the same value \(y''(t_n)\). To leading order: same magnitude, opposite sign. That is why one runs ahead and the other lags: it is the same error with a different sign. Accumulating \(t/h\) steps costs one order, and the global truncation error of both lands at \(O(h)\) [2, p. 725].
In practice, halving \(h\) halves the error, at least once \(h\) is small. Go back to the demo above: the explicit method's max error at \(h\) = 1000, 500, 250 and 125 s is 0.0335, 0.0151, 0.0072 and 0.0035 (in units of conversion), and each ratio gets closer to 2 (2.2, 2.1 and 2.0). With large steps not yet: from 2000 to 1000 s the error drops 2.8 times. The figure's log-log slopes confirm it: 1.04 and 0.97.

If both are first order, accuracy is not enough to decide. So look at what each method does to the distance to steady state, \(e = f_A - f_{A\infty}\). Since \(f_{A\infty}\) is constant, \(de/dt = df_A/dt = -a\,e\): the error obeys exactly the homogeneous equation \(dy/dt = -ay\), Chapra and Canale's (26.3) [2, p. 767]. Subtract \(f_{A\infty}\) from both sides of the formulas in sections 3 and 4; in both, what is left groups into a multiple of \(f_{A,n} - f_{A\infty}\):
Each step multiplies the error by an amplification factor \(R\), so \(e_n = R^n e_0\). These are the factors of Chapra and Canale's equations (26.4) and (26.5) [2, pp. 768–769]. With \(\lambda = -a\) (the derivative \(\partial f/\partial y\), constant for a linear ODE) and \(z = h\lambda\), they take the form that holds for any linear ODE:
The solution stays bounded only if \(\lvert R \rvert \le 1\). For the explicit method, \(\lvert 1 + z \rvert \le 1\) is the disk of radius 1 centered at \(-1\). On the real axis that disk runs from \(z = -2\) to \(z = 0\), and since \(z = -ah\), the condition is \(ah \le 2\). That is Chapra and Canale's criterion: if \(h > 2/a\), the numerical solution grows without bound [2, p. 768]. For the reactor:
For the implicit method, \(\lvert 1 - z \rvert \ge 1\) covers the entire left half-plane and then some: if the physical problem is stable, so is the method, for any \(h\). Chapra and Canale call it unconditionally stable [2, p. 769]; the numerical-analysis literature calls it A-stable, the name Dahlquist gave it [3]. And since \(R_{imp} \to 0\) as \(\lvert z \rvert \to \infty\), it does not merely tolerate fast modes: it annihilates them.
In the animation, \(h\) grows and \(z = h\lambda\) moves left along the real axis; alongside, the first eight steps of each method with that same \(h\).

| \(h\) (s) | \(R_{exp}\) | \(R_{imp}\) | Exact \(e^{h\lambda}\) |
|---|---|---|---|
| 1000 | +0.6000 | +0.7143 | +0.6703 |
| 2500 | 0.0000 | +0.5000 | +0.3679 |
| 4500 | −0.8000 | +0.3571 | +0.1653 |
| 5500 | −1.2000 | +0.3125 | +0.1108 |
At 2500 s the explicit method hits \(R_{exp} = 0\) and jumps to the steady state in one step; at 4500 s the factor is already negative and the solution oscillates, though it still decays. At 5500 s, barely 10 % above the limit, \(\lvert R_{exp} \rvert > 1\):
0.000, 0.825, -0.165, 1.023, -0.403, 1.308, -0.745, 1.719, -1.237
A conversion of −124 %. The implicit method at the same step gives 0.000, 0.258, 0.338, 0.364, 0.371, ...: inaccurate, but never absurd. And that divergence is not a coding bug or a rounding artifact: it is the exact solution of the recurrence you wrote, which no longer resembles the ODE.
6. Stiffness: Where Implicit Truly Wins
With 5000 s of headroom the explicit method looks usable. Everything changes when the system has two widely separated time scales. Chapra and Canale show it in section 26.1 with equation (26.1) [2, p. 767], a minimal ODE that mixes one very fast mode with one slow one:
Its analytic solution, equation (26.2), shows both scales at a glance:
(Chapra and Canale round the coefficients to three decimals: the exact ones are \(997/999\) and \(2000/999\), and the difference never exceeds \(2 \times 10^{-6}\).) One mode with \(\lambda = -1000\) and another with \(\lambda = -1\): the stiffness ratio is 1000. The fast one lifts the solution from \(y = 0\) to \(y \approx 1\) and dies out before \(t = 0.005\) [2, p. 768]; from there on the slow one rules, and at \(t = 0.4\) it is still only at 1.66 on its way to 3.
Here is the treacherous part. That transient occupies 1.25 % of the interval \([0,\ 0.4]\), and after it nothing it does matters again. Yet it is the one that sets the stability limit, not the slow mode: \(h \le 2/1000 = 0.002\), for the full 0.4. That is how Chapra and Canale define a stiff system: one with rapidly changing components alongside slowly changing ones, where the fast transient, though it lasts a tiny fraction of the interval, controls the step size of the whole solution [2, pp. 767–768]. Put in plant terms: a dynamic that no longer matters and charges you anyway.
# Chapra and Canale's eq. (26.1): one fast mode (e^-1000t) and one slow (e^-t).
def f_stiff(t, y):
return -1000.0 * y + 3000.0 - 2000.0 * np.exp(-t)
def exact_stiff(t):
"""Equation (26.2): y = 3 - 0.998·e^(-1000t) - 2.002·e^(-t)."""
return 3.0 - 0.998 * np.exp(-1000.0 * t) - 2.002 * np.exp(-t)
def stiff_explicit(dt, t_final):
n = int(round(t_final / dt))
t = np.linspace(0.0, t_final, n + 1)
y = np.empty(n + 1)
y[0] = 0.0
for k in range(n):
y[k + 1] = y[k] + dt * f_stiff(t[k], y[k])
return t, y
def stiff_implicit(dt, t_final):
"""Chapra and Canale's closed form:
y_{i+1} = (y_i + 3000h - 2000h·e^-t_{i+1}) / (1 + 1000h)."""
n = int(round(t_final / dt))
t = np.linspace(0.0, t_final, n + 1)
y = np.empty(n + 1)
y[0] = 0.0
for k in range(n):
y[k + 1] = ((y[k] + 3000.0 * dt - 2000.0 * dt * np.exp(-t[k + 1]))
/ (1.0 + 1000.0 * dt))
return t, y
print("Explicit limit: h <", 2 / 1000) # 1000 and 1 → stiffness ratio 1000
Chapra and Canale's Example 26.1 [2, pp. 769–770] — titled, literally, "Explicit and implicit Euler" — pushes it to the limit with three step sizes. At \(h = 0.0005\) the explicit method works. At \(h = 0.0015\), still below the limit, the solution already oscillates: the amplification factor is \(1 - 1000h = -0.5\), negative but less than 1 in absolute value. It is the same regime as the 4500 s row of section 5's table: it oscillates while it decays. And above \(0.002\) it runs off to infinity.

The implicit method, by contrast, runs at \(h = 0.05\): twenty-five times the explicit limit, and it tracks the curve with a 0.02 maximum error. Count the steps over the same interval \([0,\ 0.4]\) Chapra and Canale integrate with the implicit method: explicit, at their step size of 0.0015, uses 267; implicit uses 8: 33 times fewer. And even pushing explicit to the edge of stability it would not drop below 200 steps, 25 times more. The advantage grows with the stiffness ratio: the explicit step is set by the fastest mode; the implicit one only by the accuracy you want on the slow one.
With the closed form, an implicit step costs the same as an explicit one: one exponential and a few operations. Set to advance at the same pace, one step per tick, it looks like this:
Animation (needs JavaScript): at one step per tick, implicit covers the interval in 8 steps; at that moment explicit is at 3 %, and it finishes at 267.
7. Closing
The two Eulers have the same order of accuracy and come from the same Taylor expansion. What separates them is not error, it is stability.
- Estimate \(\lambda\) — the derivative \(\partial f / \partial y\) at the operating point, or the Jacobian eigenvalues. It is the number that governs everything else.
- Compute the stiffness ratio \(\lvert \lambda_{max} \rvert / \lvert \lambda_{min} \rvert\). As a rule of thumb, not from the cited books: below 10 explicit usually suffices and is simpler; above 100 implicit almost always wins.
- If you use explicit, respect \(h \le 2/\lvert\lambda\rvert\) and validate the full horizon: an unstable simulation can look impeccable at start-up.
In production you do not hand-code Euler: you use SciPy's scipy.integrate.solve_ivp [4] with method="BDF" or "Radau", implicit precisely because of this. But the criterion for choosing between the two is the one in this article.
Related reading: solving an ODE with SymPy and simulating a temperature sensor.
References
[1] R.W. Missen, C.A. Mims, B.A. Saville, Introduction to Chemical Reaction Engineering and Kinetics, Wiley, New York, 1999.
[2] S.C. Chapra, R.P. Canale, Métodos numéricos para ingenieros, fifth ed., McGraw-Hill Interamericana, Mexico City, 2007. Spanish translation of Numerical Methods for Engineers, fifth ed., McGraw-Hill, 2006; section, equation and figure numbers match the original, page numbers refer to the translation.
[3] G.G. Dahlquist, A special stability problem for linear multistep methods, BIT 3 (1963) 27–43. https://doi.org/10.1007/BF01963532.
[4] P. Virtanen, et al., SciPy 1.0: fundamental algorithms for scientific computing in Python, Nat. Methods 17 (2020) 261–272. https://doi.org/10.1038/s41592-019-0686-2.