Roel
25 November 2014
A dynamical system is a system that displays behaviour over time.
Examples are an accelerating car, a lunar lander, and the spread of a virus in a population (such as Ebola).
These systems are deterministic, meaning that the time course is determined by the initial conditions and the motion equations.
In the 1960's Edward Lorenz discovered that simple deterministic systems can behave in an unpredictable way: these systems display deterministic chaos.
See http://en.wikipedia.org/wiki/Lorenz_system for background on the Lorenz system.
The deSolve package (by Soetaert et al.) can be used to simulate the behaviour of dynamical systems.
Shiny can be used to manipulate parameters and initial conditions in the browser.
The behaviour of the system is recalculated at every change in parameter or initial value.
A plot of the state variables is redrawn as soon as an input value is changed.
The plot below shows example behaviour of the Lorenz system of equations (only part of R code shown).
out = ode(y = state, times = times, func = Lorenz, parms = parameters)
plot(out[,"X"],out[,"Z"],type="l",col="darkgreen",lwd=2,xlab="X",ylab="Z")
An interactive version of the Lorenz system can be found at: https://roelb54.shinyapps.io/devdataproduct/
This Shiny application lets the end user experiment with the system.
The behaviour of the system (stable equilibrium vs deterministic chaos) depends on parameter values.
The Lorenz system is just one example of a dynamical system.
We have shown that it is easy to implement a simulation of the behaviour of a dynamical system in R and Shiny.
There are numerous other examples that can be implemented just as easily.
In principle, it should be possible to use R, Shiny and deSolve to set up a system where the end user can define his or her simulation (by specifying differential equations, state variables and parameters).