MATHEMATICA GUIDE

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.

Mathematica 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.

ReferenceReference

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

Events

f=0 when f crosses zero

f>0 when f crosses zero from below

f<0 when f crosses zero from above

f=0&&pred when f crosses zero and pred is True

Mod[t,t] sample at regular intervals

Actions

expr expression to evaluate at event

var→val set the state variable var to val

"StopIntegration" stop integrating differential equations at event

▪  ▪  ▪  ▪

Solution Variables

DependentVariables continuously varying solution functions

DiscreteVariables piecewise constant solution functions

New to Mathematica? Find your learning path »
Have a question? Ask support »