Mathos-Project icon indicating copy to clipboard operation
Mathos-Project copied to clipboard

Derivative improvement

Open artemlos opened this issue 10 years ago • 2 comments

  • change the method so that it takes into account the machine epsilon.
  • use Richardson extrapolation
  • and more (I will wait until I've done the entire numerical analysis course)

artemlos avatar Mar 25 '15 21:03 artemlos

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.

artemlos avatar Mar 29 '15 15:03 artemlos

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)
}

artemlos avatar Mar 30 '15 20:03 artemlos