$$ \newcommand{\D}{\displaystyle} \renewcommand{\eqref}[1]{Eq.~(\ref{#1})} $$




2.6.5 Euler's method for a system

Euler's method may of course also be used for a system. Let's look at a simultaneous system of \( p \) equations $$ \begin{align} &y'_1=f_1(x,y_1,y_2,\dots y_p) \nonumber\\ &y'_2=f_2(x,y_1,y_2,\dots y_p) \nonumber\\ &. \tag{2.60}\\ &.\nonumber\\ &y'_p=f_p(x,y_1,y_2,\dots y_p)\nonumber \end{align} $$ with initial values $$ \begin{equation} \tag{2.61} y_1(x_0)=a_1,\ y_2(x_0)=a_2,\dots,\ y_p(x_0)=a_p \end{equation} $$ Or, in vectorial format as follows, $$ \begin{align} \tag{2.62} \mathbf{y'}&=\mathbf{f}(x,\mathbf{y})\\ \mathbf{y}&(x_0)=\mathbf{a} \nonumber \end{align} $$ where \( \mathbf{y'} \), \( \mathbf{f} \), \( \mathbf{y} \) and \( \mathbf{a} \) are column vectors with \( p \) components.

The Euler scheme (2.55) used on (2.62) gives $$ \begin{equation} \tag{2.63} \mathbf{y_{n+1}}=\mathbf{y_n}+h\cdot \mathbf{f}(x_n,\mathbf{y_n}) \end{equation} $$ For a system of three equations we get $$ \begin{align} y'_1=&y_2\nonumber\\ y'_2=&y_3 \tag{2.64}\\ y'_3=&-y_1y_3\nonumber \end{align} $$ In this case (2.63) gives $$ \begin{align} &(y_1)_{n+1}=(y_1)_n+h\cdot (y_2)_n\nonumber\\ &(y_2)_{n+1}=(y_2)_n+h\cdot (y_3)_n \tag{2.65}\\ &(y_3)_{n+1}=(y_3)_n-h\cdot (y_1)_n\cdot (y_3)_n\nonumber\\ \tag{2.66} \end{align} $$ with \( y_1(x_0)=a_1,\ y_2(x_0)=a_2,\text{ and }y_3(x_0)=a_3 \)

In the section 2.4 Reduction of Higher order Equations we have seen how we can reduce a higher order ODE to a set of first order ODEs. In (2.67) and (2.68) we have the equation \( \frac{d^2z}{dt^2}=g-\alpha\cdot \left(\frac{dz}{dt}\right)^2 \) which we have reduced to a system as $$ \begin{align*} \frac{dz}{dt}= v&\\ \frac{dv}{dt}= g&-\alpha\cdot v^2 \end{align*} $$ which gives an Euler scheme as follows, $$ \begin{align*} &z_{n+1}=z_n+\Delta t\cdot v_n\\ &v_{n+1}=n_n+\Delta t\cdot [g-\alpha(v_n)^2]\\ &\text{med }z_0=0,\ v_0=0 \end{align*} $$