Open artemlos opened 9 years ago
a good h value(for the double type) is in the order of 10e-14. Now, the current method uses forward differentiation, however, it's better to switch to centered differentiation instead. The h value might need to be adjusted in this case.
example in GO:
func Derivative(x func(x float64) float64, point float64) float64 {
const h = 1e-14 //not sure what to take here. Anyway, I think our derivative function has to test the errors (flactuation) in advance. Say we start at 1e-10 to 1e14.
return (x(point+h) - x(point-h)) / (2 * h)
}