31.3: Ordinary Differential Equations
- Page ID
- 69512
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\dsum}{\displaystyle\sum\limits} \)
\( \newcommand{\dint}{\displaystyle\int\limits} \)
\( \newcommand{\dlim}{\displaystyle\lim\limits} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\(\newcommand{\longvect}{\overrightarrow}\)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\ket}[1]{\left| #1 \right>}\)
\(\newcommand{\bra}[1]{\left< #1 \right|}\)
\(\newcommand{\braket}[2]{\left< #1 \vphantom{#2} \right| \left. #2 \vphantom{#1} \right>}\)
\(\newcommand{\braopket}[3]{\left< #1 \vphantom{#2}\vphantom{#3} \right| #2 \vphantom{#1}\vphantom{#3} \left| #3 \vphantom{#1}\vphantom{#2} \right>}\)
\(\newcommand{\qmvec}[1]{\mathbf{\vec{#1}}}\)
\(\newcommand{\op}[1]{\hat{\mathbf{#1}}}\)
\(\newcommand{\expect}[1]{\langle #1 \rangle}\)
\(\newcommand{\dfn}[1]{\emph{\textbf{#1}}}\)
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:


