Hi,
This could be a chance to battle-test ForwardDiff.jl's new API. It takes
exact derivatives and we're trying to make it easy to use. If your discrete
grid is granular enough, ForwardDiff.jl should work great. Just keep in
mind that ForwardDiff is so accurate (i.e., to machine-epsilon precision of
the functions it evaluates), that the derivative values might not be what
you expect - in the words of Alexey Radul: "[Automatic differentiation]
will give you derivatives of the procedure you actually programmed, which
may not be good approximations of the derivatives of the ideal function
that your procedure was approximating.""
Anyway, here's an example. Let's say you had a Julia function "f" to map
your x values to your y values:
julia> f(x) = # compute y value using your grid data.
f (generic function with 1 method)
# Assuming f: Number → Number
julia> derivf = ForwardDiff.derivative(f)
derivf (generic function with 1 method)
julia> derivf(x) # will return df(x)/dx
If f: Vector → Number, than ForwardDiff also offers "gradient" and
"hessian" methods that are used in the same way as above (as well as a
"jacobian" method if f: Vector → Vector).
You might also try producing a "smoother" f(x) using Interpolations.jl,
then running that function through ForwardDiff.jl
Best,
Jarrett
On Wednesday, August 26, 2015 at 6:56:01 AM UTC-4, Spencer Lyon wrote:
>
> It would be awesome to get this under AD.
>
> I'm not sure I follow with how to get DF(y) at each output point. Can you
> provide a quick example (made up data is totally fine)?
>
> Thanks
>
> // Spencer
>
> On August 25, 2015 at 4:15:28 PM EDT, Christoph Ortner <
> [email protected] <javascript:>> wrote:
>
> In this case AD will actually work. Since
>
> y'' = DF(y) y'
>
> you can use AD to compute DF(y) at each output point of the curve and get
> y'' as above.
>
> Christoph
>
>
>
>