{-# LANGUAGE PostfixOperators #-}
module Drasil.SglPend.GenDefs (genDefns, velocityIXGD, velocityIYGD,
accelerationIXGD, accelerationIYGD, hForceOnPendulumGD, vForceOnPendulumGD,
angFrequencyGD, periodPend) where
import Prelude hiding (cos, sin, sqrt)
import qualified Data.List.NonEmpty as NE
import Language.Drasil
import Theory.Drasil (GenDefn, gdNoRefs,
equationalModel', equationalModelU, equationalRealmU,
MultiDefn, mkDefiningExpr, mkMultiDefnForQuant)
import Utils.Drasil (weave)
import Language.Drasil.Chunk.Concept.NamedCombinators
import qualified Language.Drasil.Sentence.Combinators as S
import qualified Language.Drasil.NounPhrase.Combinators as NP
import Data.Drasil.Concepts.Math (xComp, yComp, equation, component, direction, angle)
import Data.Drasil.Quantities.Physics (velocity, acceleration, force,
momentOfInertia, torque, angularDisplacement, angularFrequency,
frequency, period, xAccel, xVel, yAccel, yVel)
import Data.Drasil.Concepts.Physics (pendulum, weight, shm)
import Data.Drasil.Quantities.PhysicalProperties (mass, len)
import Data.Drasil.Theories.Physics (newtonSLR)
import Drasil.SglPend.DataDefs (frequencyDD, periodSHMDD, angFrequencyDD)
import qualified Drasil.SglPend.Derivations as D
import qualified Drasil.SglPend.Expressions as E
import Drasil.SglPend.Unitals (lenRod, pendDisplacementAngle)
import Drasil.DblPend.Concepts (arcLen, horizontalPos,
verticalPos, horizontalVel, verticalVel, horizontalForce, verticalForce)
genDefns :: [GenDefn]
genDefns :: [GenDefn]
genDefns = [GenDefn
velocityIXGD, GenDefn
velocityIYGD, GenDefn
accelerationIXGD, GenDefn
accelerationIYGD,
GenDefn
hForceOnPendulumGD, GenDefn
vForceOnPendulumGD, GenDefn
angFrequencyGD, GenDefn
periodPend]
velocityIXGD :: GenDefn
velocityIXGD :: GenDefn
velocityIXGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
velocityIXQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
velocity)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
velocityIXDeriv) String
"velocityIX" []
velocityIXQD :: ModelQDef
velocityIXQD :: ModelQDef
velocityIXQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
xVel (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
xComp NP -> NP -> NP
`NP.of_` (UnitalChunk
velocity UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))
(ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.velocityIXExpr
velocityIXDeriv :: Derivation
velocityIXDeriv :: Derivation
velocityIXDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
xComp ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
velocity))) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
velocityIXDerivSents, [Sentence]
velocityIXDerivEqns])
velocityIXDerivSents :: [Sentence]
velocityIXDerivSents :: [Sentence]
velocityIXDerivSents = [Sentence
velocityDerivSent1, Sentence
velocityIXDerivSent2, Sentence
velocityDerivSent3,
Sentence
velocityDerivSent4, Sentence
velocityDerivSent5]
velocityIXDerivEqns :: [Sentence]
velocityIXDerivEqns :: [Sentence]
velocityIXDerivEqns = (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.velocityIXDerivEqns [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIXQD]
velocityDerivSent1, velocityIXDerivSent2, velocityDerivSent3,
velocityDerivSent4, velocityDerivSent5 :: Sentence
velocityDerivSent1 :: Sentence
velocityDerivSent1 = String -> Sentence
S String
"At a given point in time" Sentence -> Sentence -> Sentence
`sC` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
velocity Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"may be defined as"
velocityIXDerivSent2 :: Sentence
velocityIXDerivSent2 = String -> Sentence
S String
"We also know the" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
horizontalPos
velocityDerivSent3 :: Sentence
velocityDerivSent3 = String -> Sentence
S String
"Applying this,"
velocityDerivSent4 :: Sentence
velocityDerivSent4 = UnitalChunk -> Sentence
forall t. Express t => t -> Sentence
eS' UnitalChunk
lenRod Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"constant" Sentence -> Sentence -> Sentence
`S.wrt` String -> Sentence
S String
"time, so"
velocityDerivSent5 :: Sentence
velocityDerivSent5 = String -> Sentence
S String
"Therefore, using the chain rule,"
velocityIYGD :: GenDefn
velocityIYGD :: GenDefn
velocityIYGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
velocityIYQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
velocity)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
velocityIYDeriv) String
"velocityIY" []
velocityIYQD :: ModelQDef
velocityIYQD :: ModelQDef
velocityIYQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
yVel (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
yComp NP -> NP -> NP
`NP.of_` (UnitalChunk
velocity UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) (ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.velocityIYExpr
velocityIYDeriv :: Derivation
velocityIYDeriv :: Derivation
velocityIYDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
yComp ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
velocity))) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
velocityIYDerivSents, [Sentence]
velocityIYDerivEqns])
velocityIYDerivSents :: [Sentence]
velocityIYDerivSents :: [Sentence]
velocityIYDerivSents = [Sentence
velocityDerivSent1, Sentence
velocityIYDerivSent2, Sentence
velocityDerivSent3,
Sentence
velocityDerivSent4, Sentence
velocityDerivSent5]
velocityIYDerivEqns :: [Sentence]
velocityIYDerivEqns :: [Sentence]
velocityIYDerivEqns = (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.velocityIYDerivEqns [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIYQD]
velocityIYDerivSent2 :: Sentence
velocityIYDerivSent2 :: Sentence
velocityIYDerivSent2 = String -> Sentence
S String
"We also know the" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
verticalPos
accelerationIXGD :: GenDefn
accelerationIXGD :: GenDefn
accelerationIXGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
accelerationIXQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
acceleration)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
accelerationIXDeriv) String
"accelerationIX" []
accelerationIXQD :: ModelQDef
accelerationIXQD :: ModelQDef
accelerationIXQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
xAccel (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
xComp NP -> NP -> NP
`NP.of_` (UnitalChunk
acceleration UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))
(ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.accelerationIXExpr
accelerationIXDeriv :: Derivation
accelerationIXDeriv :: Derivation
accelerationIXDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
xComp ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
acceleration))) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
accelerationIXDerivSents, [Sentence]
accelerationIXDerivEqns])
accelerationIXDerivSents :: [Sentence]
accelerationIXDerivSents :: [Sentence]
accelerationIXDerivSents = [Sentence
accelerationDerivSent1, Sentence
accelerationIXDerivSent2, Sentence
accelerationDerivSent3,
Sentence
accelerationDerivSent4, Sentence
accelerationDerivSent5]
accelerationIXDerivEqns :: [Sentence]
accelerationIXDerivEqns :: [Sentence]
accelerationIXDerivEqns = ModelExpr -> Sentence
eS ModelExpr
D.accelerationIDerivEqn1 Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIXQD Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
:
(ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr
D.accelerationIXDerivEqn3, ModelExpr
D.accelerationIXDerivEqn4] [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
accelerationIXQD]
accelerationDerivSent1, accelerationIXDerivSent2, accelerationDerivSent3,
accelerationDerivSent4, accelerationDerivSent5 :: Sentence
accelerationDerivSent1 :: Sentence
accelerationDerivSent1 = String -> Sentence
S String
"Our" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
acceleration Sentence -> Sentence -> Sentence
+: String -> Sentence
S String
"is"
accelerationIXDerivSent2 :: Sentence
accelerationIXDerivSent2 = String -> Sentence
S String
"Earlier" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we found the" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
horizontalVel Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"to be"
accelerationDerivSent3 :: Sentence
accelerationDerivSent3 = String -> Sentence
S String
"Applying this to our equation for" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
acceleration
accelerationDerivSent4 :: Sentence
accelerationDerivSent4 = String -> Sentence
S String
"By the product and chain rules, we find"
accelerationDerivSent5 :: Sentence
accelerationDerivSent5 = String -> Sentence
S String
"Simplifying,"
accelerationIYGD :: GenDefn
accelerationIYGD :: GenDefn
accelerationIYGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (ModelQDef -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
accelerationIYQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
acceleration)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
accelerationIYDeriv) String
"accelerationIY" []
accelerationIYQD :: ModelQDef
accelerationIYQD :: ModelQDef
accelerationIYQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
yAccel (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
yComp NP -> NP -> NP
`NP.of_` (UnitalChunk
acceleration UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) (ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.accelerationIYExpr
accelerationIYDeriv :: Derivation
accelerationIYDeriv :: Derivation
accelerationIYDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
yComp ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
acceleration))) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
accelerationIYDerivSents, [Sentence]
accelerationIYDerivEqns])
accelerationIYDerivSents :: [Sentence]
accelerationIYDerivSents :: [Sentence]
accelerationIYDerivSents = [Sentence
accelerationDerivSent1, Sentence
accelerationIYDerivSent2, Sentence
accelerationDerivSent3,
Sentence
accelerationDerivSent4, Sentence
accelerationDerivSent5]
accelerationIYDerivEqns :: [Sentence]
accelerationIYDerivEqns :: [Sentence]
accelerationIYDerivEqns = ModelExpr -> Sentence
eS ModelExpr
D.accelerationIDerivEqn1 Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
: ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIYQD Sentence -> [Sentence] -> [Sentence]
forall a. a -> [a] -> [a]
:
(ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr
D.accelerationIYDerivEqn3, ModelExpr
D.accelerationIYDerivEqn4] [Sentence] -> [Sentence] -> [Sentence]
forall a. [a] -> [a] -> [a]
++ [ModelQDef -> Sentence
forall t. Express t => t -> Sentence
eS' ModelQDef
accelerationIYQD]
accelerationIYDerivSent2 :: Sentence
accelerationIYDerivSent2 :: Sentence
accelerationIYDerivSent2 = String -> Sentence
S String
"Earlier" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we found the" Sentence -> Sentence -> Sentence
+:+ IdeaDict -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
verticalVel Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"to be"
hForceOnPendulumGD :: GenDefn
hForceOnPendulumGD :: GenDefn
hForceOnPendulumGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (String -> MultiDefn ModelExpr -> ModelKind ModelExpr
forall e. String -> MultiDefn e -> ModelKind e
equationalRealmU String
"hForceOnPendulum" MultiDefn ModelExpr
hForceOnPendulumMD)
(UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force) (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
hForceOnPendulumDeriv) String
"hForceOnPendulum" []
hForceOnPendulumMD :: MultiDefn ModelExpr
hForceOnPendulumMD :: MultiDefn ModelExpr
hForceOnPendulumMD = QuantityDict
-> Sentence
-> NonEmpty (DefiningExpr ModelExpr)
-> MultiDefn ModelExpr
forall e.
QuantityDict
-> Sentence -> NonEmpty (DefiningExpr e) -> MultiDefn e
mkMultiDefnForQuant QuantityDict
quant Sentence
EmptyS NonEmpty (DefiningExpr ModelExpr)
defns
where quant :: QuantityDict
quant = String
-> NP
-> Maybe String
-> Space
-> (Stage -> Symbol)
-> Maybe UnitDefn
-> QuantityDict
mkQuant' String
"force" (IdeaDict
horizontalForce IdeaDict -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)
Maybe String
forall a. Maybe a
Nothing Space
Real (UnitalChunk -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
force) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force)
defns :: NonEmpty (DefiningExpr ModelExpr)
defns = [DefiningExpr ModelExpr] -> NonEmpty (DefiningExpr ModelExpr)
forall a. HasCallStack => [a] -> NonEmpty a
NE.fromList [
String -> [UID] -> Sentence -> ModelExpr -> DefiningExpr ModelExpr
forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"hForceOnPendulumViaComponent"
[] Sentence
EmptyS (ModelExpr -> DefiningExpr ModelExpr)
-> ModelExpr -> DefiningExpr ModelExpr
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.hForceOnPendulumViaComponent,
String -> [UID] -> Sentence -> ModelExpr -> DefiningExpr ModelExpr
forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"hForceOnPendulumViaAngle"
[] Sentence
EmptyS (ModelExpr -> DefiningExpr ModelExpr)
-> ModelExpr -> DefiningExpr ModelExpr
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.hForceOnPendulumViaAngle
]
hForceOnPendulumDeriv :: Derivation
hForceOnPendulumDeriv :: Derivation
hForceOnPendulumDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
force UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)) [MultiDefn ModelExpr -> Sentence
forall t. Express t => t -> Sentence
eS' MultiDefn ModelExpr
hForceOnPendulumMD]
vForceOnPendulumGD :: GenDefn
vForceOnPendulumGD :: GenDefn
vForceOnPendulumGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (String -> MultiDefn ModelExpr -> ModelKind ModelExpr
forall e. String -> MultiDefn e -> ModelKind e
equationalRealmU String
"vForceOnPendulum" MultiDefn ModelExpr
vForceOnPendulumMD)
(UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force) (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
vForceOnPendulumDeriv) String
"vForceOnPendulum" []
vForceOnPendulumMD :: MultiDefn ModelExpr
vForceOnPendulumMD :: MultiDefn ModelExpr
vForceOnPendulumMD = QuantityDict
-> Sentence
-> NonEmpty (DefiningExpr ModelExpr)
-> MultiDefn ModelExpr
forall e.
QuantityDict
-> Sentence -> NonEmpty (DefiningExpr e) -> MultiDefn e
mkMultiDefnForQuant QuantityDict
quant Sentence
EmptyS NonEmpty (DefiningExpr ModelExpr)
defns
where quant :: QuantityDict
quant = String
-> NP
-> Maybe String
-> Space
-> (Stage -> Symbol)
-> Maybe UnitDefn
-> QuantityDict
mkQuant' String
"force" (IdeaDict
verticalForce IdeaDict -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)
Maybe String
forall a. Maybe a
Nothing Space
Real (UnitalChunk -> Stage -> Symbol
forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
force) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force)
defns :: NonEmpty (DefiningExpr ModelExpr)
defns = [DefiningExpr ModelExpr] -> NonEmpty (DefiningExpr ModelExpr)
forall a. HasCallStack => [a] -> NonEmpty a
NE.fromList [
String -> [UID] -> Sentence -> ModelExpr -> DefiningExpr ModelExpr
forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"vForceOnPendulumViaComponent"
[] Sentence
EmptyS (ModelExpr -> DefiningExpr ModelExpr)
-> ModelExpr -> DefiningExpr ModelExpr
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.vForceOnPendulumViaComponent,
String -> [UID] -> Sentence -> ModelExpr -> DefiningExpr ModelExpr
forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"vForceOnPendulumViaAngle"
[] Sentence
EmptyS (ModelExpr -> DefiningExpr ModelExpr)
-> ModelExpr -> DefiningExpr ModelExpr
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.vForceOnPendulumViaAngle
]
vForceOnPendulumDeriv :: Derivation
vForceOnPendulumDeriv :: Derivation
vForceOnPendulumDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
force UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)) [MultiDefn ModelExpr -> Sentence
forall t. Express t => t -> Sentence
eS' MultiDefn ModelExpr
vForceOnPendulumMD]
angFrequencyGD :: GenDefn
angFrequencyGD :: GenDefn
angFrequencyGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (String -> ModelQDef -> ModelKind ModelExpr
forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"angFrequencyGD" ModelQDef
angFrequencyQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
angularFrequency)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
angFrequencyDeriv) String
"angFrequencyGD" [Sentence
angFrequencyGDNotes]
angFrequencyQD :: ModelQDef
angFrequencyQD :: ModelQDef
angFrequencyQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
angularFrequency (UnitalChunk
angularFrequency UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
pendulum) (ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.angFrequencyExpr
angFrequencyDeriv :: Derivation
angFrequencyDeriv :: Derivation
angFrequencyDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
angularFrequency UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
pendulum)) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
angFrequencyDerivSents, (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.angFrequencyDerivEqns])
angFrequencyDerivSents :: [Sentence]
angFrequencyDerivSents :: [Sentence]
angFrequencyDerivSents = [Sentence
angFrequencyDerivSent1, Sentence
angFrequencyDerivSent2, Sentence
angFrequencyDerivSent3,
Sentence
angFrequencyDerivSent4, Sentence
angFrequencyDerivSent5, Sentence
angFrequencyDerivSent6, Sentence
angFrequencyDerivSent7]
angFrequencyDerivSent1, angFrequencyDerivSent2, angFrequencyDerivSent3,
angFrequencyDerivSent4, angFrequencyDerivSent5, angFrequencyDerivSent6, angFrequencyDerivSent7 :: Sentence
angFrequencyDerivSent1 :: Sentence
angFrequencyDerivSent1 = [Sentence] -> Sentence
foldlSentCol [String -> Sentence
S String
"Consider the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque, String -> Sentence
S String
"on a", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
pendulum Sentence -> Sentence -> Sentence
+:+. TheoryModel -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
definedIn'' TheoryModel
newtonSLR,
String -> Sentence
S String
"The", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
force, String -> Sentence
S String
"providing the restoring", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.is` NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk -> NP
forall t. NamedIdea t => t -> NP
the ConceptChunk
component NP -> NP -> NP
`NP.of_`
(ConceptChunk
weight ConceptChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)), String -> Sentence
S String
"bob that acts along the" Sentence -> Sentence -> Sentence
+:+. ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
arcLen,
(UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.isThe` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
len) Sentence -> Sentence -> Sentence
`S.the_ofTheC` String -> Sentence
S String
"string", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
lenRod, String -> Sentence
S String
"multiplied by", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
component
Sentence -> Sentence -> Sentence
`S.the_ofThe` String -> Sentence
S String
"net", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
force, String -> Sentence
S String
"that is perpendicular to", String -> Sentence
S String
"radius" Sentence -> Sentence -> Sentence
`S.the_ofThe` (String -> Sentence
S String
"arc" !.),
String -> Sentence
S String
"The minus sign indicates the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque, String -> Sentence
S String
"acts in the opposite", NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
direction ConceptChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe`UnitalChunk
angularDisplacement)]
angFrequencyDerivSent2 :: Sentence
angFrequencyDerivSent2 = String -> Sentence
S String
"So then"
angFrequencyDerivSent3 :: Sentence
angFrequencyDerivSent3 = String -> Sentence
S String
"Therefore,"
angFrequencyDerivSent4 :: Sentence
angFrequencyDerivSent4 = String -> Sentence
S String
"Substituting for" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
momentOfInertia
angFrequencyDerivSent5 :: Sentence
angFrequencyDerivSent5 = String -> Sentence
S String
"Crossing out" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
mass Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
lenRod Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"we have"
angFrequencyDerivSent6 :: Sentence
angFrequencyDerivSent6 = String -> Sentence
S String
"For small" Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
plural ConceptChunk
angle Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we approximate" Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"sin" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisplacementAngle Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"to" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisplacementAngle
angFrequencyDerivSent7 :: Sentence
angFrequencyDerivSent7 = String -> Sentence
S String
"Because this" Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"has the same form as the" Sentence -> Sentence -> Sentence
+:+ NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
equation ConceptChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`for` ConceptChunk
shm) Sentence -> Sentence -> Sentence
+:+.
String -> Sentence
S String
"the solution is easy to find" Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
" The" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
angularFrequency
angFrequencyGDNotes :: Sentence
angFrequencyGDNotes :: Sentence
angFrequencyGDNotes = String -> Sentence
S String
"The" Sentence -> Sentence -> Sentence
+:+ UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.is` TheoryModel -> Sentence
forall r. (Referable r, HasShortName r) => r -> Sentence
definedIn'' TheoryModel
newtonSLR Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
frequency Sentence -> Sentence -> Sentence
`S.is` DataDefinition -> Sentence
forall r.
(Referable r, HasShortName r, DefinesQuantity r) =>
r -> Sentence
definedIn DataDefinition
frequencyDD
periodPend :: GenDefn
periodPend :: GenDefn
periodPend = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (String -> ModelQDef -> ModelKind ModelExpr
forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"periodPendGD" ModelQDef
periodPendQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
period)
(Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
periodPendDeriv) String
"periodPend" [Sentence
periodPendNotes]
periodPendQD :: ModelQDef
periodPendQD :: ModelQDef
periodPendQD = UnitalChunk -> NP -> ModelExpr -> ModelQDef
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
period (NP -> NP
NP.the (UnitalChunk
period UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) (ModelExpr -> ModelQDef) -> ModelExpr -> ModelQDef
forall a b. (a -> b) -> a -> b
$ Expr -> ModelExpr
forall c. Express c => c -> ModelExpr
express Expr
E.periodPendExpr
periodPendDeriv :: Derivation
periodPendDeriv :: Derivation
periodPendDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (NP -> Sentence
forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (UnitalChunk
period UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))) ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
periodPendDerivSents, (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.periodPendDerivEqns])
periodPendDerivSents :: [Sentence]
periodPendDerivSents :: [Sentence]
periodPendDerivSents = [Sentence
periodPendDerivSent1, Sentence
periodPendDerivSent2]
periodPendDerivSent1, periodPendDerivSent2 :: Sentence
periodPendDerivSent1 :: Sentence
periodPendDerivSent1 = NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (UnitalChunk
period UnitalChunk -> ConceptChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
pendulum) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"can be defined from the general definition for the" Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation Sentence -> Sentence -> Sentence
`S.of_`
GenDefn -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef GenDefn
angFrequencyGD (DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
angFrequencyDD)
periodPendDerivSent2 :: Sentence
periodPendDerivSent2 = String -> Sentence
S String
"Therefore from the data definition of the" Sentence -> Sentence -> Sentence
+:+ ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation Sentence -> Sentence -> Sentence
`S.for` DataDefinition -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
angFrequencyDD (DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
angFrequencyDD) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have"
periodPendNotes :: Sentence
periodPendNotes :: Sentence
periodPendNotes = NP -> Sentence
forall n. NounPhrase n => n -> Sentence
atStartNP (NP -> NP
NP.the (UnitalChunk
frequency UnitalChunk -> UnitalChunk -> NP
forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`and_` UnitalChunk
period)) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"are defined in the data definitions for" Sentence -> Sentence -> Sentence
+:+ DataDefinition -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
frequencyDD (DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
frequencyDD) Sentence -> Sentence -> Sentence
`S.and_`
DataDefinition -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
periodSHMDD (DataDefinition -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
periodSHMDD) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"respectively"