python - Why is numdifftools so inaccurate? How does it work? -
i'm using python's numdifftools library perform derivatives. however, few tests prove library highly inaccurate:
import numpy np numdifftools import derivative # result should 1/2 or 0.5 derivative(np.log, 1)(2.0) >>> array(0.5493061443340549)
is there way fix inaccuracy?
using numdifftools 0.9.16 , numpy 1.9.3 following code gives exact result:
import numpy np numdifftools import derivative # result should 1/2 or 0.5 derivative(np.log)(2.0)
output:
array(0.5000000000000238)
Comments
Post a Comment