tag:blogger.com,1999:blog-2553815923640620572.post5279791135437704970..comments2014-09-04T01:48:39.030-04:00Comments on Flygdynamikern: ANNOUNCE: fad 1.0 — Forward Automatic Differentiation for HaskellBjörn Buckwalterhttp://www.blogger.com/profile/14027110650075268096noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-2553815923640620572.post-13886947934939872482010-03-22T08:52:17.946-04:002010-03-22T08:52:17.946-04:00This comment has been removed by a blog administrator.marryhttp://www.blogger.com/profile/17811643324748313696noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-42797343881493984142009-04-05T11:05:00.000-04:002009-04-05T11:05:00.000-04:00I think what anonymous wants to know is: Can I bu...I think what anonymous wants to know is:<BR/><BR/> Can I build a sequence of functions<BR/> by repeated application of a<BR/> differential operator?<BR/><BR/>The answer is: not in general, no.<BR/><BR/>We do provide a special mechanism to calculate this when the first-order differential operator to be iterated is diff.<BR/><BR/>(Try the implementation in POPL-2007:155-60, or VLAD/Stalingrad.)barakhttp://barak.a.pearlmutter.myopenid.com/noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-70077986698915014932009-04-05T10:35:00.000-04:002009-04-05T10:35:00.000-04:00Bjorn, well I'm thinking more of cases when you're...Bjorn, well I'm thinking more of cases when you're actually passing around and storing functions (which happens a lot in FP), so you do need to actually find the function rather than just the value at some point. It may be the case that you're usually specifically interested in some particular derivative though, but it would be nice to have some convenient way of accessing it, or a subset of them...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-12319940261368440302009-04-04T13:37:00.000-04:002009-04-04T13:37:00.000-04:00@Anonymous: I would expect the most of the time yo...@Anonymous: I would expect the most of the time you'll either want to evaluate several derivatives at the same "point", in which case diffs/diffs0 is suitable, or you will be specifically interested in e.g. the fourth derivative in which case "(!!4) . diffs0 f" will work without fancy foralls or type extensions. But I'm perhaps being too narrow-minded... ;)Björn Buckwalterhttp://www.blogger.com/profile/14027110650075268096noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-61904104992613862212009-04-04T13:17:00.000-04:002009-04-04T13:17:00.000-04:00Sorry for the "ha ha". I was laughing at the Hask...Sorry for the "ha ha". I was laughing at the Haskell type system.<BR/><BR/>If we only had 1st-order dual numbers, then this is what you'd need:<BR/><BR/> diffs' f = iterate diffUU f<BR/><BR/>This seems reasonable. But the Haskell type system cannot stomach it, no matter how many foralls are sprinkled around. Hence the infinite lazy towers.barakhttp://barak.a.pearlmutter.myopenid.com/noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-6761876564409637972009-04-04T06:16:00.000-04:002009-04-04T06:16:00.000-04:00Bjorn,It's mostly a nice abstraction so you can do...Bjorn,<BR/>It's mostly a nice abstraction so you can do something like<BR/><BR/>fs = diffs' f<BR/><BR/>and then later on you can do fs!!4 for the fourth derivative etc. which makes it easy to work in a functional way (i.e. passing around functions).Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-52649766310865758582009-04-03T22:20:00.000-04:002009-04-03T22:20:00.000-04:00I believe this definition should do the trick (wit...I believe this definition should do the trick (with -XRank2Types):<BR/><BR/>> diffs' :: Num a => (forall tag . Dual tag a -> Dual tag a) -> [a -> a]<BR/>> diffs' f = map (\i x -> diffs0 f x !! i) [1..]<BR/><BR/>Although I'm not sure when you would need it... Could you elaborate on the use case? If warranted we could add something along these lines to the library.Björn Buckwalterhttp://www.blogger.com/profile/14027110650075268096noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-18835988736037153022009-04-03T18:26:00.000-04:002009-04-03T18:26:00.000-04:00Bjorn, I Mean I want something like:diffs' :: ...Bjorn, I Mean I want something like:<BR/><BR/>diffs' :: (Num a) => (a->a) -> [ a->a ]<BR/><BR/>Though obviously with some "foralls" and stuff in there....Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-90092944888943882782009-04-03T15:52:00.000-04:002009-04-03T15:52:00.000-04:00Ha ha. Yes that does not type check when done in ...Ha ha. Yes that does not type check when done in the straightforward fashion. However we provide a tower of derivatives just for you!<BR/><BR/>take 10 $ diffs (exp . (2*)) 0barakhttp://barak.a.pearlmutter.myopenid.com/noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-5248155635345271152009-04-03T15:49:00.000-04:002009-04-03T15:49:00.000-04:00@Anonymous: the examples should type check (the RE...@Anonymous: the examples should type check (the README is valid literate Haskell). Depending on your use you might have to specify a type signature for your function (e.g. "f :: Num a => a -> a") to prevent GHC from defaulting it to e.g. "Integer -> Integer".Björn Buckwalterhttp://www.blogger.com/profile/14027110650075268096noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-37134317160465301162009-04-03T15:23:00.000-04:002009-04-03T15:23:00.000-04:00Hmm. I'm tired. How can I get a a list of all the ...Hmm. I'm tired. How can I get a a list of all the derivatives of a function (each element applying "diff" to the previous element). I can't make it type check...Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-57859195594025563692009-04-03T12:28:00.000-04:002009-04-03T12:28:00.000-04:00I think these are orthogonal issues.It is just a c...I think these are orthogonal issues.<BR/><BR/>It is just a coincidence (pun) that perturbations of Reals are isomorphic to Reals. Other continuous primal structures, like rotations, do not admit to this particular pun. (In general, only flat manifolds allow this pun.) But you can still construct examples of perturbation confusion in a domain like that, at least if you don't have some mechanism to prevent it. After all, perturbations necessarily live in a linear domain: they are tangent vectors, meaning elements of a tangent space.barakhttp://barak.a.pearlmutter.myopenid.com/noreply@blogger.comtag:blogger.com,1999:blog-2553815923640620572.post-3717846995083263492009-04-03T11:56:00.000-04:002009-04-03T11:56:00.000-04:00I've wondered if perturbation confusion is an arti...I've wondered if perturbation confusion is an artificial problem, resulting from punning derivative values with function (range) values, and if treating derivatives as linear maps side-steps the problem altogether. Linear maps also handle functions from non-scalar domains (R^n etc), without having to add a notion of "partial derivatives".Conalhttp://www.blogger.com/profile/05756984502464196668noreply@blogger.com