[Math] Trapezoidal rule for system of ODE

numerical methodsordinary differential equationssystems of equations

I studied the trapezoidal rule for first-order differential equations. If the
problem is
$$y' = f(t, y)$$
the rule is given by the recursive formula
$$y_{n + 1} = y_n + \frac12h(f(t_n, y_n) + f(t_{n + 1}, y_{n + 1}))$$

I came across the following exercise, which I don't know how to solve:

Apply the trapezoidal rule to the problem
$$\begin{cases}
x''(t) = -\frac{x(t)}{r^3} & x(0) = 0.5, x'(0) = 0\\
y''(t) = -\frac{y(t)}{r^3} & y(0) = 0, y'(0) = 0
\end{cases}$$
where $r = \sqrt{x(t)^2 + y(t)^2}$. In particular, obtain the recursive formula
that defines the consecutive approximations $\{x_n, y_n\}$ of $\{x(t_n),
y(t_n)\}$.

First of all, since it's not a first-order equation I converted the problem
into a system of $4$ equations and $4$ initial conditions, but now I don't know
how to proceed because $x$ and $y$ are connected since there's that $r$ factor.
Any hints?

Best Answer

The resulting problem would be: $$\left\{\begin{align*} \dot{x}&=u\\ \dot{y}&=v\\ \dot{u}&=-x/r^3\\ \dot{v}&=-y/r^3 \end{align*}\right.$$ with $u(0) = v(0) =y(0)= 0$ and $x(0) = 0.5$

Now you have with $\vec{w} = (x, y, u, v)^{T}$ and $\vec{f}=(u,v,-x/r^3,-y/r^3)^{T}$the following system: $$\frac{d\vec{w}}{dt} = \vec{f}(\vec{w})\tag{*}$$ Simply apply your integration rule to $(*)$. Since your numerical method is implicit, and $\vec{f}$ is non linear in $\vec{w}$, you will need some iterative solver to obtain the $\vec{w}^{n+1}$ vector solution.

Going further, permit me to apply the method to $(*)$. The resulting numerical scheme is: $$\vec{w}^{n+1}=\vec{w}^n+\frac{h}{2}\left(\vec{f}(\vec{w}^{n})+\vec{f}(\vec{w}^{n+1})\right)$$ The term $\vec{f}$ this time does not depend explicitly on time $t$.

Related Question