| Safe Haskell | Safe |
|---|---|
| Language | Haskell98 |
Data.Number.Dif
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.
Documentation
The Dif type is the type of differentiable numbers.
It's an instance of all the usual numeric classes.
The computed derivative of a function is is correct
except where the function is discontinuous, at these points
the derivative should be a Dirac pulse, but it isn't.
The Dif numbers are printed with a trailing ~~ to
indicate that there is a "tail" of derivatives.
Instances
| Eq a => Eq (Dif a) Source # | |
| (Floating a, Eq a) => Floating (Dif a) Source # | |
| (Fractional a, Eq a) => Fractional (Dif a) Source # | |
| (Num a, Eq a) => Num (Dif a) Source # | |
| Ord a => Ord (Dif a) Source # | |
| Read a => Read (Dif a) Source # | |
| Real a => Real (Dif a) Source # | |
| RealFloat a => RealFloat (Dif a) Source # | |
| RealFrac a => RealFrac (Dif a) Source # | |
| Show a => Show (Dif a) Source # | |
dVar :: (Num a, Eq a) => a -> Dif a Source #
The dVar function turns a number into a variable
number. This is the number with with respect to which
the derivaticve is computed.