You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect second derivative of sinc nearby zero #466
As I have already mentioned in julia#37227, the function sinc is numerically unstable nearby zero. The sinc function is especially important for this value because its smoothness is the reason to be utilized, but the second derivative is not computed correctly.
using ForwardDiff
f(x) = ForwardDiff.derivative(y -> ForwardDiff.derivative(sinc, y), x)
for i in [1:5:89..., 90:20:330...]
x =0.1^i
println("f(", x, ") = ", f(x))
end
The next version of Julia should have an accurate sinc derivative implementation (cosc) (JuliaLang/julia#37273) that is supported in ChainRules (JuliaDiff/ChainRules.jl#255). If you AD the new cosc implementation it should be accurate near zero, I think, since the new code is just implemented as a polynomial near zero with no catastrophic cancellations.
Reacted by Andreas Noack and Felipe S. S. Schneider
Activity
andreasnoack commentedon Aug 27, 2020
I'm not sure how to easily fix this. It might require a good implementation of the derivative.
stevengj commentedon Aug 30, 2020
The next version of Julia should have an accurate
sincderivative implementation (cosc) (JuliaLang/julia#37273) that is supported in ChainRules (JuliaDiff/ChainRules.jl#255). If you AD the newcoscimplementation it should be accurate near zero, I think, since the new code is just implemented as a polynomial near zero with no catastrophic cancellations.andreasnoack commentedon Aug 30, 2020
@petvana Then we just need a definition for
sincin https://github.com/JuliaDiff/DiffRules.jl/blob/master/src/rules.jl and then we can benefit from the improvedcosconce it has made it into a release.stevengj commentedon Feb 1, 2022
I think this issue can be closed now. With the original code above, I now get: