{-# LANGUAGE PostfixOperators #-}
module Drasil.Projectile.GenDefs (genDefns, posVecGD) where

import Prelude hiding (cos, sin)

import Data.Drasil.Citations (hibbeler2004)
import Data.Drasil.Concepts.Documentation (coordinate, symbol_)
import Data.Drasil.Concepts.Math (cartesian, equation, vector)
import Data.Drasil.Concepts.Physics (oneD, rectilinear, twoD, motion)
import Data.Drasil.Quantities.Physics (acceleration, constAccelV, iPos, iSpeed,
  iVel, ixVel, iyVel, position, scalarAccel, scalarPos,
  time, velocity, positionVec, speed)
import qualified Data.Drasil.Quantities.Physics as QP (constAccel)
import Data.Drasil.Theories.Physics (accelerationTM, velocityTM)
import Language.Drasil
import Language.Drasil.Document
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import qualified Language.Drasil.Development as D
import Theory.Drasil (GenDefn, TheoryModel, gd, gdNoRefs, equationalModel', Derivation,
  mkDerivName)
import Data.List.Extras (weave)

import Drasil.Projectile.Assumptions (cartSyst, constAccel, pointMass, timeStartZero, twoDMotion)
import Drasil.Projectile.Concepts (rectVel)
import qualified Drasil.Projectile.Derivations as D
import qualified Drasil.Projectile.Expressions as E
import Drasil.Projectile.Unitals (projSpeed, projPos)

genDefns :: [GenDefn]
genDefns :: [GenDefn]
genDefns = [GenDefn
rectVelGD, GenDefn
rectPosGD, GenDefn
velVecGD, GenDefn
posVecGD]

----------
rectVelGD :: GenDefn
rectVelGD :: GenDefn
rectVelGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
rectVelQD) (DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit DefinedQuantityDict
projSpeed) (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
rectVelDeriv)
  [Citation -> RefInfo -> DecRef
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> RefInfo -> DecRef
dRefInfo Citation
hibbeler2004 (RefInfo -> DecRef) -> RefInfo -> DecRef
forall a b. (a -> b) -> a -> b
$ [Int] -> RefInfo
Page [Int
8]] String
"rectVel" [{-Notes-}]

rectVelQD :: ModelQDef
rectVelQD :: ModelQDef
rectVelQD = DefinedQuantityDict -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' DefinedQuantityDict
projSpeed
  -- TODO: make this into a proper phrase
  (String -> NP
cn String
"rectilinear velocity as a function of time for constant acceleration")
            ModelExpr
PExpr
E.speed'

rectVelDeriv :: Derivation
rectVelDeriv :: Derivation
rectVelDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
rectVel)
               ([Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
weave [Sentence]
rectVelDerivSents [Sentence]
rectVelDerivEqns)

rectVelDerivSents :: [Sentence]
rectVelDerivSents :: [Sentence]
rectVelDerivSents = [DefinedQuantityDict
-> DefinedQuantityDict
-> Sentence
-> DefinedQuantityDict
-> TheoryModel
-> Sentence
rectDeriv DefinedQuantityDict
velocity DefinedQuantityDict
acceleration Sentence
motSent DefinedQuantityDict
iVel TheoryModel
accelerationTM, Sentence
rearrAndIntSent, Sentence
performIntSent]
  where
    motSent :: Sentence
motSent = [Sentence] -> Sentence
foldlSent [NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
motion)) Sentence -> Sentence -> Sentence
`S.in_` TheoryModel -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
accelerationTM Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"now", CI -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase CI
oneD,
                         String -> Sentence
S String
"with a", DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
QP.constAccel Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"represented by", DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
QP.constAccel]

rectVelDerivEqns :: [Sentence]
rectVelDerivEqns :: [Sentence]
rectVelDerivEqns = (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.rectVelDeriv [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
rectVelQD]

----------
rectPosGD :: GenDefn
rectPosGD :: GenDefn
rectPosGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
rectPosQD) (DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit DefinedQuantityDict
projPos) (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
rectPosDeriv)
  [Citation -> RefInfo -> DecRef
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> RefInfo -> DecRef
dRefInfo Citation
hibbeler2004 (RefInfo -> DecRef) -> RefInfo -> DecRef
forall a b. (a -> b) -> a -> b
$ [Int] -> RefInfo
Page [Int
8]] String
"rectPos" [{-Notes-}]

rectPosQD :: ModelQDef
rectPosQD :: ModelQDef
rectPosQD = DefinedQuantityDict -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' DefinedQuantityDict
projPos
  -- TODO: make this into a proper phrase
  (String -> NP
cn String
"rectilinear position as a function of time for constant acceleration")
            ModelExpr
PExpr
E.scalarPos'

rectPosDeriv :: Derivation
rectPosDeriv :: Derivation
rectPosDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
rectilinear Sentence -> Sentence -> Sentence
+:+ DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
position)
               ([Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
weave [Sentence]
rectPosDerivSents [Sentence]
rectPosDerivEqns)

rectPosDerivSents :: [Sentence]
rectPosDerivSents :: [Sentence]
rectPosDerivSents = [DefinedQuantityDict
-> DefinedQuantityDict
-> Sentence
-> DefinedQuantityDict
-> TheoryModel
-> Sentence
rectDeriv DefinedQuantityDict
position DefinedQuantityDict
velocity Sentence
motSent DefinedQuantityDict
iPos TheoryModel
velocityTM,
  Sentence
rearrAndIntSent, GenDefn -> DefinedQuantityDict -> Sentence
forall r q.
(Referable r, HasShortName r, Quantity q) =>
r -> q -> Sentence
fromReplace GenDefn
rectVelGD DefinedQuantityDict
speed, Sentence
performIntSent]
    where
      motSent :: Sentence
motSent = NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
motion)) Sentence -> Sentence -> Sentence
`S.in_` TheoryModel -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
velocityTM Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"now" Sentence -> Sentence -> Sentence
+:+. CI -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase CI
oneD

rectPosDerivEqns :: [Sentence]
rectPosDerivEqns :: [Sentence]
rectPosDerivEqns = (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.rectPosDeriv [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
rectPosQD]

----------
velVecGD :: GenDefn
velVecGD :: GenDefn
velVecGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
velVecQD) (DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit DefinedQuantityDict
velocity)
           (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
velVecDeriv) String
"velVec" [{-Notes-}]

velVecQD :: ModelQDef
velVecQD :: ModelQDef
velVecQD = DefinedQuantityDict -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' DefinedQuantityDict
velocity
  -- TODO: make this into a proper phrase
  (String -> NP
cn String
"velocity vector as a function of time for 2D motion under constant acceleration")
    ModelExpr
PExpr
E.velVecExpr

velVecDeriv :: Derivation
velVecDeriv :: Derivation
velVecDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
velocity Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
vector) [Sentence
velVecDerivSent,
  ModelExpr -> Sentence
E (ModelExpr -> Sentence) -> ModelExpr -> Sentence
forall a b. (a -> b) -> a -> b
$ ModelExpr -> ModelExpr -> ModelExpr
forall r. ModelExprC r => r -> r -> r
defines (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
velocity) ModelExpr
PExpr
E.velVecExpr]

velVecDerivSent :: Sentence
velVecDerivSent :: Sentence
velVecDerivSent = [(DefinedQuantityDict, ModelExpr)] -> GenDefn -> Sentence
vecDeriv [(DefinedQuantityDict
velocity, ModelExpr
PExpr
E.velocityXY), (DefinedQuantityDict
acceleration, ModelExpr
PExpr
E.accelerationXY)] GenDefn
rectVelGD

----------
posVecGD :: GenDefn
posVecGD :: GenDefn
posVecGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
posVecQD) (DefinedQuantityDict -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit DefinedQuantityDict
position)
           (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
posVecDeriv) String
"posVec" [{-Notes-}]

-- TODO: this has gotten 'inlined' too much, need to re-use combinators
posVecQD :: ModelQDef
posVecQD :: ModelQDef
posVecQD = DefinedQuantityDict -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' DefinedQuantityDict
position (NPStruct -> NP
nounPhraseSent
  (String -> NPStruct
D.S String
"Position vector as a function of time for two-dimensional motion under constant acceleration"))
  ModelExpr
PExpr
E.posVecExpr

posVecDeriv :: Derivation
posVecDeriv :: Derivation
posVecDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
positionVec) [Sentence
posVecDerivSent, ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
posVecQD]

posVecDerivSent :: Sentence
posVecDerivSent :: Sentence
posVecDerivSent =
  [(DefinedQuantityDict, ModelExpr)] -> GenDefn -> Sentence
vecDeriv [(DefinedQuantityDict
position, ModelExpr
PExpr
E.positionXY), (DefinedQuantityDict
velocity, ModelExpr
PExpr
E.velocityXY), (DefinedQuantityDict
acceleration, ModelExpr
PExpr
E.accelerationXY)] GenDefn
rectPosGD

-- Helper for making rectilinear derivations
rectDeriv :: DefinedQuantityDict -> DefinedQuantityDict -> Sentence -> DefinedQuantityDict -> TheoryModel -> Sentence
rectDeriv :: DefinedQuantityDict
-> DefinedQuantityDict
-> Sentence
-> DefinedQuantityDict
-> TheoryModel
-> Sentence
rectDeriv DefinedQuantityDict
c1 DefinedQuantityDict
c2 Sentence
motSent DefinedQuantityDict
initc TheoryModel
ctm = [Sentence] -> Sentence
foldlSent_ [
  String -> Sentence
S String
"Assume we have", NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (ConceptChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
rectilinear ConceptChunk
motion)) Sentence -> Sentence -> Sentence
`S.ofA` String -> Sentence
S String
"particle",
  Sentence -> Sentence
sParen (String -> Sentence
S String
"of negligible size" Sentence -> Sentence -> Sentence
`S.and_` String -> Sentence
S String
"shape" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+ ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
pointMass) Sentence -> Sentence -> Sentence
:+:
  String -> Sentence
S String
";" Sentence -> Sentence -> Sentence
+:+. (String -> Sentence
S String
"that is" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"motion" Sentence -> Sentence -> Sentence
`S.in_` String -> Sentence
S String
"a straight line"),
  (NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (DefinedQuantityDict -> NP
forall t. NamedIdea t => t -> NP
the DefinedQuantityDict
c1)) Sentence -> Sentence -> Sentence
`S.is` DefinedQuantityDict -> Sentence
getScalar DefinedQuantityDict
c1 Sentence -> Sentence -> Sentence
`S.andThe` DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
c2 Sentence -> Sentence -> Sentence
`S.is` DefinedQuantityDict -> Sentence
getScalar DefinedQuantityDict
c2 !.), Sentence
motSent,
  NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (DefinedQuantityDict -> NP
forall t. NamedIdea t => t -> NP
the DefinedQuantityDict
initc), Sentence -> Sentence
sParen (String -> Sentence
S String
"at" Sentence -> Sentence -> Sentence
+:+ ModelExpr -> Sentence
eS (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+
  ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
timeStartZero) Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"represented by" Sentence -> Sentence -> Sentence
+:+. DefinedQuantityDict -> Sentence
getScalar DefinedQuantityDict
initc,
  String -> Sentence
S String
"From", TheoryModel -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS TheoryModel
ctm Sentence -> Sentence -> Sentence
`S.in_` CI -> Sentence
forall c. Idea c => c -> Sentence
short CI
oneD Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"and using the above", IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
plural IdeaDict
symbol_ Sentence -> Sentence -> Sentence
+: String -> Sentence
S String
"we have"]
  where
    getScalar :: DefinedQuantityDict -> Sentence
getScalar DefinedQuantityDict
c
      | DefinedQuantityDict
c DefinedQuantityDict -> DefinedQuantityDict -> Bool
forall a. Eq a => a -> a -> Bool
== DefinedQuantityDict
position     = DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
scalarPos
      | DefinedQuantityDict
c DefinedQuantityDict -> DefinedQuantityDict -> Bool
forall a. Eq a => a -> a -> Bool
== DefinedQuantityDict
velocity     = DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
speed
      | DefinedQuantityDict
c DefinedQuantityDict -> DefinedQuantityDict -> Bool
forall a. Eq a => a -> a -> Bool
== DefinedQuantityDict
acceleration = DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
scalarAccel
      | DefinedQuantityDict
c DefinedQuantityDict -> DefinedQuantityDict -> Bool
forall a. Eq a => a -> a -> Bool
== DefinedQuantityDict
iPos         = DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
iPos
      | DefinedQuantityDict
c DefinedQuantityDict -> DefinedQuantityDict -> Bool
forall a. Eq a => a -> a -> Bool
== DefinedQuantityDict
iVel         = DefinedQuantityDict -> Sentence
forall t. Express t => t -> Sentence
eS' DefinedQuantityDict
iSpeed
      | Bool
otherwise         = String -> Sentence
forall a. HasCallStack => String -> a
error String
"Not implemented in getScalar"

rearrAndIntSent, performIntSent :: Sentence
rearrAndIntSent :: Sentence
rearrAndIntSent = String -> Sentence
S String
"Rearranging" Sentence -> Sentence -> Sentence
`S.and_` String -> Sentence
S String
"integrating" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we" Sentence -> Sentence -> Sentence
+: String -> Sentence
S String
"have"
performIntSent :: Sentence
performIntSent  = String -> Sentence
S String
"Performing the integration" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have the required" Sentence -> Sentence -> Sentence
+: ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation

-- Helper for making vector derivations
vecDeriv :: [(DefinedQuantityDict, ModelExpr)] -> GenDefn -> Sentence
vecDeriv :: [(DefinedQuantityDict, ModelExpr)] -> GenDefn -> Sentence
vecDeriv [(DefinedQuantityDict, ModelExpr)]
vecs GenDefn
gdef = [Sentence] -> Sentence
foldlSentCol [
  String -> Sentence
S String
"For a", NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (CI -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI CI
twoD ConceptChunk
cartesian), Sentence -> Sentence
sParen (ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
twoDMotion Sentence -> Sentence -> Sentence
`S.and_` ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
cartSyst) Sentence -> Sentence -> Sentence
`sC`
  String -> Sentence
S String
"we can represent" Sentence -> Sentence -> Sentence
+:+. SepType -> FoldType -> [Sentence] -> Sentence
foldlList SepType
Comma FoldType
List
  (((DefinedQuantityDict, ModelExpr) -> Sentence)
-> [(DefinedQuantityDict, ModelExpr)] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map (\(DefinedQuantityDict
c, ModelExpr
e) -> [Sentence] -> Sentence
foldlSent_ [NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (DefinedQuantityDict -> NP
forall t. NamedIdea t => t -> NP
the DefinedQuantityDict
c), ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
vector, String -> Sentence
S String
"as", ModelExpr -> Sentence
eS ModelExpr
e]) [(DefinedQuantityDict, ModelExpr)]
vecs),
  NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (DefinedQuantityDict -> NP
forall t. NamedIdea t => t -> NP
the DefinedQuantityDict
acceleration)) Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"assumed to be constant", Sentence -> Sentence
sParen (ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
constAccel) Sentence -> Sentence -> Sentence
`S.andThe`
  DefinedQuantityDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DefinedQuantityDict
constAccelV Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"represented as" Sentence -> Sentence -> Sentence
+:+. ModelExpr -> Sentence
eS ModelExpr
PExpr
E.constAccelXY,
  NPStruct -> Sentence
D.toSent (NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
atStartNP (DefinedQuantityDict -> NP
forall t. NamedIdea t => t -> NP
the DefinedQuantityDict
iVel)) Sentence -> Sentence -> Sentence
+:+ Sentence -> Sentence
sParen (String -> Sentence
S String
"at" Sentence -> Sentence -> Sentence
+:+ ModelExpr -> Sentence
eS (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
time ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= Integer -> ModelExpr
forall r. LiteralC r => Integer -> r
exactDbl Integer
0) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"from" Sentence -> Sentence -> Sentence
+:+ ConceptInstance -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS ConceptInstance
timeStartZero) Sentence -> Sentence -> Sentence
`S.is`
  String -> Sentence
S String
"represented by" Sentence -> Sentence -> Sentence
+:+. ModelExpr -> Sentence
eS (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
iVel ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
$= ModelExpr -> ModelExpr -> ModelExpr
forall r. ExprC r => r -> r -> r
vec2D (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
ixVel) (DefinedQuantityDict -> ModelExpr
forall c. (IsChunk c, HasSymbol c) => c -> ModelExpr
forall r c. (ExprC r, IsChunk c, HasSymbol c) => c -> r
sy DefinedQuantityDict
iyVel)),
  String -> Sentence
S String
"Since we have a",
  ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
cartesian Sentence -> Sentence -> Sentence
`sC` GenDefn -> Sentence
forall r.
(IsChunk r, HasRefAddress r, HasShortName r) =>
r -> Sentence
refS GenDefn
gdef, String -> Sentence
S String
"can be applied to each", NPStruct -> Sentence
D.toSent (NPStruct -> Sentence) -> NPStruct -> Sentence
forall a b. (a -> b) -> a -> b
$ NP -> NPStruct
forall n. NounPhrase n => n -> NPStruct
phraseNP (IdeaDict
coordinate IdeaDict -> DefinedQuantityDict -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe`
  ((DefinedQuantityDict, ModelExpr) -> DefinedQuantityDict
forall a b. (a, b) -> a
fst ((DefinedQuantityDict, ModelExpr) -> DefinedQuantityDict)
-> ([(DefinedQuantityDict, ModelExpr)]
    -> (DefinedQuantityDict, ModelExpr))
-> [(DefinedQuantityDict, ModelExpr)]
-> DefinedQuantityDict
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(DefinedQuantityDict, ModelExpr)]
-> (DefinedQuantityDict, ModelExpr)
forall a. HasCallStack => [a] -> a
head) [(DefinedQuantityDict, ModelExpr)]
vecs), ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
vector, String -> Sentence
S String
"to yield the required", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation]