public class SecondDerivative
This implements an algorithm for finding a second derivative.
Derivation of the 5-point algorithm:
1. Find least-square fit of parabola y = a + b*x + c*x^2.
2. Use eqn 3-86 from Parratt's Probability and Experimental Errors in Science (1961) to find best fit parameters.
3. Use n = 5 so the values of x are -2 thru +2 (units of delta_t), y are corresponding positions.
4. Plug in to obtain c = (2*x[i+2] - x[i+1] - 2*x[i] - x[i-1] + 2*x[i-2])/14.
5. Use derivative expressions y' = b + 2cx and y'' = 2c, and scale y'' by dt^2.
6. Final result is accel[i] = (2*x[i+2] - x[i+1] - 2*x[i] - x[i-1] + 2*x[i-2])/(7*dt^2).
Other possible 5-point expressions (finite difference equations)--not used since more sensitive to noisy data(?):
1. accel[i] = (x[i+2] - 2*x[i] + x[i-2]) / (4*dt^2)
2. accel[i] = (-x[i+2] +16*x[i+1] - 30*x[i] +16*x[i-1] - x[i-2]) / (12*dt^2)