Safe HaskellNone

AronSymbolicAlgebra

Synopsis

Documentation

data Fraction a Source #

Constructors

X 
Constf a 
(Fraction a) :+: (Fraction a) infixl 6 
(Fraction a) :*: (Fraction a) infixl 7 
(Fraction a) :/: (Fraction a) infixl 7 
Apply Func (Fraction a) 

Instances

Instances details
Eq a => Eq (Fraction a) Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

(==) :: Fraction a -> Fraction a -> Bool

(/=) :: Fraction a -> Fraction a -> Bool

Floating a => Floating (Fraction a) Source # 
Instance details

Defined in AronSymbolicAlgebra

Fractional a => Fractional (Fraction a) Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

(/) :: Fraction a -> Fraction a -> Fraction a

recip :: Fraction a -> Fraction a

fromRational :: Rational -> Fraction a

Num a => Num (Fraction a) Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

(+) :: Fraction a -> Fraction a -> Fraction a

(-) :: Fraction a -> Fraction a -> Fraction a

(*) :: Fraction a -> Fraction a -> Fraction a

negate :: Fraction a -> Fraction a

abs :: Fraction a -> Fraction a

signum :: Fraction a -> Fraction a

fromInteger :: Integer -> Fraction a

Show a => Show (Fraction a) Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

showsPrec :: Int -> Fraction a -> ShowS

show :: Fraction a -> String

showList :: [Fraction a] -> ShowS

data Func Source #

Constructors

Cos 
Sin 
Tan 
Log 
Exp 
Asin 
Acos 
Atan 

Instances

Instances details
Eq Func Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

(==) :: Func -> Func -> Bool

(/=) :: Func -> Func -> Bool

Show Func Source # 
Instance details

Defined in AronSymbolicAlgebra

Methods

showsPrec :: Int -> Func -> ShowS

show :: Func -> String

showList :: [Func] -> ShowS

eval :: Floating a => Fraction a -> a -> a Source #

calculator :: Floating a => Func -> a -> a Source #

cheatsheet :: Floating a => Func -> Fraction a Source #

simplify :: (Eq a, Floating a) => Fraction a -> Fraction a Source #

rewrite :: (Fractional a, Eq a) => Fraction a -> Fraction a Source #

  rewrite (f :*: (g :*: h)) = rewrite (f :*: g) :*: rewrite h 
  rewrite (f :+: (g :+: h)) = rewrite (f :+: g) :+: rewrite h 
  rewrite (f :/: Constf 1) = f 
  rewrite (Constf a :*: Constf b) = Constf (a * b)
  rewrite (Constf a :+: Constf b) = Constf (a + b)
  rewrite (f :*: Constf a) = Constf a :*: f 
  rewrite (Constf a :*: f :+: Constf b :*: g) | f == g = rewrite (Constf a :+: Constf b) :*: rewrite f 
                                              | otherwise = rewrite (Constf a :*: f) :+: rewrite (Constf b :*: g) 

  rewrite (Apply func (Constf a)) = Constf (calculator func a)
  rewrite (f :+: g) = Constf 1 :*: f :+: Constf 1 :*: g 
  rewrite (f :*: g) = rewrite f :*: rewrite g
  rewrite (f :: g) = rewrite f :: rewrite g
  rewrite f = f
  

diff :: (Eq a, Floating a) => Fraction a -> Fraction a Source #

diffS :: (Eq a, Floating a) => Fraction a -> Fraction a Source #