In the Gomes–Saúde model the electricity price is not a function anyone writes down: it is the Lagrange multiplier that makes a fleet of batteries absorb exactly what the grid produces. For the linear-quadratic case the paper solves it by a Volterra equation and a Laplace transform, up to one implicit constant. With quadratic terminal data that constant is explicit, the price closes in three lines, and it is affine in the supply path with every coefficient non-positive. So a forecast given as a box — this much supply, give or take — turns into a price band that is a theorem: every path inside the box prices inside the band, both edges are reached, and the whole thing is decided in exact rationals. The page then holds the source lab's own finite-difference kernel against the closed form and finds where its market clears and its batteries do not.
Each agent holds a charge x and chooses a rate α of buying (α > 0) or selling. The running cost is c α²/2 + ϖ(t) α + η (x − κ)²/2 — wear, payment at the spot price, and a set-point preference — and the terminal cost is γ (x − ζ)²/2. The price ϖ(t) is whatever makes the fleet's total purchase equal the grid's production Q(t):
Gomes and Saúde prove existence and uniqueness of (u, m, ϖ) with ϖ Lipschitz, then work the linear-quadratic case. Two averages carry the price: Π(t) = ∫u_x m and Ξ(t) = ∫x m. The paper derives Ξ̇ = Q — the fleet's mean charge rises by exactly what the grid produces, conservation of energy — and Π̇ = −η(Ξ − κ), then solves for Π by a Volterra equation with a separable kernel and a Laplace transform, leaving Π(0) to be fixed implicitly. With quadratic terminal data Π(T) = ∫γ(x − ζ) m(T) = γ(Ξ(T) − ζ) is explicit, and the pair integrates in closed form:
This is elementary, and for η = 0 it is the paper's own line ϖ = Θ − cQ with Θ = −γ(∫₀ᵀQ + x̄₀ − ζ). What it buys is the shape: the price is affine in the supply path, and every coefficient is ≤ 0 when c, γ, η ≥ 0. More supply at any hour lowers the price at every hour, never raises it. Supply on the grid is a step function, Q_n on [t_n, t_{n+1}), so with rational data every quantity above is a rational number, and the instrument computes it as one. The battery checks the closed form against an independent route — the quadratic ansatz u = a x² + b x + e, a Riccati equation for a and a linear one for b, integrated in float — and the two agree to 1e−14.
Because the price falls with supply coordinate-wise, the band over the box is attained at its corners: the lowest price at every hour is the price of the upper edge Q(1 + ρ), the highest is the price of the lower edge, and these are prices of actual paths, so the band is tight. The certificate says exactly that, carries five falsifiers, and is decided by exact arithmetic: twenty random paths inside the box price inside the band at all 241 grid times, and a path a tenth above the box prices below it.
The width has an anatomy, and it is the finding of this section. At hour t the width is c·2ρQ(t) + γ·2ρ∫₀ᵀQ + (the η term): the hour's own forecast error, the day's total forecast error, and the set-point term. On this scenario the day term is 2.4699 and the instant term never exceeds 0.305: 89 % of the band at its widest is uncertainty about how much energy the whole day will bring, not about this hour. A forecaster who wants the band one price unit wide needs a box of 5.41 %, and needs it on the integral more than on the hour. That is the threshold the page publishes: the disclosure that would narrow the price.
With a set-point preference η > 0 the price-supply relation stops being a line. Π(t) picks up η∫ₜᵀ(Ξ − κ): while the fleet's mean is above the set point the offset grows toward the past, and the price the market clears at depends on where the fleet is going to be, not only on how much it will have absorbed. The band is still attained at the corners — the η term has non-positive coefficients too — and its set-point part is tabulated.
| η | κ | Π(0) | Π(T) | widest band | at | instant · day · set-point parts of it | verdict |
|---|---|---|---|---|---|---|---|
| 0 | — | 1.6564 | 1.6564 | 2.7747 | 12 h | 0.305 · 2.470 · 0.000 | PROVED |
| 3 | 3/5 | 1.7539 | 1.6564 | 3.0235 | 11 h | 0.297 · 2.470 · 0.256 | PROVED |
| 12 | 3/5 | 2.0466 | 1.6564 | 3.8292 | 8 h | 0.251 · 2.470 · 1.108 | PROVED |
The source lab solves this model on the battery box [0, 1] with an implicit upwind scheme, Anderson-accelerated on the clearing map, and reports a residual measured before the step it judges. That kernel is ported here bit for bit — the same 49 iterations to the same residual, the same price to the last binary digit — with the domain, the walls and the clearing rule made parameters. It clears: the fleet's purchase matches Q to 1e−14 at every time step. And the fleet ends the day at Ξ(T) = 0.9032 when conservation says 0.9880. The gap, 0.0848, is 12.4 % of the day's energy, and it is at the wall: the density at x = 1 reaches 22.915 by nightfall.
The mechanism is two lines of the scheme. At a wall the missing neighbour counts as u_x = 0, so an agent at full charge still sees the price and may point its control into the wall; the payment enters the Lagrangian and the purchase enters the clearing sum. The Fokker–Planck step then sets the flux through the wall to zero. Energy is bought, counted as cleared, and never stored. Forbid the wall-pointing control — the state-constraint boundary condition — and the loss falls to 0.0645 but does not vanish, because the clearing sum still counts controls at cells the flux cannot leave. Clear on the discrete flux of the Fokker–Planck step itself, one bisection per time step, and Ξ(T) matches the exact model to 1e−14.
| the scheme on the lab's box | Ξ(T), the fleet at nightfall | energy lost | Π at noon | density at the wall, T | iterations · residual |
|---|---|---|---|---|---|
| the lab's kernel as it is (walls: u_x = 0 outside; clearing on the controls) | 0.9032 | 0.0848 (12.4 % of the day) | 0.0391 | 22.915 | 49 · 8.0e-10 |
| walls as state constraints (no control into a wall); clearing on the controls | 0.9235 | 0.0645 | 0.5656 | 8.059 | 36 · 9.8e-10 |
| state-constraint walls; clearing on the Fokker–Planck flux (ours) | 0.9880 | 1.0e-14 | 1.2802 | 70.500 | 52 · 8.6e-10 |
| the exact model on the whole line | 0.9880 | 0, by identity | 1.6564 | — | none: closed form |
Once the scheme conserves, the box's price can be read against the whole line's. At noon the flux-cleared box gives Π ≈ 1.280 where the closed form gives 1.656: a gap of 0.376 that is the wall's shadow price, the model's own statement that a fleet that cannot exceed full charge does not need to be paid as much to absorb the day. The lab's kernel put the same number at 0.039, and that was the leak talking, not the wall. Whether the wall's shadow price is 0.376 or something near it is a float statement at one mesh; what is decided is the whole-line value and the fact that only the conserving scheme is measuring the model.
Move the walls to [−1, 2], where the fleet never reaches them, and the flux-cleared scheme must approach the closed form as the mesh refines. It does, at first order: the maximal price error halves when H halves, at η = 0 and with the set-point potential on. The lab's wall treatment on the same domain does not approach it — its error grows with refinement — because the wall cell's free purchase lowers u there and the backward equation carries the cheaper value inward. That is a red control on the page's own claim: if the closed form were wrong, the conserving scheme would not converge to it either. Every run in the table converged to its 1e−9 clearing residual.
| scheme on [−1, 2], walls far from the fleet | mesh | max |ϖ_fd − ϖ_exact| | max |Ξ_fd − Ξ_exact| | Π at noon, fd vs exact |
|---|---|---|---|---|
| state-constraint walls + flux clearing, η = 0 | 150 × 240, H = 0.0201 | 0.0816 | 1.2e-14 | 1.6449 vs 1.6332 |
| state-constraint walls + flux clearing, η = 0 | 300 × 480, H = 0.0100 | 0.0434 | 2.4e-14 | 1.6390 vs 1.6332 |
| the same with η = 6, κ = 0.6 | 150 × 240, H = 0.0201 | 0.0882 | 1.0e-14 | 2.3528 vs 2.3387 |
| the lab's walls and clearing | 150 × 240, H = 0.0201 | 1.6998 | 6.6e-2 | 0.4420 vs 1.6332 |
| the lab's walls and clearing | 300 × 480, H = 0.0100 | 2.3615 | 6.2e-2 | 0.3937 vs 1.6332 |
node instruments/price/battery.js # 23 checks, 5 red controls: identities exact, band attained, Riccati to 1e-14, the kernel measured node instruments/price/run.js --check # the record, re-derived and compared byte for byte
The instrument is instruments/price/price.js (exact) with fd.js (the port) and derive.js; the record is certs/price-band.json. The certificate's falsifiers, as recorded: η < 0: a sensitivity ∂ϖ_n/∂Q_k turns positive and a path inside the box prices outside the corner band (the battery shows it); a supply path inside the box whose exact price leaves the band at any grid time; η = 0: Π_n ≠ −Θ at some n, Θ the paper's (30) — the closed form would not be the paper's line; the Riccati route (u = a x² + b x + e, float ODE) disagreeing with the closed form beyond 1e−9; the wide-domain finite-difference solve of the same system disagreeing beyond first order in the mesh.