Copyright | (c) Edward Kmett 2010-2015 |
---|---|

License | BSD3 |

Maintainer | ekmett@gmail.com |

Stability | experimental |

Portability | GHC only |

Safe Haskell | None |

Language | Haskell2010 |

Higher order derivatives via a "dual number tower".

- data Tower a
- auto :: Mode t => Scalar t -> t
- taylor :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a]
- taylor0 :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a]
- maclaurin :: Fractional a => (Tower a -> Tower a) -> a -> [a]
- maclaurin0 :: Fractional a => (Tower a -> Tower a) -> a -> [a]
- diff :: Num a => (Tower a -> Tower a) -> a -> a
- diff' :: Num a => (Tower a -> Tower a) -> a -> (a, a)
- diffs :: Num a => (Tower a -> Tower a) -> a -> [a]
- diffs0 :: Num a => (Tower a -> Tower a) -> a -> [a]
- diffsF :: (Functor f, Num a) => (Tower a -> f (Tower a)) -> a -> f [a]
- diffs0F :: (Functor f, Num a) => (Tower a -> f (Tower a)) -> a -> f [a]
- du :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f (a, a) -> a
- du' :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f (a, a) -> (a, a)
- dus :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f [a] -> [a]
- dus0 :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f [a] -> [a]
- duF :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f (a, a) -> g a
- duF' :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f (a, a) -> g (a, a)
- dusF :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f [a] -> g [a]
- dus0F :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f [a] -> g [a]

# Documentation

`Tower`

is an AD `Mode`

that calculates a tangent tower by forward AD, and provides fast `diffsUU`

, `diffsUF`

(Num a, Bounded a) => Bounded (Tower a) | |

(Num a, Enum a) => Enum (Tower a) | |

(Num a, Eq a) => Eq (Tower a) | |

Floating a => Floating (Tower a) | |

Fractional a => Fractional (Tower a) | |

Data a => Data (Tower a) Source | |

Num a => Num (Tower a) | |

(Num a, Ord a) => Ord (Tower a) | |

Real a => Real (Tower a) | |

RealFloat a => RealFloat (Tower a) | |

RealFrac a => RealFrac (Tower a) | |

Show a => Show (Tower a) Source | |

Erf a => Erf (Tower a) | |

InvErf a => InvErf (Tower a) | |

Num a => Mode (Tower a) Source | |

Num a => Jacobian (Tower a) Source | |

type Scalar (Tower a) = a Source | |

type D (Tower a) = Tower a Source |

# Taylor Series

taylor :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a] Source

`taylor f x`

compute the Taylor series of `f`

around `x`

.

taylor0 :: Fractional a => (Tower a -> Tower a) -> a -> a -> [a] Source

`taylor0 f x`

compute the Taylor series of `f`

around `x`

, zero-padded.

# Maclaurin Series

maclaurin :: Fractional a => (Tower a -> Tower a) -> a -> [a] Source

`maclaurin f`

compute the Maclaurin series of `f`

maclaurin0 :: Fractional a => (Tower a -> Tower a) -> a -> [a] Source

`maclaurin f`

compute the Maclaurin series of `f`

, zero-padded

# Derivatives

diff :: Num a => (Tower a -> Tower a) -> a -> a Source

Compute the first derivative of a function `(a -> a)`

diff' :: Num a => (Tower a -> Tower a) -> a -> (a, a) Source

Compute the answer and first derivative of a function `(a -> a)`

diffs :: Num a => (Tower a -> Tower a) -> a -> [a] Source

Compute the answer and all derivatives of a function `(a -> a)`

diffs0 :: Num a => (Tower a -> Tower a) -> a -> [a] Source

Compute the zero-padded derivatives of a function `(a -> a)`

diffsF :: (Functor f, Num a) => (Tower a -> f (Tower a)) -> a -> f [a] Source

Compute the answer and all derivatives of a function `(a -> f a)`

diffs0F :: (Functor f, Num a) => (Tower a -> f (Tower a)) -> a -> f [a] Source

Compute the zero-padded derivatives of a function `(a -> f a)`

# Directional Derivatives

du :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f (a, a) -> a Source

Compute a directional derivative of a function `(f a -> a)`

du' :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f (a, a) -> (a, a) Source

Compute the answer and a directional derivative of a function `(f a -> a)`

dus :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f [a] -> [a] Source

Given a function `(f a -> a)`

, and a tower of derivatives, compute the corresponding directional derivatives.

dus0 :: (Functor f, Num a) => (f (Tower a) -> Tower a) -> f [a] -> [a] Source

Given a function `(f a -> a)`

, and a tower of derivatives, compute the corresponding directional derivatives, zero-padded

duF :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f (a, a) -> g a Source

Compute a directional derivative of a function `(f a -> g a)`

duF' :: (Functor f, Functor g, Num a) => (f (Tower a) -> g (Tower a)) -> f (a, a) -> g (a, a) Source

Compute the answer and a directional derivative of a function `(f a -> g a)`