Differential Equations with Events

Differential equations with actions at discrete events are used to model piecewise differential equations with jump discontinuities, or impacts and collisions such as a bouncing ball. They can also model hybrid systems with both continuous and discrete dynamics. The discrete dynamics can come from sampled or digital processes, such as a digital controller controlling a continuous process, or the discrete dynamics can represent modes such as a chemical reactor following a recipe.  The Wolfram Language symbolically processes differential equations to automatically set up events corresponding to discontinuities, including for the Filippov sliding mode (infinitely fast switching) solutions. In addition, for more detailed modeling, explicit WhenEvent[event,action] statements allow for whole new modeling possibilities.


WhenEvent actions to be taken when an event becomes True in a differential equation


f0 when f crosses zero

f>0 when f crosses zero from below

f<0 when f crosses zero from above

f0&&pred when f crosses zero and pred is True

Mod[t,Δt] sample at regular intervals Δt


expr expression to evaluate at event

varval set the state variable var to val

"StopIntegration" stop integrating differential equations at event

"RestartIntegration"  ▪  "CrossDiscontinuity"  ▪  "CrossSlidingDiscontinuity"  ▪  "RemoveEvent"  ▪  "DiscontinuitySignature"

Solution Variables

DependentVariables continuously varying solution functions

DiscreteVariables piecewise constant solution functions

Translate this page: