[Math] Implicit Euler for 2nd Order DE

numerical methodsordinary differential equations

I have given the following 2nd order DE:

$$
\ddot{q_1} = – \frac{q_1}{|q|^3}
$$
$$
\ddot{q_2} = – \frac{q_2}{|q|^3}
$$
with $|q| = \sqrt{q_1^2 + q_2^2}$

The assignment is to solve this using explicit and implizit Euler. As for the explicit, I could split this into a system of 1st order DEs using $\dot{q} = p$, thus I had
$$
\dot{p_1} = – \frac{q_1}{|q|^3}
$$
$$
\dot{p_2} = – \frac{q_2}{|q|^3}
$$
$$
\dot{q} = p
$$

But now I am stuck at the implicit Euler. The reason is: The equation for this is $\dot{y}_{n+1} = y_n + \Delta t f(y_{n+1})$.

My problem now is: I do not have all q or all p in my function f, but $\dot{p} = f(q)$ So how can I formulate this method?

Best Answer

Set $y_1 = q_1$, $y_2 = \dot{q}_1$, $y_3 = q_2$, and $y_4 = \dot{q}_2$. Then, your system of equations is $$\dot{\mathbf{y}} = f(t,\mathbf{y}) = \begin{pmatrix} y_2 \\ -\frac{y_1}{(y_1+y_3)^{3/2}} \\ y_4 \\ \frac{y_3}{(y_1+y_3)^{3/2}}\end{pmatrix}.$$

This form should be compatible with both implicit and explicit Euler methods.