Copyright (c) Edward Kmett 2010-2015 BSD3 ekmett@gmail.com experimental GHC only None Haskell2010

Description

Higher order derivatives via a "dual number tower".

Synopsis

# Documentation

data Tower a Source

`Tower` is an AD `Mode` that calculates a tangent tower by forward AD, and provides fast `diffsUU`, `diffsUF`

Instances

 (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

auto :: Mode t => Scalar t -> t Source

Embed a constant

# 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)`

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

Given a function `(f a -> g a)`, and a tower of derivatives, compute the corresponding directional derivatives

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

Given a function `(f a -> g a)`, and a tower of derivatives, compute the corresponding directional derivatives, zero-padded