Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

 Open In Colab

Up to this point, we have focused on first-order differential equations. Any higher-order ordinary differential equation can be converted into a coupled system of first-order equations via reduction of order by introducing auxiliary state variables for the lower-order derivatives.

For example, consider a general second-order ODE:

d2ydt2=f ⁣(t,y,dydt)\frac{\mathrm{d}^2 y}{\mathrm{d}t^2} = f\!\left(t, y, \frac{\mathrm{d}y}{\mathrm{d}t}\right)

Defining the auxiliary velocity variable z=dydtz = \frac{\mathrm{d}y}{\mathrm{d}t} transforms the single second-order equation into a system of two first-order equations:

dydt=zdzdt=f(t,y,z)\begin{aligned} \frac{\mathrm{d}y}{\mathrm{d}t} &= z \\ \frac{\mathrm{d}z}{\mathrm{d}t} &= f(t, y, z) \end{aligned}

which can be integrated directly using any vector Runge-Kutta or multistep solver!

Example: Swinging Pendulum

The nonlinear equation of motion for a rigid pendulum of mass mm and length ll under gravity gg is:

mld2Θ(t)dt2=−mgsin⁡ ⁣(Θ(t))m l \frac{\mathrm{d}^2\Theta(t)}{\mathrm{d}t^2} = -m g \sin\!\big(\Theta(t)\big)
22.01.01-pendulum.png

Applying reduction of order, we define the two-component state vector y(t)\mathbf{y}(t):

y(t)=[y1(t)y2(t)]=[Θ(t)Θ˙(t)]\mathbf{y}(t) = \begin{bmatrix} y_1(t) \\ y_2(t) \end{bmatrix} = \begin{bmatrix} \Theta(t) \\ \dot{\Theta}(t) \end{bmatrix}

Differentiating y(t)\mathbf{y}(t) with respect to time gives the first-order vector ODE system:

dydt=[Θ˙(t)Θ¨(t)]=[y2−glsin⁡(y1)]=f(t,y)\frac{\mathrm{d}\mathbf{y}}{\mathrm{d}t} = \begin{bmatrix} \dot{\Theta}(t) \\ \ddot{\Theta}(t) \end{bmatrix} = \begin{bmatrix} y_2 \\ -\frac{g}{l} \sin(y_1) \end{bmatrix} = \mathbf{f}(t, \mathbf{y})