Integrating ordinary differential equations
The following examples demonstrate how to integrate various
differential equations using
kontrast.integrateODE(). Please refer to the
integrating differential equations
for details on all individual input and output properties.
Simple sets of equations
The following interactive code examples show first how to use the derivative callback function and secondly how to enter the system of equations using the Kontrast math syntax.
The following set of differential equations describes the sine and cosine functions:
The following set of differential equations is equivalent to the equation of motion of the harmonic oscillator (m\ddot q=-kq-\gamma \dot q):
Incorporating conditional logic
Decay with switching the decay constant
In the following example we include a jump in the decay constant
Approaches like this are best implemented using the derivative
callback function (as it provides the most flexibility). However, in
this particular example we can also use the math parser with the