Interpolating with 2 Points
| > | interpolating := CurveFitting[PolynomialInterpolation]( [x0 - h, x0], [f(x0 - h), f(x0)], x ); |
| > | derivative := diff( interpolating, x ); # differentiate w.r.t. x |
| > | answer := eval( derivative, x = x0 ); # evaluate at x0 |
| > | simplify( answer ); |
Interpolating with 3 Points
| > | interpolating := CurveFitting[PolynomialInterpolation]( [x0 - 2*h, x0 - h, x0], [f(x0 - 2*h), f(x0 - h), f(x0)], x ); |
| > | derivative := diff( interpolating, x ); |
| > | answer := eval( derivative, x = x0 ); |
| > | simplify( answer ); |