I am trying to derive the formula for the second-order second derivative of the function $f(z)$ in the case of non-uniform spacings.

I start by considering that, around $z=\zeta_k$:


where the primes indicate a differentiation with respect to $z$.

Then, I evaluate this formula at $\zeta_{k-1}$ and $\zeta_{k+1}$ and take the difference of the two to have an expression for $f''(\zeta_{k})$:

$$f(\zeta_{k-1}) = f(\zeta_{k-1})+ (\zeta_{k-1}-\zeta_{k})~f'(\zeta_{k})+\frac{(\zeta_{k-1}-\zeta_{k})^2}{2}f''(\zeta_{k})$$

$$f(\zeta_{k+1}) = f(\zeta_{k-1})+ (\zeta_{k+1}-\zeta_{k})~f'(\zeta_{k})+\frac{(\zeta_{k+1}-\zeta_{k})^2}{2}f''(\zeta_{k})$$

$$ f''(\zeta_{k}) = 2\frac{f(\zeta_{k+1})-f(\zeta_{k-1})}{(\zeta_{k+1}-\zeta_{k})^2 (\zeta_{k-1}-\zeta_{k})^2} +2\frac{\mathbf{f'(\zeta_k)}\cdot(\zeta_{k+1}-\zeta_{k})(\zeta_{k-1}-\zeta_{k})}{(\zeta_{k+1}-\zeta_{k})^2 (\zeta_{k-1}-\zeta_{k})^2}$$

But I am not sure now on how to get rid of the first derivative on the rhs of the last equation.

Should I use the Taylor expansion a the beginning to derive an expression for $f'(\zeta_k)$, by stopping at $O((z-\zeta_k)^2)$, to plug into my last equation?

The problem I see with this is that I would be mixing up two different levels of accurancy.

Is there another way of doing this?

  • 1
    $\begingroup$ Note that you have a linear system for $f'(\zeta_{k})$ and $f''(\zeta_{k})$ $\endgroup$ – gammatester Apr 30 '18 at 9:26

The resulting scheme, once the system is solved, is first order accurate. Try to add more nodes to your stencil.

If you use a 4 node stencil, you will have your desired accuracy level.

Imagine, your function $f(x)$ can be written as a polynomial of 3rd order: $$f(x) = f_{0}L_0(x)+f_1L_1(x)+f_2L_2(x)+f_3L_3(x)+\epsilon(\xi)$$ Where $L_i$ are the Lagrange basis polynomials, and for some $\epsilon$ within the interval defined by the interpolation support.

The interpolation error $\epsilon$ is written as follows: $$\epsilon(\xi) = \frac{\prod_{i=0}^{3}{(x_i-\xi)}}{4!}f^{4)}(\xi)$$ If the function $f(x)$ is smooth enough the error is of the order of $\epsilon\sim \bar{h}^4$, where $\bar{h}$ is a kind of average of the spacings.

While computing the second derivative of $f(x)$ we'll find that the error is of the order of $\epsilon''(\xi)\sim \bar{h}^2$, as desired.


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.