# Dynamical Systems

## Fitting multivariate ODE models with brms

This article illustrates how ordinary differential equations and multivariate observations can be modelled and fitted with the brms package (Bürkner (2017)) in R1. As an example I will use the well known Lotka-Volterra model (Lotka (1925), Volterra (1926)) that describes the predator-prey behaviour of lynxes and hares. Bob Carpenter published a detailed tutorial to implement and analyse this model in Stan and so did Richard McElreath in Statistical Rethinking 2nd Edition (McElreath (2020)).

## Phase plane analysis in R

The forthcoming R Journal has an interesting article about phaseR: An R Package for Phase Plane Analysis of Autonomous ODE Systems by Michael J. Grayling. The package has some nice functions to analysis one and two dimensional dynamical systems. As an example I use here the FitzHugh-Nagumo system introduced earlier: \begin{aligned} \dot{v}=&2 (w + v - \frac{1}{3}v^3) + I_0 \\\\\\ \dot{w}=&\frac{1}{2}(1 - v - w)\\\\\\ \end{aligned} The FitzHugh-Nagumo system is a simplification of the Hodgkin-Huxley model of spike generation in squid giant axon.

## Simulating neurons or how to solve delay differential equations in R

I discussed earlier how the action potential of a neuron can be modelled via the Hodgkin-Huxely equations. Here I will present a simple model that describes how action potentials can be generated and propagated across neurons. The tricky bit here is that I use delay differential equations (DDE) to take into account the propagation time of the signal across the network. My model is based on the paper: Epileptiform activity in a neocortical network: a mathematical model by F.

## Hodgkin-Huxley model in R

One of the great research papers of the 20th century celebrates its 60th anniversary in a few weeks time: A quantitative description of membrane current and its application to conduction and excitation in nerve by Alan Hodgkin and Andrew Huxley. Only shortly after Andrew Huxley died, 30th May 2012, aged 94. In 1952 Hodgkin and Huxley published a series of papers, describing the basic processes underlying the nervous mechanisms of control and the communication between nerve cells, for which they received the Nobel prize in physiology and medicine, together with John Eccles in 1963.

## Dynamical systems in R with simecol

This evening I will talk about Dynamical systems in R with simecol at the LondonR meeting. Thanks to the work by Thomas Petzoldt, Karsten Rinke, Karline Soetaert and R. Woodrow Setzer it is really straight forward to model and analyse dynamical systems in R with their deSolve and simecol packages. I will give a brief overview of the functionality using a predator-prey model as an example. This is of course a repeat of my presentation given at the Köln R user group meeting in March.

## Logistic map: Feigenbaum diagram in R

The other day I found some old basic code I had written about 15 years ago on a Mac Classic II to plot the Feigenbaum diagram for the logistic map. I remember, it took the little computer the whole night to produce the bifurcation chart. With today’s computers even a for-loop in a scripting language like R takes only a few seconds. logistic.map <- function(r, x, N, M){ ## r: bifurcation parameter ## x: initial value ## N: number of iteration ## M: number of iteration points to be returned z <- 1:N z[1] <- x for(i in c(1:(N-1))){ z[i+1] <- r *z[i] * (1 - z[i]) } ## Return the last M iterations z[c((N-M):N)] } ## Set scanning range for bifurcation parameter r my.