Prevalence pool P(t) Recovery outflow Death outflow

Prevalence Bathtub: Closed-Form ODE Companion (2D)

The 3D prevalence tank tracks individual stochastic cases, each one resolving at random after a memoryless illness duration — an agent-based Monte-Carlo view of the same "bathtub" identity every epidemiologist learns: Prevalence ≈ Incidence × Duration. This 2D companion asks the same question from the opposite direction, at the population level: it integrates the stock-flow differential equation dP/dt = Incidence − P/Duration directly with a 4th-order Runge–Kutta stepper, and continuously checks that numeric integration against the equation's own exact closed-form solution, so you can watch two genuinely different computational methods — one stochastic and discrete, one deterministic and continuous — settle on the identical steady state. The tank's water level is the literal value of P(t); its two outflow spouts emit particles at the true instantaneous recovery and death rates, not merely for decoration.