31.3: Ordinary Differential Equations
- Page ID
- 69512
Ordinary Differential Equations (ODEs) are yet another for of linear dynamical systems and are a scientific model used in a wide range of problems of the basic form:
\[\dot{x} = Ax \nonumber \]
These are equations such that the is the instantaneous rate of change in \(x\) (i.e. \(\dot{x}\) is the derivative of \(x\)) is dependent on \(x\). Many systems can be modeled with these types of equations.
Here is a quick video that introduces the concepts of Differential Equations. The following is a good review of general ODEs.
Now consider an ODE as a system of linear equations:
\[\dot{x_t} = A x_t \nonumber \]
Based on the current \(x\) vector at time \(t\) and the matrix \(A\), we can calculate the derivative at \(\dot{x}\) at time \(t\). Once we know the derivative, we can increment the time to by some small amount \(dt\) and calculate a new value of \(x\) as follows:
\[x_{t+1} = x_t + \dot{x_t}dt \nonumber \]
Then we can do the exact sequence of calculations again for \(t+2\). The following function has the transition matrix (\(A\)), the starting state vector (\(x_0\)) and a number of time steps (\(N\)) and uses the above equations to calculate each state and return all of the \(x\) statues:
The following code generates a trajectory of points starting from x_0
, applying the matrix \(A\) to get \(x_1\) and then applying \(A\) again to see how the system progresses from the start state.
For example the following code uses the matrix \(A= \begin{bmatrix}1 & 1 \\ 1 & -2\end{bmatrix}\) and the starting point (0,0) over 50 timesteps to get a graph:
Let \(A= \begin{bmatrix}2 & 3 \\ 4 & -2\end{bmatrix}\)
Write a loop over the points \((−1.5,−1), (−1,2)(−1,2)\) and plot the results of the traj
function:
Let \(A= \begin{bmatrix}6 & -1 \\ 1 & 4\end{bmatrix}\)
Write a loop over the points \((−1.5,−1), (−1,2)(−1,2)\) and plot the results of the traj
function:
Let \(A= \begin{bmatrix}5 & 2 \\ -4 & 1\end{bmatrix}\)
Write a loop over the points \((−1.5,−1), (−1,2)(−1,2)\) and plot the results of the traj
function: