[Haskell-cafe] Questions about Numeric.AD / Automatic differentiation

Sean Matthews seanmatthews1 at gmail.com
Mon Nov 20 22:05:31 UTC 2017


I'm having some problems with Numeric.AD (translation, things are not
working for reason that I don't understand).  Note I don't have much
experience with this package, so these are newbie questions, thus
appropriate answers may involve pointing me to a document somewhere out
there on the net.

Anyway,  here is my problem:

I have a function (call it f x theta) which I have defined purely in terms
of basic arithmetic functions  (+/-/(/)/*/**) glued together using standard
applicative functor operations has type

f  :: m1 (m2 Double) -> m3 Double -> Double
f x theta = ...

m1 m2 and m3 are all Traversable.
f is defined purely in terms of basic arithmetic operations, (+/-/(/)/*/**)
glued together using standard applicative functor operations, and m1 m2 and
m3 are all pretty trivial record types (no recursion, even).

I would like to write

df x theta = grad (f x) theta

But it refuses to type, even though (admittedly quite a lot) simpler
versions do.

So what am I missing? Does AD not go through Applicative?  That seems
unlikely to me.

Any advice / suggestions, etc. gratefully received.

Sean Matthews



-- 
Sean Matthews
seanmatthews1 at gmail.com / +49 1515 800 1901
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20171120/02e03d04/attachment.html>


More information about the Haskell-Cafe mailing list