DISCRETE DERIVATIVES
Formulas for discrete approximations to the derivatives of a function
can be obtained from the Taylor expansion,
f(x+k d) = f(x) + k d f'(x) + k2 d2 / 2!
f"(x) + k3 d3 / 3! f"'(x) + ...
The first derivative is
f'(x) = 1/12 { - f(x+2d) + 8 f(x + d) - 8 f(x - d) + f(x - 2d) }
+ O(d5)
The second derivative is
f"(x) = 1/12 { - f(x+2d) + 16 f(x + d) - 30 f(x) + 16 f(x - d) - f(x - 2d) }
+ O(d6)
In a similar way one obtains for a function of two variables
fxy = 1/96 {
- f(x+2,y+2) + 16 f(x+1,y+1) + 16 f(x-1,y-1) - f(x-2,y-2)
+ f(x+2,y-2) - 16 f(x+1,y-1) - 16 f(x+1,y-1) + f(x+2,y-2) }
+ O(d6)
Marco Corvi - Page hosted by
geocities.com.