Simulating measurement data from a dynamical system and its derivative

52 Views Asked by At

I am implementing the SINDy algorithm in Python.
Discovering governing equations from data by sparse identification of nonlinear dynamical systems

I have a question concerning the simulation of dynamical systems.

Lets say we have measurement data of the following form and that the way features $x, y$ and $z$ change in time gets governed by a dynamical system with ODE's that we do not know: $$ \begin{array}{ccc} x(t_1) & x(t_2) & \ldots & x(t_n) ­\\ y(t_1) & y(t_2) & \ldots & y(t_n) ­\\ z(t_1) & z(t_2) & \ldots & z(t_n) \\ \end{array} $$ In this example we have 3 features that got measured at $n$ different points in time.

I implemented an algorithm in Python that takes as an input this measurement data and its derivatives: $$ \begin{array}{ccc} x'(t_1) & x'(t_2) & \ldots & x'(t_n)\\ y'(t_1) & y'(t_2) & \ldots & y'(t_n)\\ z'(t_1) & z'(t_2) & \ldots & z'(t_n)\\ \end{array} $$ The algorithm serves to identify the underlying dynamical system. In general these derivatives can be computed by the total variation regularized derivative algorithm, or TVregdiff.

My problem is that in order to test my algorithm and see if it identifies the correct dynamical system, I want to simulate measurement data from a given dynamical system but I am not sure if I am doing it correctly.

Lets say I want to have measurement data from the Lorenz Attractor, so we have the following dynamical system: $$ \begin{cases} x' = -\sigma\cdot(x_0 - y_0) ­\\ y' = \rho\cdot x_0 - y_0 - x_0\cdot z_0 ­\\ z' = -\beta\cdot z_0 + x_0\cdot y_0 \end{cases} $$ Now in order to find the data for $x, y$ and $z$, I integrate over n timesteps (using scipy's integrate.odeint) in order to solve the differential equations.

To find the derivatives I took the dynamical system and just inserted the $x(t)$, $y(t)$ and $z(t)$. So in order to find $x'(t_3), y'(t_3)$ and $z'(t_3)$ I would do this: $$ \begin{cases} x'(t_3) = -\sigma\cdot(x(t_3) - y(t_3)\\ y'(t_3) = \rho\cdot x(t_3) - y(t_3) - x(t_3)\cdot z(t_3) \\ z'(t_3) = -\beta\cdot z(t_3) + x(t_3)\cdot y(t_3) \end{cases} $$ I do this for all time steps and from that I find the derivatives of $x,y,z$ at all timesteps.

Could you please tell me if there are any errors in my thoughts about this? Thanks a lot in advance