{-# LANGUAGE PostfixOperators #-}
module Drasil.GamePhysics.GenDefs (generalDefns, accelGravityGD, impulseGD) where

import Language.Drasil
import qualified Language.Drasil.Sentence.Combinators as S
import Theory.Drasil (GenDefn, gd, equationalModel')
import Utils.Drasil (weave)
import qualified Data.Drasil.Quantities.Physics as QP (acceleration,
 gravitationalAccel, gravitationalConst, restitutionCoef, impulseS, force,
 fOfGravity)
import Drasil.GamePhysics.Unitals (mLarger, dispNorm, dVect, massA, massB,
  momtInertA, momtInertB, normalLen, normalVect, perpLenA, perpLenB, initRelVel,
  mass_1, mass_2, sqrDist, distMass)
import Drasil.GamePhysics.DataDefs (collisionAssump, rightHandAssump,
  rigidTwoDAssump)
import Data.Drasil.Concepts.Math as CM (line, cartesian)
import qualified Data.Drasil.Quantities.PhysicalProperties as QPP (mass)
import Drasil.GamePhysics.TMods (newtonLUG)

----- General Models -----

generalDefns :: [GenDefn]
generalDefns :: [GenDefn]
generalDefns = [GenDefn
accelGravityGD, GenDefn
impulseGD]


{-conservationOfMomentGDef :: RelationConcept
conservationOfMomentGDef = makeRC "conservOfMoment" (nounPhraseSP "Conservation of Momentum") 
  conservationOfMomentDesc conservationOfMomentRel

conservationOfMomentRel :: Relation
conservationOfMomentRel = UnaryOp $ Summation Nothing
  C massI

conservationOfMomentDesc :: Sentence
conservationOfMomentDesc = foldlSent [S "In an isolated system,",
  S "where the sum of external", phrase impulseS, S "acting on the system is zero,",
  S "the total momentum of the bodies is constant (conserved)"
  ]

--[mass, initialVelocity, finalVelocity]

conservationOfMomentDeriv :: Sentence
conservationOfMomentDeriv = foldlSent [S "When bodies collide, they exert",
  S "an equal (force) on each other in opposite directions" +:+.
  S "This is Newton's third law:",
  S "(expr1)",
  S "The objects collide with each other for the exact same amount of", 
  phrase time, getS time,
  S "The above equation is equal to the", phrase impulseS, 
  S "(GD1 ref)",
  S "(expr2)",
  S "The", phrase impulseS, S "is equal to the change in momentum:",
  S "(expr3)",
  S "Substituting 2*ref to 2* into 1*ref to 1* yields:",
  S "(expr4)",
  S "Expanding and rearranging the above formula gives",
  S "(expr5)",
  S "Generalizing for multiple (k) colliding objects:",
  S "(expr6)"
  ]
-}

--------------------------Acceleration due to gravity----------------------------
accelGravityGD :: GenDefn
accelGravityGD :: GenDefn
accelGravityGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (QDefinition ModelExpr -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' QDefinition ModelExpr
accelGravityQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
QP.acceleration) (Derivation -> Maybe Derivation
forall a. a -> Maybe a
Just Derivation
accelGravityDeriv)
   [Reference -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Reference
accelGravitySrc] String
"accelGravity" [Sentence
accelGravityDesc]

accelGravityQD :: ModelQDef
accelGravityQD :: QDefinition ModelExpr
accelGravityQD = UnitalChunk -> NP -> ModelExpr -> QDefinition ModelExpr
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
QP.gravitationalAccel (String -> NP
nounPhraseSP String
"Acceleration due to gravity") ModelExpr
PExpr
accelGravityExpr

accelGravityDesc :: Sentence
accelGravityDesc :: Sentence
accelGravityDesc = [Sentence] -> Sentence
foldlSent [String -> Sentence
S String
"If one of the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
plural UnitalChunk
QPP.mass Sentence -> Sentence -> Sentence
`S.is` String -> Sentence
S String
"much larger than the other" Sentence -> Sentence -> Sentence
`sC`
  (String -> Sentence
S String
"it is convenient to define a gravitational field around the larger mass as shown above" !.),
  String -> Sentence
S String
"The negative sign" Sentence -> Sentence -> Sentence
`S.inThe` String -> Sentence
S String
"equation indicates that the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force, String -> Sentence
S String
"is an attractive",
  UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force]

accelGravityExpr :: PExpr
accelGravityExpr :: PExpr
accelGravityExpr = r -> r
forall r. ExprC r => r -> r
neg ((UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalConst r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mLarger r -> r -> r
forall r. ExprC r => r -> r -> r
$/
  r -> r
forall r. (ExprC r, LiteralC r) => r -> r
square (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dispNorm)) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect)

accelGravitySrc :: Reference
accelGravitySrc :: Reference
accelGravitySrc = String -> String -> ShortName -> Reference
makeURI String
"accelGravitySrc" String
"https://en.wikipedia.org/wiki/Gravitational_acceleration" (ShortName -> Reference) -> ShortName -> Reference
forall a b. (a -> b) -> a -> b
$
  Sentence -> ShortName
shortname' (Sentence -> ShortName) -> Sentence -> ShortName
forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"Definition" Sentence -> Sentence -> Sentence
`S.of_` String -> Sentence
S String
"Gravitational Acceleration"

accelGravityDeriv :: Derivation
accelGravityDeriv :: Derivation
accelGravityDeriv = Sentence -> [Sentence] -> Derivation
mkDerivName (UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.gravitationalAccel)
                      ([[Sentence]] -> [Sentence]
forall a. [[a]] -> [a]
weave [[Sentence]
accelGravityDerivSentences, (ModelExpr -> Sentence) -> [ModelExpr] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map ModelExpr -> Sentence
eS [ModelExpr]
forall r. (ExprC r, LiteralC r) => [r]
accelGravityDerivEqns])

accelGravityDerivSentences :: [Sentence]
accelGravityDerivSentences :: [Sentence]
accelGravityDerivSentences = ([Sentence] -> Sentence) -> [[Sentence]] -> [Sentence]
forall a b. (a -> b) -> [a] -> [b]
map [Sentence] -> Sentence
foldlSentCol [[Sentence]
accelGravityDerivSentence1,
 [Sentence]
accelGravityDerivSentence2, [Sentence]
accelGravityDerivSentence3, [Sentence]
accelGravityDerivSentence4,
 [Sentence]
accelGravityDerivSentence5]

accelGravityDerivSentence1 :: [Sentence]
accelGravityDerivSentence1 :: [Sentence]
accelGravityDerivSentence1 = [String -> Sentence
S String
"From", 
        TheoryModel -> Sentence -> Sentence
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> Sentence -> Sentence
namedRef TheoryModel
newtonLUG (String -> Sentence
S String
"Newton's law" Sentence -> Sentence -> Sentence
`S.of_` String -> Sentence
S String
"universal gravitation") Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we have"]


accelGravityDerivSentence2 :: [Sentence]
accelGravityDerivSentence2 :: [Sentence]
accelGravityDerivSentence2 = [(String -> Sentence
S String
"The above equation governs the gravitational attraction between two bodies" !.),
        String -> Sentence
S String
"Suppose that one of the bodies is significantly more massive than the other" Sentence -> Sentence -> Sentence
`sC`
        String -> Sentence
S String
"so that we concern ourselves with the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force,
        String -> Sentence
S String
"the massive body",
        (String -> Sentence
S String
"exerts on the lighter body" !.), String -> Sentence
S String
"Further" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"suppose that the", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
cartesian Sentence -> Sentence -> Sentence
`S.is`
        String -> Sentence
S String
"chosen such that this", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force, String -> Sentence
S String
"acts on a", ConceptChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase ConceptChunk
line,
        (String -> Sentence
S String
"which lies along one" Sentence -> Sentence -> Sentence
`S.ofThe` String -> Sentence
S String
"principal axes" !.),
        String -> Sentence
S String
"Then our", UnitalChunk -> Sentence
forall a. Quantity a => a -> Sentence
getTandS UnitalChunk
dVect, String -> Sentence
S String
"for the x or y axes is"]

accelGravityDerivSentence3 :: [Sentence]
accelGravityDerivSentence3 :: [Sentence]
accelGravityDerivSentence3 = [String -> Sentence
S String
"Given the above assumptions" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"let", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
mLarger Sentence -> Sentence -> Sentence
`S.and_` UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
QPP.mass,
        String -> Sentence
S String
"be", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QPP.mass Sentence -> Sentence -> Sentence
`S.the_ofThe` (String -> Sentence
S String
"massive and light body respectively" !.),
        String -> Sentence
S String
"Equating", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
QP.force, String -> Sentence
S String
"above with Newton's second law",
        String -> Sentence
S String
"for the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force, String -> Sentence
S String
"experienced by the light body" Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
"we get"]

accelGravityDerivSentence4 :: [Sentence]
accelGravityDerivSentence4 :: [Sentence]
accelGravityDerivSentence4 = [String -> Sentence
S String
"where", (UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
QP.gravitationalAccel Sentence -> Sentence -> Sentence
`S.isThe` UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.gravitationalAccel !.),
        String -> Sentence
S String
"Dividing the above equation by", UnitalChunk -> Sentence
forall c. (HasUID c, HasSymbol c) => c -> Sentence
ch UnitalChunk
QPP.mass Sentence -> Sentence -> Sentence
`sC` String -> Sentence
S String
" we have"]

accelGravityDerivSentence5 :: [Sentence]
accelGravityDerivSentence5 :: [Sentence]
accelGravityDerivSentence5 = [String -> Sentence
S String
"and thus the negative sign indicates that the", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force Sentence -> Sentence -> Sentence
`S.is`
                               String -> Sentence
S String
"an attractive", UnitalChunk -> Sentence
forall n. NamedIdea n => n -> Sentence
phrase UnitalChunk
QP.force]

accelGravityDerivEqn1 :: PExpr
accelGravityDerivEqn1 :: PExpr
accelGravityDerivEqn1 = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.force r -> r -> r
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalConst r -> r -> r
forall r. ExprC r => r -> r -> r
$* (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass_1 r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mass_2) r -> r -> r
forall r. ExprC r => r -> r -> r
$/
                        UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
sqrDist) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect

accelGravityDerivEqn2 :: PExpr
accelGravityDerivEqn2 :: PExpr
accelGravityDerivEqn2 = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect r -> r -> r
forall r. ExprC r => r -> r -> r
$= (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
distMass r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dispNorm)

accelGravityDerivEqn3 :: PExpr
accelGravityDerivEqn3 :: PExpr
accelGravityDerivEqn3 = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.fOfGravity r -> r -> r
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalConst r -> r -> r
forall r. ExprC r => r -> r -> r
$* 
                         (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mLarger r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
sqrDist) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect
                         r -> r -> r
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QPP.mass r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalAccel

accelGravityDerivEqn4 :: PExpr
accelGravityDerivEqn4 :: PExpr
accelGravityDerivEqn4 = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalConst r -> r -> r
forall r. ExprC r => r -> r -> r
$* (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mLarger r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
sqrDist) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect r -> r -> r
forall r. ExprC r => r -> r -> r
$= UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalAccel

accelGravityDerivEqn5 :: PExpr
accelGravityDerivEqn5 :: PExpr
accelGravityDerivEqn5 = UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalAccel r -> r -> r
forall r. ExprC r => r -> r -> r
$= r -> r
forall r. ExprC r => r -> r
neg (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
QP.gravitationalConst r -> r -> r
forall r. ExprC r => r -> r -> r
$* (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
mLarger r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
sqrDist)) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
dVect

accelGravityDerivEqns :: (ExprC r, LiteralC r) => [r]
accelGravityDerivEqns :: forall r. (ExprC r, LiteralC r) => [r]
accelGravityDerivEqns = [r
PExpr
accelGravityDerivEqn1, r
PExpr
accelGravityDerivEqn2, r
PExpr
accelGravityDerivEqn3,
                         r
PExpr
accelGravityDerivEqn4, r
PExpr
accelGravityDerivEqn5]



----------------------------Impulse for Collision--------------------------------------------

impulseGD :: GenDefn
impulseGD :: GenDefn
impulseGD = ModelKind ModelExpr
-> Maybe UnitDefn
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
forall u.
IsUnit u =>
ModelKind ModelExpr
-> Maybe u
-> Maybe Derivation
-> [DecRef]
-> String
-> [Sentence]
-> GenDefn
gd (QDefinition ModelExpr -> ModelKind ModelExpr
forall e. QDefinition e -> ModelKind e
equationalModel' QDefinition ModelExpr
impulseQD) (UnitalChunk -> Maybe UnitDefn
forall u. MayHaveUnit u => u -> Maybe UnitDefn
getUnit UnitalChunk
QP.impulseS) Maybe Derivation
forall a. Maybe a
Nothing
  [Reference -> DecRef
forall r.
(HasUID r, HasRefAddress r, HasShortName r) =>
r -> DecRef
dRef Reference
impulseSrc] String
"impulse" [Sentence
rigidTwoDAssump, Sentence
rightHandAssump, Sentence
collisionAssump]

impulseQD :: ModelQDef
impulseQD :: QDefinition ModelExpr
impulseQD = UnitalChunk -> NP -> ModelExpr -> QDefinition ModelExpr
forall c e.
(Quantity c, MayHaveUnit c) =>
c -> NP -> e -> QDefinition e
mkQuantDef' UnitalChunk
QP.impulseS (String -> NP
nounPhraseSP String
"Impulse for Collision") ModelExpr
PExpr
impulseExpr

impulseExpr :: PExpr
impulseExpr :: PExpr
impulseExpr = (r -> r
forall r. ExprC r => r -> r
neg (Integer -> r
forall r. LiteralC r => Integer -> r
exactDbl Integer
1 r -> r -> r
forall r. ExprC r => r -> r -> r
$+ DefinedQuantityDict -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy DefinedQuantityDict
QP.restitutionCoef) r -> r -> r
forall r. ExprC r => r -> r -> r
$* UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
initRelVel r -> r -> r
forall r. ExprC r => r -> r -> r
$.
  UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
normalVect) r -> r -> r
forall r. ExprC r => r -> r -> r
$/ ((r -> r
forall r. (ExprC r, LiteralC r) => r -> r
recip_ (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massA) r -> r -> r
forall r. ExprC r => r -> r -> r
$+ r -> r
forall r. (ExprC r, LiteralC r) => r -> r
recip_ (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
massB)) r -> r -> r
forall r. ExprC r => r -> r -> r
$* 
  r -> r
forall r. (ExprC r, LiteralC r) => r -> r
square (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
normalLen) r -> r -> r
forall r. ExprC r => r -> r -> r
$+
  (r -> r
forall r. (ExprC r, LiteralC r) => r -> r
square (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
perpLenA) r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
momtInertA) r -> r -> r
forall r. ExprC r => r -> r -> r
$+
  (r -> r
forall r. (ExprC r, LiteralC r) => r -> r
square (UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
perpLenB) r -> r -> r
forall r. ExprC r => r -> r -> r
$/ UnitalChunk -> r
forall c. (HasUID c, HasSymbol c) => c -> r
forall r c. (ExprC r, HasUID c, HasSymbol c) => c -> r
sy UnitalChunk
momtInertB))

impulseSrc :: Reference
impulseSrc :: Reference
impulseSrc = String -> String -> ShortName -> Reference
makeURI String
"impulseSrc" String
"http://www.chrishecker.com/images/e/e7/Gdmphys3.pdf" (ShortName -> Reference) -> ShortName -> Reference
forall a b. (a -> b) -> a -> b
$
  Sentence -> ShortName
shortname' (Sentence -> ShortName) -> Sentence -> ShortName
forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"Impulse for Collision Ref"