# Comparing finite differences methods

I am currently writing my dissertation on different methods for pricing barrier options. As part of this, I have implemented a finite differences method for solving one partial differential equation, and another finite differences method for solving another partial differential equation.

I would like to create some plots or tables, to show which of these methods are preferable. My problem is, that I have no idea which plots to create. I do not really have much experience with this, so I don't know what will be valuable. Does anyone have any suggestions?

I suppose it is worth mentioning that I have available an analytical formula for the solution.

## 1 Answer

A log-log plot of solution accuracy versus amount of work performed is pretty common, since most methods' errors behave like a power of mesh size.

In particular, have a look at how books like Solving Ordinary Differential Equations by Hairer, Norsett, Wanner, present differences between finite difference methods.

There can also sometimes be qualitative differences between methods, e.g., a monotone method might be guaranteed to produce nonnegative solutions to a diffusion equation. These can be pointed out directly.

• How would I best measure solution accuracy? By using a matrix norm, for instance, on the matrix $E = (e_{i,j})_{i,j}$, where $e_{i,j} = \hat{u}_{i,j} - u(t_i,x_j)$? Here I assume that $\hat{u}_{i,j}$ is the finite differences approximation to $u(t_i,x_j)$. – torbonde Aug 13 '15 at 20:16
• You typically want to fix a time $t_i$ and take the max norm over all points $x_j$, so as to isolate spatial and temporal discretization errors. Other options involve various discrete norms of $e_{i,j}$. – Jesse Chan Aug 13 '15 at 20:40
• @torbonde Yes, but make sure the norm is independent of the choice of mesh. E.g. $\sum_{i,j} |e_{i,j}|$ is a reasonable measure, but it scales with mesh size as $\propto N_xN_t$, so divide it by $N_xN_t$. In essence, you have to write the mesh-independent integral defining the error, e.g., $\int |\hat u - u(T,x)|\,dx$ for the error in final solution, and then discretize that integral appropriately on your grid as $N_x^{-1}\sum_j |e_{M,j}|$. – Kirill Aug 13 '15 at 20:45
• @Kirill thank you very much. It is very helpful. – torbonde Aug 13 '15 at 20:52
• I don't think the order of a particular discretization is a good measure on how one scheme is "better" than another. The order of discretization just gives an estimate on how the error is reduced according to the grid spacing. The problem is that you are solving two different things (different PDE's, using different schemes) so, strictly speaking, no comparison can be easily done since it would be difficult to separate whether a discrepancy comes from the PDE, the FD scheme, or the implementation itself. Also, I think a max norm is easier and conveys the same info than the spectral norm. – Kbzon Aug 14 '15 at 11:12