4 ms·
There is a derivative, but since the function is non continuous, the derivative will likewise be messed up (but just around x=59). You really don’t want to be c
by seanmcdirmid 7y ago
There is a derivative, but since the function is non continuous, the derivative will likewise be messed up (but just around x=59). You really don’t want to be climbing a gradient around non continuous functions!
- joe_the_user 7y agoThe function has a derivative by some notions of derivative. But the function's derivative can't be derived by an application of the chain rule and the know derivatives of primitive functions, which is what Algorithmic/automatic differentiation ultimately does (though it does this at run time, not compile time, since ordinary, symbolic differentiation explodes in memory for a complicated functions). Also: The continuous function int f(int x) { if(x > 2) return x + x; else return x*2; } Is not automatically or symbolically differentiable when represented that way.
- Certhas 7y agoI believe a source to source differentiator could deal with all these (where well defined of course), e.g.: https://github.com/FluxML/Zygote.jl https://github.com/FluxML/Zygote.jl julia> fs = Dict("sin" => sin, "cos" => cos, "tan" => tan); julia> gradient(x -> fs[readline()](x), 1) sin 0.5403023058681398