8.1: The Euler Method
In general, Equation \ref{8.1} cannot be solved analytically, and we begin by deriving an algorithm for numerical solution. Consider the general second-order ode given by
\[\ddot{x}=f(t, x, \dot{x}) . \nonumber \]
We can write this second-order ode as a pair of first-order odes by defining \(u=\dot{x}\) , and writing the first-order system as
\[\begin{aligned} &\dot{x}=u, \\ &\dot{u}=f(t, x, u) . \end{aligned} \nonumber \]
The first ode, Equation \ref{8.2}, gives the slope of the tangent line to the curve \(x=x(t)\) ; the second ode, Equation \ref{8.3}, gives the slope of the tangent line to the curve \(u=u(t)\) . Beginning at the initial values \((x, u)=\left(x_{0}, u_{0}\right)\) at the time \(t=t_{0}\) , we move along the tangent lines to determine \(x_{1}=x\left(t_{0}+\Delta t\right)\) and \(u_{1}=u\left(t_{0}+\Delta t\right)\) :
\[\begin{aligned} &x_{1}=x_{0}+\Delta t u_{0} \\ &u_{1}=u_{0}+\Delta t f\left(t_{0}, x_{0}, u_{0}\right) \end{aligned} \nonumber \]
The values \(x_{1}\) and \(u_{1}\) at the time \(t_{1}=t_{0}+\Delta t\) are then used as new initial values to march the solution forward to time \(t_{2}=t_{1}+\Delta t\) . As long as \(f(t, x, u)\) is a wellbehaved function, the numerical solution converges to the unique solution of the ode as \(\Delta t \rightarrow 0\) .