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$:
$$f(z)=f(\zeta_k)+(z-\zeta_k)~f'(\zeta_k)+\frac{(z-\zeta_k)^2}{2!}f''(\zeta_k)+O((z-\zeta_k)^3)$$
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?