-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Various number types
--   
--   Instances of the numerical classes for a variety of different numbers:
--   (computable) real numbers, arbitrary precision fixed numbers,
--   arbitrary precision floating point numbers, differentiable numbers,
--   symbolic numbers, natural numbers, interval arithmetic.
@package numbers
@version 3000.2.0.2

module Data.Number.CReal

-- | The CReal type implements (constructive) real numbers.
--   
--   Note that the comparison operations on CReal may diverge since
--   it is (by necessity) impossible to implementent them correctly and
--   always terminating.
--   
--   This implementation is really David Lester's ERA package.
data CReal

-- | The showCReal function connverts a CReal to a
--   String.
showCReal :: Int -> CReal -> String
instance GHC.Internal.Enum.Enum Data.Number.CReal.CReal
instance GHC.Classes.Eq Data.Number.CReal.CReal
instance GHC.Internal.Float.Floating Data.Number.CReal.CReal
instance GHC.Internal.Real.Fractional Data.Number.CReal.CReal
instance GHC.Internal.Num.Num Data.Number.CReal.CReal
instance GHC.Classes.Ord Data.Number.CReal.CReal
instance GHC.Internal.Read.Read Data.Number.CReal.CReal
instance GHC.Internal.Real.Real Data.Number.CReal.CReal
instance GHC.Internal.Float.RealFloat Data.Number.CReal.CReal
instance GHC.Internal.Real.RealFrac Data.Number.CReal.CReal
instance GHC.Internal.Show.Show Data.Number.CReal.CReal

-- | The Dif module contains a data type, Dif, that allows
--   for automatic forward differentiation.
--   
--   All the ideas are from Jerzy Karczmarczuk's work, see
--   http://users.info.unicaen.fr/~karczma/arpap/diffalg.pdf.
--   
--   A simple example, if we define
--   
--   
--   foo x = x*x
--   
--   
--   then the function
--   
--   
--   foo' = deriv foo
--   
--   
--   will behave as if its body was 2*x.
module Data.Number.Dif

-- | The Dif type is the type of differentiable numbers. It's an
--   instance of all the usual numeric classes. The computed derivative of
--   a function is is correct except where the function is discontinuous,
--   at these points the derivative should be a Dirac pulse, but it isn't.
--   
--   The Dif numbers are printed with a trailing ~~ to indicate that
--   there is a "tail" of derivatives.
data Dif a

-- | The val function takes a Dif number back to a normal
--   number, thus forgetting about all the derivatives.
val :: Dif a -> a

-- | The df takes a Dif number and returns its first
--   derivative. The function can be iterated to to get higher derivaties.
df :: (Num a, Eq a) => Dif a -> Dif a

-- | The mkDif takes a value and Dif value and makes a
--   Dif number that has the given value as its normal value, and
--   the Dif number as its derivatives.
mkDif :: a -> Dif a -> Dif a

-- | The dCon function turns a normal number into a Dif
--   number with the same value. Not that numeric literals do not need an
--   explicit conversion due to the normal Haskell overloading of literals.
dCon :: Num a => a -> Dif a

-- | The dVar function turns a number into a variable number. This
--   is the number with with respect to which the derivaticve is computed.
dVar :: (Num a, Eq a) => a -> Dif a

-- | The deriv function is a simple utility to take the derivative
--   of a (single argument) function. It is simply defined as
--   
--   
--   deriv f = val . df . f . dVar
--   
deriv :: (Num a, Num b, Eq a, Eq b) => (Dif a -> Dif b) -> a -> b

-- | Convert a Dif function to an ordinary function.
unDif :: (Num a, Eq a) => (Dif a -> Dif b) -> a -> b
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Number.Dif.Dif a)
instance (GHC.Internal.Float.Floating a, GHC.Classes.Eq a) => GHC.Internal.Float.Floating (Data.Number.Dif.Dif a)
instance (GHC.Internal.Real.Fractional a, GHC.Classes.Eq a) => GHC.Internal.Real.Fractional (Data.Number.Dif.Dif a)
instance (GHC.Internal.Num.Num a, GHC.Classes.Eq a) => GHC.Internal.Num.Num (Data.Number.Dif.Dif a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Number.Dif.Dif a)
instance GHC.Internal.Read.Read a => GHC.Internal.Read.Read (Data.Number.Dif.Dif a)
instance GHC.Internal.Real.Real a => GHC.Internal.Real.Real (Data.Number.Dif.Dif a)
instance GHC.Internal.Float.RealFloat a => GHC.Internal.Float.RealFloat (Data.Number.Dif.Dif a)
instance GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (Data.Number.Dif.Dif a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Number.Dif.Dif a)

module Data.Number.FixedFunctions
approx :: Rational -> Rational -> Rational
type CF = [(Rational, Rational)]
fromCF :: CF -> Rational
toCF :: Rational -> CF
approxCF :: Rational -> CF -> Rational
fromTaylorToCF :: Fractional a => [a] -> a -> [(a, a)]
fac :: Integer -> Integer
integerRoot2 :: Integer -> Integer
pi :: Rational -> Rational
tan :: Rational -> Rational -> Rational
sin :: Rational -> Rational -> Rational
cos :: Rational -> Rational -> Rational
atan :: Rational -> Rational -> Rational
asin :: Rational -> Rational -> Rational
acos :: Rational -> Rational -> Rational
sqrt :: Rational -> Rational -> Rational
exp :: Rational -> Rational -> Rational
cosh :: Rational -> Rational -> Rational
sinh :: Rational -> Rational -> Rational
tanh :: Rational -> Rational -> Rational
atanh :: Rational -> Rational -> Rational
asinh :: Rational -> Rational -> Rational
acosh :: Rational -> Rational -> Rational
log :: Rational -> Rational -> Rational

-- | Numbers with a fixed number of decimals.
module Data.Number.Fixed
data Fixed e

-- | The Epsilon class contains the types that can be used to
--   determine the precision of a Fixed number.
class Epsilon e

-- | An epsilon of 1, i.e., no decimals.
data Eps1

-- | A type construct that gives one more decimals than the argument.
data EpsDiv10 p

-- | Ten decimals.
data Prec10

-- | 50 decimals.
data Prec50
data PrecPlus20 e

-- | 500 decimals.
data Prec500

-- | Convert between two arbitrary fixed precision types.
convertFixed :: (Epsilon e, Epsilon f) => Fixed e -> Fixed f
dynamicEps :: Rational -> (forall e. Epsilon e => Fixed e -> a) -> Rational -> a
precision :: Epsilon e => Fixed e -> Rational

-- | The call with_added_precision r f v evaluates f v,
--   while temporarily multiplying the precision of v by r.
with_added_precision :: forall a f. Epsilon f => Rational -> (forall e. Epsilon e => Fixed e -> a) -> Fixed f -> a
instance GHC.Internal.Enum.Enum (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon Data.Number.Fixed.Eps1
instance Data.Number.Fixed.Epsilon e => Data.Number.Fixed.Epsilon (Data.Number.Fixed.EpsDiv10 e)
instance Data.Number.Fixed.Epsilon Data.Number.Fixed.Prec10
instance Data.Number.Fixed.Epsilon Data.Number.Fixed.Prec50
instance Data.Number.Fixed.Epsilon Data.Number.Fixed.Prec500
instance Data.Number.Fixed.Epsilon e => Data.Number.Fixed.Epsilon (Data.Number.Fixed.PrecPlus20 e)
instance GHC.Classes.Eq (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Float.Floating (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.Fractional (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Num.Num (Data.Number.Fixed.Fixed e)
instance GHC.Classes.Ord (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Read.Read (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.Real (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Float.RealFloat (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.RealFrac (Data.Number.Fixed.Fixed e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Show.Show (Data.Number.Fixed.Fixed e)

-- | A simple implementation of floating point numbers with a selectable
--   precision. The number of digits in the mantissa is selected by the
--   Epsilon type class from the Fixed module.
--   
--   The numbers are stored in base 10.
module Data.Number.BigFloat

-- | Floating point number where the precision is determined by the type
--   e.
data BigFloat e

-- | The Epsilon class contains the types that can be used to
--   determine the precision of a Fixed number.
class Epsilon e

-- | An epsilon of 1, i.e., no decimals.
data Eps1

-- | A type construct that gives one more decimals than the argument.
data EpsDiv10 p

-- | Ten decimals.
data Prec10

-- | 50 decimals.
data Prec50
data PrecPlus20 e
instance GHC.Classes.Eq (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Float.Floating (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.Fractional (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Num.Num (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Classes.Ord (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.Real (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Float.RealFloat (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Real.RealFrac (Data.Number.BigFloat.BigFloat e)
instance Data.Number.Fixed.Epsilon e => GHC.Internal.Show.Show (Data.Number.BigFloat.BigFloat e)

-- | An incomplete implementation of interval aritrhmetic.
module Data.Number.Interval
data Interval a
ival :: Ord a => a -> a -> Interval a
getIval :: Interval a -> (a, a)
instance GHC.Classes.Ord a => GHC.Classes.Eq (Data.Number.Interval.Interval a)
instance (GHC.Classes.Ord a, GHC.Internal.Real.Fractional a) => GHC.Internal.Real.Fractional (Data.Number.Interval.Interval a)
instance (GHC.Classes.Ord a, GHC.Internal.Num.Num a) => GHC.Internal.Num.Num (Data.Number.Interval.Interval a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Number.Interval.Interval a)
instance (GHC.Classes.Eq a, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Data.Number.Interval.Interval a)

-- | Lazy natural numbers. Addition and multiplication recurses over the
--   first argument, i.e., 1 + n is the way to write the constant
--   time successor function.
--   
--   Note that (+) and (*) are not commutative for lazy natural numbers
--   when considering bottom.
module Data.Number.Natural
data Natural

-- | The infinite natural number.
infinity :: Natural
instance GHC.Internal.Enum.Enum Data.Number.Natural.Natural
instance GHC.Classes.Eq Data.Number.Natural.Natural
instance GHC.Internal.Real.Integral Data.Number.Natural.Natural
instance GHC.Internal.Num.Num Data.Number.Natural.Natural
instance GHC.Classes.Ord Data.Number.Natural.Natural
instance GHC.Internal.Real.Real Data.Number.Natural.Natural
instance GHC.Internal.Show.Show Data.Number.Natural.Natural

-- | Symbolic number, i.e., these are not numbers at all, but just build a
--   representation of the expressions. This implementation is incomplete
--   in that it allows comnstruction, but not deconstruction of the
--   expressions. It's mainly useful for debugging.
module Data.Number.Symbolic

-- | Symbolic numbers over some base type for the literals.
data Sym a

-- | Create a variable.
var :: String -> Sym a

-- | Create a constant (useful when it is not a literal).
con :: a -> Sym a

-- | The expression subst x v e substitutes the expression
--   v for each occurence of the variable x in
--   e.
subst :: (Num a, Eq a) => String -> Sym a -> Sym a -> Sym a
unSym :: Show a => Sym a -> a
instance GHC.Internal.Enum.Enum a => GHC.Internal.Enum.Enum (Data.Number.Symbolic.Sym a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Number.Symbolic.Sym a)
instance (GHC.Internal.Float.Floating a, GHC.Classes.Eq a) => GHC.Internal.Float.Floating (Data.Number.Symbolic.Sym a)
instance (GHC.Internal.Real.Fractional a, GHC.Classes.Eq a) => GHC.Internal.Real.Fractional (Data.Number.Symbolic.Sym a)
instance GHC.Internal.Real.Integral a => GHC.Internal.Real.Integral (Data.Number.Symbolic.Sym a)
instance (GHC.Internal.Num.Num a, GHC.Classes.Eq a) => GHC.Internal.Num.Num (Data.Number.Symbolic.Sym a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Number.Symbolic.Sym a)
instance (GHC.Internal.Float.RealFloat a, GHC.Internal.Show.Show a) => GHC.Internal.Float.RealFloat (Data.Number.Symbolic.Sym a)
instance GHC.Internal.Real.RealFrac a => GHC.Internal.Real.RealFrac (Data.Number.Symbolic.Sym a)
instance GHC.Internal.Real.Real a => GHC.Internal.Real.Real (Data.Number.Symbolic.Sym a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Number.Symbolic.Sym a)

module Data.Number.Vectorspace

-- | Class of vector spaces v with scalar s.
class Vectorspace s v | v -> s
(*>) :: Vectorspace s v => s -> v -> v
(<+>) :: Vectorspace s v => v -> v -> v
vnegate :: Vectorspace s v => v -> v
vzero :: Vectorspace s v => v
