vector-space-0.16: Vector & affine spaces, linear maps, and derivatives

Data.Maclaurin

Contents

Description

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

Synopsis

Documentation

data a :> b Source #

Tower of derivatives.

Constructors

 D b (a :-* (a :> b)) infixr 9
Instances
 (VectorSpace s, HasBasis s, HasTrie (Basis s), HasNormal (Two s :> Three s)) => HasNormal (Three (Two s :> s)) Source # Instance detailsDefined in Data.Cross MethodsnormalVec :: Three (Two s :> s) -> Three (Two s :> s) Source # (VectorSpace s, HasBasis s, HasTrie (Basis s), Basis s ~ ()) => HasNormal (Two (One s :> s)) Source # Instance detailsDefined in Data.Cross MethodsnormalVec :: Two (One s :> s) -> Two (One s :> s) Source # Eq (a :> b) Source # Instance detailsDefined in Data.Maclaurin Methods(==) :: (a :> b) -> (a :> b) -> Bool #(/=) :: (a :> b) -> (a :> b) -> Bool # (HasBasis a, s ~ Scalar a, HasTrie (Basis a), Floating s, VectorSpace s, Scalar s ~ s) => Floating (a :> s) Source # Instance detailsDefined in Data.Maclaurin Methodspi :: a :> s #exp :: (a :> s) -> a :> s #log :: (a :> s) -> a :> s #sqrt :: (a :> s) -> a :> s #(**) :: (a :> s) -> (a :> s) -> a :> s #logBase :: (a :> s) -> (a :> s) -> a :> s #sin :: (a :> s) -> a :> s #cos :: (a :> s) -> a :> s #tan :: (a :> s) -> a :> s #asin :: (a :> s) -> a :> s #acos :: (a :> s) -> a :> s #atan :: (a :> s) -> a :> s #sinh :: (a :> s) -> a :> s #cosh :: (a :> s) -> a :> s #tanh :: (a :> s) -> a :> s #asinh :: (a :> s) -> a :> s #acosh :: (a :> s) -> a :> s #atanh :: (a :> s) -> a :> s #log1p :: (a :> s) -> a :> s #expm1 :: (a :> s) -> a :> s #log1pexp :: (a :> s) -> a :> s #log1mexp :: (a :> s) -> a :> s # (HasBasis a, s ~ Scalar a, HasTrie (Basis a), Fractional s, VectorSpace s, Scalar s ~ s) => Fractional (a :> s) Source # Instance detailsDefined in Data.Maclaurin Methods(/) :: (a :> s) -> (a :> s) -> a :> s #recip :: (a :> s) -> a :> s #fromRational :: Rational -> a :> s # (HasBasis a, s ~ Scalar a, HasTrie (Basis a), Num s, VectorSpace s, Scalar s ~ s) => Num (a :> s) Source # Instance detailsDefined in Data.Maclaurin Methods(+) :: (a :> s) -> (a :> s) -> a :> s #(-) :: (a :> s) -> (a :> s) -> a :> s #(*) :: (a :> s) -> (a :> s) -> a :> s #negate :: (a :> s) -> a :> s #abs :: (a :> s) -> a :> s #signum :: (a :> s) -> a :> s #fromInteger :: Integer -> a :> s # (AdditiveGroup b, HasBasis a, HasTrie (Basis a), OrdB b, IfB b, Ord b) => Ord (a :> b) Source # Instance detailsDefined in Data.Maclaurin Methodscompare :: (a :> b) -> (a :> b) -> Ordering #(<) :: (a :> b) -> (a :> b) -> Bool #(<=) :: (a :> b) -> (a :> b) -> Bool #(>) :: (a :> b) -> (a :> b) -> Bool #(>=) :: (a :> b) -> (a :> b) -> Bool #max :: (a :> b) -> (a :> b) -> a :> b #min :: (a :> b) -> (a :> b) -> a :> b # Show b => Show (a :> b) Source # Instance detailsDefined in Data.Maclaurin MethodsshowsPrec :: Int -> (a :> b) -> ShowS #show :: (a :> b) -> String #showList :: [a :> b] -> ShowS # (AdditiveGroup v, HasBasis u, HasTrie (Basis u), IfB v) => IfB (u :> v) Source # Instance detailsDefined in Data.Maclaurin MethodsifB :: bool ~ BooleanOf (u :> v) => bool -> (u :> v) -> (u :> v) -> u :> v # OrdB v => OrdB (u :> v) Source # Instance detailsDefined in Data.Maclaurin Methods(<*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #(<=*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #(>*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool #(>=*) :: bool ~ BooleanOf (u :> v) => (u :> v) -> (u :> v) -> bool # (HasBasis a, HasTrie (Basis a), AdditiveGroup u) => AdditiveGroup (a :> u) Source # Instance detailsDefined in Data.Maclaurin MethodszeroV :: a :> u Source #(^+^) :: (a :> u) -> (a :> u) -> a :> u Source #negateV :: (a :> u) -> a :> u Source #(^-^) :: (a :> u) -> (a :> u) -> a :> u Source # (InnerSpace u, s ~ Scalar u, AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace (a :> u) Source # Instance detailsDefined in Data.Maclaurin Methods(<.>) :: (a :> u) -> (a :> u) -> Scalar (a :> u) Source # (HasBasis a, HasTrie (Basis a), VectorSpace u) => VectorSpace (a :> u) Source # Instance detailsDefined in Data.Maclaurin Associated Typestype Scalar (a :> u) :: Type Source # Methods(*^) :: Scalar (a :> u) -> (a :> u) -> a :> u Source # (HasBasis a, HasTrie (Basis a), VectorSpace v, HasCross3 v) => HasCross3 (a :> v) Source # Instance detailsDefined in Data.Cross Methodscross3 :: (a :> v) -> (a :> v) -> a :> v Source # (HasTrie (Basis a), HasCross2 v) => HasCross2 (a :> v) Source # Instance detailsDefined in Data.Cross Methodscross2 :: (a :> v) -> a :> v Source # (Num s, HasTrie (Basis (s, s)), HasBasis s, Basis s ~ ()) => HasNormal (Two s :> Three s) Source # Instance detailsDefined in Data.Cross MethodsnormalVec :: (Two s :> Three s) -> Two s :> Three s Source # (HasBasis s, HasTrie (Basis s), Basis s ~ ()) => HasNormal (One s :> Two s) Source # Instance detailsDefined in Data.Cross MethodsnormalVec :: (One s :> Two s) -> One s :> Two s Source # type BooleanOf (a :> b) Source # Instance detailsDefined in Data.Maclaurin type BooleanOf (a :> b) = BooleanOf b type Scalar (a :> u) Source # Instance detailsDefined in Data.Maclaurin type Scalar (a :> u) = a :> Scalar u

powVal :: (:>) a b -> b Source #

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

derivAtBasis :: (HasTrie (Basis a), HasBasis a, AdditiveGroup b) => (a :> b) -> Basis a -> a :> b Source #

Sample the derivative at a basis element. Optimized for partial application to save work for non-scalar derivatives.

type (:~>) a b = a -> a :> b Source #

Infinitely differentiable functions

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

Constant derivative tower.

fmapD :: HasTrie (Basis a) => (b -> c) -> (a :> b) -> a :> c Source #

Map a linear function over a derivative tower.

(<\$>>) :: HasTrie (Basis a) => (b -> c) -> (a :> b) -> a :> c infixl 4 Source #

Map a linear function over a derivative tower.

liftD2 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c) => (b -> c -> d) -> (a :> b) -> (a :> c) -> a :> d Source #

Apply a linear binary function over derivative towers.

liftD3 :: (HasBasis a, HasTrie (Basis a), AdditiveGroup b, AdditiveGroup c, AdditiveGroup d) => (b -> c -> d -> e) -> (a :> b) -> (a :> c) -> (a :> d) -> a :> e Source #

Apply a linear ternary function over derivative towers.

idD :: (VectorSpace u, HasBasis u, HasTrie (Basis u)) => u :~> u Source #

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) :~> a Source #

Differentiable version of fst

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

Differentiable version of snd

linearD :: (HasBasis u, HasTrie (Basis u), AdditiveGroup v) => (u -> v) -> u :~> v Source #

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

distrib :: forall a b c u. (HasBasis a, HasTrie (Basis a), AdditiveGroup u) => (b -> c -> u) -> (a :> b) -> (a :> c) -> a :> u Source #

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

(>-<) :: (HasBasis a, HasTrie (Basis a), VectorSpace u) => (u -> u) -> ((a :> u) -> a :> Scalar u) -> (a :> u) -> a :> u infix 0 Source #