optimal way to approximate second derivative Suppose there is a function $f: \mathbb R\to \mathbb R$ and that we only know $f(0),f(h),f'(h),f(2h)$ for some $h>0$. and we can't know the value of $f$ with $100$% accuracy at any other point.
What is the optimal way of approximating $f''(0)$ with the given data?
I'd say that $f''(0)=\frac{f'(h)-f'(0)}{h}+O(h)$ and $f'(0)=\frac{f(h)-f(0)}{h}+O(h)$, therefor we get
$$f''(0)=\frac{f'(h)-\frac{f(h)-f(0)}{h}}{h}+O(h)$$
But that can't be the optimal way since we know $f(2h)$ and i didn't use it at all.
Could someone shed some light?

Because you only have four pieces of information - your finite difference scheme is essentially fitting a cubic. Additionally, because most of your information is centered around $x=h$ I would build the interpolating polynomial around that point and fit it with the information at hand:
$$f(h+\delta) \approx a_0 + a_1\delta + a_2\delta^2 + a_3\delta^3 +O(\delta^4)$$
then implementing the information that you are given:
$$f(0) = a_0 - a_1h + a_2h^2 - a_3h^3\\
f(h) = a_0\\
f(2h) = a_0 + a_1h + a_2h^2 + a_3h^3\\
f'(h) = a_1\\
$$
which gives a system of equations:
$$ \begin{pmatrix}
  1 & -h & h^2 & -h^3 \\
  1 & 0 & 0 & 0 \\
  1 & h & h^2 & h^3 \\
  0 & 1 & 0 & 0 \\
 \end{pmatrix}\begin{pmatrix}a_0\\a_1\\a_2\\a_3\end{pmatrix}=\begin{pmatrix}f(0)\\f(h)\\f(2h)\\f'(h)\end{pmatrix} $$
after solving for the $a_k$ (there are really only two unknowns here) 
I get 
$$a_2 = \frac{f(0)-2f(h)+f(2h)}{2h^2}$$ 
and 
$$a_3 = \frac{f(2h)-2f'(h)h - f(0)}{2h^3}$$
then you can simply compute $f''(0) = 2a_2 - 6a_3 h$. 
This solution will minimize the energy of the error.
