-- | Assigns a symbol and possibly units (quantities) to mathematical quantities.
module Data.Drasil.Quantities.Math where

import Language.Drasil
import Language.Drasil.Display
import Language.Drasil.ShortHands

import qualified Data.Drasil.Concepts.Math as CM (area, diameter, euclidN, gradient, 
    normalV, orient, perpV, pi_, posInf, negInf, surArea, surface, unitV)
import Data.Drasil.SI_Units (metre, m_2, radian)

-- * May Not Have Units

gradient, normalVect, unitVect, unitVectj, euclidNorm, perpVect,
  pi_, posInf, negInf, uNormalVect :: DefinedQuantityDict
 

gradient :: DefinedQuantityDict
gradient    = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.gradient Symbol
lNabla         Space
Real
normalVect :: DefinedQuantityDict
normalVect  = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.normalV  (Symbol -> Symbol
vec Symbol
lN)       Space
Real
uNormalVect :: DefinedQuantityDict
uNormalVect = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.normalV  (Symbol -> Symbol
vec forall a b. (a -> b) -> a -> b
$ Symbol -> Symbol
hat Symbol
lN) Space
Real
unitVect :: DefinedQuantityDict
unitVect    = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.unitV    (Symbol -> Symbol
vec forall a b. (a -> b) -> a -> b
$ Symbol -> Symbol
hat Symbol
lI) Space
Real
unitVectj :: DefinedQuantityDict
unitVectj   = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.unitV    (Symbol -> Symbol
vec forall a b. (a -> b) -> a -> b
$ Symbol -> Symbol
hat Symbol
lJ) Space
Real
perpVect :: DefinedQuantityDict
perpVect    = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.perpV    (Symbol -> Symbol
vec Symbol
lN)       Space
Real
pi_ :: DefinedQuantityDict
pi_         = ConceptChunk
-> (Stage -> Symbol)
-> Space
-> Maybe UnitDefn
-> DefinedQuantityDict
dqd'      ConceptChunk
CM.pi_      (Symbol -> Symbol -> Stage -> Symbol
staged Symbol
lPi (String -> Symbol
variable String
"pi")) Space
Real forall a. Maybe a
Nothing
posInf :: DefinedQuantityDict
posInf      = ConceptChunk
-> (Stage -> Symbol)
-> Space
-> Maybe UnitDefn
-> DefinedQuantityDict
dqd'      ConceptChunk
CM.posInf   (Symbol -> Symbol -> Stage -> Symbol
staged Symbol
lPosInf (String -> Symbol
variable String
"posInf")) Space
Real forall a. Maybe a
Nothing
negInf :: DefinedQuantityDict
negInf      = ConceptChunk
-> (Stage -> Symbol)
-> Space
-> Maybe UnitDefn
-> DefinedQuantityDict
dqd'      ConceptChunk
CM.negInf   (Symbol -> Symbol -> Stage -> Symbol
staged Symbol
lNegInf (String -> Symbol
variable String
"posInf")) Space
Real forall a. Maybe a
Nothing
euclidNorm :: DefinedQuantityDict
euclidNorm  = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CM.euclidN  (Decoration -> Symbol -> Symbol
Atop Decoration
Magnitude forall a b. (a -> b) -> a -> b
$ Symbol -> Symbol
vec Symbol
lD) Space
Real

-- * With Units

area, diameter, surface, surArea, orientation :: UnitalChunk

area :: UnitalChunk
area        = forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CM.area     Symbol
cA   Space
Real UnitDefn
m_2
diameter :: UnitalChunk
diameter    = forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CM.diameter Symbol
lD   Space
Real UnitDefn
metre
surface :: UnitalChunk
surface     = forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CM.surface  Symbol
cS   Space
Real UnitDefn
m_2
surArea :: UnitalChunk
surArea     = forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CM.surArea  Symbol
cA   Space
Real UnitDefn
m_2
orientation :: UnitalChunk
orientation = forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CM.orient   Symbol
lPhi Space
Real UnitDefn
radian

-- * Constants

piConst :: ConstQDef
piConst :: ConstQDef
piConst = forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef DefinedQuantityDict
pi_ (forall r. LiteralC r => Double -> r
dbl Double
3.14159265)