module Drasil.Projectile.Derivations (
timeDeriv,
landPosDeriv,
rectVelDeriv,
rectPosDeriv
) where
import Prelude hiding (cos, sin)
import Language.Drasil (eqSymb, LiteralC(..), ModelExprC(..), ExprC(..),
ModelExpr, square, half)
import qualified Data.Drasil.Quantities.Physics as QP (iSpeed, constAccel)
import Data.Drasil.Quantities.Physics (gravitationalAccelConst, iPos, ixVel, iyVel, scalarPos, speed, time, xPos, yPos)
import Drasil.Projectile.Unitals (launAngle, launSpeed, landPos, flightDur)
timeDeriv :: [ModelExpr]
timeDeriv :: [ModelExpr]
timeDeriv = [ModelExpr
timeDerivEqn1, ModelExpr
timeDerivEqn2, ModelExpr
timeDerivEqn3, ModelExpr
timeDerivEqn4]
timeDerivEqn1, timeDerivEqn2, timeDerivEqn3, timeDerivEqn4 :: ModelExpr
timeDerivEqn1 :: ModelExpr
timeDerivEqn1 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
yPos ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iyVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
half (ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
square (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time))
timeDerivEqn2 :: ModelExpr
timeDerivEqn2 = (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iyVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
flightDur) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
half (ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
square (ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
flightDur)) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0
timeDerivEqn3 :: ModelExpr
timeDerivEqn3 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iyVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$- ModelExpr -> ModelExpr
forall r. (ExprC r, LiteralC r) => r -> r
half (ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
flightDur) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0
timeDerivEqn4 :: ModelExpr
timeDerivEqn4 = ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
flightDur ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
2 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iyVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$/ ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst
landPosDeriv :: [ModelExpr]
landPosDeriv :: [ModelExpr]
landPosDeriv = [ModelExpr
landPosDerivEqn1, ModelExpr
landPosDerivEqn2, ModelExpr
landPosDerivEqn3]
landPosDerivEqn1, landPosDerivEqn2, landPosDerivEqn3 :: ModelExpr
landPosDerivEqn1 :: ModelExpr
landPosDerivEqn1 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
xPos ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
ixVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time
landPosDerivEqn2 :: ModelExpr
landPosDerivEqn2 = ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
landPos ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
ixVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
2 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launSpeed ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
sin (ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launAngle) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$/ ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst
landPosDerivEqn3 :: ModelExpr
landPosDerivEqn3 = ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
landPos ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launSpeed ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
cos (ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launAngle) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
2 ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launSpeed ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* ModelExpr -> ModelExpr
forall r. ExprC r => r -> r
sin (ConstrConcept -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstrConcept
launAngle) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$/ ConstQDef -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy ConstQDef
gravitationalAccelConst
rectVelDeriv :: [ModelExpr]
rectVelDeriv :: [ModelExpr]
rectVelDeriv = [ModelExpr
rectVelDerivEqn1, ModelExpr
rectVelDerivEqn2]
rectVelDerivEqn1, rectVelDerivEqn2 :: ModelExpr
rectVelDerivEqn1 :: ModelExpr
rectVelDerivEqn1 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.constAccel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
speed) UnitalChunk
time
rectVelDerivEqn2 :: ModelExpr
rectVelDerivEqn2 = Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
speed) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.iSpeed) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
speed) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$=
Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
time) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.constAccel)
rectPosDeriv :: [ModelExpr]
rectPosDeriv :: [ModelExpr]
rectPosDeriv = [ModelExpr
rectPosDerivEqn1, ModelExpr
rectPosDerivEqn2, ModelExpr
rectPosDerivEqn3]
rectPosDerivEqn1, rectPosDerivEqn2, rectPosDerivEqn3 :: ModelExpr
rectPosDerivEqn1 :: ModelExpr
rectPosDerivEqn1 = UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
speed ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= ModelExpr -> UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => ModelExpr -> c -> ModelExpr
forall r c. (ModelExprC r, HasUID c, HasSymbol c) => r -> c -> r
deriv (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
scalarPos) UnitalChunk
time
rectPosDerivEqn2 :: ModelExpr
rectPosDerivEqn2 = Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
scalarPos) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iPos) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
scalarPos) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$=
Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
time) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
speed)
rectPosDerivEqn3 :: ModelExpr
rectPosDerivEqn3 = Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
scalarPos) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
iPos) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
scalarPos) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
1) ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$=
Symbol -> ModelExpr -> ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => Symbol -> r -> r -> r -> r
defint (UnitalChunk -> Symbol
forall q. HasSymbol q => q -> Symbol
eqSymb UnitalChunk
time) (Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time) (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.iSpeed ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$+ (UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.constAccel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> ModelExpr
forall c. (HasUID c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
time))