The DEplot[interactive] System Library
This example page describes the default models (available on startup) for the DEplot[interactive] differential system tool.
Damped Harmonic Oscillator
Suppose a mass m, which is attached to a spring which is fixed to a wall, is resting on a table. Let x=0 be the point where the mass is in rest position. If the mass is moved so that the spring is stretched or compressed, a force is applied to the mass. Hooke's law states that the force exerted by the spring on the mass is −k x where k is the spring constant, that is, the force is proportional to the displacement x of the mass from the rest position. Since f=m a, that is, force equals mass times acceleration, we have the following second order differential equation which governs the motion of the mass.
−k⁢x=m ⅆ2xⅆt2
When the mass slides over the table there will be a frictional force applied to the mass in the opposite direction of motion. Assuming it is proportional to the velocity of the mass, we obtain the following equation
ⅆ2xⅆt2+μ ⅆxⅆt+ω2⁢x=0
which governs the motion of the mass. Here ω=km , k is the constant of spring, m is the mass. The term μ ⅆxⅆt models the friction with the table where μ is the damping coefficient. One can convert this linear second order differential equation into a system of two first order differential equations by letting v=ⅆxⅆt, that is, v is the velocity, obtaining:
ⅆvⅆt+μ⁢v+ω2⁢x=0, v=ⅆxⅆt
restart;
des:=ⅆⅆt⁢x⁡t=v⁡t,ⅆⅆt⁢v⁡t=−μ⁢v⁡t−ω2⁢x⁡t:
μ≔0.5: ω≔1:
DEtools:-DEplotdes,x⁡t,v⁡t,t=0..12,x=−1.5..1.5,v=−1.5..1.5,0,1.2,0,0,0,1.2,axes=frame,linecolor=blue,dirfield=400,arrows=fish,numsteps=100
Metastasis of Malignant Tumors
This is a two-compartment model for the metastasis of cancer, that is, the spread of cancer cells through the boundary of an organ tissue. Let x1 be the number of arrested cells (sitting on the boundary of the tissue in compartment A) and x2 be the number of cells that have invaded the target tissue (compartment B). Cells pass from compartment A to B with a rate of β2⁢x1. In addition, cells die from compartment A with the rate β1⁢x1 and die from compartment B with the rate β3⁢x2. We obtain the following system of two first order differential equations representing these relations.
ⅆx__1ⅆt=−β1+β2⁢x1, ⅆx__2ⅆt=β2⁢x1−β3⁢x2.
des:=ⅆⅆt⁢x⁡t=−β1+β2⁢x⁡t,ⅆⅆt⁢y⁡t=β2⁢x⁡t−β3⁢y⁡t:
β:=0.032,0.32,0.7:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..10,x=−0.5..2.5,y=−0.5..2.5,0,0.2,2,0,2,0.2,axes=box,linecolor=blue,dirfield=600,arrows=fish,color=magnitude
Lotka-Volterra Model
The Lotka-Volterra system
ⅆⅆt⁢x⁡t=α⁢x⁡t−b⁢x⁡t⁢y⁡t , ⅆⅆt⁢y⁡t=−β⁢y⁡t+c⁢x⁡t⁢y⁡t,
is a predator-prey model. x⁡t is the population of the prey at time t, y⁡t is the population of the predator at time t, 0<α is the birth rate of the prey, 0<β is the death rate of the predator, b is the predation rate coefficient, and c is the reproduction rate of predators per one prey eaten.
des≔ⅆⅆt⁢x⁡t=α⁢x⁡t−b⁢x⁡t⁢y⁡t,ⅆⅆt⁢y⁡t=−β⁢y⁡t+c⁢x⁡t⁢y⁡t:
α≔1: b≔1:β≔0.3:c≔0.3:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..10,x=0..3,y=0..3,dirfield=400,arrows=fish,1,0.5,0.5,0,1.2,1.1,color=magnitude,linecolor=blue
Brusselator
The brusselator is a mathematical model for chemical oscillation. The dynamics of this system are given by:
ⅆuⅆt=1−b+1⁢u+a⁢u2⁢ν , dνdt=b⁢u−a⁢u2⁢ν,
where 0≤u and 0≤ν, are concentrations of two chemicals, and a and b are positive constants. For certain values of a and b, for example, a = 0.5, b = 2, the brusselator exhibits natural oscillation, that is, a stable limit cycle.
des:=ⅆⅆt⁢u⁡t=1−b+1⁢u⁡t+a⁢u⁡t2⁢ν⁡t,ⅆⅆt⁢ν⁡t=b⁢u⁡t−a⁢u⁡t2⁢ν⁡t:
a:=12:b≔2:
DEtools:-DEplotdes,u⁡t,ν⁡t,t=0..8,u=0..5,ν=0..7,dirfield=600,0,0,4,0,1,0,0,2,4,0,2,3,color=magnitude,arrows=fish,numsteps=300,linecolor=blue
Kermack-McKendrick Epidemic Model
Kermack-McKendrick model is an SIR (Susceptible, Infected, Recovered) model for the number of people infected with a contagious illness in a closed population over time. Here we are using a simplified version of the model with no recovery, R, element. So we have
ⅆSⅆt=−β⁢S⁢I, ⅆIⅆt=β⁢S⁢I−γ⁢I,
where 0 < S < 1 is the proportion of the population which is susceptible to the illness, 0 < I < 1 is the proportion of infectious individuals in the population, β is the mean transmissions rate, and γ is the mean rate at which infected individuals either recover or die from the illness.
des:=ⅆⅆt⁢x⁡t=−β⁢x⁡t⁢y⁡t,ⅆⅆt⁢y⁡t=β⁢y⁡t⁢x⁡t−G⁢y⁡t:
β≔2:G≔1:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..20,x=0..1.2,y=0..0.8,dirfield=400,0,0.995,0.005,linecolor=blue,color=magnitude,arrows=curve,labels=S,I
The most interesting observation to make about this model is that the S does not drop to zero, that is, not everyone in the population gets the illness, even if β is increased (individuals are more infectious) and γ is decreased (individuals stay infectious for longer). In the plot above we see that when I=0, that is, when all infectious individuals have either died or recovered, the value of S=0.2, that is, about 20% of the population is susceptible, i.e., has not caught the illness. In the plot below it is about S=0.02 or 2%. This correctly predicts what has been observed in real life.
β≔2:G≔0.5:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..20,x=0..1.2,y=0..0.8,dirfield=400,0,0.995,0.005,linecolor=blue,color=magnitude,numsteps=200,arrows=curve,labels=S,I
Competing Species
Suppose in a closed environment there are two species competing for a limited supply of food. Let x and y be the population of the two species at time t. We have
ⅆxⅆt=x⁢a−δ1⁢x−α1⁢y , ⅆyⅆt=y⁢b−δ2⁢y−α2⁢x,
where a and b are the growth rates of the two populations, and aδ1 and bδ2 are their saturation levels. The α values are a measure of the degree to which each species interferes with the other.
des:=ⅆⅆt⁢x⁡t=x⁡t⁢a−δ1⁢x⁡t−α1⁢y⁡t,ⅆⅆt⁢y⁡t=y⁡t⁢b−δ2⁢y⁡t−α2⁢x⁡t:
a≔1:δ1≔1:α1≔1:b≔0.75:δ2≔1:α2≔0.5:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..10,x=0..1.5,y=0..1.5,0,0.3,0.1,0,0.1,0.4,0,1.6,0.6,0,1.2,1.2,0,0.8,1.3,dirfield=400,arrows=fish,color=magnitude,linecolor=blue,numsteps=100
Van der Pol Oscillator
The van der Pol equation describes the self-sustaining oscillations in which the energy is fed into small oscillations and removed from large oscillations. This equation arises in the study of circuits containing vacuum tubes. The Van der Pol equation is given by:
ⅆ2xⅆt2−μ 1−x2 ⅆxⅆt+x=0,
where μ, a positive constant, describes the current x in a triode oscillator. When μ=0 the equation reduces to the simple harmonic oscillator. One can write this second order differential equation as a system of differential equations:
ⅆⅆt⁢x⁡t=y⁡t, ⅆⅆt⁢y⁡t=−x⁡t+μ⁢1−x⁡t2⁢y⁡t.
des:=ⅆⅆt⁢x⁡t=y⁡t,ⅆⅆt⁢y⁡t=−x⁡t+μ⁢1−x⁡t2⁢y⁡t:
μ:=0.25:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..50,x=−4..4,y=−4..4,0,−4,4,0,0.5,0.5,axes=box,linecolor=blue,dirfield=400,color=magnitude,arrows=fish,numsteps=300,numpoints=900
House Warming Model
The following system of differential equations describes the relationship between temperatures of rooms in a house with a furnace. A(t) is the temperature for room A, B(t) is the temperature for room B, F is the heating rate of the furnace located in room B, and Am is the outside temperature.
ⅆⅆt⁢A⁡t=k1⁢Am−A⁡t+k2⁢B⁡t−A⁡t, ⅆⅆt⁢B⁡t=k2⁢A⁡t−B⁡t+k3⁢Am−B⁡t+F
The parameters k1,k2, and k3 describe the rates of exchange for heat between the rooms A,and B,and outside.
des:=ⅆⅆt⁢A⁡t=k1⁢Am−A⁡t+k2⁢B⁡t−A⁡t,ⅆⅆt⁢B⁡t=k2⁢A⁡t−B⁡t+k3⁢Am−B⁡t+F:
k:=0.05,0.2,0.05:F≔1:Am:=20:
DEtools:-DEplotdes,A⁡t,B⁡t,t=0..20,A=0..40,B=0..40,0,5,20,0,20,20,0,30,10,linecolor=blue,dirfield=400,color=magnitude,arrows=fish
Richardson's Arms Race Model
Consider two competing nations. Both nations are self defensive and fight back to protect their nation. Both nations maintain army and stock weapons. When one nation expands their army the other nation finds it offensive. Let x(t) and y(t) represent the yearly rate of armament expenditures of the two nations in some standard unit. One can model the Mutual Fear factor for each nation. Assume that extensive armament expenditures create a drag on the nation's economy. And also assume that the each nation's mutual fear's rate is directly proportional to the expenditure of the other nation. In addition, assume that there are constants r and s indicating the grievance of one country toward the other country. Note that negative values for s and r represent feelings of good will. The Model will be:
ⅆxⅆt=a⁢y−m⁢x+r,ⅆyⅆt=b⁢x−n⁢y+s
where a, b, m, and n are positive constant.
des:=ⅆⅆt⁢x⁡t=a⁢y⁡t−m⁢x⁡t+r,ⅆⅆt⁢y⁡t=b⁢x⁡t−n⁢y⁡t+s:
a≔2.0:m≔1.0:r≔−3:b≔2.0:n≔1.0:s:=−3.0:
DEtools:-DEplotdes,x⁡t,y⁡t,t=0..10,x=0..10,y=0..10,dirfield=400,arrows=fish,0,4,0.1,0,0.2,4.1,0,7,0.2,0,0.2,7,color=magnitude,linecolor=blue
Return to Index for Example Worksheets
Download Help Document