{-# 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.Documentation (coordinate, symbol_)
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 Drasil.Projectile.Assumptions (cartSyst, constAccel, pointMass, timeStartZero, twoDMotion)
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 = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
velocityIXQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
velocity)
           (forall a. a -> Maybe a
Just Derivation
velocityIXDeriv) String
"velocityIX" [{-Notes-}]

velocityIXQD :: ModelQDef
velocityIXQD :: ModelQDef
velocityIXQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
xVel (forall t. NamedIdea t => t -> NP
the ConceptChunk
xComp NP -> NP -> NP
`NP.of_` (UnitalChunk
velocity forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))
    forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.velocityIXExpr

velocityIXDeriv :: Derivation
velocityIXDeriv :: Derivation
velocityIXDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
xComp forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
velocity))) (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 = forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.velocityIXDerivEqns forall a. [a] -> [a] -> [a]
++ [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` 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
+:+ forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
horizontalPos
velocityDerivSent3 :: Sentence
velocityDerivSent3 = String -> Sentence
S String
"Applying this,"
velocityDerivSent4 :: Sentence
velocityDerivSent4 = 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 = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
velocityIYQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
velocity)
           (forall a. a -> Maybe a
Just Derivation
velocityIYDeriv) String
"velocityIY" [{-Notes-}]

velocityIYQD :: ModelQDef
velocityIYQD :: ModelQDef
velocityIYQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
yVel (forall t. NamedIdea t => t -> NP
the ConceptChunk
yComp NP -> NP -> NP
`NP.of_` (UnitalChunk
velocity forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.velocityIYExpr
 
velocityIYDeriv :: Derivation
velocityIYDeriv :: Derivation
velocityIYDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
yComp forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
velocity))) (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 = forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
D.velocityIYDerivEqns forall a. [a] -> [a] -> [a]
++ [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
+:+ forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
verticalPos

-----------------------
accelerationIXGD :: GenDefn
accelerationIXGD :: GenDefn
accelerationIXGD = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
accelerationIXQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
acceleration)
           (forall a. a -> Maybe a
Just Derivation
accelerationIXDeriv) String
"accelerationIX" [{-Notes-}]

accelerationIXQD :: ModelQDef
accelerationIXQD :: ModelQDef
accelerationIXQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
xAccel (forall t. NamedIdea t => t -> NP
the ConceptChunk
xComp NP -> NP -> NP
`NP.of_` (UnitalChunk
acceleration forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))
    forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.accelerationIXExpr

accelerationIXDeriv :: Derivation
accelerationIXDeriv :: Derivation
accelerationIXDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
xComp forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
acceleration))) (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 forall a. a -> [a] -> [a]
: forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIXQD forall a. a -> [a] -> [a]
:
    forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr
D.accelerationIXDerivEqn3, ModelExpr
D.accelerationIXDerivEqn4] forall a. [a] -> [a] -> [a]
++ [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
+:+ 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
+:+ 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
+:+ 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 = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. QDefinition e -> ModelKind e
equationalModel' ModelQDef
accelerationIYQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
acceleration)
           (forall a. a -> Maybe a
Just Derivation
accelerationIYDeriv) String
"accelerationIY" [{-Notes-}]

accelerationIYQD :: ModelQDef
accelerationIYQD :: ModelQDef
accelerationIYQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
yAccel (forall t. NamedIdea t => t -> NP
the ConceptChunk
yComp NP -> NP -> NP
`NP.of_` (UnitalChunk
acceleration forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.accelerationIYExpr

accelerationIYDeriv :: Derivation
accelerationIYDeriv :: Derivation
accelerationIYDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (ConceptChunk
yComp forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` UnitalChunk
acceleration))) (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 forall a. a -> [a] -> [a]
: forall t. Express t => t -> Sentence
eS' ModelQDef
velocityIYQD forall a. a -> [a] -> [a]
:
    forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr
D.accelerationIYDerivEqn3, ModelExpr
D.accelerationIYDerivEqn4] forall a. [a] -> [a] -> [a]
++ [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
+:+ forall n. NamedIdea n => n -> Sentence
phrase IdeaDict
verticalVel Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"to be"

-------------------------------------Horizontal force acting on the pendulum 
hForceOnPendulumGD :: GenDefn
hForceOnPendulumGD :: GenDefn
hForceOnPendulumGD = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. String -> MultiDefn e -> ModelKind e
equationalRealmU String
"hForceOnPendulum" MultiDefn ModelExpr
hForceOnPendulumMD)
        (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force) (forall a. a -> Maybe a
Just Derivation
hForceOnPendulumDeriv) String
"hForceOnPendulum" [{-Notes-}]

hForceOnPendulumMD :: MultiDefn ModelExpr
hForceOnPendulumMD :: MultiDefn ModelExpr
hForceOnPendulumMD = 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 forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)
                    forall a. Maybe a
Nothing Space
Real (forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
force) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force)
          defns :: NonEmpty (DefiningExpr ModelExpr)
defns = forall a. [a] -> NonEmpty a
NE.fromList [
                    forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"hForceOnPendulumViaComponent"
                      [] Sentence
EmptyS forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.hForceOnPendulumViaComponent,
                    forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"hForceOnPendulumViaAngle"
                      [] Sentence
EmptyS forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.hForceOnPendulumViaAngle
                  ]

hForceOnPendulumDeriv :: Derivation
hForceOnPendulumDeriv :: Derivation
hForceOnPendulumDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
force forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)) [forall t. Express t => t -> Sentence
eS' MultiDefn ModelExpr
hForceOnPendulumMD]

----------------------------------------Vertical force acting on the pendulum 
vForceOnPendulumGD :: GenDefn
vForceOnPendulumGD :: GenDefn
vForceOnPendulumGD = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. String -> MultiDefn e -> ModelKind e
equationalRealmU String
"vForceOnPendulum" MultiDefn ModelExpr
vForceOnPendulumMD)
        (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force) (forall a. a -> Maybe a
Just Derivation
vForceOnPendulumDeriv) String
"vForceOnPendulum" [{-Notes-}]

vForceOnPendulumMD :: MultiDefn ModelExpr
vForceOnPendulumMD :: MultiDefn ModelExpr
vForceOnPendulumMD = 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 forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)
                    forall a. Maybe a
Nothing Space
Real (forall c. HasSymbol c => c -> Stage -> Symbol
symbol UnitalChunk
force) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
force)
          defns :: NonEmpty (DefiningExpr ModelExpr)
defns = forall a. [a] -> NonEmpty a
NE.fromList [
                    forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"vForceOnPendulumViaComponent"
                      [] Sentence
EmptyS forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.vForceOnPendulumViaComponent,
                    forall e. String -> [UID] -> Sentence -> e -> DefiningExpr e
mkDefiningExpr String
"vForceOnPendulumViaAngle"    
                      [] Sentence
EmptyS forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.vForceOnPendulumViaAngle
                  ]

vForceOnPendulumDeriv :: Derivation
vForceOnPendulumDeriv :: Derivation
vForceOnPendulumDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
force forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`onThe` ConceptChunk
pendulum)) [forall t. Express t => t -> Sentence
eS' MultiDefn ModelExpr
vForceOnPendulumMD]

--------------------------------------Angular Frequency Of Pendulum

angFrequencyGD :: GenDefn
angFrequencyGD :: GenDefn
angFrequencyGD = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"angFrequencyGD" ModelQDef
angFrequencyQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
angularFrequency)
           (forall a. a -> Maybe a
Just Derivation
angFrequencyDeriv) String
"angFrequencyGD" [Sentence
angFrequencyGDNotes]

angFrequencyQD :: ModelQDef
angFrequencyQD :: ModelQDef
angFrequencyQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
angularFrequency (UnitalChunk
angularFrequency forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
pendulum) forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.angFrequencyExpr

angFrequencyDeriv :: Derivation
angFrequencyDeriv :: Derivation
angFrequencyDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (UnitalChunk
angularFrequency forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`the_ofThe` ConceptChunk
pendulum)) (forall a. [[a]] -> [a]
weave [[Sentence]
angFrequencyDerivSents, 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", forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque, String -> Sentence
S String
"on a", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
pendulum Sentence -> Sentence -> Sentence
+:+. forall r. (Referable r, HasShortName r) => r -> Sentence
definedIn'' TheoryModel
newtonSLR,
                  String -> Sentence
S String
"The", forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
force, String -> Sentence
S String
"providing the restoring", forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.is` forall n. NounPhrase n => n -> Sentence
phraseNP (forall t. NamedIdea t => t -> NP
the ConceptChunk
component NP -> NP -> NP
`NP.of_`
                  (ConceptChunk
weight 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
+:+. forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
arcLen,
                  (forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.isThe` forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
len) Sentence -> Sentence -> Sentence
`S.the_ofTheC` String -> Sentence
S String
"string", forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
lenRod, String -> Sentence
S String
"multiplied by", forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
component
                  Sentence -> Sentence -> Sentence
`S.the_ofThe` String -> Sentence
S String
"net", 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", forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque, String -> Sentence
S String
"acts in the opposite", forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
direction 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
+:+ forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
momentOfInertia
angFrequencyDerivSent5 :: Sentence
angFrequencyDerivSent5 = String -> Sentence
S String
"Crossing out" Sentence -> Sentence -> Sentence
+:+ forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
mass Sentence -> Sentence -> Sentence
`S.and_` 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
+:+ 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
+:+ forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisplacementAngle Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"to" Sentence -> Sentence -> Sentence
+:+ forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
pendDisplacementAngle
angFrequencyDerivSent7 :: Sentence
angFrequencyDerivSent7 = String -> Sentence
S String
"Because this" Sentence -> Sentence -> 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
+:+ forall n. NounPhrase n => n -> Sentence
phraseNP (ConceptChunk
equation 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
+:+ forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
angularFrequency

angFrequencyGDNotes :: Sentence
angFrequencyGDNotes :: Sentence
angFrequencyGDNotes = String -> Sentence
S String
"The" Sentence -> Sentence -> Sentence
+:+ forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
torque Sentence -> Sentence -> Sentence
`S.is` forall r. (Referable r, HasShortName r) => r -> Sentence
definedIn'' TheoryModel
newtonSLR  Sentence -> Sentence -> Sentence
`S.and_` forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
frequency Sentence -> Sentence -> Sentence
`S.is` forall r.
(Referable r, HasShortName r, DefinesQuantity r) =>
r -> Sentence
definedIn DataDefinition
frequencyDD

 -------------------------------- Period of Pendulum Motion 

periodPend :: GenDefn
periodPend :: GenDefn
periodPend = forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u -> Maybe Derivation -> String -> [Sentence] -> GenDefn
gdNoRefs (forall e. String -> QDefinition e -> ModelKind e
equationalModelU String
"periodPendGD" ModelQDef
periodPendQD) (forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
period)
           (forall a. a -> Maybe a
Just Derivation
periodPendDeriv) String
"periodPend" [Sentence
periodPendNotes]

periodPendQD :: ModelQDef
periodPendQD :: ModelQDef
periodPendQD = forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
period (NP -> NP
NP.the (UnitalChunk
period forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum)) forall a b. (a -> b) -> a -> b
$ forall c. Express c => c -> ModelExpr
express Expr
E.periodPendExpr

periodPendDeriv :: Derivation
periodPendDeriv :: Derivation
periodPendDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (forall n. NounPhrase n => n -> Sentence
phraseNP (NP -> NP
NP.the (UnitalChunk
period forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`ofThe` ConceptChunk
pendulum))) (forall a. [[a]] -> [a]
weave [[Sentence]
periodPendDerivSents, 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 = forall n. NounPhrase n => n -> Sentence
atStartNP (UnitalChunk
period 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
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation Sentence -> Sentence -> Sentence
`S.of_`
                forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef GenDefn
angFrequencyGD (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
+:+ forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
equation Sentence -> Sentence -> Sentence
`S.for` forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
angFrequencyDD (forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
angFrequencyDD) Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have"

periodPendNotes :: Sentence
periodPendNotes :: Sentence
periodPendNotes = forall n. NounPhrase n => n -> Sentence
atStartNP (NP -> NP
NP.the (UnitalChunk
frequency 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
+:+ forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
frequencyDD (forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
frequencyDD) Sentence -> Sentence -> Sentence
`S.and_`
        forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef DataDefinition
periodSHMDD (forall n. NamedIdea n => n -> Sentence
phrase DataDefinition
periodSHMDD) Sentence -> Sentence -> Sentence
+:+ String -> Sentence
S String
"respectively"