# Difference between revisions of "Functional differentiation"

(→Blog Posts) |
(→Code) |
||

Line 35: | Line 35: | ||

* [http://hackage.haskell.org/package/fad Forward accumulation mode Automatic Differentiation] Hackage package | * [http://hackage.haskell.org/package/fad Forward accumulation mode Automatic Differentiation] Hackage package | ||

+ | * [http://hackage.haskell.org/package/vector-space Vector-space package], including derivatives as linear transformations satisfying product rule. | ||

[[Category:Mathematics]] | [[Category:Mathematics]] |

## Revision as of 18:32, 8 December 2010

## Introduction

Functional differentiation means computing or approximating the derivative of a function. There are several ways to do this:

- Approximate the derivative by where is close to zero. (or at best the square root of the machine precision .
- Compute the derivative of symbolically. This approach is particularly interesting for Haskell.

## Functional analysis

If you want to explain the terms Higher order function and Currying to mathematicians, this is certainly a good example. The mathematician writes

and the Haskell programmer writes

```
derive :: a -> (a -> a) -> (a -> a)
derive h f x = (f (x+h) - f x) / h .
```

Haskell's `derive h`

approximates the mathematician's .
In functional analysis is called a (linear) function operator, because it maps functions to functions.
In Haskell `derive h`

is called a higher order function for the same reason.
is in curried form. If it would be uncurried, you would write .

## Blog Posts

There have been several blog posts on this recently. I think we should gather the information together and make a nice wiki article on it here. For now, here are links to articles on the topic.

- Overloading Haskell numbers, part 2, Forward Automatic Differentiation.
- Non-standard analysis, automatic differentiation, Haskell, and other stories.
- Automatic Differentiation
- Some Playing with Derivatives
- Beautiful differentiation by Conal Elliott. The paper itself and link to video of ICFP talk on the subject are available from his site.

## Code

- Forward accumulation mode Automatic Differentiation Hackage package
- Vector-space package, including derivatives as linear transformations satisfying product rule.