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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -