-- | Defines concepts used in the field of math.
module Data.Drasil.Concepts.Math where

import Language.Drasil hiding (number, norm, matrix)
import Language.Drasil.ShortHands (lX, lY, lZ)
import Data.Drasil.Domains (mathematics)
import Data.Drasil.Citations (cartesianWiki, lineSource, pointSource)
import qualified Language.Drasil.Sentence.Combinators as S
import Language.Drasil.Chunk.Concept.NamedCombinators

-- | Collects all math-related concepts.
mathcon :: [ConceptChunk]
mathcon :: [ConceptChunk]
mathcon = [ConceptChunk
amplitude, ConceptChunk
angle, ConceptChunk
area, ConceptChunk
axis, ConceptChunk
calculation, ConceptChunk
cartesian, ConceptChunk
centre, ConceptChunk
change, ConceptChunk
component,
  ConceptChunk
constraint, ConceptChunk
diameter, ConceptChunk
direction, ConceptChunk
equation, ConceptChunk
euclidN, ConceptChunk
euclidSpace, ConceptChunk
gradient, ConceptChunk
graph, ConceptChunk
laplaceTransform, ConceptChunk
law, ConceptChunk
line, ConceptChunk
matrix,
  ConceptChunk
norm, ConceptChunk
normal, ConceptChunk
normalV, ConceptChunk
number, ConceptChunk
orient, ConceptChunk
origin, ConceptChunk
parameter, ConceptChunk
perp, ConceptChunk
perpV, ConceptChunk
pi_, ConceptChunk
negInf, ConceptChunk
posInf, ConceptChunk
positive, ConceptChunk
negative,
  ConceptChunk
point, ConceptChunk
probability, ConceptChunk
rOfChng, ConceptChunk
rate, ConceptChunk
rightHand, ConceptChunk
shape, ConceptChunk
surArea, ConceptChunk
surface, ConceptChunk
unitV, ConceptChunk
unit_, ConceptChunk
vector, 
  ConceptChunk
xAxis, ConceptChunk
xCoord, ConceptChunk
xComp, ConceptChunk
xDir, ConceptChunk
yAxis, ConceptChunk
yCoord, ConceptChunk
yComp, ConceptChunk
yDir, ConceptChunk
zAxis, ConceptChunk
zCoord, ConceptChunk
zComp, ConceptChunk
zDir, ConceptChunk
iAngle]

-- | Collects all math-related common ideas (like a concept, but with no definition).
mathcon' :: [CI]
mathcon' :: [CI]
mathcon' = [CI
de, CI
leftSide, CI
ode, CI
pde, CI
rightSide]

-- * Mathematical Concepts

amplitude, angle, area, axis, calculation, cartesian, centre, change, component, constraint, diameter,
  direction, equation, euclidN, euclidSpace, gradient, graph, laplaceTransform, law, line, matrix, norm, normal, normalV, 
  number, orient, origin, parameter, perp, perpV, pi_, negInf, posInf, positive, negative, point, probability,
  rOfChng, rate, rightHand, shape, surArea, surface, unitV, unit_, vector, xAxis, xCoord, xComp, xDir,
  yAxis, yCoord,  yComp, yDir, zAxis, zCoord, zComp, zDir, iAngle :: ConceptChunk

  
amplitude :: ConceptChunk
amplitude   = String -> NP -> String -> ConceptChunk
dcc String
"amplitude"    (String -> NP
nounPhraseSP String
"amplitude")      String
"The peak deviation of a function from zero"
angle :: ConceptChunk
angle       = String -> NP -> String -> ConceptChunk
dcc String
"angle"        (String -> NP
cn' String
"angle")                   String
"the amount of rotation needed to bring one line or plane into coincidence with another"
area :: ConceptChunk
area        = String -> NP -> String -> ConceptChunk
dcc String
"area"         (String -> NP
cn' String
"area")                    String
"a part of an object or surface"
axis :: ConceptChunk
axis        = String -> NP -> String -> ConceptChunk
dcc String
"axis"         (String -> NP
cn' String
"axis")                    String
"a fixed reference line for the measurement of coordinates" 
calculation :: ConceptChunk
calculation = String -> NP -> String -> ConceptChunk
dcc String
"calculation"  (String -> NP
cn' String
"calculation")             String
"a mathematical determination of the size or number of something"
cartesian :: ConceptChunk
cartesian   = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"cartesian" (String -> NP
pn' String
"Cartesian coordinate system") forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"a coordinate system that specifies each point uniquely in a plane by a set" Sentence -> Sentence -> Sentence
`S.of_`
                                                                  String -> Sentence
S String
"numerical coordinates, which are the signed distances to the point from" Sentence -> Sentence -> Sentence
+:+
                                                                  String -> Sentence
S String
"two fixed perpendicular oriented lines, measured in the same unit of length" Sentence -> Sentence -> Sentence
+:+
                                                                  forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource Citation
cartesianWiki
centre :: ConceptChunk
centre       = String -> NP -> String -> ConceptChunk
dcc String
"centre"       (String -> NP
cn' String
"centre")                  String
"the middle point of an object"
change :: ConceptChunk
change       = String -> NP -> String -> ConceptChunk
dcc String
"change"       (String -> NP
cn' String
"change")                  String
"Difference between relative start and end states of an object"
component :: ConceptChunk
component    = String -> NP -> String -> ConceptChunk
dcc String
"component"    (String -> String -> NP
nounPhrase String
"component" String
"components") (String
"The scalar quantity defining the contribution " forall a. [a] -> [a] -> [a]
++
                                                                  String
"of a vector in one of the coordinate directions")
constraint :: ConceptChunk
constraint   = String -> NP -> String -> ConceptChunk
dcc String
"constraint"   (String -> NP
cn' String
"constraint")              String
"A condition that the solution must satisfy"
diameter :: ConceptChunk
diameter     = String -> NP -> String -> ConceptChunk
dcc String
"diameter"     (String -> NP
cn' String
"diameter")                (String
"Any straight line segment that passes through the center of the circle" forall a. [a] -> [a] -> [a]
++
                                                                  String
"and whose endpoints lie on the circle.")
direction :: ConceptChunk
direction    = String -> NP -> String -> ConceptChunk
dcc String
"direction"    (String -> NP
cn' String
"direction")               String
"'which way' a vector points, extending from the tail to the tip"
equation :: ConceptChunk
equation     = String -> NP -> String -> ConceptChunk
dcc String
"equation"     (String -> NP
cn' String
"equation")                String
"A statement that the values of two mathematical expressions are equal "
euclidSpace :: ConceptChunk
euclidSpace  = String -> NP -> String -> ConceptChunk
dcc String
"euclidSpace"  (String -> NP
cn' String
"Euclidean")               (String
"Denoting the system of geometry corresponding to the geometry of ordinary" forall a. [a] -> [a] -> [a]
++
                                                                  String
"experience")
gradient :: ConceptChunk
gradient     = String -> NP -> String -> ConceptChunk
dcc String
"gradient"     (String -> NP
cn' String
"gradient")                String
"degree of steepness of a graph at any point"
graph :: ConceptChunk
graph        = String -> NP -> String -> ConceptChunk
dcc String
"graph"        (String -> NP
cn' String
"graph")                   String
"A diagram showing the relation between variable quantities"
laplaceTransform :: ConceptChunk
laplaceTransform = String -> NP -> String -> ConceptChunk
dcc String
"laplaceTransform" (String -> NP
cn' String
"laplace transform") (String
"An integral transform that converts a function of a real variable t " forall a. [a] -> [a] -> [a]
++
                                                                     String
"(often time) to a function of a complex variable s (complex frequency)")
law :: ConceptChunk
law          = String -> NP -> String -> ConceptChunk
dcc String
"law"          (String -> NP
cn' String
"law")                     String
"a generalization based on a fact or event perceived to be recurrent"
line :: ConceptChunk
line         = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"line"      (String -> NP
pn' String
"line")                    forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"An interval between two points" Sentence -> Sentence -> Sentence
+:+
                                                                  forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource Citation
lineSource
matrix :: ConceptChunk
matrix       = String -> NP -> String -> ConceptChunk
dcc String
"matrix"       (String -> NP
cnICES String
"matrix")               (String
"A rectangular array of quantities or expressions in rows and columns that" forall a. [a] -> [a] -> [a]
++
                                                                 String
"is treated as a single entity and manipulated according to particular rules")
norm :: ConceptChunk
norm        = String -> NP -> String -> ConceptChunk
dcc String
"norm"         (String -> NP
cn' String
"norm")                    String
"the positive length or size of a vector"
normal :: ConceptChunk
normal      = String -> NP -> String -> ConceptChunk
dcc String
"normal"       (String -> NP
cn' String
"normal" )                 String
"an object that is perpendicular to a given object"
number :: ConceptChunk
number      = String -> NP -> String -> ConceptChunk
dcc String
"number"       (String -> NP
cn' String
"number")                  String
"a mathematical object used to count, measure, and label"
orient :: ConceptChunk
orient      = String -> NP -> String -> ConceptChunk
dcc String
"orientation"  (String -> NP
cn' String
"orientation")             String
"the relative physical position or direction of something"
origin :: ConceptChunk
origin      = String -> NP -> String -> ConceptChunk
dcc String
"origin"       (String -> NP
cn' String
"origin")                  String
"a fixed point of reference for the geometry of the surrounding space"
parameter :: ConceptChunk
parameter   = String -> NP -> String -> ConceptChunk
dcc String
"parameter"    (String -> NP
cn' String
"parameter")               String
"a quantity whose value is selected depending on particular circumstances"
--FIXME: Should "parameter" be in math?
perp :: ConceptChunk
perp         = String -> NP -> String -> ConceptChunk
dcc String
"perp"         (String -> NP
cn' String
"perpendicular")          String
"At right angles"
pi_ :: ConceptChunk
pi_          = String -> NP -> String -> ConceptChunk
dcc String
"pi"           (String -> NP
cn' String
"ratio of circumference to diameter for any circle") String
"The ratio of a circle's circumference to its diameter"
posInf :: ConceptChunk
posInf       = String -> NP -> String -> ConceptChunk
dcc String
"PosInf"       (String -> NP
cn' String
"Positive Infinity")      String
"the limit of a sequence or function that eventually exceeds any prescribed bound"
negInf :: ConceptChunk
negInf       = String -> NP -> String -> ConceptChunk
dcc String
"NegInf"       (String -> NP
cn' String
"Negative Infinity")      String
"Opposite of positive infinity"
positive :: ConceptChunk
positive     = String -> NP -> String -> ConceptChunk
dcc String
"positive"     (String -> NP
cn' String
"positive")               String
"greater than zero"
negative :: ConceptChunk
negative     = String -> NP -> String -> ConceptChunk
dcc String
"negative"     (String -> NP
cn' String
"negative")               String
"less than zero"
point :: ConceptChunk
point        = String -> NP -> Sentence -> ConceptChunk
dccWDS String
"point"     (String -> NP
pn' String
"point")                   forall a b. (a -> b) -> a -> b
$ String -> Sentence
S String
"An exact location, it has no size, only position" Sentence -> Sentence -> Sentence
+:+
                                                                  forall r. (Referable r, HasShortName r) => r -> Sentence
fromSource Citation
pointSource
probability :: ConceptChunk
probability  = String -> NP -> String -> ConceptChunk
dcc String
"probability"  (String -> NP
cnIES String
"probability")          String
"The likelihood of an event to occur"
rate :: ConceptChunk
rate         = String -> NP -> String -> ConceptChunk
dcc String
"rate"         (String -> NP
cn' String
"rate")                   String
"Ratio that compares two quantities having different units of measure"
rightHand :: ConceptChunk
rightHand    = String -> NP -> String -> ConceptChunk
dcc String
"rightHand"    (String -> NP
cn' String
"right-handed coordinate system")  String
"A coordinate system where the positive z-axis comes out of the screen."
shape :: ConceptChunk
shape        = String -> NP -> String -> ConceptChunk
dcc String
"shape"        (String -> NP
cn' String
"shape")                  String
"The outline of an area or figure"
surface :: ConceptChunk
surface      = String -> NP -> String -> ConceptChunk
dcc String
"surface"      (String -> NP
cn' String
"surface")                String
"The outer or topmost boundary of an object"
unit_ :: ConceptChunk
unit_        = String -> NP -> String -> ConceptChunk
dcc String
"unit"         (String -> NP
cn' String
"unit")                   String
"Identity element"
vector :: ConceptChunk
vector       = String -> NP -> String -> ConceptChunk
dcc String
"vector"       (String -> NP
cn' String
"vector")                 String
"Object with magnitude and direction"

xAxis :: ConceptChunk
xAxis = String -> NP -> String -> ConceptChunk
dcc String
"xAxis" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lX Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-axis") String
"the primary axis of a system of coordinates"
yAxis :: ConceptChunk
yAxis = String -> NP -> String -> ConceptChunk
dcc String
"yAxis" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lY Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-axis") String
"the secondary axis of a system of coordinates"
zAxis :: ConceptChunk
zAxis = String -> NP -> String -> ConceptChunk
dcc String
"zAxis" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lZ Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-axis") String
"the tertiary axis of a system of coordinates"

xCoord :: ConceptChunk
xCoord = String -> NP -> String -> ConceptChunk
dcc String
"xCoord" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lX Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-coordinate") String
"the location of the point on the x-axis"
yCoord :: ConceptChunk
yCoord = String -> NP -> String -> ConceptChunk
dcc String
"yCoord" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lY Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-coordinate") String
"the location of the point on the y-axis"
zCoord :: ConceptChunk
zCoord = String -> NP -> String -> ConceptChunk
dcc String
"zCoord" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lZ Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-coordinate") String
"the location of the point on the z-axis"

xComp :: ConceptChunk
xComp = String -> NP -> String -> ConceptChunk
dcc String
"xComp" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lX Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-component") String
"the component of a vector in the x-direction"
yComp :: ConceptChunk
yComp = String -> NP -> String -> ConceptChunk
dcc String
"yComp" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lY Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-component") String
"the component of a vector in the y-direction"
zComp :: ConceptChunk
zComp = String -> NP -> String -> ConceptChunk
dcc String
"zComp" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lZ Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-component") String
"the component of a vector in the z-direction"

xDir :: ConceptChunk
xDir = String -> NP -> String -> ConceptChunk
dcc String
"xDir" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lX Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-direction") String
"the direction aligned with the x-axis"
yDir :: ConceptChunk
yDir = String -> NP -> String -> ConceptChunk
dcc String
"yDir" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lY Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-direction") String
"the direction aligned with the y-axis"
zDir :: ConceptChunk
zDir = String -> NP -> String -> ConceptChunk
dcc String
"zDir" (Sentence -> NP
nounPhraseSent forall a b. (a -> b) -> a -> b
$ Symbol -> Sentence
P Symbol
lZ Sentence -> Sentence -> Sentence
:+: String -> Sentence
S String
"-direction") String
"the direction aligned with the z-axis"
iAngle :: ConceptChunk
iAngle = String -> NP -> String -> ConceptChunk
dcc String
"iAngle" (String -> NP
cn String
"initial angle")                      String
"The initial angle where the body is being displaced"

de, leftSide, ode, pde, rightSide :: CI
--FIXME: use nounphrase instead of cn'
de :: CI
de  = String -> NP -> String -> [IdeaDict] -> CI
commonIdeaWithDict String
"de"  (String -> NP
cn' String
"differential equation")          String
"DE"  [IdeaDict
mathematics]
ode :: CI
ode = String -> NP -> String -> [IdeaDict] -> CI
commonIdeaWithDict String
"ode" (String -> NP
cn' String
"ordinary differential equation") String
"ODE" [IdeaDict
mathematics]
pde :: CI
pde = String -> NP -> String -> [IdeaDict] -> CI
commonIdeaWithDict String
"pde" (String -> NP
cn' String
"partial differential equation")  String
"PDE" [IdeaDict
mathematics]

leftSide :: CI
leftSide  = String -> NP -> String -> [IdeaDict] -> CI
commonIdeaWithDict String
"leftSide"  (String -> String -> NP
nounPhrase String
"left-hand side"  String
"left-hand sides" ) String
"LHS" [IdeaDict
mathematics]
rightSide :: CI
rightSide = String -> NP -> String -> [IdeaDict] -> CI
commonIdeaWithDict String
"rightSide" (String -> String -> NP
nounPhrase String
"right-hand side" String
"right-hand sides") String
"RHS" [IdeaDict
mathematics]

--FIXME: COMBINATION HACK (all below)
-- do we really need fterms here? Would combineNINI work?
euclidN :: ConceptChunk
euclidN = String -> NP -> String -> ConceptChunk
dcc String
"euclidNorm"    (forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
euclidSpace ConceptChunk
norm) String
"euclidean norm"
normalV :: ConceptChunk
normalV = String -> NP -> String -> ConceptChunk
dcc String
"normal vector" (forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
normal ConceptChunk
vector) String
"unit outward normal vector for a surface"
perpV :: ConceptChunk
perpV   = String -> NP -> String -> ConceptChunk
dcc String
"perp_vect"     (forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
perp ConceptChunk
vector) String
"vector perpendicular or 90 degrees to another vector"
rOfChng :: ConceptChunk
rOfChng = String -> NP -> String -> ConceptChunk
dcc String
"rOfChng"       (ConceptChunk
rate forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
`of_` ConceptChunk
change) String
"ratio between a change in one variable relative to a corresponding change in another"
surArea :: ConceptChunk
surArea = String -> NP -> String -> ConceptChunk
dcc String
"surArea"       (forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
surface ConceptChunk
area) String
"a measure of the total area that the surface of the object occupies"
unitV :: ConceptChunk
unitV   = String -> NP -> String -> ConceptChunk
dcc String
"unit_vect"     (forall c d. (NamedIdea c, NamedIdea d) => c -> d -> NP
combineNINI ConceptChunk
unit_ ConceptChunk
vector) String
"a vector that has a magnitude of one"