| |||||||||||||||
| |||||||||||||||
| Description | |||||||||||||||
The Dif module contains a data type, Dif, that allows for automatic forward differentiation. All the ideas are from Jerzy Karczmarczuk's work, see http://users.info.unicaen.fr/~karczma/arpap/diffalg.pdf. A simple example, if we define foo x = x*x then the function foo' = deriv foo will behave as if its body was 2*x. | |||||||||||||||
| Synopsis | |||||||||||||||
| |||||||||||||||
| Documentation | |||||||||||||||
| data Dif a | |||||||||||||||
| |||||||||||||||
| val :: Dif a -> a | |||||||||||||||
| The val function takes a Dif number back to a normal number, thus forgetting about all the derivatives. | |||||||||||||||
| df :: Num a => Dif a -> Dif a | |||||||||||||||
| The df takes a Dif number and returns its first derivative. The function can be iterated to to get higher derivaties. | |||||||||||||||
| mkDif :: a -> Dif a -> Dif a | |||||||||||||||
| The mkDif takes a value and Dif value and makes a Dif number that has the given value as its normal value, and the Dif number as its derivatives. | |||||||||||||||
| dCon :: Num a => a -> Dif a | |||||||||||||||
| The dCon function turns a normal number into a Dif number with the same value. Not that numeric literals do not need an explicit conversion due to the normal Haskell overloading of literals. | |||||||||||||||
| dVar :: Num a => a -> Dif a | |||||||||||||||
| The dVar function turns a number into a variable number. This is the number with with respect to which the derivaticve is computed. | |||||||||||||||
| deriv :: (Num a, Num b) => (Dif a -> Dif b) -> a -> b | |||||||||||||||
The deriv function is a simple utility to take the derivative of a (single argument) function. It is simply defined as deriv f = val . df . f . dVar | |||||||||||||||
| unDif :: Num a => (Dif a -> Dif b) -> a -> b | |||||||||||||||
| Convert a Dif function to an ordinary function. | |||||||||||||||
| Produced by Haddock version 0.8 |