Given differential equations $$\ddot x=Gm_1\frac{y-x}{|y-x|^3}\hspace{2cm}\ddot y=Gm_2\frac{x-y}{|y-x|^3}$$ with constant $G,m_1,m_2$ I want to solve them with the Euler method. I know I have to reduce the equations to a system of first order. So I did for $\ddot x$

$$\frac{d}{dt}\begin{pmatrix}v_0\\v_1\end{pmatrix}=\begin{pmatrix}v_1\\Gm_1\frac{y-v_0}{|v_0-y|^3}\end{pmatrix}$$and the same for $\ddot y$. But now my problem is that the right side depends on the other equation and the other way round. How can you get a system of first order so you can apply Euler to it?


I'm assuming, these are two-body gravitational interaction equations, not that it matters from math standpoint.

Anyhow, you've started well, just missed one point. You have to combine all four equations into one, even though system gets coupled.

So, before doing it, first write them down. $$ \begin{align} \dot x & = u \\ \dot u & = G m_1 \frac {y-x}{|y-x|^3} \\ \dot y & = v \\ \dot v & = G m_1 \frac {x-y}{|x-y|^3} \end{align} $$ So, now it's well formed (from Euler method standpoint) system of ODEs of general type $$ \dot{\mathbf y} = \mathbf{f}(\mathbf y, t) $$ where $$ \mathbf y = [x,u,y,v]^T $$ and $$ \mathbf f = \left [ \begin{array}{c} x \\ G m_1 \frac {y-x}{|y-x|^3} \\ y \\ G m_2 \frac {x-y}{|x-y|^3} \end{array} \right ] $$ Now, you can proceed to the Euler method from this point. $$ \mathbf y_{n+1} = \mathbf y_n + h \mathbf f(\mathbf y_n) $$ or, explicitly $$ \left [ \begin{array}{c} x_{n+1} \\ u_{n+1} \\ y_{n+1} \\ v_{n+1} \end{array} \right ] = \left [ \begin{array}{c} x_n \\ u_n \\ y_n \\ v_n \end{array} \right ]+ h \cdot \left [ \begin{array}{c} u_n \\ G m_1 \frac {y_n-x_n}{|y_n-x_n|^3} \\ v_n \\ G m_2 \frac {x_n-y_n}{|x_n-y_n|^3} \end{array} \right ] $$ So, if you do it iteratively with sufficiently small $h$, you'll get $1^{st}$ order approximation of solution of the ODEs given.


You need some initial values $[x_0, u_0, y_0, v_0]^T$ as a starting point, and those are usually know as physical initial conditions. They are of the form $$ \begin{align} x(0) &= something \\ u(0) &= \dot x(0) = something \\ y(0) &= something \\ v(0) &= \dot y(0) = something \end{align} $$

  • $\begingroup$ thanks. But I am still a little bit confused. I need $y=[x,z,y,v]^T$, right, but what's explicitly in the vector now? $\endgroup$ – sheldoor May 12 '13 at 14:14
  • $\begingroup$ @sheldoor Ok, I'll try to extend my answer. $\endgroup$ – Kaster May 12 '13 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.