Could someone point me to a source (preferably a numerical methods textbook) where they derive / show the formulas to approximate derivatives of a function at a given point $x_0$ based on the values of the function at $x_0$, and the values at surrounding points, e.g., $x_0 + h$ and $x_0 - h$ to obtain first and second derivative.
For some reason, I was convinced I had gotten these from Numerical Recipes in C, but I cannot seem to be able to find it there (section 5.7, in particular Equation 5.7.7 shows the approximation for the first derivative, but it seems more like in passing.
The way I remember learning about it was: to approximate the derivative, assuming the function is "smooth" and well-behaved within intervals of width $h$, we just determine the polynomial (2nd-degree for first and second derivatives; 4th-degree for 3rd and 4th derivatives, etc.) that passes through the points $(x_0 - h, f(x_0 - h))$, $(x_0, f(x_0))$, and $(x_0 + h, f(x_0 + h))$. Then, we use the analytically-obtained formula for the derivative of that polynomial.
If we use $y_1, y_2, y_3$ to denote the values of $f$ at $x_0 - h, x_0, x_0 + h$, respectively, the 2nd-degree polynomial through those points is: $$P(x) = \frac{y_1 + y_3 - 2y_2}{2h^2} \; (x-x_0)^2 + \frac{y_3 - y_1}{2h} \; (x - x_0) + y_2$$
Thus, $$P'(x_0) = \frac{y_3 - y_1}{2h} ~~;~~~~~~P''(x_0) = \frac{y_1+y_3-2y_2}{h^2}$$
Could you point me to a source for these and higher-order derivative formulas? (or please point me to the section in the Numerical Recipes in C where they show it, if it is a matter that I'm failing to find it even though it's there!)
Thanks!