Hacker News new | comments | show | ask | jobs | submit login

The post mentions motivation being symbolic differentiation.

Let me instead advocate auto differentiaton. It enables writing mathematical expressions as normal programs, is less error prone for the programmer, is well defined at every valid point in the derivative, and is better at using sharing when computing higher order derivatives. An excellent library for this is, called ad, is available in Haskell.

edit: link to package is http://hackage.haskell.org/package/ad/

edit2: I should also add that MOST auto differentiation libraries also have a problem of not being able to distinguish the differential/ epsilon used in two independent derivative calculations, and this can lead to subtle / large numerical errors.

The AD library uses some haskell type system cleverness to prevent users from making that mistake!

a nice exposition of this problem can be found in this excellent blog post http://conway.rutgers.edu/~ccshan/wiki/blog/posts/Differenti...

Good tip in general. Symbolic differentiation was McCarthy's motivation in 1960. My own motivation was nothing more sophisticated than "I wonder how much Haskell can look like M-expressions, without resorting to Template Haskell?"

neat code golf reason! :)

btw, I've been to some of the recent LispNYC events, have you been to recent ones?

I live about two hours away, more by public transport, and don't get in to the city much. I'll try to make a meeting in 2013...

Let me advocate something even more interesting.

Take Haskell type, formally find its derivative, notice this new type is useful for traversing the original one and (optionally) explode your head.

(They call it zipper)

I just implemented a tree library using zippers without knowing this. Thanks for pointing this out.... .... .... shutdown initiated.

Zippers are really awesome data structures indeed. More people should use them. (But not for numerical computation)

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact