Closed
Description
If I nest ForwardDiff.derivative
three times to compute the third derivative, I found that it doesn't work with some inputs. Taking derivative of x^2
at x = 0
is the minimal example I found.
julia> deriv3(f, x::Number = 0.0) =
ForwardDiff.derivative(
a -> ForwardDiff.derivative(
b -> ForwardDiff.derivative(f, b),
a),
x)
deriv3 (generic function with 2 methods)
julia> deriv3(x -> x^2)
NaN
julia> deriv3(x -> x^3) # OK
6.0
julia> deriv3(x -> x) # OK
0.0
julia> versioninfo()
Julia Version 0.6.3
Commit d55cadc (2018-05-28 20:20 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
WORD_SIZE: 64
BLAS: libopenblas (DYNAMIC_ARCH NO_AFFINITY Penryn)
LAPACK: libopenblas
LIBM: libm
LLVM: libLLVM-3.9.1 (ORCJIT, penryn)
julia> Pkg.installed("ForwardDiff")
v"0.7.5"
Metadata
Metadata
Assignees
Labels
No labels