Module

# Data.Number.Dual

Package
purescript-dual-numbers
Repository
Ebmtranceboy/purescript-dual-numbers

### #DualSource

``newtype Dual a b``

#### Constructors

• `D (a -> b /\ (a -> b))`

#### Instances

• `Monoidal Dual`
• `Semigroupoid Dual`
• `Category Dual`
• `Cartesian Dual`
• `(Ring s) => RingCat Dual s`
• `(DivisionRing s, EuclideanRing s, RingCat Dual s) => DivisionRingCat Dual s`
• `NumCat Dual`

### #MonoidalSource

``class Monoidal :: (Type -> Type -> Type) -> Constraint``class Monoidal k  where``

#### Members

• `cross :: forall a b c d. k a c -> k b d -> k (a /\ b) (c /\ d)`

#### Instances

• `Monoidal Function`
• `Monoidal Dual`

### #linearPropagationSource

``linearPropagation :: forall a b. (a -> b) -> (a -> b) -> Dual a b``

### #CartesianSource

``class Cartesian :: (Type -> Type -> Type) -> Constraint``class (Category k) <= Cartesian k  where``

#### Members

• `exl :: forall a b. k (a /\ b) a`
• `exr :: forall a b. k (a /\ b) b`
• `dup :: forall a. k a (a /\ a)`

#### Instances

• `Cartesian Function`
• `Cartesian Dual`

### #SpaceSource

``class Space a  where``

#### Members

• `scale :: a -> (a -> a)`
• `accum :: (a /\ a) -> a`

#### Instances

• `(Semiring s) => Space s`

### #RingCatSource

``class RingCat :: (Type -> Type -> Type) -> Type -> Constraint``class RingCat k s  where``

#### Members

• `negate :: k s s`
• `add :: k (s /\ s) s`
• `mul :: k (s /\ s) s`

#### Instances

• `(Ring s) => RingCat Function s`
• `(Ring s) => RingCat Dual s`

### #DivisionRingCatSource

``class DivisionRingCat :: (Type -> Type -> Type) -> Type -> Constraint``class DivisionRingCat k s  where``

#### Members

• `recip :: k s s`
• `div :: k (s /\ s) s`

#### Instances

• `(DivisionRing s, EuclideanRing s) => DivisionRingCat Function s`
• `(DivisionRing s, EuclideanRing s, RingCat Dual s) => DivisionRingCat Dual s`

### #recipImplSource

``recipImpl :: forall b. EuclideanRing b => DivisionRing b => Dual b b``

### #expImplSource

``expImpl :: Dual Number Number``

### #lnImplSource

``lnImpl :: Dual Number Number``

### #sinImplSource

``sinImpl :: Dual Number Number``

### #cosImplSource

``cosImpl :: Dual Number Number``

### #sqrtImplSource

``sqrtImpl :: Dual Number Number``

### #absImplSource

``absImpl :: Dual Number Number``

### #atanImplSource

``atanImpl :: Dual Number Number``

### #coshImplSource

``coshImpl :: Dual Number Number``

### #sinhImplSource

``sinhImpl :: Dual Number Number``

### #NumCatSource

``class NumCat :: (Type -> Type -> Type) -> Constraint``class NumCat k  where``

#### Members

• `exp :: k Number Number`
• `sqrt :: k Number Number`
• `sin :: k Number Number`
• `cos :: k Number Number`
• `tan :: k Number Number`
• `asin :: k Number Number`
• `acos :: k Number Number`
• `atan :: k Number Number`
• `sinh :: k Number Number`
• `cosh :: k Number Number`
• `tanh :: k Number Number`
• `asinh :: k Number Number`
• `acosh :: k Number Number`
• `atanh :: k Number Number`
• `ln :: k Number Number`
• `abs :: k Number Number`
• `sign :: k Number Number`
• `atan2 :: k (Number /\ Number) Number`
• `pow :: k (Number /\ Number) Number`
• `min :: k (Number /\ Number) Number`
• `max :: k (Number /\ Number) Number`

#### Instances

• `NumCat Dual`

### #pairSource

``pair :: forall a c d k. Cartesian k => Monoidal k => k a c -> k a d -> k a (c /\ d)``

Generalized pairing operator such that exl >>> f .:. exr >>> g is equivalent to cross f g

### #(.:.)Source

Operator alias for Data.Number.Dual.pair (right-associative / precedence 6)

### #cstSource

``cst :: forall a s. Semiring s => s -> Dual a s``

### #axesSource

``axes :: forall @n a. Axes n a => a``

### #AxesSource

``class Axes :: Int -> Type -> Constraint``class Axes n a | n -> a where``

#### Members

• `axesImpl :: Proxy n -> a`

#### Instances

• `Axes 1 Number`
• `Axes 2 (Tuple (Tuple Number Number) (Tuple Number Number))`
• `(Axes n (Tuple h t), Add n 1 n1, Fmapable h (Tuple h t) (Tuple Number h) (Tuple h' t'), Fmapable Number h Number h) => Axes n1 (Tuple (Tuple Number h) (Tuple h' t'))`

### #TransposableSource

``class Transposable a b | a -> b where``

#### Members

• `transpose :: Dual a b`

#### Instances

• `(Transposable (Tuple (Tuple b x) (Tuple d y)) e) => Transposable (Tuple (Tuple a (Tuple b x)) (Tuple c (Tuple d y))) (Tuple (Tuple a c) e)`
• `Transposable (Tuple (Tuple a b) (Tuple c d)) (Tuple (Tuple a c) (Tuple b d))`
• `Transposable a a`

### #CumulativeSource

``class Cumulative c a  where``

#### Members

• `cumulate :: Dual c a`

#### Instances

• `(Ring a, Cumulative c a) => Cumulative (Tuple a c) a`
• `(Ring a) => Cumulative (Tuple a a) a`
• `Cumulative a a`

### #FmapableSource

``class Fmapable a c b k | b c -> k where``

#### Members

• `fmap :: Dual a b -> Dual c k`

#### Instances

• `Fmapable a a b b`
• `(Fmapable a c b k) => Fmapable a (Tuple a c) b (Tuple b k)`

### #minimizeSource

``minimize :: forall a c u t v axs. Fmapable a axs Number v => Transposable (a /\ v) c => Fmapable (Number /\ Number) c Number a => Transposable (v /\ v) u => Fmapable (Number /\ Number) u Number t => Cumulative t Number => axs -> Dual a Number -> Number -> Number -> a -> a``

### #distance2Source

``distance2 :: forall a b c t. Transposable a b => Fmapable (Number /\ Number) b (Number /\ Number) c => Fmapable (Number /\ Number) c Number t => Cumulative t Number => Dual a Number``

### #norm2Source

``norm2 :: forall a s t u v. Fmapable Number a Number s => Transposable (a /\ s) t => Fmapable (Number /\ Number) t (Number /\ Number) u => Fmapable (Number /\ Number) u Number v => Cumulative v Number => Dual a Number``

### #distanceSource

``distance :: forall a b c t. Transposable a b => Fmapable (Number /\ Number) b (Number /\ Number) c => Fmapable (Number /\ Number) c Number (Number /\ t) => Cumulative t Number => Dual a Number``