vector-space-0.5.2: Vector & affine spaces, linear maps, and derivatives (requires ghc 6.9)

Stability experimental conal@conal.net

Data.Maclaurin

Description

Infinite derivative towers via linear maps, using the Maclaurin representation. See blog posts http://conal.net/blog/tag/derivatives/.

Synopsis

# Documentation

data a :> b Source

Tower of derivatives.

Instances

 (Num s, VectorSpace s, HasBasis s, HasTrie (Basis s), HasNormal (:> (Two s) (Three s))) => HasNormal (Three (:> (Two s) s)) (Basis s ~ (), Num s, VectorSpace s, HasBasis s, HasTrie (Basis s)) => HasNormal (Two (:> (One s) s)) Eq b => Eq (:> a b) (s ~ Scalar a, Scalar s ~ s, HasBasis a, HasTrie (Basis a), Floating s, VectorSpace s) => Floating (:> a s) (s ~ Scalar a, Scalar s ~ s, HasBasis a, HasTrie (Basis a), Fractional s, VectorSpace s) => Fractional (:> a s) (s ~ Scalar a, Scalar s ~ s, HasBasis a, HasTrie (Basis a), Num s, VectorSpace s) => Num (:> a s) Ord b => Ord (:> a b) Show b => Show (:> a b) (HasBasis a, HasTrie (Basis a), VectorSpace u) => AdditiveGroup (:> a u) (s ~ Scalar u, s ~ Scalar s, InnerSpace u, InnerSpace s, HasBasis a, HasTrie (Basis a)) => InnerSpace (:> a u) (s ~ Scalar u, HasBasis a, HasTrie (Basis a), VectorSpace u) => VectorSpace (:> a u) (HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross3 v) => HasCross3 (:> a v) (HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross2 v) => HasCross2 (:> a v) (Basis s ~ (), Num s, HasTrie (Basis (s, s)), HasBasis s) => HasNormal (:> (Two s) (Three s)) (Basis s ~ (), HasBasis s, HasTrie (Basis s)) => HasNormal (:> (One s) (Two s))

powVal :: :> a b -> bSource

derivative :: :> a b -> a :-* (a :> b)Source

type :~> a b = a -> a :> bSource

Infinitely differentiable functions

dZero :: (AdditiveGroup b, HasBasis a, HasTrie (Basis a)) => a :> bSource

Derivative tower full of `zeroV`.

pureD :: (AdditiveGroup b, HasBasis a, HasTrie (Basis a)) => b -> a :> bSource

Constant derivative tower.

fmapD :: (HasTrie (Basis a), VectorSpace b) => (b -> c) -> (a :> b) -> a :> cSource

(<\$>>) :: (HasTrie (Basis a), VectorSpace b) => (b -> c) -> (a :> b) -> a :> cSource

Map a linear function over a derivative tower.

liftD2 :: (HasTrie (Basis a), VectorSpace b, VectorSpace c, VectorSpace d) => (b -> c -> d) -> (a :> b) -> (a :> c) -> a :> dSource

Apply a linear binary function over derivative towers.

liftD3 :: (HasTrie (Basis a), VectorSpace b, VectorSpace c, VectorSpace d, VectorSpace e) => (b -> c -> d -> e) -> (a :> b) -> (a :> c) -> (a :> d) -> a :> eSource

Apply a linear ternary function over derivative towers.

idD :: (VectorSpace u, s ~ Scalar u, VectorSpace (u :> u), VectorSpace s, HasBasis u, HasTrie (Basis u)) => u :~> uSource

Differentiable identity function. Sometimes called the derivation variable or similar, but it's not really a variable.

fstD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> aSource

Differentiable version of `fst`

sndD :: (HasBasis a, HasTrie (Basis a), HasBasis b, HasTrie (Basis b), Scalar a ~ Scalar b) => (a, b) :~> bSource

Differentiable version of `snd`

linearD :: (HasBasis u, HasTrie (Basis u), VectorSpace v) => (u -> v) -> u :~> vSource

Every linear function has a constant derivative equal to the function itself (as a linear map).

distrib :: (HasBasis a, HasTrie (Basis a), VectorSpace u) => (b -> c -> u) -> (a :> b) -> (a :> c) -> a :> uSource

Derivative tower for applying a binary function that distributes over addition, such as multiplication. A bit weaker assumption than bilinearity.

(>-<) :: (HasBasis a, HasTrie (Basis a), VectorSpace u) => (u -> u) -> ((a :> u) -> a :> Scalar u) -> (a :> u) -> a :> uSource

Specialized chain rule. See also '(@.)'