6  Slope

This tool allows the visualization of simple one or two dimensional differential equations.

The Slope Widget

The Slope Widget

6.1 One Dimensional differential equation

Set \(x' = 1\). This means that \(x(t) = t (t_0 = 0)\). Set \(y' =\) to the differential equation which should be considered.
[Calc Slope Field] computes and displays the slope field of the differential equation in the \(t-y\) plane.

6.2 Two Dimensional differential equation

Set \(x' =\) and \(y' =\) to your differential equation system which should be considered.
[Calc Slope Field] shows the slope field of the system in the \(x-y\) phase plane.

6.3 Parameters and Built in Math functions

Up to five parameters (\(a, b, c, d, e\)) can be used within the formulas.
The following math functions can be used within the formulas:
\(\verb# acos asin atan cos cosh exp log log10#\)
\(\verb# pow sin sinh sqrt tan tanh abs#\)

6.4 Linear Model

If the parameters \(a, b, c, d\) are set [linear] makes a linear system from these parameters: \[ \left ( \begin{array}{c} x'\\ y'\end{array} \right ) = \left ( \begin{array}{cc} a&b\\ c&d\end{array} \right ) \left ( \begin{array}{c} x\\y\end{array} \right ) \] The Eigenvalues und Eigenvectors, the trace and determinant are displayed in the Info window.

6.5 Eigenrichtung

The directions of the Eigenvectors are plotted. This button is only active if we have non-complex Eigenvectors.

6.6 Reload

Pressing this button forces a reload of the original differential equation or differential equation system when needed, especially after the derived linear model has been computed and you want to return the non-linear.

Python dependent functions

The functions Calc FP, Make Linear and Normalize require Python for symbolic analyses.
If no suitable Python is found (see [Custom] (2.1)), those buttons will not appear.

6.7 Calc FP

The fixed points of the the defined system are computed and displayed in the Info window.

6.8 Make Linear

The linear model is derived and the fixed points are derived. If there are more than one fixed point, a selection window is opened to select one of the fixed points decribed by its value. After selection the according slope field is computed and displayed.
After the linear model has been derived, those input fields and function buttons which are mean- ingless for the derived linear model are disabled. They all are enabled again after reloading the original equations by Reload or loading a new model by [Load].

6.9 Normalize

Normalizing serves to compare models of different types by unifying the scales and shifing the fixed points to [1,1] in the [x,y]-plane. The process is as follows for generic model: Let the model be described by: \[\begin{eqnarray*} \dot x &=& (g(x) -y \cdot h(x))\cdot x \\ \dot y &=& a\cdot ( x\cdot h(x) -m ) \cdot y \end{eqnarray*}\]

For a fixed point \((x^*,y^*)\) with \(x^*>0\) and \(y^*>0\)
the normalized model is derived by the substitution \(X=x/x^*\) and \(Y=y/y^*\)

\[\begin{eqnarray*} \dot X &=& \frac{dX}{dt} = \frac{1}{x^*}\cdot\frac{dx}{dt} = (g(X\cdot x^*) -Y\cdot y^* \cdot h(X\cdot x^*))\cdot X \\ \dot Y &=& \frac{dY}{dt} = \frac{1}{y^*}\cdot\frac{dy}{dt} = a \cdot (X\cdot x^*\cdot h(X\cdot x^*) -m)\cdot Y \end{eqnarray*}\]

The formulas in the function entries are replaced by those for the normalized model where X stands for the term \((X \cdot x^*)\) and Y stands for the term \((Y \cdot y^*)\).
The fixed point coordinates are denoted by Xf and Yf.
If none or only one considerable fixed point is found, a message is given in the info window; in case of more than one considerable fixed points are found a selection window is opened to select one of the fixed points identified by its coordinates.
After selection of a fixed point the according slope field is computed and displayed.

If at least one considerable fixed point is found, the slope field of the normalized model is computed and displayed.
After the linear or a normalized model has been derived, those input fields and function buttons which are meaningless for the derived model are disabled.
They all are enabled again after reloading the original equations by Reload or loading a new model by [Load].

6.10 Resolution

The slider Resolution sets the resolution of the slope field. After setting a new value the slope field is refreshed.

6.11 Endtime

The slider Endtime sets the endtime for the evaluation of the trajectories.

6.12 Isoclines

The isoclines of the system \((x_0 = 0, y_0 = 0)\) can be plotted. Either the single isoclines [X isoclines] or [Y isoclines] or both with [XY Isoclines]. If Python is avaiable the isoclines will be derived by symbolic analysis otherwise they will be determined numerically, which is less accurate.

6.13 Scale

The \(x\) and \(y\)ranges of the plotting area for the slope field can be set.
Applying the input values by [Apply] refreshes the slope field;
[Cancel] just closes the window and rejects the changes.

6.14 ReSetScale

This button resets the the range of the plotting area to the initial values.

6.15 Autoscale

The maximum values of \(x\) and \(y\) are evaluated and the plotting area is adapted to those values accordingly.

6.16 PosScale

The \(x\) and \(y\) range is shifted to the positive quadrant.

6.17 Trajectories

Trajectories to given initial values can be plotted in two ways:

  1. Setting initial values for \(x\) and \(y\) in \(x0 =\) and \(y0 =\) and pressing [Start]
    or
  2. Setting an initial value by a left mouse click within the slope field. In this case it is helpful to switch on Show coor. to see the coordinates of the mouse cursor.

The calculation is done by evaluating the differential equation with a second order method. By middle mouse click the evaluation is done with Euler’s method.
The time step \(\Delta t\) for the evaluation is \(0.01\).
The simulation stops either at Endtime or can be stopped by a right mouse click in the slope field.

6.18 Multi-Trajectories

Although trajectories can be startet from any point in the slope field, it might be uncomfortable to inspect areas of interest by a lot of single clicks.
On the right hand side of the [Start] button you can select whether to draw a line or a circle for defining a set of inital values for trajectories.
By holding the <CTRL> - key and pressing the left mouse button a line or circle can be drawn from the point of origin by dragging the mouse pointer while keeping <CTRL> pressed. After releasing the mouse button the line resp. the circle will be transformed into a set of initial values displayed as a set of blue dots.
The number of dots is the half values of the Resolution parameter.
After pressing [Start] the evaluation of the trajectories for each of those initial points begins.
If a set of initial values is drawn but should not apply, it can be erased by pressing the <Escape> - key on the keyboard.

6.19 Check Buttons

Time Plot

In the case of a two dimensional system the time information cannot be seen in the phase di- agram. If Time Plot is switched on a second plot window is opened showing the temporal evolution of the trajectory.

The TimePlot Window

The TimePlot Window

Show Coor.

If Show Coor. is switched on the coordinates in the slope field are shown at the mouse pointer.

Show Points

If Show Points is switched on a dot is displayed in the slope field after each integration step of the trajectory. The distance between those dots depend on the value of \(\Delta t\).

AutoScale

If AutoScale is switched on the definition of a scaling/zooming area by <Shift>-Left Mouse Button is directly applied.
Otherwise Shift-Right Mouse Button will initiate the scaling.
If a scaling rectangle is drawn but should not apply, it can be erased by pressing the <Escape> - key on the keyboard.

6.20 Load, Save & Edit

Equations, parameter values, coordinates, resolution and endtime can be saved in a file. These files get automatically the extension .tgf and are stored normally in <Path to Mathtools>/mftfiles.
After loading a file the equations, parameter values and the stored coordinate values, resolution and endtime are set.
The files can also be edited to set f.e. coordinate values not provided by default.
This editing functionality does not work under windows at the moment.
Please use your usual editor to edit the files manually.

6.21 PS print/Print

A Postscript output is generated and stored in <Path to Store Directory>/plots.
The PS-files are named automatically.