[Math] implicit midpoint method for newton’s laws

numerical methodsordinary differential equations

I've been banging my head against the way trying to understand the Wikipedia article for the implicit midpoint method. I find the notation confusing which isn't helping. My goal is to use the implicit midpoint method to time advance a physics simulation based on Newton's Laws.

Given $$y(t) = (x(t),v(t)) = y_{n}$$ and $$\dot{y}(t) = (\dot{x}(t),\dot{v}(t)) = (v(t),a(t)) = (v(t),\frac{F(x(t))}{m}) = \dot{y}_{n}$$

Assuming I know $x(0),v(0),F(0)$ I would like to use the implicit midpoint method to find $y(t+h)=y_{n+1}$

As far as I can understand the article the update rule would be

$$y_{n+1} = y_{n} + \frac{h}{2}(\dot{y}_{n} + \dot{y}_{n+1})$$

but I'm not even sure that's correct because the way they write it in the article makes the fact that both sides of the equation depend on $y_{n+1}$ very explicit. Whereas the way I've written it it's not clear that is the case.

I was thinking I'd use Newton's method to solve this implicit system of equations which I think means that I need to do something like write

$$G(y_{n+1}) = y_{n+1} – y_{n} – \frac{h}{2}(\dot{y}_{n} + \dot{y}_{n+1}) = 0$$

but I really don't think that's correct because for Newton's method to work I need to be able to guess values for $y_{n+1}$ and evaluate $G$ at those values. However I need a value for $\dot{y}_{n+1}$ to evaluate $G$.

EDIT:

It may be useful to show how I ended up with this form for the midpoint method.
My understanding of the notation $f(t,y) = \dot{y}(t)$ is that the $t$ parameter of $f$ only matters if there is an explicit dependence on time. For example if $\dot{y}(t) = t + y(t)$ then

$$f
(t + \frac{h}{2},\frac{1}{2}(y(t) + y(t+h)) = t + \frac{h}{2} + \frac{1}{2}(y(t) + y(t+h))
$$

Since there is no explicit dependence of $t$ in these equations I dropped the $t + \frac{h}{2}$ term and wrote

$$
f(t + \frac{h}{2},\frac{1}{2}(y(t) + y(t+h)) = \dot{y}(t) = \frac{1}{2}(\dot{y}(t) + \dot{y}(t+h))
$$

Thank you for taking the time to read my question.

Best Answer

For the midpoint method you approximate \begin{align} \frac{y(t+h)-y(t)}h&\approx\dot y(t+\tfrac h2) \\ &=f(t+\tfrac h2,y(t+\tfrac h2)) \\ &\approx f(t+\tfrac h2,\tfrac12(y(t+h)+y(t))). \end{align} All approximations with an error $O(h^2)$

This gives the method $$ y_{k+1}=y_k+hf(t+\tfrac h2,\tfrac12(y_k+y_{k+1})) $$ This can be decomposed into first one step of the implicit Euler method and then one of the explicit Euler method, both with half the step size \begin{align} \text{implicit Euler: }&&y_{k+\frac12}&=y_k+\tfrac h2 f(t+\tfrac h2,y_{k+\frac12})\\ \text{explicit Euler: }&&y_{k+1}&=y_{k+\frac12}+\tfrac h2 f(t+\tfrac h2,y_{k+\frac12}) \end{align} where $(t+\tfrac h2,y_{k+\frac12})$ is the midpoint of the segment connecting the iteration points with $y_{k+\frac12}=\frac12(y_k+y_{k+1})$

Related Question