mathematics//differential equations//constraint
A constraint is an equality the variables of a differential equation must satisfy at all times. It either comes out of the equations themselves or is a physical condition the model must respect; it cannot be bolted onto an ODE arbitrarily and expected to hold.
A constraint is an equality the variables of a differential equation must satisfy at all times. It either comes out of the equations themselves or is a physical condition the model must respect; it cannot be bolted onto an ODE arbitrarily and expected to hold.
In an epidemic model the total population never changes.
In an SIR model the population is fixed, so susceptible plus infected plus recovered equals NNN. People move between the three groups (well to sick, sick to recovered, recovered to sick again) but the total never changes: R=N−S−IR = N - S - IR=N−S−I.
peak of I0.41 S left at the end0.02 S + I + R1.00 at every instant What leaves S enters I at the rate βSI, which needs both; what leaves I enters R at the rate γI. The total never changes.
Move either rate and play the run: the three curves change shape, but their sum stays at 1 and the state, drawn in the octant, never leaves the triangle.
Three variables tied by one equality restrict the three-dimensional state space to a plane; with non-negativity of each group it is a triangle in the positive octant. Every constraint typically removes one dimension from what the number of variables suggests: three variables, one constraint, a two-dimensional state.
Tangency is the test. If g(x)=0g(x)=0g(x)=0 is to hold along every trajectory, its time derivative must vanish, so the velocity has to be tangent to the constraint surface: ∇g(x)⋅f(x)=0\nabla g(x)\cdot f(x)=0∇g(x)⋅f(x)=0 wherever g(x)=0g(x)=0g(x)=0. In SIR, S˙+I˙+R˙=0\dot S+\dot I+\dot R=0S˙+I˙+R˙=0 because every term that leaves one equation enters another; the constraint is an invariant of the field. The same calculation with an inequality, ∇V⋅f(x)≤0\nabla V\cdot f(x)\le 0∇V⋅f(x)≤0, defines a Lyapunov function: a quantity the field never increases, where a constraint is one it keeps exactly constant.
Two legitimate origins. Either the constraint is an invariant of the field, as above, or it is a physical condition imposed on the model, such as conservation of mass or volume (the conserved total of a closed network), non-negativity of a concentration, or a rigid link between coordinates. In the second case the equations have to be written so that the field is tangent to it; if they are not, the constraint is violated the moment the system moves and the model is inconsistent.
Consequences: a constraint lets you eliminate a variable (write R=N−S−IR=N-S-IR=N−S−I and integrate two equations instead of three), it shrinks the space a phase portrait has to show, and in a numerical scheme it drifts unless the integrator preserves it (discretization).