Differential Equation Systems I – ODEs

 
Stefan Kuntsche, Sanam Sabeti Adibpour

The following tutorial will show you how to describe and solve differential equation systems.

ODE – The Van der Pol Oscillator

First, the Van der Pol Oscillator will be implemented. The problem is stated as follows:

Equation System Van der Pol
\frac{dx}{dt} = y
\frac{dy}{dt} = a \cdot (1-(x)^{2})\cdot y - x

Notation Diff Eqs

Base Names:

Name Description
a parameter a
t differential variable t
x value x
y value y

Evaluation

  • Design value

$latex a = 5$

  • Differential variable and initial values for the state variables

t in  [0, 20]
x = 2.0
y = 0

Requirements It is assumed that you have basic knowledge about Notations, Equations, and Equation Systems in MOSAICmodeling. If you do not know how to create and modify these model elements, please work through Notations and Variables first.

Creating the Notation
  • Create a Notation and enter the names as Base Names. If you need help, please follow Creating the Notation in the tutorial Notations and Variables.
  • Note that the differential variable t is part of the notation as well. As far as the Notation is concerned, there is no difference between the identifiers atx, and y.
Creating the equations
  • In MosaicLatex there is a special command for the differential operator.To create \frac{dA}{dB} please use the code:\diff{A}{B}
  • In the current version, MOSAICmodeling only allows first order ordinary differential equations. The differential operator must be on the left hand side.
  • Enter the equations one by one as described in the tutorial Notations and Variables.
  • If you had problems in entering the correct code, use the following

For Equation one:

\diff{x}{t} = y

For Equation two:

\diff{y}{t} = a \cdot (1-(x)^{2})\cdot y - x
Creating the equation system
  • The equations can be added to an equation system in the usual way. If you need help, please refer to Creating the equations in the tutorial Notations and Variables.
Evaluating the equation system
  • Load the equation system in Evaluate and go the tab named Variable Specification. If you need help, refer to the tutorial Notations and Variables.
  • You will note that x and y are already sorted into the table named State Variables while the differential variablet is put correctly into a corresponding section on the right hand side of the user interface.
  • Enter the initial values for the state variables and the value for the design variable as stated above in the paragraph Evaluation of the problem description.
  • Enter the limits of the interval of the differential variable in the fields named Diff Var Start and Diff Var End.
  • Go to the tab named Evaluation and make sure that the language specificator C++ BzzMath ODE Stiff is activated in predefined Language Specification dropdown list. Press [Generate Code] and then [Evaluate] to solve the equation system on the modeling server.
  • Select the tab Results. In the now visible section select the tab DE Variable Values. Here you find the trajectory list for the differential variable and the state variables.
  • Select the tab DE Plot Results and tick the boxes for x and y in the column Plot of the variables table.