-- | Assigns symbols and units (quantities) to physical concepts.
module Data.Drasil.Quantities.Physics where

import Language.Drasil
import Language.Drasil.Display
import Language.Drasil.ShortHands
import qualified Data.Drasil.Concepts.Physics as CP (acceleration, angAccel,
  angDisp, angVelo, chgInVelocity, constAccel, constAccelV, displacement,
  distance, energy, fSpeed, fVel, force, frequency, gravitationalAccel, gravitationalConst, 
  gravitationalMagnitude, height, iPos, iSpeed, ixSpeed, iySpeed, iVel, impulseS, impulseV, 
  ixPos, ixVel, iyPos, iyVel, kEnergy, linAccel, linDisp, linVelo, momentOfInertia, position, 
  potEnergy, pressure, restitutionCoef, scalarAccel, scalarPos, speed, time, torque,
  velocity, weight, xAccel, xConstAccel, xDist, xPos, xVel, yAccel, yConstAccel, yDist, 
  yPos, yVel, momentum, moment, fOfGravity, positionVec, tension, angFreq, period, frequency, chgMomentum)

import Data.Drasil.SI_Units (joule, metre, newton, pascal, radian, second, hertz)
import Data.Drasil.Units.Physics (accelU, angAccelU, angVelU, gravConstU, 
    impulseU, momtInertU, torqueU, velU)

restitutionCoef :: DefinedQuantityDict
restitutionCoef :: DefinedQuantityDict
restitutionCoef = ConceptChunk -> Symbol -> Space -> DefinedQuantityDict
dqdNoUnit ConceptChunk
CP.restitutionCoef (Symbol -> Symbol -> Symbol
sub Symbol
cC (String -> Symbol
label String
"R")) Space
Real

-- | Collects all physical quantities defined in this file for easy use in Drasil.
physicscon :: [UnitalChunk]
physicscon :: [UnitalChunk]
physicscon = [UnitalChunk
acceleration, UnitalChunk
angularAccel, UnitalChunk
angularDisplacement, UnitalChunk
angularVelocity,
  UnitalChunk
chgInVelocity, UnitalChunk
constAccel, UnitalChunk
constAccelV, UnitalChunk
displacement, UnitalChunk
distance, UnitalChunk
energy, UnitalChunk
frequency,
  UnitalChunk
fSpeed, UnitalChunk
fVel, UnitalChunk
force, UnitalChunk
gravitationalAccel, UnitalChunk
gravitationalConst, UnitalChunk
gravitationalMagnitude,
  UnitalChunk
height, UnitalChunk
iPos, UnitalChunk
iSpeed, UnitalChunk
ixSpeed, UnitalChunk
iySpeed, UnitalChunk
iVel, UnitalChunk
impulseS, UnitalChunk
impulseV, UnitalChunk
ixPos, UnitalChunk
ixVel, UnitalChunk
iyPos, 
  UnitalChunk
iyVel, UnitalChunk
kEnergy, UnitalChunk
linearAccel, UnitalChunk
linearDisplacement, UnitalChunk
linearVelocity, UnitalChunk
momentOfInertia, 
  UnitalChunk
position, UnitalChunk
potEnergy, UnitalChunk
pressure, UnitalChunk
scalarAccel, UnitalChunk
scalarPos, UnitalChunk
speed, UnitalChunk
time, UnitalChunk
torque, UnitalChunk
velocity,
  UnitalChunk
weight, UnitalChunk
xAccel, UnitalChunk
xConstAccel, UnitalChunk
xDist, UnitalChunk
xPos, UnitalChunk
xVel, UnitalChunk
yAccel, UnitalChunk
yConstAccel, UnitalChunk
yDist,
  UnitalChunk
yPos, UnitalChunk
yVel,UnitalChunk
momentum, UnitalChunk
moment, UnitalChunk
moment2D, UnitalChunk
fOfGravity, UnitalChunk
positionVec, UnitalChunk
tension,
  UnitalChunk
angularFrequency, UnitalChunk
period, UnitalChunk
frequency, UnitalChunk
chgMomentum]

-- * Physical Quantities (With Units)

acceleration, angularAccel, angularDisplacement, angularVelocity, chgInVelocity,
  constAccel, constAccelV, displacement, distance, energy, fSpeed, fVel, force,
  gravitationalAccel, gravitationalConst, gravitationalMagnitude, height, iPos, 
  iSpeed, ixSpeed, iySpeed, iVel, impulseS, impulseV, ixPos, ixVel, iyPos, iyVel, 
  kEnergy, linearAccel, linearDisplacement, linearVelocity, momentOfInertia, position, 
  potEnergy, pressure, scalarAccel, scalarPos, speed, time, torque, velocity, weight, 
  xAccel, xConstAccel, xDist, xPos, xVel, yAccel, yConstAccel, yDist, yPos, 
  yVel, momentum, moment, moment2D, fOfGravity, positionVec, tension, angularFrequency, 
  period, frequency, chgMomentum :: UnitalChunk

acceleration :: UnitalChunk
acceleration           = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.acceleration           ([Symbol] -> Symbol
Concat [Symbol -> Symbol
vec Symbol
lA, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"]) (Space -> Space
Vect Space
Real) UnitDefn
accelU
angularAccel :: UnitalChunk
angularAccel           = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.angAccel               Symbol
lAlpha                                      Space
Real        UnitDefn
angAccelU
angularDisplacement :: UnitalChunk
angularDisplacement    = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.angDisp                Symbol
lTheta                                      Space
Real        UnitDefn
radian
angularFrequency :: UnitalChunk
angularFrequency       = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.angFreq                Symbol
cOmega                                      Space
Real        UnitDefn
second
angularVelocity :: UnitalChunk
angularVelocity        = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.angVelo                Symbol
lOmega                                      Space
Real        UnitDefn
angVelU
chgInVelocity :: UnitalChunk
chgInVelocity          = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.chgInVelocity          (Decoration -> Symbol -> Symbol
Atop Decoration
Delta (Symbol -> Symbol) -> Symbol -> Symbol
forall a b. (a -> b) -> a -> b
$ Symbol -> Symbol
vec Symbol
lV)                       Space
Real        UnitDefn
velU
constAccel :: UnitalChunk
constAccel             = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.constAccel             (Symbol -> Symbol -> Symbol
sup Symbol
lA Symbol
lC)                                 Space
Real        UnitDefn
accelU
displacement :: UnitalChunk
displacement           = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.displacement           (Symbol -> Symbol
vec Symbol
lU)                                    Space
Real        UnitDefn
metre
distance :: UnitalChunk
distance               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.distance               Symbol
lD                                          Space
Real        UnitDefn
metre
energy :: UnitalChunk
energy                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.energy                 Symbol
cE                                          Space
Real        UnitDefn
joule
force :: UnitalChunk
force                  = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.force                  (Symbol -> Symbol
vec Symbol
cF)                                    Space
Real        UnitDefn
newton
frequency :: UnitalChunk
frequency              = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.frequency              Symbol
lF                                          Space
Real        UnitDefn
hertz
gravitationalAccel :: UnitalChunk
gravitationalAccel     = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.gravitationalAccel     (Symbol -> Symbol
vec Symbol
lG)                                    Space
Real        UnitDefn
accelU
gravitationalConst :: UnitalChunk
gravitationalConst     = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.gravitationalConst     Symbol
cG                                          Space
Real        UnitDefn
gravConstU
gravitationalMagnitude :: UnitalChunk
gravitationalMagnitude = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.gravitationalMagnitude Symbol
lG                                          Space
Real        UnitDefn
accelU
height :: UnitalChunk
height                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.height                 Symbol
lH                                          Space
Real        UnitDefn
metre
impulseS :: UnitalChunk
impulseS               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.impulseS               Symbol
lJ                                          Space
Real        UnitDefn
impulseU
impulseV :: UnitalChunk
impulseV               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.impulseV               (Symbol -> Symbol
vec Symbol
cJ)                                    Space
Real        UnitDefn
impulseU
kEnergy :: UnitalChunk
kEnergy                = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.kEnergy                ([Symbol] -> Symbol
Concat [Symbol
cK, Symbol
cE])                           Space
Real        UnitDefn
joule
linearAccel :: UnitalChunk
linearAccel            = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.linAccel               ([Symbol] -> Symbol
Concat [Symbol
lA, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"])     Space
Real        UnitDefn
accelU
linearDisplacement :: UnitalChunk
linearDisplacement     = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.linDisp                ([Symbol] -> Symbol
Concat [Symbol
lU, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"])     Space
Real        UnitDefn
metre
linearVelocity :: UnitalChunk
linearVelocity         = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.linVelo                ([Symbol] -> Symbol
Concat [Symbol
lV, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"])     Space
Real        UnitDefn
velU
momentOfInertia :: UnitalChunk
momentOfInertia        = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.momentOfInertia        (Symbol -> Symbol
vec Symbol
cI)                                    Space
Real        UnitDefn
momtInertU
chgMomentum :: UnitalChunk
chgMomentum            = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.chgMomentum            ([Symbol] -> Symbol
Concat [Symbol
cDelta,Symbol -> Symbol
vec Symbol
cP])                    Space
Real        UnitDefn
impulseU
momentum :: UnitalChunk
momentum               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.momentum               (Symbol -> Symbol
vec Symbol
cP)                                    Space
Real        UnitDefn
impulseU
moment :: UnitalChunk
moment                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.moment                 (Symbol -> Symbol
vec Symbol
cM)                                    Space
Real        UnitDefn
torqueU
moment2D :: UnitalChunk
moment2D               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.moment                 Symbol
cM                                          Space
Real        UnitDefn
torqueU
-- FIXME: moment2D should eventually be a specialization of moment, not separately defined
period :: UnitalChunk
period                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.period                 Symbol
cT                                          Space
Real        UnitDefn
second
position :: UnitalChunk
position               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.position               ([Symbol] -> Symbol
Concat [Symbol -> Symbol
vec Symbol
lP, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"]) Space
Real        UnitDefn
metre
positionVec :: UnitalChunk
positionVec            = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.positionVec            (Symbol -> Symbol
vec Symbol
lR)                                    Space
Real        UnitDefn
metre
potEnergy :: UnitalChunk
potEnergy              = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.potEnergy              ([Symbol] -> Symbol
Concat [Symbol
cP, Symbol
cE])                           Space
Real        UnitDefn
joule
pressure :: UnitalChunk
pressure               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.pressure               Symbol
lP                                          Space
Real        UnitDefn
pascal
speed :: UnitalChunk
speed                  = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.speed                  Symbol
lV                                          Space
Real        UnitDefn
velU
scalarAccel :: UnitalChunk
scalarAccel            = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.scalarAccel            Symbol
lA                                          Space
Real        UnitDefn
accelU
scalarPos :: UnitalChunk
scalarPos              = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.scalarPos              Symbol
lP                                          Space
Real        UnitDefn
metre
tension :: UnitalChunk
tension                = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.tension                (Symbol -> Symbol
vec Symbol
cT)                                    Space
Real        UnitDefn
newton
time :: UnitalChunk
time                   = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.time                   Symbol
lT                                          Space
Real        UnitDefn
second
torque :: UnitalChunk
torque                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.torque                 (Symbol -> Symbol
vec Symbol
lTau)                                  Space
Real        UnitDefn
torqueU
velocity :: UnitalChunk
velocity               = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.velocity               ([Symbol] -> Symbol
Concat [Symbol -> Symbol
vec Symbol
lV, String -> Symbol
label String
"(", Symbol
lT, String -> Symbol
label String
")"]) Space
Real        UnitDefn
velU
weight :: UnitalChunk
weight                 = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.weight                 Symbol
cW                                          Space
Real        UnitDefn
newton
fOfGravity :: UnitalChunk
fOfGravity             = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.fOfGravity             (Symbol -> Symbol -> Symbol
sub (Symbol -> Symbol
vec Symbol
cF) (Symbol -> Symbol
vec Symbol
lG))                     Space
Real        UnitDefn
newton

-- Variants of distance, speed, and scalar acceleration
-- FIXME: Add variants of vector forms?
-- FIXME: Pull out commonalities?

xDist :: UnitalChunk
xDist = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.xDist (Symbol -> Symbol
subX Symbol
lR) Space
Real UnitDefn
metre
yDist :: UnitalChunk
yDist = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.yDist (Symbol -> Symbol
subY Symbol
lR) Space
Real UnitDefn
metre

iPos :: UnitalChunk
iPos = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iPos (Symbol -> Symbol -> Symbol
sup Symbol
lP Symbol
initial) Space
Real UnitDefn
metre
xPos :: UnitalChunk
xPos = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.xPos (Symbol -> Symbol
subX Symbol
lP)        Space
Real UnitDefn
metre
yPos :: UnitalChunk
yPos = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.yPos (Symbol -> Symbol
subY Symbol
lP)        Space
Real UnitDefn
metre

ixPos :: UnitalChunk
ixPos = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.ixPos (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subX Symbol
lP) Symbol
initial) Space
Real UnitDefn
metre
iyPos :: UnitalChunk
iyPos = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iyPos (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subY Symbol
lP) Symbol
initial) Space
Real UnitDefn
metre

fSpeed :: UnitalChunk
fSpeed = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.fSpeed (Symbol -> Symbol -> Symbol
sup Symbol
lV Symbol
final)   Space
Real UnitDefn
velU
iSpeed :: UnitalChunk
iSpeed = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iSpeed (Symbol -> Symbol -> Symbol
sup Symbol
lV Symbol
initial) Space
Real UnitDefn
velU

ixSpeed :: UnitalChunk
ixSpeed = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.ixSpeed (Symbol -> Symbol -> Symbol
sub Symbol
lU Symbol
initial) Space
Real UnitDefn
velU -- temporary use for avoiding having too many superscripts
iySpeed :: UnitalChunk
iySpeed = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iySpeed (Symbol -> Symbol -> Symbol
sub Symbol
lW Symbol
initial) Space
Real UnitDefn
velU -- temporary use for avoiding having too many superscripts

fVel :: UnitalChunk
fVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.fVel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
vec Symbol
lV) Symbol
final)   Space
Real UnitDefn
velU
iVel :: UnitalChunk
iVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iVel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
vec Symbol
lV) Symbol
initial) Space
Real UnitDefn
velU
xVel :: UnitalChunk
xVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.xVel (Symbol -> Symbol
subX Symbol
lV)              Space
Real UnitDefn
velU
yVel :: UnitalChunk
yVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.yVel (Symbol -> Symbol
subY Symbol
lV)              Space
Real UnitDefn
velU

ixVel :: UnitalChunk
ixVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.ixVel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subX Symbol
lV) Symbol
initial) Space
Real UnitDefn
velU
iyVel :: UnitalChunk
iyVel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.iyVel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subY Symbol
lV) Symbol
initial) Space
Real UnitDefn
velU

xAccel :: UnitalChunk
xAccel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.xAccel (Symbol -> Symbol
subX Symbol
lA) Space
Real UnitDefn
accelU
yAccel :: UnitalChunk
yAccel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.yAccel (Symbol -> Symbol
subY Symbol
lA) Space
Real UnitDefn
accelU

constAccelV :: UnitalChunk
constAccelV = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.constAccelV (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
vec  Symbol
lA) Symbol
constant) Space
Real UnitDefn
accelU
xConstAccel :: UnitalChunk
xConstAccel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.xConstAccel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subX Symbol
lA) Symbol
constant) Space
Real UnitDefn
accelU
yConstAccel :: UnitalChunk
yConstAccel = ConceptChunk -> Symbol -> Space -> UnitDefn -> UnitalChunk
forall c u.
(Concept c, IsUnit u) =>
c -> Symbol -> Space -> u -> UnitalChunk
uc ConceptChunk
CP.yConstAccel (Symbol -> Symbol -> Symbol
sup (Symbol -> Symbol
subY Symbol
lA) Symbol
constant) Space
Real UnitDefn
accelU

constant, final, initial :: Symbol
constant :: Symbol
constant = String -> Symbol
label String
"c"
final :: Symbol
final    = String -> Symbol
label String
"f"
initial :: Symbol
initial  = String -> Symbol
label String
"i"

-- * Helpers

-- Helpers for common modifiers
subMax, subMin, subX, subY, subZ, supMax, supMin :: Symbol -> Symbol
subMax :: Symbol -> Symbol
subMax Symbol
s = Symbol -> Symbol -> Symbol
sub Symbol
s (String -> Symbol
label String
"max")
subMin :: Symbol -> Symbol
subMin Symbol
s = Symbol -> Symbol -> Symbol
sub Symbol
s (String -> Symbol
label String
"min")
subX :: Symbol -> Symbol
subX   Symbol
s = Symbol -> Symbol -> Symbol
sub Symbol
s (String -> Symbol
label String
"x")
subY :: Symbol -> Symbol
subY   Symbol
s = Symbol -> Symbol -> Symbol
sub Symbol
s (String -> Symbol
label String
"y")
subZ :: Symbol -> Symbol
subZ   Symbol
s = Symbol -> Symbol -> Symbol
sub Symbol
s (String -> Symbol
label String
"z")
supMax :: Symbol -> Symbol
supMax Symbol
s = Symbol -> Symbol -> Symbol
sup Symbol
s (String -> Symbol
label String
"max")
supMin :: Symbol -> Symbol
supMin Symbol
s = Symbol -> Symbol -> Symbol
sup Symbol
s (String -> Symbol
label String
"min")

-- * Constants

gravitationalConstValue :: ConstQDef
gravitationalConstValue :: ConstQDef
gravitationalConstValue = UnitalChunk -> Literal -> ConstQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
gravitationalConst (Double -> Literal
forall r. LiteralC r => Double -> r
dbl Double
6.6743E-11)
--(dbl 6.673 * 10E-11)
--(dbl 0.00000000006673)
gravitationalAccelConst :: ConstQDef
gravitationalAccelConst :: ConstQDef
gravitationalAccelConst = UnitalChunk -> Literal -> ConstQDef
forall c e. (Quantity c, MayHaveUnit c) => c -> e -> QDefinition e
mkQuantDef UnitalChunk
gravitationalMagnitude (Double -> Literal
forall r. LiteralC r => Double -> r
dbl Double
9.8)