Description

Metric classes

Synopsis

# Documentation

class (Additive a, Multiplicative a) => Signed a where Source #

signum from base is not an operator name in numhask and is replaced by sign. Compare with Norm where there is a change in codomain

abs a * sign a == a

Methods

sign :: a -> a Source #

abs :: a -> a Source #

#### Instances

Instances details

class (Additive a, Multiplicative b, Additive b) => Norm a b | a -> b where Source #

Norm is a slight generalisation of Signed. The class has the same shape but allows the codomain to be different to the domain.

norm a >= zero
norm zero == zero
a == norm a .* basis a
norm (basis a) == one

Methods

norm :: a -> b Source #

basis :: a -> a Source #

#### Instances

Instances details

distance :: (Norm a b, Subtractive a) => a -> a -> b Source #

Distance, which combines the Subtractive notion of difference, with Norm.

distance a b >= zero
distance a a == zero
distance a b .* basis (a - b) == a - b

class (Additive coord, Multiplicative coord, Additive dir, Multiplicative dir) => Direction coord dir | coord -> dir where Source #

Convert between a "co-ordinated" or "higher-kinded" number and representations of an angle. Typically thought of as polar co-ordinate conversion.

ray . angle == basis
norm (ray x) == 1

Methods

angle :: coord -> dir Source #

ray :: dir -> coord Source #

#### Instances

Instances details
 TrigField a => Direction (Complex a) a Source # Instance detailsDefined in NumHask.Data.Complex Methodsangle :: Complex a -> a Source #ray :: a -> Complex a Source #

data Polar mag dir Source #

Something that has a magnitude and a direction.

Constructors

 Polar Fieldsmagnitude :: !mag direction :: !dir

#### Instances

Instances details
 (Eq mag, Eq dir) => Eq (Polar mag dir) Source # Instance detailsDefined in NumHask.Analysis.Metric Methods(==) :: Polar mag dir -> Polar mag dir -> Bool #(/=) :: Polar mag dir -> Polar mag dir -> Bool # (Show mag, Show dir) => Show (Polar mag dir) Source # Instance detailsDefined in NumHask.Analysis.Metric MethodsshowsPrec :: Int -> Polar mag dir -> ShowS #show :: Polar mag dir -> String #showList :: [Polar mag dir] -> ShowS # Generic (Polar mag dir) Source # Instance detailsDefined in NumHask.Analysis.Metric Associated Typestype Rep (Polar mag dir) :: Type -> Type # Methodsfrom :: Polar mag dir -> Rep (Polar mag dir) x #to :: Rep (Polar mag dir) x -> Polar mag dir # type Rep (Polar mag dir) Source # Instance detailsDefined in NumHask.Analysis.Metric type Rep (Polar mag dir) = D1 ('MetaData "Polar" "NumHask.Analysis.Metric" "numhask-0.7.1.0-L0knaGsPb6PJAGlPoK4bjY" 'False) (C1 ('MetaCons "Polar" 'PrefixI 'True) (S1 ('MetaSel ('Just "magnitude") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 mag) :*: S1 ('MetaSel ('Just "direction") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 dir)))

polar :: (Norm coord mag, Direction coord dir) => coord -> Polar mag dir Source #

Convert from a number to a Polar.

coord :: (MultiplicativeAction coord mag, Direction coord dir) => Polar mag dir -> coord Source #

Convert from a Polar to a (coordinated aka higher-kinded) number.

class (Eq a, Additive a, Subtractive a, MeetSemiLattice a) => Epsilon a where Source #

A small number, especially useful for approximate equality.

Minimal complete definition

Nothing

Methods

epsilon :: a Source #

nearZero :: a -> Bool Source #

aboutEqual :: a -> a -> Bool Source #

#### Instances

Instances details