Fischer esterification reacts a carboxylic acid with an alcohol to form an ester and water — a reversible reaction that settles at equilibrium rather than running to completion:
RCOOH + R'OH ⇌ RCOOR' + H2O
Keq = [ester][water] / [acid][alcohol]
Starting from A₀ mol acid and B₀ mol alcohol with none of the products present, an ICE table gives Acid = A₀−x, Alcohol = B₀−x, Ester = x, Water = x, where x is the reaction extent. Substituting into Keq gives one quadratic equation in x:
Keq(A0−x)(B0−x) = x²
(Keq−1)x² − Keq(A0+B0)x + Keq·A0·B0 = 0
The engine solves this quadratic from scratch with the quadratic formula every time A₀, B₀ or Keq changes, keeps the physically valid root (0 ≤ x ≤ min(A₀,B₀)), and animates the population relaxing toward it.
- Alcohol : Acid ratio — starting with excess alcohol (Le Chatelier's principle) pushes the solved equilibrium extent x higher relative to the limiting reagent, even though Keq itself never changes.
- Keq — a larger equilibrium constant favors the ester side directly; the quadratic's positive root grows with it.
- Dean–Stark Trap — continuously pulls water out of the flask. With water amount r already removed, the governing quadratic becomes (Keq−1)x² + (r−Keq(A0+B0))x + Keq·A0·B0 = 0, which the engine re-solves every frame as r grows — removing a product keeps the reaction quotient below Keq, so conversion keeps climbing toward 100%, the only lever here that changes the final yield rather than just the speed of getting there.