I am reviewing Numerical Recipes method on solving ODEs via relaxation (Chapter 18.3 in the 3rd edition) and they chose a finite difference method I am unfamiliar with (Equation 18.3.2):

\begin{equation} \frac{\textrm{d}y}{\textrm{d}x} = g(x,y),\\ \longrightarrow \frac{y_k - y_{k-1}}{x_k-x_{k-1}} = g\left(\frac{1}{2}(x_k+x_{k-1}), \frac{1}{2}(y_k+y_{k-1})\right). \end{equation}

Unfortunately, they just refer to it as a "not unique" method of turning the ODE into a finite difference equation. What is new to me is the averaging of the variables for the nonhomgeneous part of the equation, $g(x,y)$. It almost reminds me of Crank-Nicholson, but instead of averaging the entire $g(x,y)$ temporally, it is averaging the variables themselves spatially, i.e., not just a difference of spatial verse temporal. E.g., say if $x$ was the familiar time coordinate, $x\rightarrow t$, then Crank-Nicholson would look like

\begin{equation} \frac{\textrm{d}y}{\textrm{d}t} = g(t,y),\\ \longrightarrow \frac{y^n - y^{n-1}}{t^n-t^{n-1}} = \frac{1}{2} \left\{g\left(t^n, y^n\right) + g\left(t^{n-1}, y^{n-1}\right)\right\} \neq g\left(t^{n+1/2}, y^{n+1/2}\right). \end{equation}

Perhaps there is not a general name for this method, but a even general discussion for how to treat the nonhomgeneous part of the equation in terms of finite differences would be helpful. The method intuitively seems "better," as you are saying the mean slope between $x_k$ and $x_{k-1}$, i.e., the left-hand side of equation 1, is equal to the slope at the midpoint (the right-hand side), rather than the slope at $x_k$ (the traditional backwards difference method). This is somewhat in line with the philosophy of Crank-Nicholson, which says the mean of the time derivatives at $t^n$ and $t^{n-1}$. But again, this is subtly different that the actual derivative at the half-way time step (the $\neq$ part of equation 2).


A common name for this technique is the (implicit) midpoint method, with the ODE being evaluated using the equivalent of the midpoint rule for Riemann integrals, just as Crank-Nicolson is the the equivalent of trapeziodal rule (note there isn't an h in the name, although autocorrection tools often introduce one). Unfortunately this name isn't absolutely universal, and the method also fits into a lot of other taxonomies of numerical techniques.

| cite | improve this answer | |

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.