Search is not available for this dataset
text
string | meta
dict |
---|---|
% language=uk
\usemodule[fnt-23]
\usemodule[fnt-25]
\startcomponent mk-math
\environment mk-environment
\chapter{Unicode math}
{\em I assume that the reader is somewhat familiar with math in
\TEX. Although in \CONTEXT\ we try to support the concepts and
symbols used in the \TEX\ community we have our own way of
implementing math. The fact that \CONTEXT\ is not used extensively
for conventional math journals permits us to rigourously
re|-|implement mechanisms. Of course the user interfaces mostly
remain the same.}
\subject{introduction}
The \LUATEX\ project entered a new stage when end of 2008 and
beginning of 2009 math got opened up. Although \TEX\ can handle
math pretty good we had a few wishes that we hoped to fulfill in
the process. That \TEX's math machinery is a rather independent
subsystem is reflected in the fact that after parsing there is an
intermediate list of so called noads (math elements), which then
gets converted into a node list (glyphs, kerns, penalties, glue and
more). This conversion can be intercepted by a callback and a
macro package can do whatever it likes with the list of noads as
long as it returns a proper list.
Of course \CONTEXT\ does support math and that is visible in its
code base:
\startitemize
\item Due to the fact that we need to be able to switch to
alternative styles the font system is quite complex and in
\CONTEXT\ \MKII\ math font definitions (and changes) are good for
50\% of the time involved. In \MKIV\ we can use a more efficient
model.
\item Because some usage of \CONTEXT\ demands the mix of several
completely different encoded math fonts there is a dedicated math
encoding subsystem in \MKII. In \MKIV\ we will use \UNICODE\
exclusively.
\item Some constructs (and symbols) are implemented in a way that
we find suboptimal. In the perspective of \UNICODE\ in \MKIV\ we
aim at all symbols being real characters. This is possible because
all important constructs (like roots, accents and delimiters) are
supported by the engine.
\item In order to fit vertical spacing around math (think for
instance of typesetting on a grid) in \MKII\ we have ended up with
rather messy and suboptimal code. \footnote {This is because
spacing before and after formulas has to cooperate with spacing of
structural components that surround it.} The expectation is that
we can improve that.
\stopitemize
In the following sections I will discuss a few of the
implementation details of the font related issues in \MKIV. Of
course a few years from now the actual solutions we implemented
might look different but the principles remain the same. Also, as
with other components of \LUATEX\ Taco and I worked in parallel on
the code and its usage, which made both our tasks easier.
\subject{transition}
In \TEX, math typesetting uses a special concept called families.
Each math component (number, letter, symbol, etc) is member of a
family. Because we have three sizes (text, script and
scriptscript) this results in a family||size matrix of defined
fonts. Because the number of glyphs in a font was limited to 256,
in practice it meant that we had quite some font definitions. The
minimum number of families was~4 (roman, italic, symbol, and
extension) but in practice several more could be active (sans,
bold, mono|-|spaced, more symbols, etc.) for specific alphabets or
extra symbols (for instance \AMS\ set A and B). The total number
of families in traditional \TEX\ is limited to 16, and one easily
hits this maximum. In that case, some 16 times 3 fonts are defined
for one size of which in practice only a few are really used in the
typesetting.
A potential source of confusion is bold math. Bold in math can
either mean having some bold letters, or having the whole formula
in bold. In practice this means that for a complete bold formula
one has to define the whole lot using bold fonts. A complication
is that the math symbols (etc) are kind of bound to families and
so we end up with either redefining symbols, or reusing the
families (which is easier and faster). In any case there is a
performance issue involved due to the rather massive switch from
normal to bold.
In \UNICODE\ all alphabets that make sense as well as all math
symbols are part of the definition although unfortunately some
alphabets have their letters spread over the \UNICODE\ vector and
not in a range (like blackboard). This forces all applications
that want to support math to implement similar hacks to deal with
it.
In \MKIV\ we will assume that we have \UNICODE\ aware math fonts,
like \OPENTYPE. The font that sets the standard is Microsoft
Cambria. The upcoming (I'm writing this in January 2009) \TEX Gyre
fonts will be compliant to this standard but they're not yet there
and so we have a problem. The way out is to define virtual fonts
and now that \LUATEX\ math is extended to cover all of \UNICODE\
as well as provides access to the (intermediate) math lists this
has become feasible. This also permits us to test \LUATEX\
with both Cambria and Latin Modern Virtual Math.
The advantage is that we can stick to just one family for all
shapes which simplifies the underlying \TEX\ code enormously.
First of all we need to define way less fonts (which is partially
compensated by loading them as part of the virtual font) and all
math aspects can now be dealt with using the character data
tables.
One tricky aspect of the new approach is that the Latin Modern
fonts have design sizes, so we have to define several virtual
fonts. On the other hand, fonts like Cambria have alternative
script and scriptscript shapes which is controlled by the \type
{ssty} feature, a gsub alternate that provides some alternative
sizes for a couple of hundred characters that matter.
\starttabulate[|l|l|l|]
\NC text \NC \type {lmmi12 at 12pt} \NC \type {cambria at 12pt with ssty=no} \NC \NR
\NC script \NC \type {lmmi8 at 8pt} \NC \type {cambria at 8pt with ssty=1} \NC \NR
\NC scriptscript \NC \type {lmmi6 at 6pt} \NC \type {cambria at 6pt with ssty=2} \NC \NR
\stoptabulate
So Cambria not so much has design sizes but shapes optimized
relative to the text variant: in the following example we see text
in red, script in green and scriptscript in blue.
\startbuffer
\definefontfeature[math][analyze=false,script=math,language=dflt]
\definefontfeature[text] [math][ssty=no]
\definefontfeature[script] [math][ssty=1]
\definefontfeature[scriptscript][math][ssty=2]
\stopbuffer
\typebuffer \getbuffer
Let us first look at Cambria:
\startbuffer
\startoverlay
{\definedfont[name:cambriamath*scriptscript at 150pt]\mkblue X}
{\definedfont[name:cambriamath*script at 150pt]\mkgreen X}
{\definedfont[name:cambriamath*text at 150pt]\mkred X}
\stopoverlay
\stopbuffer
\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
When we compare them scaled down as happens in real script and
scriptscript we get:
\startbuffer
\startoverlay
{\definedfont[name:cambriamath*scriptscript at 120pt]\mkblue X}
{\definedfont[name:cambriamath*script at 80pt]\mkgreen X}
{\definedfont[name:cambriamath*text at 60pt]\mkred X}
\stopoverlay
\stopbuffer
\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
Next we see (scaled) Latin Modern:
\startbuffer
\startoverlay
{\definedfont[LMRoman8-Regular at 150pt]\mkblue X}
{\definedfont[LMRoman10-Regular at 150pt]\mkgreen X}
{\definedfont[LMRoman12-Regular at 150pt]\mkred X}
\stopoverlay
\stopbuffer
\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
In practice we will see:
\startbuffer
\startoverlay
{\definedfont[LMRoman8-Regular at 120pt]\mkblue X}
{\definedfont[LMRoman10-Regular at 80pt]\mkgreen X}
{\definedfont[LMRoman12-Regular at 60pt]\mkred X}
\stopoverlay
\stopbuffer
\typebuffer \startlinecorrection \getbuffer \stoplinecorrection
Both methods probably work out well although you need to keep in
mind that the \OPENTYPE\ \type {ssty} feature is not so much a
design size related feature.
An \OPENTYPE\ font can have a specification for the script and
scriptscript size. By default we listen to this specification instead
of the one imposed by the bodyfont environment. When you turn on
tracing
\starttyping
\enabletrackers[otf.math]
\stoptyping
you will get messages like:
\starttyping
asked scriptscript size: 458752, used: 471859.2 (102.86 %)
asked script size: 589824, used: 574095.36 (97.33 %)
\stoptyping
The differences between the defaults and the font recommendations
are not that large so by default we listen to the font specification.
\usetypescript[cambria] \start \setupbodyfont[cambria] \stop
\definefontfeature[math-script] [math-script] [mathsize=no]
\definefontfeature[math-scriptscript][math-scriptscript][mathsize=no]
\definetypeface [cambria-ns] [rm] [serif] [cambria] [default]
\definetypeface [cambria-ns] [tt] [mono] [modern] [default]
\definetypeface [cambria-ns] [mm] [math] [cambria] [default]
\usetypescript[cambria-ns] \start \setupbodyfont[cambria-ns] \stop
\startlinecorrection
\scale
[width=\textwidth]
{\backgroundline
[darkgray]
{\startoverlay
{\white\switchtobodyfont [cambria]$\sum_{i=0}^n$}
{\mkred\switchtobodyfont[cambria-ns]$\sum_{i=0}^n$}
\stopoverlay
\startoverlay
{\white\switchtobodyfont [cambria]$\int_{i=0}^n$}
{\mkred\switchtobodyfont[cambria-ns]$\int_{i=0}^n$}
\stopoverlay
\startoverlay
{\white\switchtobodyfont [cambria]$\log_{i=0}^n$}
{\mkred\switchtobodyfont[cambria-ns]$\log_{i=0}^n$}
\stopoverlay
\startoverlay
{\white\switchtobodyfont [cambria]$\cos_{i=0}^n$}
{\mkred\switchtobodyfont[cambria-ns]$\cos_{i=0}^n$}
\stopoverlay
\startoverlay
{\white\switchtobodyfont [cambria]$\prod_{i=0}^n$}
{\mkred\switchtobodyfont[cambria-ns]$\prod_{i=0}^n$}
\stopoverlay}}
\stoplinecorrection
\definefontfeature[math-script] [math-script] [mathsize=yes]
\definefontfeature[math-scriptscript][math-scriptscript][mathsize=yes]
In this overlay the white text is scaled according to the
specification in the font, while the red text is scaled according
to the bodyfont environment (12/7/5 points).
\subject{going virtual}
The number of math fonts (used) in the \TEX\ community is
relatively small and of those only Latin Modern (which builds upon
Computer Modern) has design sizes. This means that the amount of
\UNICODE\ compliant virtual math fonts that we have to make is not
that large. We could have used an already present virtual
composition mechanism but instead we made a handy helper function
that does a more efficient job. This means that a definition looks
(a bit simplified) as follows:
\starttyping
mathematics.make_font ( "lmroman10-math", {
{ name="lmroman10-regular", features="virtualmath", main=true },
{ name="lmmi10", vector="tex-mi", skewchar=0x7F },
{ name="lmsy10", vector="tex-sy", skewchar=0x30, parameters=true } ,
{ name="lmex10", vector="tex-ex", extension=true } ,
{ name="msam10", vector="tex-ma" },
{ name="msbm10", vector="tex-mb" },
{ name="lmroman10-bold", "tex-bf" } ,
{ name="lmmib10", vector="tex-bi", skewchar=0x7F } ,
{ name="lmsans10-regular", vector="tex-ss", optional=true },
{ name="lmmono10-regular", vector="tex-tt", optional=true },
} )
\stoptyping
For the \TEX Gyre Pagella it looks this way:
\starttyping
mathematics.make_font ( "px-math", {
{ name="texgyrepagella-regular", features="virtualmath", main=true },
{ name="pxr", vector="tex-mr" } ,
{ name="pxmi", vector="tex-mi", skewchar=0x7F },
{ name="pxsy", vector="tex-sy", skewchar=0x30, parameters=true } ,
{ name="pxex", vector="tex-ex", extension=true } ,
{ name="pxsya", vector="tex-ma" },
{ name="pxsyb", vector="tex-mb" },
} )
\stoptyping
As you can see, it is possible to add alphabets, given that there is
a suitable vector that maps glyph indices onto \UNICODE s. It is good
to know that this function only defines the way such a font is
constructed. The actual construction is delayed till the font is
needed.
Such a virtual font is used in typescripts (the building blocks of
typeface definitions in \CONTEXT) as follows:
\starttyping
\starttypescript [math] [palatino] [name]
\definefontsynonym [MathRoman] [pxmath@px-math]
\loadmapfile[original-youngryu-px.map]
\stoptypescript
\stoptyping
If you're familiar with the way fonts are defined in \CONTEXT, you will
notice that we no longer need to define MathItalic, MathSymbol and
additional symbol fonts. Of course users don't have to deal with
these issues themselves. The \type {@} triggers the virtual
font builder.
You can imagine that in \MKII\ switching to another font style or size
involves initializing (or at least checking) involves some 30 to 40
font definitions when it comes to math (the number of used
families times 3, the number o fmath sizes.). And even if we take
into account that fonts are loaded only once, this checking and
enabling takes time. Keep in mind that in \CONTEXT\ we can have
several math font sets active in one document which comes at a
price.
In \MKIV\ we use one family (at three sizes). Of course we need to
load the font (and more than one in the case of virtual variants)
but when switching bodyfont sizes we only need to enable one
(already defined) math font. And that really saves time. This is
one of the areas where we gain back time that we loose elsewhere
by extending core functionality using \LUA\ (like \OPENTYPE\
support).
\subject{dimensions}
By setting font related dimensions you can control the way \TEX\
positions math elements relative to each other. Math fonts have a
few more dimensions than regular text fonts. But \OPENTYPE\ math
fonts like Cambria have quite some more. There is a nice booklet
published by Microsoft, \quote {Mathematical Typesetting}, where
dealing with math is discussed in the perspective of their word
processor and \TEX. In the booklet some of the parameters are
discussed and since many of them are rather special it makes no
sense (yet) to elaborate on them here. \footnote {Googling on
\quote {Ulrich Vieth}, \quote {TeX} and \quote {conferences} might
give you some hits on articles on these matters.} Figuring out
their meaning was quite a challenge.
I am the first to admit that the current code in \MKIV\ that deals
with math parameters is somewhat messy. There are several reasons
for this:
\startitemize[packed]
\item We can pass parameters as \type {MathConstants} table in the
\TFM\ table that we pass to the core engine.
\item We can use some named parameters, like \type {x_height} and
pass those in the \type {parameters} table.
\item We can use the traditional font dimension numbers in the
\type {parameters} table, but since they overlap for symbol and
extensible fonts, that is asking for troubles.
\stopitemize
Because in \MKIV\ we create virtual fonts at run|-|time and use just
one family, we fill the \type {MathConstants} table for
traditional fonts as well. Future versions may use the upcoming
mechanisms of font parameter sets at the macro level. These can be
defined for each of the sizes (display, text, script and
scriptscript, and the last three in cramped form as well) but
since a font only carries one set, we currently use a compromise.
\subject{tracing}
One of the nice aspects of the opened up math machinery is that it
permits us to get a more detailed look at what happens. It also
fits nicely in the way we always want to visualize things in
\CONTEXT\ using color, although most users are probably unaware of
many such features because they don't need them as I do.
\startbuffer
\enabletrackers[math.analyzing]
\ruledhbox{$a = \sqrt{b^2 + \sin{c} - {1 \over \gamma}}$}
\disabletrackers[math.analyzing]
\stopbuffer
\typebuffer \startbaselinecorrection \getbuffer \stopbaselinecorrection
This tracker option colors characters depending on their nature and the
fact that they are remapped. The tracker also was handy during development
of \LUATEX\ especially for checking if attributes migrated right in
constructed symbols.
For over a year I had been using a partial \UNICODE\ math
implementation in some projects but for serious math the vectors
needed to be completed. In order to help the \quote {math
department} of the \CONTEXT\ development team (Aditya Mahajan,
Mojca Miklavec, Taco Hoekwater and myself) we have some extra
tracing options, like
\startbuffer
\showmathfontcharacters[list=0x0007B]
\stopbuffer
\typebuffer
\start \blank \getbuffer \blank \stop
The simple variant with no arguments would have extended this
document with many pages of such descriptions.
Another handy command (defined in module \type{fnt-25}) is the following:
\starttyping
\ShowCompleteFont{name:cambria}{9pt}{1}
\ShowCompleteFont{dummy@lmroman10-math}{10pt}{1}
\stoptyping
This will for instance for Cambria generate between 50 and 100
pages of character tables.
\startbuffer[mathtest]
$abc \bf abc \bi abc$
$\mathscript abcdefghijklmnopqrstuvwxyz %
1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathfraktur abcdefghijklmnopqrstuvwxyz %
1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathblackboard abcdefghijklmnopqrstuvwxyz %
1234567890 ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\mathscript abc IRZ \mathfraktur abc IRZ %
\mathblackboard abc IRZ \ss abc IRZ 123$
\stopbuffer
If you look at the following samples you can imagine how coloring
the characters and replacements helped figuring out the alphabets
We use the following input (stored in a buffer):
\typebuffer [mathtest]
For testing Cambria we say:
\starttyping
\usetypescript[cambria]
\switchtobodyfont[cambria,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoptyping
And we get:
\usetypescript[cambria] % global
\startlines
\switchtobodyfont[cambria,10pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoplines
For the virtualized Latin Modern we say:
\starttyping
\usetypescript[modern]
\switchtobodyfont[modern,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest] % the input shown before
\disabletrackers[math.analyzing]
\stoptyping
This gives:
\usetypescript[modern] % global
\startlines
\switchtobodyfont[modern,11pt]
\enabletrackers[math.analyzing]
\getbuffer[mathtest]
\disabletrackers[math.analyzing]
\stoplines
These two samples demonstrate that Cambria has a rather complete
repertoire of shapes which is no surprise because it is a recent
font that also serves as a showcase for \UNICODE\ and \OPENTYPE\
driven math.
Commands like \type {\mathscript} sets an attribute. When we post|-|process
the noad list and encounter this attribute, we remap the characters to
the desired variant. Of course this happens selectively. So, a capital~A
(\type {0x0041}) becomes a capital script~A (\type {0x1D49C}). Of course
this solution is rather \CONTEXT\ specific and there are other ways to
achieve the same goal (like using more families and switching family).
\subject{special cases}
Because we now are operating in the \UNICODE\ domain, we run into
problems if we keep defining some of the math symbols in the
traditional \TEX\ way. Even with the \AMS\ fonts available we
still end up with some characters that are represented by
combining others. Take for instance $\neq$ which is composed of
two characters. Because in \MKIV\ we want to have all
characters in their pure form we use a virtual replacement for
them. In \MKIV\ speak it looks like this:
\starttyping
local function negate(main,unicode,basecode)
local characters = main.characters
local basechar = characters[basecode]
local ht, wd = basechar.height, basechar.width
characters[unicode] = {
width = wd,
height = ht,
depth = basechar.depth,
italic = basechar.italic,
kerns = basechar.kerns,
commands = {
{ "slot", 1, basecode },
{ "push" },
{ "down", ht/5},
{ "right", - wd/2},
{ "slot", 1, 0x2215 },
{ "pop" },
}
}
end
\stoptyping
In case you're curious, there are indeed kerns, in this case the
kerns with the Greek Delta.
Another thing we need to handle is positioning of accents on top
of slanted (italic) shapes. For this \TEX\ uses a special
character in its fonts (set with \type{\skewchar}). Any character
can have in its kerning table a kern towards this special
character. From this kern we
can calculate the \type {top_accent} variable that we can pass for
each character. This variable lives at the same level as \type
{width}, \type {height}, \type {depth} and \type {italic} and is
calculated as: $w/2 + k$, so it defines the horizontal anchor. A
nice side effect is that (in the \CONTEXT\ font management
subsystem) this saves us passing information associated with
specific fonts such as the skew character.
A couple of concepts are unique to \TEX, like having \type {\hat}
and \type {\widehat} where the wide one has sizes. In \OPENTYPE\ and
\UNICODE\ we don't have this distinction so we need special
trickery to simulate this. We do so by adding extra code points in
a private \UNICODE\ space which in return results in them being
defined automatically and the relevant first size variant being
used for \type {\hat}. For some users this might still be too wide
but at least it's better than a wrongly positioned \ASCII\ variant.
In the future we might use this private space for similar cases.
Arrows, horizontal extenders and radicals also fall in the
category \quote {troublesome} if only because they use special
dimensions to get the desired effect. Fortunately \OPENTYPE\ math
is modeled after \TEX, so in \LUATEX\ we introduce a couple
of new constructs to deal with this. One such simplification at
the macro level is in the definition of \type {\root}. Here we use
the new \type {\Uroot} primitive. The placement related parameters
are those used by traditional \TEX, but when they are available the
\OPENTYPE\ parameters are applied. The simplified
plain definitions are now:
\starttyping
\def\rootradical{\Uroot 0 "221A }
\def\root#1\of{\rootradical{#1}}
\def\sqrt{\rootradical{}}
\stoptyping
The successive sizes of the root will be taken from the font in the
same way as traditional \TEX\ does it. In that sense \LUATEX\ is no
doing anything differently, it only has more parameters to control
the process. The definition of \type {\sqrt} in \CONTEXT\ permits
an optional first argument that sets the degree.
\startbuffer
\showmathfontcharacters[list=0x221A]
\stopbuffer
\start \blank \getbuffer \blank \stop
Note that we've collected all characters in family~0 (simply
because that is what \TEX\ defaults characters to) and that we use
the formal \UNICODE\ slots. When we use the Latin Modern fonts we
just remap traditional slots to the right ones.
Another neat trick is used when users choose among the bigger variants
of some characters. The traditional approach is to create a box of a
certain size and create a fake delimited variant which is then used.
\starttyping
\definemathcommand [big] {\choosemathbig\plusone }
\definemathcommand [Big] {\choosemathbig\plustwo }
\definemathcommand [bigg] {\choosemathbig\plusthree}
\definemathcommand [Bigg] {\choosemathbig\plusfour }
\stoptyping
Of course this can become a primitive operation and we might decide
to add such a primitive later on so we won't bother you with more
details.
Attributes are also used to make live easier for authors who have
to enter lots of pairs. Compare:
\startbuffer
\setupmathematics[autopunctuation=no]
$ (a,b) = (1.20,3.40) $
\stopbuffer
\typebuffer \begingroup \getbuffer \endgroup
with:
\startbuffer
\setupmathematics[autopunctuation=yes]
$ (a,b) = (1.20,3.40) $
\stopbuffer
\typebuffer \begingroup \getbuffer \endgroup
So we don't need to use this any more:
\starttyping
$ (a{,}b) = (1{.}20{,}3{.}40) $
\stoptyping
Features like this are implemented on top of an experimental math
manipulation framework that is part of \MKIV. When the math
font system is stable we will rework the rest of math support
and implement additional manipulating frameworks.
\subject{control}
As with all other character related issues, in \MKIV\ everything
is driven by a character table (consider it a database).
Quite some effort went into getting that one right and although by
now math is represented well, more data will be added in due time.
In \MKIV\ we no longer have huge lists of \TEX\ definitions for
math related symbols. Everything is initialized using the mentioned
table: normal symbols, delimiters, radicals, whether or not with name.
Take for instance the square root:
\start \blank \showmathfontcharacters[list=0x221A] \blank \stop
Its entry is:
\starttyping
[0x221A] = {
adobename = "radical",
category = "sm",
cjkwd = "a",
description = "SQUARE ROOT",
direction = "on",
linebreak = "ai",
mathclass = "radical",
mathname = "surd",
unicodeslot = 0x221A,
}
\stoptyping
The fraction symbol also comes in sizes. This symbol is not to be
confused with the negation symbol \type {0x2215}, which in \TEX\ is
known as \type {\not}).
\start \blank \showmathfontcharacters[list=0x2044] \blank \stop
\starttyping
[0x2044] = {
adobename = "fraction",
category = "sm",
contextname = "textfraction",
description = "FRACTION SLASH",
direction = "cs",
linebreak = "is",
mathspec = {
{ class = "binary", name = "slash" },
{ class = "close", name = "solidus" },
},
unicodeslot = 0x2044,
}
\stoptyping
However, since most users don't have this symbol visualized in
their word processor, they expect the same behaviour from the
regular slash. This is why we find a reference to the real symbol
in its definition.
\start \blank \showmathfontcharacters[list=0x002F] \blank \stop
The definition is:
\starttyping
[0x002F] = {
adobename = "slash",
category = "po",
cjkwd = "na",
contextname = "textslash",
description = "SOLIDUS",
direction = "cs",
linebreak = "sy",
mathsymbol = 0x2044,
unicodeslot = 0x002F,
}
\stoptyping
One problem left is that currently we have only one class per
character (apart from the delimiter and radical usage which have
their own definitions). Future releases of \CONTEXT\ will provide
support for math dictionaries (as in \OPENMATH\ and \MATHML~3). At
that point we will also have a \type {mathdict} entry.
There is another issue with character mappings, one that will
seldom reveal itself to the user, but might confuse macro writers
when they see an error message.
In traditional \TEX, and therefore also in the Latin Modern fonts,
a chain from small to large character goes in two steps: the
normal size is taken from one family and the larger variants from
another. The larger variant then has a pointer to an even larger
one and so on, until there is no larger variant or an extensible
recipe is found. The default family is number~0. It is for this
reason that some of the definition primitives expect a small and
large family part.
However, in order to support \OPENTYPE\ in \LUATEX\ the
alternative method no longer assumes this split. After all, we no
longer have a situation where the 256 limit forces us to take the
smaller variant from one font and the larger sequence from another
(so we need two family||slot pairs where each family eventually
resolves to a font).
It is for that reason that the new \type {\U...} primitives expect
only one family specification: the small symbol, which then has a
pointer to a larger variant when applicable. However deep down in
the engine, there is still support for the multiple family
solution (after all, we don't want to drop compatibility). As a
result, in error messages you can still find references
(defaulting to~0) to large specifications, even if you don't use
them. In that case you can simply ignore the large symbol (0,0),
since it is not used when the small symbol provides a link.
\subject{extensibles}
In \TEX\ fences can be told to become larger automatically. In
traditional \TEX\ a character can have a linked list of next
larger shapes ending in a description of how to compose even
larger variants.
A parenthesis in Cambria has the following list:
\start
\switchtobodyfont[cambria,10pt]
\showmathfontcharacters[list=0x00028]
\stop
In Latin Modern we have:
\start
\switchtobodyfont[modern,10pt]
\showmathfontcharacters[list=0x00028]
\stop
Of course \LUATEX\ is downward compatible with respect to this
feature, but the internal representation is now closer to what
\OPENTYPE\ math provides (which is not that far from how \TEX\
works simply because it's inspired by \TEX). Because Cambria has
different parameters we get slightly different results. In the
following list of pairs, you see Cambria on the left and Latin
Modern on the right.
Both start with stepwise larger shapes, followed by a more gradual
growth. The thresholds for a next step are driven by parameters
set in the \OPENTYPE\ font or by \TEX's default.
\start
\lineskip1ex
\dostepwiserecurse{5}{140}{5} {
\dontleavehmode \ruledhbox \bgroup
\setbox0=\vbox{\vss\hbox{\switchtobodyfont[cambria,10pt]$\left\{ \vcenter{\hbox{\darkgray\vrule height \recurselevel pt width 5pt}} \right\}$}\vss}%
\setbox2=\vbox{\vss\hbox{\switchtobodyfont[modern, 10pt]$\left\{ \vcenter{\hbox{\darkgray\vrule height \recurselevel pt width 5pt}} \right\}$}\vss}%
\ifdim\ht0>\ht2
\setbox2\vbox to \htdp0{\vss\box2\vss}%
\else
\setbox0\vbox to \htdp2{\vss\box0\vss}%
\fi
\box0\box2
\egroup \quad
}
\par \stop
In traditional \TEX\ horizontal extensibles are not really present. Accents
are chosen from a linked list of variants and don't have an extensible
specification. This is because most such accents grow in two dimensions and
the only extensible like accents are rules and braces. However, in \UNICODE\
we have a few more and also because of symmetry we decided to add horizontal
extensibles too. Take:
\startbuffer
$ \overbrace {a+1} \underbrace {b+2} \doublebrace {c+3} $ \par
$ \overparent{a+1} \underparent{b+2} \doubleparent{c+3} $ \par
\stopbuffer
\typebuffer
This gives:
\getbuffer
Contrary to Cambria, Latin Modern Math, which is just like
Computer Modern Math, has no ready overbrace glyphs. Keep in mind
that in that we're dealing with fonts that have only 256 slots and
that the traditional font mechanism has the same limitation. For
this reason, the (extensible) braces are traditionally made from
snippets as is demonstrated below.
\startbuffer
\hbox\bgroup
\ruledhbox{\getglyph{lmex10}{\char"7A}}
\ruledhbox{\getglyph{lmex10}{\char"7B}}
\ruledhbox{\getglyph{lmex10}{\char"7C}}
\ruledhbox{\getglyph{lmex10}{\char"7D}}
\ruledhbox{\getglyph{lmex10}{\char"7A\char"7D\char"7C\char"7B}}
\ruledhbox{\getglyph{name:cambriamath}{\char"23DE}}
\ruledhbox{\getglyph{lmex10}{\char"7C\char"7B\char"7A\char"7D}}
\ruledhbox{\getglyph{name:cambriamath}{\char"23DF}}
\egroup
\stopbuffer
\typebuffer
This gives:
\startlinecorrection
\getbuffer
\stoplinecorrection
The four snippets have the height and depth of the rule that will
connect them. Since we want a single interface for all fonts we no
longer will use macro based solutions. First of all fonts like
Cambria don't have the snippets, and using active character
trickery (so that we can adapt the meaning to the font) has no
preference either. This leaves virtual glyphs.
It took us a bit of experimenting to get the right virtual definition because
it is a multi||step process:
\startitemize[packed]
\item The right \UNICODE\ character (\type {0x23DE}) points to a character that has
no glyph itself but only horizontal extensibles.
\item The snippets that make up the extensible don't have the right dimensions
(as they define the size of the connecting rule), so we need to make them
virtual themselves and give them a size that matches \LUATEX's expectations.
\item Each virtual snippet contains a reference to the physical snippet and moves
it up or down as well as fixes its size.
\item The second and fifth snippet are actually not real glyphs but rules. The
dimensions are derived from the snippets and it is shifted up or down too.
\stopitemize
You might wonder if this is worth the trouble. Well, it is if you take into
account that all upcoming math fonts will be organized like Cambria.
\subject{math kerning}
While reading Microsofts orange booklet, it became clear that
\OPENTYPE\ provides advanced kerning possibilities and we decided
to put it on the agenda for \LUATEX.
It is possible to define a ladder||like boundary for each corner
of a character where the ladder more or less follows the shape of
a character. In theory this means that when we attach a
superscript to a base character we can use two such ladders to
determine the optimal spacing between them.
Let's have a look at a few characters, the upright~f and its
italic cousin.
\startcombination[2*1]
{\ShowGlyphShape{name:cambria-math}{40bp}{0x66}} {U+00066}
{\ShowGlyphShape{name:cambria-math}{40bp}{0x1D453}} {0x1D453}
\stopcombination
The ladders on the right can be used to position a super or
subscript, that is, they are positioned in the normal way but the
ladder, as well as the boundingbox and/or left ladders of the
scripts can be used to fine tune the positioning.
Should we use this information? I made this visualizer for
checking some Arabic fonts anchoring and cursive features and then
it made sense to add some of the information related to math as
well. \footnote {Taco extended the visualizer for his presentation
at Bachotek 2009 so you might run into variants.} The orange
booklet shows quite advanced ladders, and when looking at the 3500
shapes in Cambria, it quickly becomes clear that in practice there
is not that much detail in the specification. Nevertheless,
because without this feature the result is not acceptable \LUATEX\
gracefully supports it.
\usetypescript[cambria-y]
\startbuffer
$V^a_a V^a V_a V^1_2 V^1 V_2 f^a f_a f^a_a$\par
$V^f_f V^f V_f V^1_2 V^1 V_2 f^f f_f f^f_f$\par
$T^a_a T^a T_a T^1_2 T^1 T_2 f^a f_f f^a_f$\par
$T^f_f T^f T_f T^1_2 T^1 T_2 f^f f_a f^f_a$\par
\stopbuffer
\startlinecorrection
\startcombination[3*1]
{\framed[align=normal]{\switchtobodyfont[modern]\getbuffer}} {latin modern}
{\framed[align=normal]{\switchtobodyfont[cambria-y]\getbuffer}} {cambria without kerning}
{\framed[align=normal]{\switchtobodyfont[cambria]\getbuffer}} {cambria with kerning}
\stopcombination
\stoplinecorrection
% \ShowGlyphShape{name:cambria-math} {40bp}{0x1D43F}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D444}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D447}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x2112}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D432}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D43D}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D44A}
% \ShowGlyphShape{name:cambria-math}{100bp}{0x1D45D}
\subject{faking glyphs}
A previous section already discussed virtual shapes. In the
process of replacing all shapes that lack in Latin Modern and are
composed from snippets instead we ran into the dots. As they are a
nice demonstration of something that, although somewhat of a hack,
survived 30 years without problems we show the definition used in
\CONTEXT\ \MKII:
% ldots = 2026
% vdots = 22EE
% cdots = 22EF
% ddots = 22F1
% udots = 22F0
\startbuffer
\def\PLAINldots{\ldotp\ldotp\ldotp}
\def\PLAINcdots{\cdotp\cdotp\cdotp}
\def\PLAINvdots
{\vbox{\forgetall\baselineskip.4\bodyfontsize\lineskiplimit\zeropoint\kern.6\bodyfontsize\hbox{.}\hbox{.}\hbox{.}}}
\def\PLAINddots
{\mkern1mu%
\raise.7\bodyfontsize\ruledvbox{\kern.7\bodyfontsize\hbox{.}}%
\mkern2mu%
\raise.4\bodyfontsize\relax\ruledhbox{.}%
\mkern2mu%
\raise.1\bodyfontsize\ruledhbox{.}%
\mkern1mu}
\stopbuffer
\getbuffer \typebuffer
This permitted us to say:
\starttyping
\definemathcommand [ldots] [inner] {\PLAINldots}
\definemathcommand [cdots] [inner] {\PLAINcdots}
\definemathcommand [vdots] [nothing] {\PLAINvdots}
\definemathcommand [ddots] [inner] {\PLAINddots}
\stoptyping
However, in \MKIV\ we use virtual shapes instead.
\definemathcommand [xldots] [inner] {\PLAINldots}
\definemathcommand [xcdots] [inner] {\PLAINcdots}
\definemathcommand [xvdots] [nothing] {\PLAINvdots}
\definemathcommand [xddots] [inner] {\PLAINddots}
The following lines show the virtual shapes in red. In each
triplet we see the original, the virtual and the overlaid
character.
\startlinecorrection
\switchtobodyfont[modern,17.3pt]%
\dontleavehmode
\ruledhbox{$\xldots$}%
\ruledhbox{$\ldots$}%
\ruledhbox{\startoverlay{$\xldots$}{$\red\ldots$}\stopoverlay}%
\quad
\ruledhbox{$\xcdots$}%
\ruledhbox{$\cdots$}%
\ruledhbox{\startoverlay{$\xcdots$}{$\red\cdots$}\stopoverlay}%
\quad
\ruledhbox{$\xvdots$}%
\ruledhbox{$\vdots$}%
\ruledhbox{\startoverlay{$\xvdots$}{$\red\vdots$}\stopoverlay}%
\quad
\ruledhbox{$\xddots$}%
\ruledhbox{$\ddots$}%
\ruledhbox{\startoverlay{$\xddots$}{$\red\ddots$}\stopoverlay}%
\quad
\ruledhbox{$\xddots$}%
\ruledhbox{$\udots$}%
\ruledhbox{\startoverlay{$\xddots$}{$\red\udots$}\stopoverlay}%
\stoplinecorrection
As you can see here, the virtual variants are rather close to the
originals. At 12pt there are no real differences but (somehow) at
other sizes we get slightly different results but it is hardly
visible. Watch the special spacing above the shapes. It is
probably needed for getting the spacing right in matrices (where
they are used).
\stopcomponent
| {
"alphanum_fraction": 0.7578340038,
"avg_line_length": 36.8624390244,
"ext": "tex",
"hexsha": "9fddd4f2739e8d7b72583912599124a4f8c63e51",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "74ea55abde343f4e6e07fa6cd94694816e6e3cc4",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "kensh/pandoc_resume",
"max_forks_repo_path": "tex/texmf-context/doc/context/sources/general/manuals/mk/mk-math.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "74ea55abde343f4e6e07fa6cd94694816e6e3cc4",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "kensh/pandoc_resume",
"max_issues_repo_path": "tex/texmf-context/doc/context/sources/general/manuals/mk/mk-math.tex",
"max_line_length": 156,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "74ea55abde343f4e6e07fa6cd94694816e6e3cc4",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "kensh/pandoc_resume",
"max_stars_repo_path": "tex/texmf-context/doc/context/sources/general/manuals/mk/mk-math.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 10510,
"size": 37784
} |
\chapter{Public Views} \label{publicprofile}
Before Skylab was implemented, the display of past Orbital staff and projects was done by means of a manually curated WordPress post. Project links for teams and team members were all manually created, which was a tedious and error-prone process. Since Skylab already captures all information on teams and students, publicly-accessible (i.e., without needing to login) pages are a logical form of data export that has been created to supersede these past facilities.
\section{User Avatars} \label{useravatar}
Skylab does not currently handle image uploading, as it requires a lot more storage and more efforts in security as well. However, we need to support user avatar pictures as this enhances the user experience of Skylab. To implement this, we have integrated with an external third party service. We have decided to use Gravatar, a globally recognized avatar for any user\cite{citationgravatar}. Gravatar is popularized by Wordpress and in use by many sites. It is easy to integrate and a number of users already use gravatar for creating a universal user avatar for themselves. The steps to get an avatar are as follows:
\begin{itemize}
\item Trim the user's email address, convert it to lower case, and calculate MD5 hash of the transformed email address.
\item Use the hash computed in previous step and append it to \url{http://www.gravatar.com/avatar/} to obtain the gravatar's image source.
\end{itemize}
Gravatar serves our purpose of serving users' avatars while bypassing the complication of supporting image uploading and storage, as this is handled by the service. And the most important part in arriving at this solution is that it is a relatively quick, easy yet clean to serve users' profile images. Compromises like this happen as we need to weigh advantages and disadvantages of different approaches and take the time taken and priority of issues in implementation into consideration. In the future, if we find too many inconveniences from using Gravatar, we may decide to host avatar images on our own server, and handle problems arising from the support of file uploading and storage.
| {
"alphanum_fraction": 0.8037770613,
"avg_line_length": 144.7333333333,
"ext": "tex",
"hexsha": "9a8eec395a2fdce937a5a0e210467e6dff205f3c",
"lang": "TeX",
"max_forks_count": 53,
"max_forks_repo_forks_event_max_datetime": "2022-01-29T15:26:35.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-11-30T16:26:02.000Z",
"max_forks_repo_head_hexsha": "c79b9c44dcc7fae1a44555357f34a8217450c737",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "w-yuchen/nusskylab",
"max_forks_repo_path": "docs/2015_2016_Sem2_Final_Report/Chapters/Chapter_Public_Profile.tex",
"max_issues_count": 755,
"max_issues_repo_head_hexsha": "c79b9c44dcc7fae1a44555357f34a8217450c737",
"max_issues_repo_issues_event_max_datetime": "2022-03-30T22:09:42.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-19T12:39:23.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "w-yuchen/nusskylab",
"max_issues_repo_path": "docs/2015_2016_Sem2_Final_Report/Chapters/Chapter_Public_Profile.tex",
"max_line_length": 691,
"max_stars_count": 26,
"max_stars_repo_head_hexsha": "c79b9c44dcc7fae1a44555357f34a8217450c737",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "w-yuchen/nusskylab",
"max_stars_repo_path": "docs/2015_2016_Sem2_Final_Report/Chapters/Chapter_Public_Profile.tex",
"max_stars_repo_stars_event_max_datetime": "2020-12-24T14:11:10.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-05-11T06:58:50.000Z",
"num_tokens": 454,
"size": 2171
} |
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
%\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
%\usepackage{algorithm}git add
\usepackage{algpseudocode}
\usepackage{arevmath} % For math symbols
\usepackage{bbm}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\SetCommentSty{mycommfont}
\SetKwInput{KwInput}{Input} % Set the Input
\SetKwInput{KwOutput}{Output} % set the Output
% Math font
%\usepackage{mathpazo}
\usepackage{fourier}
\DeclareMathOperator*{\argmax}{arg\,max}
% Enable subfigures
\graphicspath{ {./pictures/} }
\usepackage{subcaption}
\captionsetup{compatibility=false}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}
\title{Imbalanced Dataset Techniques to Improve the Classification of Uneven Class Distributions\\
}
\author{\IEEEauthorblockN{Miguel Jiménez Aparicio}
\IEEEauthorblockA{
Atlanta, USA\\
[email protected]}
\and
\IEEEauthorblockN{Belén Martín Urcelay}
\IEEEauthorblockA{
San Sebastián, Spain \\
[email protected]}
\and
\IEEEauthorblockN{Cristian Gómez Peces}
\IEEEauthorblockA{
Atlanta, USA \\
[email protected]}
}
\maketitle
\begin{abstract}
This document analyzes the impact of imbalanced datasets on machine learning classifiers and discusses several techniques to deal with them. The results are applied to train a Twitter fake account detection algorithm where the performance of these techniques is compared. The paper shows how state-of-the-art ensemble and cost-sensitive classifiers lead to a substantial increase in F1-score compared to traditional classifiers, while both true and empirical risks decrease.
\end{abstract}
\begin{IEEEkeywords}
imbalance, undersampling, oversampling, boosting, bagging, cost-sensitive.
\end{IEEEkeywords}
\section{Introduction}
\subsection{Motivation}
Many canonical machine learning algorithms used for classification assume that the number of objects in the respective classes is roughly the same. However, in reality, classes are rarely represented equally. Class distribution skews are not only common, but many times expected \cite{data_imbalance_overview} especially in decision systems aiming to detect rare but important cases. For instance, Covid-19 testing at Georgia Institute of Technology showed that less than 1\% of the samples contained the virus. This means that a naive classifier could achieve a 99\% accuracy just by labeling all samples as negative for Covid-19.
Imbalanced datasets significantly compromise the performance of traditional learning algorithms. The disparity of classes in the training dataset may lead the algorithm to bias the classification towards the class with more instances, or even to ignore the minority class altogether. Therefore, it is vital to find efficient ways of dealing with data imbalances.
The overall goal of our project is to provide an overview of the state-of-the-art approaches to solve the issues introduced by imbalanced datasets. Including, a performance comparison of the various techniques. We also aim to implement an efficient scheme that can deal with highly complex and imbalanced datasets.
This study covers the impact of resampling and cost-weighting techniques to improve the classification. The work on \cite{ensembles_review}, suggests that the performance of the classification is highly improved when combining these techniques with ensemble methods. Hence, we also covered the combination of upsampling and downsampling with ensemble learning algorithms such as bagging and boosting. These algorithms have been implemented from scratch, facilitating the embedding of cost-sensitive frameworks as well in the ensemble learning process.
\subsection{Methodology}
Firstly, we study a synthetic dataset characterized by its simplicity. It is made up of two classes following $N(\boldsymbol\mu_0, \Sigma_0)$ and $N(\boldsymbol\mu_1, \Sigma_1))$, where
\begin{equation*}
\boldsymbol\mu_0=
\begin{pmatrix}
-1\\
-0.5
\end{pmatrix},\ %\quad
\boldsymbol\mu_1=
\begin{pmatrix}
0\\
1
\end{pmatrix},\ %\quad \\
\Sigma_0=
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix},\ %\quad %\mathrm{ and }\quad
\Sigma_1=
\begin{pmatrix}
4 & 0\\
0 & 2
\end{pmatrix}
\end{equation*} and where the minority class only accounts for 15\% of the samples. This simple dataset is especially useful to analyze the imbalance-compensating techniques from a mathematical perspective. Not only do we study the concepts learned in class at a theoretical level, but we also use plugin machine learning models to illustrate how they affect density distributions.
Secondly, we target a more complex dataset, with data of more than thirty-seven thousand Twitter accounts. Our goal is to learn to distinguish between bot and human accounts. The number of bot accounts represents a 30\% of the total samples in the dataset. Each contains thirteen features, such as the existence of a profile image, location or favorites and followers count. Some variables are categorical, while others are binary or integer variables.
The performance of the classification will be evaluated using the $F_1$ score $\in [0, 1]$, where the best possible score is 1. This metric is computed as
\begin{equation*}
F_1 = 2\frac{\mathrm{precision}\times\mathrm{recall}}{\mathrm{precision}+\mathrm{recall}},
\end{equation*}
where the precision is the ratio between correctly identified minority samples and the total number of minority samples, while the recall is given by the fraction of correctly identified minority samples over all samples. This metric clearly explains if the classes (including the minority) are correctly handled by the model or not.
\section{Overview of the techniques}
\subsection{Undersampling}
Undersampling is frequently employed to balance datasets before any machine learning algorithm is applied. Undersampling involves randomly removing entries from the majority class. Figure \ref{fig:Undersampling_2D_OriginalHistograms} shows the effects of undersampling on the Gaussian training dataset. The class imbalance is somewhat countered. However, the algorithm learned from this undersampled dataset will be affected.
\begin{figure}[h]
\centering
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Undersampling_2D_OriginalDataset}
\caption{Original.}
\label{fig:Undersampling_2D_OriginalDataset}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Undersampling_2D_UndersampledDataset}
\caption{Undersampled. $\beta=0.25$.}
\label{fig:Undersampling_2D_UndersampledDataset}
\end{subfigure}
\caption{Gaussian dataset.}
\label{fig:Undersampling_2D_OriginalHistograms}
\end{figure}
\subsubsection{Generalization Ability}
Induction algorithms require a sufficient amount of data to learn a model that generalizes well. If the training set is not large, a classifier may just memorize the characteristics of the training data. Moreover, undersampling has the potential of eliminating valuable samples from consideration of the classifier entirely \cite{undersampling_generalization}, so it may exacerbate this problem of lack of data. The obtained training set may vary greatly from one undersampling to another, which leads to a high variance on the learned model. Hence, the achievable complexity of the hypothesis set must be reduced to ensure a good generalization.
\subsubsection{Posterior Bias}
One goal of undersampling is to change the prior probabilities of the classes to make them more balanced. The classifier assumes that the features encountered at testing follow the same distribution as the training set. This mismatch introduced by design is known as sampling selection bias \cite{sampling_bias} on the posterior distribution.
Let $(\mathcal{X}, \mathcal{Y})$ denote the pairs of feature vectors, $\mathbf{x} \in \mathbb{R}^n$, and binary labels, $y \in \{0, 1\}$, contained in our original dataset. We assume that the number of samples labeled as zero is small compared with the number of samples in class one. Undersampling randomly removes points from the majority class. We describe this sampling with the binary random variable $S$, which takes the value 1 if a sample is selected.
It is reasonable to assume that the selection is independent of the features given the class. Then, applying Bayes rule, the law of total probability and noting that the samples from the minority class are always selected, we obtain
\begin{align*} \label{posterior}
p' = & P(y=0|\mathbf{x}, s=1)= \frac{P(s=1|y=0, \mathbf{x})P(y=0|\mathbf{x})}{P(s=1|\mathbf{x})}=\notag\\
=& \frac{P(y=0|\mathbf{x})}{P(y=0|\mathbf{x})+P(s=1|y=1)P(y=1|\mathbf{x})}=\notag\\
=&\frac{p}{p+\beta(1-p)},
\end{align*}
where $p$ and $p'$ denote the posterior probability of encountering a sample from the minority class when employing the original and the undersampled dataset respectively. Whereas $\beta$ denotes the probability of keeping a sample from the majority class.
The posterior is highly affected by the sampling rate. As more samples are removed, the classification is more biased towards the minority class. Figure \ref{fig:Undersampling_2D_Contour_Classification} shows the decision region of a naive Bayes classifier, where the area within each circle corresponds to the cluster of points classified as the minority class for a given undersampling rate. As the training set is undersampled the region of points that are labeled as the minority class grows. The undersampling rate not only influences the posterior bias, but also the algorithm's ability to generalize. Thus, $\beta$ should be chosen with care. Figure \ref{fig:F1_Score} presents the average F1-score over different training sets. We observe that the score is concave and in this case the optimum occurs with $\beta=0.67$, with a 2\% performance improvement.
\begin{figure}[h]
\includegraphics[scale=0.45]{Undersampling_2D_Contour_Classification}
\centering
\caption{Influence of undersampling on the classification region.}
\label{fig:Undersampling_2D_Contour_Classification}
\end{figure}
\begin{figure}[h]
\includegraphics[scale=0.45]{F1_scores_dataset1}
\centering
\caption{F1-score vs. undersampling rate, oversampling rate and cost.}
\label{fig:F1_Score}
\end{figure}
Another factor that strongly influences the posterior bias is class separability. The bias is higher when conditional distributions are similar across the classes\cite{undersampling_posterior}. To analyze this behavior we reduced the problem to a one-dimensional setting, the results are depicted in Figure \ref{fig:Undersampling_posterior}. We confirm that undersampling shifts the posterior distribution in favor of the minority class. Nevertheless, the shift caused by $\beta$ is lower under the configuration with lower overlap.
\begin{figure}[h]
\centering
\begin{subfigure}[h]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Undersampling_PosteriorBias}
\caption{$|\mu_0 - \mu_1|=3$.}
\label{fig:Undersampling_PosteriorBias}
\end{subfigure}
\hfill
\begin{subfigure}[h]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Undersampling_PosteriorBias_Separated}
\caption{$|\mu_0 - \mu_1|=13$.}
\label{fig:Undersampling_2D_UndersampledDataset}
\end{subfigure}
\caption{Influence of undersampling on posterior probability of the minority class.}
\label{fig:Undersampling_posterior}
\end{figure}
\subsection{Oversampling}
Another technique to balance datasets is oversampling, that is, artificially creating new instances of the minority class. This can be done simply by cloning existing samples, but it is not adding new information to the model. More elaborated methods create samples by interpolation. The most widely used is the Synthetic Minority Oversampling Technique (SMOTE). It works by selecting a random sample, taking another nearby sample and creating points in between. This procedure is repeated multiple times until the desired amount of new samples is created.
In Figure \ref{fig:Oversampling_2D_OriginalHistograms}, it is possible to observe the effect of oversampling on the 2D dataset. For the chosen ratio of 1, the number of samples of both classes is the same.
\begin{figure}[h]
\centering
\begin{subfigure}[h]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Oversampling_2D_OriginalDataset}
\caption{Original.}
\label{fig:Oversampling_2D_OriginalDataset}
\end{subfigure}
\hfill
\begin{subfigure}[h]{0.24\textwidth}
\centering
\includegraphics[width=\textwidth]{Oversampling_2D_OversampledDataset}
\caption{Oversampled. Ratio=1.}
\label{fig:Oversampling_2D_OversampledDataset}
\end{subfigure}
\caption{Gaussian dataset.}
\label{fig:Oversampling_2D_OriginalHistograms}
\end{figure}
A sensitivity analysis for several ratios has been conducted and the optimum ratio is determined to be around 0.55, which means that the minority class is oversampled until the number of minority samples is 55\% of the samples of the majority class. The increase in F1 score for this ratio is almost 0.6\%, as shown in Figure \ref{fig:F1_Score}.
\subsection{Cost-Sensitive Techniques}
Unlike the data-level based methods seen above, cost-sensitive learning requires the training algorithm to be modified to include uneven penalizations when samples are misclassified. In other words, we are minimizing the risk based on an uneven loss function. Depending on the loss function that we choose, the risk function -- and therefore the estimated distribution parameter -- will impact the decision boundaries of the new cost-sensitive classifier. The loss function selected for this study is Weighted Likelihood (WL). This approach consists of weighting the training samples according to their cost of misclassification. The loss function and empirical risk become
\begin{equation*}
\begin{aligned} \label{costWL}
L(y,\boldsymbol x, \theta) &= c(y)\mathbbm{1}\{ \hat y \neq y \} \\
R^{WL}_{emp}(\theta) &= \int \int L(y,\boldsymbol x, \theta) p(\boldsymbol x, y) d\boldsymbol x \text{ }dy=\\
&=-\frac{1}{N} \sum_n c(y_n,\boldsymbol x_n,) \ln p(y_n | \boldsymbol x_n;\theta)
\end{aligned},
\end{equation*}
where $L$ is the loss function, $R$ is the empirical risk, $c(y)$ is the cost of misclassifying class $y$, $\pi_k$ is the prior probability associated to class $k$ and $\theta$ is the set of estimated classifier parameters. With this configuration, the decision rule of the Naive-Bayes classifier is
$$ h^{NB}(\boldsymbol x) = \underset{k}{\operatorname{argmax}} \text{ } c(y_k) \pi_k p_{\boldsymbol x | y}(\boldsymbol x|y=k)$$
Fig. \ref{fig:F1_Score} shows the results when different costs are applied to the Naive-Bayes classification. Note that this technique is especially effective when the penalization of the majority class is higher, leading to a F1-score improvement with respect to the symmetric loss function of 2\%.
\section{Classification Impact on Real Data}
The rest of the paper studies the Twitter dataset. The first attempt was to use the same techniques as in the bi-dimensional dataset. Nevertheless, the presence of categorical variables makes oversampling and custom cost-sensitive approaches less suitable. Therefore, the first approach relied solely on undersampling and Naive Bayes. The Naive Bayes classifier achieved a F1-score of 29.73\% and including undersampling only improved the performance up to 41.98\%. The only solution is to use more advanced classifiers that can cope with such complex dataset.
Ensemble Classifiers are known to improve the performance of single classifiers in imbalanced datasets \cite{ensembles_review} by combining separate weak learners into a composite whole. Both bagging and boosting algorithms have been implemented from scratch to explore their advantages and compare them with highly-effective classifiers such as XGBoost.
\subsection{Bagging}
Bagging algorithms are composed of two parts: bootstrapping and aggregation. The first part consists of selecting a subsample of the dataset. In bagging algorithms, weak learners are only trained over a fraction of the dataset. For training, support vector machines are employed. Once all the classifiers are trained, the predictions of all the models are aggregated to provide the final prediction. Note that these algorithms are purely variance reducing procedures intended to mitigate instability, especially the one associated with decision trees.
\subsection{AdaBoost}
Unlike bagging, boosting fits the weak learners in an adaptive way: a different significance is assigned to each of the base learners based on the samples that were misclassified in the previous iteration. It was first introduced by Schapire in 1990, who proved in \cite{schapire} that a weak learner can be turned into a strong learner in the sense of probably approximately correct (PAC) learning framework. In particular, the AdaBoost algorithm stands out in the field of ensemble learning as one of the top ten data mining algorithms \cite{top10algo}. One of its main advantages is the versatility to incorporate cost-sensitive techniques. We implemented a custom AdaBoost classifier that enables us to gain control over the algorithm at a lower level, make adjustments when necessary and create other Adaboost-based classifiers such as AdaCost or Boosted SVM. The algorithm is shown below.
\begin{algorithm}
\KwInput{Training set $D = \{x_i, y_i\}, i=1,\dots,N;$ and $y_i \in \{ -1,+1\}$; $T:$ Number of iterations; $I:$ Weak learner}
\KwOutput{Boosted Classifier: $H(x)=sign\left( \sum^T_{t=1}\alpha_ih_t(x)\right)$ where $h_t, \alpha_t$ are the induced classifiers and their significance, respectively}
%\KwData{Testing set $x$}
$W_1(i) \leftarrow 1/N$ for $i=1,\dots,N$ %\tcp*{this is a comment}
\tcc{Create a weak learner in each iteration}
\For{t=1 to T}
{
$h_t \leftarrow I(D,W)$
$\epsilon_t \leftarrow \sum^N_{i=1}W_t(i)[h_t(x_i)\neq y_i]$
\If{$\epsilon_t > 0.5$}
{
$T \leftarrow t-1$
\bf{return}
}
$\alpha_t = \frac{1}{2}\ln \left( \frac{1-\epsilon_t}{\epsilon_t} \right)$
\tcc{Update Weights}
$W_{t+1}(i) = W_t(i) e^{(-\alpha_th_t(x_i)y_i)}$ for $i=1,\dots,N$
Normalize $W_{t+1}$ such that $\sum^N_{i=1}W_{t+1}(i)=1$
}
\caption{AdaBoost Algorithm}
\end{algorithm}
% Maybe we need to delete or reduce this paragraph
This custom implementation uses single decision trees with 2 leaf nodes. It takes the number of maximum iterations, namely the number weak learners that will be fitted, and a dataset $D$ formed by N training samples, each constituted by a feature vector $\boldsymbol{x}_i$ and an associated binary label $y_i$. For each iteration, a weak classifier is created using the weighted training samples. In the first iteration, we allocate the same weight to all the samples, i.e. $1/N$. Once the decision tree has been created, we predict the class of the training samples and compute the weighted misclassification error $\epsilon_t$. Then, the significance $\alpha_t$ is calculated based on that error. Finally, the weights of each training sample are updated according to its significance and whether the sample was correctly classified or not. Note that the weights are increased by $e^{\alpha}$ if the sample is misclassified or decreased by $e^{-\alpha}$ if correctly classified, with $\alpha_t \in [0,1]$ because $\epsilon_t \in [0,0.5]$.
In contrast to Bagging, AdaBoost uses all training samples to create each weak learner serially, giving more focus to challenging instances to turn the incorrect classifications into good predictions in the next iteration. Hence, AdaBoost can be considered as a "bias" reducing procedure, intended to increase the flexibility of stable (highly biased) weak learners when incorporated properly in a serial additive expansion. That is the reason why weak learners with a low variance but high bias --such as decision trees-- are well adapted for boosting. Lastly, the literature suggests that AdaBoost algorithms are generally resistant to overfitting regardless of the number of weak estimators employed. In fact, there are very few cases that reported overfitting in the training data \cite{BoostingStats}. This fascinating property is explained by 1) as we move onto the next iteration, the weak learners tend to have less significance and 2) similarly to SVM, ensemble classifiers maximize the margin which allows promoting a good generalization \cite{margin_adaboost}. The results section will further cover the impact of complexity on overfitting.
\subsection{AdaCost}
The AdaBoost algorithm is accuracy-oriented. In other words, it assumes each class has an even distribution. Therefore, in cases where the class distribution is uneven, the algorithm may incur systematic biases toward the majority class. Literature suggests two lines of work to incorporate an asymmetric weight update and eliminate these biases \cite{need_boosting}: 1) modify the model learned from data or 2) modifying how the model is used to make a decision. AdaCost falls into the former category, and it aims at modifying the update of the weights based on a slight modification:
$$ W_{t+1}(i) = W_t(i) \exp \left(-\alpha_t y_i h_t(x_i) \boxed{\phi(i)} \text{ } \right),$$
with $$ W_1(i) = \frac{c_i}{\sum_{i=1}^Nc_i}$$
and where the new boxed term is called the cost-adjustment function. We use this function to allocate different penalizations across different classes. %This function is left for design since the literature suggest more than one alternatives.
In this project, we used the cost-adjustment function suggested in \cite{ensembles_review}:
$$\phi(i) = 0.5C_i \left( \mathbbm{1}\{ h_t(\boldsymbol x)=1\} - \mathbbm{1}\{ h_t(\boldsymbol x)=-1\} \right)+0.5$$ where $C_i$ is a hyper-parameter that establishes the misclassification cost of the sample $i$, which ultimately depends upon the class of that sample. This cost-adjustment function yields to an upper bound cumulative misclassification cost equal to $d\prod_{t=1}^TZ_t$, where $d= \sum c_i$ and $Z_t$ is the sum of the costs calculated for $W_{t+1}$, i.e. the coefficient that we use to normalize the weights in AdaBoost \cite{adacost}. Since boosting minimizes $Z_t$, the significance ultimately needs to be updated in a different way \cite{improved_boosting}:
$$ \alpha = \frac{1}{2}\ln\frac{1+r}{1-r},\quad \text{where } r=\sum_iD(i)u_i, \ u_i=y_i h(x_i)\phi(i)$$.
All in all, the AdaCost algorithm follows the same procedure as AdaBoost with changes in the significance and weight update rule to incorporate an asymmetric penalization cost.
\subsection{AdaMEC}
The AdaMEC algorithm falls into the second category introduced in the previous section. The model is trained with the original AdaBoost, but modifies the decision rule by exploiting the Bayesian decision theory:
$$ H_{AdaMEC}(\boldsymbol x) = sign \left( \sum_{y \in \{-1,+1\}} c(y) \sum_{\tau: h_{\tau}(\boldsymbol x)=y} \alpha_{\tau} h_{\tau}(\boldsymbol x)\right)$$
This is called the Minimum Expected Cost rule and it assumes that the weighted votes of each weak learner are proportional to the class probabilities. We have incorporated this classifier in this study because it has been reported as one of the best cost-sensitive AdaBoost classifiers \cite{need_boosting}.
\subsection{Boosting SVM}
One of the practical concerns about AdaBoost is the accuracy/diversity dilemma \cite{study_boosted_svm}: when the weak learners are actually strong classifiers and they do not disagree too much on their vote, the performance of boosting is weakened. Support vector machines (SVM) are known to be strong learners that minimize structural risk such that they should not work well when embedded. However, the work on \cite{study_boosted_svm} and \cite{boosting_svm} suggests that if properly weakened, Boosted SVM can exceed the classification performance of traditional SVMs or AdaBoost on imbalanced datasets, and gain control over the accuracy/diversity issue. To do that, we have used radial basis function kernel (RBF), which uses the Gaussian width $\sigma$ to map the features on a high dimensional feature space. The performance of RBFSVM can be conveniently controlled by adjusting $\sigma$. Large values of sigma will lead to very weak classifiers. Algorithm 2 gives a detailed description of the implementation.
\begin{algorithm}
\KwInput{Training set $D = \{x_i, y_i\}, i=1,\dots,N;$ and $y_i \in \{ -1,+1\}$; $T:$ Maximum number of iterations; The initial $\sigma=\sigma_{ini}, \sigma_{min}, \sigma_{step}$}
\KwOutput{Boosted Classifier: $H(x)=sign\left( \sum^T_{t=1}\alpha_ih_t(x)\right)$ where $h_t, \alpha_t$ are the induced classifiers and their significance, respectively}
%\KwData{Testing set $x$}
$W_1(i) \leftarrow 1/N$ for $i=1,\dots,N$ %\tcp*{this is a comment}
\tcc{Create a weak learner in each iteration}
\While{$\sigma > \sigma_{min}$ and $t<T$}
{
$t \leftarrow t+1$
$h_t \leftarrow RBFSVM(D,W,\sigma)$ \tcp*{Train RBFSVM}
$\epsilon_t \leftarrow \sum^N_{i=1}W_t(i)[h_t(x_i)\neq y_i]$
\If{$\epsilon_t > 0.5$}
{
$\sigma \leftarrow \sigma - \sigma_{step}$
}
\Else
{
$\alpha_t = \frac{1}{2}\ln \left( \frac{1-\epsilon_t}{\epsilon_t} \right)$
\tcc{Update Weights}
$W_{t+1}(i) = W_t(i) e^{(-\alpha_th_t(x_i)y_i)}$ for $i=1,\dots,N$
Normalize $W_{t+1}$ such that $\sum^N_{i=1}W_{t+1}(i)=1$
}
}
\caption{Boosted SVM Algorithm}
\end{algorithm}
The main disadvantage of SVM is that the running time to train the model does not scale well with the size of the training set\cite{boosting_svm}. Our training set has more than 30,000 samples so the training would take a significant amount of time. Therefore, a preprocessing step was applied to the training data, whose dimensionality is reduced using PCA and ultimately under-sampled to speed-up the training process.
\subsection{XGBoost}
Nowadays, XGBoost is one of the most effective classification algorithms. In fact, it has been the winner of many competitions in the last years \cite{xgboost}. The working principle is additive tree learning, which means that the knowledge acquired on an iteration is used to train the following tree of the model. This new tree has to minimize the objective function that includes a training loss and a regularization term. The second-order Taylor expansion is employed, as the actual function can be very complex. The structure of the new tree is optimized to produce the maximum reduction of the objective function. The tree split that gives the maximum similarity between its prediction and the output is added.
In practice, XGBoost is the classification algorithm that achieves the highest F1-score and accuracy. The XGBoost library is used to train this algorithm for our dataset.
\section{Results and Discussion}
This section discusses the performance of each classifier, addresses how these algorithms work for different imbalance rates and shows how the number of learners affects the true and empirical risks.
\subsection{Performance Results}
The performance results of each methodology are summarized in Table \ref{tab:PerformanceComparison}. It includes the F1-score, accuracy, precision, recall and AUC in order to compare the algorithms from multiple perspectives. All scores have been obtained with classifiers that had 100 weak learners.
\begin{table}[htbp]
\caption{Best Classification Performances}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
\textbf{Type of} & & \multicolumn{5}{|c|}{\textbf{Scores (\%)}} \\
\cline{3-7}
\textbf{Method} & \textbf{Classifier} &\textbf{\textit{F-1}}& \textbf{\textit{Acc.}}&\textbf{\textit{Prec.}}&\textbf{\textit{Rec.}}&\textbf{\textit{AUC}}\\
\hline
& AdaBoost$^*$ &68.68&84.55&74.43&63.75&77.91 \\
\cline{2-7}
& Bagging$^*$ &49.98&78.03&63.27&41.31&66.31 \\
\cline{2-7}
Ensemble & R. Forest &27.73&76.96&83.33&26.63&57.71 \\
\cline{2-7}
& BoostSVM$^*$$^*$ &62.18&73.42&53.91&73.42&0.5 \\
\cline{2-7}
& XGBoost &\textbf{76.70}&\textbf{88.63}&\textbf{84.18}&\textbf{70.44}&\textbf{82.82} \\
\hline
Cost & AdaCost$^*$ &59.53&80.70&67.23&53.42&72.00 \\
\cline{2-7}
Sensitive& AdaMEC &70.99&85.88&78.21&64.99&79.21 \\
\hline
& AdaBoost$^*$ &69.03&83.14&67.42&70.71&79.17 \\
\cline{2-7}
& Bagging$^*$ &59.27&75.90&53.80&65.99&72.74 \\
\cline{2-7}
Hybrid & R. Forest &60.82&80.83&66.54&56.01&72.91 \\
\cline{2-7}
(under-& XGBoost &76.69&87.89&78.49&74.97&83.76 \\
\cline{2-7}
sampling) & AdaCost$^*$ &57.51&79.29&63.24&52.72&70.82 \\
\cline{2-7}
& AdaMEC &70.97&84.62&71.19&70.75&80.19 \\
\hline
\multicolumn{4}{l}{$^{\mathrm{*}}$Custom implementation.}
\multicolumn{4}{l}{$^{\mathrm{*}}$$^{\mathrm{*}}$Metrics are weighted.}
\end{tabular}
\label{tab:PerformanceComparison}
\end{center}
\end{table}
Under the category of ensemble algorithms, XGBoost outperforms every other algorithm in all metrics. Looking at the F1-score, XGBoost is close to 80\%. The next algorithm is AdaBoost, whose F1-score is above 68\%. The rest of the ensemble classifiers are clearly inferior. Regarding cost-sensitive algorithms, for this particular dataset, they do not give any substantial advantage. Only AdaMEC is slightly better than the original AdaBoost. For hybrid algorithms, which combine ensemble and cost-sensitive algorithms plus undersampling, the optimum beta (the one that gives the maximum F1-score) for each algorithm is selected. A few of the classifiers improve, as is the case of Random Forest, Bagging and AdaBoost. However, XGBoost still has the largest F1-score.
\subsection{Impact of Imbalance Data on Classification}
This section studies how each algorithm works if fewer samples of the majority class are considered (conceptually, this is similar to undersampling the majority class). Figure \ref{Fig:ImbalanceComparison} shows the performance of each algorithm for different rates. For example, the rate of 0.5 implies that the number of majority and minority class samples are the same.
\begin{figure}[htbp]
\centerline{\includegraphics[scale=0.35]{pictures/Imbalance_Comparison.png}}
\caption{Impact of imbalanced training set on classification.}
\label{Fig:ImbalanceComparison}
\end{figure}
It is interesting to note that some of the algorithms have a peak in the F1-score metric when rates around 0.6 are considered. Random Forest has a strong peak on 0.52 that supports why in the previous section this algorithm improves a 30\% in its F1-score when the undersampling is included. Bagging has the same effect, increasing around a 10\% when the optimum undersampling is applied.
\subsection{Overfitting Analysis}
Figure \ref{fig:True_empirical_risk_complexity} shows the evolution of both empirical and true risk for increasing algorithm complexity. The true risk and the empirical risk were computed with a validation and training set, respectively. Complexity increases with the number of learners trained by the algorithm, as it involves a larger number of hypotheses. XGBoost is the algorithm that minimizes the most the true risk. Even with just a few estimators, it is better than any other algorithm. The true risk rapidly decreases as the number of learners grows, up until 50 learners when a risk below 12\% is achieved.
\begin{figure}
\includegraphics[scale=0.45]{True_empirical_risk_complexity}
\centering
\caption{True (triangles) and empirical (circles) risks vs. complexity.}
\label{fig:True_empirical_risk_complexity}
\end{figure}
Regarding other algorithms, AdaBoost and AdaMEC tend to become similar as the number of weak learners increases. Although not comparable to XGBoost, both performances are satisfactory. However, AdaMEC seems to outperform AdaBoost. Regarding AdaCost, Bagging and Random Forest, their true risks are comparably high, and their performance does not improve much with the number of learners.
It is worth noting that the true risk remains stable after a certain number of learners, while the empirical risk always seems to decrease. This is especially visible in XGBoost. This occurs because the algorithm learns patterns that are extremely specific to the training set, but which are not generalizable to the test set. Therefore, very few improvements are seen on the true risk. %In the other algorithms, the different between empiricial and true risk is not as significant, but the true risk always remain higher than the empirical risk.
%\subsection{Diversity Analysis}
%Chart of Accuracy vs. Diversity
% Mirar Fig. 3 de esta paper: http://users.cecs.anu.edu.au/~wanglei/My_papers/AdaBoost_SVM_IJCNN_2005.pdf
\section{Conclusions}
This paper shows how the classification of imbalanced datasets can be addressed. Some methods that change the dataset on a data level, such as oversampling or undersampling, while others develop more complex classifiers (cost-sensitive and ensemble methods). In the synthetic Gaussian dataset, the first type of methods was employed with satisfactory results and the F1-score is higher. However, applying the same methods to the Twitter dataset did not yield a significant improvement. Consequently, several ensemble and hybrid classifiers have been tested, including some custom implementations. It has been determined that a substantial improvement of almost 30\% on the F1-score can be achieved in relation to a Naive Bayes classifier with undersampling. The ensemble and cost-sensitive classifiers that give the maximum F1-score are the XGBoost and AdaMEC, respectively. Among the ensemble algorithms, it has been shown that boosting algorithms are superior to bagging algorithms%, which are the other type of ensemble algorithms
. For this particular dataset, some hybrid methods (including undersampling of the majority class) are more effective than the corresponding default ensemble and cost-sensitive methods. This is the case of Bagging and Random Forest. In addition, this paper has also explored the versatility of these algorithms against the number of weak-learners and the rate of imbalance in the dataset. It was determined that XGBoost is the most resilient to imbalance rates and it has the lowest empirical and true risk in a broad spectrum of weak learners.
\vspace{12pt}
\begin{thebibliography}{1}
\bibitem{data_imbalance_overview}
V.~S. {Spelmen} and R.~{Porkodi}, ``A review on handling imbalanced data,'' in
{\em 2018 International Conference on Current Trends towards Converging
Technologies (ICCTCT)}, pp.~1--11, 2018.
\bibitem{undersampling_generalization}
M.~{Wasikowski} and X.~{Chen}, ``Combating the small sample class imbalance
problem using feature selection,'' {\em IEEE Transactions on Knowledge and
Data Engineering}, vol.~22, no.~10, pp.~1388--1400, 2010.
\bibitem{sampling_bias}
Q.-C. Joaquin, {\em Dataset shift in machine learning}.
\newblock MIT, 2009.
\bibitem{undersampling_posterior}
A.~D. {Pozzolo}, O.~{Caelen}, R.~A. {Johnson}, and G.~{Bontempi}, ``Calibrating
probability with undersampling for unbalanced classification,'' in {\em 2015
IEEE Symposium Series on Computational Intelligence}, pp.~159--166, 2015.
\bibitem{ensembles_review}
M.~{Galar}, A.~{Fernandez}, E.~{Barrenechea}, H.~{Bustince}, and F.~{Herrera},
``A review on ensembles for the class imbalance problem: Bagging-, boosting-,
and hybrid-based approaches,'' {\em IEEE Transactions on Systems, Man, and
Cybernetics, Part C (Applications and Reviews)}, vol.~42, no.~4,
pp.~463--484, 2012.
\bibitem{improved_boosting}
Schapire, Robert E. and Yoram Singer, "Improved boosting algorithms using confidence-rated predictions,", Springer Netherlands, 1999.
\bibitem{adacost}
Fan, Wei and Stolfo, Salvatore and Zhang, Junxin and Chan, Philip,
"AdaCost: Misclassification Cost-sensitive Boosting,"
{\em Proceedings of the Sixteenth International Conference on Machine Learning (ICML'99)}
\bibitem{boosting_svm}
Elkin Garc{\'{\i}}a and Fernando Lozano,
"Machine Learning and Data Mining in Pattern Recognition,"
{\em 5th International Conference, {MLDM} 2007}, Leipzig, Germany, July 18-20, 2007, Post Proceedings
\bibitem{study_boosted_svm}
{Xuchun Li} and {Lei Wang} and E. {Sung},
"A study of AdaBoost with SVM based weak learners,"
{\em Proceedings. 2005 IEEE International Joint Conference on Neural Networks}, 2005.
\bibitem{need_boosting}
Nikolaou, Nikos and Edakunni, Narayanan and Kull, Meelis and Flach, Peter and Brown, Gavin,
"Cost-sensitive boosting algorithms: Do we really need them?," Vol. 104, 2016.
\bibitem{margin_adaboost}
Rudin, Cynthia and Daubechies, Ingrid and Schapire, Robert,
"The Dynamics of AdaBoost: Cyclic Behavior and Convergence of Margins,"
{\em Journal of Machine Learning Research}, 2004.
\bibitem{top10algo}
Wu, Xindong and Kumar, Vipin and Quinlan, Ross and Ghosh, Joydeep and Yang, Qiang and Motoda, Hiroshi and Mclachlan, G. and Ng, Shu Kay Angus and Liu, Bing and Yu, Philip and Zhou, Zhi-Hua and Steinbach, Michael and Hand, David and Steinberg, Dan,
"Top 10 algorithms in data mining," {\em {Knowledge and Information Systems}}, Vol. 14, 2007.
\bibitem{BoostingStats}
Jerome Friedman and Trevor Hastie and Robert Tibshirani,
"Additive Logistic Regression: a Statistical View of Boosting,"
{\em Annals of Statistics}, Vol. 28, 1998.
\bibitem{schapire}
Schapire, Robert E.,
"The Strength of Weak Learnability," Vol. 5, 1990.
\bibitem{xgboost}
T. {Chen} and C.~{Guestrin}, ``XGBoost: A Scalable Tree Boosting System,'' in
{\em Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining}, pp.~785--794, 2016.
\end{thebibliography}
%\bibliographystyle{ieeetr}
%\bibliography{ref2.bib}
%\bibliography{ECE6254_references.bib}
\end{document}
| {
"alphanum_fraction": 0.7650541666,
"avg_line_length": 72.1585820896,
"ext": "tex",
"hexsha": "39945fb0d902b84feaf89b6bdc03477c5cd5bdb7",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a758a740689d010180c77cc4e977c810d2a360ca",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "crisgompec/ImbalancedDataset",
"max_forks_repo_path": "WriteUp/report.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a758a740689d010180c77cc4e977c810d2a360ca",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "crisgompec/ImbalancedDataset",
"max_issues_repo_path": "WriteUp/report.tex",
"max_line_length": 1151,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "a758a740689d010180c77cc4e977c810d2a360ca",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "crisgompec/ImbalancedDataset",
"max_stars_repo_path": "WriteUp/report.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 9942,
"size": 38677
} |
\section{Next Step}
Our proposed way to workaround the situation mentioned in previous chapter is using
supervector-based approaches. This is advantageous since it map a speech to a single
vector, which makes it easy to utilizes discrimitive models that are more powerful
in classification task, such as SVM. Further more,
we plan to conduct extensive investigation on \textbf{Joint Factor Analysis(JFA)}
, which is a much promising method to our best knowledge extent.
| {
"alphanum_fraction": 0.813163482,
"avg_line_length": 52.3333333333,
"ext": "tex",
"hexsha": "0a97e7b467d4df346b3d0ba5f4075b1b2d5ba713",
"lang": "TeX",
"max_forks_count": 315,
"max_forks_repo_forks_event_max_datetime": "2022-03-29T08:13:36.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-21T00:06:00.000Z",
"max_forks_repo_head_hexsha": "1f5d150ded23af4c152b8d20f1ab4ecec77b40e1",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "juliia5m/knu_voice",
"max_forks_repo_path": "doc/Checkpoint-Report/futurework.tex",
"max_issues_count": 91,
"max_issues_repo_head_hexsha": "1f5d150ded23af4c152b8d20f1ab4ecec77b40e1",
"max_issues_repo_issues_event_max_datetime": "2021-05-19T08:51:26.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-03-19T09:25:23.000Z",
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "juliia5m/knu_voice",
"max_issues_repo_path": "doc/Checkpoint-Report/futurework.tex",
"max_line_length": 84,
"max_stars_count": 717,
"max_stars_repo_head_hexsha": "1f5d150ded23af4c152b8d20f1ab4ecec77b40e1",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "juliia5m/knu_voice",
"max_stars_repo_path": "doc/Checkpoint-Report/futurework.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-30T12:45:45.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-03T15:25:46.000Z",
"num_tokens": 96,
"size": 471
} |
\documentclass[12pt]{article}
\usepackage[english, portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage{sourcesanspro}
\renewcommand{\familydefault}{\sfdefault}
\usepackage{sectsty}
\sectionfont{\fontsize{14}{15}\selectfont}
\usepackage[margin=3cm]{geometry}
\linespread{1.5}
\usepackage{indentfirst}
\setlength\parindent{1.25cm}
\usepackage{tocloft}
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand*\cftfigpresnum{\bfseries Figure~}
\settowidth{\cftfignumwidth}{\cftfigpresnum}
\renewcommand{\cftfigaftersnumb}{\quad--~}
\usepackage{import}
\usepackage[notocbib]{apacite}
\usepackage{multibib}
\newcites{intro}{\centerline{\bfseries\Large References}}
\newcites{review}{\centerline{\bfseries\Large References}}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{microtype}
\DeclareUnicodeCharacter{2212}{-}
\def\blankpage{%
\clearpage%
\thispagestyle{empty}%
\addtocounter{page}{+0}%
\null%
\clearpage}
\begin{document}
\pagenumbering{Roman}
\begin{center}
\includegraphics[width=\columnwidth]{figs/UPorto.png}
\vspace{6em}
\textbf{\Large Calibration and validation of accelerometers: Establishing new equations for energy expenditure and ground reaction force prediction}
\vspace{\fill}
\textbf{Lucas de Souza Veras}
\medskip
\textbf{Porto, 2019}
\end{center}
\thispagestyle{empty}
\blankpage
\begin{center}
\includegraphics{figs/UPorto.png}
\vspace{4em}
\Large \textbf{Calibration and validation of accelerometers: Establishing new equations for energy expenditure and ground reaction force prediction}
\end{center}
\vspace{6em}
\begingroup
\setlength{\leftskip}{3.75cm} \noindent Dissertação apresentada com vista à obtenção do 2º ciclo em Atividade Física e Saúde, da Faculdade de Desporto da Universidade do Porto, ao abrigo do Decreto-Lei nº 74/2006, de 24 de março, na redação dada pelo Decreto-Lei nº 65/2018 de 16 de agosto
\par
\endgroup
\vspace{\fill}
\noindent \textbf{Orientador:} Professor Doutor Hélder Rui Martins Fonseca
\noindent \textbf{Coorientador:} Professor Doutor José Manuel Fernandes de Oliveira
\medskip
\begin{center}
Lucas de Souza Veras
Porto, 2019
\end{center}
\thispagestyle{empty}
\pagebreak
\section*{\hfil Ficha de catalogação \hfil}
\vspace{\fill}
\noindent Veras, L. (2019). Calibration and validation of accelerometers: Establishing new equations for energy expenditure and ground reaction force prediction. Porto: Dissertação de Mestrado apresentada à Faculdade de Desporto da Universidade do Porto.
\bigskip
\noindent \textbf{Palavras-chave:} MONITORES DE ATIVIDADE, OBESIDADE, VALIDAÇÃO, CALORIMETRIA INDIRETA, CARGA MECÂNICA
\pagebreak
\section*{\hfil Financiamento \hfil}
\vspace{\fill}
\noindent A presente dissertação de Mestrado foi realizada no âmbito do Projeto BaSEIB \textit{Clinical Trial - Bariatric Surgery and Exercise Intervention Bone Trial}, financiado pela Fundação para a Ciência e a Tecnologia (FCT; \textbf{PTDC/DTP-DES/0968/2014}) através de fundos nacionais e cofinanciado pelo Fundo Europeu de Desenvolvimento Regional (FEDER) através do programa COMPETE - Programa Operacional Fatores de Competitividade (\textbf{POCI-01-0145-FEDER-016707}).
\vspace{2em}
\begin{center}
\includegraphics[width=\columnwidth]{figs/funding.png}
\end{center}
\blankpage
\begin{center}
\large{\textbf{Acknowledgements}}
(Agradecimentos)
\end{center}
\addcontentsline{toc}{section}{Acknowledgements}
\vspace{1em}
Primeiramente gostaria de agradecer à minha família, aos meus pais Sinval Veras e Jussara Veras, por seu apoio e suporte incondicional em todos os momentos da minha vida, principalmente quando tomei a decisão de cruzar o oceano e ir atrás do meus sonhos. Vocês são meu espelho e meu exemplo, serei eternamente grato por tudo o que vocês já fizeram.
À minha namorada, Ananda Stuart, companheira de todas as horas. Obrigado por ter estado comigo mesmo quando não podíamos estar fisicamente perto. Seu amor, seu carinho e sua sensibilidade me motivam todos os dias.
Aos meus amigos que estiveram presentes por todo este caminho. Pedro Rios, agradeço por todos estes anos de companheirismo, por nunca recusar um pedido de ajuda, sua amizade me é essencial. Aos meus colegas de mestrado, que dividiram comigo todas as aulas, trabalhos, exames, dificuldades e aprendizados. Aos meus amigos Florêncio Sousa e Giorjines Boppre, obrigado por toda a amizade e conhecimentos partilhados.
Finalmente, aos meus professores. À professora Flávia Accioly, por ainda na graduação ter me incentivado no caminho do conhecimento, e por abrir tantas portas. Ao professor José Oliveira, por sua experiência e pela oportunidade de fazer parte deste projeto. Ao meu orientador, professor Hélder Fonseca, agradeço por toda a sua ajuda durante este trajeto, seus ensinamentos foram essenciais para que eu possa concluir este mestrado.
\blankpage
\renewcommand{\contentsname}{\centerline{\bfseries\Large Table of Contents \vspace{1em}}}
\tableofcontents
\blankpage
\section*{\hfil List of figures \hfil}
\addcontentsline{toc}{section}{List of figures}
\vspace{0.5em}
\noindent \textbf{Literature review}
\vspace{0.5em}
\noindent \textbf{Figure 1.} Articles published by year with search terms ``exercise or physical activity'' and ``accelerometer or accelerometry'', Scopus.com, accessed 15 April 2019. \dotfill 11
\vspace{2em}
\noindent \textbf{Study 1}
\vspace{0.5em}
\noindent \textbf{Figure 1.} Bland-Altman plots of measured and predicted EE in all accelerometer metrics from hip (left panel, A) and back (right panel, B) placement. Continuous thick lines show bias while dotted lines show upper and lower limits of agreement.
\noindent \dotfill 40
\vspace{2em}
\noindent \textbf{Study 2}
\vspace{0.5em}
\noindent \textbf{Figure 1.} Scatterplot of actual pRGRF versus pRACC (panel a), actual pVGRF versus pVACC (panel b), actual pRLR versus pRATR (panel c), and actual pVLR versus pVATR (panel d) from lower back and hip accelerometer placements. Data points of participants in different BMI categories are highlighted by markers with different colors and shapes. Linear trends for each BMI class are also depicted. \dotfill 49
\vspace{0.3em}
\noindent \textbf{Figure 2.} Bland–Altman plots of actual and predicted pRGRF (panel \textbf{a}), pVGRF (panel \textbf{b}), pRLR (panel \textbf{c}), and pVLR (panel \textbf{d}) from lower back and hip accelerometer placement–derived equations. Continuous thick lines show bias (average of the differences between real and pre- dicted pGRFs and pLRs) while dotted lines show upper and lower limits of agreement ($\pm$ 1.96 SD). Data points of participants in different BMI categories are highlighted by markers with different colors and shapes. \dotfill 51
\vspace{0.3em}
\noindent \textbf{Figure 3.} Data represents the relationship between actual (measured by FP) and predicted values by the regression equations developed from lower back and hipworn accelerometers on pGRF in the resultant (panel \textbf{a}) and its vertical component (panel \textbf{b}) and on pLR in the resultant (panel \textbf{c}) and its vertical component (panel \textbf{d}). For each speed, none of the predicted pGRF was significantly different (\textit{p} > 0.05) from the actual pGRF, while at the speed of 2 km$\cdot$h\textsuperscript{−1}, the predicted pLR was significantly different (\textit{p} < 0.05) from the actual pLR (\textit{p} value presented above each speed). Moreover, actual and predicted pGRFs and pLRs significantly increased (\textit{p} < 0.001) along with speed increments. Actual and predicted pGRF and pLR values were systematically shifted in each speed ($x$-axis) to avoid overlapping and facilitate result interpretation/visualization. Data are pre- sented as mean $\pm$ confidence interval. \dotfill 52
\vspace{0.3em}
\noindent \textbf{Figure 4.} Bland–Altman plots of actual and predicted pVGRFs by our equation (left panel, \textbf{a}) and by Neugebauer’s equation [20] (right panel, \textbf{b}) from hip-derived accelerometer data. Continuous thick lines show bias (average of the differences between real and predicted pGRFs) while dotted lines show upper and lower limits of agreement ($\pm$ 1.96 SD). \dotfill 54
\pagebreak
\section*{\hfil List of tables \hfil}
\addcontentsline{toc}{section}{List of tables}
\vspace{0.5em}
\noindent \textbf{Study 1}
\vspace{0.5em}
\noindent \textbf{Table 1.} Regression equations, R\textsuperscript{2} and accuracy indices. \dotfill 39
\vspace{0.3em}
\noindent \textbf{Table 2.} Proposed cut-points and their classification agreement. \dotfill 41
\vspace{2em}
\noindent \textbf{Study 2}
\vspace{0.5em}
\noindent \textbf{Table 1,} Regression equations, R\textsuperscript{2} and accuracy indices. \dotfill 50
\vspace{0.3em}
\noindent \textbf{Table 2.} Accuracy indices of ours and Neugebauer equation to predict pVGRF with data from accelerometers placed at hip. \dotfill 53
\blankpage
\section*{\hfil List of abbreviations \hfil}
\addcontentsline{toc}{section}{List of abbreviations}
\vspace{0.5em}
\noindent \textbf{AC:} activity counts
\noindent \textbf{ACC:} acceleration
\noindent \textbf{AF:} atividade física
\noindent \textbf{AI:} activity index
\noindent \textbf{ANOVA:} analysis of variance
\noindent \textbf{ATR:} acceleration transient rate
\noindent \textbf{AUC:} area under the curve
\noindent \textbf{BMD:} bone mineral density
\noindent \textbf{BMI:} body mass index
\noindent \textbf{BW$\cdot$s\textsuperscript{-1}:} body weights per second
\noindent \textbf{DXA:} dual-energy x–ray absorptiometry
\noindent \textbf{EE:} energy expenditure
\noindent \textbf{ENMO:} euclidean norm minus one
\noindent \textbf{FP:} force plates
\noindent \textbf{GE:} gasto energético
\noindent \textbf{GRF:} ground reaction forces
\noindent \textbf{IAF:} intensidade da atividade física
\noindent \textbf{LMM:} linear mixed models
\noindent \textbf{LoA:} limits of agreement
\noindent \textbf{LOOCV:} leave-one-out cross-validation
\noindent \textbf{LPA:} light physical activity
\noindent \textbf{LR:} loading rate
\noindent \textbf{MAD:} mean amplitude deviation
\noindent \textbf{MAE:} mean absolute error
\noindent \textbf{MAPE:} mean absolute percent error
\noindent \textbf{MET:} metabolic equivalent
\noindent \textbf{MPA:} moderate physical activity
\noindent \textbf{NHANES:} National Health and Nutrition Examination Survey
\noindent \textbf{PA:} physical activity
\noindent \textbf{pACC:} peak acceleration
\noindent \textbf{PAI:} physical activity intensity
\noindent \textbf{pATR:} peak acceleration transient rate
\noindent \textbf{pFRS:} pico da força de reação do solo
\noindent \textbf{pGRF:} peak ground reaction force
\noindent \textbf{pLR:} peak loading rate
\noindent \textbf{pRACC:} peak resultant acceleration
\noindent \textbf{pRATR:} peak resultant acceleration transient rate
\noindent \textbf{pRGRF:} peak resultant ground reaction force
\noindent \textbf{pVLR:} peak vertical loading rate
\noindent \textbf{pVACC:} peak vertical acceleration
\noindent \textbf{pVATR:} peak vertical acceleration transient rate
\noindent \textbf{pVGRF:} peak vertical ground reaction force
\noindent \textbf{pVLR:} peak vertical loading rate
\noindent \textbf{R\textsuperscript{2}:} coefficient of determination
\noindent \textbf{RMR:} resting metabolic rate
\noindent \textbf{RMSE:} root mean square error
\noindent \textbf{ROC:} receiver operating characteristic
\noindent \textbf{SA:} sedentary activity
\noindent \textbf{SD:} standard deviation
\noindent \textbf{VCO\textsubscript{2}:} carbon dioxide production
\noindent \textbf{VO\textsubscript{2}:} oxygen uptake
\noindent \textbf{VPA:} vigorous physical activity
\pagebreak
\section*{\hfil Resumo \hfil}
\addcontentsline{toc}{section}{Resumo}
\vspace{0.5em}
\noindent Os acelerómetros têm sido amplamente adotados para monitorizar a atividade física (AF). A sua utilização mais frequente é na determinação do gasto energético (GE) e da intensidade da AF (IAF), mas mais recentemente começaram a ser utilizados para predizer a carga mecânica nas estruturas esqueléticas. Contudo, a grande maioria dos estudos de calibração de acelerómetros foi feita com pessoas não obesas, o que prejudica a sua aplicação na monitorização da AF em doentes com obesidade. Portanto, o objetivo geral deste trabalho foi o de melhorar a precisão da predição do GE, da carga mecânica e da determinação da IAF especialmente em doentes com obesidade. Para isto, o presente trabalho está estruturado em três partes: i) uma revisão de literatura em que é feito o enquadramento teórico sobre os acelerómetros, o seu processo de calibração e a sua utilização para predizer o GE e a carga mecânica; ii) um artigo original em que foram desenvolvidas equações para predizer o GE associado à AF e pontos de corte para classificar a IAF em doentes com obesidade severa; e iii) um artigo original em que foram desenvolvidas equaçõe para predizer o pico da força de reação do solo (pFRS) com dados de acelerometria em sujeitos com pesos entre o normal e a obesidade severa. Os resultados revelaram que todos os modelos de predição desenvolvidos para o GE e o pFRS e os pontos de corte para classificar a IAF apresentaram uma precisão similar ou superior comparada à de estudos prévios. Em conclusão, os nossos resultados mostram que os dados de acelerometria permitem predizer de precisamente o GE e classificar corretamente a IAF em doentes com obesidade severa e também predizer o pFRS de forma precisa em sujeitos com pesos entre o normal e a obesidade severa. Portanto, futuros estudos podem adotar equações de regressão e pontos de corte apropriadamente desenvolvidos para os obesos e também facilmente determinar a intensidade da carga mecânica em condições clínicas com a utilização de acelerómetros.
\vspace{\fill}
\noindent
\textbf{Palavras-chave:} MONITORES DE ATIVIDADE, OBESIDADE, VALIDAÇÃO, CALORIMETRIA INDIRETA, CARGA MECÂNICA
\blankpage
\section*{\hfil Abstract \hfil}
\addcontentsline{toc}{section}{Abstract}
\vspace{0.5em}
\noindent Accelerometers have been widely adopted to objectively monitor physical activity. Their most frequent use is to determine energy expenditure (EE) and physical activity intensity (PAI), but more recently they have started to be explored as a way to predict skeletal mechanical loading. However, almost all accelerometer calibration studies were developed for non-obese people, hindering its application in obese patients. Therefore, the general aim of this work was to improve the accuracy of EE and mechanical loading prediction and PAI classification, especially in obese patients. For this, the current work is structured in three parts: i) a literature review with the theoretical background regarding accelerometers, their calibration process and their use to predict EE and mechanical loading; ii) an original article developing regression equations to predict the physical activity-related EE and cut-points to classify PAI in severely obese people based on several accelerometry metrics; and iii) an original article developing accelerometry-based equations to predict peak ground reaction forces (pGRF) on subjects with body mass ranging from normal weight to severe obesity. The results revealed that all of our prediction models developed for EE and pGRF prediction and our cut-points for PAI classification presented a similar or better accuracy compared to other previously published studies. In conclusion, our results showed that accelerometry data allow to accurately predict EE and classify PAI in severely obese people and to predict pGRF in normal weight to severely obese subjects. Therefore, future studies may adopt appropriate regression equations and cut-points developed for obese people and also to easily determine mechanical loading intensity in clinical settings using accelerometers.
\vspace{\fill}
\noindent
\textbf{Keywords:} ACTIVITY MONITOR, OBESITY, VALIDITY, INDIRECT CALORIMETRY, MECHANICAL LOADING
\blankpage
\pagenumbering{arabic}
\section*{\vfill\raggedleft\bfseries 1. General introduction}
\addcontentsline{toc}{section}{1. General introduction}
\thispagestyle{empty}
\blankpage
\section*{General introduction}
There are plenty of evidence supporting the role of physical activity (PA) in health improvement and chronic diseases prevention \citeintro{Guthold_2018, Warburton_2017, Warburton_2006}. These evidences contributed to the emergence of recommendations about the type, amount and intensity of PA necessary to maintain or improve health in the general population \citeintro{WHO_2010}, and also led to the need of accurate methods to assess PA during daily living \citeintro{Montoye_2000, Plasqui_2013} either subjectively or objectively. Accelerometers are among the most common devices to objectively measure PA \citeintro{Strath_2013}, but as they only measure the body segment accelerations, their output needs to be translated into more biologically meaningful information by a process called calibration \citeintro{Welk_2005}.
Nowadays, the majority of calibration studies use the accelerometer output to determine several cardio-metabolic parameters, such as energy expenditure (EE) and PA intensity (PAI) levels \citeintro{Migueles_2017}. However, other important uses for accelerometry data is the estimation of biomechanical parameters relevant for bone health, such a ground reaction forces \citeintro{Neugebauer_2014}.
Another important aspect of accelerometer calibration studies is that their application is only valid for a population similar to the one used as the calibration sample \citeintro{Welk_2005}. Patients with obesity present several particular characteristics compared to the non-obese population, as a low resting metabolic rate \citeintro{Byrne_2005}, lower aerobic physical fitness \citeintro{Souza_2010} and some biomechanical gait alterations \citeintro{Bode_2019}. As obesity is an increasingly prevalent condition \citeintro{Guthold_2018}, specific accelerometer calibration studies are needed for this population in order to accurately predict their PA related parameters in order to use them to monitor PA, exercise and their effects on health.
Therefore, the general purposes of this work were: i) to develop regression equations to predict EE and cut-points to classify sedentary activity and PAI in patients with severe obesity based on several metrics obtained from accelerometer data; and ii) to develop accelerometry-based equations to predict peak ground reaction forces (pGRF) on normal weight to severely obese patients. In order to attend with these goals, this dissertation was structured in four chapters. The first chapter consists of the general introduction, which presents some relevant background information concerning the dissertation main theme and the primary objectives. The second chapter includes a narrative literature review regarding accelerometers, their calibration process and their use to predict EE and skeletal mechanical loading. The third chapter is composed of two original articles in which accelerometry-based prediction models to EE and cut-points to classify PAI were developed, as well as several regression equations to predict pGRF using raw accelerometer data on normal weight to severely obese patients. Finally, the fourth chapter presents the dissertation general conclusions and future perspectives.
\pagebreak
\renewcommand{\refnameintro}{\large References}
\vspace{0.5em}
\bibliographyintro{bibliography}
\bibliographystyleintro{fadeup}
\pagebreak
\section*{\vfill\raggedleft\bfseries 2. Literature review}
\addcontentsline{toc}{section}{2. Literature review}
\thispagestyle{empty}
\blankpage
\section*{Introduction}
\addcontentsline{toc}{subsection}{Introduction}
Physical activity (PA) has long been established as one of the main contributors to prevent chronic diseases and promote health \citereview{Kaminsky_2014, Warburton_2017}. Evidence shows that lack of PA leads to an increased risk of cardiovascular disease, diabetes, hypertension, osteoporosis, several types of cancer and a higher mortality risk \citereview{Guthold_2018, Lee_2012, Shiroma_2014}. Given the relevant relationship between PA and health, there is an increasing need of accurate and reliable methods of PA assessment on daily life \citereview{Montoye_2000, Plasqui_2013, Strath_2013}. These methods can be either subjective, such as questionnaires, or objective, as direct observation and wearable devices \citereview{Strath_2013, Troiano_2005}.
The most commonly used wearable devices to assess PA are accelerometers \citereview{Strath_2013}. These are equipments that detect the body movement accelerations in one to three orthogonal planes (anteroposterior, mediolateral, and vertical) \citereview{Chen_2005}. The accelerometers output can be either raw acceleration, usually expressed as gravitational acceleration units (\textit{g}), or activity counts (AC), which are processed data derived from the raw acceleration and are based on manufacturer-specific algorithm \citereview{Chen_2005, Basset_2012, Troiano_2014}. In both cases, the accelerometer output needs to be translated into more biologically meaningful information through a calibration process \citereview{Matthews_2005}.
Currently, most calibration studies use the accelerometer output to determine energy expenditure (EE) and PA intensity levels \citereview{Migueles_2017, Mendes_2018} but they can be also used to estimate biomechanical parameters, such as ground reaction forces (GRF) \citereview{Neugebauer_2014, Fortune_2014}, to evaluate standing balance \citereview{Mayagoitia_2002}, to detect the type of PA being performed \citereview{Bonomi_2009, Zhang_2012}, among others. Apart from the standard measure against which the accelerometer output needs to be compared, calibration studies must carefully define the sample characteristics, PA protocols and statistical approaches, as these aspects can greatly influence the study internal and external validity \citereview{Basset_2012, Welk_2005}. This led to the emergence of several different calibration studies in the literature with distinct methods to predict a given outcome variable \citereview{Mendes_2018, Matthews_2018}.
This current review aims to describe the literature regarding the use of accelerometers to measure EE, classify PA intensities and estimate GRF, as well as issues about calibration and validation studies of these wearable monitors.
\section*{Accelerometers}
\addcontentsline{toc}{subsection}{Accelerometers}
As said previously, accelerometers are wearable devices used to measure PA related variables \citereview{Chen_2005}. The first portable accelerometer was developed in the 1980s \citereview{Wong_1981, Montoye_1983} and with the many technological advances since then, the use of such devices in research is ever growing, with a major increase in the number of published articles mentioning PA or exercise and accelerometers since the early 2000s (Figure \ref{art_year}).
\renewcommand{\figurename}{Figure}
\begin{figure}[h]
\includegraphics[width=\linewidth]{figs/fig1.pdf}
\caption{Articles published by year with search terms ``exercise or physical activity'' and ``accelerometer or accelerometry'', Scopus.com, accessed 15 April 2019.}
\label{art_year}
\end{figure}
From a technical standpoint, the working principle of most accelerometers is based on a sensing element, the seismic mass, and a piezoelectric element. When this system suffers an acceleration, the seismic mass causes a deformation in the piezoelectrical element, generating an output voltage signal proportional to the applied acceleration \citereview{Chen_2005, Yang_2010}. The rate by which this data is acquired is determined by the sampling frequency of the device, making it responsive not only to the acceleration intensity, but to its frequency \citereview{Mathie_2004}. The signal is then filtered and processed before being digitally stored by the equipment \citereview{Chen_2005}.
As an objective method to measure PA, accelerometers offer some advantages over subjective methods, such as questionnaires and PA diaries. They are capable of long term continuous data collection with low subject burden \citereview{Chen_2012, Strath_2013}, are more accurate than questionnaires to measure PA and sedentary behaviour \citereview{Celis-Morales_2012, Matthews_2018} and can measure the full spectrum of daily activities, providing more detailed intensity, frequency and duration data \citereview{Matthews_2018, Strath_2013}.
On the other hand, accelerometers also present some weaknesses. They cannot reliably account for some activities, such as cycling, climbing stairs, weight-lifting and upper-body activities when worn at hip or lower back \citereview{Strath_2013}. Also, different manufacturers have distinct proprietary algorithms to compute raw data into AC, hindering the comparison of the accelerometer output between devices \citereview{Plasqui_2013}. In addition, there is still no consensus on the best positioning place for accelerometers on the body, and how to process the data \citereview{Troiano_2014}.
Some decisions need to be made in order to conduct a research utilizing accelerometers, such as the device sampling frequency, body placement, and which accelerometer output data to use (either AC or raw acceleration). To assure that all human movements are correctly captured by the monitor, the sampling frequency must be at least twice the highest movement frequency, accordingly to the Nyquist criterion \citereview{Chen_2012}. The first accelerometry studies utilized a sampling frequency of 30 Hz, which was the acquisition limit of most equipments at that time, but nowadays the recommendation ranges from 90 to 100 Hz \citereview{Migueles_2017}.
As to the body placement in which to wear the accelerometers, the waist is the most common as it is the closest to the body center of mass \citereview{Chen_2005, Mendes_2018}. Other placements are the lower back \citereview{Brandes_2012}, wrist \citereview{Hildebrand_2017}, ankle \citereview{Fortune_2014} and thigh \citereview{Montoye_2016a}. Among these body placements, the wrist has been gaining popularity on the past few years, most due to its increase in prediction accuracy in some recent studies \citereview{Phillips_2013, Hildebrand_2017} and its higher compliance compared with waist placement. These facts made the United States National Health and Nutrition Examination Survey (NHANES) change from waist to wrist placement in the 2011-2012 and 2013-2014 survey cycles \citereview{Troiano_2014}.
Early studies on accelerometry utilized the AC since this was the only available output variable at that time. Despite presenting moderate to high correlations with measured EE \citereview{Nichols_1999, Freedson_1998} and GRF \citereview{Janz_2003}, AC calculation depends on proprietary algorithms that vary among manufacturers, causing different accelerometers to produce different count values even when measuring the same accelerations \citereview{Chen_2012, Plasqui_2013}.
Recent technological advances have enabled to collect and store raw acceleration data at high frequencies, eliminating the need to summarize them into AC \citereview{Bakrania_2016}. The use of raw acceleration entails some advantages, as the ability to extract time-domain and frequency-domain features from the data, allowing to apply more advanced statistical and computational techniques in the calibration process \citereview{John_2013}. It can also enhance comparability among accelerometers from different manufacturers \citereview{Mendes_2018, Rowlands_2016}.
With these modern technologies and the recent endorsement to the use of raw acceleration \citereview{Freedson_2012}, several metrics based on raw acceleration have been developed, as the euclidean norm minus one (ENMO) \citereview{vanHees_2013}, the mean amplitude deviation (MAD) \citereview{Vaha-Ypya_2015} and the activity index (AI) \citereview{Bai_2016}. The use of these new metrics also complies with the recommendations for more transparency \citereview{Intille_2012}, since they are nonproprietary metrics, with known properties and can be computed using open-source software.
\section*{Accelerometers calibration}
\addcontentsline{toc}{subsection}{Accelerometers calibration}
As already discussed, the accelerometers output can be either AC, a dimensionless unit, or raw acceleration, usually expressed as gravitational acceleration units (\textit{g}). Both outputs can indicate overall movement, but they need to be converted into more biologically meaningful units in a process designated as calibration \citereview{Welk_2005}.
The calibration process can be either for value or unit calibration. Value calibration examines the accelerometers validity, comparing the output measure with a gold standard criterion measure that has biological significance \citereview{Basset_2012}. Unit calibration, on the other hand, analyses the accelerometer reliability by measuring differences in the output among distinct units of the same device and aims to reduce inter-instrument variability \citereview{Welk_2005, Basset_2012}. The remaining of this section will address value calibration.
To execute a calibration research, scientists need to simultaneously collect accelerometer and criterion data on multiple subjects performing different activities. These data will then be used to convert the accelerometer output into EE estimates, time spent in different PA intensity categories, GRF, activity types, or other physiological or biomechanical variable of interest, according to the criterium data collected \citereview{Basset_2012}. Regarding the criterion measure, several methods can be used to validate EE predictions, such as direct observation, doubly labeled water, room calorimetry and indirect calorimetry, with the latest being the most used \citereview{Basset_2012, Mendes_2018}. Studies validating GRF prediction use mainly force plates as criterion measure \citereview{Neugebauer_2018, Neugebauer_2014, Fortune_2014}.
Initial calibration research was mainly performed in controlled laboratory conditions to evaluate accelerometer and criterion data agreement, while in more recent studies the use of free-living activities is becoming more common, due to its greater external validity \citereview{Welk_2005, Matthews_2005}. Typical laboratory-based calibration studies, such as those performed by Freedson et al. \citeyearreview{Freedson_1998} and Nichols et al. \citeyearreview{Nichols_1999}, used progressively increasing speeds on a treadmill, ranging from slow walking to running, and as result they usually displayed strong associations between AC and measured EE using linear regression.
One of the main purposes of using accelerometers is to estimate EE in daily living. Since locomotor activities are not the only tasks performed on everyday life, laboratory research generally fails to provide a true evaluation of how well accelerometers perform under real-world conditions \citereview{Welk_2005}. Thus, many studies have also assessed accelerometers validity using free-living activities in their test protocol. These studies usually include in their procedures a variety of sedentary (e.g., lying down, sitting, reading), household (e.g., sweeping, laundering, stair climbing), and exercise activities (e.g., cycling, jumping jacks, squatting) along with locomotor activities \citereview{Montoye_2015, Montoye_2016b}.
Despite the benefit of including activities that represent more accurately real-world conditions, calibration studies that utilize free-living activities have to consider that the relationship between the accelerometer output and the criterion measure for these activities is substantially different than that between criterion measure and locomotor activities and, therefore, a single regression equation may not fully characterize the data \citereview{Welk_2005}. To address this issue, Crouter et al. \citeyearreview{Crouter_2006} developed a two-regression method that discriminates locomotor from lifestyle activities based on the AC coefficient of variation. Crouter's model exhibited an improved accuracy compared to the methods available at that time and, since then, novel approaches based on pattern recognition have been developed, some of them even more accurate than the two-regression model \citereview{Farrahi_2019, Basset_2012}.
Attention must be paid to certain methodological aspects of accelerometer calibration studies. First, the study sample must be representative of the population in terms of age, weight or body mass index (BMI), and behavioral patterns \citereview{Welk_2005, Strath_2012}. Thus, a few calibration studies have been done for specific populations such as children \citereview{Phillips_2013, McMurray_2016}, adults \citereview{Freedson_1998, Hibbing_2018}, obese people \citereview{Aadland_2012}, and elderly \citereview{Evenson_2015}.
Second, since the accelerometer positioning on the body is one of the factors influencing its output, distinct calibration needs to be done for each positioning \citereview{Welk_2005}. Furthermore, as accelerometers output can also vary among different units of the same device, calibration research should employ multiple monitors to allow this variability and avoid bias \citereview{Welk_2005}. Finally, a wide range of PA, representing those usually performed by the target population, should be performed during calibration procedures \citereview{Welk_2005, Basset_2012}. In addition, these activities should also include lying, sitting and standing tasks and cover the entire range of intensities, from sedentary to vigorous PA \citereview{Basset_2012}.
Another key aspect of calibration studies is the statistical approach utilized. To translate the accelerometer output into an outcome variable (e.g., estimates of EE or GRF), a usual method is to develop a regression model, mostly a linear regression \citereview{Montoye_2017}. But, as the vast majority of calibration studies use multiple data points for each individual, they violate the linear regression assumption of independence \citereview{Welk_2005, Field_2012}. One way to resolve this issue is to apply the linear mixed model approach, which allow the repeated data to be modeled in the analysis \citereview{Field_2012}. Also, mixed models have the benefit of permitting quadratic and cubic polynomial simulations to be tested \citereview{Field_2012}.
The advantages provided by the application of mixed models have made a significant contribution to the calibration studies, but nowadays more advanced methods are gaining popularity, such as machine-learning techniques \citereview{Montoye_2017, Troiano_2014}. These techniques have the ability to model not just the accelerometer output, but to use statistical summaries of the data in time and frequency domains to describe more thoroughly the acceleration pattern \citereview{Staudenmayer_2015, Farrahi_2019}. Thus, machine-learning techniques have the potential to increase accelerometers prediction accuracy, mainly for sedentary and non-locomotor activities, where regression-based models show not to work well \citereview{Montoye_2017}. However, if both machine-learning and regression models can achieve similar accuracy, the regression models should be preferred, as they are simpler to apply and interpret \citereview{Montoye_2017}.
One of the main goals of accelerometer calibration studies is to identify PA intensity levels, which are usually classified according to the metabolic equivalent (MET) based on EE as determined by direct or indirect calorimetry. A MET value of 1 is equivalent to the resting metabolic rate, and PA intensities are classified as follows: MET $\leq$ 1.5 {\textemdash} sedentary activity (SA); MET 1.6 to 2.9 {\textemdash} light PA (LPA); MET 3.0 to 5.9 {\textemdash} moderate PA (MPA); and MET $\geq$ 6.0 {\textemdash} vigorous PA (VPA) \citereview{Piercy_2018}. A common strategy to classify PA intensity by accelerometry derived data is to develop a regression model with the MET as the dependent variable and calculate the amount of accelerometer output required to attain each of the thresholds \citereview{Jago_2007}. However, an alternate method to achieve this result is by the use of a receiver operating characteristic (ROC) curve \citereview{Welk_2005, Jago_2007}.
A ROC curve is a graphical representation of the sensitivity [true positives/(true positives + false negatives)] and specificity [true negatives/(true negatives + false positives)] of different cut-points \citereview{Welk_2005, Jago_2007}, plotting the sensitivity on the y-axis and the 1 - specificity on the x-axis. The top-left corner coordinates (0, 1) are considered the perfect classification \citereview{Welk_2005, Jago_2007}. A good ROC curve would be the one with values rising steeply on the y-axis approaching the top-left corner. This curve indicates that the method being tested has a high sensitivity and a low false-positive rate, showing, therefore, favorable discrimination properties \citereview{Welk_2005}.
Finally, the accelerometer calibration results must have its performance evaluated \citereview{Basset_2012}. This assessment should ideally be conducted using another sample from the target population, however, as the process to recruit, assess and analyze data from another sample could be costly, a common approach is to use a split-sample cross-validation method \citereview{Staudenmayer_2012}. One strategy would be to divide the study sample in two parts, one for calibration and another for cross-validation. This, however, could be a problem when dealing with small sample sizes \citereview{Staudenmayer_2012}. A procedure to overcome this problem is the leave-one-out cross-validation (LOOCV) method, in which one participant's data is separated in a testing dataset, with the remaining participants in the training dataset \citereview{Staudenmayer_2012}. This procedure is repeated until each participant is used in the testing dataset.
\section*{Energy expenditure prediction and physical activity intensity classification}
\addcontentsline{toc}{subsection}{Energy expenditure prediction and physical activity intensity classification}
The most frequent use of accelerometers, both in research and by the general population as wearable devices, is to estimate the amount of energy spent throughout the day or during PA and to quantify the time spent in each of the PA intensity categories, as this is related with several health outcomes \citereview{Fuzeki_2017, Adelnia_2019, Menai_2017}. Since the first studies that employed these devices, there have been attempts to translate their output into EE measures \citereview{Wong_1981, Montoye_1983}. These studies have evolved over time, as technology advances and new procedures and statistical methods are applied, but their general objective remains the same, which is to increase the accuracy and detail of accelerometer estimates.
Freedson et al. \citeyearreview{Freedson_1998} conceived the first linear regression model to predict EE, in kilocalories (kcal), from hip-worn uniaxial accelerometers AC in normal-weight young adults. The study protocol consisted of three treadmill activities with speeds ranging from slow walking (4.8 km\textsuperscript{.}h\textsuperscript{-1}) to jogging (9.7 km\textsuperscript{.}h\textsuperscript{-1}) and the criterion measure utilized was indirect calorimetry. The linear regression was developed with AC and body mass (in kg) as predictors and was shown to strongly explain the variation in EE (R\textsuperscript{2} = 0.82). The accelerometer was positioned close to the body center of mass in these studies based on the principle of linear relationship between vertical acceleration and EE during locomotion. Nevertheless, this principle does not hold true at higher running speeds and at non-locomotor activities \citereview{Lyden_2012}.
Swartz et al. \citeyearreview{Swartz_2000} were among the first researchers to include lifestyle activities in their linear regression model of EE estimation. Although the inclusion of free-living activities to the protocol addressed the issue of their underestimation observed on the Freedson model \citeyearreview{Freedson_1998}, a study comparing several regression equations \citereview{Lyden_2012} showed that this improvement occurred at the expense of overestimating low-intensity activities. This owes to the fact that a single regression equation cannot accurately describe both locomotor and free-living activities, as they present different slopes \citereview{Crouter_2006}. Therefore, novel methods needed to be developed to settle this issue.
To overcome the limitations of single regression models, Crouter et al \citeyearreview{Crouter_2006} created a two-regression method. Their study utilized a uniaxial accelerometer positioned at the right hip and included walking and running at several speeds along with lifestyle and sporting activities. To distinguish between locomotor and other activities, an algorithm based on the AC coefficient of variation was conceived. If the coefficient of variation per 10 seconds was less than or equal to 10, an exponential curve would be applied (R\textsuperscript{2} = 0.70) and locomotor activities would be assumed. If the coefficient of variation was greater than 10, a cubic curve would be applied (R\textsuperscript{2} = 0.85) and free-living activities would be assumed. This new approach was able to successfully increase EE prediction accuracy compared to previous studies and was also refined by the same group afterwards \citereview{Crouter_2010}.
All studies mentioned earlier were validated in normal-weight individuals. However, the calibration study sample needs to be representative of the target population \citereview{Welk_2005, Strath_2012} and there is a lack of accelerometer calibration studies in obese people. This population would perhaps be the one that would benefit the most with information regarding PA related EE for the correct management of weight loss programs. To address this issue, Aadland and Anderssen \citeyearreview{Aadland_2012} conducted a calibration study with young to middle-aged patients with different degrees of obesity severity (BMI from 30 to 50 kg\textsuperscript{.}m\textsuperscript{-2}). A hip-worn uniaxial accelerometer was used while subjects walked on a treadmill at speeds from 2 to 6 km\textsuperscript{.}h\textsuperscript{-1}, with increments of 1 km\textsuperscript{.}h\textsuperscript{-1}. To define MPA and VPA cut-points, based on 3 and 6 MET, respectively, three different statistical methods, suggested by Welk \citeyearreview{Welk_2005}, were tested: linear regression, linear mixed model and ROC curves. Although the cut-points defined by each of these methods deviated substantially from each other, most of them were remarkably lower than what was found on previous studies, suggesting the need to apply specific cut-points for this population.
With technological advances, acquisition and storage of large amounts of raw acceleration data have become possible. As a consequence, new acceleration metrics based on the raw signals, instead of AC, have been developed in the past few years. A study by van Hees et al \citeyearreview{vanHees_2013} evaluated the performance of five distinct metrics to separate the movement and gravity components in the acceleration signal with robot and human experiments. Among these metrics, the ENMO had an overall strong performance in the different experiments and was able to explain 34\% of the variance in daily EE in a sample of 63 women. In later research, several regression equations were developed using the ENMO metric in children and adult samples performing locomotor and free-living activities \citereview{Hildebrand_2014}. During the protocol, two different accelerometer devices were used at hip and wrist placements. All of the regression equations presented an R\textsuperscript{2} greater than 0.70.
Another study devised for the development of a new raw acceleration metric was made by V{\"a}h{\"a}-Ypy{\"a} et al \citeyearreview{Vaha-Ypya_2015}. Various time- and frequency-domain features were tested and the MAD, a time-domain feature which describes the typical distance of data points around the mean, performed best in the ROC analysis. This metric was posteriorly validated in a research \citereview{Vaha-Ypya_2015b} whose protocol consisted in walking and running on an indoor track while wearing accelerometers at the hip. A gamma regression model was used to estimate EE (r = 0.98) and cut-points for MPA and VPA were created with good accuracy (area under the curve - AUC - of 0.97 and 0.99, respectively).
Bai et al. \citeyearreview{Bai_2016} developed the AI, another metric based on raw acceleration data. This metric removes the device systematic noise and then captures its acceleration variability. In this study, the accelerometer was positioned at the right hip, and subjects performed sedentary, locomotor and lifestyle activities. The AI ability to predict MET was compared against other metrics. AI showed an R\textsuperscript{2} of 0.72, greater than what was shown by both AC and ENMO (0.54 and 0.62, respectively). Also, in the ROC analysis, AI was shown to perform better than the other metrics, specially at sedentary and light activities.
Although many advances were accomplished in the past few years, future directions should include an increase in collaboration between researchers from distinct fields to enhance the development and application of improved analytical methods \citereview{Mendes_2018, Troiano_2014}. Also, the standardization of the accelerometer metric used is necessary and would greatly increase comparability among different estimates \citereview{Mendes_2018}. Finally, future calibration studies should aim for more heterogeneous samples for a better generalization of their results \citereview{Mendes_2018}.
\section*{Ground reaction force prediction}
\addcontentsline{toc}{subsection}{Ground reaction force prediction}
Due to their higher accuracy, force plates are considered the gold standard method for GRF measurement. Nevertheless, they are expensive devices and, due to the nature of the equipment, their use is limited to laboratory conditions, and expert technicians are needed to calibrate, collect and analyze data \citereview{Medved_2000}. Since the assessment of GRF in field conditions is necessary to ascertain the effects of daily life tasks-induced mechanical loading in bone mass and musculoskeletal injury risk \citereview{Turner_2003, Marques_2012, Martyn-StJames_2010}, several strategies have been developed to enable this measurement \citereview{Liu_2010, Koch_2016}, particularly by the use of accelerometers \citereview{Fortune_2014, Neugebauer_2012, Neugebauer_2014, Neugebauer_2018}.
Janz et al. \citeyearreview{Janz_2003} made one of the first attempts to investigate the relationship between AC and GRF. In their study, 40 children, from 6 to 11 years old, wearing uniaxial accelerometers at the right hip performed a protocol consisting of treadmill walking and running, and jumping. Although significant correlations were found between AC and peak GRF during the locomotor activities, these were only weak to moderate (\textit{r} = 0.33 for walking at 5.6 km\textsuperscript{.}h\textsuperscript{-1} and \textit{r} = 0.66 for running at 8.0 km\textsuperscript{.}h\textsuperscript{-1}). No significant correlations were found between AC and peak GRF during jumping. Similar weak associations have also been found between AC and average GRF in a posterior study \citereview{Garcia_2004}.
More recent studies have used raw acceleration instead of AC and managed to achieve better results. Rowlands and Stiles \citeyearreview{Rowlands_2012} tested the correlation between peak and average GRF and raw acceleration output of hip- and wrist-worn accelerometers during walking, running and jumping. Strong and significant correlations were found for average GRF on both accelerometer placements (\textit{r} ranging from 0.82 to 0.87). Fortune et al. \citeyearreview{Fortune_2014}, using accelerometers placed at the ankle, tibia, thigh, and waist during walking, were able to show a moderate to strong relation between peak vertical acceleration and peak vertical GRF, for all placements, with ankle and waist yielding the best results (R\textsuperscript{2} of 0.75 and 0.72, respectively). Also, Neugebauer et al. \citeyearreview{Neugebauer_2014} developed an equation using linear mixed models to estimate peak vertical GRF from the vertical acceleration, the subjects mass and the type of locomotion (walking or running). However, their equation presented a bias of -50 N (130.4 N, standard deviation), suggesting that the model consistently underestimated the peak vertical GRF as compared with the reference values measured by the force plates.
The successful use of accelerometers to predict GRF allows researchers to quantify the amount of mechanical loading during daily PA, and to estimate the minimum loading needed to induce beneficial bone adaptations. Vainionp{\"{a}}{\"{a}} et al. \citeyearreview{Vainionpaa_2006} conducted a prospective intervention study to evaluate the relationship between daily PA, assessed by accelerometers, and bone mineral density (BMD) in premenopausal women. Their results show that peak accelerations above 3.9 \textit{g} significantly correlated with 12 months changes on BMD at the femoral neck, trochanter, and Ward's triangle measured by dual-energy x–ray absorptiometry (DXA). BMD changes at the lumbar vertebra L1 correlated with peak accelerations above 5.4 \textit{g}.
There are other important biomechanical variables related to the osteogenic potential of load-bearing mechanical stimulation other than the GRF. Thus, Stiles et al. \citeyearreview{Stiles_2013} tried to determine the peak acceleration cut-point that would relate to a loading rate of 43 body weights per second (BW\textsuperscript{.}s\textsuperscript{-1}), as this threshold has been considered to be beneficial to bone health \citereview{Bassey_1998}. ROC curves were used to determine the thresholds for vertical and resultant peak acceleration from hip-worn accelerometers and resultant peak acceleration from wrist-worn accelerometers. The selected cut-points presented an AUC ranging from 0.92 to 0.97, sensitivity from 92.3\% to 98.2\%, and specificity from 83.0\% to 93.3\% showing a good discrimination ability.
In a recent study, Stiles et al. \citeyearreview{Stiles_2017} attempted to associate accelerometer-assessed PA parameters with bone health outcomes based on data from a large (n = 2534) population survey, the UK Biobank. Raw accelerations recorded by wrist-worn accelerometers and expressed as ENMO in milli-gravitational units (\textit{mg}) were associated with the BMD T-score derived from a quantitative ultrasound scanning (QUS) at the calcaneus. Results showed that, for premenopausal women, spending small amounts (1\textendash 2 minutes) of PA at intensities $\geq$ 1000 \textit{mg} is related to higher BMD T-scores, while postmenopausal women presented a lower intensity threshold of 750 mg.
Several studies have shown that objectively measured accelerations acquired by activity monitors can reliably reflect mechanical loading \citereview{Stiles_2013, Neugebauer_2014, Fortune_2014} and can be related to bone health outcomes such as BMD \citereview{Vainionpaa_2006, Stiles_2017}. Until now, most studies have used uniquely acceleration values in association with bone health. Nevertheless, an important limitation of this approach is that the use of the acceleration of a body segment does not represent mechanical loading and bone strain, which are necessary stimuli for the bone anabolism \citereview{Kohrt_2004}. Therefore, future directions should include the use a prediction model that translates the accelerometer output into GRF or another indicator of mechanical loading, and then establish threshold values for PA parameters (such as intensity, frequency, and duration) related to bone health. Also, the establishment of these thresholds could only be population-specific, as differences in age, sex, body mass, and menopausal status have implications in the bone responsiveness to mechanical loading and, consequently, in the minimal amount of mechanical strain to elicit a positive bone anabolic response \citereview{Stiles_2017, Deere_2016}.
\section*{Conclusion}
\addcontentsline{toc}{subsection}{Conclusion}
Accelerometers are wearable devices that detect the movement acceleration of a body segment. They have proven to be objective and reliable tools for monitoring daily life PA, providing objective data regarding the intensity, frequency, and duration of it, and have been successfully used to associate PA behaviors and important health outcomes. Nevertheless, the accelerometers output needs to be translated into biologically meaningful information through a calibration process against a gold standard criterion measure. Currently, the main uses of accelerometers are related to the estimation and determination of cardio-metabolic parameters, such as EE and PAI levels, and, to a lesser extent, biomechanical variables as GRF. Over time, with methodological and technological advances, the accelerometers calibration has evolved, using new study designs and statistical techniques, which allowed the achievement of better prediction accuracy and validity. Future studies should include the collaboration of researchers from different areas, to contribute to advances in data acquisition, storage, computing and transmission of the growing volumes of raw acceleration signals.
\pagebreak
\renewcommand{\refnamereview}{\large References}
\vspace{0.5em}
\bibliographyreview{bibliography}
\bibliographystylereview{fadeup}
\blankpage
\section*{\vfill\raggedleft\bfseries 3. Original studies}
\addcontentsline{toc}{section}{3. Original studies}
\thispagestyle{empty}
\blankpage
\section*{\vfill\raggedleft\bfseries Study 1}
\noindent \textbf{Accelerometry calibration in people with class II-III obesity: Energy expenditure prediction and physical activity intensity identification}
\addcontentsline{toc}{subsection}{3.1. Study 1 - Accelerometry calibration in people with class II-III obesity: Energy expenditure prediction and physical activity intensity identification}
\bigskip
\noindent Florêncio Diniz-Sousa, Lucas Veras, José Carlos Ribeiro, Giorjines Boppre, Vítor Devezas, Hugo Santos-Sousa, John Preto, Leandro Machado, João Paulo Vilas-Boas, José Oliveira, Hélder Fonseca
\bigskip
\noindent Published in \textbf{Gait \& Posture}
\thispagestyle{empty}
\blankpage
\includepdf[pages=-, pagecommand={}]{original_studies/Study_1.pdf}
\pagebreak
\section*{\vfill\raggedleft\bfseries Study 2}
\noindent \textbf{Accelerometer-based prediction of skeletal mechanical loading during walking in normal weight to severely obese subjects}
\addcontentsline{toc}{subsection}{3.2. Study 2 - Accelerometer-based prediction of skeletal mechanical loading during walking in normal weight to severely obese subjects}
\bigskip
\noindent Lucas Veras, Florêncio Diniz-Sousa, Giorjines Boppre, Vítor Devezas, Hugo Santos-Sousa, John Preto, Leandro Machado, João Paulo Vilas-Boas, José Oliveira, Hélder Fonseca
\bigskip
\noindent Published in \textbf{Osteoporosis International}
\thispagestyle{empty}
\blankpage
\includepdf[pages=-, pagecommand={}]{original_studies/Study_2.pdf}
\pagebreak
\section*{\vfill\raggedleft\bfseries 4. Conclusion and future perspectives}
\addcontentsline{toc}{section}{4. Conclusion and future perspectives}
\thispagestyle{empty}
\blankpage
\section*{Conclusion and future perspectives}
Through the literature review we could see that the accelerometers are suitable devices for monitoring several PA parameters during daily life, as they are able to continuously collect and store relevant data for long periods with a low subject burden. Furthermore, we have seen that the accelerometers output needs to be translated into more biologically meaningful information by a calibration process, and that, currently, most calibration studies use accelerometry data mostly to predict cardio-metabolic-related outcomes, such as time spent in sedentary behaviour and in different PAI categories. However, over the past few years, calibration studies aiming to use accelerometers to predict biomechanical variables, such as the GRF, have also been performed.
The first original study included in this dissertation addressed the problem of accelerometers calibration to predict EE and classify PAI in patients with severe obesity. Our results showed that hip and lower back accelerometer data allowed to accurately predict EE and correctly classify SA and PAI during walking in this particular population. Both AC and the metrics MAD and ENMO, which are based on raw data, can be used to obtain accurate predictions, as they were all explored in this work and showed similar results. The findings of this study will enable researchers to adopt regression equations and cut-points specifically developed for patients with class II-III obesity, rather than those built for non-obese people, obtaining, then, valid and more accurate results.
The second original study focused on the calibration of accelerometers to predict pGRF. It was observed that both the resultant and its vertical component of the pGRF could be accurately predicted through raw accelerometer data during walking in normal weight to severely obese patients, using accelerometers placed at the ankle, lower back and hip. These results allow to easily obtain reliable pGRF data in clinical conditions, enabling to accurately prescribe exercise and monitor the mechanical loading in patients with increased fracture risk.
As these studies were performed in controlled laboratory conditions, future studies in this field should aim at expanding the prediction of cardio-metabolic and biomechanical variables to activities other than walking, and to consider the use of free-living activities in the calibration process, which would enhance the external validity comparing to laboratory-based calibration. Also, with the ability to accurately predict mechanical loading in clinical conditions, future studies should attempt to determine the relationships between predicted GRF and bone health outcomes, such as changes in BMD and biochemical markers of bone turnover. This would allow to establish the dose-response relationship between exercise and bone health and to provide mechanical loading intensity thresholds for a given outcome.
\end{document} | {
"alphanum_fraction": 0.8161583553,
"avg_line_length": 110.0093457944,
"ext": "tex",
"hexsha": "6dd88bf6cec37e01a77c52c1feb8e1c0f18446d1",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "7543024efd959189fe63548ee86029e3bdfd3ca9",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "verasls/MSc_dissertation",
"max_forks_repo_path": "dissertation.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7543024efd959189fe63548ee86029e3bdfd3ca9",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "verasls/MSc_dissertation",
"max_issues_repo_path": "dissertation.tex",
"max_line_length": 2014,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "7543024efd959189fe63548ee86029e3bdfd3ca9",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "verasls/MSc_dissertation",
"max_stars_repo_path": "dissertation.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 13941,
"size": 58855
} |
\chapter{Introduction}
The study of homotopy theoretic phenomena in the language of type theory \cite{hottbook} is
sometimes loosely called `synthetic homotopy theory' \cite{Brunerie16}.
Homotopy theory in type theory \cite{Awodey12} is only one of the
many aspects of homotopy type theory, which also includes the study of the
set theoretic semantics (models of homotopy type theory and univalence in a
meta-theory of sets or categories \cite{Awodey14,AwodeyWarren,BezemCoquandHuber,KapulkinLeFanuLumsdaine,Shulman15,Voevodsky15}), type theoretic semantics (internal models of homotopy type
theory), and computational semantics \cite{AngiuliHarperWilson}, as well as the study of various questions
in the internal language of homotopy type theory which are not necessarily
motivated by homotopy theory, or questions related to the development of
formalized libraries of mathematics based on homotopy type theory.
This thesis concerns the development of synthetic homotopy theory.
Homotopy type theory is based on Martin-L\"of's theory of dependent types \cite{MartinLof1984}, which
was developed during the 1970's and 1980's.
The novel additions of homotopy type theory are Voevodsky's univalence axiom \cite{Voevodsky06,Voevodsky10},
and higher inductive types \cite{Lumsdaine11Blog,Shulman11Blog,hottbook}. The univalence axiom characterizes the identity
type on the universe, and establishes the universe as an object classifier \cite{RijkeSpitters}.
Higher inductive types are a generalization of inductive types, in which both
point constructors (generators) and path constructors (relations) may be specified.
A simple class of higher inductive types, which includes most known higher inductive
types, are the homotopy pushouts. When the universe is assumed to be closed
under homotopy pushouts, it is also closed under homotopy coequalizers \cite{hottbook},
sequential colimits \cite{hottbook}, and propositional truncation \cite{vanDoorn2016}.
For instance, one way of obtaining the $n$-spheres \cite{Lumsdaine12Blog} using homotopy pushouts is by setting $\sphere{-1}\defeq\emptyt$ and
by inductively defining the $(n+1)$-sphere $\sphere{n+1}$ to be the pushout
of the span $\unit \leftarrow\sphere{n}\rightarrow\unit$.
Then we can attach $(n+1)$-cells to a type $X$.
Let $f:(\sm{a:A}B(a))\to X$ be a family of attaching maps
for some $\sphere{n}$-bundle $B:A\to\mathrm{BAut}(\sphere{n})$, where $\mathrm{BAut}(\sphere{n})$ is the type $\sm{X:\UU}\brck{\eqv{\sphere{n}}{X}}$ of types merely equivalent to the $n$-sphere. We
attach the $(n+1)$-disks indexed by $A$ to $X$ by taking the homotopy pushout
\begin{equation*}
\begin{tikzcd}
\sm{a:A}B(a) \arrow[r,"f"] \arrow[d,swap,"\pi_1"] & X \arrow[d,"\inr"] \\
A \arrow[r,swap,"\inl"] & P. \arrow[ul,phantom,very near start,"\ulcorner"]
\end{tikzcd}
\end{equation*}
In this thesis we study dependent type theory with univalent universes that are closed under homotopy pushouts, further developing the program set out in \cite{hottbook} on synthetic homotopy theory. We will assume in this dissertation that every type family is classified by a univalent universe, and that all universes are closed under homotopy pushouts, as well as under the usual type constructors including identity types, $\Pi$- and $\Sigma$-types, and a natural numbers object. The model in cubical sets by Coquand et al. \cite{BezemCoquandHuber} is a constructive model for this setup, although the fact that it is closed under homotopy pushouts is currently unpublished. Furthermore, we will exclusively work with objects that can be described either as (dependent) types, or as their terms. In other words, the objects of our study are all `formalizable' in the sense that they can be encoded in computer implementations of our setup of dependent type theory. Existing implementations of dependent type theory, supporting univalent universes and homotopy pushouts, with libraries developing synthetic homotopy theory, include the proof assistants Agda \cite{agda}, Coq \cite{Coq,hcoq}, and Lean \cite{vDvRB2017HoTTLean}, and parts of the material in this theses are formalized in each of them.
%One of the most persisting open problems of synthetic homotopy theory is the problem of defining the type of simplicial objects, or even the type of semi-simplicial objects. Related open problems include the specifications of the types of weak $\infty$-categories, and weak $\infty$-groupoids. In all these problems, the task is to find a way of specifying in type theory the infinite coherence data that these objects come equipped with. Because of this problem, we have currently no way of exhibiting the universe of all small types, and functions between them, as a term in the type of weak $\infty$-categories; there is no way of presenting the suspension operation as a functor, beyond specifying its action on objects, on morphisms, and the composition laws for low dimensions; and there is no way of making precise the suspension-loop space adjunction beyond establishing the universal property of the adjunction. In other words, there are many examples of `categories', `functors', `natural transformations', and `adjunction' that we know \emph{ought to be} adjunctions, but we have no way (yet) of establishing them as such in a formalizable way, i.e.~by exhibiting them as a term of the types of categories, functors, natural transformations, or adjunctions, etc. This is an important limitation of synthetic homotopy theory that we currently have to deal with.
\section{Overview per chapter}
In \cref{chap:univalent} we will first establish notation, although we will mostly follow the notation from \cite{hottbook}\footnote{A difference of practice between \cite{hottbook} and this thesis is that \cite{hottbook} doesn't use the label `Proposition' for any results at all, whereas we use propositions for statements that might be of independent interest, but are not our main theorem. In this thesis, the label `Theorem' is reserved for the main results that were originally established in my thesis research, and is therefore used much more sparingly.}. Furthermore, we recall some of the most basic facts of homotopy type theory, and then we will show that the univalence axiom establishes any universe as an object classifier.
In \cref{chap:descent} we will first recall the most basic properties of homotopy pushouts, and then we will proceed to prove the descent property for pushouts, using the univalence axiom. Note that the coherence problem of type theory plays a role in this chapter: we would much rather have shown that the descent property holds for any homotopy colimit, but this task requires the definition of an internal $\infty$-category. Some solace will be offered in \cref{chap:equifibrant}, where we will prove a descent property for any modality.
In \cref{chap:rcoeq} we will study reflexive graphs and, most importantly, reflexive coequalizers in type theory. We take interest in reflexive graphs, because the topos of reflexive graphs (over sets) is cohesive over the topos of sets. The left-most adjunction is the reflexive coequalizer which is left adjoint to the discrete functor. We will construct the reflexive coequalizer as a pushout, so it exists under our assumptions, and we know in some cases how to compute them into previously known operations. Here we run again into the limitation of homotopy type theory, because we cannot establish the type of reflexive graphs as the type of objects of an $\infty$-category, and neither can we establish the reflexive coequalizer as an $\infty$-functor. However, to state and prove that the reflexive coequalizer satisfies the universal property of the left adjoint of the discrete functor, we only need composition of reflexive graph morphisms, and the action on morphisms of the operation equipping a type with the structure of a discrete graph. The universal property is indeed sufficient for many purposes. We then introduce the notion of fibrations for reflexive graphs, and show that the fibrations are right orthogonal to the same maps as the discrete reflexive graphs: morphisms between representables. It follows that a morphism is a fibration if and only if it is cartesian. Then we proceed to prove the descent property of reflexive coequalizers. We also note that diagrams over reflexive graphs are just left fibrations of reflexive graphs, so we also obtain a descent theorem for diagrams over graphs. Of particular interest in the present work is the descent property for sequential colimits. The contents of this chapter are joint work with Bas Spitters.
In \cref{chap:image} we will show that any function factors as a surjective function followed by an embedding, even though we only assume that the universe is closed under pushouts and the basic type constructors. Of course, it is of essential importance here that the universe contains a natural numbers object. Our construction of the image of a map proceeds by iteratively taking the fiberwise join of a map with itself, so we call it the join construction. It follows from our construction that the image of a map from an essentially small type into a locally small type (notions that are explained in \cref{chap:univalent}), is again essentially small. The join construction can be used to construct the quotient of a type by a $\prop$-valued equivalence relation (i.e.~an equivalence relation in the usual sense), and it can be used to construct the Rezk completion of a pre-category. The construction of set-quotients includes the construction of the set truncation, and the construction of the Rezk completion includes the construction of the $1$-truncation, and of Eilenberg-Mac Lane spaces of the form $K(G,1)$ \cite{FinsterLicata}. Following \cite{FinsterLicata}, the Eilenberg Mac-Lane spaces $K(G,n)$ for $G$ abelian and $n\geq 2$ can be constructed once we have constructed the $k$-truncation for any $k\geq -2$. We note that Eilenberg-Mac Lane spaces are important classifying spaces in higher group theory, and so are the connected components of the universe (which we show to be essentially small).
In \cref{chap:reflective} we consider general reflective subuniverses. Examples that we have at our disposal at this point are the $(-2)$-, $(-1)$-, $0$-, and $1$-truncations. Most examples of reflective subuniverses are obtained by localization at a family of maps. However, since the only assumed homotopy colimits are pushouts, we will construct localizations only in \cref{chap:compact}, and only of families between compact types, because we need more theory in order to establish the necessary basic results. Thus, in \cref{chap:reflective} we focus on general reflective subuniverses. We show that for any reflective subuniverse $L$, the subuniverse $L'$ of $L$-separated types (i.e.~types whose identity types are $L$-types) is again reflective. It follows at once that the subuniverse of $k$-truncated types is reflective, for any $k\geq -2$. Furthermore, we will study several classes of maps related to a reflective subuniverse. First of all, we study the $L$-equivalences, i.e.~the maps that become an equivalence by the functorial action of $L$, and second of all we study the $L$-connected maps, i.e.~ the maps with fibers that become trivial after applying $L$. Clearly, any $L$-connected map is also an $L$-equivalence, but the converse is one of the many characterizations of $L$ being lex given in \cite{RijkeShulmanSpitters}.
Furthermore, we study modalities. One of the characterizations of modalities is as reflective subuniverses that are $\Sigma$-closed, but we provide three more equivalent definitions of modalities. One particularly important alternative definition is that of a stable orthogonal factorization system, i.e.~a pair $(\mathcal{L},\mathcal{R})$ of two classes of maps such that every map factors as an $\mathcal{L}$-map followed by a $\mathcal{R}$-map; the class $\mathcal{L}$ is left orthogonal to the class $\mathcal{R}$; and the pullback of an $\mathcal{L}$-map is again a $\mathcal{L}$-map. For any modality $\modal$, the stable orthogonal factorization system associated to it consists of the $\modal$-connected maps as the $\mathcal{L}$-maps, and the $\modal$-modal maps as the $\mathcal{R}$-maps. A final topic for this chapter is the notion of accessibility for reflective subuniverses and accessible modalities.
The contents from this chapter are selected from \cite{RijkeShulmanSpitters} and \cite{ChristensenOpieRijkeScoccola}. I began to study reflective subuniverses with Mike Shulman and Bas Spitters, and continued to study them with my MRC teammates Morgan Opie and Luis Scoccola, under the lead of Dan Christensen.
In \cref{chap:equifibrant} we recall from \cite{WellenPhD} the notion of $\modal$-\'etale map for an arbitrary modality $\modal$. We prove a modal version of the descent theorem, which asserts that a maps into $\modal X$ from a $\modal$-modal type are equivalently described as \'etale maps into $X$. The $\modal$-\'etale maps form the right class of a second orthogonal factorization system associated to any modality: the \emph{reflective} factorization system. The left class of this factorization system is the class of $\modal$-equivalences. Using this factorization system we obtain that the universal cover of a type $X$ at a point $x_0$ is the left-right-factorization of the map $\unit\to X$.
We then proceed to study the \'etale maps for the modality of discrete reflexive graphs. Note that the type of all reflexive graphs isn't exactly a universe, so it is not possible to directly apply our previous observations about $\modal$-\'etale maps. Nevertheless, most arguments are practically the same. Thus, we treat our section on $\modal$-\'etale maps as a blue-print for our section of $\Delta$-\'etale maps, and do most arguments a second time. Such is the current state of homotopy type theory. What we get out is a generalized flattening lemma, which states that for any morphism $f:\mathcal{B}\to\mathcal{A}$ factors uniquely as an $\Delta$-equivalence followed by a fibration of graphs. We use this to show that the loop space of the suspension of a pointed type $X$ is the free H-space $G$ with a base-point preserving map $X\to_\ast G$. The generalized flattening lemma also applies to diagrams over reflexive graphs, and in particular to sequential colimits. Moreover, the equifibrant replacement can be constructed by a telescope construction. We show in this chapter that sequential colimits commute with $\Sigma$- and identity types, and therefore also with pullbacks. In particular, the sequential colimit operation sends sequences of fiber sequences to fiber sequences. Moreover, we show that sequential colimits commute with $k$-truncation for all $k\geq -2$, from which it follows that sequential colimits commute with $\pi_k$ for any $k\geq 0$. We expect to be able to use these results also in showing that the spectrification of a pre-spectrum is indeed a spectrum, but we haven't done that yet.
The idea of a modal version of the descent theorem first arose in unpublished work on reflexive graphs with Bas Spitters, in the spring of 2016. However, I only learned about $\modal$-\'etale maps much later from Felix Wellen, and many of the results presented in \cref{sec:modal_descent} came out of a discussion I had with Felix Wellen and Mike Shulman, who also brought my attention to the reflective factorization system of a modality, of which the classical case is due to \cite{chk:reflocfact}.
The material in \cref{sec:equifibrant_replacement} on the equifibrant replacement operation on reflexive graphs is joint work with Bas Spitters.
The material in \cref{sec:seqcolim_eqf} on sequential colimits is joint work with Floris van Doorn and Kristina Sojakova \cite{DoornRijkeSojakova}, and all the results concerning sequential colimits are formalized in the proof assistant Lean.
In \cref{chap:compact} we introduce the notion of (sequentially) compact types, in order to provide an application for the results in \cref{chap:equifibrant}. The most important basic result about compact types is that they are closed under pushouts, and in proving this fact we use that sequential colimits commute with pullbacks.
Our main purpose here, and the final main result of this dissertation, is to show that for any family $f$ of maps between compact types, the subuniverse of $f$-local types is reflective, thus providing a fairly large class of reflective subuniverses including types localized away from a prime \cite{ChristensenOpieRijkeScoccola}. It should be noted that all subuniverses of $f$-local types are reflective if enough higher inductive types are assumed. Furthermore, our result about $\omega$-compact types should in principle hold for $\kappa$-compact types for cardinals larger than $\omega$. However, we restrict to the case of $\omega$-compact types since we do not have a good theory of such larger cardinals available in homotopy type theory, while the natural numbers object is right there (by assumption).
\section{Acknowledgments\footnote{I gratefully acknowledge the support of the Air Force Office of Scientific Research through MURI grant FA9550-15-1-0053.}}
First and foremost, it is my pleasure to thank my advisor, professor Steve Awodey. I could not have done this PhD without his advice, support, and inspiration. I cherish the many pleasant discussions we had: over the blackboard, between us, with our many visitors, while visiting other places, or over a beer somewhere in Pittsburgh. I am very grateful for the guidance you offered in selecting a worthwhile research topic, and I feel honored to have had the privilege to work with you.
Then I would like to express my gratitude to the members of my committee: Jeremy Avigad for transmitting his enthusiasm for interactive theorem proving, and for his wisdom and unparalleled kindness; Ulrik Buchholz for his unabated energy to make large formalization projects possible, introducing me to many concepts of algebraic topology along the way; and Michael Shulman for shining a light on many beautiful subjects related to higher category theory, that would otherwise have remained obscure for me.
I would like to thank my other collaborators, the people I had projects with:
Simon Boulier, Dan Christensen, Floris van Doorn, Jonas Frey, Morgan Opie, Luis Scoccola, Kristina Sojakova, Bas Spitters, Nicolas Tabareau, Felix Wellen, and Alexandra Yarosh. I thank you for all your inspiration, insights, energy, and creativity.
I would also like to thank all the people who have generously invited me for a visit. I am deeply indebted to Joachim Kock, who has hosted me for half a year in 2013-2014 at the \textit{Departament de Matemàtiques} of the Universitat Autònoma de Barcelona and helped me finding my PhD position at CMU; I am grateful to Vladimir Voevodsky for inviting me to the Institute for Advanced Study in March 2015; Nicolas Tabareau and his students Kevin Quirin and Simon Boulier for hosting me at INRIA Nantes during the summers of 2015 and 2016; Andrej Bauer for hosting me at the \textit{Fakulteta za Matematiko in Fiziko} of the University of Ljubljana in January 2016; Lars Birkedal and Bas Spitters for hosting me at the Department of Computer Science of Aarhus University in February 2016; Marie-Françoise Roy for inviting me to speak in the Effective Geometry and Algebra seminar at the \textit{Institut de Recherche Mathématiques de Rennes} in June 2016; Dan Christensen and his student Luis Scoccola for hosting me at the University of Western Ontario in London, Ontario in October 2017; Guillaume Brunerie for hosting me at the Institute for Advanced Study in November 2017; Charles Rezk and his student Nima Rasekh for inviting me to speak in the Topology Seminar at the University of Illinois at Urbana-Champaign in December 2017; Tom Hales for inviting me to speak at the Algebra, Combinatorics, and Geometry seminar at the University of Pittsburgh in April 2018; and Pieter Hofstra for inviting me to speak for the Canadian Mathematical Society in Fredericton, New Brunswick, in June 2018. Tak, dankjewel, thank you, merci, danke sch\"on, spasibo, \v dankujem, hvala, gracias.
I would like to thank Karin Arnds for lending me her cabin along the Allegheny River, where I wrote and rewrote significant parts of this dissertation.
Finally, I thank my dear parents Mieke and Reinier for their unconditional support, and my siblings Jeroen, Sophie, and Fleur, whom I didn't get to see as much as I would have liked because I chose to study overseas. I miss you and I dedicate this thesis to you.\\[2em]
\noindent \hfill Pittsburgh, \today
| {
"alphanum_fraction": 0.7966257372,
"avg_line_length": 252.2682926829,
"ext": "tex",
"hexsha": "be603cb7c85e761856dd0cfdd0fafcfbf1b42eee",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f2c087ba8983205d3dd336bbc194be5b7218c2c5",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "EgbertRijke/dissertation",
"max_forks_repo_path": "intro.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f2c087ba8983205d3dd336bbc194be5b7218c2c5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "EgbertRijke/dissertation",
"max_issues_repo_path": "intro.tex",
"max_line_length": 1775,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "f2c087ba8983205d3dd336bbc194be5b7218c2c5",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "EgbertRijke/dissertation",
"max_stars_repo_path": "intro.tex",
"max_stars_repo_stars_event_max_datetime": "2018-07-06T10:37:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-07-06T10:37:12.000Z",
"num_tokens": 4999,
"size": 20686
} |
% supplementary
\documentclass[12pt,addpoints]{exam} %, answers
%\documentclass[12pt,addpoints,answers]{exam} %a
% or \printanswers at beginning, inside %\noprintanswers
%%%``cancelspace'' argument for no answerspaces against solutions in qpaper
\RequirePackage{amssymb, amsfonts, amsmath, latexsym, verbatim, xspace, setspace}
\RequirePackage{tikz, pgflibraryplotmarks}
\usepackage{caption} % for captionof command worked
\usepackage[margin=1in]{geometry} % By default LaTeX uses large margins.
\usepackage{graphicx}
\usepackage{pdfpages}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%test
\def\LOGO{%
\begin{picture}(0,0)\unitlength=1cm
\put (3,1) {\includegraphics[width=5em]{IRlogored.png}} %did change -1 to +1
\end{picture}
}
%%%%%########################################
%%% https://www.overleaf.com/project/61b06701ca3ed1b47d9a229b tize LianTze Lim
%% fonts hindi https://www.overleaf.com/help/193
%% Aksharyogini2, Annapurna SIL, BABEL Unicode, Baloo 2,Chandas, Eczar,FreeSans,FreeSerif
% Gargi, Gotu , IBM Plex Sans Devanagari, Jaini,Jaini Purva,Kalimati
% Lohit Devanagari,Lohit Marathi,Lohit Nepali,Modak,Mukta,Nakula,Noto Sans Devanagari,Noto Serif Devanagari
% Sahadeva,Samanata,Samyak Devanagari,Sarai,Shobhika
% Arabic: Amiri, Amiri Quran, Amiri Quran Colored
% Arab, Arial, Awami Nastaliq, Cortoba, Courier New, DejaVu Sans
\usepackage{silence} %Selective filtering of error messages and warnings
\WarningFilter{latex}{Command \InputIfFileExists}
\usepackage{fontspec}
\usepackage{xunicode} %% loading this first to avoid clash with bidi/arabic
\usepackage{polyglossia} % language switching -- like babel, but for xelatex
\usepackage{hologo} %%% For the xelatex (and other LaTeX friends) logos
\usepackage{fontawesome} % awesome fontawesome icons!
\usepackage[hyphens]{url}
\setmainlanguage{english}
\setotherlanguages{arabic,hindi,sanskrit,greek,thai} %% or other languages
% Main serif font for English (Latin alphabet) text
\setmainfont{Noto Serif}
\setsansfont{Noto Sans}
\setmonofont{Noto Mono}
% define fonts for other languages
\newfontfamily\devanagarifont[Script=Devanagari]{Noto Serif Devanagari}
% \newfontfamily\greekfont[Script=Greek]{GFS Artemisia}
\newfontfamily\thaifont[Script=Thai]{Noto Serif Thai}
\newfontfamily\arabicfont[Script=Arabic]{Noto Naskh Arabic}
\usepackage[space]{xeCJK}. %%% CJK needs a different treatment
\setCJKmainfont{Noto Serif CJK SC} %%% Assuming Chinese is the main CJK language..
\setCJKsansfont{Noto Sans CJK SC}
\newCJKfontfamily\japanesefont{Noto Serif CJK JP} %%% Define fonts for Japanese and Korean
% \newCJKfontfamily\koreanfont{[UnGraphic.ttf]} % upload your own font files
% \newCJKfontfamily\koreanfont{Noto Serif CJK KR} %..or go along font on server
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Here's where you edit the Class, Exam, Date, etc.
\newcommand{\class}{Gr.B(Mech) 70\% Absentee}
\newcommand{\term}{22 December 2021}
\newcommand{\examnum}{Mechanical Dept}
\newcommand{\examdate}{22/12/2021}
\newcommand{\timelimit}{120 Minutes}
\singlespacing % most appropriate but can use % \onehalfspacing or % \doublespacing
\parindent 0ex % For an exam, we generally want to turn off paragraph indentation
% These set up the running header on the top of the exam pages
%\firstpageheader %\firstpagefooter %\firstpageheadrule %\firstpagefootrule
%\runningheader %\runningfooter %\runningheadrule %\runningfootrule
%\pagestyle{head}
\firstpageheader{}{}{}
\runningheader{\class}{\examnum\ - Page \thepage\ of \numpages}{\examdate}
\runningheadrule
\firstpagefooter{}{}{}
%\runningfooter{Math 115}{First Exam}{Page \thepage\ of \numpages}
%\runningfooter{\class}{\examnum\ - Page \thepage\ of \numpages}{\examdate} %??????
\runningfootrule
\marksnotpoints % for points instead of Marks
%\addpoints %\noaddpoints %turn marking on and off in document as reqd
% with answer: solution, solutionorbox, solutionorlines, and solutionordottedlines
%% choices, oneparchoices, checkboxes, or oneparcheckboxes environment emphesis \CorrectChoice
%% \answerline include an optional argument answer printed on the answer lines
%\pointsinmargin %Print marks at left
%\pointsinrightmargin %Print marks at left
%\nopointsinmargin ~= \nopointsinrightmargin for default setup marks in bigining
%\pointsdroppedatright % but not printed until you give the command \droppoints at end of question
%\bracketedpoints %\nobracketedpoints % sq brakets instead of default perenthesis for marks,
%\boxedpoints %\noboxedpoints % for boxing unboxing default points
%\marginpointname
%\pointname{ \points} %\pointname{ \points} is default %can use \pointname{\%} for percent
%\pointpoints{SingularText}{PluralText}
\pointpoints{Mark}{Marks}
%\marksnotpoints
%\marginpointname{ \points} %these two give marks instead of points
%%\extrawidth{-1in} \marginpointname{ \points} %to increase margins around
%%%info \half for 1/2 , \useslantedhalf is default ; \usehorizontalhalf
%%%\bonusquestion %\bonustitledquestion %\bonuspart %\bonussubpart %\bonussubsubpart %\bonusqformat
%%counting \numquestions %\numparts %\numsubparts %\numsubsubparts
%%%eg This exam has \numquestions\ questions, for a total of \numpoints\ points and \numbonuspoints\ bonus points.
%%You can use the standard LATEX commands \label and \ref to refer to questions (or parts
%%%%%%MCQ
%%Choice like list envo \begin{choices} \choice John \choice Paul \choice George \end{choices}
%%oneparchoices for choice in single line
%%insert a blank line before the \begin{oneparchoices}
%% and \answerline after the \end{oneparchoices}
%%%use a checkboxes environment instead of the choices environment
%%use a oneparcheckboxes environment instead of the choices environment %\begin{oneparcheckboxes}
%% for answers correct choice is \CorrectChoice, which is used in place of the command \choice
%%\CorrectChoiceEmphasis{\itshape} or \CorrectChoiceEmphasis{\color{red}\bfseries}} if \usepackage{color} is in preamble
%%default is \CorrectChoiceEmphasis{\bfseries}
%%\checkboxchar{$\Box$} if \usepackage{amssymb} in the preamble, default is \checkboxchar{$\bigcirc$}
%%for instructions uplevel of subindent by \uplevel{The following two parts should be answered in Greek:} or eq envoi
%% or \fullwidth{When you finish this exam, reexamine your work, for any errors that you may have made.} with format
%% create answer lines for short answer questions : solution, solutionorbox, solutionorlines, and solutionordottedlines.
%%twice as much space \vspace*{\stretch{2}} after that question instead of \vspace*{\stretch{1}}
%%\vspace*{1in} inserts one inch of vertical space, unstared no space at newpage
%%\makeemptybox{1in}
%%to fill the remaining space on the page with an empty box, \makeemptybox{\stretch{1}} and \newpage
%%insert an empty box when solutions are not being printed by solutionoremptybox environment
%%%fill space with lines with the command \fillwithlines{length} or \fillwithdottedlines{1in}
%%%line gap by \setlength\linefillheight{.25in}, thickness by \setlength\linefillthickness{0.1pt}
%%equally distribute space for answers among questions on page, \fillwithlines{\stretch{1}} and /newpage
%%% use solutionorlines envoi
%print answer lines for short answer questions by \answerline
%%\setlength\answerskip{2ex} and \setlength\answerlinelength{1in}
%%\answerline[the answer 43 goods ] take an optional argument for answer to print when required
%%Four environments for typing solutions to the problems solution, solutionorbox, solutionorlines, solutionordottedlines
%%\begin{solution}[2in] answer text \end{solution} default solution is printed in a box, 2in for qpaper
%%or \begin{solutionorbox}[2in] answertext \end{solutionorbox}
%%or \begin{solutionorlines}[2in] answertext \end{solutionorlines} oror \begin{solutionordottedlines}[2in]
%%\shadedsolutions if used \usepackage{color}
%%or \definecolor{SolutionColor}{rgb}{0.8,0.9,1} for defining color blue,
%%\unframedsolutions
%%for all goback to default by \framedsolutions
%%%%%%%%%conditional in answers sheet
%% \ifprintanswers Stuff to appear only when answers are being printed or blank.
%% \else optional Stuff to appear only when answers are not being printed or blank.
%% \fi
%% same things using the \ifthenelse command as automatic loaded
%%\ifthenelse{\boolean{printanswers}} {Stuff when answers are being printed.}{Stuff when answers notprinted.}
%%%Grading table
%\gradetable[v][questions] %prints a vertically oriented table indexed by questions
%\gradetable[h][questions] %prints a horizontally oriented table indexed by question
%\gradetable[v][pages] %vertically table indexed by page number similar \gradetable[h][pages]
%\pointtable[h][questions] %Only points printed
%%%\begingradingrange{myrange} \endgradingrange{myrange} and expend by \pointsinrange{myrange},
%%\partialgradetable{myrange}[v][questions]
%%\pointsofquestion{3} prints the sum of the point values for question 3 and all of its subparts
%%\bonusgradetable
%%\combinedgradetable[h][questions]
%equall space \vspace{\stretch{1}} after each questions or parts, etc. and end page with \newpage. {1.5} for more space
\renewcommand{\choicelabel}{(\thechoice)}
\pointsinrightmargin % print marks on right, \pointstwosided s
% \nopointsinmargin cancels
%\marksnotpoints
%\pointname{ \mark}
\pointpoints{mark}{marks}
%\CorrectChoiceEmphasis{\color{red}}
\CorrectChoiceEmphasis{\color{red}\bfseries}
% \checkboxchar{$\bigcirc$} default
% \checkboxchar{$\Box$}
%% numeric values instead of a, b c d
%You can change the multiple choice labels in the exam package via something like this:
% \renewcommand\thechoice{\arabic{choice}}
% You can also change the label punctuation via
% \renewcommand\choicelabel{(\thechoice)}
% \newenvironment{boxed}
% {commands before for new environment }
% { } %insput into the envirornments appears hare ie boxed
% { commands after commands for new environment } ck brakets
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{center}
% \sffamily
\bfseries
{\LARGE Research Designs and Standards Organisation (RDSO) } \\
%\end{center}
%\hrulefill\par
%\begin{center}
\vspace{5pt}
\fbox{ \fbox{\parbox{5.5in}{\centering Absentee Examination for Departmental Selection against 70\% quota for Group ‘B’ Technical Posts (PB-2 GP Rs.4800) in the\par Mechanical Department of RDSO.\\
Time: 10:30 Hrs to 12:30 Hrs on 22 December 2021 \\ % Answers are marked in RED
} } }.
\end{center}
\rule[1ex]{\textwidth}{1.5pt}
Important Instructions:
\begin{itemize}
\item This question paper contains \numpages\ printed pages (including this cover page) containing \numquestions\ MCQ questions. Check to see if any page is missing.
\item Enter all requested information in the OMR sheet only.
\item \textbf{Answer only in the OMR sheet provided}. Also read \textbf{Instructions to candidate”} as printed on the OMR sheet.
%\item The printed questions are \numquestions\ .
\item Please attempt all the 15 MCQ questions in section on \emph{Establishment and Financial rules}. The section on \emph{Technical subject including official language policy} contains 40 MCQ questions \textbf{Please attempt only 35 MCQ form this section} .
\item Each question carries 2 marks. The maximum marks are 100 only. There shall be \textbf{negative marking}
of \( \frac{2}{3} \) (two third) marks for every incorrect answers.
%One 3rd marks will be deducted from every wrong answer. No such deduction shall be there on any unattempted questions.
\item \textbf{No cutting, over-writing, erasing and alteration} shall be accepted in answer sheet.
\item Do not write your name or any distinguishing mark on the answer sheet portion of OMR. Such answer sheet shall not be evaluated.
\item Use of any unfair means, including any digital device such as calculator, mobile and digital watch, notes or recorded material etc. are prohibited.
\item This questions paper is in bilingual i.e. Hindi/English. In case of contradiction on Hindi/English version questions, \textbf{ the English version shall prevail over hindi translated version}.
\item Please note that multiple choice options to the questions are printed as (A), (B), (C) and (D) in the same line in continuation to save on paper and printing resources. Please select \emph{the most appropriate best answer in the context}.
%Part ‘A’ (technical subject including official language policy)
%Part ‘B’ ( establishment and finance rules)
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\vqword{Problem}
\vqword{Question}
\addpoints % required here by exam.cls, even though questions haven't started yet.
%\gradetable[h]%[pages] % Use [pages] to have grading table by page instead of question
% \renewcommand{\choicelabel}{(\thechoice)} to get (A), (B) etc documentation file examdoc.pdf, on pages 38-39.
\newpage % End of cover page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{questions}
\addpoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Question with parts
%\newpage
%\addpoints
%\question Consider $f(x)=x^2$. \marginpar{example margin notes}
%\begin{parts}
%\part[5] Find $f'(x)$ using the limit definition of derivative.
%\vfill
%\part[5] Find the line tangent to the graph of $y=f(x)$ at the point where $x=2$.
%\vfill
%\end{parts}
% If you want the total number of points for a question displayed at the top,
% as well as the number of points for each part, then you must turn off the point-counter
% or they will be double counted.
%\begin{oneparchoices}
%\choice Ringo
%\CorrectChoice Socrates
%\end{oneparchoices}
%\begin{oneparcheckboxes}
%\choice John
%\CorrectChoice Socrates
%\end{oneparcheckboxes}
%\makeemptybox{1in}
%\vspace*{\stretch{1}}
%\makeemptybox{1in}
%\setlength{\gridsize}{5mm}
%\setlength{\gridlinewidth}{0.1pt}
%\colorgrids
%\smallskip \fillwithgrid{1in}
%\fillwithgrid{length}
% \answerline
%\addpoints
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MCQ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\newpage
%\addpoints
%\question Itself can be blank
%\begin{parts}
%\part
%What changes to the van Allen radiation belt ?
%\makeemptybox{1in}
%\part
%Where should the field generator be constructed if you want one of the vertices to be located at the Royal Observatory at Greenwich?
%\fillwithlines{1in}
%\end{parts}
%\question[20] Identify and label the Parts in the Wagon bogie in the figure given below.
% \label{label:a}
% \begin{parts}
% \part Label any 10 parts correctly and Clearly. Each correct label carries 2 Marks.
% \begin{minipage}[t]{\linewidth}
% \centering
% \includegraphics[scale=0.5]{NRlogo.png}
% \captionof{figure}{Figure of Q.\ref{label:a}}
% \label{label:q1}
% \end{minipage}
% \end{parts}
%\end{questions}
%%%%%%%%%%%%%%%%%%%%%
%\examdate
\newpage
\section{Establishment and Financial rules}
%\fullwidth{\Large \textbf{Establishment and Financial rules}}
% 5 finance questions and 10 personal questions
\input{AMERDSO/AME70estabfinance.tex}
%-------------------------
\section{Technical subject including official language}
%\subsection{Official language rules (Optional questions) }
Note: Please attempt only 35 questions out of 40 MCQ questions provided in this part .
\input{AMERDSO/AMERajbhasha70} % 5 Questions
%\subsection{Technical subject} % should be 35 questions
\input{AMERDSO/AMETech70}
\vskip 1cm
\hrulefill \BIG END OF THE EXAM \hrulefill
\end{questions}
\newpage
\includepdf[pages={1-6}, noautoscale, width=\paperwidth, height=\paperheight ]{AMERDSO/AME70hindi.pdf}
% scale=.8,pagecommand={}
\end{document}
| {
"alphanum_fraction": 0.7228690617,
"avg_line_length": 45.1151685393,
"ext": "tex",
"hexsha": "2285b732ba3c989faff8bacbdd171374935929db",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "97420d79478282052f266d71c4a876798c991988",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "ggmtech/groupbselection",
"max_forks_repo_path": "mainexam.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "97420d79478282052f266d71c4a876798c991988",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "ggmtech/groupbselection",
"max_issues_repo_path": "mainexam.tex",
"max_line_length": 262,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "97420d79478282052f266d71c4a876798c991988",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "ggmtech/groupbselection",
"max_stars_repo_path": "mainexam.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4413,
"size": 16061
} |
\chapter{Analysis}
Analyze data from the implementation with respect to the objective of the study.
\section{Neural network}
| {
"alphanum_fraction": 0.8031496063,
"avg_line_length": 21.1666666667,
"ext": "tex",
"hexsha": "3a1fae15957f91b75fea56edd32740f216f82fb5",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "41af3cee716890bda61647d810a1ae28453fef9d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "oribabky/masterthesis",
"max_forks_repo_path": "report/analysis.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "41af3cee716890bda61647d810a1ae28453fef9d",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "oribabky/masterthesis",
"max_issues_repo_path": "report/analysis.tex",
"max_line_length": 80,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "41af3cee716890bda61647d810a1ae28453fef9d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "oribabky/masterthesis",
"max_stars_repo_path": "report/analysis.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 27,
"size": 127
} |
\hypertarget{book-one}{%
\subsection{Book One}\label{book-one}}
\hypertarget{section}{%
\section{1}\label{section}}
\hypertarget{psalm-1-the-way-of-happiness}{%
\subsection{Psalm 1 --- The Way of
Happiness}\label{psalm-1-the-way-of-happiness}}
\bibverse{1} Happy are those who do not follow the counsel of the
wicked, not halting in ways frequented by sinners, nor taking a seat in
a gathering of scoffers. \bibverse{2} But the law of the Lord is their
joy, they study it day and night. \bibverse{3} They are like trees
planted by runlets of water, yielding fruit in due season, leaves never
fading. In all that they do, they prosper. \bibverse{4} Not so fare the
wicked, not so; like chaff are they, blown by the wind. \bibverse{5} So
the wicked will not stand firm in the judgement, nor sinners appear,
when the righteous are gathered. \bibverse{6} For the way of the
righteous is dear to the Lord, but the way of the wicked will end in
ruin.
\hypertarget{psalm-2-the-lords-chosen-king}{%
\subsection{Psalm 2 --- The Lord's Chosen
King}\label{psalm-2-the-lords-chosen-king}}
\hypertarget{section-1}{%
\section{2}\label{section-1}}
\bibverse{1} Why this turmoil of nations, this futile plotting of
peoples, \bibverse{2} with kings of the earth conspiring, and rulers
consulting together, against the Lord and against his anointed,
\bibverse{3} to snap their bonds and fling their cords away?
\bibverse{4} He whose throne is in heaven laughs, the Lord mocks them.
\bibverse{5} Then he speaks to them in his wrath, and in his hot anger
confounds them. \bibverse{6} ``This my king is installed by me, on Zion
my holy mountain.'' \bibverse{7} I will tell of the Lord's decree. He
said to me: ``You are my son, this day I became your father.
\bibverse{8} Only ask, and I make you the heir of the nations, and lord
of the world to its utmost bounds. \bibverse{9} You will break them with
sceptre of iron, shatter them like pottery.'' \bibverse{10} So now, you
kings, be wise: be warned, you rulers of earth. \bibverse{11} Serve the
Lord in awe, kiss his feet with trembling, \bibverse{12} lest, angry, he
hurl you to ruin; for soon will his fury blaze. Happy all who take
refuge in him.
\hypertarget{psalm-3-a-morning-prayer-for-protection}{%
\subsection{Psalm 3 --- A Morning Prayer for
Protection}\label{psalm-3-a-morning-prayer-for-protection}}
\hypertarget{section-2}{%
\section{3}\label{section-2}}
A psalm of David, when he fled from his son Absalom. \bibverse{1} How
many, Lord, are my foes! Those who rise up against me are many.
\bibverse{2} Many are those who say of me, ``There is no help for him in
his God.'' Selah \bibverse{3} But you, Lord, are shield about me, my
glory, who lifts up my head. \bibverse{4} When loudly I call to the
Lord, from his holy hill he gives answer. Selah \bibverse{5} I laid down
and slept: now I wake, for the Lord sustains me. \bibverse{6} I fear not
the myriads of people who beset me on every side. \bibverse{7} Arise,
Lord: save me, my God, who strikes all my foes on the cheek, and
shatters the teeth of the wicked. \bibverse{8} Victory belongs to the
Lord: let your blessing descend on your people. Selah
\hypertarget{psalm-4-an-evening-prayer}{%
\subsection{Psalm 4 --- An Evening
Prayer}\label{psalm-4-an-evening-prayer}}
\hypertarget{section-3}{%
\section{4}\label{section-3}}
For the leader, with stringed instruments. A psalm of David.
\bibverse{1} Answer my cry, God, my defender. Often from straits you
have brought me to spacious places. So now show me your favour and hear
my prayer. \bibverse{2} How long, you proud people, will my honour be
stained by the slanders you love, and the lies that you follow? Selah
\bibverse{3} See! The Lord has shown me his wonderful kindness: the Lord
hears, when I call to him. \bibverse{4} Sin not in your anger: but speak
in your heart on your bed, and be still. Selah \bibverse{5} Offer true
sacrifice, trust in the Lord. \bibverse{6} Many are longing for fortune
to smile. Lift upon us the light of your face. \bibverse{7} You have put
in my heart, Lord, a deeper joy than was theirs who had corn and wine in
abundance. \bibverse{8} So in peace I will lie down and sleep; for you,
Lord, keep me safe.
\hypertarget{psalm-5-a-prayer-for-guidance}{%
\subsection{Psalm 5 --- A Prayer for
Guidance}\label{psalm-5-a-prayer-for-guidance}}
\hypertarget{section-4}{%
\section{5}\label{section-4}}
For the leader: A psalm of David, to be accompanied by the flute.
\bibverse{1} Hear my words, Lord: give heed to my whisper. \bibverse{2}
Attend to my loud cry for help, my king and my God. \bibverse{3} When I
pray to you, Lord, in the morning, hear my voice. I make ready for you
in the morning, and look for a sign. \bibverse{4} For you are no God who
takes pleasure in wickedness: no one of evil can be your guest.
\bibverse{5} No braggarts can stand in your presence, you hate all
workers of wrong. \bibverse{6} You destroy all speakers of lies, people
of blood and deceit you abhor. \bibverse{7} But I, through your kindness
abundant, may enter your house, and towards the shrine of your temple
may reverently bow. \bibverse{8} Lead me, Lord, in your righteousness
because of my enemies. Make your way level before me. \bibverse{9} For
their mouth is a stranger to truth, their heart is a pit of destruction.
Their throat is a wide open grave, their tongue the smooth tongue of the
hypocrite. \bibverse{10} Condemn them, God; let their schemes bring them
down to the ground. For their numberless crimes thrust them down for
playing the rebel against you. \bibverse{11} But let all who take refuge
in you ring out their gladness forever. Protect those who love your
name, so they may exult in you. \bibverse{12} For you give your
blessing, Lord, to the godly, and the shield of your favour protects
them.
\hypertarget{psalm-6-a-cry-for-help-in-time-of-trouble}{%
\subsection{Psalm 6 --- A Cry for Help in Time of
Trouble}\label{psalm-6-a-cry-for-help-in-time-of-trouble}}
\hypertarget{section-5}{%
\section{6}\label{section-5}}
For the leader; with instrumental music on the sheminith. A psalm of
David. \bibverse{1} Rebuke me not, Lord, in your anger, punish me not in
your wrath. \bibverse{2} Lord, be gracious to me in my weakness. Heal me
Lord, for racked is my body; \bibverse{3} all of me utterly racked. Why
do you wait so long, Lord? \bibverse{4} Turn, Lord, rescue me; save me,
because of your love. \bibverse{5} For in death none can call you to
mind; in Sheol who can praise you? \bibverse{6} I am so weary of
sighing. All the night I make my bed swim, and wet my couch with my
tears. \bibverse{7} My eyes swollen with grief; from weeping caused by
my foes. \bibverse{8} Begone, workers of wrong, for the Lord has heard
my loud weeping, \bibverse{9} the Lord has heard my entreaty, the Lord
accepts my prayer. \bibverse{10} My foes will be stricken with terror,
brought to shame and dismay in a moment.
\hypertarget{psalm-7-a-prayer-to-the-god-of-justice}{%
\subsection{Psalm 7 --- A Prayer to the God of
Justice}\label{psalm-7-a-prayer-to-the-god-of-justice}}
\hypertarget{section-6}{%
\section{7}\label{section-6}}
A Shiggaion of David, which he sang to the Lord about Cush, the
Benjamite. \bibverse{1} Lord my God, I take refuge in you. Deliver me,
save me from all who pursue me; \bibverse{2} or like lions they will
tear me to pieces, and rend me, past hope of rescue. \bibverse{3} Lord,
my God, if my life has been such if my hands have been stained with
guilt, \bibverse{4} if friends I paid back with evil, if I plundered my
foes without cause, \bibverse{5} may the enemy chase and find me,
trample my life to the ground, my honour leave in the dirt! Selah
\bibverse{6} Arise, Lord, in anger, against my foes rise in fury. Awake
for my help: let justice be done. \bibverse{7} Gather the nations about
you, and sit on your lofty throne, \bibverse{8} as the Lord, the judge
of the peoples. Judge me, Lord, in my innocence and according to my
integrity. \bibverse{9} Put an end to the wrong of the wicked, protect
the righteous. Searcher of hearts and minds, righteous God.
\bibverse{10} God is my shield: he saves the upright in heart.
\bibverse{11} God is a just judge, constant in righteous anger.
\bibverse{12} He will sharpen his sword without fail, his bow is bent
and ready, \bibverse{13} his deadly weapons are ready, his arrows he
makes of flame. \bibverse{14} The enemy who conceives evil; pregnant
with mischief, giving birth to lies, \bibverse{15} a pit they have made
and dug; but into the hole that they made they will fall. \bibverse{16}
On their own heads their mischief comes back; on their own skulls their
violence comes down. \bibverse{17} I will give thanks to the Lord for
his justice, and sing to the name of the Lord Most High.
\hypertarget{psalm-8-gods-glory-in-nature}{%
\subsection{Psalm 8 --- God's Glory in
Nature}\label{psalm-8-gods-glory-in-nature}}
\hypertarget{section-7}{%
\section{8}\label{section-7}}
For the leader: A psalm of David, to be accompanied by a stringed
instrument. \bibverse{1} Lord our God! How glorious in all the earth is
your name! Your praise reaches as high as the heavens, \bibverse{2} from
the mouths of children and infants. You have built a fortress against
your enemies, to silence the foe and the rebel. \bibverse{3} When I look
at your heavens, the work of your fingers, the moon and the stars, which
you have set there, \bibverse{4} what are mortals, that you think of
them, humans, that you visit them? \bibverse{5} Yet you made them little
less than divine, crowned them with glory and majesty, \bibverse{6} made
them lord of the works of your hands, put all things under their feet
--- \bibverse{7} sheep and oxen, all of them; and the wild beasts also:
\bibverse{8} birds of the air, and fish of the sea, and all that crosses
the paths of the ocean. \bibverse{9} Lord our God! How glorious in all
the earth is your name!
\hypertarget{psalm-9-a-song-of-praise-the-lords-justice}{%
\subsection{Psalm 9 --- A Song of Praise the Lord's
Justice}\label{psalm-9-a-song-of-praise-the-lords-justice}}
\hypertarget{section-8}{%
\section{9}\label{section-8}}
For the leader; 'almuth labben. A psalm of David. \bibverse{1} With all
my heart I will praise the Lord, all your wonders I will rehearse.
\bibverse{2} I will rejoice and exult in you, singing praise to your
name, Most High; \bibverse{3} because backward my foes were turned, they
stumbled and perished before you. \bibverse{4} My right and my claim you
have upheld, you did sit on the throne as a fair judge, \bibverse{5}
rebuking the nations, destroying the wicked, and blotting their name out
forever and ever. \bibverse{6} The foe is vanished, ruined forever,
their cities destroyed, their memory perished. \bibverse{7} See! The
Lord is seated forever on the throne he established for judgement,
\bibverse{8} ruling the world with justice, and judging the nations with
equity. \bibverse{9} So the Lord proves a haven to the oppressed, a
haven in times of trouble. \bibverse{10} Well may they trust you who
know your name, for those who seek you, you never abandon. \bibverse{11}
Sing praise to the Lord, whose home is in Zion, declare his deeds
amongst the nations. \bibverse{12} As avenger of blood, he keeps them in
mind, he does not forget the cry of the wretched. \bibverse{13} Show me
favour, Lord, see how my foes afflict me, lift me up from the gates of
death; \bibverse{14} so I may, in your help exulting, tell forth your
praise at the gates of Zion. \bibverse{15} The nations are sunk in the
pit which they made, in the net that they hid, their own foot is
entangled. \bibverse{16} The Lord is revealed in the judgement he
wrought, the wicked are snared in their own handiwork. Selah
\bibverse{17} Let the wicked depart to Sheol, all the nations that live
forgetful of God. \bibverse{18} For the needy will not be always
forgotten, nor the hope of the helpless be lost forever. \bibverse{19}
Arise, Lord; don't let them triumph: before your face let the nations be
judged. \bibverse{20} Strike them with fear, Lord: show the nations how
frail they are. Selah
\hypertarget{psalm-10-a-prayer-for-help}{%
\subsection{Psalm 10 --- A Prayer for
Help}\label{psalm-10-a-prayer-for-help}}
\hypertarget{section-9}{%
\section{10}\label{section-9}}
\bibverse{1} Why do you stand, Lord, so far away, hiding yourself in
times of trouble? \bibverse{2} The wicked, in their pride, are pursuing
the helpless: let them be caught in the schemes they have plotted.
\bibverse{3} For the wicked boasts of their wanton greed; the robber
despises the Lord, and curses him, \bibverse{4} in wicked pride, thinks:
God doesn't care, God doesn't call to account. \bibverse{5} Never a
season that they do not prosper; your judgements are far above out of
their sight: they scoff at their foes. \bibverse{6} Each says in their
heart, ``I will never be shaken; I will live for all time untouched by
misfortune.'' \bibverse{7} Their mouths are full of deceit and
oppression: under their tongues lurks mischief and wrong. \bibverse{8}
Lying in secret in some village ambush, and stealthily watching, they
murder the innocent. \bibverse{9} Like a lion that lurks in a secret
lair they lurk intending to catch the defenceless; to seize them, to
drag them away in their net. \bibverse{10} Their victims are crushed,
sink down to the ground. Under their claws the hapless fall.
\bibverse{11} The wicked say in their hearts that God has forgotten, has
hidden his face, will see nothing. \bibverse{12} Arise, Lord, lift up
your hand, do not forget the cry of the wretched. \bibverse{13} Why do
the wicked treat God with contempt, and say in their hearts, ``God
doesn't care''? \bibverse{14} You have seen the trouble and sorrow; you
mark it all, and will take it in hand. The hapless can count on you,
helper of orphans. \bibverse{15} Break the arm of the wicked and evil:
search out their sin, till no more be found. \bibverse{16} The Lord is
king forever and ever: the nations will vanish from his land.
\bibverse{17} Lord, you have heard the desire of the humble, inclining
your ear, strengthening their hearts, \bibverse{18} rights you have won
for the crushed and the orphan, so no one on earth may strike terror
again.
\hypertarget{psalm-11-trust-in-the-lord}{%
\subsection{Psalm 11 --- Trust in the
Lord}\label{psalm-11-trust-in-the-lord}}
\hypertarget{section-10}{%
\section{11}\label{section-10}}
For the leader. Of David. \bibverse{1} In the Lord I take refuge. How
can you tell me to flee like a bird to the mountains? \bibverse{2}
``See! The wicked are bending the bow, their arrow is set on the string,
to shoot from the shadows at the upright in heart. \bibverse{3} In this
tearing down of foundations what good can a good person do?''
\bibverse{4} The Lord in his holy temple, the Lord in heaven, enthroned.
His eyes watch the world, they see everyone. \bibverse{5} The Lord
examines the righteous and wicked, and the lover of violence he hates.
\bibverse{6} On the wicked he rains coals of fire and brimstone, and
their drink will be scorching wind. \bibverse{7} For the Lord is just,
and justice he loves; so the upright will see his face.
\hypertarget{psalm-12-a-prayer-for-the-faithful-in-a-false-world}{%
\subsection{Psalm 12 --- A Prayer for the Faithful in a False
World}\label{psalm-12-a-prayer-for-the-faithful-in-a-false-world}}
\hypertarget{section-11}{%
\section{12}\label{section-11}}
For the leader; on the sheminith. A psalm of David. \bibverse{1} Help,
Lord, for the good are all gone, faithful people have vanished.
\bibverse{2} One lies to another, speaking empty lies, with flattering
lips and false hearts they speak. \bibverse{3} May the Lord cut off all
the flattering lips, and the tongue that utters arrogance, \bibverse{4}
they declare, ``Our tongue is our strength, our allies our lips: who is
lord over us?'' \bibverse{5} ``The poor are despoiled, and the needy are
sighing; so now I will act,'' the Lord declares ``And place them in the
safety they long for.'' \bibverse{6} The words of the Lord are words
that are pure, silver smelted, seven times refined. \bibverse{7} You
will keep us, Lord, and guard us from this generation forever,
\bibverse{8} in a world where the wicked prowl, and worthless people
exalted.
\hypertarget{psalm-13-a-prayer-for-help-in-trouble}{%
\subsection{Psalm 13 --- A Prayer for Help in
Trouble}\label{psalm-13-a-prayer-for-help-in-trouble}}
\hypertarget{section-12}{%
\section{13}\label{section-12}}
For the leader. A psalm of David. \bibverse{1} How long, Lord, will you
forget me forever? How long will you hide your face from me?
\bibverse{2} How long must I nurse grief inside me, and in my heart a
daily sorrow? How long are my foes to exult over me? \bibverse{3} Look
at me, answer me, Lord my God. Fill my eyes with your light, lest I
sleep in death, \bibverse{4} lest my enemies claim to have triumphed,
lest my foes rejoice at my downfall. \bibverse{5} But I trust in your
kindness: my heart will rejoice in your help. \bibverse{6} I will sing
to the Lord who was good to me.
\hypertarget{psalm-14-the-folly-of-denying-god}{%
\subsection{Psalm 14 --- The Folly of Denying
God}\label{psalm-14-the-folly-of-denying-god}}
\hypertarget{section-13}{%
\section{14}\label{section-13}}
For the leader. Of David. \bibverse{1} Fools say in their heart, ``There
is no God.'' Vile, hateful their life is; not one does good.
\bibverse{2} From heaven the Lord looks out on humans, to see if any are
wise, and care for God. \bibverse{3} But all have turned bad, the taint
is on all; not one does good, no, not one. \bibverse{4} Have they learnt
their lesson, those workers of evil? Who ate up my people, eating,
devouring, never calling to the Lord. \bibverse{5} Sore afraid will they
be; for God is amongst those who are righteous, \bibverse{6} you may
mock the plans of the poor, but the Lord is their refuge. \bibverse{7}
If only help from Zion would come for Israel! When the Lord brings his
people a change of fortune, how glad will be Jacob, and Israel how
joyful!
\hypertarget{psalm-15-standing-firm}{%
\subsection{Psalm 15 --- Standing Firm}\label{psalm-15-standing-firm}}
\hypertarget{section-14}{%
\section{15}\label{section-14}}
A psalm of David. \bibverse{1} Lord, who can be guest in your tent? Who
may live on your holy mountain? \bibverse{2} The person whose walk is
blameless, whose conduct is right, whose words are true and sincere;
\bibverse{3} on whose tongue there sits no slander, who will not harm a
friend, \bibverse{4} nor cruelly insult a neighbour, who regards with
contempt those rejected by God; but honours those who obey the Lord, who
keeps an oath, whatever the cost, \bibverse{5} whose money is lent
without interest, and never takes a bribe to hurt the innocent. The
person who does these things will always stand firm.
\hypertarget{psalm-16-the-joy-of-fellowship-with-god}{%
\subsection{Psalm 16 --- The Joy of Fellowship with
God}\label{psalm-16-the-joy-of-fellowship-with-god}}
\hypertarget{section-15}{%
\section{16}\label{section-15}}
A michtam of David. \bibverse{1} Keep me, O God, for in you I take
refuge. \bibverse{2} I said to the Lord, ``You are my Lord, my happiness
rests in you alone. \bibverse{3} Those who are holy in the land, they,
they alone, are the noble ones; all my delight is in them.''
\bibverse{4} Those who choose other gods find endless sorrow. In their
offerings of blood I will have no part nor take their name on my lips.
\bibverse{5} The Lord is my share and my portion, my fate is in your
strong hands. \bibverse{6} The boundary lines of my life mark out
delightful country, my heritage pleases me well. \bibverse{7} I praise
the Lord for his counsel, which so stirs my heart in the night.
\bibverse{8} I keep the Lord always in mind: with him at my hand, I can
never be moved. \bibverse{9} So my heart is glad, there is joy inside
me; and in safety of body I live. \bibverse{10} For you will not give me
up to Sheol nor let any who love you see the pit. \bibverse{11} You will
show me the path that leads to life, to that fulness of joy which is in
your presence, and the pleasures dispensed by your hand evermore.
\hypertarget{psalm-17-a-prayer-for-deliverance}{%
\subsection{Psalm 17 --- A Prayer for
Deliverance}\label{psalm-17-a-prayer-for-deliverance}}
\hypertarget{section-16}{%
\section{17}\label{section-16}}
A prayer of David. \bibverse{1} Listen, O Lord, to my innocence; attend
to my piercing cry. Give heed to my prayer out of lips unfeigned.
\bibverse{2} Let my vindication come from you, your eyes see the truth.
\bibverse{3} When you test my heart when you visit at night, and assay
me like silver --- you can find no evil. I am determined that my mouth
should not lie. \bibverse{4} I gave earnest heed to the words of your
lips. \bibverse{5} My steps have held fast to the paths of your precepts
and in your tracks have my feet never stumbled. \bibverse{6} So I call
you, O God, with assurance of answer; bend down your ear to me, hear
what I say. \bibverse{7} Show your marvellous love, you who save from
enemies those who take refuge at your right hand. \bibverse{8} Keep me
as the apple of the eye, hide me in the shelter of your wings.
\bibverse{9} From wicked people who do me violence, from deadly foes who
crowd around me. \bibverse{10} They have closed their hearts to pity,
the words of their mouths are haughty. \bibverse{11} Now they dog us at
every step, keenly watching, to hurl us to the ground, \bibverse{12}
like a lion, longing to tear, like a young lion, lurking in secret.
\bibverse{13} Arise, Lord, face them and fell them. By your sword set me
free from the wicked, \bibverse{14} by your hand, O Lord, from those ---
whose portion of life is but of this world. But let your treasured ones
have food in plenty may their children be full and their children
satisfied. \bibverse{15} In my innocence I will see your face, awake I
am filled with a vision of you.
\hypertarget{psalm-18-a-kings-song-of-gratitude}{%
\subsection{Psalm 18 --- A King's Song of
Gratitude}\label{psalm-18-a-kings-song-of-gratitude}}
\hypertarget{section-17}{%
\section{18}\label{section-17}}
For the leader. Of David, the servant of the Lord, who recited the words
of this song to the Lord after the Lord had saved him from the power of
all his enemies and from the hand of Saul. He said: \bibverse{1} I love
you, O Lord, my strength. \bibverse{2} The Lord is my rock, my fortress,
deliverer, my God, my rock, where I take refuge, my shield, my defender,
my tower. \bibverse{3} Worthy of praise is the Lord whom I call on, he
rescues me from all my foes. \bibverse{4} The waves of death broke about
me, fearful floods of chaos. \bibverse{5} Sheol threw cords around me,
snares of death came to meet me. \bibverse{6} In distress I cried to the
Lord, and shouted for help to my God; in his temple he heard my voice,
into his ears came my cry. \bibverse{7} Then the earth shook and quaked,
mountains trembled to their foundations, and quaked because of his
wrath. \bibverse{8} Smoke went up from his nostrils, devouring fire from
his mouth, coals were kindled by it. \bibverse{9} Then he bent the sky
and came down, thick darkness was under his feet. \bibverse{10} He rode
on a cherub and flew, darting on wings of wind, \bibverse{11} with his
screen of darkness about him, in thick dark clouds of water.
\bibverse{12} At the radiance before him there passed hailstones and
coals of fire. \bibverse{13} The Lord thundered from heaven, the Most
High uttered his voice. \bibverse{14} He shot his arrows and scattered
them, flashed lightnings, and routed them. \bibverse{15} The channels of
the sea were revealed, the world was laid bare to its base, at your
rebuke, O Lord, at the blast of the breath of your nostrils.
\bibverse{16} He stretched from on high, he seized me, drew me up from
the mighty waters, \bibverse{17} and saved me from those who hated me
--- fierce foes, too mighty for me. \bibverse{18} In my day of distress
they assailed me, but the Lord proved my support. \bibverse{19} To a
spacious place he brought me, and, for love of me, he saved me.
\bibverse{20} The Lord repays my innocence, he rewards my cleanness of
hands. \bibverse{21} For I kept the ways of the Lord, nor have wickedly
strayed from my God. \bibverse{22} His commandments were all before me,
his statutes I put not away. \bibverse{23} And I was blameless before
him, guarding myself from sin. \bibverse{24} So the Lord repaid my
innocence, my cleanness of hands in his sight. \bibverse{25} With the
loyal you are loyal, and with the blameless blameless. \bibverse{26}
With the pure you show yourself pure, but shrewd with the devious.
\bibverse{27} For the lowly people you save, but haughty eyes you abase.
\bibverse{28} You are my lamp, Lord, my God who enlightens my darkness.
\bibverse{29} With you I can storm a rampart, with my God I can leap a
wall. \bibverse{30} As for God, his way is perfect; the word of the Lord
is pure. He is shield to all who take refuge in him. \bibverse{31} For
who is God but the Lord? And who is a rock but our God? \bibverse{32}
The God who arms me with strength, who cleared and smoothed my way.
\bibverse{33} He made my feet like hinds' feet, and set me up on the
heights. \bibverse{34} He taught my hands how to fight, and my arms how
to bend a bronze bow. \bibverse{35} The shield of your help you gave me,
your right hand supports me, you stoop down to make me great.
\bibverse{36} In your strength I took giant strides, and my feet never
slipped. \bibverse{37} So I chased the foe till I caught them, and
turned not, till I made an end of them. \bibverse{38} I smashed them,
they could not rise, they fell beneath my feet. \bibverse{39} You did
arm me with strength for war, you did bow my assailants beneath me.
\bibverse{40} You made my foes turn their back to me, and those who did
hate me I finished. \bibverse{41} They cried for help, but none saved
them; to the Lord, but he answered them not. \bibverse{42} I beat them
like dust of the market-place, stamped them like mud of the streets.
\bibverse{43} From the strife of the peoples you saved me, you made me
head of the nations, peoples I knew not did serve me. \bibverse{44} On
the instant they hear, they obey me, foreigners come to me cringing.
\bibverse{45} Foreigners lose courage, and come out of their strongholds
trembling. \bibverse{46} The Lord is alive! Blest be my rock! Exalted be
God, my protector! \bibverse{47} The God who gave me revenge, and
brought down nations beneath me, \bibverse{48} who saved me from angry
foes, and set me above my assailants, safe from the violent.
\bibverse{49} For this I will praise you amongst the nations, making
music, O Lord, to your name: \bibverse{50} for great triumphs he grants
to his king, and faithful love he shows his anointed, to David and his
seed evermore.
\hypertarget{psalm-19-the-glory-of-god-in-the-heavens}{%
\subsection{Psalm 19 --- The Glory of God in the
Heavens}\label{psalm-19-the-glory-of-god-in-the-heavens}}
\hypertarget{section-18}{%
\section{19}\label{section-18}}
For the leader. A psalm of David. \bibverse{1} The heavens declare God's
glory, the sky tells what his hands have done. \bibverse{2} Day tells it
to day, night reveals it to night, \bibverse{3} without speaking,
without words; without the sound of voices. \bibverse{4} But through all
the world their voice carries their words to the ends of the earth. He
has pitched a tent for the sun in the sky, \bibverse{5} it comes out
like a bridegroom from his bridal chamber, it joyfully runs its course
like a hero. \bibverse{6} From one end of the heavens it rises, and
around it runs to the other, and nothing hides from its heat. \#\# In
Praise of the Law \bibverse{7} The law of the Lord is perfect, renewing
life. The decrees of the Lord are trusty, making the simple wise.
\bibverse{8} The behests of the Lord are right, rejoicing the heart. The
command of the Lord is pure, giving light to the eyes. \bibverse{9} The
fear of the Lord is clean, it endures forever. The Lord's judgements are
true and right altogether. \bibverse{10} More precious are they than
gold --- than fine gold in plenty, and sweeter they are than honey, that
drops from the comb. \bibverse{11} By them is your servant warned; who
keeps them has rich reward. \bibverse{12} Who can know their flaws?
Absolve me from those I know not. \bibverse{13} Keep your servant from
wilful sins --- from falling under their sway: then blameless and clear
will I be from great offence. \bibverse{14} May the words of my mouth
and the thoughts of my heart be pleasing to you, Lord, my rock and
redeemer.
\hypertarget{psalm-20-a-prayer-for-victory}{%
\subsection{Psalm 20 --- A Prayer for
Victory}\label{psalm-20-a-prayer-for-victory}}
\hypertarget{section-19}{%
\section{20}\label{section-19}}
For the leader. A psalm of David. \bibverse{1} The Lord answer you in
the day of distress, the name of the Jacob's God protect you,
\bibverse{2} sending you help from the temple, out of Zion supporting
you. \bibverse{3} All your meal-offerings may he remember, your
burnt-offerings look on with favour. Selah \bibverse{4} May he grant you
your heart's desire, and bring all your plans to pass. \bibverse{5} We
will shout then for joy at your victory, and rejoice in the name of our
God. May the Lord grant your every request. \bibverse{6} Now I am sure
that the Lord will help his anointed. From his temple in heaven he will
answer by his mighty triumphant right hand. \bibverse{7} Some in
chariots are strong, some in horses; but our strength is the Lord our
God. \bibverse{8} They will totter and fall, while we rise and stand
firm. \bibverse{9} Give victory, Lord, to the king, and answer us when
we call.
\hypertarget{psalm-21-a-prayer-after-a-victory}{%
\subsection{Psalm 21 --- A Prayer after a
Victory}\label{psalm-21-a-prayer-after-a-victory}}
\hypertarget{section-20}{%
\section{21}\label{section-20}}
For the leader. A psalm of David. \bibverse{1} The king rejoices, Lord,
in your might, how he exults because of your help! \bibverse{2} You have
granted to him his heart's desire, you have not withheld his lips'
request. Selah \bibverse{3} You came to meet him with rich blessings,
you set on his head a golden crown. \bibverse{4} He asked you for life,
you gave it --- many long days, forever and ever. \bibverse{5} Great is
his glory because of your help, honour and majesty you lay upon him.
\bibverse{6} For you make him most blessed forever, you make him glad
with the joy of your presence. \bibverse{7} For the king puts always his
trust in the Lord; the Most High, in his love, will preserve him
unshaken. \bibverse{8} Your hand will reach all your foes, your right
hand, all who hate you. \bibverse{9} You will make them like a furnace
of fire, when you appear, Lord. The Lord will swallow them up in his
wrath. The fire will devour them. \bibverse{10} You will sweep their
offspring from the earth, their children from humanity. \bibverse{11}
When they scheme against you and hatch evil plots --- they will fail.
\bibverse{12} For you aim your bow at their faces, make them turn in
flight. \bibverse{13} Be exalted, Lord, in your strength, to your might
we shall sing and make music.
\hypertarget{psalm-22-the-sufferers-triumph}{%
\subsection{Psalm 22 --- The Sufferer's
Triumph}\label{psalm-22-the-sufferers-triumph}}
\hypertarget{section-21}{%
\section{22}\label{section-21}}
For the leader; set to `Deer of the Dawn'. A psalm of David.
\bibverse{1} My God, my God, why have you left me, my rescue so far from
the words of my roaring? \bibverse{2} I cry in the day, you do not
answer, I cry in the night but find no rest. \bibverse{3} You are the
Holy One, throned on the praises of Israel. \bibverse{4} In you our
ancestors trusted, they trusted and you delivered them. \bibverse{5}
They cried to you, and found safety, in you did they trust and were not
put to shame. \bibverse{6} But I am a worm, not a person; insulted by
others, despised by the people. \bibverse{7} All who see me mock me,
with mouths wide open and wagging heads: \bibverse{8} ``He relies on the
Lord; let him save him. Let him rescue the one he holds dear!''
\bibverse{9} But you drew me from the womb, laid me safely on my
mother's breasts. \bibverse{10} On your care was I cast from my very
birth, you are my God from my mother's womb. \bibverse{11} Be not far
from me, for trouble is nigh, and there is none to help. \bibverse{12} I
am circled by many bulls, beset by the mighty of Bashan, \bibverse{13}
who face me with gaping jaws, like ravening roaring lions. \bibverse{14}
Poured out am I like water, and all my bones are loosened. My heart is
become like wax, melted within me. \bibverse{15} My palate is dry as a
sherd, my tongue sticks to my jaws; in the dust of death you lay me.
\bibverse{16} For dogs are round about me, a band of knaves encircles
me, gnawing my hands and my feet. \bibverse{17} I can count my bones,
every one. As for them, they feast their eyes on me. \bibverse{18} They
divide my garments amongst them, and over my raiment cast lots.
\bibverse{19} But you, O Lord, be not far, O my strength, hasten to help
me. \bibverse{20} Deliver my life from the sword my life from the power
of the dogs. \bibverse{21} Save me from the jaws of the lion, from the
horns of the wild oxen help me. \bibverse{22} I will tell of your fame
to my kindred, and in the assembly will praise you. \bibverse{23} Praise
the Lord, you who fear him. All Jacob's seed, give him glory. All
Israel's seed, stand in awe of him. \bibverse{24} For he has not
despised nor abhorred the sorrow of the sorrowful. He hid not his face
from me, but he listened to my cry for help. \bibverse{25} Of you is my
praise in the great congregation; my vows I will pay before those who
fear him. \bibverse{26} The afflicted will eat to their heart's desire,
and those who seek after the Lord will praise him. Lift up your hearts
forever. \bibverse{27} All will call it to mind, to the ends of the
earth, and turn to the Lord; and all tribes of the nations will bow down
before you. \bibverse{28} For the kingdom belongs to the Lord: he is the
Lord of the nations. \bibverse{29} To him will bow down all who sleep in
the earth, and before him bend all who go down to the dust, and those
who could not preserve their lives. \bibverse{30} My descendants will
tell of the Lord to the next generation; \bibverse{31} they will declare
his righteousness to people yet to be born: He has done it.
\hypertarget{psalm-23-the-good-shepherd}{%
\subsection{Psalm 23 --- The Good
Shepherd}\label{psalm-23-the-good-shepherd}}
\hypertarget{section-22}{%
\section{23}\label{section-22}}
A psalm of David. \bibverse{1} The Lord is my shepherd: I am never in
need. \bibverse{2} He lays me down in green pastures. He gently leads me
to waters of rest, \bibverse{3} he refreshes my life. He guides me along
paths that are straight, true to his name. \bibverse{4} And when my way
lies through a valley of gloom, I fear no evil, for you are with me.
Your rod and your staff comfort me. \bibverse{5} You spread a table for
me in face of my foes; with oil you anoint my head, and my cup runs
over. \bibverse{6} Surely goodness and love will pursue me --- all the
days of my life. In the house of the Lord I will live through the length
of the days.
\hypertarget{psalm-24-the-true-worshipper}{%
\subsection{Psalm 24 --- The True
Worshipper}\label{psalm-24-the-true-worshipper}}
\hypertarget{section-23}{%
\section{24}\label{section-23}}
Of David. A psalm. \bibverse{1} The earth is the Lord's and all that it
holds, the world and those who live in it. \bibverse{2} For he founded
it on the seas, and on the floods he sustains it. \bibverse{3} Who may
ascend the hill of the Lord? Who may stand in his holy place?
\bibverse{4} The clean of hands, the pure of heart, who sets not their
heart upon sinful things, nor swears with intent to deceive:
\bibverse{5} they win from the Lord a blessing: God is their champion
and saviour. \bibverse{6} Such must be those who resort to him, and seek
the face of the God of Jacob. Selah \#\# The Lords's Triumphal Entry
into the Sanctuary \bibverse{7} Lift high your heads, you gates ---
Higher, you ancient doors; welcome the glorious king. \bibverse{8} ``Who
is the glorious king?'' ``The Lord strong and heroic, the Lord heroic in
battle.'' \bibverse{9} Lift high your heads, you gates --- Higher, you
ancient doors; welcome the glorious king. \bibverse{10} ``Who is the
glorious king?'' ``The Lord, the God of hosts, he is the glorious
king.'' Selah
\hypertarget{psalm-25-a-prayer-for-forgiveness-and-protection}{%
\subsection{Psalm 25 --- A Prayer for Forgiveness and
Protection}\label{psalm-25-a-prayer-for-forgiveness-and-protection}}
\hypertarget{section-24}{%
\section{25}\label{section-24}}
A psalm of David. \bibverse{1} To you, O Lord, I lift up my heart: all
the day I wait for you. \bibverse{2} In you I trust, put me not to
shame; let not my foes exult over me. \bibverse{3} None will be shamed
who wait for you, but shame will fall upon wanton traitors. \bibverse{4}
Make me, O Lord, to know your ways: teach me your paths. \bibverse{5} In
your faithfulness guide me and teach me, for you are my God and my
saviour. \bibverse{6} Remember your pity, O Lord, and your kindness, for
they have been ever of old. \bibverse{7} Do not remember the sins of my
youth; remember me in kindness, because of your goodness, Lord.
\bibverse{8} Good is the Lord and upright, so he teaches sinners the
way. \bibverse{9} The humble he guides in the right, he teaches the
humble his way. \bibverse{10} All his ways are loving and loyal to those
who observe his charges and covenant. \bibverse{11} Be true to your name
Lord, forgive my many sins. \bibverse{12} Who then is the person who
fears the Lord? He will teach them the way to choose. \bibverse{13} They
will live in prosperity, their children will inherit the land.
\bibverse{14} The Lord gives guidance to those who fear him, and with
his covenant he makes them acquainted. \bibverse{15} My eyes are ever
towards the Lord, for out of the net he brings my foot. \bibverse{16}
Turn to me with your favour, for I am lonely and crushed \bibverse{17}
In my heart are strain and storm; bring me out of my distresses.
\bibverse{18} Look on my misery and trouble, and pardon all my sins,
\bibverse{19} look on my foes oh, so many! And their cruel hatred
towards me. \bibverse{20} Deliver me, keep me, and shame not one who
takes refuge in you. \bibverse{21} May integrity and innocence preserve
me, for I wait for you, O Lord. \bibverse{22} Redeem Israel, O God, from
all its distresses.
\hypertarget{psalm-26-prayer-of-a-devout-worshipper}{%
\subsection{Psalm 26 --- Prayer of a Devout
Worshipper}\label{psalm-26-prayer-of-a-devout-worshipper}}
\hypertarget{section-25}{%
\section{26}\label{section-25}}
A psalm of David. \bibverse{1} Defend me, O Lord, for my walk has been
blameless; in the Lord have I trusted unswervingly: \bibverse{2} Examine
me, Lord, and test me; test my heart and my mind. \bibverse{3} For your
love is before my eyes, and your faithfulness governs my way.
\bibverse{4} I never sat down with the worthless, nor companied with
dissemblers. \bibverse{5} I hate the assembly of knaves, I would never
sit down with the wicked; \bibverse{6} but, with hands washed in
innocence, I would march round your altar, O Lord, \bibverse{7} singing
loud songs of thanks, and telling of all your wonders. \bibverse{8} O
Lord, I love your house, the place where your glory lives. \bibverse{9}
Do not gather me up with sinners; slay me not with people of blood,
\bibverse{10} whose hands are stained with villainy, and whose right
hand is filled with bribes. \bibverse{11} But my walk is blameless! O
redeem me, be gracious to me. \bibverse{12} My foot stands on even
ground, in the choirs I will bless the Lord.
\hypertarget{psalm-27-if-god-is-for-me}{%
\subsection{Psalm 27 --- If God is for
Me}\label{psalm-27-if-god-is-for-me}}
\hypertarget{section-26}{%
\section{27}\label{section-26}}
A psalm of David. \bibverse{1} The Lord is my light and my saviour; whom
then should I fear? The Lord protects my life; whom then should I dread?
\bibverse{2} When the wicked drew near to assail me and eat up my flesh,
it was those who distressed and opposed me who stumbled and fell.
\bibverse{3} Though against me a host should encamp, yet my heart would
be fearless: though battle should rise up against me, still would I be
trustful. \bibverse{4} One thing have I asked of the Lord, and that do I
long for --- To live in the house of the Lord all the days of my life,
to gaze on the grace of the Lord and enquire in his temple. \bibverse{5}
For he will hide me in his shelter in the day of misfortune. In his
sheltering tent he hides me: he lifts me up on a rock. \bibverse{6} And
now that my head he has lifted above my encircling foes, I will march
round the altar and sacrifice, shouting with joy, in his tent, making
music and song to the Lord. \#\# The Serenity of Faith \bibverse{7}
Hear, O Lord, my loud cry, and graciously answer me. \bibverse{8} My
heart has said to you, ``Your face, O Lord, I seek.'' \bibverse{9} Hide
not your face from me, reject not your servant in anger: for you have
been my help. Abandon me not, nor forsake me, O God of my help:
\bibverse{10} for father and mother have left me; but the Lord will take
me up. \bibverse{11} Teach me your way, O Lord: lead me in an even path,
because of my enemies. \bibverse{12} Give me not up, O Lord, unto the
rage of my foes; for against me have risen false witnesses, breathing
out cruelty. \bibverse{13} Firm is the faith I cherish, that I, in the
land of the living, will yet see the goodness of God. \bibverse{14} Let
your heart be courageous and strong, and wait on the Lord.
\hypertarget{psalm-28-an-answered-prayer-for-help}{%
\subsection{Psalm 28 --- An Answered Prayer for
Help}\label{psalm-28-an-answered-prayer-for-help}}
\hypertarget{section-27}{%
\section{28}\label{section-27}}
Of David. \bibverse{1} Unto you, O Lord, do I cry; my rock, be not deaf
to me: lest, through holding your peace, I become like those who go down
to the pit. \bibverse{2} Hear my loud entreaty, as I cry for help to
you, lifting my hands, O Lord, towards your holy chancel. \bibverse{3}
Take me not off with the wicked, nor with the workers of wrong, whose
speech to their neighbours is friendly, while evil is in their heart.
\bibverse{4} Give them as they have done, as their wicked deeds deserve.
As their hands have wrought, so give to them: requite to them their
deserts. \bibverse{5} They are blind to all that the Lord does, to all
that his hands have wrought; and so he will tear them down, to build
them up no more. \bibverse{6} Blest be the Lord, who has heard my voice
as I plead for mercy. \bibverse{7} The Lord is my strength and my
shield; my heart trusts in him. I was helped: so my heart is exultant,
and in my song I will praise him. \bibverse{8} The Lord is the strength
of his people, the fortress who saves his anointed. \bibverse{9} O save
your people, and bless your inheritance. Be their shepherd and carry
them forever.
\hypertarget{psalm-29-the-lords-glory-in-the-storm}{%
\subsection{Psalm 29 --- The Lord's Glory in the
Storm}\label{psalm-29-the-lords-glory-in-the-storm}}
\hypertarget{section-28}{%
\section{29}\label{section-28}}
A psalm of David. \bibverse{1} Ascribe to the Lord, you heavenly beings,
ascribe to the Lord glory and power \bibverse{2} Ascribe to the Lord the
glory he manifests: bow to the Lord in holy array. \bibverse{3} The
Lord's voice peals on the waters. The God of glory has thundered. He
peals o'er the mighty waters. \bibverse{4} The Lord's voice sounds with
strength, the Lord's voice sounds with majesty. \bibverse{5} The Lord's
voice breaks the cedars, he breaks the cedars of Lebanon, \bibverse{6}
making Lebanon dance like a calf, Sirion like a young wild ox.
\bibverse{7} The Lord's voice hews out flames of fire. \bibverse{8} The
Lord's voice rends the desert, he rends the desert of Kadesh.
\bibverse{9} The Lord's voice whirls the oaks, and strips the forests
bare; and all in his temple say ``Glory.'' \bibverse{10} The Lord was
king at the flood, the Lord sits throned forever. \bibverse{11} The Lord
gives strength to his people, he blesses his people with peace.
\hypertarget{psalm-30-a-song-of-thanksgiving-for-deliverance}{%
\subsection{Psalm 30 --- A Song of Thanksgiving for
Deliverance}\label{psalm-30-a-song-of-thanksgiving-for-deliverance}}
\hypertarget{section-29}{%
\section{30}\label{section-29}}
A psalm of David. A song for the dedication of the Temple. \bibverse{1}
I will extol you, O Lord, because you have lifted me up, and not
suffered my foes to rejoice over me. \bibverse{2} I cried to you for
help, O Lord my God, and you healed me. \bibverse{3} You have brought me
up, Lord, from Sheol, from my way to the pit back to life you have
called me. \bibverse{4} Sing praise to the Lord, faithful people; give
thanks to his holy name. \bibverse{5} For his anger lasts only a moment,
his favour endures for a lifetime. Weeping may lodge for the night, but
the morning brings shouts of joy. \bibverse{6} When all went well, I
imagined that never should I be shaken. \bibverse{7} For by your favour,
O Lord, you had set me on mountains strong: but you hide your face, and
I was confounded. \bibverse{8} Then to you, Lord, I cried, to the Lord I
begged for mercy, \bibverse{9} ``What profit is there in my blood, if I
go down to the pit? Can you be praised by dust? Can it tell of your
faithfulness? \bibverse{10} Hear, Lord, and show me your favour, Lord be
a helper to me.'' \bibverse{11} You have turned my mourning to dancing;
my sackcloth you have unloosed, and clothed me with joy: \bibverse{12}
that unceasingly I should sing your praise, and give thanks to you, Lord
my God, forever.
\hypertarget{psalm-31-a-prayer-for-deliverance-from-troubles}{%
\subsection{Psalm 31 --- A Prayer for Deliverance from
Troubles}\label{psalm-31-a-prayer-for-deliverance-from-troubles}}
\hypertarget{section-30}{%
\section{31}\label{section-30}}
For the leader. A psalm of David. \bibverse{1} In you, O Lord, I take
refuge; let me never be put to shame. Rescue me in your faithfulness;
\bibverse{2} incline to me your ear. Deliver me speedily. Be to me a
rock of defence, a fortified house, to save me. \bibverse{3} For my rock
and my fortress are you; lead me and guide me so your name will be
honoured. \bibverse{4} Draw me out of the net they have hid for me, for
you yourself are my refuge. \bibverse{5} Into your hand I commend my
spirit: you ransom me, Lord, faithful God. \bibverse{6} I hate those
devoted to worthless idols; I trust in the Lord. \bibverse{7} I will
rejoice and be glad in your love, because you have looked on my misery,
and cared for me in my distress. \bibverse{8} You have not given me into
the enemy's hand, you have set my feet in a spacious place. \bibverse{9}
Be gracious to me, Lord, for I am distressed; my eye is wasted away with
sorrow. \bibverse{10} For my life is consumed with grief, and my years
with sighing. My strength is broken with misery, my bones waste away.
\bibverse{11} The scorn of all my foes, the butt of my neighbours am I,
a terror to my acquaintance. At the sight of me in the street people
turn quickly away. \bibverse{12} I am clean forgotten like the dead, am
become like a ruined vessel. \bibverse{13} I hear the whispers of many
--- terror on every side --- scheming together against me, plotting to
take my life. \bibverse{14} But my trust is in you, Lord. ``You are my
God,'' I say; \bibverse{15} my times are in your hand, save me from the
hand of the foes who pursue me. \bibverse{16} Make your face to shine on
your servant, save me in your love. \bibverse{17} Put me not, O Lord, to
shame, for I have called upon you. Let the wicked be put to shame silent
in Sheol. \bibverse{18} Strike the false lips dumb, that speak proudly
against the righteous with haughtiness and contempt. \bibverse{19} How
great is the goodness you have treasured for those who fear you, and
wrought for those who take refuge in you, in plain sight of all!
\bibverse{20} In your sheltering wings you hide them from plottings of
people, you keep them safe in a bower from the chiding of tongues.
\bibverse{21} Blest be the Lord for the wonderful love he has shown me
in time of distress. \bibverse{22} For I had said in panic, ``I am
driven clean out of your sight.'' But you heard my plea, when I cried to
you for help. \bibverse{23} Love the Lord, all you faithful; the Lord
protects the loyal, but repays the haughty in full. \bibverse{24} Let
your hearts be courageous and strong, all you who wait on the Lord.
\hypertarget{psalm-32-a-prayer-of-confession-and-joy}{%
\subsection{Psalm 32 --- A Prayer of Confession and
Joy}\label{psalm-32-a-prayer-of-confession-and-joy}}
\hypertarget{section-31}{%
\section{32}\label{section-31}}
Of David. A maskil. \bibverse{1} Happy those whose transgression is
pardoned, whose sin is covered. \bibverse{2} Happy are those, free from
falseness of spirit, to whom the Lord reckons no debt of guilt.
\bibverse{3} When I held my peace, my bones wore away with my endless
groaning; \bibverse{4} for day and night did your hand lie heavy upon
me. The sap of my life was dried up as with fierce summer-heat. Selah
\bibverse{5} I began to acknowledge my sin, not concealing my guilt; and
the moment I vowed to confess to the Lord my transgression, then you
yourself did pardon the guilt of my sin. Selah \bibverse{6} For this
cause let all who are faithful pray to you in the time of distress;
then, when the great waters rush, they will not reach to him.
\bibverse{7} For you are my shelter, you protect me from trouble, and
surround me with deliverance. Selah \bibverse{8} ``With my eye
steadfastly upon you, I will instruct and teach you The way you should
go. \bibverse{9} Do not be like the horse or the mule, that have no
understanding, but need bridle and halter to curb them, else they will
not come near to you.'' \bibverse{10} The godless have many sorrows, but
those who trust in the Lord will be compassed about by his kindness.
\bibverse{11} Be glad in the Lord, and rejoice, you righteous; and ring
out your joy, all you upright in heart.
\hypertarget{psalm-33-a-hymn-of-thanksgiving}{%
\subsection{Psalm 33 --- A Hymn of
Thanksgiving}\label{psalm-33-a-hymn-of-thanksgiving}}
\hypertarget{section-32}{%
\section{33}\label{section-32}}
\bibverse{1} Shout for joy in the Lord, you righteous: praise for the
upright is seemly. \bibverse{2} Give thanks to the Lord on the lyre,
play to him on a ten-stringed harp. \bibverse{3} Sing to him a new song,
play skilfully and shout merrily. \bibverse{4} For the Lord is straight
in his promise; and all that he does is in faithfulness. \bibverse{5}
Justice and right he loves; the earth is full of his kindness.
\bibverse{6} By his word the heavens were made, all their host by the
breath of his mouth. \bibverse{7} He gathers the sea in a bottle, the
ocean he puts into store-houses. \bibverse{8} Let the whole world honour
the Lord, let all who live on earth be in awe. \bibverse{9} For at his
word it came into being, at his command it stood forth. \bibverse{10}
The Lord frustrates the designs of the nations, what the peoples have
purposed, he brings to nought, \bibverse{11} but the Lord's own design
will stand forever, and what his heart has purposed, through all
generations. \bibverse{12} Happy the nation whose God is the Lord, the
people he chose for himself as his own. \bibverse{13} The Lord looks
down from heaven, he sees all of humanity; \bibverse{14} from where he
rules he gazes on all who inhabit the earth. \bibverse{15} He fashions
the hearts of them all, and gives heed to all that they do.
\bibverse{16} It is not by great armies that kings are victorious, it is
not by great strength that a warrior saves himself; \bibverse{17} false
hope is the war-horse to usher in victory, for all its great might it
can provide no escape. \bibverse{18} See! The eye of the Lord is on
those who fear him, on those who hope in his kindness; \bibverse{19} to
deliver their life from death, and to keep them alive in famine.
\bibverse{20} We wait for the Lord: he is our help and our shield.
\bibverse{21} For in him our heart is glad, we trust in his holy name.
\bibverse{22} Let your kindness, O Lord, be upon us, as is our hope in
you.
\hypertarget{psalm-34-the-lord-is-mindful-of-his-own}{%
\subsection{Psalm 34 --- The Lord is Mindful of His
Own}\label{psalm-34-the-lord-is-mindful-of-his-own}}
\hypertarget{section-33}{%
\section{34}\label{section-33}}
Of David, when he feigned madness in the presence of Abimelech, who
drove him away, and he left. \bibverse{1} I will bless the Lord at all
times, in my mouth will his praise be forever. \bibverse{2} In the Lord
will my heart make her boast, the humble will hear and be glad.
\bibverse{3} O magnify the Lord with me and let us extol his name
together. \bibverse{4} I sought the Lord, and, in answer, he saved me
from all my terrors. \bibverse{5} Look to him and you will be radiant,
with faces unashamed. \bibverse{6} Here is one who was crushed, but
cried and was heard by the Lord, and brought safe out of every trouble.
\bibverse{7} The Lord's angel encamps about those who fear him, and
rescues them. \bibverse{8} O taste and see that the Lord is good, happy
those who take refuge in him. \bibverse{9} Fear the Lord, all his
people, for they who fear him lack nothing. \bibverse{10} Even young
lions may be poor and hungry, but those who seek the Lord will not lack
any good thing. \bibverse{11} Come, children, listen to me. I will teach
you the fear of the Lord. \bibverse{12} Which of you is desirous of
life, loves many and happy days? \bibverse{13} Then guard your tongue
from evil, and your lips from speaking deceit. \bibverse{14} Depart from
evil, and do good; seek peace, and pursue it. \bibverse{15} The eyes of
the Lord are towards the righteous, his ears are towards their cry for
help. \bibverse{16} The Lord sets his face against those who do evil, to
root their memory out of the earth. \bibverse{17} When righteous cry,
they are heard by the Lord, and he saves them from all their distresses.
\bibverse{18} The Lord is near to the broken-hearted, he helps those
whose spirit is crushed. \bibverse{19} Many misfortunes befall the
righteous, but the Lord delivers them out of them all. \bibverse{20} He
guards all their bones, none are broken. \bibverse{21} Misfortune will
slay the ungodly; those who hate the righteous are doomed. \bibverse{22}
The Lord ransoms the life of his servants, and none will be doomed who
takes refuge in him.
\hypertarget{psalm-35-a-prayer-for-deliverance-from-malicious-foes}{%
\subsection{Psalm 35 --- A Prayer for Deliverance from Malicious
Foes}\label{psalm-35-a-prayer-for-deliverance-from-malicious-foes}}
\hypertarget{section-34}{%
\section{35}\label{section-34}}
Of David. \bibverse{1} Contend, Lord, with those who contend with me, do
battle with those who do battle with me. \bibverse{2} Grasp shield and
buckler, and rise up as my help. \bibverse{3} Draw spear and battle-axe,
confront those who pursue me. Assure me that you will help me.
\bibverse{4} Dishonour and shame be on those who are seeking my life!
Defeat and confusion on those who are planning my hurt! \bibverse{5} As
chaff before wind may they be, with the Lord's angel pursuing them.
\bibverse{6} Slippery and dark be their way, with his angel thrusting
them on. \bibverse{7} For they wantonly hid their net for me, and dug a
pit to destroy me. \bibverse{8} Upon them may ruin come unawares; may
the net which they hid catch themselves, and into the pit may they fall.
\bibverse{9} Then I will exult in the Lord, and be joyful because of his
help; \bibverse{10} and all my being will say, ``Who, O Lord, is like
you, who save the helpless from those too strong for them, the poor and
the helpless from those who despoil them?'' \bibverse{11} Violent
witnesses rise, and ask of me things that I know not. \bibverse{12} Evil
for good they requite me, leaving me inwardly comfortless. \bibverse{13}
But when they were sick, I put on sackcloth, and chastened myself with
fasting. I prayed with head bowed low, \bibverse{14} as if for my friend
or my brother. I went about bowed and in mourning, as one who laments
his mother. \bibverse{15} When I stumbled, they gleefully gathered,
strangers gathered around me, and tore at me without ceasing,
\bibverse{16} impiously mocking and mocking, bearing their teeth at me.
\bibverse{17} How long, Lord, will you look on? Rescue me from their
roaring, my precious life from the lions. \bibverse{18} I will then give
you thanks in the great congregation, and praise you before many people.
\bibverse{19} Suffer not those to rejoice over me who are falsely my
foes, suffer not those who without cause abhor me to wink with the eye.
\bibverse{20} For it is not peace that they speak of those who are quiet
in the land; but treacherous charges they plot. \bibverse{21} With wide
open mouths they shout, ``Hurrah! Hurrah! With our own eyes we saw it.''
\bibverse{22} But you have seen, too, O Lord, keep not silence, O Lord,
be not far from me. \bibverse{23} Bestir you, awake, for my right my
God, my Lord, for my cause. \bibverse{24} You are just, Lord: win for me
justice, let them not rejoice over me, \bibverse{25} inwardly saying,
``Hurrah! The desire of our hearts at last! Now we have swallowed him
up.'' \bibverse{26} Shame and confusion together on those who rejoice at
my hurt! Clothed with shame and dishonour be those who are haughty to
me! \bibverse{27} Let such as delight in my cause ring out their
gladness, and say evermore, ``Great is the Lord whose delight is the
well-being of his servant.'' \bibverse{28} Then my tongue will tell of
your justice, and all the day long of your praise.
\hypertarget{psalm-36-the-triumphant-power-of-gods-love}{%
\subsection{Psalm 36 --- The Triumphant Power of God's
Love}\label{psalm-36-the-triumphant-power-of-gods-love}}
\hypertarget{section-35}{%
\section{36}\label{section-35}}
For the leader. Of the servant of the Lord, of David. \bibverse{1} Sin
whispers within the heart of the wicked, who have no dread of God before
their eyes. \bibverse{2} It flatters them in their eyes that their sin
will not be found out. \bibverse{3} First, their speech becomes wicked
and false, they give up acting wisely and well. \bibverse{4} Then they
plot deliberate wrong, take their stand on the wicked way, without the
least shrinking from evil. \bibverse{5} Your love, O Lord, touches the
heavens, your faithfulness reaches the clouds. \bibverse{6} Your justice
is like the great mountains, your judgements are like the broad sea.
Lord, you save people and animals. \bibverse{7} How precious your love,
O God! All may seek shelter in the shadow of your wings. \bibverse{8}
They feast on the fat of your house, they drink of your brook of
delights. \bibverse{9} For with you is the fountain of life, in the
light that is yours we see light. \bibverse{10} O continue your grace to
the faithful, your love to the upright in heart. \bibverse{11} Let no
arrogant foot tread upon me, no wicked hand drive me to exile.
\bibverse{12} There the workers of wrong lie prostrate, thrust down to
rise up no more.
\hypertarget{psalm-37-trust-in-the-lord-and-do-good}{%
\subsection{Psalm 37 --- Trust in the Lord and Do
Good}\label{psalm-37-trust-in-the-lord-and-do-good}}
\hypertarget{section-36}{%
\section{37}\label{section-36}}
Of David. \bibverse{1} Be not kindled to wrath at the wicked, nor
envious of those who work wrong; \bibverse{2} for, like grass, they will
speedily wither, and fade like the green of young grass. \bibverse{3}
Trust in the Lord, and do good; remain in the land, and deal faithfully:
\bibverse{4} then the Lord will be your delight, he will grant you your
heart's petitions. \bibverse{5} Commit your way to the Lord; trust in
him, and he will act, \bibverse{6} making clear as the light your right,
and your just cause clear as the noon-day. \bibverse{7} In silence and
patience wait on the Lord. Be not kindled to anger at those who prosper.
At those who execute evil devices. \bibverse{8} Desist from anger,
abandon wrath: be not kindled to anger it leads but to evil:
\bibverse{9} for evildoers will be cut off, but the land will be theirs,
who wait on the Lord. \bibverse{10} Yet but a little, and the wicked
vanish: look at their place: they are there no more. \bibverse{11} But
the humble will have the land, and the rapture of peace in abundance.
\bibverse{12} The wicked plots against the righteous, snarls like a wild
animal; \bibverse{13} the Lord laughs, for he sees that his day is
coming. \bibverse{14} The wicked have drawn the sword, and bent the bow,
to fell the poor, to slay those who walk uprightly; \bibverse{15} but
their sword will pierce their own heart, and their bows will be broken
in pieces. \bibverse{16} Better is the righteous person's little than
the wealth of many wicked. \bibverse{17} For the arms of the wicked will
be broken, but the Lord upholds the righteous. \bibverse{18} The Lord
watches over the days of the blameless, their heritage will continue
forever. \bibverse{19} They will not be shamed in the evil time, in the
days of famine they will be satisfied. \bibverse{20} Because the wicked
will perish: but the foes of the Lord, like a brand in the oven, will
vanish, like smoke they will vanish. \bibverse{21} The wicked must
borrow and cannot pay back, but the righteous is lavish and gives.
\bibverse{22} For those blest by the Lord inherit the land, while those
whom he curses will be cut off. \bibverse{23} The Lord supports the
steps of those with whom he is pleased. \bibverse{24} Though they fall,
they will not be cast headlong, for the Lord holds their hands.
\bibverse{25} Never, from youth to age, have I seen the righteous
forsaken, or their children begging bread. \bibverse{26} They are ever
lavishly lending, and their children are fountains of blessing.
\bibverse{27} Turn away from evil and do good and you will live in the
land forever. \bibverse{28} For the Lord loves justice, he does not
forsake his friends. The unrighteous will be destroyed forever, and the
seed of the wicked will be cut off. \bibverse{29} But the land will
belong to the righteous, they will live upon it forever, \bibverse{30}
The mouth of the righteous murmurs wisdom, and words of justice are on
their tongues. \bibverse{31} The law of their God is in their heart,
their steps are never unsteady. \bibverse{32} The wicked watches the
righteous, and seeks to put them to death. \bibverse{33} But the Lord
leaves them not in their hand: at their trial they will not be held
guilty. \bibverse{34} Wait on the Lord, and observe his way: he will
lift you to honour the land will be yours, you will feast your eyes on
the doom of the wicked. \bibverse{35} I have seen the wicked exultant,
lifting themselves like a cedar of Lebanon. \bibverse{36} But the moment
I passed, they vanished! I sought for them, but they could not be found.
\bibverse{37} Preserve your honour and practise uprightness, for such a
person fares well in the end. \bibverse{38} But transgressors will
perish together. Cut off are the wicked forever. \bibverse{39} The
righteous are saved by the Lord, who in time of distress is their
refuge: \bibverse{40} the Lord helps and rescue them, from the wicked he
rescues and saves them, because they take refuge in him.
\hypertarget{psalm-38-a-confession-and-prayer-for-deliverance}{%
\subsection{Psalm 38 --- A Confession and Prayer for
Deliverance}\label{psalm-38-a-confession-and-prayer-for-deliverance}}
\hypertarget{section-37}{%
\section{38}\label{section-37}}
A Psalm of David. A lament. \bibverse{1} Reprove me not, Lord, in your
anger, and chasten me not in your wrath; \bibverse{2} for your arrows
have sunk into me, and your hand lies heavy upon me. \bibverse{3} In my
flesh is no soundness because of your anger, no health in my bones,
because of my sin. \bibverse{4} For that my guilt is gone over my head:
it weighs like a burden too heavy for me. \bibverse{5} My wounds stink
and fester, for my foolishness I am tormented. \bibverse{6} Bent and
bowed am I utterly, all the day going in mourning. \bibverse{7} My loins
are filled with burning, and in my flesh is no soundness. \bibverse{8} I
am utterly crushed and numb; I cry louder than lion roars. \bibverse{9}
Lord, you know all that I long for, my groans are not hidden from you.
\bibverse{10} My heart is throbbing, my strength has failed me. The
light of my eyes--- even it is gone from me. \bibverse{11} My dear ones
and friends keep aloof, and my neighbours stand afar off. \bibverse{12}
They who aim at my life lay their snares, they who seek my hurt speak of
ruin, nursing treachery all the day long. \bibverse{13} But I turn a
deaf ear and hear not; like the dumb I open not my mouth. \bibverse{14}
I am like one without hearing, with no arguments in my mouth.
\bibverse{15} For my hope, O Lord, is in you. You will answer, O Lord my
God, \bibverse{16} when I utter the hope that those who made scorn of my
tottering feet may not rejoice over me. \bibverse{17} For I am ready to
fall, my pain forsakes me never. \bibverse{18} I acknowledge my guilt, I
am anxious because of my sin: \bibverse{19} My wanton assailants are
strong, those who wrongfully hate me are many, \bibverse{20} who render
me evil for good, and oppose me, because I make good my goal.
\bibverse{21} Do not forsake me, O Lord; my God, be not far from me.
\bibverse{22} Hasten to help me, O Lord my saviour.
\hypertarget{psalm-39-the-pathos-of-life}{%
\subsection{Psalm 39 --- The Pathos of
Life}\label{psalm-39-the-pathos-of-life}}
\hypertarget{section-38}{%
\section{39}\label{section-38}}
For the leader; for Jeduthun. A psalm of David. \bibverse{1} I vowed to
watch my words, and sin not with my tongue, but to put on my mouth a
muzzle, while the wicked were in my presence. \bibverse{2} I was silent
and dumb, speechless: but my pain was stirred up. \bibverse{3} My heart
grew hot within me; as I mused, the fire was kindled, till at last the
words came to my tongue. \bibverse{4} ``Teach me, O Lord, my end, and
the sum of my days what it is. Let me know how transient I am.
\bibverse{5} See! My days you have made but a span, and my life is as
nothing before you. It is but as a breath that everyone stands: Selah
\bibverse{6} it is but in mere semblance we walk to and fro, and all our
noise is for nothing. We heap up, and know not who will gather.''
\bibverse{7} And now, what wait I for, Lord? My hope is in you.
\bibverse{8} From all my transgressions deliver me; make me not the
scorn of the fool. \bibverse{9} I am dumb, never opening my mouth, for
this is your own doing. \bibverse{10} Remove your stroke from off me: by
the might of your hand I am spent. \bibverse{11} When you rebuke someone
to punish their sins, you consume, like a moth, what they treasures.
Everyone is only a breath. Selah \bibverse{12} Hear my prayer, O Lord;
attend to my cry for help. Hold not your peace at my tears. For I am but
a guest of yours, a stranger visiting, like all my ancestors.
\bibverse{13} Look away from me, let me smile again, before I die and am
gone.
\hypertarget{psalm-40-thanksgiving-and-petition}{%
\subsection{Psalm 40 --- Thanksgiving and
Petition}\label{psalm-40-thanksgiving-and-petition}}
\hypertarget{section-39}{%
\section{40}\label{section-39}}
For the leader. A psalm of David. \bibverse{1} For the Lord I waited and
waited, till, inclining to me, he heard my cry. \bibverse{2} From the
horrible pit he drew me, up out of the miry clay; he set my feet on a
rock, and my steps he made firm. \bibverse{3} He put a new song in my
mouth, of praise to our God. Many see it, and, filled with awe, put
their trust in the Lord. \bibverse{4} Happy the person who has put in
the Lord their trust, not looking to false gods or turning to idols.
\bibverse{5} With us you have wrought in rich measure, O Lord our God,
your marvels and purposes for us --- none may compare with you --- were
I to declare or to tell them, past counting are they. \bibverse{6} In
offerings bloody or bloodless you have no delight, but with open ears
you have made me. Burnt-offering and offering for sin are not what you
ask. \bibverse{7} Then said I, ``Here I am, as the roll of the book has
enjoined. \bibverse{8} My delight, O God, is to do your will, and your
law is within my heart.'' \bibverse{9} Well, O Lord, you know that, with
lips unrestrained, your righteousness I told in the great congregation,
\bibverse{10} not hiding it in my heart. I have told of your steadfast
help, from the great congregation I hid not your love and your
faithfulness. \bibverse{11} So do not restrain, Lord, your pity from us.
Your love and your faithfulness --- ever may they be our shield.
\bibverse{12} For evils that cannot be numbered have compassed me round.
My transgressions have followed me up --- I can bear it no more. They
are more than the hairs of my head, and my heart has forsaken me.
\bibverse{13} O Lord, be pleased to deliver me, haste to my help, O
Lord. \bibverse{14} May those who are seeking my life be ashamed and
confounded together; may those who delight in my hurt be defeated and
brought to dishonour. \bibverse{15} May those who hurrah over me be
dumbfounded because of their shame. \bibverse{16} But may all who seek
after you rejoice and be glad in you. May all those eager for your aid,
say, ``Great is the Lord'' evermore. \bibverse{17} I am weak and needy,
yet the Lord cares for me. You are my help and deliverer; don't delay,
my God.
\hypertarget{psalm-41-a-prayer-for-healing-and-vindication}{%
\subsection{Psalm 41 --- A Prayer for Healing and
Vindication}\label{psalm-41-a-prayer-for-healing-and-vindication}}
\hypertarget{section-40}{%
\section{41}\label{section-40}}
For the leader; for Jeduthun. A psalm of David. \bibverse{1} Happy are
those who consider the weak; in the day of misfortune the Lord will
deliver them. \bibverse{2} He will keep them safe, happy, and long in
the land, and not give them up to the rage of their foes. \bibverse{3}
The Lord will sustain them on bed of languishing; tending their
sickness, as long as they lie. \bibverse{4} For this cause I say,
``Lord, show me your favour; heal me, because I have sinned against
you.'' \bibverse{5} My enemies speak of me nothing but evil, ``When will
he die, and his name pass away?'' \bibverse{6} When one comes to see me,
their words ring hollow; their heart keeps gathering mischief the while;
and when they go out, they give it speech. \bibverse{7} In secret they
whisper together against me, all those who hate me plot evil against me.
\bibverse{8} ``Some fatal disease has fastened upon him; and now that he
lies, he will rise up no more.'' \bibverse{9} My most trusted friend, on
whom I relied, who ate of my bread, has turned against me. \bibverse{10}
But do you, Lord, graciously raise me up, that I may pay them their due
reward. \bibverse{11} By this will I know you delight in me: if my foes
may not shout over me in triumph. \bibverse{12} For my innocence you
uphold me, and set me forever before your face. \bibverse{13} Blessed be
the Lord, the God of Israel, from everlasting to everlasting, Amen and
Amen.
\hypertarget{book-two}{%
\subsection{Book Two}\label{book-two}}
\hypertarget{section-41}{%
\section{42}\label{section-41}}
\hypertarget{psalm-42-yearning-for-god}{%
\subsection{Psalm 42 --- Yearning for
God}\label{psalm-42-yearning-for-god}}
For the leader. A maskil of the Korahites. \bibverse{1} Like the hart
which longs for brooks of water, I long for you, God. \bibverse{2} I
thirst for God, for my living God. When shall I enter in, and see the
face of God? \bibverse{3} My tears have been my food by day and by
night; for they say to me all the day long, ``Where is your God?''
\bibverse{4} My heart floods with sorrow, as I call to mind: how I used
to pass on with the throng, at their head, to the house of God, with
glad shouts and giving of thanks, in the throng who kept festival.
\bibverse{5} Why am I downcast? Why this moaning within me? Hope in God;
for yet will I praise him, my help, my God. \bibverse{6} I am sunk in my
misery; I will therefore call you to mind from the land of Jordan and
Hermon, the mountain Mizar. \bibverse{7} Flood is calling to flood at
the noise of your cataracts; all your waves and your breakers have
passed over me. \bibverse{8} In the day I cry to the Lord to summon his
kindness; and the song that I sing in the night is a prayer to the
living God. \bibverse{9} I say to God my rock, ``Why have you forgotten
me? Why must I walk so sadly, so hard pressed by the foe?''
\bibverse{10} It pierces me to the heart to hear the enemy's taunts, as
all the day long they say to me, ``Where is your God?'' \bibverse{11}
Why am I downcast? Why this moaning within me? Hope in God; for yet will
I praise him, my help, my God.
\hypertarget{psalm-43-plea-for-help}{%
\subsection{Psalm 43 --- Plea for Help}\label{psalm-43-plea-for-help}}
\hypertarget{section-42}{%
\section{43}\label{section-42}}
\bibverse{1} Right me, defend my cause against a pitiless people. From
the crafty and crooked, O God, deliver me. \bibverse{2} For you are God
my protector: why have you cast me off? Why must I walk so sadly, so
hard pressed by the foe? \bibverse{3} Send forth your light and your
truth, let them be my guides: to your holy hill let them bring me, to
the place where you live. \bibverse{4} Then will I go to God's altar, to
God my rejoicing; and with joy on the lyre I will praise you, O God, my
God. \bibverse{5} Why am I downcast? Why this moaning within me? Hope in
God; for yet will I praise him, my help, my God.
\hypertarget{psalm-44-a-lament-in-defeat}{%
\subsection{Psalm 44 --- A Lament in
Defeat}\label{psalm-44-a-lament-in-defeat}}
\hypertarget{section-43}{%
\section{44}\label{section-43}}
For the leader. Of the Korahites. A maskil. \bibverse{1} O God, we have
heard with our ears, all our ancestors have told us of the work that you
wrought in their day, your wonders in days of old, \bibverse{2}
uprooting and crushing the nations, then planting and settling them. For
it wasn't their own sword that won them the land, \bibverse{3} it was
not their own arm that brought them the victory. Yours was the hand and
the arm, yours was the face that shone on them with favour. \bibverse{4}
It was you, my king and my God, that ordained the victories of Jacob.
\bibverse{5} Through you we can thrust back our foes, and by your name
tread down our assailants: \bibverse{6} for not in my bow do I trust,
nor can my sword win me the victory. \bibverse{7} Our victory comes from
you, and confusion to those who hate us. \bibverse{8} In God we boast
all the day long, and your name will we praise forever. Selah
\bibverse{9} Yet you have spurned and disgraced us, in not going forth
with our armies, \bibverse{10} and in making us flee from the foe, so
that those who hated us plundered us. \bibverse{11} You have let us be
eaten like sheep, you have scattered us over the world, \bibverse{12}
sold your people for a pittance, and getting no gain from their price.
\bibverse{13} You have made us the butt of our neighbours, the derision
and scorn of all round us. \bibverse{14} O'er the world you have made us
a byword, the nations at us shake their heads. \bibverse{15} My disgrace
is forever before me, my face is covered with shame, \bibverse{16} at
the words of blasphemer and scoffer, at the sight of the foe and the
vengeful. \bibverse{17} All this has come upon us, yet we have not
forgotten you nor falsely dealt with your covenant. \bibverse{18} Our
heart has not turned back, nor our steps declined from your way,
\bibverse{19} that you thus should have crushed us down, and covered us
over with gloom, in the place where the jackals roam. \bibverse{20} Had
we forgotten the name of our God, or stretched out our hands to a god
that was strange, \bibverse{21} would God not have searched this out?
For he knows the heart and its secrets. \bibverse{22} But in your cause
it is we are killed all the day, and counted as sheep for the slaughter.
\bibverse{23} Rouse yourself, why do you sleep Lord? Awake, cast us not
off forever. \bibverse{24} Why do you hide your face, forgetting our
stress and our misery? \bibverse{25} For we have sunk down to the dust,
our bodies cling to the ground. \bibverse{26} Arise, come to our help:
for your love's sake, ransom us.
\hypertarget{psalm-45-song-for-the-marriage-of-a-king}{%
\subsection{Psalm 45 --- Song for the Marriage of a
King}\label{psalm-45-song-for-the-marriage-of-a-king}}
\hypertarget{section-44}{%
\section{45}\label{section-44}}
For the leader; on shoshannim. Of the Korahites. A maskil. A love song.
\bibverse{1} My heart is astir with beautiful words: I will sing a song,
concerning the king, with tongue like the pen of a ready writer.
\bibverse{2} Your beauty is more than mortal, grace is shed over your
lips: therefore God has blessed you forever. \bibverse{3} Warrior, strap
your sword on your thigh. What glory and splendour! \bibverse{4} Good
fortune attend you, as forth you ride in the cause of good faith, and as
champion of justice. May your arm instruct you in deeds of dread.
\bibverse{5} Sharp are your arrows; nations fall under you: pierced to
the heart are the foes of the king. \bibverse{6} Your throne shall
endure for ever and ever your royal sceptre a sceptre of equity.
\bibverse{7} Right you love and wrong you hate: therefore the Lord your
God anoints you With oil of gladness above your fellows. \bibverse{8}
With myrrh, aloes, and cassia your robes are all fragrant, you are
gladdened by music of ivory harps. \bibverse{9} King's daughters stand
ready with jewels for you, at your right hand the queen in gold of
Ophir. \bibverse{10} Listen, daughter, and see; and incline your ear:
forget your folk and your father's house. \bibverse{11} And when the
king desires your beauty, bow to him, for he is your lord. \bibverse{12}
So shall the Tyrians come with gifts, and the richest of people will do
you homage. \bibverse{13} The king's daughter is glorious altogether,
with dress of pearls inwrought with gold. \bibverse{14} In many-coloured
robes she is led to the king, with the virgin companions she brought in
her train. \bibverse{15} The king's palace they enter with joy and
rejoicing. \bibverse{16} May sons of yours take the place of your
fathers, whom you will make princes in all the land. \bibverse{17} Your
name will I celebrate world without end, so that nations shall praise
you for ever and ever.
\hypertarget{psalm-46-our-god-is-a-mighty-fortress}{%
\subsection{Psalm 46 --- Our God is a Mighty
Fortress}\label{psalm-46-our-god-is-a-mighty-fortress}}
\hypertarget{section-45}{%
\section{46}\label{section-45}}
For the leader. Of the Korahites, on alamoth. A song. \bibverse{1} God
is our refuge and strength, a very present help in trouble. \bibverse{2}
So we have no fear, though earth should change, and the hills totter
into the heart of the ocean. \bibverse{3} Let its waters roar and foam,
let the mountains shake with the swelling thereof. On our side is the
Lord of hosts, our sure defence is the God of Jacob. Selah \bibverse{4}
A river there is, whose streams make glad God's city, the home the Most
High has hallowed. \bibverse{5} God is within her: she cannot be shaken.
God helps her at the turn of the morning. \bibverse{6} Nations roared,
kingdoms tottered: he uttered his voice, earth melted away. \bibverse{7}
On our side is the Lord of hosts, our sure defence is the God of Jacob.
\bibverse{8} Come and see what the Lord has done, working appallingly in
the earth. \bibverse{9} He stills wars to the ends of the earth-
breaking the bow, snapping the spear, burning the chariots in the fire.
\bibverse{10} ``Refrain; and know surely that I am God, high over the
nations, high over the world.'' \bibverse{11} On our side is the Lord of
Hosts, our sure defence is the God of Jacob. Selah
\hypertarget{psalm-47-the-lords-universal-sovereignty}{%
\subsection{Psalm 47 --- The Lord's Universal
Sovereignty}\label{psalm-47-the-lords-universal-sovereignty}}
\hypertarget{section-46}{%
\section{47}\label{section-46}}
For the leader. Of the Korahites. A psalm. \bibverse{1} Clap your hands,
all you peoples: shout to God in ringing cries. \bibverse{2} For the
Lord is most high and dread, a great king over all the earth.
\bibverse{3} He subdues the peoples under us, the nations under our
feet; \bibverse{4} he chooses our heritage for us, the glory of Jacob
whom he loves. Selah \bibverse{5} God is gone up with a shout, the Lord
with the sound of a trumpet. \bibverse{6} Sing praise to our God, sing
praises: sing praise to our king, sing praises. \bibverse{7} For king of
all earth is he: praise God in a skilful song. \bibverse{8} God is king
over all the nations, God sits on his holy throne. \bibverse{9} Princes
of nations gather with the people of Abraham's God: for the shields of
the earth are God's; greatly exalted is he.
\hypertarget{psalm-48-the-marvellous-deliverance-of-zion}{%
\subsection{Psalm 48 --- The Marvellous Deliverance of
Zion}\label{psalm-48-the-marvellous-deliverance-of-zion}}
\hypertarget{section-47}{%
\section{48}\label{section-47}}
A song. A psalm of the Korahites. \bibverse{1} Great is the Lord and
worthy all praise in the city of our God. His holy mountain,
\bibverse{2} that rises so fair, is the joy of all the world. Like the
mount of the gods is Mount Zion, the city of the great king.
\bibverse{3} Once God made himself known as the defence of her palaces.
\bibverse{4} For see! A concert of kings passed over the frontier
together. \bibverse{5} But one glance, and they were astounded; they
hastened away in dismay. \bibverse{6} Trembling took hold of them there,
like the pains of a woman in labour. \bibverse{7} They were shattered,
as east wind shatters the giant ships in pieces. \bibverse{8} What we
heard, we now have seen in the city of the Lord of hosts, the city of
our God. God will uphold her forever. Selah \bibverse{9} We think, O
God, of your love, in the midst of your temple. \bibverse{10} Your fame,
O God, like your name, shall extend to the ends of the earth. Victory
fills your hand. \bibverse{11} Let mount Zion be glad; let the daughters
of Judah rejoice because of your judgements. \bibverse{12} Walk about
Zion, go round her; count her towers. \bibverse{13} Set your mind on her
ramparts, consider her palaces; that you tell to the next generation
\bibverse{14} That such is God, our God he it is who shall guide us for
ever and ever.
\hypertarget{psalm-49-the-problem-of-the-prosperity-of-the-wicked}{%
\subsection{Psalm 49 --- The Problem of the Prosperity of the
Wicked}\label{psalm-49-the-problem-of-the-prosperity-of-the-wicked}}
\hypertarget{section-48}{%
\section{49}\label{section-48}}
For the leader. Of the Korahites. A psalm. \bibverse{1} Hear this, you
peoples all; give ear, all you who live in the world \bibverse{2} people
of low degree and high, the rich and the poor together. \bibverse{3} My
mouth shall utter wisdom, the thoughts of a seeing heart. \bibverse{4} I
incline my ear to a proverb, on the lyre I will open my riddle.
\bibverse{5} Why should I be afraid in the days of misfortune, when
circled by wicked and cunning foes, \bibverse{6} who put their trust in
their wealth, and boast of their boundless riches? \bibverse{7} For
assuredly no one can ransom themselves, or give to God the price of
their life, \bibverse{8} for the ransom of a life is costly, no payment
is ever enough, \bibverse{9} to keep them alive for ever and ever, so as
never to see the pit at all. \bibverse{10} But see it they will. Even
wise people die, the fool and the brutish perish alike, and abandon
their wealth to others. \bibverse{11} The grave is their everlasting
home, the place they shall live in for ever and ever, though after their
own names they called whole lands. \bibverse{12} Despite their wealth,
they perish like dumb animals. \bibverse{13} This is the fate of the
confident fool, and the end of those who are pleased with their portion.
Selah \bibverse{14} Like sheep they descend to Sheol with Death for
their shepherd; down they go straight to the grave, and their form
wastes away in their home below. \bibverse{15} But God will assuredly
ransom my life from the hand of Sheol; for he will receive me. Selah
\bibverse{16} So be not afraid when someone grows rich, when the wealth
of their house increases. \bibverse{17} Not a shred of it all can they
take when they die, wealth cannot follow them down. \bibverse{18} Though
they count themselves happy, when they are alive, and win praise from
many for faring so well, \bibverse{19} they must join their ancestors,
who see the light nevermore. \bibverse{20} The wealthy are without
understanding, they perish like dumb animals.
\hypertarget{psalm-50-true-worship}{%
\subsection{Psalm 50 --- True Worship}\label{psalm-50-true-worship}}
\hypertarget{section-49}{%
\section{50}\label{section-49}}
A psalm of Asaph. \bibverse{1} The Lord God has spoken: He summons the
earth from sunrise to sunset. \bibverse{2} From Zion, perfection of
beauty, God's glory shines forth. \bibverse{3} Our God comes, he cannot
keep silence, devouring fire is before him, and furious tempest around
him. \bibverse{4} He summons the heavens above and the earth to judge
his people. \bibverse{5} Gather to him his saints by covenant-sacrifice
bound to him; \bibverse{6} that the heavens may declare his justice, for
a God of justice is he. Selah \bibverse{7} ``Hear, O my people, and I
will speak, and protest to you, O Israel: I am the Lord, your God.
\bibverse{8} Not for your sacrifices will I reprove you your
burnt-offerings are ever before me \bibverse{9} Not a bullock will I
take from your house, nor he-goats out of your folds; \bibverse{10} for
all beasts of the forest are mine, and the kine on a thousand hills.
\bibverse{11} I know all the birds of the air, all that moves on the
fields is mine. \bibverse{12} Were I hungry, I would not tell you, for
the world and its fulness are mine. \bibverse{13} Am I such as to eat
bulls' flesh, or drink the blood of goats? \bibverse{14} Offer to God a
thank-offering, pay the Most High your vows. \bibverse{15} Summon me in
the day of distress, I will rescue you, so will you honour me.''
\bibverse{16} But to the wicked God says: ``What right have you to talk
of my statutes, or take my covenant into your mouth \bibverse{17} while
you yourself hate correction, and cast my words behind you?
\bibverse{18} When you see a thief, you run with them; with adulterers
you keep company. \bibverse{19} You let your mouth loose for evil, your
tongue contrives deceit. \bibverse{20} You shamefully speak of your kin,
and slander your own mother's son. \bibverse{21} And because I kept
silence at this, you did take me for one like yourself. But I will
convict you and show you plainly. \bibverse{22} ``Now you who forget
God, mark this, lest I rend you, past hope of deliverance. \bibverse{23}
Those who bring a thank-offering honour me; but to those: who follows my
way, I will show the salvation of God.''
\hypertarget{psalm-51-god-be-merciful-to-me-the-sinner}{%
\subsection{Psalm 51 --- God be Merciful to Me, the
Sinner}\label{psalm-51-god-be-merciful-to-me-the-sinner}}
\hypertarget{section-50}{%
\section{51}\label{section-50}}
For the leader. A psalm of David, when Nathan the prophet come to him
after he had been with Bathsheba. \bibverse{1} In your kindness, O God,
be gracious to me, in your own great pity blot out my transgressions.
\bibverse{2} Wash me clean of my guilt, make me pure of my sin.
\bibverse{3} For well I know my transgressions, my sin is ever before
me. \bibverse{4} Against you, only you, have I sinned, and done that
which is wrong in your sight: you therefore are just when you speak, and
clear when you utter judgement. \bibverse{5} See! In guilt was I brought
to the birth, and in sin did my mother conceive me. \bibverse{6} It's
the innermost truth you desire, give me therefore true wisdom of heart.
\bibverse{7} Purge me clean with hyssop, wash me whiter than snow.
\bibverse{8} Fill me with joy and gladness, let the bones you have
broken rejoice. \bibverse{9} Hide your face from my sins, and blot out
my guilt altogether. \bibverse{10} Create me a clean heart, O God, put a
new steadfast spirit within me. \bibverse{11} Cast me not forth from
your presence, withdraw not your holy spirit. \bibverse{12} Give me back
the joy of your help, with a willing spirit sustain me. \bibverse{13} I
will teach your ways to transgressors, and sinners shall turn to you.
\bibverse{14} Save me from blood, O God, and my tongue shall ring out
your faithfulness. \bibverse{15} Open my lips, O Lord, and my mouth
shall declare your praise. \bibverse{16} For in sacrifice you have no
pleasure, in gifts of burnt-offering no delight. \bibverse{17} The
sacrifice pleasing to God is a spirit that is broken; a heart that is
crushed, O God, you will not despise. \bibverse{18} Do good in your
pleasure to Zion, build the walls of Jerusalem. \bibverse{19} Then will
you welcome the due forms of sacrifice, then on your altars shall
bullocks be offered.
\hypertarget{psalm-52-the-doom-of-arrogance}{%
\subsection{Psalm 52 --- The Doom of
Arrogance}\label{psalm-52-the-doom-of-arrogance}}
\hypertarget{section-51}{%
\section{52}\label{section-51}}
For the leader. A maskil of David, when Doeg the Edomite came and told
Saul that David had gone to Abimelech's house. \bibverse{1} Why glory in
mischief, you hero? God's kindness is all the day. \bibverse{2}
Engulfing ruin you plot, your tongue like a razor sharpened, you
practiser of deceit. \bibverse{3} Evil, not good, you love, and
falsehood, not words of truth. Selah \bibverse{4} But you love all words
that devour, and a tongue that is given to deceit. \bibverse{5} But God,
on his part, shall destroy you forever, grasp you and pluck you out of
your tent, and root you out of the land of the living. Selah
\bibverse{6} Smitten with awe at the sight, the righteous shall laugh at
you. \bibverse{7} ``Look'' (they will say) ``at the hero who did not
make God his stronghold, but trusted in his great wealth and in the
strength of his riches.'' \bibverse{8} But I am like a fresh olive-tree
in the house of God. I trust in the kindness of God for ever and
evermore. \bibverse{9} I will render you thanks for ever for what you
have done. I will tell how good you are in the presence of those who
love you.
\hypertarget{psalm-53-the-folly-of-denying-god}{%
\subsection{Psalm 53 --- The Folly of Denying
God}\label{psalm-53-the-folly-of-denying-god}}
\hypertarget{section-52}{%
\section{53}\label{section-52}}
For the leader. On mahalath. A maskil of David. \bibverse{1} Fools say
in their heart, ``There is no God.'' Vile, hateful their life is; not
one does good. \bibverse{2} From heaven God looks out on humans, to see
if any are wise, and care for God. \bibverse{3} But all have turned bad,
the taint is on all; not one does good, no, not one. \bibverse{4} Have
they learnt their lesson, those workers of evil? Who ate up my people,
eating, devouring, never calling to the Lord. \bibverse{5} Sore afraid
will they be, where no fear was; when God scatters the bones of the
godless people. They will be put to shame, when God rejects them.
\bibverse{6} If only help from Zion would come for Israel! When God
brings his people a change of fortune, how glad will be Jacob, and
Israel how joyful!
\hypertarget{psalm-54-a-prayer-for-deliverance-from-oppression}{%
\subsection{Psalm 54 --- A Prayer for Deliverance from
Oppression}\label{psalm-54-a-prayer-for-deliverance-from-oppression}}
\hypertarget{section-53}{%
\section{54}\label{section-53}}
For the leader. With stringed instruments. A maskil of David, when the
Ziphites came and said to Saul, `David is in hiding amongst us'.
\bibverse{1} Save me, O God, by your name, by your power secure for me
justice. \bibverse{2} Listen, O God, to my prayer, give ear to the words
of my mouth. \bibverse{3} For proud men have risen against me, and
terrible men seek my life, men who do not set God before them. Selah
\bibverse{4} But see! God is my helper, the Lord is sustaining my life.
\bibverse{5} Let their evil fall back on my foes: cut them off in your
faithfulness, Lord. \bibverse{6} Then will I bring you glad sacrifice,
praising your gracious name; \bibverse{7} for from all distress you have
saved me, and feasted my eyes on my foes.
\hypertarget{psalm-55-betrayed-by-a-friend}{%
\subsection{Psalm 55 --- Betrayed by a
Friend}\label{psalm-55-betrayed-by-a-friend}}
\hypertarget{section-54}{%
\section{55}\label{section-54}}
For the leader. With stringed instruments. A maskil of David.
\bibverse{1} Listen, God, to my prayer. Don't hide yourself from my
pleading. \bibverse{2} Hear me, and answer; for bitter is my lament.
\bibverse{3} I am wild with the noise of the foe, with the clamour of
the ungodly; for they hurl disaster upon me, and attack me with fury.
\bibverse{4} My heart shudders within me, terrors of deaths press on me,
\bibverse{5} fear and trembling attack me, and horror wraps me round.
\bibverse{6} O for the wings of a dove: I would fly away and rest.
\bibverse{7} I would wander far away, find refuge in the wilderness.
Selah \bibverse{8} I would find myself a shelter from raging wind and
tempest. \bibverse{9} Confuse them, Lord, upset their plans; for I see
violence and strife in the city. \bibverse{10} By day and by night they
make their rounds on the city walls, while within is crime and trouble,
\bibverse{11} within is ruin. Her market-place is never free of deceit
and tyranny. \#\# The Treacherous Friend \bibverse{12} The taunts were
not those of a foe that I could have borne; the disdain was not that of
an enemy I could have shunned them: \bibverse{13} but it was you, my
equal, my dear and familiar friend. \bibverse{14} We used to be so
close, together we walked in God's house with the crowd. \bibverse{15}
May death suddenly take them, may they go down to Sheol alive, for evil
lives in their homes and their hearts. \bibverse{16} But I will call on
God, the Lord will save me. \bibverse{17} Evening and morning and noon I
lament and moan. He will hear my voice; \bibverse{18} though I am
attacked by many he will rescue me, unharmed from the war. \bibverse{19}
God, who sits on his ancient throne will hear and will humble them, for
they never change, they never fear God. Selah \bibverse{20} My friend
turned against me, betrayed his word. \bibverse{21} His mouth was
smoother than butter, but war filled his heart. His words were softer
than oil, but sharper than swords. \bibverse{22} Cast your burden on the
Lord, and he will sustain you. He will never let the righteous be
shaken. \bibverse{23} But you, God, will hurl them down to the deepest
pit. Bloody and treacherous people will not live out half their days;
but I will trust you.
\hypertarget{psalm-56-a-prayer-of-trust-in-god}{%
\subsection{Psalm 56 --- A Prayer of Trust in
God}\label{psalm-56-a-prayer-of-trust-in-god}}
\hypertarget{section-55}{%
\section{56}\label{section-55}}
For the leader. On jonath elem rehokim. Of David. A michtam, when the
Philistines seized him in Gath. \bibverse{1} O God, be gracious to me,
for people trample upon me, all the day righting and pressing me.
\bibverse{2} All the day enemies trample me; many there be who contend
with me bitterly. \bibverse{3} In the day of my terror I trust in you.
\bibverse{4} In God I maintain my cause, in God I fearlessly trust. What
can flesh do to me? \bibverse{5} They torture me all the day, they
ceaselessly plan to hurt me, \bibverse{6} banded together in secret,
watching my every step, as those who hope for my death. \bibverse{7} Pay
them out for their sin, O God, hurl down the strong in your anger.
\bibverse{8} You yourself count my wanderings. Put in your bottle my
tears are they not in your book? \bibverse{9} Then shall my foes be
turned back in the day that I call. Of this I am sure, because God is
for me. \bibverse{10} In God I maintain my cause, in the Lord I maintain
my cause. \bibverse{11} In God I fearlessly trust, what can people do to
me? \bibverse{12} Your vows are upon me, O God, I will render
thank-offerings to you; \bibverse{13} because you have saved me from
death, my feet from stumbling, to the end that I walk before God in the
light of the living.
\hypertarget{psalm-57-a-prayer-for-protection-from-persecution}{%
\subsection{Psalm 57 --- A Prayer for Protection from
Persecution}\label{psalm-57-a-prayer-for-protection-from-persecution}}
\hypertarget{section-56}{%
\section{57}\label{section-56}}
For the leader. Al tashheth. A michtam of David, when he fled from Saul
into a cave. \bibverse{1} Be gracious, O God, be gracious to me, for in
you I take shelter. In your sheltering wings I take refuge, till ruin be
over past. \bibverse{2} I cry to the Most High God, to the God who
accomplishes for me. \bibverse{3} He will send me his succour from
heaven, he will thrust away those who would trample me. Selah
\bibverse{4} In the midst of lions I lie, who devour human prey. Their
teeth are spears and arrows, and their tongue is a sharpened sword.
\bibverse{5} Be exalted, God, o'er the heavens, and your glory o'er all
the earth. \bibverse{6} They set a net for my feet, but in it was their
own foot caught. Before me they dug a pit, but they fell into it
themselves. Selah \bibverse{7} My heart is steadfast, O God, my heart is
steadfast. I would sing, I would make music; \bibverse{8} awake, my
soul. Awake, harp and lyre; I would wake the dawn. \bibverse{9} I would
praise you amongst the peoples, O Lord, and make music amongst the
nations to you; \bibverse{10} for great to heaven is your love, and your
faithfulness to the clouds. \bibverse{11} Be exalted, God, o'er the
heavens, and your glory o'er all the earth.
\hypertarget{psalm-58-a-prayer-for-vengeance-on-unjust-judges}{%
\subsection{Psalm 58 --- A Prayer for Vengeance on Unjust
Judges}\label{psalm-58-a-prayer-for-vengeance-on-unjust-judges}}
\hypertarget{section-57}{%
\section{58}\label{section-57}}
For the leader. Al tashheth. Of David. A michtam. \bibverse{1} Do you
speak what is right, you gods? With equity judge you your people?
\bibverse{2} In the land you practise iniquity --- all of you; violence
do you dispense with your hands. \bibverse{3} The wicked go astray from
the womb liars take the wrong path from their birth. \bibverse{4} Venom
have they like the venom of snakes, they are like the deaf adder that
stops her ears, \bibverse{5} and refuses to listen to the voice of the
charmer, or binder of spells, no matter how cunning. \bibverse{6} O God,
break to pieces the teeth in their mouth, tear out the great teeth of
the young lions, Lord. \bibverse{7} May they melt away like running
water! Like tender grass, cut down may they be! \bibverse{8} Like the
snail that dissolves on its crawling path, like the birth untimely which
sees not the sunlight. \bibverse{9} Faster than a thorn-fire heats your
pots, he will come with his tempest and sweep them away. \bibverse{10}
The sight of such vengeance will gladden the righteous; their feet they
will wash in the blood of the wicked. \bibverse{11} People will say,
``Yes, the just are rewarded: yes, on the earth is a God who is Judge.''
\hypertarget{psalm-59-a-prayer-for-safety}{%
\subsection{Psalm 59 --- A Prayer for
Safety}\label{psalm-59-a-prayer-for-safety}}
\hypertarget{section-58}{%
\section{59}\label{section-58}}
For the leader. Al tashheth. Of David. A michtam, when Saul sent men to
watch his house in order to kill him. \bibverse{1} Save me, O God, from
my enemies; secure me from my assailants. \bibverse{2} Save me from
those who do wrong, save me from the bloodthirsty. \bibverse{3} For see!
They lay ambush for me, strong men are banded against me not for sin or
transgression of mine, for no guilt of mine, O Lord, \bibverse{4} they
run and make ready. Awake! Come forth to meet me, and see! \bibverse{5}
You, O Lord of hosts, God of Israel, awake! And punish the proud, every
one; spare none of the traitors vile. Selah \bibverse{6} At evening they
come, and, howling like dogs, make their round in the city. \bibverse{7}
Look at their venomous mouths, tongues like swords, they think no one
hears them. \bibverse{8} But you, Lord, laugh at them, you mock all the
insolent. \bibverse{9} My strength, I will sing to you, for God is my
sure retreat. \bibverse{10} My God with his love will meet me, and feast
my eyes on my foes. \bibverse{11} Slay them not, lest my people forget,
let your hosts keep them roaming and wandering. \bibverse{12} In their
sinful speech snare them, O Lord; and may they be trapped in their
pride, for the curses and lies that they utter. \bibverse{13} In your
wrath make a clean end of them, that people, to the ends of the earth,
may know that God rules in Jacob. Selah \bibverse{14} At evening they
come, and, howling like dogs, make their round in the city.
\bibverse{15} They roam about for a feast, and snarl, if they get not
their fill. \bibverse{16} But I will sing of your might; I will ring out
your love in the morning. For to me you have been a sure refuge, a
retreat in the day of my trouble. \bibverse{17} My strength, I will sing
praise to you, for God is my sure retreat, my faithful God.
\hypertarget{psalm-60-a-prayer-after-defeat-in-battle}{%
\subsection{Psalm 60 --- A Prayer after Defeat in
Battle}\label{psalm-60-a-prayer-after-defeat-in-battle}}
\hypertarget{section-59}{%
\section{60}\label{section-59}}
For the leader. On shushan eduth. A michtam of David (for teaching),
when he fought with Aram-naharaim and Aram-zobah, and Joab returned and
defeated twelve thousand Edomites in the Valley of Salt. \bibverse{1} O
God, you have spurned and broken us, routing us in your wrath ---
restore us! \bibverse{2} You have shaken the land and cleft it; heal its
tottering breaches. \bibverse{3} You have made your people drink
hardship, and given us wine of reeling. \bibverse{4} You have given
those who fear you a banner, a rallying-place from the bow, Selah
\bibverse{5} for the rescue of your beloved. Save by your right hand and
answer us. \bibverse{6} God did solemnly swear: ``As victor will I
divide Shechem, and mete out the valley of Succoth. \bibverse{7} Mine is
Gilead, mine is Manasseh, Ephraim is the defence of my head, Judah my
sceptre of rule, \bibverse{8} Moab the pot that I wash in, Edom --- I
cast my shoe over it, I shout o'er Philistia in triumph.'' \bibverse{9}
O to be brought to the fortified city! O to be led into Edom!
\bibverse{10} Have you not spurned us, O God? You do not march forth
with our armies. \bibverse{11} Grant us help from the foe, for human
help is worthless. \bibverse{12} With God we shall yet do bravely: he
himself will tread down our foes.
\hypertarget{psalm-61-our-god-is-a-strong-tower}{%
\subsection{Psalm 61 --- Our God is a Strong
Tower}\label{psalm-61-our-god-is-a-strong-tower}}
\hypertarget{section-60}{%
\section{61}\label{section-60}}
For the leader. On stringed instruments. Of David. \bibverse{1} Hear my
cry, O God, be attentive to my prayer. \bibverse{2} From the ends of the
earth I call unto you, when my heart is faint: lead me to the rock that
is high above me. \bibverse{3} For you are a refuge to me, a strong
tower in face of the foe. \bibverse{4} O to be guest in your tent
forever, hiding beneath your sheltering wings! Selah \bibverse{5} For
you, O God, do hear my vows, and grant the desires of those who fear
you. \bibverse{6} Add many days to the life of the king; may his years
endure throughout all generations. \bibverse{7} In the presence of God
be he throned forever; may kindness and faithfulness watch over him.
\bibverse{8} And I will sing praise to your name forever, paying my vows
day after day.
\hypertarget{psalm-62-quietness-and-confidence}{%
\subsection{Psalm 62 --- Quietness and
Confidence}\label{psalm-62-quietness-and-confidence}}
\hypertarget{section-61}{%
\section{62}\label{section-61}}
For the leader. On jeduthun. A psalm of David. \bibverse{1} I wait alone
in silence for God; From him comes my help. \bibverse{2} Yes, he is my
rock, my help, my retreat, I shall not be shaken too sorely.
\bibverse{3} How long will you, all of you, batter a man, as one might a
leaning wall? \bibverse{4} From his height they are planning to topple
him. They take pleasure in falsehood; they bless with their mouth, but
inwardly they curse. Selah \bibverse{5} I wait alone in silence for God;
for from him comes my hope. \bibverse{6} Yes, he is my rock, my help, my
retreat, I shall not be shaken too sorely. \bibverse{7} On God rests my
honour and safety, in God is my strong rock, my refuge. \bibverse{8}
Trust in him, all you people assembled, pour out your heart in his
presence; God is a refuge for us. Selah \bibverse{9} The lowly are
nought but a breath, the lofty are but an illusion: in the balances up
they go, they are lighter than breath altogether. \bibverse{10} Trust
not in gain of extortion, set no vain hopes in robbery. As for wealth,
if it bears fruit, set not your heart upon it. \bibverse{11} One thing
God has uttered, two things there are which I heard that power belongs
to God, \bibverse{12} and to you, too, O Lord, belongs kindness; for you
requite each person according to what they have done.
\hypertarget{psalm-63-athirst-for-god}{%
\subsection{Psalm 63 --- Athirst for
God}\label{psalm-63-athirst-for-god}}
\hypertarget{section-62}{%
\section{63}\label{section-62}}
A psalm of David, when he was in the wilderness of Judah. \bibverse{1} O
God, my God, you, you do I seek: my heart thirsts for you, my body
faints for you in a parched and waterless land. \bibverse{2} As I in the
temple have seen you, beholding your power and your glory, \bibverse{3}
for better than life is your kindness: my lips shall utter your praise.
\bibverse{4} So, while I live, I will bless you, and lift up my hands in
your name. \bibverse{5} As with marrow and fat am I feasted; with joyful
lips I will praise you. \bibverse{6} I call you to mind on my bed, and
muse on you in the night watches; \bibverse{7} for you have been my
help, I joyfully sing in the shadow of your wings. \bibverse{8} I cling
close after you, your right hand holds me up. \bibverse{9} But those who
seek after my life shall go down to the depths of the earth,
\bibverse{10} given o'er to the power of the sword, or as prey for
jackals to devour. \bibverse{11} But the king shall rejoice in God: all
who own his allegiance will glory. For the mouth of the false shall be
stopped.
\hypertarget{psalm-64-a-prayer-for-deliverance-from-malicious-foes}{%
\subsection{Psalm 64 --- A Prayer for Deliverance from Malicious
Foes}\label{psalm-64-a-prayer-for-deliverance-from-malicious-foes}}
\hypertarget{section-63}{%
\section{64}\label{section-63}}
For the leader. A psalm of David. \bibverse{1} Hear, O my God, the voice
of my lament: guard my life from the foe who affrights me. \bibverse{2}
Hide me from villains who secretly plot, from the blustering throng of
the workers of evil, \bibverse{3} who have sharpened their tongue like a
sword, and aimed bitter words like arrows, \bibverse{4} which from
ambush they launch at the blameless, shooting swiftly and unafraid.
\bibverse{5} They strengthen their wicked purpose, they tell of the
snares they have hidden, they say to themselves, ``Who can see?''
\bibverse{6} They think out their crimes full cunningly hidden deep in
their crafty hearts. \bibverse{7} But God with his arrow will shoot
them, swiftly shall they be smitten. \bibverse{8} For their tongue he
will bring them to ruin, all will shudder with horror at the sight of
them. \bibverse{9} Then every person, touched to awe, as they ponder
what God has wrought, will tell the tale of his deeds. \bibverse{10} In
the Lord shall the righteous rejoice, in him shall they take refuge; and
all the true-hearted shall glory.
\hypertarget{psalm-65-hymn-for-a-thanksgiving-festival}{%
\subsection{Psalm 65 --- Hymn for a Thanksgiving
Festival}\label{psalm-65-hymn-for-a-thanksgiving-festival}}
\hypertarget{section-64}{%
\section{65}\label{section-64}}
For the leader. A psalm of David. A song. \bibverse{1} It is seemly to
praise you, O God, in Zion, and to you shall the vow be performed in
Jerusalem. \bibverse{2} O you who hear prayer, unto you shall all flesh
come. \bibverse{3} Our sins are too mighty for us, our transgressions
you only can cover them. \bibverse{4} Happy the person who you choose to
live beside you in your courts. O may we be filled with the joys of your
house, of your holy temple. \bibverse{5} In dread deeds you loyally
answer us, O God of our salvation, whom all ends of the earth put their
trust in, and islands far away. \bibverse{6} By your strength you
establish the hills, you are armed with might; \bibverse{7} you still
the roaring of seas, and the turmoil of nations, \bibverse{8} so that
those who live at earth's bounds are awed at your signs: the lands of
the sunrise and sunset you make to ring with joy. \bibverse{9} You visit
and water the earth; you greatly enrich her with the river of God, which
is full of water. You prepare the corn thereof, \bibverse{10} watering
her furrows, settling her ridges; you make her soft with showers, and
bless what grows thereon. \bibverse{11} You crown the year with your
goodness, your chariot-tracks drip with fatness. \bibverse{12} The
desert pastures are lush, the hills greened with joy. \bibverse{13} The
meadows are clothed with flocks, the valleys are covered with corn; they
shout to each other and sing.
\hypertarget{psalm-66-thanksgiving-for-national-deliverance}{%
\subsection{Psalm 66 --- Thanksgiving for National
Deliverance}\label{psalm-66-thanksgiving-for-national-deliverance}}
\hypertarget{section-65}{%
\section{66}\label{section-65}}
For the leader. A song. A psalm. \bibverse{1} Shout to God, all the
earth, \bibverse{2} sing praise to his glorious name, sing his glorious
praise. \bibverse{3} Say to God, ``How dread are your works, so great is
your might that your enemies cringe to you. \bibverse{4} All the earth
does homage to you, singing praises to you, singing praise to your
name.'' Selah \bibverse{5} Come and see what God has done, awe-inspiring
is he in his works amongst people. \bibverse{6} He turns the sea into
dry land, and people cross the river on foot. Let us therefore rejoice
in him, \bibverse{7} the mighty Ruler eternal, whose eyes keep watch on
the nations, that no rebel lift up his head. Selah \bibverse{8} O bless
our God, you peoples; sound aloud his praise, \bibverse{9} who keeps us
in life, and keeps our feet from slipping. \bibverse{10} For you, God,
have tested us, have tried us, as silver is tried. \bibverse{11} You did
bring us into prison, and put chains upon us, \bibverse{12} you did let
people ride over our head. We went through fire and through water, but
you led us out to a spacious place. \bibverse{13} I will enter your
house with burnt-offerings, I will pay to you my vows, \bibverse{14}
which my open lips have uttered, arid my mouth has declared in my
straits. \bibverse{15} I will offer you offerings of fatlings, with the
odour of burning rams, I will sacrifice bullocks with goats. Selah
\bibverse{16} Come and hear my story all who fear God --- of what he has
done for me. \bibverse{17} For my mouth had no sooner invoked him than
his praise was under my tongue. \bibverse{18} Had I cherished sin in my
heart, the Lord would never have listened. \bibverse{19} But assuredly
God has listened, and attended to my loud prayer. \bibverse{20} Blessed
be God, who turned not aside my prayer, nor withdrew his kindness from
me.
\hypertarget{psalm-67-a-harvest-thanksgiving}{%
\subsection{Psalm 67 --- A Harvest
Thanksgiving}\label{psalm-67-a-harvest-thanksgiving}}
\hypertarget{section-66}{%
\section{67}\label{section-66}}
For the leader. On stringed instruments. A psalm. A song. \bibverse{1}
Bless us, O God, with your favour, let the light of your face fall upon
us; Selah \bibverse{2} that the world may know your way, and all nations
your power to save. \bibverse{3} Let the peoples praise you, O God; let
the peoples all of them praise you. \bibverse{4} Let the nations ring
out their joy; for you govern the peoples with equity, and guide the
nations on earth. Selah \bibverse{5} Let the peoples praise you, O God,
let the peoples, all of them, praise you. \bibverse{6} The earth has
yielded her increase by the blessing of God, our God. \bibverse{7} May
this blessing of ours win people to him to all the ends of the earth.
\hypertarget{psalm-68-victory}{%
\subsection{Psalm 68 --- Victory}\label{psalm-68-victory}}
\hypertarget{section-67}{%
\section{68}\label{section-67}}
For the leader. Of David. A psalm. A song. \bibverse{1} God arises, his
enemies scatter: they who hate him flee before him. \bibverse{2} As
smoke before wind is driven, as wax melts before fire, so before God
vanish the wicked. \bibverse{3} But the righteous rejoice in God's
presence, they exult with exceeding joy. \bibverse{4} Sing to God, make
music to his name, his name is the Lord, praise him who rides on the
clouds, and exult in his presence. \bibverse{5} Father of orphans,
defender of widows, is God in his holy abode. \bibverse{6} God brings
home the lonely, he leads forth the prisoner to comfort, so that none
but the rebel lives cheerless. \bibverse{7} God, when you went in front
of your people in your march through the desert, Selah \bibverse{8}
earth shook, the heavens poured rain at the presence of God, Sinai's God
at the presence of God, Israel's God. \bibverse{9} Rain in abundance,
God, you did sprinkle, restoring the languishing land of your heritage.
\bibverse{10} A dwelling therein your people found: in your goodness, O
God, you did care for the poor. \bibverse{11} The Lord spoke the glad
tidings of victory, a great army of women proclaim it: \bibverse{12}
``Kings of armies they flee, they flee, and the housewife divides the
spoil: \bibverse{13} dove's wings covered with silver and pinions with
shimmer of gold, \bibverse{14} set with stones, like snow upon Zalmon.''
\bibverse{15} A mountain of God is the mountain of Bashan, a mountain of
peaks is the mountain of Bashan. \bibverse{16} You high-peaked
mountains, why look you askance at the mountain which God has desired
for his home whereon the Lord will live forever? \bibverse{17} The
chariots of God are twice ten thousand: the Lord came from Sinai, his
holy place. \bibverse{18} You did mount the height with trains of your
captives, and gifts that you had received from the people. The rebels
shall live with the Lord God. \bibverse{19} Blest be the Lord who
sustains us daily, the God who is also our saviour. Selah \bibverse{20}
Our God is a God who is saviour. The ways of escape from death are known
to the Lord God. \bibverse{21} Yes, God will shatter the head of his
foes the rough scalp of those who strut on in their sins. \bibverse{22}
The Lord said: ``I will bring you home from Bashan, home from the depths
of the sea, \bibverse{23} that your feet you may bathe in blood, and
your dogs lick their share of the foe.'' \bibverse{24} In the temple
appear God's triumphal processions, processions in praise of my king and
my God, \bibverse{25} with singers in front, and minstrels behind, and
maidens with timbrels between them, singing, \bibverse{26} ``You of the
well-spring of Israel, bless the Lord God in the dance.'' \bibverse{27}
There, in front, is Benjamin the little, the princes of Judah beside
them, the princes of Zebulon, princes of Naphtali. \bibverse{28} God,
show your strength, your godlike might, as you did in the past,
\bibverse{29} from your temple that crowns Jerusalem. Kings shall bring
tribute to you. \bibverse{30} Rebuke the beast of the reed, the herd of
bulls, with the calves of the peoples. Trample down the lovers of lies.
Scatter the nations whose joy is in war. \bibverse{31} May they come
from Egypt with gifts of oil, Ethiopia haste with full hands to God.
\bibverse{32} Sing to God, O you kingdoms of earth, make melody to the
Lord. Selah \bibverse{33} Praise him who rides on the ancient heavens.
See! He utters his voice, his mighty voice. \bibverse{34} Ascribe
strength to the God over Israel, whose strength and majesty live in the
skies. \bibverse{35} Awe-inspiring is God in his holy place, it is
Israel's God who gives strength and might to his people. Blessed be God.
\hypertarget{psalm-69-a-prayer-for-deliverance-and-vengeance}{%
\subsection{Psalm 69 --- A Prayer for Deliverance and
Vengeance}\label{psalm-69-a-prayer-for-deliverance-and-vengeance}}
\hypertarget{section-68}{%
\section{69}\label{section-68}}
For the leader. On shoshannim. Of David. \bibverse{1} Save me, O God;
for the waters are threatening my life. \bibverse{2} I am sunk in depths
of mire, where ground there is none. I am come into deep deep waters,
the flood overwhelms me. \bibverse{3} I am weary of crying, my throat is
parched, my eyes are wasted with waiting for God. \bibverse{4} More than
the hairs of my head are those who wantonly hate me. More than my bones
in number are those who are falsely my foes. That which I never robbed,
how am I then to restore? \bibverse{5} O God, you know my folly, my
guilt is not hidden from you. \bibverse{6} Through me let not any be
shamed, who wait for you, Lord God of hosts. Through me let not those be
confounded who seek you, O God of Israel. \bibverse{7} It's in your
cause that I have borne taunts, and my face has been covered with shame;
\bibverse{8} I became to my kindred a foreigner, to my mother's sons a
stranger. \bibverse{9} It was zeal for your house that consumed me, and
the insults they hurled at you fell upon me. \bibverse{10} When I
chastened myself with fasting, they took occasion to taunt me.
\bibverse{11} When I put on a garment of sackcloth, they made me the
theme of a taunt-song. \bibverse{12} Those who sit in the gate make
sport of me in the music of drunken songs. \bibverse{13} But I pray to
you, Lord, for a time of favour. In your great love answer me; with your
loyal help, save me \bibverse{14} from sinking down in the mire. Lift me
out of the deep deep waters, \bibverse{15} that the rushing flood may
not drown me, that the deep may not swallow me up, nor the pit close her
mouth upon me. \bibverse{16} Answer me, Lord, in your gracious kindness,
turn to me in your great compassion. \bibverse{17} Hide not your face
from your servant, for I am in trouble; O answer me speedily.
\bibverse{18} Draw near to me, redeem me; because of my enemies, ransom
me. \bibverse{19} You know how I am insulted; in your sight are all my
foes. \bibverse{20} Insult has broken my heart, past cure are my shame
and confusion. For pity I looked --- there was none! And for comforters,
but I found none. \bibverse{21} Poison they gave me for food, and to
slake my thirst they gave vinegar. \bibverse{22} May their table,
outspread, be a trap to them, and their peace-offerings be a snare.
\bibverse{23} May their eyes be darkened and blind, make them shake
without ceasing. \bibverse{24} Pour your indignation upon them, let your
burning wrath overtake them. \bibverse{25} May their camp be a
desolation, in their tents be there none to live. \bibverse{26} For
those whom you struck, they persecute, and those whom you wounded, they
pain yet more. \bibverse{27} Charge them with sin upon sin, may they not
be acquitted by you. \bibverse{28} From the book of life be they
blotted, may their names not be written with the righteous.
\bibverse{29} Lift me, O God, by your help above my pain and misery.
\bibverse{30} Then will I praise God in song and magnify him with
thanksgiving, \bibverse{31} which shall please the Lord better than ox,
or than bullock with horns and hoofs. \bibverse{32} The oppressed shall
rejoice at the sight. You who seek after God, let your heart revive.
\bibverse{33} For the Lord listens to the poor, he does not despise his
prisoners. \bibverse{34} Let the heavens and the earth sing his praises,
the seas, and all creatures that move in them. \bibverse{35} For God
will bring help to Zion, and build up the cities of Judah, his people
shall live there in possession. \bibverse{36} His servants' children
shall have it for heritage, and those who love him shall live therein.
\hypertarget{psalm-70-a-cry-for-help-in-persecution}{%
\subsection{Psalm 70 --- A Cry for Help in
Persecution}\label{psalm-70-a-cry-for-help-in-persecution}}
\hypertarget{section-69}{%
\section{70}\label{section-69}}
For the leader. Of David. For commemoration. \bibverse{1} Quickly, God,
deliver me, hasten to help me, Lord. \bibverse{2} May those who are
seeking my life, be ashamed and confounded. \bibverse{3} May those who
delight in my hurt be defeated and brought to dishonour. \bibverse{4}
But may all who seek after you rejoice and be glad in you. May all who
love your salvation say, ``Glory to God,'' evermore. \bibverse{5} I am
weak and needy: make haste, God, to me. You are my help and deliverer;
Lord, don't delay.
\hypertarget{psalm-71-forsake-me-not-when-i-am-old}{%
\subsection{Psalm 71 --- Forsake me not, when I am
Old}\label{psalm-71-forsake-me-not-when-i-am-old}}
\hypertarget{section-70}{%
\section{71}\label{section-70}}
\bibverse{1} In you, O Lord, I take refuge, let me never be put to
shame. \bibverse{2} In your faithfulness save me and rescue me, bend
your ear to me and save me. \bibverse{3} Be to me a rock of defence, a
fortified house, to save me; for my rock and my fortress are you.
\bibverse{4} Save me, my God, from the hand of the wicked, from the
grasp of the unjust and cruel. \bibverse{5} For you, Lord, are my hope,
in whom from my youth I have trusted. \bibverse{6} On you have I leaned
from my birth; from my mother's womb it was you who did draw me. In you
is my hope evermore. \bibverse{7} I have been as a wonder to many, for
you are my refuge and strength. \bibverse{8} All the day long my mouth
is filled with your praise and your glory. \bibverse{9} Cast me not off
in the time of old age; when my strength is spent, forsake me not.
\bibverse{10} For my foes whisper against me, they who watch me take
counsel together; \bibverse{11} ``God has left him,'' they say: ``pursue
and seize him, for he is helpless.'' \bibverse{12} O God, be not far
from me, haste, O my God, to my help. \bibverse{13} Put my foes to shame
and dishonour, with insult and shame be they covered. \bibverse{14} But
I will never stop hoping, and more and yet more will I praise you.
\bibverse{15} All the day long shall my mouth tell your faithfulness and
your salvation, though I know not how they may be counted. \bibverse{16}
I will tell of the might of the Lord, and your faithfulness praise, you
alone. \bibverse{17} You have taught me, O God, from my youth, and till
now have I told of your wonders. \bibverse{18} Even in old age and grey
hair, O God, do not forsake me. Still would I tell of your might unto
all generations to come. \bibverse{19} Your power and your justice, O
God, extend as far as the heavens: for great are the things you have
done. Who is like you, O God? \bibverse{20} You have caused us to see
troubles many, but you will revive us again. From the depths of the
earth you will bring me up again. \bibverse{21} You will multiply my
greatness, and comfort me again. \bibverse{22} So with harp I will
praise you, and your faithfulness, O my God; and make music to you on
the lyre, O you Holy One of Israel. \bibverse{23} My lips shall ring out
their joy, my mouth shall sing praises to you; all of me, which you have
redeemed. \bibverse{24} Yes, all the day long shall my tongue utter your
righteousness; for ashamed and confounded are they who were seeking my
hurt.
\hypertarget{psalm-72-a-prayer-for-a-just-and-glorious-reign}{%
\subsection{Psalm 72 --- A Prayer for a Just and Glorious
Reign}\label{psalm-72-a-prayer-for-a-just-and-glorious-reign}}
\hypertarget{section-71}{%
\section{72}\label{section-71}}
Of Solomon. \bibverse{1} Give the king, O God, your own spirit of
justice your spirit of right to the son of the king, \bibverse{2} that
with right he may judge your people, and your downtrodden ones with
justice. \bibverse{3} May the mountains bear weal for the people, and
the hills yield fruits of justice. \bibverse{4} The weak may he help to
their rights, may he save the sons of the needy and crush the oppressor
in pieces. \bibverse{5} May he live as long as the sun, while the moon
shines --- for ages and ages. \bibverse{6} May he be like the rain on
the meadow, like showers that water the earth. \bibverse{7} In his days
may justice flourish, and welfare abound, till the moon be no more.
\bibverse{8} May he reign from ocean to ocean, from the river to the
ends of the earth. \bibverse{9} May his foes bow down before him, his
enemies lick the dust. \bibverse{10} May tribute be rendered by kings of
the isles and of Tarshish; may gifts be brought by the kings of Sheba
and Seba. \bibverse{11} May all kings fall prostrate before him, and all
nations yield him their service. \bibverse{12} For he saves the poor
when he cries, the helpless and the downtrodden. \bibverse{13} He pities
the weak and the poor, he saves the lives of the poor. \bibverse{14} He
redeems them from wrong and from violence, for dear is their blood in
his sight. \bibverse{15} Long may he live; and may gold of Sheba be
given him; prayer, too, be made for him ceaselessly, all the day long
may men bless him. \bibverse{16} May the land have abundance of corn, to
the tops of the hills may it wave. May the fruit thereof flourish like
Lebanon, may men spring from the city like grass of the earth.
\bibverse{17} May his name be blessed forever, may his fame endure as
the sun. May all nations envy his blessedness, all tribes of the earth
call him happy. \bibverse{18} Blest be the Lord God, Israel's God, who
alone does wonders; \bibverse{19} And blest be forever his glorious
name. Let all the earth be filled with his glory. Amen and Amen.
\bibverse{20} Here end the prayers of David, son of Jesse.
\hypertarget{book-three}{%
\subsection{Book Three}\label{book-three}}
\hypertarget{section-72}{%
\section{73}\label{section-72}}
\hypertarget{psalm-73-fellowship-with-god-here-and-hereafter}{%
\subsection{Psalm 73 --- Fellowship with God Here and
Hereafter}\label{psalm-73-fellowship-with-god-here-and-hereafter}}
A psalm of Asaph. \bibverse{1} Yes, God is good to the upright, the Lord
to the pure in heart. \bibverse{2} But my feet were almost gone, my
steps had nearly slipped, \bibverse{3} through envy of godless
braggarts, when I saw how well they fared. \bibverse{4} For never a pang
have they, their body is sound and sleek. \bibverse{5} They have no
trouble like mortals, no share in human pain. \bibverse{6} So they wear
their pride like a necklace, they put on the garment of wrong,
\bibverse{7} their eyes stand out with fatness, their heart swells with
riotous fancies. \bibverse{8} Their speech is mocking and evil,
condescending and crooked their speech. \bibverse{9} They have set their
mouth in the heavens, while their tongue struts about on the earth.
\bibverse{10} Small wonder that people resort to them, and drink deep
draughts of their lore. \bibverse{11} ``How does God know?'' they say,
``And has the Most High any knowledge?'' \bibverse{12} See! These are
the godless, with wealth and ease ever increasing. \bibverse{13} Yes, in
vain have I kept my heart pure, and washed my hands in innocence;
\bibverse{14} for all the day long was I plagued not a morning but I was
chastised. \bibverse{15} But to resolve to speak like they do would be
treachery to your children. \bibverse{16} So I sought to understand it,
but a wearisome task it seemed: \bibverse{17} till I entered the holy
world of God and saw clearly their destiny. \bibverse{18} Yes, you set
them on slippery places; down to destruction you hurl them.
\bibverse{19} One moment and then what a horror of ruin! They are
finished and ended in terrors. \bibverse{20} Like a dream, when one
wakes, shall they be, whose phantoms the waker despises. \bibverse{21}
So my bitterness of mind and the pain that stabbed my heart
\bibverse{22} show how dull I was and stupid just like a beast before
you. \bibverse{23} But I am always with you, you have hold of my right
hand. \bibverse{24} By a plan of yours you guide me and will afterward
take me to glory. \bibverse{25} Whom have I in the heavens but you? And
on earth there is none I desire beside you. \bibverse{26} Though flesh
and heart waste away, yet God is the rock of my heart, yet God is my
portion forever. \bibverse{27} For see! Those who are far from you must
perish, you destroy all who are false to you. \bibverse{28} But I am
happy when close to God; the Lord my God I have made my refuge, that I
may recount all the things you have done.
\hypertarget{psalm-74-lament-on-the-devastation-of-the-temple}{%
\subsection{Psalm 74 --- Lament on the Devastation of the
Temple}\label{psalm-74-lament-on-the-devastation-of-the-temple}}
\hypertarget{section-73}{%
\section{74}\label{section-73}}
A maskil of Asaph. \bibverse{1} Why, O God, have you spurned us forever?
Why smokes your wrath against the sheep of your pasture? \bibverse{2}
Remember the community you purchased of old to become by redemption the
tribe of your heritage, Zion, the mountain you made your home.
\bibverse{3} Rouse yourself, visit its ruins complete. In the temple the
foe has made havoc of all things. \bibverse{4} Like lions your enemies
roared through your house, replacing our symbols by signs of their own,
\bibverse{5} hacking, like woodsmen who lift axes on thickets of trees,
\bibverse{6} smashing with hatchets and hammers all of its carved work
together. \bibverse{7} They have set your temple on fire, to the very
ground they have outraged the place where lives your name. \bibverse{8}
They have said in their heart, ``Let us utterly crush them.'' They have
burnt all the houses of God in the land. \bibverse{9} No symbol of ours
do we see any more: no prophet is there any more, none is with us who
knows how long. \bibverse{10} How long, O God, is the foe to insult?
Shall the enemy spurn your name forever? \bibverse{11} Why, O Lord, do
you hold back your hand, why keep your right hand in the folds of your
robe? \bibverse{12} Yet God is our king from the ancient days, in the
midst of the earth working deeds of salvation. \bibverse{13} It was you
who did cleave the sea by your might, and shatter the heads of the ocean
monsters. \bibverse{14} It was you who did crush many-headed Leviathan,
and give him as food to the beasts of the wilderness. \bibverse{15} It
was you who did cleave the fountains and torrents; it was you who did
dry the perennial streams. \bibverse{16} Yours is the day; yours, too,
is the night, it was you who did establish the sun and the star.
\bibverse{17} It was you who did fix all the borders of earth: summer
and winter it's you who have made them. \bibverse{18} Yet, for all this,
the foe has insulted you, Lord, and a nation of fools has reviled your
name. \bibverse{19} Do not give your dove to the beasts, do not forget
your afflicted forever. \bibverse{20} Look to the sleek ones - how full
they are: the dark places of earth are the dwellings of violence.
\bibverse{21} O let not the downtrodden turn back ashamed: let the poor
and the needy sing praise to your name. \bibverse{22} Arise, God, and
defend your cause: remember how fools all the day insult you.
\bibverse{23} Do not forget the uproar of your enemies, the din of your
foes that ascends evermore.
\hypertarget{psalm-75-god-the-judge}{%
\subsection{Psalm 75 --- God the Judge}\label{psalm-75-god-the-judge}}
\hypertarget{section-74}{%
\section{75}\label{section-74}}
For the leader; al tashheth. A psalm of Asaph, a song. \bibverse{1} We
praise you, God, we praise you: we would call on your name and declare
your wonders. \bibverse{2} ``At the time I choose, I will judge fairly.
\bibverse{3} Though earth melt and all her inhabitants, it is I who keep
steady her pillars.'' Selah \bibverse{4} I say to the boasters, ``Boast
not''; to the wicked, ``Lift not up your horn: \bibverse{5} lift not
your horn on high, speak not boldly against the Rock.'' \bibverse{6} For
not from east nor west, not from desert nor mountains; \bibverse{7} but
God himself is the judge, humbling one and exalting another.
\bibverse{8} In the hand of the Lord is a cup foaming wine, richly
spiced. Out of this he pours a draught, and all the wicked of earth must
drain it down to the dregs. \bibverse{9} But I will rejoice forever,
singing praise to the God of Jacob. \bibverse{10} I will hew all the
horns of the wicked, but the horns of the just shall be lifted.
\hypertarget{psalm-76-a-song-of-victory}{%
\subsection{Psalm 76 --- A Song of
Victory}\label{psalm-76-a-song-of-victory}}
\hypertarget{section-75}{%
\section{76}\label{section-75}}
For the leader. With instrumental music. A psalm of Asaph, a song.
\bibverse{1} God has made himself known in Judah, his name is great in
Israel. \bibverse{2} His tent is in Salem, his dwelling in Zion.
\bibverse{3} There he broke the lightning arrows, shield, sword, and
weapons of war. Selah \bibverse{4} Terrible is your splendour on the
everlasting mountains. \bibverse{5} Despoiled were the stout of heart;
in the sleep into which they had fallen, none of the warriors could lift
a hand. \bibverse{6} At your rebuke, God of Jacob, sank chariot and
horse to sleep. \bibverse{7} Awful are you: who can stand before you,
when once you are angry? \bibverse{8} The judgement you gave from heaven
frightened the earth into silence, \bibverse{9} when God arose to
judgement to save the oppressed of the earth. Selah \bibverse{10} The
fiercest will praise you, to you will the remnant hold festival.
\bibverse{11} Vow and pay to Lord your God, and let all who are round
him bring presents. \bibverse{12} He lops off the courage of princes,
and with terror fills kings of the earth.
\hypertarget{psalm-77-a-prayer-for-preservation-as-in-the-days-of-old}{%
\subsection{Psalm 77 --- A Prayer for Preservation as in the Days of
Old}\label{psalm-77-a-prayer-for-preservation-as-in-the-days-of-old}}
\hypertarget{section-76}{%
\section{77}\label{section-76}}
For the leader. On Jeduthun. Of Asaph, a psalm. \bibverse{1} Loudly will
I lift my cry to God, loudly to God, so he hears to me. \bibverse{2} In
the day of my trouble I seek the Lord; in the night I lift my hands in
prayer, refusing all comfort. \bibverse{3} When I think of God, I moan;
when I muse, my spirit is faint. Selah \bibverse{4} When you hold my
eyes awake, and I am restless and speechless, \bibverse{5} I think of
the days of old, call to mind distant years. \bibverse{6} I commune with
my heart in the night, I muse with enquiring spirit. \bibverse{7} ``Will
the Lord cast us off forever, will he be gracious no more? \bibverse{8}
Has his love vanished forever? Is his faithfulness utterly gone?
\bibverse{9} Has God forgotten to be gracious, or in anger withheld his
compassion?'' Selah \bibverse{10} Then I said, ``This it is that grieves
me, that the hand of the Most High has changed.'' \bibverse{11} I will
think of the deeds of the Lord, and remember your wonders of old.
\bibverse{12} I will muse on all you have wrought, and meditate on your
deeds. \bibverse{13} Then your way, O God, was majestic: what God was
great as our God? \bibverse{14} You were a God who did marvels, you did
show your power to the world \bibverse{15} by your arm you rescued your
people, the children of Jacob and Joseph. Selah \bibverse{16} The waters
saw you, O God. The waters saw you and shivered; to their depths they
trembled. \bibverse{17} Clouds poured torrents of water, thunder rolled
in the sky, your arrows sped to and fro. \bibverse{18} Loud was the roll
of your thunder, lightnings lit up the world. Earth quaked and trembled.
\bibverse{19} In your way, Lord, through the sea, in your path through
the mighty waters, your footsteps were all unseen. \bibverse{20} You did
guide your folk like a flock by the hand of Moses and Aaron.
\hypertarget{psalm-78-the-warnings-of-history}{%
\subsection{Psalm 78 --- The Warnings of
History}\label{psalm-78-the-warnings-of-history}}
\hypertarget{section-77}{%
\section{78}\label{section-77}}
A maskil of Asaph. \bibverse{1} My people, give ear to my teaching: bend
your ears to the words of my mouth, \bibverse{2} as I open my mouth in a
poem on the riddling story of the past. \bibverse{3} What we have heard
and known, and what our ancestors have told us, \bibverse{4} we will not
hide from their children. We will tell to the next generation the
praises and might of the Lord, and the wonders that he has done.
\bibverse{5} He set up a testimony in Jacob, a law he appointed in
Israel, which he commanded our ancestors to make known to their
children, \bibverse{6} that the next generation should know it, that the
children yet to be born should arise and tell their children;
\bibverse{7} that in God they might put their confidence, and not forget
God's works; but that they might keep his commandments, \bibverse{8} and
not be like their ancestors, a generation defiant and stubborn, a
generation with heart unsteady, and spirit unfaithful towards God.
\bibverse{9} Ephraimites, armed bowmen, turned back in the day of
battle. \bibverse{10} They did not keep God's covenant, they refused to
walk in his law. \bibverse{11} They forgot what he had done, and the
wonders he had shown them. \bibverse{12} He did wonders before their
ancestors in the country of Zoan in Egypt. \bibverse{13} Through the sea
which he split he brought them, making waters stand up like a heap;
\bibverse{14} he led them by day with a cloud, all the night with a
light of fire. \bibverse{15} From the rocks which he split in the
wilderness, he gave them to drink as of ocean's abundance. \bibverse{16}
He brought streams out of the rock, and made water run down like rivers.
\bibverse{17} Yet they still went on sinning against him, they defied
the Most High in the desert. \bibverse{18} They wilfully challenged God,
demanding the food that they longed for. \bibverse{19} ``Is God able,''
such was their challenge, ``to spread in the desert a table?
\bibverse{20} From the rock that he struck there gushed water, and
torrents that overflowed; but can he also give bread, or provide his
people with meat?'' \bibverse{21} When the Lord heard this, he was
furious, and fire was kindled on Jacob, anger flared up against Israel.
\bibverse{22} For they put no trust in God, no confidence in his help.
\bibverse{23} So he summoned the clouds above; and, opening the doors of
heaven, \bibverse{24} he rained manna upon them for food, and grain of
heaven he gave them. \bibverse{25} Everyone ate the bread of angels; he
sent them food to the full. \bibverse{26} He launched the east wind in
the heavens, and guided the south by his power. \bibverse{27} He rained
meat upon them like dust, winged bird like the sand of the sea.
\bibverse{28} In the midst of their camp he dropped it, all around their
tents. \bibverse{29} They ate and were more than filled; he had brought
them the thing they desired. \bibverse{30} But the thing they desired
became loathsome: while their food was still in their mouths,
\bibverse{31} the wrath of God rose against them. He slew the stoutest
amongst them, and laid low the young men of Israel. \bibverse{32} Yet
for all this they sinned yet more, and refused to believe in his
wonders. \bibverse{33} So he ended their days in a breath, and their
years in sudden dismay. \bibverse{34} When he slew them, then they
sought after him, they turned and sought God with diligence.
\bibverse{35} They remembered that God was their rock, and the Most High
God their redeemer. \bibverse{36} But they flattered him with their
mouth, and lied to him with their tongue. \bibverse{37} Their heart was
not steady with him, they were faithless to his covenant. \bibverse{38}
But he is full of pity: he pardons sin and destroys not. Often he turns
his anger away, without stirring his wrath at all. \bibverse{39} So he
remembered that they were but flesh, breath that passes and does not
return. \bibverse{40} But how often they rebelled in the desert, and
caused him grief in the wilderness, \bibverse{41} tempting God again and
again, provoking the Holy One of Israel. \bibverse{42} They did not
remember his strength, nor the day he redeemed from the foe,
\bibverse{43} how he set his signs in Egypt, in the country of Zoan his
wonders. \bibverse{44} He turned their canals into blood, their streams
undrinkable. \bibverse{45} He sent forth flies, which devoured them;
frogs, too, which destroyed them. \bibverse{46} Their crops he gave to
the caterpillar, and the fruits of their toil to the locust.
\bibverse{47} He slew their vines with hail, and their sycamore trees
with frost. \bibverse{48} He delivered their cattle to the hail, and
their flocks to bolts of fire. \bibverse{49} He let loose his hot anger
amongst them, fury and wrath and distress, a band of destroying angels.
\bibverse{50} He cleared a path for his anger, did not spare them from
death, but gave them over to pestilence. \bibverse{51} He struck down
all the first-born in Egypt, the first fruits of their strength in the
tents of Ham. \bibverse{52} He led forth his people like sheep, he was
guide to his flock in the desert. \bibverse{53} Securely he led them,
and free from fear, while their foes were drowned in the sea.
\bibverse{54} To his holy realm he brought them, to the mountain his
right hand had purchased. \bibverse{55} He drove out the nations before
them, and allotted their land for possession, and their tents for Israel
to live in. \bibverse{56} Yet they tempted and angered the Most High
God, they did not observe his decrees. \bibverse{57} They drew back,
false like their ancestors; they failed like a treacherous bow.
\bibverse{58} Their shrines stirred him to anger, their idols moved him
to jealousy. \bibverse{59} When God heard of this, he was furious, and
he spurned Israel utterly. \bibverse{60} He abandoned his home in
Shiloh, the tent he had pitched amongst people. \bibverse{61} He gave
his strength up to captivity, his glory to the hands of the foe.
\bibverse{62} He gave his people to the sword, he was furious with his
own. \bibverse{63} Fire devoured their young men, and their maidens had
no marriage-song. \bibverse{64} Their priests fell by the sword, and
their widows could not weep. \bibverse{65} Then the Lord awoke as from
sleep, like a warrior flushed with wine; \bibverse{66} and he beat back
his foes, putting them to perpetual scorn. \bibverse{67} He disowned the
tent of Joseph, he rejected the tribe of Ephraim; \bibverse{68} but he
chose the tribe of Judah, Mount Zion, which he loves. \bibverse{69} And
he built like the heights his sanctuary, like the earth which he founded
forever. \bibverse{70} And he chose David his servant, taking him from
the sheepfolds. \bibverse{71} From the mother-ewes he brought him, to be
shepherd to Jacob his people, and to Israel his inheritance.
\bibverse{72} With upright heart did he shepherd them, and with skilful
hands did he guide them.
\hypertarget{psalm-79-a-national-prayer-for-deliverance}{%
\subsection{Psalm 79 --- A National Prayer for
Deliverance}\label{psalm-79-a-national-prayer-for-deliverance}}
\hypertarget{section-78}{%
\section{79}\label{section-78}}
A psalm of Asaph. \bibverse{1} Heathen, O God, have come into your land,
defiling your holy temple, and laying Jerusalem in ruins. \bibverse{2}
They have given the bodies of your dead servants to the birds of the air
to devour, and the flesh of your faithful to the beasts of the field.
\bibverse{3} Round about Jerusalem they have poured out their blood like
water; and there was no one to bury them. \bibverse{4} On every side our
neighbours revile us and mock us and jeer at us. \bibverse{5} How long
will you be angry, O Lord? Will your jealousy burn like fire forever?
\bibverse{6} Pour out your wrath on the nations that don't know you, on
the kingdoms that do not call on your name. \bibverse{7} For Jacob they
devoured, they have desolated his home. \bibverse{8} Do not remember
against us our ancestors' sins; O meet us soon with your pity, for
utterly weak are we. \bibverse{9} Help us, O God our saviour, for the
renown of your name: for your reputation deliver us and cover over our
sins. \bibverse{10} Why should the nations say, ``Where is their God?''
Let revenge for the outpoured blood of your servants be shown on the
heathen before our eyes. \bibverse{11} May the groans of the prisoner
come before you; free the children of death by your mighty arm.
\bibverse{12} Pay our neighbours back sevenfold for the scorn they have
heaped upon you, O Lord. \bibverse{13} Then we, your people, the flock
of your pasture, will give thanks to you for evermore, and tell your
praise to all generations.
\hypertarget{psalm-80-a-prayer-for-the-preservation-of-israel}{%
\subsection{Psalm 80 --- A Prayer for the Preservation of
Israel}\label{psalm-80-a-prayer-for-the-preservation-of-israel}}
\hypertarget{section-79}{%
\section{80}\label{section-79}}
For the leader. On shoshannim, eduth. Of Asaph, a psalm. \bibverse{1}
Listen, Shepherd of Israel, who leads Joseph like a flock of sheep; from
your throne on the cherubs shine forth \bibverse{2} before Ephraim,
Manasseh, and Benjamin. Stir up your mighty power, come to our help.
\bibverse{3} God, restore us: show us the light of your face, so we may
be saved. \bibverse{4} O Lord of hosts, how long is your anger to smoke,
despite the prayer of your people? \bibverse{5} You have fed them with
bread of tears, you have made them drink tears by the measure.
\bibverse{6} The scorn of our neighbours you make us, the laughing-stock
of our foes. \bibverse{7} God of hosts, restore us: show us the light of
your face, so we may be saved. \bibverse{8} A vine out of Egypt you
brought; you did drive out the nations, and plant her; \bibverse{9} in
the ground you did clear she struck root, and she filled all the land.
\bibverse{10} The shade of her covered the mountains, her branches the
cedars of God. \bibverse{11} She sent forth her shoots to the sea, and
her branches as far as the River. \bibverse{12} Why have you torn down
her fences, and left her to be plucked at by all who pass by,
\bibverse{13} to be gnawed by the boar from the forest, and devoured by
the beasts of the field? \bibverse{14} O God of hosts, return: look down
from heaven and see and visit this vine, and restore her \bibverse{15}
the vine which your right hand has planted. \bibverse{16} She is burnt
with fire and cut down before your stern face they are perishing.
\bibverse{17} Support the one you have chosen, the one you have raised
for yourself; \bibverse{18} then from you we will never draw back.
Preserve us, and we will call on your name. \bibverse{19} Lord, God of
hosts, restore us: Show us the light of your face, so we may be saved.
\hypertarget{psalm-81-for-the-feast-of-tabernacles}{%
\subsection{Psalm 81 --- For the Feast of
Tabernacles}\label{psalm-81-for-the-feast-of-tabernacles}}
\hypertarget{section-80}{%
\section{81}\label{section-80}}
For the leader. On the gittith. Of Asaph. \bibverse{1} Sing aloud to God
our strength, shout for joy to the God of Jacob. \bibverse{2} Raise a
song, sound the timbrel, sweet lyre and harp. \bibverse{3} On the new
moon blow the horn, at the full moon, the day of our festival.
\bibverse{4} For this is a statute for Israel, a ruling of the God of
Jacob, \bibverse{5} a witness he set up in Joseph, when he marched
against Egypt's land, where he heard an unknown voice say: \bibverse{6}
``I removed from your shoulder the burden, and freed your hands from the
basket. \bibverse{7} At your call of distress I delivered you, from the
thundercloud I answered you. At Meribah's waters I tested you. Selah
\bibverse{8} ``Listen, my people, to my warning, O Israel, if you would
but listen! \bibverse{9} There must not be a strange god amongst you,
you must bow to no foreign god. \bibverse{10} I am the Lord your God who
brought you up out of Egypt. Open your mouth, that I fill it.
\bibverse{11} ``But my people did not listen to my voice, Israel would
have none of me. \bibverse{12} So to their own hard hearts I left them,
to follow their own devices. \bibverse{13} O that my people would
listen, that Israel would walk in my ways. \bibverse{14} Soon would I
humble their enemies, and turn my hand on their foes. \bibverse{15}
Those who hate the Lord would cringe before him in everlasting terror.
\bibverse{16} But you would I feed with the richest wheat, and with
honey from the rock to your heart's desire.''
\hypertarget{psalm-82-god-the-upholder-of-justice}{%
\subsection{Psalm 82 --- God the Upholder of
Justice}\label{psalm-82-god-the-upholder-of-justice}}
\hypertarget{section-81}{%
\section{82}\label{section-81}}
A psalm of Asaph. \bibverse{1} God has taken his stand in the divine
assembly: in the midst of the gods he holds judgement. \bibverse{2}
``How long will you crookedly judge, and favour the wicked? Selah
\bibverse{3} Do right by the weak and the orphan, acquit the innocent
poor. \bibverse{4} Rescue the weak and the needy, save them from the
hand of the wicked. \bibverse{5} ``They have neither knowledge nor
insight, in darkness they walk to and fro, while the earth's foundations
totter. \bibverse{6} It was I who appointed you gods, children of the
Most High all of you. \bibverse{7} Yet like mortals you will surely die,
you will fall like any prince.'' \bibverse{8} Arise, O God, judge the
earth, for all nations are yours by inheritance.
\hypertarget{psalm-83-a-prayer-for-the-destruction-of-the-enemies-of-judah}{%
\subsection{Psalm 83 --- A Prayer for the Destruction of the Enemies of
Judah}\label{psalm-83-a-prayer-for-the-destruction-of-the-enemies-of-judah}}
\hypertarget{section-82}{%
\section{83}\label{section-82}}
A song, a psalm of Asaph. \bibverse{1} Do not keep silent, O God: hold
not your peace, be not still, God. \bibverse{2} For see! Your enemies
roar, those who hate you lift up their heads, \bibverse{3} laying crafty
plans for your people, and plotting against those you treasure.
\bibverse{4} ``Come, let us wipe them out as a nation, so Israel's name
will be mentioned no more.'' \bibverse{5} For, conspiring with one
accord, they have made a league against you \bibverse{6} Tents of Edom,
and Ishmaelites, Moab, and the Hagrites. \bibverse{7} Gebal and Ammon
and Amalek, Philistia, with the people of Tyre; \bibverse{8} Syria, too,
is confederate, they have strengthened the children of Lot. Selah
\bibverse{9} Deal with them as you dealt with Midian, with Sisera, with
Jabin, at the torrent of Kishon, \bibverse{10} who at Endor were
destroyed, and became dung for the field. \bibverse{11} Make their
nobles like Oreb and Zeeb, all their princes like Zebah and Zalmunna,
\bibverse{12} who said, ``Let us take for ourselves the meadows of
God.'' \bibverse{13} Whirl them, my God, like dust, like stubble before
the wind. \bibverse{14} As the fire that kindles the forest, as flame
that sets mountains ablaze, \bibverse{15} so with your tempest pursue
them, terrify them with your hurricane. \bibverse{16} Make them blush
with shame; until they seek your name, O Lord. \bibverse{17} Everlasting
shame and confusion, disgrace and destruction be theirs. \bibverse{18}
Teach those who you alone are most high over all the earth.
\hypertarget{psalm-84-the-song-of-the-pilgrims}{%
\subsection{Psalm 84 --- The Song of the
Pilgrims}\label{psalm-84-the-song-of-the-pilgrims}}
\hypertarget{section-83}{%
\section{84}\label{section-83}}
For the leader. On the gittith. Of the Korahites, a psalm. \bibverse{1}
How dearly loved is the place where you live, Lord of hosts!
\bibverse{2} How I long and yearn for the courts of the Lord. Now heart
and flesh cry for joy to the living God. \bibverse{3} Even the sparrow
has found her a home and the swallow a nest, to lay her young, near your
altar, Lord of hosts, my king and my God. \bibverse{4} Happy those who
live in your house, praising you evermore. Selah \bibverse{5} Happy
those whose strength is in you, people with pilgrim hearts. \bibverse{6}
As they pass through the valley of tears, they make it a place of
fountains, clothed with the blessings of early rain. \bibverse{7} From
rampart to rampart on they march, till at last God reveals himself in
Zion. \bibverse{8} Lord, God of hosts, hear my prayer, give ear, O God
of Jacob. Selah \bibverse{9} Behold, O God, our defender, and look upon
your anointed, \bibverse{10} for better a single day in your courts than
a thousand in my own chambers: better stand at the door of the house of
my God than live in the tents of ungodliness, \bibverse{11} for the Lord
is sun and shield, the Lord gives grace and glory. He withholds no good
thing from the life that is blameless. \bibverse{12} Lord of hosts,
happy those whose trust is in you.
\hypertarget{psalm-85-a-prayer-for-national-restoration}{%
\subsection{Psalm 85 --- A Prayer for National
Restoration}\label{psalm-85-a-prayer-for-national-restoration}}
\hypertarget{section-84}{%
\section{85}\label{section-84}}
For the leader. Of the Korahites, a psalm. \bibverse{1} Once, Lord, you
did favour your land, granting change of fortune to Jacob, \bibverse{2}
forgiving the guilt of your people, pardoning all their sin, Selah
\bibverse{3} withdrawing all your fury, turning from your hot anger.
\bibverse{4} Restore us, O God our saviour, put away your displeasure
against us. \bibverse{5} Will you cherish your anger against us forever,
prolonging your wrath to all generations? \bibverse{6} Will you not
revive us again, that your people may be glad in you? \bibverse{7} Show
us your kindness, O Lord, grant us your salvation. \bibverse{8} Let me
hear what God the Lord will speak; for he will speak of peace to his
people, to those who love him, and turn their hearts to him.
\bibverse{9} Soon those who fear him shall see how he saves, and glory
shall live in our land. \bibverse{10} Kindness and loyalty meet; peace
and righteousness kiss. \bibverse{11} Loyalty springs from the earth;
righteousness looks from the sky. \bibverse{12} The Lord shall give all
that is good, our land yielding its increase, \bibverse{13}
righteousness marching before him, and peace on the path he treads.
\hypertarget{psalm-86-a-prayer-for-divine-guidance-and-favour}{%
\subsection{Psalm 86 --- A Prayer for Divine Guidance and
Favour}\label{psalm-86-a-prayer-for-divine-guidance-and-favour}}
\hypertarget{section-85}{%
\section{86}\label{section-85}}
A prayer of David. \bibverse{1} Incline your ear, Lord, and answer me,
for I am afflicted and needy. \bibverse{2} Guard me, for I am loyal:
save your servant, who trusts in you. \bibverse{3} Lord, be gracious to
me, for you are my God; I cry to you all the day. \bibverse{4} Gladden
the heart of your servant; for to you, Lord, I set my hope. \bibverse{5}
For you, Lord, are good and forgiving, rich in love towards all who call
on you. \bibverse{6} Listen, O Lord, to my prayer; attend to my plea for
mercy. \bibverse{7} In the day of my trouble I call on you, with
assurance that you will answer me. \bibverse{8} None of the gods is like
you, Lord, nor are any works like yours. \bibverse{9} All the nations
you have made will come and bow down before you, giving glory, O Lord,
to your name. \bibverse{10} For great are you, and a doer of wonders;
you alone are God. \bibverse{11} Teach me, O Lord, your way, that I may
walk in your truth: so my heart shall rejoice in your name.
\bibverse{12} I will give you thanks, O Lord, with all my heart, my God,
I will honour your name forever. \bibverse{13} For great is your love
towards me, from the depths of Sheol you have saved me. \bibverse{14}
Haughty men have risen up against me, O God, a band of the violent
seeking my life, who think nothing of you. \bibverse{15} But you are a
God of pity and grace, patient and rich in kindness and faithfulness;
turn to me with your grace, O Lord. \bibverse{16} Grant your strength to
your servant, and save the child of your handmaid. \bibverse{17} Show me
a sign of your favour, which those who hate me may see with confusion,
since you, Lord, are my helper and comforter.
\hypertarget{psalm-87-zion-city-of-god}{%
\subsection{Psalm 87 --- Zion, City of
God}\label{psalm-87-zion-city-of-god}}
\hypertarget{section-86}{%
\section{87}\label{section-86}}
Of the Korahites, a psalm. A song. \bibverse{1} On the holy mountain
stands the city he founded. \bibverse{2} The Lord loves the gates of
Zion more than all the dwellings of Jacob. \bibverse{3} Glorious things
he is speaking of you, you city of God. Selah \bibverse{4} ``Amongst
those who are mine I name Rahab and Babylon, Philistia, Tyre, Ethiopia,
their people will say I was born in Zion. \bibverse{5} As for Zion it
will be said each and all were born in her.'' The Lord will preserve
her. \bibverse{6} The Lord will count, when enrolling the peoples,
``This one was born there, and that one was born there.'' Selah
\bibverse{7} Singers and dancers alike will say ``All my springs are in
you.''
\hypertarget{psalm-88-the-prayer-of-despair}{%
\subsection{Psalm 88 --- The Prayer of
Despair}\label{psalm-88-the-prayer-of-despair}}
\hypertarget{section-87}{%
\section{88}\label{section-87}}
\bibverse{1} O Lord my God, I cry for help in the day-time, in the night
my cry is before you; \bibverse{2} let my prayer come into your
presence, incline your ear to my cry. \bibverse{3} For I am sated with
sorrow, my life draws near to Sheol. \bibverse{4} I am counted with
those who go down to the pit; without strength am I. \bibverse{5} My
home is amongst the dead, like the slain that lie in the grave, whom you
remember no more cut off as they are from your hand. \bibverse{6} In the
deepest pit you have put me, in shadows deep and dark. \bibverse{7} Your
wrath lies heavy upon me, waves of your anger roll over me. Selah
\bibverse{8} You have put my friends far from me, you have made them
shun me. I am shut in, and cannot escape, \bibverse{9} my eyes are
wasted with sorrow. I call on you, Lord, every day, spreading my hands
out to you. \bibverse{10} For the dead can you work wonders? Can the
shades rise again to praise you? Selah \bibverse{11} Can your kindness
be told in the grave, your faithfulness in the tomb? \bibverse{12} Can
your wonders be known in the darkness, or your help in the land of
forgetfulness? \bibverse{13} I cry for help to you, in the morning my
prayer comes before you. \bibverse{14} Why, O Lord, do you spurn me, and
hide your face from me? \bibverse{15} From my youth I am wretched and
dying, I am numbed by the terrors I bear. \bibverse{16} The fires of
your wrath have passed over me, your terrors destroy me, \bibverse{17}
surging around me forever, hemming me in altogether. \bibverse{18} Those
who love me you put far from me; the dark is my only friend.
\hypertarget{psalm-89-the-promise-to-david}{%
\subsection{Psalm 89 --- The Promise to
David}\label{psalm-89-the-promise-to-david}}
\hypertarget{section-88}{%
\section{89}\label{section-88}}
A song. A psalm of the Korahites. \bibverse{1} I will sing evermore of
the love of the Lord, proclaiming to all generations his faithfulness.
\bibverse{2} For your love you did promise to build up forever, your
faithfulness firm as the heavens themselves. \bibverse{3} ``I have made
with my chosen a covenant, and sworn to David my servant, \bibverse{4}
to establish his seed forever, and to build up his throne to all ages.''
Selah \bibverse{5} Then the holy assembly in heaven praised your
marvellous faithfulness, Lord. \bibverse{6} For who in the skies may
compare with the Lord? Who is like the Lord amongst the gods?
\bibverse{7} A God to be feared in the holy assembly, awful and great
above all who are round him. \bibverse{8} O Lord God of hosts, who is
mighty as you? Your strength and faithfulness, Lord, surround you.
\bibverse{9} You are the Lord of the raging sea: when its waves surge,
it is you who still them. \bibverse{10} It was you who did pierce and
crush Rahab in pieces, and scatter your foes by your mighty arm.
\bibverse{11} Yours are the heavens, yours also the earth, the world and
its fulness, it's you who did found them. \bibverse{12} The north and
the south, it's you have created them; Tabor and Hermon shout praise to
your name. \bibverse{13} You have an arm with the might of a hero;
strong is your hand, high uplifted your right hand. \bibverse{14}
Justice and right are the base of your throne, kindness and faithfulness
ever attend you. \bibverse{15} Happy the people who know the glad shout,
who walk, O Lord, in the light of your face. \bibverse{16} They exult in
your name all the day, and your righteousness they extol. \bibverse{17}
For you are our strength and our pride. Your favour will lift us to
honour. \bibverse{18} For the holy Lord of Israel keeps our defender and
king. \bibverse{19} In a vision of old you did speak in this way to the
one whom you loved: ``A crown I have set on the hero I chose to be over
the people \bibverse{20} ``I found my servant David, and anointed with
holy oil. \bibverse{21} My hand will be with him forever, my arm will
give him strength. \bibverse{22} ``No enemy will dare to assail him, nor
the wicked to oppress him; \bibverse{23} but his foes I will shatter
before him, I will strike down those who hate him. \bibverse{24} ``My
loyal love shall attend him, and I will lift him to honour.
\bibverse{25} I will set his hand on the sea, and his right hand on the
rivers. \bibverse{26} ``As for him, he will call me `My father, my God,
and my rock of salvation.' \bibverse{27} And I will make him my
first-born, highest of kings on the earth. \bibverse{28} ``My love will
I keep for him ever, my covenant with him shall stand fast.
\bibverse{29} His line will I make everlasting, and his throne as the
days of the heavens. \bibverse{30} ``If his children forsake my law, and
walk not as I have ordained; \bibverse{31} if they profane my statutes,
and do not keep my commandments; \bibverse{32} ``I will punish their sin
with the rod, their iniquity with scourges. \bibverse{33} But my love
will I not take from him, nor will I belie my faithfulness.
\bibverse{34} ``I will not profane my covenant by changing the word that
has passed my lips. \bibverse{35} Once have I solemnly sworn and I would
not lie to David, \bibverse{36} ``that his line should endure forever,
and his throne as the sun before me, \bibverse{37} firm as the moon
which for ever and ever is fixed in the sky.'' Selah \bibverse{38} But
you have cast off in contempt, and been furious with your anointed.
\bibverse{39} You have spurned the covenant with your servant, and his
sacred crown dashed to the ground. \bibverse{40} You have broken down
all his walls, and laid his bulwarks in ruins. \bibverse{41} All who
pass on their way despoil him, the scorn of his neighbours is he now.
\bibverse{42} You have given his foes the victory, and made all his
enemies glad. \bibverse{43} You have turned back his sword from the foe,
you did not lift him up in the battle. \bibverse{44} The sceptre you
took from his hand, and his throne you did hurl to the ground.
\bibverse{45} You have shortened the days of his youth, and covered him
with shame. Selah \bibverse{46} How long, Lord will you hide you
forever? How long are the fires of your wrath to burn? \bibverse{47}
Remember, Lord, the shortness of life how fleeting you made all people.
\bibverse{48} Who can live without seeing death? Who can rescue their
life from the clutch of Sheol? Selah \bibverse{49} Where, Lord, is your
kindness of old, which you in your faithfulness swore to David?
\bibverse{50} Remember, O Lord, how your servants are mocked, how I bear
in my heart the scorn of all nations \bibverse{51} The scorn which your
enemies hurl, O Lord, which they hurl at the footsteps of your anointed.
\bibverse{52} Blest be the Lord, for ever and ever. Amen and Amen.
\hypertarget{book-four}{%
\subsection{Book Four}\label{book-four}}
\hypertarget{section-89}{%
\section{90}\label{section-89}}
\hypertarget{psalm-90-hymn-of-eternity}{%
\subsection{Psalm 90 --- Hymn of
Eternity}\label{psalm-90-hymn-of-eternity}}
A prayer of Moses, the man of God. \bibverse{1} Lord, you have been a
home to us one generation after another. \bibverse{2} Before the
mountains were born, or the earth and the world were brought forth, from
everlasting to everlasting you are God. \bibverse{3} You bring us back
to the dust, you summon mortals to return. \bibverse{4} For you see a
thousand years as the passing of yesterday, as a watch in the night.
\bibverse{5} Your floods sweep them away; they are like a dream, or like
grass which sprouts in the morning, \bibverse{6} which blossoms and
sprouts in the morning, but by evening is cut and withered. \bibverse{7}
For your anger consumes us, the heat of your wrath confounds us.
\bibverse{8} Our sins you have set before you, our secrets in the light
of your face. \bibverse{9} For through your wrath our days are
declining, we bring our years to an end as a sigh. \bibverse{10} The
span of our life is seventy years, or, if we are strong, maybe eighty;
yet is their breadth but empty toil, for swiftly they go, and we fly
away. \bibverse{11} Who lays to heart the power of your anger? Or who
stands in reverent awe of your wrath? \bibverse{12} O teach us to count
our days so our minds may learn wisdom. \bibverse{13} Return, O Lord;
why so long? Relent on your servants. \bibverse{14} Grant us your love
to the full in the morning, that all our days we may shout for joy.
\bibverse{15} Make us glad for the days you have humbled us, for the
evil years we have seen. \bibverse{16} Let your servants see you in
action, show your majesty to their children. \bibverse{17} Let the grace
of the Lord our God be upon us, uphold what our hands are striving to
do.
\hypertarget{psalm-91-in-the-shelter-of-the-most-high}{%
\subsection{Psalm 91 --- In the Shelter of the Most
High}\label{psalm-91-in-the-shelter-of-the-most-high}}
\hypertarget{section-90}{%
\section{91}\label{section-90}}
\bibverse{1} You whose home is the shelter of God Most High, whose abode
is the shadow of God Almighty, \bibverse{2} can say to the Lord, ``My
refuge, my fortress, my God, in whom I trust.'' \bibverse{3} For he
saves you from fowler's snare, from deadly plague, \bibverse{4} he
shelters you with his pinions, and under his wings you can hide. His
truth will be a shield and buckler. \bibverse{5} You need not fear the
terror of night, nor the arrow that flies by day, \bibverse{6} nor the
plague that stalks in darkness, nor the pestilence raging at noon.
\bibverse{7} A thousand may fall at your side, ten thousand at your
right hand: but it will not draw near to you. \bibverse{8} You will only
look on with your eyes, and see how the wicked are punished.
\bibverse{9} You have made the Lord your refuge, you have made the Most
High your defence. \bibverse{10} You will never be met by misfortune, no
plague will come near your tent, \bibverse{11} for he orders his angels
to guard you, wherever you go. \bibverse{12} They will carry you with
their hands, so you don't hurt your foot on a stone. \bibverse{13} You
will trample down lions and snakes, tread on young lions and cobras.
\bibverse{14} ``Because of their love for me, I will deliver them, I
will protect those who trust my name. \bibverse{15} I will answer their
cry and be with them in trouble, bringing them forth into safety and
honour. \bibverse{16} I will give them a life of many days, I will show
them my salvation.''
\hypertarget{psalm-92-the-ways-of-god}{%
\subsection{Psalm 92 --- The Ways of
God}\label{psalm-92-the-ways-of-god}}
\hypertarget{section-91}{%
\section{92}\label{section-91}}
A psalm. A song; for the sabbath day. \bibverse{1} It is good to give
thanks to the Lord, to sing praise to your name, O Most High,
\bibverse{2} to declare your love in the morning, and your faithfulness
in the night, \bibverse{3} with voice and a ten-stringed harp, with
music that throbs on the lyre. \bibverse{4} For you make me glad by your
deeds, Lord, at the work of your hands I will ring out my joy.
\bibverse{5} How great are your works, O Lord; how deep are your
thoughts! \bibverse{6} The insensitive cannot know, nor can a fool
understand, \bibverse{7} that, though the wicked flourish like grass,
and evil-doers all blossom, they will perish forever. \bibverse{8} But
you are exalted forever. \bibverse{9} For see! Your enemies, Lord For
see! Your enemies perish, all evil-doers are scattered. \bibverse{10}
But you lift me to honour, and anoint me afresh with oil. \bibverse{11}
My eyes will feast on my foes, and my ears will hear of the doom of the
wicked. \bibverse{12} The righteous will sprout like the palm, will grow
like a cedar of Lebanon. \bibverse{13} In the house of the Lord are they
planted, in the courts of our God they will sprout. \bibverse{14} They
will still bear fruit in old age, all sappy and fresh will they be
\bibverse{15} So they proclaim the Lord to be just, my rock, in whom is
no wrong.
\hypertarget{psalm-93-the-lord-king-of-all-the-world}{%
\subsection{Psalm 93 --- The Lord, King of all the
World}\label{psalm-93-the-lord-king-of-all-the-world}}
\hypertarget{section-92}{%
\section{93}\label{section-92}}
\bibverse{1} The Lord has taken his seat on the throne, clothed with
majesty, armed with might. Now the world stands firm, to be shaken no
more, \bibverse{2} firm stands your throne from all eternity. You are
from everlasting. \bibverse{3} The floods, O Lord, have lifted, the
floods have lifted their voice, the floods lift up their roar.
\bibverse{4} But more grand than the great roaring waters, more grand
than the ocean waves, grand on the height stands the Lord. \bibverse{5}
What you have ordained is most sure; most sure shall your house stand
inviolate, O Lord, for ever and ever.
\hypertarget{psalm-94-a-prayer-for-vengeance-on-the-cruel}{%
\subsection{Psalm 94 --- A Prayer for Vengeance on the
Cruel}\label{psalm-94-a-prayer-for-vengeance-on-the-cruel}}
\hypertarget{section-93}{%
\section{94}\label{section-93}}
\bibverse{1} Lord, God of vengeance, God of vengeance, shine forth.
\bibverse{2} Rise up, judge of the earth, pay back the proud what they
deserve. \bibverse{3} Lord, how long shall the wicked, how long shall
the wicked exult, \bibverse{4} with their blustering arrogant words,
their braggart and wicked speech, \bibverse{5} crushing your people,
Lord, and afflicting your heritage, \bibverse{6} murdering widows and
strangers, slaying the fatherless? \bibverse{7} They think that the Lord
does not see, nor the God of Jacob regard it. \bibverse{8} Take heed,
you dullest of people; when will you be wise, you fools? \bibverse{9} Is
he deaf, who shaped the ear? Is he blind, who fashioned the eye?
\bibverse{10} Can he who trains nations not punish them he who teaches
knowledge to people? \bibverse{11} The Lord knows the thoughts of
people, that only a breath are they. \bibverse{12} Happy are those whom
you chasten, and teach out of your law, \bibverse{13} keeping them calm
in the day of misfortune, till a pit be dug for the wicked.
\bibverse{14} For the Lord will not leave his people, he will not
forsake his inheritance. \bibverse{15} For the righteous shall come to
their rights, and all true-hearted people shall follow them.
\bibverse{16} Who will rise up for me against those who do evil? Who
will stand up for me against workers of wrong? \bibverse{17} Were it not
for the help of the Lord, I would soon have gone to the silent grave.
\bibverse{18} When I thought that my foot was slipping, your kindness,
Lord, held me up. \bibverse{19} When with cares my heart was crowded,
your comforts make me glad. \bibverse{20} Can corrupt justice be your
ally, framing mischief by statute? \bibverse{21} They assail the life of
the righteous, and innocent blood condemn. \bibverse{22} But the Lord is
my sure retreat, my God is the rock of my refuge. \bibverse{23} He will
bring back their sin upon them, for their wickedness he will destroy
them; the Lord our God will destroy them.
\hypertarget{psalm-95-for-a-festival.-a-hymn-of-praise-and-a-solemn-warning}{%
\subsection{Psalm 95 --- For a Festival. A Hymn of Praise and a Solemn
Warning}\label{psalm-95-for-a-festival.-a-hymn-of-praise-and-a-solemn-warning}}
\hypertarget{section-94}{%
\section{95}\label{section-94}}
\bibverse{1} Come! Let us ring out our joy to the Lord, let us merrily
shout to our rock of salvation. \bibverse{2} Before his face let us come
with thanks, with songs of praise let us shout to him. \bibverse{3} For
the Lord is a great God, king above all gods. \bibverse{4} In his hand
are the depths of the earth, the heights of the mountains are his.
\bibverse{5} The sea is his, for he made it: the dry land was formed by
his hands. \bibverse{6} Come! Let us worship and bow on our knees to the
Lord our creator. \bibverse{7} For he is our God; and we are the people
he tends, the sheep in his care. If only you would heed his voice today:
\bibverse{8} ``Do not harden your hearts as at Meribah, or at Massah,
that day in the desert, \bibverse{9} when your ancestors tempted and
tried me, though they had seen my deeds. \bibverse{10} ``For forty years
I was filled with loathing for that generation, so I said: `A people
with wandering hearts are they, and ignorant of my ways.' \bibverse{11}
So I solemnly swore to them in my anger, that never would they enter my
place of rest.''
\hypertarget{psalm-96-the-lords-rule}{%
\subsection{Psalm 96 --- The Lord's
Rule}\label{psalm-96-the-lords-rule}}
\hypertarget{section-95}{%
\section{96}\label{section-95}}
\bibverse{1} Sing to the Lord a new song, sing to the Lord, all the
earth. \bibverse{2} Sing to the Lord, bless his name, from day to day
herald his victory. \bibverse{3} Tell his glory amongst the nations, his
wonders amongst all peoples. \bibverse{4} For great is the Lord and
worthy all praise; held in awe, above all gods: \bibverse{5} for all the
gods of the nations are idols, but the Lord created the heavens.
\bibverse{6} Before him are splendour and majesty, beauty and strength
in his holy place. \bibverse{7} Ascribe to the Lord, you tribes of the
nations, ascribe to the Lord glory and strength. \bibverse{8} Ascribe to
the Lord the glory he manifests: bring you an offering, enter his
courts. \bibverse{9} Bow to the Lord in holy array: tremble before him,
all the earth. \bibverse{10} Say to the nations, ``The Lord is king.''
The world stands firm to be shaken no more. He will judge the peoples
with equity. \bibverse{11} Let the heavens be glad and the earth
rejoice, let the sea and its fulness thunder. \bibverse{12} Let the
field, and all that is in it, exult; let the trees of the forest ring
out their joy \bibverse{13} before the Lord: for he comes, he comes to
judge the earth. He will judge the world with justice and the nations
with faithfulness.
\hypertarget{psalm-97-the-lords-judgement}{%
\subsection{Psalm 97 --- The Lord's
Judgement}\label{psalm-97-the-lords-judgement}}
\hypertarget{section-96}{%
\section{97}\label{section-96}}
\bibverse{1} The Lord is king, let the earth rejoice: let her many isles
be glad. \bibverse{2} Clouds and darkness are round about him, justice
and right are the base of his throne. \bibverse{3} Fire goes before him,
and blazes around his steps, \bibverse{4} his lightnings illumine the
world: the earth quakes at the sight. \bibverse{5} Mountains melt like
wax before the Lord of all the earth. \bibverse{6} The heavens proclaim
his justice, all nations behold his glory. \bibverse{7} Shamed are all
image-worshippers, who make a boast of their idols. All the gods bow
before him. \bibverse{8} Zion is glad at the tidings, the towns of Judah
rejoice because of your judgements, Lord. \bibverse{9} For you are most
high over all the earth, greatly exalted above all gods. \bibverse{10}
The Lord loves those who hate evil, he guards the lives of the faithful:
from the hand of the wicked he saves them. \bibverse{11} Light arises
for the righteous, and joy for the upright in heart. \bibverse{12}
Rejoice in the Lord, you righteous: give thanks to his holy name.
\hypertarget{psalm-98-a-song-of-praise-to-the-lord}{%
\subsection{Psalm 98 --- A Song of Praise to the
Lord}\label{psalm-98-a-song-of-praise-to-the-lord}}
\hypertarget{section-97}{%
\section{98}\label{section-97}}
A psalm. \bibverse{1} Sing a new song to the Lord, for he has done
wonders; his right hand and holy arm have won him the victory.
\bibverse{2} The Lord has made his victory known, and revealed to the
eyes of the nations his righteousness. \bibverse{3} Mindful he was of
his kindness to Jacob, faithful he was to the house of Israel. All the
ends of the earth have seen the victory of our God. \bibverse{4} Shout,
all the earth, to the Lord: break into cries and music. \bibverse{5}
Play on the lyre to the Lord, on the lyre and with loud melody.
\bibverse{6} With trumpet and sound of horn, shout before the king.
\bibverse{7} Let the sea and its fulness roar, the world and the
dwellers upon it. \bibverse{8} Let the streams clap their hands, let the
hills shout for gladness together \bibverse{9} before the Lord for he
comes, he comes to judge the earth. He will judge the world with justice
and the nations with equity.
\hypertarget{psalm-99-the-lords-just-and-holy-rule}{%
\subsection{Psalm 99 --- The Lord's Just and Holy
Rule}\label{psalm-99-the-lords-just-and-holy-rule}}
\hypertarget{section-98}{%
\section{99}\label{section-98}}
\bibverse{1} The Lord is king; let the nations tremble: he is throned
upon cherubs; let earth quake. \bibverse{2} The Lord is great in Zion,
he is high over all the nations. \bibverse{3} Let them praise your great
and terrible name. Holy is he. \bibverse{4} You are a king who loves
justice, equity you have established: justice and right you have wrought
for Jacob. \bibverse{5} Exalt the Lord our God, bow down at his
footstool. Holy is he. \bibverse{6} Amongst his priests were Moses and
Aaron, Samuel amongst those who called on his name. They called to the
Lord, and he gave them answer. \bibverse{7} He spoke to them in the
pillar of cloud, they kept his commands and the statute he gave them.
\bibverse{8} Lord our God, you gave them answer. A God of forgiveness
were you to them, who suffered their deeds to go unpunished.
\bibverse{9} Exalt the Lord our God; bow down at his holy mountain. For
holy is the Lord our God.
\hypertarget{psalm-100-a-call-to-worship}{%
\subsection{Psalm 100 --- A Call to
Worship}\label{psalm-100-a-call-to-worship}}
\hypertarget{section-99}{%
\section{100}\label{section-99}}
A psalm of praise. \bibverse{1} Shout, all the earth, to the Lord.
\bibverse{2} Serve the Lord with gladness, approach him with ringing
cries. \bibverse{3} Be sure that the Lord alone is God. It is he who has
made us, and his we are his people, the sheep of his pasture.
\bibverse{4} Enter his gates with thanksgiving, his courts with praise.
Give thanks to him, bless his name. \bibverse{5} For the Lord is good,
his love is forever, and to all ages endures his faithfulness.
\hypertarget{psalm-101-a-model-king}{%
\subsection{Psalm 101 --- A Model King}\label{psalm-101-a-model-king}}
\hypertarget{section-100}{%
\section{101}\label{section-100}}
Of David, a psalm. \bibverse{1} If kindness and justice I sing, making
melody to you, Lord. \bibverse{2} I would look to the way that is
blameless, and make it my own. Within my own house I would walk with an
innocent heart. \bibverse{3} I would never direct my eyes to a thing
that is base. The impulse to stray I abhor it shall not cling to me.
\bibverse{4} Far from me be perverseness of heart, or kinship with evil.
\bibverse{5} Who slanders their neighbour in secret, I bring them to
silence: haughty looks and proud hearts I will not abide. \bibverse{6} I
will favour the true in the land, they shall live in my court. Those who
walk in a way that is blameless will be my attendant. \bibverse{7} No
one will live in my house who practises guile. No one that speaks a lie
will abide in my presence. \bibverse{8} Morn by morn I will wholly wipe
out all the bad in the land, and cut off from the Lord's own city all
workers of evil.
\hypertarget{psalm-102-a-prayer-for-pity-and-for-the-restoration-of-zion}{%
\subsection{Psalm 102 --- A Prayer for Pity and for the Restoration of
Zion}\label{psalm-102-a-prayer-for-pity-and-for-the-restoration-of-zion}}
\hypertarget{section-101}{%
\section{102}\label{section-101}}
\bibverse{1} Hear my prayer, O Lord; let my cry for help come to you.
\bibverse{2} Hide not your face from me in the day of my distress.
Incline your ear to me: when I call, answer me speedily. \bibverse{3}
For my days pass away like smoke: my bones are burnt through as with
fire. \bibverse{4} My heart is scorched, withered like grass; I forget
to eat my bread. \bibverse{5} By reason of my loud groaning, my flesh
clings to my bones. \bibverse{6} Like a desert-owl of the wilderness,
like an owl amongst ruins am I. \bibverse{7} I make my sleepless lament
like a bird on the house-top alone. \bibverse{8} All the day wild foes
revile me, using my name for a curse. \bibverse{9} For ashes have been
my bread, and tears have been mixed with my cup. \bibverse{10} Because
of your passionate anger, you did raise me, then hurl me to the ground.
\bibverse{11} My days come to an end, shadows lengthen, I wither like
grass. \bibverse{12} But you, O Lord, are enthroned forever, your fame
endures to all generations. \bibverse{13} You will arise and have pity
on Zion; it's time to be gracious; her hour has come. \bibverse{14} For
even her stones are dear to your servants, even the dust of her ruins
they look on with love. \bibverse{15} Then the nations will revere the
name of the Lord and all the kings of the earth his glory, \bibverse{16}
when the Lord shall have built up Zion, and revealed himself in his
glory, \bibverse{17} in response to the prayer of the destitute, whose
prayer he will not despise. \bibverse{18} Let this be recorded for ages
to come, that the Lord may be praised by a people yet unborn.
\bibverse{19} For he shall look down from his holy height, from the
heavens the Lord will gaze on the earth, \bibverse{20} to hear the
groans of the prisoner, to free those who are doomed to die;
\bibverse{21} that people may recount the Lord's fame in Zion, and the
praise of him in Jerusalem, \bibverse{22} when the nations are gathered
together, and the kingdoms, to worship the Lord. \bibverse{23} He has
broken my strength on the way, he has shortened my days. \bibverse{24} I
will say, ``My God, take me not hence in the midst of my days. ``Your
years endure age after age. \bibverse{25} Of old you have founded the
earth, and the heavens are the work of your hands. \bibverse{26} They
shall perish; but you do stand. They shall all wax old like a garment,
and change as a robe you will change them. \bibverse{27} But you are the
same, your years are endless. \bibverse{28} The children of your
servants abide, evermore shall their seed be before you.''
\hypertarget{psalm-103-bless-the-lord-o-my-soul}{%
\subsection{Psalm 103 --- Bless the Lord, O my
Soul}\label{psalm-103-bless-the-lord-o-my-soul}}
\hypertarget{section-102}{%
\section{103}\label{section-102}}
Of David. \bibverse{1} O my soul, bless the Lord; and all that is in me,
his holy name. \bibverse{2} O my soul, bless the Lord; and forget not
one of his benefits. \bibverse{3} He pardons all your sins, he heals all
your diseases. \bibverse{4} He ransoms your life from the pit, he crowns
you with kindness and pity. \bibverse{5} He gives you your heart's
desire, renewing your youth like the eagle's. \bibverse{6} The Lord
executes justice - and right for all who are wronged. \bibverse{7} He
revealed his ways to Moses, his acts to the children of Israel.
\bibverse{8} Full of pity and grace is the Lord, patient, and rich in
kindness: \bibverse{9} he will not always chide, nor cherish his anger
forever. \bibverse{10} Not after our sins has he dealt with us, nor
requited us after our wickedness. \bibverse{11} For high as the heavens
o'er the earth is his love over those who fear him. \bibverse{12} Far as
is east from the west has he put our transgressions from us.
\bibverse{13} As a father pities his children, so the Lord pities those
who fear him; \bibverse{14} for well he knows our frame, he remembers
that we are dust. \bibverse{15} A person's days are as grass; blossoms
like a flower of the meadow. \bibverse{16} At the breath of the wind it
is gone, and the place thereof knows it no more. \bibverse{17} But the
love of the Lord is eternal, and his kindness to children's children,
\bibverse{18} to those who keep his covenant and mindfully do his
behests. \bibverse{19} The Lord has set his throne in the heavens; the
whole world is under his sway. \bibverse{20} Bless the Lord, you angels
of his, mighty heroes performing his word. \bibverse{21} Bless the Lord,
all you his hosts, you servants who do his will. \bibverse{22} Bless the
Lord, all you his works, far as his sway extends. O my soul, bless the
Lord.
\hypertarget{psalm-104-the-hymn-of-creation}{%
\subsection{Psalm 104 --- The Hymn of
Creation}\label{psalm-104-the-hymn-of-creation}}
\hypertarget{section-103}{%
\section{104}\label{section-103}}
\bibverse{1} Bless the Lord, O my soul. O Lord my God, you are very
great, clad in awful splendour, \bibverse{2} covered with robe of light.
You stretch out the heavens like the cloth of a tent. \bibverse{3} He
lays the beams of his chambers on water. He takes dark clouds for his
chariot, and rides on the wings of the wind. \bibverse{4} He takes the
winds for his messengers, the fire and the flame for his servants.
\bibverse{5} He founded the earth upon pillars, to sustain it unshaken
forever. \bibverse{6} With the garment of ocean he covered it, waters
towered over the mountains. \bibverse{7} But at your rebuke they fled,
scared by the roar of your thunder, \bibverse{8} mountains rose, valleys
sank down to the place appointed for them. \bibverse{9} They dared not
pass the bounds set for them, or cover the earth any more. \bibverse{10}
He sent brooks into the valleys, they meander between the mountains.
\bibverse{11} The wild beasts all drink from them, and the wild asses
quench their thirst. \bibverse{12} The birds have their home by the
banks, and sing in the branches. \bibverse{13} From his chambers above
he gives drink to the mountains, and satisfies earth with the vials of
heaven. \bibverse{14} He makes grass grow for the cattle, and herbs for
people. He brings bread out of the earth; \bibverse{15} wine, to gladden
hearts; oil, to make faces shine; bread, to strengthen hearts.
\bibverse{16} The trees of the Lord drink their fill the cedars he
planted on Lebanon, \bibverse{17} where the little birds build their
nest, and the stork whose home is the cypress. \bibverse{18} The high
hills are for the wild goats, and the rocks are for coneys to hide in.
\bibverse{19} He created the moon to mark seasons, and told the sun when
to set. \bibverse{20} You make it dark: night comes, when all the wild
beasts creep out. \bibverse{21} Young lions that roar for their prey,
seeking their meat from God. \bibverse{22} At sunrise they slink away,
and lie down in their dens. \bibverse{23} Then people go forth to their
work, and toil till evening. \bibverse{24} How many, O Lord, are your
works, all of them made in wisdom! The earth is filled with your
creatures. \bibverse{25} And there is the great broad sea, where are
countless things in motion, living creatures, both great and small.
\bibverse{26} There go the ships, and the Leviathan you made to play
there. \bibverse{27} They all look in hope to you, to give them their
food in due season. \bibverse{28} And you give with open hand; they
gather and eat to their heart's desire. \bibverse{29} When you hide your
face, they are terrified; when you take their breath away, they die and
go back to their dust. \bibverse{30} But a breath from your lips creates
them, and renews the face of the earth. \bibverse{31} May the glory of
the Lord be forever, may the Lord rejoice in his works. \bibverse{32} A
glance of his makes the earth tremble, a touch of his makes the hills
smoke. \bibverse{33} I will sing to the Lord while I live, I will play
to my God while I am. \bibverse{34} May my musing be sweet to him. for I
rejoice in the Lord. \bibverse{35} But may sinners be swept from the
earth, and the wicked vanish forever. O my soul, bless the Lord.
Hallelujah.
\hypertarget{psalm-105-the-inspiration-of-the-past}{%
\subsection{Psalm 105 --- The Inspiration of the
Past}\label{psalm-105-the-inspiration-of-the-past}}
\hypertarget{section-104}{%
\section{105}\label{section-104}}
\bibverse{1} Give thanks to the Lord, call on his name: make known his
deeds amongst the nations. \bibverse{2} Sing to him, make music to him,
tell of all his wondrous works. \bibverse{3} Make your boast in his holy
name, be glad at heart, you who seek the Lord. \bibverse{4} Seek after
the Lord and his strength, seek his face evermore. \bibverse{5} Remember
the wonders he did, his portents, the judgements he uttered,
\bibverse{6} you who are offspring of Abraham, his servant, the children
of Jacob, his chosen ones. \bibverse{7} He is the Lord our God: in all
the earth are his judgements. \bibverse{8} He remembers forever his
covenant, his promise for a thousand generations \bibverse{9} The
covenant he made with Abraham, the oath he swore to Isaac, \bibverse{10}
and confirmed as a statute to Jacob, a pact everlasting to Israel
\bibverse{11} to give them the land of Canaan as the lot which they
should inherit. \bibverse{12} And when they were very few, few and but
pilgrims therein, \bibverse{13} wandering from nation to nation,
journeying from people to people, \bibverse{14} he allowed no one to
oppress them, even punishing kings for their sakes. \bibverse{15} He
forbade them to touch his anointed, or do any hurt to his prophets.
\bibverse{16} When he called down famine on the land, and cut off the
bread which sustained them, \bibverse{17} he sent before them a man,
Joseph, who was sold as a slave. \bibverse{18} His feet were galled with
fetters, he was laid in chains of iron, \bibverse{19} till the time that
his word came to pass, the word of the Lord that had tried him.
\bibverse{20} The king sent and freed him, the ruler of nations released
him. \bibverse{21} He made him lord of his household, and ruler of all
his possessions, \bibverse{22} to admonish his princes at will and
instruct his elders in wisdom. \bibverse{23} Thus Israel came into
Egypt, Jacob sojourned in the land of Ham. \bibverse{24} His people he
made very fruitful, and mightier than their foes. \bibverse{25} He
inspired them to hate his people, and to deal with his servants
craftily. \bibverse{26} He sent his servant Moses, and Aaron whom he had
chosen, \bibverse{27} portents he wrought in Egypt, and signs in the
land of Ham. \bibverse{28} Darkness he sent, and it fell: yet they gave
no heed to his word. \bibverse{29} He turned their waters into blood,
thus causing their fish to die. \bibverse{30} Their land was alive with
frogs, swarming even in the royal chambers. \bibverse{31} At his command
came flies, and lice in all their borders. \bibverse{32} He gave them
hail for rain and fire that flashed through the land, \bibverse{33}
smiting their vines and figs, breaking the trees of their border.
\bibverse{34} At his command came locusts, young locusts beyond all
counting, \bibverse{35} which ate every herb in the land, ate up, too,
the fruit of their ground. \bibverse{36} He struck down in their land
all the first-born, the firstlings of all their strength \bibverse{37}
Then forth he led Israel with silver and gold, and amongst his tribes no
one was weary. \bibverse{38} Egypt was glad when they left, for terror
had fallen upon them. \bibverse{39} He spread out a cloud to screen
them, and fire to give light in the night. \bibverse{40} He sent quails
at their entreaty, and heavenly bread in abundance. \bibverse{41} He
opened the rock; waters gushed: in the desert they ran like a river.
\bibverse{42} For he remembered his holy promise to Abraham his servant.
\bibverse{43} So he led out his people with joy, his elect with a
ringing cry. \bibverse{44} And he gave them the lands of the nations,
the fruit of their toil for possession, \bibverse{45} that so they might
keep his statutes, and be of his laws observant. Hallelujah.
\hypertarget{psalm-106-the-nations-sin-against-the-lord}{%
\subsection{Psalm 106 --- The Nation's Sin against the
Lord}\label{psalm-106-the-nations-sin-against-the-lord}}
\hypertarget{section-105}{%
\section{106}\label{section-105}}
\bibverse{1} Hallelujah! Give thanks to the Lord for his goodness, for
his kindness endures forever. \bibverse{2} Who can describe his heroic
deeds, or publish all his praise? \bibverse{3} Happy they who act
justly, and do righteousness evermore. \bibverse{4} Remember me, Lord,
as you remember your people, and visit me with your gracious help.
\bibverse{5} May I see the good fortune of your elect, may I share in
the joy of your nation, and in the pride of your heritage. \bibverse{6}
We, like our fathers, have sinned, we have done perversely and wickedly
\bibverse{7} In the land of Egypt our fathers, all heedless of your
wonders, and unmindful of your great kindness, at the Red Sea defied the
Most High. \bibverse{8} But true to his name he saved them, in order to
show his might. \bibverse{9} He rebuked the Red Sea, and it dried; they
marched through the depths as through desert, \bibverse{10} saved from
the hand of the hostile, redeemed from the hand of the foe.
\bibverse{11} The waters covered their enemies: not one of them was
left. \bibverse{12} So then they believed in his words, and began to
sing his praise. \bibverse{13} But soon they forgot his deeds: they did
not wait for his counsel. \bibverse{14} Their greed was ravenous in the
desert; they put God to the test in the wilderness. \bibverse{15} He
gave them the thing they had asked for, but sent wasting disease amongst
them. \bibverse{16} The camp grew jealous of Moses and of Aaron, holy
one of the Lord. \bibverse{17} The earth opened and swallowed up Dathan,
and covered Abiram's company. \bibverse{18} Fire broke out on their
company, flame kindled upon the wicked. \bibverse{19} They made a calf
in Horeb, and bowed to the molten image. \bibverse{20} They exchanged
their glorious God for the image of ox that eats grass. \bibverse{21}
They forgot the God who had saved them by mighty deeds in Egypt
\bibverse{22} Wonders in the land of Ham, terrors by the Red Sea.
\bibverse{23} So he vowed, and would have destroyed them, but for Moses
his elect, who stepped into the breach before him, to divert his deadly
wrath. \bibverse{24} They spurned the delightsome land, they refused to
believe in his word. \bibverse{25} They grumbled in their tents, would
not listen to the voice of the Lord. \bibverse{26} So he swore with
uplifted hand to lay them low in the wilderness; \bibverse{27} to
disperse their seed amongst heathen, to scatter them over the world.
\bibverse{28} Then they joined them to Baal of Peor, and ate what was
offered the dead. \bibverse{29} They provoked him to wrath by their
deeds, and plague broke out amongst them. \bibverse{30} Then Phinehas
stood between, and so the plague was stayed; \bibverse{31} and it was
counted to him for righteousness unto all generations forever.
\bibverse{32} They angered him at the waters of Meribah, through them it
went ill with Moses. \bibverse{33} They rebelled against his spirit, and
he uttered speech that was rash. \bibverse{34} They did not destroy the
nations, as the Lord had commanded them; \bibverse{35} but they mingled
with the heathen, and learnt to do as they did. \bibverse{36} Their idol
gods they worshipped, and they were ensnared by them. \bibverse{37} They
sacrificed their sons and their daughters to the demons. \bibverse{38}
They poured out innocent blood the blood of their sons and daughters
whom they offered to Canaan's idols, and the land was polluted with
blood. \bibverse{39} They became unclean by their works, and adulterous
in their deeds. \bibverse{40} Then the Lord's fury was on his people,
filled with horror at his inheritance. \bibverse{41} He delivered them
to the heathen, to the sway of those who hated them. \bibverse{42} Their
enemies oppressed them, and subdued them under their hand. \bibverse{43}
Many a time he saved them, but they rebelled at his counsel, and were
brought low by their wrongdoing. \bibverse{44} Yet he looked upon their
distress, when he heard their cry. \bibverse{45} He remembered his
covenant, and, in his great kindness, relented. \bibverse{46} He caused
them to be pitied by all who carried them captive. \bibverse{47} Save
us, O Lord our God, and gather us out of the nations, to give thanks to
your holy name, and to make our boast of your praise. \bibverse{48}
Blessed be the Lord, the God of Israel, from everlasting to everlasting.
And let all the people say ``Amen.'' Praise the Lord.
\hypertarget{book-five}{%
\subsection{Book Five}\label{book-five}}
\hypertarget{section-106}{%
\section{107}\label{section-106}}
\hypertarget{psalm-107-the-song-of-the-redeemed}{%
\subsection{Psalm 107 --- The Song of the
Redeemed}\label{psalm-107-the-song-of-the-redeemed}}
\bibverse{1} Give thanks to the Lord for his goodness for his kindness
endures forever. \bibverse{2} Let this be the song of the ransomed, whom
the Lord has redeemed from distress, \bibverse{3} gathering them from
all lands, east, west, north, and south. \bibverse{4} In the wastes of
the desert some wandered, finding no way to a city inhabited.
\bibverse{5} Full of hunger and thirst, their spirit failed.
\bibverse{6} Then they cried to the Lord in their trouble, and he saved
them from their distresses, \bibverse{7} guiding them straight on the
way, till they reached an inhabited city. \bibverse{8} Let them thank
the Lord for his kindness, for his wonderful deeds for people;
\bibverse{9} for the thirsty he satisfies, and the hungry he fills with
good things. \bibverse{10} Some sat in darkness and gloom prisoners in
irons and misery, \bibverse{11} for rebelling against God's word, and
spurning the Most High's counsel. \bibverse{12} Their heart was bowed
with toil; there was no one to help when they stumbled. \bibverse{13}
Then they cried to the Lord in their trouble, and he saved them from
their distresses. \bibverse{14} Out of darkness and gloom he brought
them, and burst their chains. \bibverse{15} Let them praise the Lord for
his kindness, for his wonderful deeds for people. \bibverse{16} For he
shattered the gates of bronze, and broke bars of iron. \bibverse{17}
Some were sick from their wicked ways, and suffering because of their
sins. \bibverse{18} All manner of food they hated; they had come to the
gates of death. \bibverse{19} Then they cried to the Lord in their
trouble, and he saved them from their distresses. \bibverse{20} He sent
his word and healed them, and delivered their life from the pit.
\bibverse{21} Let them praise the Lord for his kindness, for his
wonderful deeds for people. \bibverse{22} Let them offer to him
thankofferings, and with joy tell what things he has done. \bibverse{23}
Some crossed the sea in ships, doing business in great waters.
\bibverse{24} They have seen what the Lord can do, and his wonderful
deeds on the deep. \bibverse{25} At his command rose a tempest, which
lifted the waves on high. \bibverse{26} Up to heaven they went, down to
the depths; their courage failed them. \bibverse{27} They staggered and
reeled like drunkards; all their skills useless. \bibverse{28} Then they
cried to the Lord in their trouble, and he saved them from their
distresses. \bibverse{29} He stilled the storm to a whisper, and the
waves of the sea were hushed. \bibverse{30} They were glad, because it
was quiet; they were led to the haven they longed for. \bibverse{31} Let
them praise the Lord, for his kindness, for his wonderful deeds for
people. \bibverse{32} Where the people assemble, extol him, and praise
him in council of elders. \bibverse{33} He turns streams into a
wilderness, springs of water into thirsty land, \bibverse{34} fruitful
land into a salt waste, because of the sin of the people. \bibverse{35}
A desert he makes pools of water, a land of drought into springs of
water. \bibverse{36} He settles the hungry therein, they establish a
city to live in. \bibverse{37} They sow fields and plant vineyards,
which furnish a fruitful yield. \bibverse{38} By his blessing they
multiply greatly, and he lets not their cattle decrease. \bibverse{39}
Yet when they are bowed and diminished by oppression, misfortune, or
sorrow, \bibverse{40} he pours contempt upon princes, and on trackless
wastes leads them astray \bibverse{41} He lifts the poor out of misery,
and makes families fruitful as flocks. \bibverse{42} At this sight shall
the upright be glad, and all wicked mouths shall be stopped.
\bibverse{43} Let those who are wise observe this, and consider the love
of the Lord
\hypertarget{psalm-108-a-prayer-for-victory}{%
\subsection{Psalm 108 --- A Prayer for
Victory}\label{psalm-108-a-prayer-for-victory}}
\hypertarget{section-107}{%
\section{108}\label{section-107}}
A song. A psalm of David. \bibverse{1} My heart is steadfast, O God, my
heart is steadfast. I would sing, I would make music; awake, my soul.
\bibverse{2} Awake, harp and lyre; I would wake the dawn. \bibverse{3} I
would praise you amongst the peoples, O Lord; make music amongst the
nations to you. \bibverse{4} For great to heaven is your love, and your
faithfulness to the clouds. \bibverse{5} Be exalted, O God, o'er the
heavens, and your glory o'er all the earth. \bibverse{6} So those you
love may be rescued, save by your right hand and answer us. \bibverse{7}
God did solemnly swear: ``As victor will I divide Shechem, portion out
the valley of Succoth. \bibverse{8} Mine is Gilead, mine is Manasseh,
Ephraim is my helmet, Judah my sceptre of rule, \bibverse{9} Moab the
pot that I wash in, on Edom I hurl my sandal, I shout o'er Philistia in
triumph.'' \bibverse{10} O to be brought to the fortified city! O to be
led into Edom! \bibverse{11} Have you not spurned us, O God? You do not
march forth with our armies. \bibverse{12} Grant us help from the foe,
for human help is worthless. \bibverse{13} With God we shall yet do
bravely, he himself will tread down our foes.
\hypertarget{psalm-109-a-prayer-for-the-lords-help}{%
\subsection{Psalm 109 --- A Prayer for the Lord's
Help}\label{psalm-109-a-prayer-for-the-lords-help}}
\hypertarget{section-108}{%
\section{109}\label{section-108}}
For the leader. Of David, a psalm. \bibverse{1} O God whom I praise,
keep not silence; \bibverse{2} for their wicked mouths they have opened
against me, they speak to me with tongues that are false, \bibverse{3}
they beset me with words of hatred, and fight without cause against me.
\bibverse{4} My love they requite with hostility, while for them I lift
up my prayer. \bibverse{5} Evil for good they reward me, and hatred for
my love. \bibverse{6} ``Set over him one who is godless,'' they say,
``an opponent at his right hand. \bibverse{7} From his trial let him
come forth guilty, may his prayer be counted as sin. \bibverse{8} Grant
that his days may be few, that his office be seized by another.
\bibverse{9} Grant that his children be fatherless, and that his wife be
a widow. \bibverse{10} Up and down may his children go begging, expelled
from their desolate home. \bibverse{11} May all that he owns be seized
by the creditor may strangers plunder the fruits of his toil.
\bibverse{12} ``May none extend to him kindness, or pity his fatherless
children. \bibverse{13} His descendants be doomed to destruction!
Blotted out be his name in one generation! \bibverse{14} May his
father's guilt be remembered, and his mother's sin not blotted out:
\bibverse{15} on record always before the Lord, and his memory root from
the earth; \bibverse{16} for he gave no thought to show kindness, but
pursued the poor and the needy, drove the downhearted to death.
\bibverse{17} ``May the curses he loved light upon him, may the
blessings he loathed be afar. \bibverse{18} Like a garment he clothed
him with curses; may they pierce to his inwards like water, and cling to
his bones like oil. \bibverse{19} Let them be like the robe he wraps
round him, like the belt he wears every day.'' \bibverse{20} Be this the
reward of my adversaries, of those who speak evil against me.
\bibverse{21} But you, Lord my God, be true to your name, deal kindly
with me; in your gracious kindness save me. \bibverse{22} For I am poor
and needy, and my heart is wounded within me. \bibverse{23} I am gone
like a lengthening shadow, I am shaken off like a locust. \bibverse{24}
My knees totter from fasting, my flesh is shrivelled and spare.
\bibverse{25} They heap insults upon me: when they see me, they shake
their head. \bibverse{26} Help me, O Lord my God, and save me in your
kindness. \bibverse{27} Teach them that this is your hand, and your own
doing, O Lord. \bibverse{28} Let them curse, if only you bless. Put my
assailants to shame, and make your servant glad. \bibverse{29} My
opponents be clothed with dishonour, and wrapped in a robe of shame.
\bibverse{30} I give thanks to you, Lord, with loud voice, I give praise
in the midst of the throng; \bibverse{31} for he stands by the poor, at
his right hand, to save them from those who condemn them.
\hypertarget{psalm-110-a-promise-of-victory-to-the-king}{%
\subsection{Psalm 110 --- A Promise of Victory to the
King}\label{psalm-110-a-promise-of-victory-to-the-king}}
\hypertarget{section-109}{%
\section{110}\label{section-109}}
Of David, a psalm. \bibverse{1} This said the Lord concerning my lord,
``Sit at my right hand, till I set your foot on the neck of your foes.''
\bibverse{2} On Zion the Lord is wielding your sceptre of might, and
charges you to rule over the foes that surround you. \bibverse{3} The
day that you march to battle your people will follow you gladly young
warriors in holy array, like dew-drops, born of the morning.
\bibverse{4} The Lord has sworn and will not repent, ``As for you, you
are priest for ever as Melchizedek was.'' \bibverse{5} By your side will
the Lord shatter kings on the day of his wrath. \bibverse{6} He will
execute judgement filling the valleys with dead, the broad fields with
shattered heads. \bibverse{7} He will drink of the brook by the way, and
march onward with uplifted head.
\hypertarget{psalm-111-in-praise-of-the-divine-goodness}{%
\subsection{Psalm 111 --- In Praise of the Divine
Goodness}\label{psalm-111-in-praise-of-the-divine-goodness}}
\hypertarget{section-110}{%
\section{111}\label{section-110}}
\bibverse{1} Hallelujah. I will thank the Lord with all my heart, in the
assembled congregation of his people. \bibverse{2} Great are the things
that the Lord has done, worthy of study by those who love them.
\bibverse{3} Majestic and glorious is his work, and his righteousness
abides forever. \bibverse{4} For his marvellous deeds he has won renown;
the Lord is gracious and full of compassion. \bibverse{5} Food he gives
to those who fear him, always he remembers his covenant. \bibverse{6}
His mighty works he has shown to his people, in giving to them the
nations for heritage. \bibverse{7} All that he does is faithful and
right, all his behests are firm and sure. \bibverse{8} They are
established for ever and ever, executed with truth and uprightness.
\bibverse{9} To his people he sent redemption, he has appointed his
covenant forever. His name is holy and awe-inspiring. \bibverse{10} The
fear of the Lord is the beginning of wisdom those who keep it are wise
indeed. His praise abides for ever and ever.
\hypertarget{psalm-112-the-blessings-of-godliness}{%
\subsection{Psalm 112 --- The Blessings of
Godliness}\label{psalm-112-the-blessings-of-godliness}}
\hypertarget{section-111}{%
\section{112}\label{section-111}}
\bibverse{1} Hallelujah. Happy are those who fear the Lord, and greatly
delight in his commandments. \bibverse{2} Mighty on earth shall be their
seed; a blessing shall rest on the race of the upright. \bibverse{3}
Wealth and riches are in their houses, their prosperity stands forever.
\bibverse{4} To the upright arises light in the darkness; full of favour
and pity and kindness are they. \bibverse{5} It is well with those who
show pity and lend, who support all their affairs upon justice.
\bibverse{6} For they will never be shaken; the just will be forever
remembered. \bibverse{7} They will not be afraid of evil tidings, with
steady heart they trust the Lord. \bibverse{8} Their heart is firm and
unafraid: they know they will feast their eyes on their enemies.
\bibverse{9} With lavish hands they give to the poor, and their
prosperity stands forever. They are lifted to heights of triumph and
honour. \bibverse{10} The sight of them fills the wicked with anger:
grinding their teeth with despair. The hopes of the wicked will come to
nothing.
\hypertarget{psalm-113-the-lord-loves-the-humble}{%
\subsection{Psalm 113 --- The Lord loves the
Humble}\label{psalm-113-the-lord-loves-the-humble}}
\hypertarget{section-112}{%
\section{113}\label{section-112}}
\bibverse{1} Hallelujah. Praise the Lord, you his servants, praise the
name of the Lord. \bibverse{2} The name of the Lord be blessed from now
and for evermore. \bibverse{3} From sunrise to sunset is the name of the
Lord to be praised. \bibverse{4} High is the Lord above all nations,
above the heavens is his glory. \bibverse{5} Who is like the Lord our
God, seated on high? \bibverse{6} He bends down to look at the heavens
and earth. \bibverse{7} He raises the weak from the dust, he lifts the
poor from the dunghill, \bibverse{8} and sets them beside the princes,
even the princes of his people. \bibverse{9} He gives the childless
woman a home, and makes her the happy mother of children. Hallelujah.
\hypertarget{psalm-114-the-marvel-of-the-exodus}{%
\subsection{Psalm 114 --- The Marvel of the
Exodus}\label{psalm-114-the-marvel-of-the-exodus}}
\hypertarget{section-113}{%
\section{114}\label{section-113}}
\bibverse{1} When Israel went out of Egypt, Jacob's house from a
barbarous people, \bibverse{2} God chose Judah for himself, Israel
became his kingdom. \bibverse{3} The sea saw it, and fled, Jordan river
ran backwards. \bibverse{4} Mountains skipped like rams, hills like the
young of the flock. \bibverse{5} Why, sea, do you flee? Jordan, why run
backwards? \bibverse{6} Mountains, why skip ram-like? Why, hills, like
the young of the flock? \bibverse{7} Earth, tremble before the Lord, at
the presence of Jacob's God, \bibverse{8} who turns rocks into pools of
water, and flint into fountains of water.
\hypertarget{psalm-115-israels-incomparable-god}{%
\subsection{Psalm 115 --- Israel's Incomparable
God}\label{psalm-115-israels-incomparable-god}}
\hypertarget{section-114}{%
\section{115}\label{section-114}}
\bibverse{1} Not to us, Lord, not to us, but to your name give glory,
for your kindness' and faithfulness' sake. \bibverse{2} Why should the
heathen say, ``Where is now their God?'' \bibverse{3} Our God he is in
heaven; whatever he wishes, he does. \bibverse{4} Their idols are silver
and gold, made by human hands. \bibverse{5} They have mouths, but cannot
speak; they have eyes, but cannot see. \bibverse{6} They have ears, but
cannot hear; they have noses, but cannot smell. \bibverse{7} They have
hands, but cannot feel; they have feet, but cannot walk: no sound comes
from their throats. \bibverse{8} Their makers become like them, so do
all who trust in them. \bibverse{9} O Israel, trust in the Lord: he is
their help and their shield. \bibverse{10} House of Aaron, trust in the
Lord: he is their help and their shield. \bibverse{11} You who fear the
Lord, trust in the Lord he is their help and their shield. \bibverse{12}
The Lord, mindful of us, will bless us: he will bless the house of
Israel, he will bless the house of Aaron. \bibverse{13} He will bless
those who fear the Lord, the small and the great together. \bibverse{14}
May the Lord add to your numbers to you and to your children.
\bibverse{15} Blessed be you of the Lord, creator of heaven and earth.
\bibverse{16} The heavens are the heavens of the Lord, but the earth has
he given to people. \bibverse{17} The dead cannot praise the Lord, nor
those who go down into silence. \bibverse{18} But we will bless the Lord
from now and for evermore. Hallelujah.
\hypertarget{psalm-116-song-of-thanksgiving-for-deliverance}{%
\subsection{Psalm 116 --- Song of Thanksgiving for
Deliverance}\label{psalm-116-song-of-thanksgiving-for-deliverance}}
\hypertarget{section-115}{%
\section{116}\label{section-115}}
\bibverse{1} I love the Lord, for he hears my voice, my pleas for mercy.
\bibverse{2} For he has inclined his ear to me: I will call upon him as
long as I live. \bibverse{3} About me were snares of death, the anguish
of Sheol was upon me: distress and sorrow were mine. \bibverse{4} Then I
called on the name of the Lord: ``I beseech you, O Lord, deliver me.''
\bibverse{5} Gracious and just is the Lord, compassionate is our God.
\bibverse{6} The Lord preserves the simple; when I was drooping, he
saved me. \bibverse{7} Be at peace, my heart, once more, for the Lord
has been good to you. \bibverse{8} You have rescued me from death, my
eyes from tears, my feet from stumbling. \bibverse{9} Before the Lord I
will walk in the land of the living. \bibverse{10} I held fast my faith,
though I said, ``Ah me! I am sore afflicted,'' \bibverse{11} though in
my alarm I said, ``Everyone is a liar.'' \bibverse{12} What shall I
render the Lord for all his bounty to me? \bibverse{13} I will lift up
the cup of salvation, and call on the name of the Lord. \bibverse{14} I
will pay my vows to the Lord in the presence of all his people.
\bibverse{15} Grave in the eyes of the Lord is the death of his loyal
and loved ones. \bibverse{16} Ah, Lord! I am your servant, your servant,
child of your handmaid. You have loosened my bonds. \bibverse{17} I will
offer to you a thank-offering, and call on the name of the Lord.
\bibverse{18} I will pay my vows to the Lord in the presence of all his
people, \bibverse{19} in the courts of the house of the Lord, in the
midst of you, O Jerusalem. Hallelujah.
\hypertarget{psalm-117-a-call-to-praise}{%
\subsection{Psalm 117 --- A Call to
Praise}\label{psalm-117-a-call-to-praise}}
\hypertarget{section-116}{%
\section{117}\label{section-116}}
\bibverse{1} Praise the Lord, all you nations: laud him, all you
peoples. \bibverse{2} For his mighty love is over us: the Lord is
faithful forever. Hallelujah.
\hypertarget{psalm-118-thanksgiving-for-victory}{%
\subsection{Psalm 118 --- Thanksgiving for
Victory}\label{psalm-118-thanksgiving-for-victory}}
\hypertarget{section-117}{%
\section{118}\label{section-117}}
\bibverse{1} Give thanks to the Lord for his goodness, his kindness
endures forever. \bibverse{2} Let the house of Israel now say: his
kindness endures forever. \bibverse{3} Let the house of Aaron now say:
his kindness endures forever. \bibverse{4} Let those who fear the Lord
now say: his kindness endures forever. \bibverse{5} Out of straits I
called on the Lord, the Lord answered and gave me room. \bibverse{6} The
Lord is mine; I am fearless. What can mere people do to me? \bibverse{7}
The Lord is mine, as my help: I shall feast my eyes on my foes.
\bibverse{8} It is better to hide in the Lord than to trust in mortals.
\bibverse{9} It is better to hide in the Lord than to put any trust in
princes. \bibverse{10} Everywhere heathen swarmed round me; in the name
of the Lord I cut them down. \bibverse{11} They swarmed, swarmed around
me; in the name of the Lord I cut them down, \bibverse{12} they swarmed
around me like bees, they blazed like a fire of thorns: in the name of
the Lord I cut them down. \bibverse{13} Sore they pushed me, to make me
fall; but the Lord gave me his help. \bibverse{14} The Lord is my
strength and my song, and he is become my salvation. \bibverse{15} Hark!
In the tents of the righteous glad cries of victory are ringing. The
hand of the Lord has wrought bravely, \bibverse{16} the hand of the Lord
is exalted, the hand of the Lord has wrought bravely. \bibverse{17} I
shall not die: nay, I shall live, to declare the works of the Lord.
\bibverse{18} Though the Lord has chastened me sore, he has not given me
over to death. (The Procession arrives at the Temple) \bibverse{19}
``Open to me the gates of victory. I would enter therein and give thanks
to the Lord.'' (The Welcome) \bibverse{20} ``This is the gate of the
Lord: the righteous may enter therein;'' \bibverse{21} I thank you
because you have heard me, and are become my salvation. \bibverse{22}
The stone which the builders despised is become the head-stone of the
corner. \bibverse{23} This has been wrought by the Lord; it is
marvellous in our eyes. \bibverse{24} This day is the Lord's own
creation: in it let us joy and be glad. \bibverse{25} O Lord, save us,
we pray, O Lord, prosper, we pray. \bibverse{26} Blessed the one who
enters in the name of the Lord. From the house of the Lord we bless you.
\bibverse{27} The Lord is God, he has given us light. Wreathe the dance
with boughs, till they touch the horns of the altar. \bibverse{28} You
are my God, I will thank you; O my God, I will exalt you. \bibverse{29}
Give thanks to the Lord for his goodness: his kindness endures forever.
\hypertarget{psalm-119-the-power-and-comfort-of-the-word-of-god}{%
\subsection{Psalm 119 --- The Power and Comfort of the Word of
God}\label{psalm-119-the-power-and-comfort-of-the-word-of-god}}
\hypertarget{section-118}{%
\section{119}\label{section-118}}
\bibverse{1} Happy they whose life is blameless, who walk by the law of
the Lord. \bibverse{2} Happy they who keep his charges, and seek him
with all their hearts; \bibverse{3} who have done no wrong, but walk in
his ways. \bibverse{4} You yourself have appointed your precepts to be
kept with diligence. \bibverse{5} O to be steadily guided in the keeping
of your statutes! \bibverse{6} Then unashamed shall I be, when I look
towards all your commandments. \bibverse{7} I will thank you with heart
unfeigned, when I learn your righteous judgements. \bibverse{8} I will
observe your statutes: O forsake me not utterly. \bibverse{9} How can a
young person keep their life pure? By giving heed to your word.
\bibverse{10} With all my heart have I sought you, let me not stray from
your commandments. \bibverse{11} In my heart have I treasured your word,
to keep from sinning against you. \bibverse{12} Blessed are you, O Lord;
teach me your statutes. \bibverse{13} With my lips have I rehearsed all
the judgements of your mouth. \bibverse{14} I delight in the way of your
charges, more than in riches of all sorts. \bibverse{15} I will muse
upon your precepts, and look to your paths. \bibverse{16} In your
statutes I delight, I will not forget your word. \bibverse{17} Grant
that your servant may live, and I will observe your word. \bibverse{18}
Open my eyes, that I see wondrous things out of your law. \bibverse{19}
But a guest am I on the earth: hide not your commandments from me.
\bibverse{20} My heart is crushed with longing for your ordinances, at
all times. \bibverse{21} You rebuke the proud, the accursed, who wander
from your commandments. \bibverse{22} Roll away from me scorn and
contempt, for I have observed your charges. \bibverse{23} Though princes
sit plotting against me, your servant will muse on your statutes.
\bibverse{24} Your charges are my delight, they are my counsellors.
\bibverse{25} I lie grovelling in the dust; revive me, as you have
promised. \bibverse{26} I told of my ways, you made answer; teach me
your statutes. \bibverse{27} Grant me insight into your precepts, and I
will muse on your wonders. \bibverse{28} I am overcome with sorrow;
raise me up, as you have promised. \bibverse{29} Put the way of
falsehood from me, and graciously grant me your law. \bibverse{30} I
have chosen the way of fidelity, your ordinances I long for.
\bibverse{31} I hold fast to your charges: O put me not, Lord, to shame.
\bibverse{32} I will run in the way of your commandments, for you give
me room of heart. \bibverse{33} Teach me, O Lord, the way of your
statutes, and I will keep it to the end, \bibverse{34} instruct me to
keep your law, and I will observe it with all my heart. \bibverse{35}
Guide me in the path of your commandments, for therein do I delight.
\bibverse{36} Incline my heart to your charges, and not to greed of
gain. \bibverse{37} Turn away my eyes from vain sights, revive me by
your word. \bibverse{38} Confirm to your servant the promise which is
given to those who fear you. \bibverse{39} Remove the reproach which I
dread, because your judgements are good. \bibverse{40} Behold, I long
for your precepts. Quicken me in your righteousness. \bibverse{41} Visit
me, Lord, with your love and salvation, as you have promised.
\bibverse{42} So shall I answer my slanderers, for my trust is in your
word. \bibverse{43} Snatch not from my mouth the word of truth, for in
your judgements I hope. \bibverse{44} I will keep your law continually,
for ever and evermore. \bibverse{45} So shall I walk in wide spaces, for
I give my mind to your precepts. \bibverse{46} I will speak of your
charge before kings, and will not be ashamed thereof. \bibverse{47} Your
commandments are my delight, I love them exceedingly. \bibverse{48} I
will lift up my hands to your commandments, and muse upon your statutes.
\bibverse{49} Remember your word to your servant, on which you have made
me to hope. \bibverse{50} This is my comfort in trouble, that your word
gives life to me. \bibverse{51} The arrogant utterly scorn me, but I
have not declined from your law. \bibverse{52} When I think of your
judgements of old, O Lord, I take to me comfort. \bibverse{53} I am
seized with glowing anger at the wicked who forsake your law.
\bibverse{54} Your statutes have been to me songs in the house of my
pilgrimage. \bibverse{55} I remember your name in the night, O Lord and
observe your law. \bibverse{56} My lot has been this, that I have kept
your precepts. \bibverse{57} My portion are you, O Lord: I have promised
to keep your words. \bibverse{58} I entreat you with all my heart; grant
me your promised favour. \bibverse{59} I have thought upon my ways, and
turned my feet to your charges. \bibverse{60} I hasted and tarried not
to give heed to your commandments. \bibverse{61} Though the godless have
wound their cords round me, I have not forgotten your law. \bibverse{62}
At midnight I rise to praise you because of your righteous judgements.
\bibverse{63} With all those who fear you I company, aid with those who
observe your precepts. \bibverse{64} The earth, Lord, is full of your
kindness; teach me your Statutes. \bibverse{65} Well have you dealt with
your servant, as you have promised, O Lord. \bibverse{66} Teach me
discretion and knowledge, for I have believed your commandments.
\bibverse{67} Till trouble came I was a wanderer, but now I observe your
word. \bibverse{68} You are good and do good; teach me your statutes.
\bibverse{69} The proud have forged lies against me, but I keep your
precepts with all my heart. \bibverse{70} Their heart is gross like fat,
but I delight in your law. \bibverse{71} It was good for me to be
humbled, that I should learn your statutes. \bibverse{72} The law of
your mouth is better to me than thousands of pieces of silver and gold.
\bibverse{73} Your hands have made me and fashioned me; make me wise to
learn your commandments. \bibverse{74} Those who fear you shall see me
with joy, for in your word have I hoped. \bibverse{75} I know, O Lord,
that your judgements are right, and in faithfulness you have afflicted
me. \bibverse{76} Let your love be a comfort to me, for so have you
promised your servant. \bibverse{77} Visit me with your quickening pity,
for your law is my delight. \bibverse{78} Put the proud to shame, who
have wronged me falsely: I will muse on your precepts. \bibverse{79} Let
those turn to me who fear you, that they may learn your charges.
\bibverse{80} Let my heart be sound in your statutes, that I may not be
put to shame. \bibverse{81} My long for you to rescue me, I put my hope
in your word. \bibverse{82} My eyes pine away for your promise: saying,
``When will you comfort me?'' \bibverse{83} Though shrivelled like
wine-skin in smoke, your statutes I have not forgotten. \bibverse{84}
How few are the days of your servant! When will you judge those who
harass me? \bibverse{85} Proud people have dug for me pits people who do
not conform to your law. \bibverse{86} All your commandments are trusty.
With falsehood they harass me: help me. \bibverse{87} They had nearly
made an end of me, yet I did not forget your precepts. \bibverse{88}
Spare me in your kindness, and I will observe the charge of your mouth.
\bibverse{89} Forever, O Lord, is your word fixed firmly in the heavens.
\bibverse{90} Your truth endures age after age; it is established on
earth, and it stands. \bibverse{91} By your appointment they stand this
day, for all are your servants. \bibverse{92} Had not your law been my
joy, in my misery then had I perished. \bibverse{93} I will never forget
your precepts, for through them you have put life in me. \bibverse{94} I
am yours, O save me, for I give my mind to your precepts. \bibverse{95}
The wicked lay wait to destroy me, but I give heed to your charge.
\bibverse{96} I have seen a limit to all things: but your commandment is
spacious exceedingly. \bibverse{97} O how I love your law! All the day
long I muse on it. \bibverse{98} Your commandment makes me wiser than my
enemies: for it is mine forever. \bibverse{99} I am prudent above all my
teachers, for your charges are my meditation. \bibverse{100} I have
insight more than the aged, because I observe your precepts.
\bibverse{101} I refrain my foot from all wicked ways, that I may keep
your word. \bibverse{102} I turn not aside from your judgements, for you
yourself are my teacher. \bibverse{103} How sweet are your words to my
taste, sweeter than honey to my mouth! \bibverse{104} Insight I win
through your precepts, therefore every false way I hate. \bibverse{105}
Your word is a lamp to my feet, and a light to my path. \bibverse{106} I
have sworn an oath, and will keep it, to observe your righteous
judgements. \bibverse{107} I am afflicted sorely: revive me, O Lord, as
you said. \bibverse{108} Accept, Lord, my willing praise, and teach me
your judgements. \bibverse{109} My life is in ceaseless peril; but I do
not forget your law. \bibverse{110} The wicked set traps for me, yet I
do not stray from your precepts. \bibverse{111} In your charges are my
everlasting inheritance, they are the joy of my heart. \bibverse{112} I
am resolved to perform your statutes forever, to the utmost.
\bibverse{113} I hate people of divided heart, but your law do I love.
\bibverse{114} You are my shelter and shield: in your word do I hope.
\bibverse{115} Begone, you wicked people, I will keep the commands of my
God. \bibverse{116} Uphold me and spare me, as you have promised: O
disappoint me not. \bibverse{117} Hold me up, and I shall be saved: and
your statutes shall be my unceasing delight. \bibverse{118} All who
swerve from your statutes you spurn: their cunning is in vain.
\bibverse{119} All the wicked of earth you count as dross, therefore I
love your charges. \bibverse{120} My flesh, for fear of you, shudders,
and I stand in awe of your judgements. \bibverse{121} Justice and right
have I practised, do not leave me to my oppressors. \bibverse{122} Be
your servant's surety for good, let not the proud oppress me.
\bibverse{123} My eyes pine for your salvation, and for your righteous
promise. \bibverse{124} Deal in your love with your servant, and teach
me your statutes. \bibverse{125} Your servant am I; instruct me, that I
may know your charges. \bibverse{126} It is time for the Lord to act:
they have violated your law. \bibverse{127} Therefore I love your
commandments above gold, above fine gold. \bibverse{128} So by all your
precepts I guide me, and every false way I hate. \bibverse{129} Your
decrees are wonderful, gladly I keep them. \bibverse{130} When your word
is unfolded, light breaks; it imparts to the simple wisdom.
\bibverse{131} With open mouth I pant with longing for your
commandments. \bibverse{132} Turn to me with your favour, as is just to
those who love you. \bibverse{133} Steady my steps by your word, so that
sin have no power over me. \bibverse{134} Set me free from those who
oppress me, and I shall observe your precepts. \bibverse{135} Shine with
your face on your servant, and teach me your statutes. \bibverse{136} My
eyes run down with rills of water, because your law is not kept.
\bibverse{137} Righteous are you, O Lord, and right are your ordinances.
\bibverse{138} The laws you has ordered are just, and trusty
exceedingly. \bibverse{139} My jealousy has undone me, that my foes have
forgotten your words. \bibverse{140} Your word has been tested well; and
your servant loves it. \bibverse{141} I am little and held in contempt,
but your precepts I have not forgotten. \bibverse{142} Just is your
justice forever, and trusty is your law. \bibverse{143} Stress and
strain are upon me, but your commandments are my delight. \bibverse{144}
Right are your charges forever, instruct me that I may live.
\bibverse{145} With my whole heart I cry; O answer me. I would keep your
statutes, O Lord. \bibverse{146} I cry to you: O save me, and I will
observe your charges. \bibverse{147} Ere the dawn I cry for your help:
in your word do I hope. \bibverse{148} Awake I meet the night-watches,
to muse upon your sayings. \bibverse{149} Hear my voice in your
kindness: O Lord, by your judgements revive me. \bibverse{150} Near me
are wicked tormentors, who are far from thoughts of your law;
\bibverse{151} but near, too, are you, O Lord, and all your commandments
are trusty. \bibverse{152} Long have I known from your charges that you
have founded them for all time. \bibverse{153} Look on my misery, and
rescue me; for I do not forget your law. \bibverse{154} Defend my cause
and redeem me: revive me, as you have promised. \bibverse{155} Salvation
is far from the wicked, for their mind is not in your statutes.
\bibverse{156} Great is your pity, O Lord: Revive me, as you have
ordained. \bibverse{157} My foes and tormentors are many, but I have not
declined from your charges. \bibverse{158} I behold the traitors with
loathing, for they do not observe your word. \bibverse{159} Behold how I
love your precepts: revive me, O Lord!, in your kindness. \bibverse{160}
The sum of your word is truth, all your laws are just and eternal.
\bibverse{161} Princes have harassed me wantonly: but my heart stands in
awe of your word. \bibverse{162} Over your word I rejoice as one who
finds great spoil. \bibverse{163} Falsehood I hate and abhor, but your
law do I love. \bibverse{164} Seven times a day do I praise you because
of your righteous judgements. \bibverse{165} Right well do they fare who
love your law: they go on their way without stumbling. \bibverse{166} I
hope for your salvation; O Lord I do your commandments. \bibverse{167} I
observe your charges: I love them greatly. \bibverse{168} I observe your
precepts and charges: all my ways are before you. \bibverse{169} Let my
cry come before you, O Lord: give me insight, as you have promised.
\bibverse{170} Let my prayer enter into your presence: deliver me, as
you have said. \bibverse{171} My lips shall be fountains of praise, that
you teach me your statutes. \bibverse{172} My tongue shall sing of your
word, for all your commandments are right. \bibverse{173} Let your hand
be ready to help me, for your precepts have been my choice.
\bibverse{174} I long, Lord, for your salvation, and your law is my
delight. \bibverse{175} Revive me that I may praise you, and let your
precepts help me. \bibverse{176} I have strayed like a wandering sheep
seek your servant, because I do not forget your commandments.
\hypertarget{psalm-120-prayer-for-deliverance-from-slander-and-treachery}{%
\subsection{Psalm 120 --- Prayer for Deliverance from Slander and
Treachery}\label{psalm-120-prayer-for-deliverance-from-slander-and-treachery}}
\hypertarget{section-119}{%
\section{120}\label{section-119}}
A song of ascents. \bibverse{1} In distress I cried to the Lord, and he
answered me. \bibverse{2} ``Deliver me, Lord, from the lip that is false
and the tongue that is crafty.'' \bibverse{3} What shall he give to you,
you tongue that is crafty? What yet shall he give to you? \bibverse{4}
Arrows of warrior, sharpened, with glowing broom coals together.
\bibverse{5} Woe is me that I sojourn in Meshech, that I live by the
tents of Kedar. \bibverse{6} Already too long have I dwelt amongst those
who hate peace. \bibverse{7} I am for peace: but when I speak of it,
they are for war.
\hypertarget{psalm-121-the-lord-our-protector}{%
\subsection{Psalm 121 --- The Lord Our
Protector}\label{psalm-121-the-lord-our-protector}}
\hypertarget{section-120}{%
\section{121}\label{section-120}}
\hypertarget{a-song-of-ascents}{%
\subsection{A song of ascents}\label{a-song-of-ascents}}
\bibverse{1} I will lift up my eyes to the mountains. O whence shall
help for me come? \bibverse{2} From the Lord comes help to me the
creator of heaven and earth. \bibverse{3} Your foot he will not let
totter: he who guards you will not sleep. \bibverse{4} The guardian of
Israel will neither slumber nor sleep. \bibverse{5} The Lord is he who
guards you your shelter upon your right hand. \bibverse{6} The sun by
day shall not strike you, nor the moon by night. \bibverse{7} From all
evil the Lord will guard you, he will guard your life. \bibverse{8} The
Lord will guard your going and coming from now and for evermore.
\hypertarget{psalm-122-the-joy-and-the-prayer-of-the-pilgrims}{%
\subsection{Psalm 122 --- The Joy and the Prayer of the
Pilgrims}\label{psalm-122-the-joy-and-the-prayer-of-the-pilgrims}}
\hypertarget{section-121}{%
\section{122}\label{section-121}}
A song of ascents. Of David. \bibverse{1} I was glad when they said to
me, ``We will go to the house of the Lord.'' \bibverse{2} Now we are
standing, within your gates, O Jerusalem. \bibverse{3} O Jerusalem,
built close-packed, like a city without breach or gap, \bibverse{4} to
you do the tribes come, the tribes of the Lord, as the law has ordained
for Israel, there to give thanks to the Lord. \bibverse{5} There once
stood thrones of justice even thrones of the household of David.
\bibverse{6} Pray that all may be well with Jerusalem, and well with
those who love you, \bibverse{7} well within your ramparts, and well
within your palaces. \bibverse{8} For the sake of my brethren and
friends, I will wish you now prosperity: \bibverse{9} for the sake of
the house of the Lord our God, I will seek your good.
\hypertarget{psalm-123-a-prayer-for-mercy}{%
\subsection{Psalm 123 --- A Prayer for
Mercy}\label{psalm-123-a-prayer-for-mercy}}
\hypertarget{section-122}{%
\section{123}\label{section-122}}
A song of ascents. \bibverse{1} I Lift up my eyes to you, who are
throned in the heavens. \bibverse{2} As the eyes of a servant turn to
the hand of his master, or the eyes of a maid to the hand of her
mistress, so do our eyes turn to the Lord our God, until he is gracious
to us. \bibverse{3} Be gracious, be gracious to us, Lord. Scorn enough,
and more, have we borne \bibverse{4} More than enough have we borne of
derision from those at their ease, of scorn from those who are haughty.
\hypertarget{psalm-124-a-magnificent-deliverance}{%
\subsection{Psalm 124 --- A Magnificent
Deliverance}\label{psalm-124-a-magnificent-deliverance}}
\hypertarget{section-123}{%
\section{124}\label{section-123}}
A song of ascents. Of David. \bibverse{1} ``Had it not been the Lord who
was for us'' let Israel say \bibverse{2} ``Had it not been the Lord who
was for us when enemies rose against us, \bibverse{3} then alive they'd
have swallowed us up, when their anger was kindled against us.
\bibverse{4} Then the waters would've swept us away, and the torrent
passed over us clean: \bibverse{5} then most sure would've passed over
us clean the wild seething waters.'' \bibverse{6} Blest be the Lord who
has given us not to be torn by their teeth. \bibverse{7} We are like a
bird just escaped from the snare of the fowler. The snare is broken, and
we are escaped. \bibverse{8} Our help is the name of the Lord, the
Creator of heaven and earth.
\hypertarget{psalm-125-a-sure-defence}{%
\subsection{Psalm 125 --- A Sure
Defence}\label{psalm-125-a-sure-defence}}
\hypertarget{section-124}{%
\section{125}\label{section-124}}
A song of ascents. \bibverse{1} Those who trust in the Lord are like
Mount Zion, that cannot be moved, but abides forever. \bibverse{2} Round
Jerusalem are the mountains, and the Lord is round his people from now
and for evermore. \bibverse{3} For he will not suffer the sceptre of
wrong to rest on the land allotted to the righteous; else the righteous
might put forth their own hand to evil. \bibverse{4} Do good, O Lord, to
the good, and to the true-hearted. \bibverse{5} But those who swerve
into crooked ways will the Lord lead away with the workers of evil.
Peace be upon Israel.
\hypertarget{psalm-126-sowing-in-tears}{%
\subsection{Psalm 126 --- Sowing in
Tears}\label{psalm-126-sowing-in-tears}}
\hypertarget{section-125}{%
\section{126}\label{section-125}}
A song of ascents. \bibverse{1} When the Lord turned the fortunes of
Zion, we were like dreamers. \bibverse{2} Then was our mouth filled with
laughter, our tongue with glad shouts; then amongst the nations they
said, ``The Lord has dealt greatly with them.'' \bibverse{3} The Lord
had dealt greatly with us, and we were rejoicing. \bibverse{4} Turn our
fortunes, O Lord, as the streams in the Negreb. \bibverse{5} They who
sow in tears shall reap with glad shouts. \bibverse{6} Forth they fare,
with their burden of seed, and they weep as they go. But home, home,
with glad shouts they shall come with their arms full of sheaves.
\hypertarget{psalm-127-the-need-of-heavenly-help}{%
\subsection{Psalm 127 --- The Need of Heavenly
Help}\label{psalm-127-the-need-of-heavenly-help}}
\hypertarget{section-126}{%
\section{127}\label{section-126}}
A song of ascents. Of Solomon. \bibverse{1} Unless the Lord builds the
house, those who build it labour in vain. Unless the Lord guards the
city, the watchman wakes in vain. \bibverse{2} In vain you rise early,
and finish so late, and so eat sorrow's bread; for he cares for his
loved ones in their sleep. \bibverse{3} Children are a gift of the Lord,
the fruit of the womb, a reward. \bibverse{4} Like arrows wielded by
warriors, are the children of youth. \bibverse{5} Happy the man who has
filled his quiver full of them. He will not be ashamed when he speaks
with enemies in the gate.
\hypertarget{psalm-128-the-blessings-of-home}{%
\subsection{Psalm 128 --- The Blessings of
Home}\label{psalm-128-the-blessings-of-home}}
\hypertarget{section-127}{%
\section{128}\label{section-127}}
A song of ascents. \bibverse{1} Happy all who fear the Lord, who walk in
his ways. \bibverse{2} You will eat what your hands have toiled for, and
be happy and prosperous! \bibverse{3} Like a fruitful vine shall your
wife be in the innermost room of your house: your children, like olive
shoots, round about your table. \bibverse{4} See! This is the blessing
of the man who fears the Lord. \bibverse{5} The Lord shall bless you
from Zion. You will see Jerusalem nourish all the days of your life.
\bibverse{6} You will see your children's children. Peace upon Israel.
\hypertarget{psalm-129-a-prayer-for-the-discomfiture-of-the-enemies-of-zion}{%
\subsection{Psalm 129 --- A Prayer for the Discomfiture of the Enemies
of
Zion}\label{psalm-129-a-prayer-for-the-discomfiture-of-the-enemies-of-zion}}
\hypertarget{section-128}{%
\section{129}\label{section-128}}
A song of ascents. \bibverse{1} ``Sore have they vexed me from youth''
thus let Israel say \bibverse{2} ``Sore have they vexed me from youth,
but they have not prevailed against me. \bibverse{3} ``The ploughers
ploughed on my back, they made their furrows long. \bibverse{4} But the
Lord, who is righteous, has cut the cords of the wicked.'' \bibverse{5}
Let all who are haters of Zion be put to shame and defeated.
\bibverse{6} May they be as the grass on the house-top, which withers
before it shoots up; \bibverse{7} which fills not the arms of the
reaper, nor the lap of the binder of sheaves \bibverse{8} whereof no one
says as they pass, ``The blessing of God be upon you.'' In the name of
the Lord we bless you.
\hypertarget{psalm-130-out-of-the-depths}{%
\subsection{Psalm 130 --- Out of the
Depths}\label{psalm-130-out-of-the-depths}}
\hypertarget{section-129}{%
\section{130}\label{section-129}}
A song of ascents. \bibverse{1} Out of the depths I call to you, Lord.
\bibverse{2} Lord, hear my voice: give heed with your ears to my loud
plea. \bibverse{3} If you should mark sin, Lord, O Lord, who could
stand? \bibverse{4} But with you is forgiveness, that you may be feared.
\bibverse{5} I wait for the Lord, I wait for his word, \bibverse{6} I
look for the Lord more than watchman for morning, than watchman for
morning. \bibverse{7} Israel, hope in the Lord: with the Lord there is
love with him plenteous redemption. \bibverse{8} And he redeems Israel
from all his iniquities.
\hypertarget{psalm-131-as-a-little-child}{%
\subsection{Psalm 131 --- As a Little
Child}\label{psalm-131-as-a-little-child}}
\hypertarget{section-130}{%
\section{131}\label{section-130}}
A song of ascents. Of David. \bibverse{1} O Lord, my heart is not
haughty, my eyes are not lofty, I walk not amongst great things, things
too wonderful for me. \bibverse{2} Yes, I have soothed and stilled
myself, like a young child on his mother's lap; like a young child am I.
\bibverse{3} O Israel, hope in the Lord from now and for evermore.
\hypertarget{psalm-132-the-ancient-promise-to-david-and-zion}{%
\subsection{Psalm 132 --- The Ancient Promise to David and
Zion}\label{psalm-132-the-ancient-promise-to-david-and-zion}}
\hypertarget{section-131}{%
\section{132}\label{section-131}}
\bibverse{1} Remember, O Lord, David all his sufferings, \bibverse{2}
the oath that he swore to the Lord, and his vow to the Strong One of
Jacob, \bibverse{3} never to enter his tent, never to lie on his bed,
\bibverse{4} never to give his eyes sleep or his eyelids slumber,
\bibverse{5} till he had found a place for the Lord, for the Strong One
of Jacob to live in. \bibverse{6} We heard of it in Ephrathah, in the
fields of Jaar we found it. \bibverse{7} We went to the place where he
dwelt, we bowed ourselves low at his footstool. \bibverse{8} ``Arise,
Lord, and enter your resting-place, you and your mighty ark.
\bibverse{9} Let your priests wear a garment of righteousness, your
faithful shout aloud for joy. \bibverse{10} For the sake of David your
servant, do not reject your Anointed.'' \bibverse{11} The Lord swore an
oath to David an oath that he will not break; ``I will set on your
throne a prince of your line. \bibverse{12} If your sons keep my
covenant and the statutes I teach them, then their sons, too, forever,
will sit on your throne.'' \bibverse{13} For the choice of the Lord is
Zion; she is the home of his heart. \bibverse{14} ``This is forever my
resting-place, this is the home of my heart. \bibverse{15} I will
royally bless her provision, and give bread to her poor in abundance.
\bibverse{16} Her priests I will clothe with salvation; her faithful
will shout for joy. \bibverse{17} There will I raise up for David a
dynasty of power. I have set my anointed a lamp that shall never go out.
\bibverse{18} Robes of shame I will put on his foes, but on his head a
glittering crown.''
\hypertarget{psalm-133-family-together}{%
\subsection{Psalm 133 --- Family
together}\label{psalm-133-family-together}}
\hypertarget{section-132}{%
\section{133}\label{section-132}}
A song of ascents. Of David. \bibverse{1} Behold! How good and how
pleasant is the dwelling of kindred together! \bibverse{2} Like precious
oil on the head that ran down on the beard, the beard of Aaron, running
over the collar of his robe: \bibverse{3} like the dew upon Hermon which
falls on the mountains of Zion. For there has the Lord ordained blessing
--- life that is endless.
\hypertarget{psalm-134-an-evening-invocation}{%
\subsection{Psalm 134 --- An Evening
Invocation}\label{psalm-134-an-evening-invocation}}
\hypertarget{section-133}{%
\section{134}\label{section-133}}
A song of ascents. \bibverse{1} Come, praise the Lord, all you the
Lord's servants, who stand by night in the house of the Lord.
\bibverse{2} Lift your hands to the holy place, praise the Lord.
\bibverse{3} The Lord who made heaven and earth, bless you from Zion.
\hypertarget{psalm-135-the-lords-power-revealed-in-nature-and-history}{%
\subsection{Psalm 135 --- The Lord's Power Revealed in Nature and
History}\label{psalm-135-the-lords-power-revealed-in-nature-and-history}}
\hypertarget{section-134}{%
\section{135}\label{section-134}}
\bibverse{1} Hallelujah. Praise the name of the Lord. Praise the Lord,
you his servants, \bibverse{2} who stand in the house of the Lord, in
the courts of the house of our God. \bibverse{3} Praise the Lord, for
the Lord is good: Sing praise to his name it is pleasant. \bibverse{4}
The Lord for himself chose Jacob, Israel as his own special treasure.
\bibverse{5} For I know that the Lord is great, that our Lord is above
all gods. \bibverse{6} All that he wills he does in the heavens and on
the earth, in the seas and in all the abysses. \bibverse{7} Clouds he
brings up from the ends of the earth, lightnings he makes for the rain,
wind he brings out of his storehouses. \bibverse{8} The first-born of
Egypt he struck, both humans and animals. \bibverse{9} Signs and wonders
he sent into your midst, O Egypt, upon Pharaoh and all his servants.
\bibverse{10} Many nations he struck, mighty kings he slew \bibverse{11}
Sihon, king of the Amorites, Og, king of Bashan, and all the kingdoms of
Canaan. \bibverse{12} He gave their land for possession, possession to
Israel his people. \bibverse{13} Your name, O Lord, is forever; your
memorial world without end. \bibverse{14} For the Lord secures right for
his people, and takes pity upon his servants. \bibverse{15} The idols of
heathen are silver made by human hands. \bibverse{16} They have mouths,
but cannot speak: they have eyes, but cannot see. \bibverse{17} They
have ears, but cannot hear: there is no breath in their mouths.
\bibverse{18} Their makers become like them, so do all who trust in
them. \bibverse{19} House of Israel, praise the Lord: house of Araon,
praise the Lord. \bibverse{20} House of Levi, praise the Lord: you who
fear the Lord, praise the Lord. \bibverse{21} Blest be the Lord out of
Zion, who lives in Jerusalem. Hallelujah.
\hypertarget{psalm-136-the-lords-love-revealed-in-nature-and-history}{%
\subsection{Psalm 136 --- The Lord's Love Revealed in Nature and
History}\label{psalm-136-the-lords-love-revealed-in-nature-and-history}}
\hypertarget{section-135}{%
\section{136}\label{section-135}}
\bibverse{1} Give thanks to the Lord for his goodness: for his kindness
endures forever. \bibverse{2} Give thanks to the God of gods: for his
kindness endures forever. \bibverse{3} Give thanks to the Lord of lords:
for his kindness endures forever. \bibverse{4} To him who alone does
great wonders: for his kindness endures forever. \bibverse{5} Whose
wisdom created the heavens: for his kindness endures forever.
\bibverse{6} Who spread forth the earth on the waters: for his kindness
endures forever. \bibverse{7} Who made great lights: for his kindness
endures forever. \bibverse{8} The sun to rule over the day: for his
kindness endures forever. \bibverse{9} Moon and stars to rule over the
night: for his kindness endures forever. \bibverse{10} Who struck the
first-born of Egypt: for his kindness endures forever. \bibverse{11} And
brought Israel out from their midst: for his kindness endures forever.
\bibverse{12} With strong hand and outstretched arm: for his kindness
endures forever. \bibverse{13} Who cut the Red Sea in pieces: for his
kindness endures forever. \bibverse{14} And brought Israel right through
the midst: for his kindness endures forever. \bibverse{15} And shook
Pharaoh with all his host into the sea for his kindness endures forever.
\bibverse{16} Who led his people through the desert: for his kindness
endures forever. \bibverse{17} Who struck down great kings: for his
kindness endures forever. \bibverse{18} And slew noble kings: for his
kindness endures forever. \bibverse{19} Sihon, king of the Amorites: for
his kindness endures forever. \bibverse{20} And Og, king of Bashan: for
his kindness endures forever. \bibverse{21} Who gave their land for
possession: for his kindness endures forever. \bibverse{22} Possession
to Israel his servant: for his kindness endures forever. \bibverse{23}
Who remembered our low estate: for his kindness endures forever.
\bibverse{24} And rescued us from our foes: for his kindness endures
forever. \bibverse{25} Who gives to all flesh food: for his kindness
endures forever. \bibverse{26} Give thanks to the God of heaven: for his
kindness endures forever.
\hypertarget{psalm-137-by-the-waters-of-babylon}{%
\subsection{Psalm 137 --- By the Waters of
Babylon}\label{psalm-137-by-the-waters-of-babylon}}
\hypertarget{section-136}{%
\section{137}\label{section-136}}
\bibverse{1} By the waters of Babylon there we sat, and we wept at the
thought of Zion. \bibverse{2} There on the poplars we hung our harps.
\bibverse{3} For there our captors called for a song: our tormentors,
rejoicing, saying: ``Sing us one of the songs of Zion.'' \bibverse{4}
How can we sing the Lord's song in the foreigner's land? \bibverse{5} If
I forget you, Jerusalem, may my right hand wither. \bibverse{6} May my
tongue stick to the roof of my mouth, if I am unmindful of you, or don't
set Jerusalem above my chief joy. \bibverse{7} Remember the Edomites,
Lord, the day of Jerusalem's fall, when they said, ``Lay her bare, lay
her bare, right down to her very foundation.'' \bibverse{8} Babylon,
despoiler, happy are those who pay you back for all you have done to us.
\bibverse{9} Happy are they who seize and dash your children against the
rocks.
\hypertarget{psalm-138-the-constancy-of-the-lords-care}{%
\subsection{Psalm 138 --- The Constancy of the Lord's
Care}\label{psalm-138-the-constancy-of-the-lords-care}}
\hypertarget{section-137}{%
\section{138}\label{section-137}}
Of David. \bibverse{1} I will thank you, O Lord, with all my heart: in
the sight of the gods I will sing your praise, \bibverse{2} and
prostrate before your holy temple, will praise your name for your
constant love, for you have exulted your promise above all. \bibverse{3}
When I called you, you answered; you gave me strength, you inspired me.
\bibverse{4} All the kings of the earth shall praise you, O Lord, when
they shall have heard the words you have uttered; \bibverse{5} and they
shall sing of the ways of the Lord, and tell of the Lord's transcendent
glory. \bibverse{6} For, high though the Lord is, he looks on the lowly,
and strikes down the haughty from far away. \bibverse{7} Though my way
be distressful, yet you preserve me: you lay your hand on my angry foes,
and your right hand gives me victory. \bibverse{8} The Lord will
accomplish all that which concerns me. Your kindness, O Lord, endures
forever. O do not abandon the work of your hands.
\hypertarget{psalm-139-the-ever-present-god}{%
\subsection{Psalm 139 --- The Ever-Present
God}\label{psalm-139-the-ever-present-god}}
\hypertarget{section-138}{%
\section{139}\label{section-138}}
For the leader. Of David, a psalm. \bibverse{1} O Lord, you search and
know me; \bibverse{2} when I sit, when I rise you know it, you perceive
my thoughts from afar. \bibverse{3} When I walk, when I lie you sift it,
familiar with all my ways. \bibverse{4} There is not a word on my
tongue, but see! Lord, you know it all. \bibverse{5} Behind and before
you beset me, upon me you lay your hand. \bibverse{6} It's too wonderful
for me to know too lofty I cannot attain it. \bibverse{7} Whither shall
I go from your spirit? Or whither shall I flee from your face?
\bibverse{8} If I climb up to heaven, you are there: or make Sheol my
bed, you are there. \bibverse{9} If I lift up the wings of the morning
and fly to the end of the sea, \bibverse{10} there also your hand would
grasp me, and your right hand take hold of me. \bibverse{11} If I say,
``Let the darkness cover me, and night be the light about me,''
\bibverse{12} The dark is not dark for you, but night is as light as the
day. \bibverse{13} For you did put me together; in my mother's womb you
did weave me. \bibverse{14} I give you praise for my fashioning so full
of awe, so wonderful. Your works are wonderful. You knew me right well;
\bibverse{15} my bones were not hidden from you, when I was made in
secret, and woven in the depths of the earth. \bibverse{16} Your eyes
saw all my days: they stood on your book every one written down, before
they were fashioned, while none of them yet was mine. \bibverse{17} But
how far, O God, beyond measure are your thoughts! How mighty their sum!
\bibverse{18} Should I count, they are more than the sand. When I wake,
I am still with you. \bibverse{19} Will you slay the wicked, O God? And
remove from me the bloodthirsty, \bibverse{20} who maliciously defy you
and take your name in vain. \bibverse{21} Do I not hate those who hate
you, Lord? Do I not loathe those who resist you? \bibverse{22} With
perfect hatred I hate them, I count them my enemies. \bibverse{23}
Search me, O God, know my heart: test me, and know my thoughts,
\bibverse{24} and see if guile be in me; and lead me in the way
everlasting.
\hypertarget{psalm-140-a-prayer-for-preservation}{%
\subsection{Psalm 140 --- A Prayer for
Preservation}\label{psalm-140-a-prayer-for-preservation}}
\hypertarget{section-139}{%
\section{140}\label{section-139}}
\bibverse{1} Rescue me, Lord, from evil people; from the violent guard
me \bibverse{2} from those who plot evil in their heart, and stir up war
continually: \bibverse{3} who make their tongue as sharp as a serpent's,
and under whose lips is the poison of adders. Selah \bibverse{4}
Preserve me, O Lord, from the hands of the wicked, from the violent
guard me from those who are plotting to trip up my feet. \bibverse{5}
The proud have hidden a trap for me, cords they have spread as a net for
my feet: snares they have set at the side of my track. Selah
\bibverse{6} I have said to the Lord, ``My God are you; give ear, Lord,
to my loud plea. \bibverse{7} O Lord my Lord, my saviour mighty, you did
cover my head in the day of battle. \bibverse{8} Grant not, O Lord, the
desires of the wicked; and what they have purposed, promote you not.''
Selah \bibverse{9} Let them not lift up their heads against me. May the
mischief they prate bring themselves to destruction, \bibverse{10} may
he rain upon them coals of fire, may he strike them down swiftly, to
rise no more, \bibverse{11} no place in the land may there be for the
slanderer: may the violent be hunted from sorrow to sorrow.
\bibverse{12} I know that the Lord will do right by the weak, and will
execute justice for those who are needy. \bibverse{13} Surely the
righteous shall praise your name, and they who are upright shall live in
your presence.
\hypertarget{psalm-141-a-prayer-for-protection-from-persecutors}{%
\subsection{Psalm 141 --- A Prayer for Protection from
Persecutors}\label{psalm-141-a-prayer-for-protection-from-persecutors}}
\hypertarget{section-140}{%
\section{141}\label{section-140}}
A psalm of David. \bibverse{1} Lord, I call to you: hasten, to me, give
ear to my voice, when I call to you. \bibverse{2} Let my prayer be
presented as incense before you, and my uplifted hands as the evening
meal-offering. \bibverse{3} Set, O Lord, a watch on my mouth, put a
guard on the door of my lips. \bibverse{4} Incline not my heart to an
evil matter, to busy myself in deeds of wickedness, in company with
workers of evil: never may I partake of their dainties. \bibverse{5} A
wound or reproof from a good person in kindness is oil which my head
shall never refuse. In their misfortune my prayer is still with them.
\bibverse{6} Abandoned they are to the hands of their judges: they shall
learn that my words are true. \bibverse{7} Like stones on a country road
cleft and broken so lie our bones scattered for Death to devour.
\bibverse{8} But my eyes are turned towards you, O Lord. Do not pour out
my life, for in you I take refuge. \bibverse{9} Keep me safe from the
trap they have laid for me, from the snares of the workers of trouble.
\bibverse{10} Into their own nets let wicked people fall; while I pass
by in safety.
\hypertarget{psalm-142-a-prayer-for-deliverance-from-persecutors}{%
\subsection{Psalm 142 --- A Prayer for Deliverance from
Persecutors}\label{psalm-142-a-prayer-for-deliverance-from-persecutors}}
\hypertarget{section-141}{%
\section{142}\label{section-141}}
A maskil of David, while he was in the cave, a prayer. \bibverse{1}
Loudly I cry to the Lord: to the Lord plead loudly for mercy,
\bibverse{2} I pour my complaint before him, I tell my troubles to him.
\bibverse{3} When my spirit is faint within me, my path is known to you.
In the way I am wont to walk in, they have hidden a trap for me.
\bibverse{4} I look to the right and the left; but not a friend have I.
No place of refuge is left me, not a man to care for me. \bibverse{5} So
I cry to you, O Lord: I say, ``My refuge are you, all I have in the land
of the living.'' \bibverse{6} Attend to my piercing cry, for very weak
am I. Save me from those who pursue me, for they are too strong for me.
\bibverse{7} Free me from prison, that I may give thanks to your name,
for the righteous are patiently waiting till you show your bounty to me.
\hypertarget{psalm-143-a-prayer-for-deliverance-and-guidance}{%
\subsection{Psalm 143 --- A Prayer for Deliverance and
Guidance}\label{psalm-143-a-prayer-for-deliverance-and-guidance}}
\hypertarget{section-142}{%
\section{143}\label{section-142}}
A psalm of David. \bibverse{1} Listen, O Lord, to my prayer; give ear to
my plea. In your faithfulness give me answer, and in your righteousness.
\bibverse{2} With your servant O enter you not into judgement, for in
your sight can no one alive be justified. \bibverse{3} For the enemy
persecutes me, crushing my life to the ground, making me live in the
darkness, as those who have long been dead. \bibverse{4} My spirit is
faint within me, my heart is bewildered within me. \bibverse{5} I
remember the days of old, and brood over all you have done, musing on
all that your hands have wrought. \bibverse{6} I spread out my hands to
you: I thirst for you, like parched earth. Selah \bibverse{7} Answer me
soon, Lord, because my spirit is spent. Hide not your face from me, else
become I like those who go down to the pit. \bibverse{8} Let me learn of
your love in the morning, for my trust is in you. Teach me the way I
should go: for my heart longs for you. \bibverse{9} Save me, O Lord,
from my foes: for to you I have fled for refuge. \bibverse{10} Teach me
to do your will, for you yourself are my God. Guide me by your good
spirit, O Lord, on a way that is smooth. \bibverse{11} Be true to your
name Lord, spare me, bring me out of distress in your faithfulness.
\bibverse{12} In your kindness extinguish my enemies, and all those who
vex me destroy; for I am your servant.
\hypertarget{psalm-144-the-warriors-song}{%
\subsection{Psalm 144 --- The Warrior's
Song}\label{psalm-144-the-warriors-song}}
\hypertarget{section-143}{%
\section{144}\label{section-143}}
Of David. \bibverse{1} Blest be the Lord my rock, who trains my hands
for war, my fingers for fighting. \bibverse{2} My rock and my fortress,
my tower, my deliverer, my shield, behind whom I take refuge, who lays
nations low at my feet. \bibverse{3} Lord, what are mortals that you
care for them, humans, that you think of them? \bibverse{4} They are
like a breath, their days as a shadow that passes. \bibverse{5} Lord,
bow your heavens and come down: touch the hills, so that they smoke.
\bibverse{6} Flash forth lightning and scatter them, your arrows send
forth and confound them. \bibverse{7} Stretch out your hand from on
high; pluck me out of the mighty waters, out of the hands of foreigners,
\bibverse{8} who speak with the mouth of falsehood, and lift their right
hand to swear lies. \bibverse{9} O God, a new song I would sing you, on
a ten-stringed harp make you music. \bibverse{10} For to kings you give
the victory, and David your servant you save. \bibverse{11} Snatch me
from the cruel sword, rescue me from the hand of foreigners, who speak
with the mouth of falsehood, and lift their right hand to swear lies.
\#\# The Prosperity of the Lord's People \bibverse{12} May our sons in
their youth be as plants well tended: our daughters like cornices carved
as in palaces. \bibverse{13} May our barns be bursting with produce of
all kinds. In the fields may our sheep bear by thousands and ten
thousands. \bibverse{14} May our cattle be fat, our walls unbreached,
may no cry of distress ring in our streets. \bibverse{15} Happy the
people who fares so well: and so fares the people whose God is the Lord.
\hypertarget{psalm-145-the-kingdom-everlasting}{%
\subsection{Psalm 145 --- The Kingdom
Everlasting}\label{psalm-145-the-kingdom-everlasting}}
\hypertarget{section-144}{%
\section{145}\label{section-144}}
A song of praise. Of David. \bibverse{1} I will exalt you, my God, O
king: I will praise your name for ever and ever. \bibverse{2} I will
bless you every day: I will praise your name for ever and ever.
\bibverse{3} Great is the Lord and worthy all praise, his greatness is
unsearchable. \bibverse{4} One age to another shall praise your deeds,
declaring the mighty things you have done. \bibverse{5} Of your glorious
majesty they shall tell, and I will muse of your many wonders.
\bibverse{6} Of the might of your terrible acts they shall speak, and
the tale of your great deeds I will tell. \bibverse{7} The fame of your
abundant goodness and righteousness they shall pour forth in song.
\bibverse{8} The Lord is full of grace and pity, patient and rich in
loving-kindness. \bibverse{9} The Lord is good to all the world, and his
pity is over all things that he made. \bibverse{10} All your works give
you thanks, O Lord, and you are blessed of those who love you.
\bibverse{11} They shall speak of your glorious kingdom, and of your
might shall they discourse, \bibverse{12} making known to all his mighty
acts, and the glorious majesty of his kingdom. \bibverse{13} Yours is a
kingdom that lives through all ages: through all generations extends
your dominion. The Lord is faithful in all that he promises, gracious is
he in all that he does. \bibverse{14} The Lord upholds all who fall; he
lifts up all who are bowed down. \bibverse{15} The eyes of all look in
hope to you, and you give them their food in due season. \bibverse{16}
You yourself open your hand, and fill with your favour all things that
live. \bibverse{17} The Lord is righteous in all his ways, gracious is
he in all that he does. \bibverse{18} The Lord is near to all who call
him, to all who call upon him in truth. \bibverse{19} He will fulfil the
desires of those who fear him; he will hear their cry for help and save
them. \bibverse{20} The Lord is the keeper of all who love him, but all
the wicked will he destroy. \bibverse{21} My mouth will utter the praise
of the Lord, and all life will bless his holy name for ever and ever.
\hypertarget{psalm-146-the-great-protector}{%
\subsection{Psalm 146 --- The Great
Protector}\label{psalm-146-the-great-protector}}
\hypertarget{section-145}{%
\section{146}\label{section-145}}
\bibverse{1} My soul, praise the Lord. \bibverse{2} I will praise the
Lord, while I live; I will sing to my God, while I am. \bibverse{3} Put
not your trust in princes mortals, in whom is no help. \bibverse{4} When
their breath goes out, they go back to the dust: on that very day their
purposes perish. \bibverse{5} Happy those whose help is the God of
Jacob: whose hope is set on the Lord their God, \bibverse{6} the Creator
of heaven and earth, the sea, and all that is in them. He remains
eternally loyal. \bibverse{7} For the wronged he executes justice; he
gives bread to the hungry; the Lord releases the prisoners. \bibverse{8}
The Lord gives sight to the blind: the Lord raises those who are bowed.
The Lord loves the righteous. \bibverse{9} The Lord preserves the
stranger, upholds the widow and orphan, but the wicked he leads to
disaster. \bibverse{10} The Lord shall reign forever, your God, O Zion,
to all generations. Hallelujah.
\hypertarget{psalm-147-the-lords-love-and-power-revealed-in-nature}{%
\subsection{Psalm 147 --- The Lord's Love and Power Revealed in
Nature}\label{psalm-147-the-lords-love-and-power-revealed-in-nature}}
\hypertarget{section-146}{%
\section{147}\label{section-146}}
\bibverse{1} Hallelujah. It is good to sing praise to our God, for
praise is sweet and seemly. \bibverse{2} The Lord builds up Jerusalem,
the outcasts of Israel he gathers. \bibverse{3} He heals the broken in
heart, and binds up their wounds. \bibverse{4} He counts the numberless
stars, he gives names to them all. \bibverse{5} Great is our Lord, rich
in power, and measureless is his wisdom. \bibverse{6} The Lord lifts up
the down-trodden, the wicked he brings to the ground. \bibverse{7} Sing
songs of thanks to the Lord, and play on the lyre to our God.
\bibverse{8} For he covers the sky with clouds, he prepares rain for the
earth, makes grass to grow on the mountains. \bibverse{9} He gives the
cattle their food the young ravens when they cry. \bibverse{10} His
pleasure is not in the strength of the horse, his joy is not in the
speed of a runner; \bibverse{11} but the Lord has his pleasure in those
who fear him, in those who wait for his kindness. \bibverse{12} Praise
the Lord, then, O Jerusalem: sing praise to your God, O Zion.
\bibverse{13} For he strengthens the bars of your gates, and blesses
your children within you. \bibverse{14} He brings peace to your borders,
and choicest of wheat in abundance. \bibverse{15} He sends his command
to the earth: his word runs very swiftly. \bibverse{16} Snow he gives
like wool, frost he scatters like ashes. \bibverse{17} He casts forth
his ice like morsels: who can stand before his cold? \bibverse{18} He
sends forth his word, and melts them: his wind blows the waters flow.
\bibverse{19} He declares his word to Jacob, his statutes and judgements
to Israel. \bibverse{20} No other nation did he do this for, they know
nothing of his judgements. Hallelujah.
\hypertarget{psalm-148-the-universal-chorus-of-praise}{%
\subsection{Psalm 148 --- The Universal Chorus of
Praise}\label{psalm-148-the-universal-chorus-of-praise}}
\hypertarget{section-147}{%
\section{148}\label{section-147}}
\bibverse{1} Praise the Lord from the heavens, praise him in the
heights. \bibverse{2} Praise him, all his angels; praise him, all his
hosts. \bibverse{3} Praise him, sun and moon; praise him, all stars of
light. \bibverse{4} Praise him, you highest heavens, and you waters
above the heavens. \bibverse{5} Let them praise the name of the Lord,
for at his command they were made. \bibverse{6} And he fixed them for
ever and ever by a law which they dare not transgress. \bibverse{7}
Praise the Lord from the earth: you depths, with your monsters, all.
\bibverse{8} Fire, hail, snow and ice, and stormy wind doing his word.
\bibverse{9} All you mountains and hills, all you fruit trees and
cedars, \bibverse{10} all you wild beasts and tame, creeping things,
birds on the wing. \bibverse{11} All you kings and nations of earth; all
you princes and judges of earth: \bibverse{12} young men and maidens
together, old men and children together. \bibverse{13} Let them praise
the name of the Lord, for his name alone is exalted. Over heaven and
earth is his glory. \bibverse{14} He has lifted his people to honour.
Wherefore this chorus of praise from his saints, from Israel, the people
who stand in his fellowship. Hallelujah.
\hypertarget{psalm-149-song-of-victory}{%
\subsection{Psalm 149 --- Song of
Victory}\label{psalm-149-song-of-victory}}
\hypertarget{section-148}{%
\section{149}\label{section-148}}
\bibverse{1} Hallelujah. Sing to the Lord a new song, sound his praise
where the faithful are gathered. \bibverse{2} Let Israel rejoice in its
maker, sons of Zion exult in their king. \bibverse{3} Let them praise
his name in the dance, making music with lyre and with timbrel.
\bibverse{4} For the Lord delights in his people, adorning the humble
with victory. \bibverse{5} Let the faithful exult and extol him with
glad ringing cries all night long. \bibverse{6} High praises of God in
their mouth, and a two-edged sword in their hand: \bibverse{7} on the
heathen to execute vengeance, and chastisement sore on the nations,
\bibverse{8} binding their kings with chains, and their nobles with
fetters of iron, \bibverse{9} to execute on them the doom that is
written. This is the glory of all his faithful. Hallelujah.
\hypertarget{psalm-150-hallelujah}{%
\subsection{Psalm 150 --- Hallelujah}\label{psalm-150-hallelujah}}
\hypertarget{section-149}{%
\section{150}\label{section-149}}
\bibverse{1} Hallelujah. Praise God in his holy place. Praise him in the
sky, his stronghold. \bibverse{2} Praise him for his deeds of power.
Praise him for his boundless greatness. \bibverse{3} Praise him with
blast of horn; praise him with harp and lyre. \bibverse{4} Praise him
with timbrel and dance; praise him with strings and pipe. \bibverse{5}
Praise him with resounding cymbals, praise him with clashing cymbals.
\bibverse{6} Let all that has breath praise the Lord. Hallelujah.
| {
"alphanum_fraction": 0.759323947,
"avg_line_length": 57.8785226302,
"ext": "tex",
"hexsha": "4a1734c14af9c09a9f78da1b38e30457c8868b40",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "bibliadelpueblo/BibliaLibre",
"max_forks_repo_path": "Bibles/English.OpenEnglishBible/out/tex/03-Psalms.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "bibliadelpueblo/BibliaLibre",
"max_issues_repo_path": "Bibles/English.OpenEnglishBible/out/tex/03-Psalms.tex",
"max_line_length": 79,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "bibliadelpueblo/BibliaLibre",
"max_stars_repo_path": "Bibles/English.OpenEnglishBible/out/tex/03-Psalms.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 78031,
"size": 271103
} |
%!TEX root = ../../main.tex
\subsection{Log Anomaly Detection:}
Anomaly detection in log file aims to find text, which can indicate the reasons and the nature of failure of a system. Most commonly, a domain specific regular-expression is constructed from past experience which finds new faults by pattern matching. The limitation of such approaches is that newer messages of failures are easily are not detected~\cite{memon2008log}.
The unstructured and diversity in both format and semantics of log data pose significant challenges to log anomaly detection. Anomaly detection techniques should adapt to concurrent setting of log data generated and detect outliers in real time. Following the success of deep neural networks in real time text analysis, several DAD techniques illustrated in Table~\ref{tab:logAnomalyDetect} which model the log data as natural language sequence are shown very effective in detecting outliers.
%%%%%%% Begin table fraud detection
\begin{table*}
\begin{center}
\caption{Examples of Deep learning anomaly detection techniques used in system logs.
\\CNN: Convolution Neural Networks, LSTM : Long Short Term Memory Networks
\\GRU: Gated Recurrent Unit, DNN : Deep Neural Networks
\\AE: Autoencoders, DAE: Denoising Autoencoders}
\captionsetup{justification=centering}
\label{tab:logAnomalyDetect}
\scalebox{0.85}{
\begin{tabular}{ | p{2cm} | p{2cm} | p{9cm} |}
\hline
\textbf{Techniques} & \textbf{Section} & \textbf{References} \\ \hline
LSTM & Section ~\ref{sec:rnn_lstm_gru} & ~\cite{hochreiter1997long},~\cite{brown2018recurrent},~\cite{tuor2017deep},~\cite{das2018desh},~\cite{malhotra2015long} \\\hline
AE & Section ~\ref{sec:ae} & ~\cite{du2017deeplog},~\cite{andrews2016detecting} ,~\cite{sakurada2014anomaly},~\cite{nolle2018analyzing},~\cite{nolle2016unsupervised}\\\hline
LSTM-AE & Section ~\ref{sec:rnn_lstm_gru}, ~\ref{sec:ae} & ~\cite{grover2018anomaly},~\cite{wolpher2018anomaly} \\\hline
RNN & Section ~\ref{sec:rnn_lstm_gru} & ~\cite{brown2018recurrent},~\cite{zhang2018role},~\cite{nanduri2016anomaly},~\cite{fengming2017anomaly}\\\hline
DAE & Section ~\ref{sec:ae} & ~\cite{marchi2015non},~\cite{nolle2016unsupervised}\\\hline
CNN & Section ~\ref{sec:cnn} & ~\cite{lu2018detecting},~\cite{yuan2018insider},~\cite{racki2018compact},~\cite{zhou2016spatial},~\cite{gorokhov2017convolutional},~\cite{liao2017deep},~\cite{cheng2017deep},~\cite{zhang2018alphamex}\\\hline
\end{tabular}}
\end{center}
\end{table*}
%%%%%%%%% End of Log anomaly detection
| {
"alphanum_fraction": 0.7452647855,
"avg_line_length": 64.675,
"ext": "tex",
"hexsha": "223c6a85bb6e2aaf6e1d1e09485329e2d0f85ff1",
"lang": "TeX",
"max_forks_count": 27,
"max_forks_repo_forks_event_max_datetime": "2021-12-06T07:59:29.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-01-15T02:42:12.000Z",
"max_forks_repo_head_hexsha": "aa775990a4b23306885979c4ef8e8cb3ed00441b",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "raghavchalapathy/Deep-Learning-for-Anomaly-Detection-A-Survey_Arxiv_WorkingDocument",
"max_forks_repo_path": "ARXIV_DAD_Survey/sections/applications/logAnomalyDetect.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "aa775990a4b23306885979c4ef8e8cb3ed00441b",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "raghavchalapathy/Deep-Learning-for-Anomaly-Detection-A-Survey_Arxiv_WorkingDocument",
"max_issues_repo_path": "ARXIV_DAD_Survey/sections/applications/logAnomalyDetect.tex",
"max_line_length": 492,
"max_stars_count": 107,
"max_stars_repo_head_hexsha": "aa775990a4b23306885979c4ef8e8cb3ed00441b",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "raghavchalapathy/Deep-Learning-for-Anomaly-Detection-A-Survey",
"max_stars_repo_path": "ARXIV_DAD_Survey/sections/applications/logAnomalyDetect.tex",
"max_stars_repo_stars_event_max_datetime": "2021-11-09T12:03:57.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-01-11T12:06:24.000Z",
"num_tokens": 790,
"size": 2587
} |
% file: Analysis.tex
% Analysis, in unconventional ``grande'' format; fitting a widescreen format
%
% github : ernestyalumni
% linkedin : ernestyalumni
% wordpress.com : ernestyalumni
%
% This code is open-source, governed by the Creative Common license. Use of this code is governed by the Caltech Honor Code: ``No member of the Caltech community shall take unfair advantage of any other member of the Caltech community.''
%
\documentclass[10pt]{amsart}
\pdfoutput=1
%\usepackage{mathtools,amssymb,lipsum,caption}
\usepackage{mathtools,amssymb,caption}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
%\usepackage[version=3]{mhchem}
%\usepackage{mhchem}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,backgrounds} % background for framed option
\usepackage{multicol}
\hypersetup{colorlinks=true,citecolor=[rgb]{0,0.4,0}}
\oddsidemargin=15pt
\evensidemargin=5pt
\hoffset-45pt
\voffset-55pt
\topmargin=-4pt
\headsep=5pt
\textwidth=1120pt
\textheight=595pt
\paperwidth=1200pt
\paperheight=700pt
\footskip=40pt
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
%\newtheorem*{main}{Main Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem{definition}{Definition}
\newtheorem{remark}{Remark}
\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}
%This defines a new command \questionhead which takes one argument and
%prints out Question #. with some space.
\newcommand{\questionhead}[1]
{\bigskip\bigskip
\noindent{\small\bf Question #1.}
\bigskip}
\newcommand{\problemhead}[1]
{
\noindent{\small\bf Problem #1.}
}
\newcommand{\exercisehead}[1]
{ \smallskip
\noindent{\small\bf Exercise #1.}
}
\newcommand{\solutionhead}[1]
{
\noindent{\small\bf Solution #1.}
}
\title{Analysis Dump}
\author{Ernest Yeung \href{mailto:[email protected]}{[email protected]}}
\date{20 Nov 2017}
\keywords{Analysis, Functional Analysis}
\begin{document}
\definecolor{darkgreen}{rgb}{0,0.4,0}
\lstset{language=Python,
frame=bottomline,
basicstyle=\scriptsize,
identifierstyle=\color{blue},
keywordstyle=\bfseries,
commentstyle=\color{darkgreen},
stringstyle=\color{red},
}
%\lstlistoflistings
\maketitle
From the beginning of 2016, I decided to cease all explicit crowdfunding for any of my materials on physics, math. I failed to raise \emph{any} funds from previous crowdfunding efforts. I decided that if I was going to live in \emph{abundance}, I must lose a scarcity attitude. I am committed to keeping all of my material \textbf{open-sourced}. I give all my stuff \emph{for free}.
In the beginning of 2017, I received a very generous donation from a reader from Norway who found these notes useful, through \emph{PayPal}. If you find these notes useful, feel free to donate directly and easily through \href{https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=ernestsaveschristmas%2bpaypal%40gmail%2ecom&lc=US&item_name=ernestyalumni¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted}{PayPal}, which won't go through a 3rd. party such as indiegogo, kickstarter, patreon. Otherwise, under the \emph{open-source MIT license}, feel free to copy, edit, paste, make your own versions, share, use as you wish.
\noindent gmail : ernestyalumni \\
linkedin : ernestyalumni \\
twitter : ernestyalumni \\
\begin{multicols*}{2}
\setcounter{tocdepth}{1}
\tableofcontents
\begin{abstract}
Everything about Analysis, real analysis, complex analysis, functional analysis, Fourier series, Fourier transforms, Fourier analysis
\end{abstract}
\part{Fourier Analysis}
\section{Fourier transform}
cf. Ch. IX of Reed and Simon \cite{ReSi1980}, from pp. 318
\begin{definition}[Schwartz space]
Showing Reed and Simon \cite{ReSi1980}'s notation and wikipedia's notation (that'll be used here), respectively
\[
\mathcal{S}(\mathbb{R}^n) \equiv S(\mathbb{R}^n) = \text{ Schwartz space of $C^{\infty}$ functions of rapid decrease, i.e. }
\]
\begin{equation}
S(\mathbb{R}^n) = \lbrace f\in C^{\infty}(\mathbb{R}^n) | \| f\|_{\alpha, \beta} < \infty, \, \forall \, \alpha, \beta \in \mathbb{Z}^n_+ \rbrace
\end{equation}
where $\alpha , \beta$ are multiindices, $C^{\infty}(\mathbb{R}^n)$ is set of smooth functions from $\mathbb{R}^n$ to $\mathbb{C}$, and
\begin{equation}
\| f\|_{\alpha,\beta} = \sup_{\mathbf{x} \in \mathbb{R}^n }{ | \mathbf{x}^{\alpha} D^{\beta} f(\mathbf{x}) | }
\end{equation}
cf. wikipedia definition of Schwartz space
\end{definition}
cf. IX.1 The Fourier transform on $S(\mathbb{R}^n)$ and $S'(\mathbb{R}^n)$, convolutions of Reed and Simon \cite{ReSi1980}
\begin{definition}
Suppose $f\in S(\mathbb{R}^n)$, \\
\textbf{Fourier transform} of $f$, $\widehat{f}$, give by
\begin{equation}
\widehat{f}(\mathbf{\lambda}) = \frac{1}{(2\pi)^{n/2)}} \int_{\mathbb{R}^n} e^{-i \mathbf{x}\cdot \mathbf{\lambda} } f(\mathbf{x})d\mathbf{x}
\end{equation}
where $\mathbf{x} \cdot \mathbf{\lambda} =\sum_{i=1}^n x_i \lambda_i $
Inverse Fourier transform of $f$, $\check{f}$,
\[
\check{f}(\lambda) = \frac{1}{(2\pi)^{n/2}} \int_{\mathbb{R}^n} e^{i\mathbf{x}\cdot \mathbf{\lambda} } f(\mathbf{x}) d\mathbf{x}
\]
Reed and Simon \cite{ReSi1980} mentions this notation and I will use it more here
\[
\widehat{f} \equiv \mathcal{F} f
\]
\end{definition}
Standard multiindex notation:
\[
\alpha = \langle \alpha_1, \dots \alpha_n \rangle
\]
$n$-tuple of nonnegative integers, $\alpha \in \mathbb{Z}_+^n$
$I_+^n \equiv $ collection of all multiindices \\
Define:
\[
\begin{gathered}
|\alpha | := \sum_{i=1}^n \alpha_i \\
\mathbf{x}^{\alpha} := x_1^{\alpha_1} x_2^{\alpha_2} \dots x_n^{\alpha_n} \\
D^{\alpha} := \frac{\partial^{ |n |} }{ \partial x_1^{\alpha_1} \partial x_2^{\alpha_2} \dots \partial x_n^{\alpha_n} }
x^2 := \sum_{i=1}^n x_i^2
\end{gathered}
\]
\begin{lemma}
$ \widehat{ \, } $, $\check{\, } \equiv \mathcal{F}, \mathcal{F}^{-1}$ are cont. linear transformations of $S(\mathbb{R}^n)$ into $S(\mathbb{R}^n)$.
Furthermore, if $\alpha, \beta \in I_+^n$, then
\begin{equation}
((i\lambda)^{\alpha} D^{\beta}\widehat{f})(\lambda) = \widehat{ D^{\alpha}((-ix)^{\beta}f(x)) }
\end{equation}
cf. (IX.1) of Reed and Simon \cite{ReSi1980}.
\end{lemma}
\begin{proof}
$\widehat{ \, } \equiv \mathcal{F}$ clearly linear (since $\int$ linear), \\
Since
\[
\begin{gathered}
(\lambda^{\alpha} D^{\beta} \widehat{f} )(\lambda) = \lambda^{\alpha} D^{\beta} \frac{1}{(2\pi)^{n/2}} \int_{\mathbb{R}^n } e^{-i\mathbf{x}\cdot \mathbf{\lambda}} f(\mathbf{x})d\mathbf{x} = \frac{1}{ (2\pi)^{n/2}} \int_{\mathbb{R}^n} \lambda^a (-i\mathbf{x})^{\beta} e^{-i\mathbf{\lambda} \cdot \mathbf{x} } f(\mathbf{x}) d\mathbf{x} = \\
= \frac{1}{ (2\pi)^{n/2}} \int_{\mathbb{R}^n} \frac{1}{(-i)^a} (D_x^a e^{-i\mathbf{\lambda} \cdot \mathbf{x}}) (-i\mathbf{x})^{\beta} f(\mathbf{x}) d\mathbf{x} = 0 + \frac{(-i)^{\alpha} }{ (2\pi)^{n/2}} \int_{\mathbb{R}^n} e^{-i \mathbf{\lambda} \cdot \mathbf{x} } D_x^{\alpha} ((-i\mathbf{x})^{\beta}f(\mathbf{x}))d\mathbf{x}
\end{gathered}
\]
Last step is just integration by parts and using given $\| f \|_{\alpha, \beta} < \infty$ property.
Conclude $\| \widehat{f} \|_{\alpha, \beta} = \sup_{\mathbf{\lambda} } | \mathbf{\lambda}^{\alpha} (D^{\beta} \widehat{f})(\lambda) | \leq \frac{1}{ (2\pi)^{n/2}} \int | D_{\mathbf{x}}^{\alpha}(\mathbf{x}^{\beta} f) | d\mathbf{x} < \infty$.
Thus,
\[
\mathcal{F}: S(\mathbb{R}^n) \to S(\mathbb{R}^n)
\]
and
\[
((i\mathbf{\lambda})^{\alpha} D^{\beta}\widehat{f})(\lambda) = \widehat{ D^{\alpha}((-ix)^{\beta}f(x)) }
\]
If $k$ large enough, $\int (1+x^2)^{-k} d\mathbf{x} < \infty$ (Clearly $\int \frac{1}{(1+x^2)}= \arctan{x} \xrightarrow{ \infty, -\infty} \frac{\pi}{2} - (-\frac{\pi}{2}) = \pi < \infty$), so
\[
\| \widehat{f} \|_{\alpha, \beta} \leq \frac{1}{(2\pi)^{n/2}} \int_{\mathbb{R}^n} \frac{ (1+x^2)^{-k} }{ (1+x^2 )^{-k} } |D_x^{\alpha} (\mathbf{x}^{\beta} f) | d\mathbf{x} \leq \frac{1}{(2\pi)^{n/2}} (\int_{\mathbb{R}^n } (1+x^2)^{-k} d\mathbf{x}) \sup_{\mathbf{x}} |(1+x^2)^k D_x^{\alpha} (\mathbf{x}^{\beta} f)|
\]
By Leibnitz rule, $(fg)^{(n)}(x) = \sum_{k=0}^n \binom{n}{k} f^{(n-k)}(\mathbf{x}) g^{(k)}(\mathbf{x}) $, $\exists \, $ constants $c_j$, multiindices $\alpha_j \beta_j \in I_+^n$, s.t.
\[
\| \widehat{f} \|_{\alpha, \beta} \leq \sum_{i=1}^M c_j \| f\|_{\alpha_j,\beta_j}
\]
where $\| f\|_{\alpha_j , \beta_j} = \sup_{\mathbf{x} \in \mathbb{R}^n } | \mathbf{x}^{\alpha} D^{\beta} f(\mathbf{x}) |$, which we recall, was used.
Thus $\| \widehat{f} \|_{\alpha,\beta}$ bounded, and by, as Reed and Simon \cite{ReSi1980} said, Thm. V.4, therefore cont. But I think that reference is incorrect. I looked up possible theorems online, and possibly it's, \\
since $\widehat{f}$ bounded and has closed graph $(\mathbf{\lambda}, \widehat{f}(\mathbf{\lambda}))$, then $f$ cont.
Likewise for $\check{f}$
\end{proof}
cf. Thm. IX.1. of Reed and Simon (1980)\cite{ReSi1980}
\begin{theorem}[(Fourier inverse thm.)]
Fourier transform $\mathcal{F}$ is linear, bicont., bijection: $\mathcal{F} : S(\mathbb{R}^n ) \to S(\mathbb{R}^n) $, and $\mathcal{F}^{-1} = \check{\, }$.
\end{theorem}
\begin{proof}
Prove $\mathcal{F} \mathcal{F}^{-1} f = \mathcal{F}^{-1} \mathcal{F} f = f$ for $f$ contained in dense set $C^{\infty}(\mathbb{R}^n)$.
Let $C_{\epsilon}$ be cube of volume $\left( \frac{2}{\epsilon}\right)^n$ centered at $0\in \mathbb{R}^n$.
Choose $\epsilon$ small enough s.t. support of $f$ is contained in $C_{\epsilon}$.
Let $K_{\epsilon} := \lbrace \mathbf{k} \in \mathbb{R}^n | \forall \, k_i / \pi \epsilon \text{is an integer } \rbrace$, then
\[
f(x) = \sum_{\mathbf{k} \in K_{\epsilon}} ((\frac{1}{2} \epsilon)^{n/2} e^{i\mathbf{k}\cdot \mathbf{x}}, f) (\frac{1}{2} \epsilon)^{n/2} e^{-i \mathbf{k} \cdot \mathbf{x}}
\]
where $(\cdot,\cdot )$ is the inner product.
The expression immediately above for $f(x)$ is just the Fourier series of $f$, which converges uniformly in $C_{\epsilon}$, to $f$, since $f$ cont. diff. (Thm. II.8 of Reed and Simon (1980) \cite{ReSi1980}). Recall this theorem says: \\
Suppose $f(x)$ periodic of period $2\pi$ and is cont. diff. Then functions $\sum_{-M}^{M} c_n e^{inx} \xrightarrow{M\to \infty} f(x)$ uniformly converges.
\begin{equation}
f(x) = \sum_{\mathbf{k} \in K_{\epsilon} } \frac{\widehat{f}(\mathbf{k}) e^{i\mathbf{k}\cdot \mathbf{x}} }{ (2\pi)^{n/2} } (\pi \epsilon)^n
\end{equation}
cf. (IX.2) of Reed and Simon (1980)\cite{ReSi1980}.
Since $\mathbb{R}^n $ is the disjoint union of cubes of volume $(\pi \epsilon)^n$ centered around pts. in $K_{\epsilon}$, (indeed, $K_{\epsilon} = \lbrace \mathbf{k} \in \mathbb{R}^n | k_i/\pi \epsilon \in \mathbb{Z} \, \forall \, i=1,2,\dots n\rbrace$) then
\[
\sum_{\mathbf{k} \in K_{\epsilon} } \frac{\widehat{f}(\mathbf{k}) e^{i \mathbf{k}\cdot \mathbf{x} } }{ (2\pi )^{n/2} } (\pi \epsilon)^n
\]
is just Riemann sum for integral of function
\[
\widehat{f}(\mathbf{k}) e^{i\mathbf{k}\cdot \mathbf{x} } /(2\pi)^{n/2}
\]
By lemma, $\widehat{f}(\mathbf{k})e^{i\mathbf{k}\cdot \mathbf{x} } \in S(\mathbb{R}^n)$, so Riemann sums converge to integral. Thus
\[
\mathcal{F}^{-1}\mathcal{F}f = f
\]
\end{proof}
\end{multicols*}
\begin{thebibliography}{9}
\bibitem{ReSi1980}
Michael Reed and Barry Simon. \textbf{Functional Analysis (Methods of Modern Mathematical Physics, Vol. 1)}. Academic Press. 1980.
\end{thebibliography}
\end{document}
| {
"alphanum_fraction": 0.6558535547,
"avg_line_length": 39.4127516779,
"ext": "tex",
"hexsha": "2a9be2dcde9133b4f5cb0071d49ecbd80ca944a9",
"lang": "TeX",
"max_forks_count": 25,
"max_forks_repo_forks_event_max_datetime": "2022-03-03T20:15:13.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-01-21T05:33:31.000Z",
"max_forks_repo_head_hexsha": "59eb794dfa46e2b80e43df0440bb8ec3c472d973",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "wacfeldwang333/mathphysics",
"max_forks_repo_path": "LaTeX_and_pdfs/Analysis.tex",
"max_issues_count": 5,
"max_issues_repo_head_hexsha": "59eb794dfa46e2b80e43df0440bb8ec3c472d973",
"max_issues_repo_issues_event_max_datetime": "2020-04-12T03:12:29.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-09-29T09:29:53.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "wacfeldwang333/mathphysics",
"max_issues_repo_path": "LaTeX_and_pdfs/Analysis.tex",
"max_line_length": 662,
"max_stars_count": 50,
"max_stars_repo_head_hexsha": "59eb794dfa46e2b80e43df0440bb8ec3c472d973",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "wacfeldwang333/mathphysics",
"max_stars_repo_path": "LaTeX_and_pdfs/Analysis.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-29T11:19:23.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-01-10T14:24:13.000Z",
"num_tokens": 4439,
"size": 11745
} |
\chapter{Conclusions}
\label{ch7:Conclusions}
\section{Summary}
\label{ch7:sec:Summary}
\section{Future Work}
\label{ch7:sec:FutureWork}
| {
"alphanum_fraction": 0.7697841727,
"avg_line_length": 15.4444444444,
"ext": "tex",
"hexsha": "418debf660df2696ff7810415454be4b72a8ecc1",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "d4e030c1e3b153cac6e2d8eb339406c68197318d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "fei-pan/CityU_Thesis",
"max_forks_repo_path": "Chapters/chapter7.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "d4e030c1e3b153cac6e2d8eb339406c68197318d",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "fei-pan/CityU_Thesis",
"max_issues_repo_path": "Chapters/chapter7.tex",
"max_line_length": 26,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "d4e030c1e3b153cac6e2d8eb339406c68197318d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "fei-pan/CityU_Thesis",
"max_stars_repo_path": "Chapters/chapter7.tex",
"max_stars_repo_stars_event_max_datetime": "2021-11-16T15:43:50.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-11-16T15:43:50.000Z",
"num_tokens": 47,
"size": 139
} |
\subsection{Task 2: Pagerank}
In this experiment, we run pagerank on various size of graph data, 10 in total. The purpose of this design is that we think pagerank is a time consuming operation, and our first try proves our intuition. So we want to test the implementation on incrementally larger dataset, so that we can spot the bottleneck of single machine implementation.
\begin{center}
\begin{tabular}{| c | c | c |}
\hline
Name & Nodes & edges \\ \hline
Roadnet-ca & 1,965,206 & 5,533,214 \\ \hline
Roadnet-PA & 1,088,092 & 3,083,796 \\ \hline
Roadnet-TX & 1,379,917 & 3,843,320 \\ \hline
com-Amazon & 334,863 & 925,872 \\ \hline
web-BerkStan & 685,230 & 7,600,595 \\ \hline
email-Enron & 36,692 & 367,662 \\ \hline
web-Google & 875,713 & 5,105,039 \\ \hline
soc-Slashdot0902 & 77,360 & 905,468 \\ \hline
web-Stanford & 281,903 & 2,312,497 \\ \hline
wiki-Vote & 7,115 & 103,689 \\ \hline
\end{tabular}
\end{center}
\subsubsection{Detailed Plot}
{\bf Proof of Correctness: } In order to verify the correctness of our implementation, we compare the SQL implementation with a standard implementation with NumPy\footnote{http://www.numpy.org/} on a tiny dataset from "Introduction to Information Retrieval". Table \ref{t2:verify} is the outcome of two different implementaions. We can see that most of the values are the same to one digit of the right of decimal point. The difference after that is due to subtle difference in implmentation, such as max iteration, initilization, etc.
\begin{table}
\begin{center}
\begin{tabular}{| c | c | c | }
\hline
Node & SQL & NumPy \\ \hline
1 & 0.122864 & 0.11799887 \\ \hline
2 & 0.081234 & 0.08069813 \\ \hline
3 & 0.263843 & 0.2526222 \\ \hline
4 & 0.529185 & 0.52647168 \\ \hline
5 & 0.452971 & 0.45487423 \\ \hline
6 & 0.081234 & 0.08069813 \\ \hline
7 & 0.645657 & 0.65203598 \\ \hline
\end{tabular}
\caption{SQL implementaion VS NumPy implementaion}
\label{t2:verify}
\end{center}
\end{table}
Here We use rank-frequency plot to find the underlying patterns in the datasets.
\paragraph{Roadnet-CA}
The rank-frequency plot(Figure \ref{t2:ca}) of Roadnet-CA is nearly flat, there is not obvious pattern in the plot.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_ca.png}\\
\end{tabular}
\caption{Rank-frequency plot Roadnet-CA}
\label{t2:ca}
\end{center}
\end{figure}
\paragraph{Roadnet-TX}
The rank-frequency plot(Figure \ref{t2:tx}) of Roadnet-TX is nearly flat, there is not obvious pattern in the plot.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_tx.png}\\
\end{tabular}
\caption{Rank-frequency plot Roadnet-TX}
\label{t2:tx}
\end{center}
\end{figure}
\paragraph{Roadnet-PA}
The rank-frequency plot(Figure \ref{t2:pa}) of Roadnet-PA is nearly flat, there is not obvious pattern in the plot.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_pa.png}\\
\end{tabular}
\caption{Rank-frequency plot Roadnet-PA}
\label{t2:pa}
\end{center}
\end{figure}
\paragraph{com-Amazon}
From the plot(Figure \ref{t2:amazon}) we can find that the pagerank distribution follows {\bf power law}, which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_amazon.png}
\end{tabular}
\caption{Rank-frequency plot Amazon}
\label{t2:amazon}
\end{center}
\end{figure}
\paragraph{web-BerkStan}
From the plot(Figure \ref{t2:berke}) we can find that the pagerank distribution follows {\bf power law}(exception the first few nodes), which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_berke.png}
\end{tabular}
\caption{Rank-frequency plot BerkeStan}
\label{t2:berke}
\end{center}
\end{figure}
\paragraph{email-Enron}
From the plot(Figure \ref{t2:enron}) we can find that the pagerank distribution follows {\bf power law}(except the first few nodes), which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_enron.png}
\end{tabular}
\caption{Rank-frequency plot Enron mail}
\label{t2:enron}
\end{center}
\end{figure}
\paragraph{web-Google}
From the plot(Figure \ref{t2:google}) we can find that the pagerank distribution follows {\bf power law}, which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_google.png}
\end{tabular}
\caption{Rank-frequency plot Google}
\label{t2:google}
\end{center}
\end{figure}
\paragraph{soc-Slashdot0902}
From the plot(Figure \ref{t2:slashdot}) we can find that the pagerank distribution follows {\bf power law}, which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_slashdot.png}
\end{tabular}
\caption{Rank-frequency plot Slashdot}
\label{t2:slashdot}
\end{center}
\end{figure}
\paragraph{web-Stanford}
From the plot(Figure \ref{t2:stanford}) we can find that the pagerank distribution follows {\bf power law}(except the first few nodes), which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_stanford.png}
\end{tabular}
\caption{Rank-frequency plot Stanford}
\label{t2:stanford}
\end{center}
\end{figure}
\paragraph{wiki-Vote}
From the plot(Figure \ref{t2:wikivote}) we can find that the pagerank distribution follows {\bf power law}, which means that top few nodes has the largest pagerank, while the majority of the node has small pagerank. This matches out intuition in real world data.
\begin{figure}[!htbf]
\begin{center}
\begin{tabular}{c}
\includegraphics[width=0.6\textwidth]{FIG/t2_wikivote.png}
\end{tabular}
\caption{Rank-frequency plot Wiki-Vite}
\label{t2:wikivote}
\end{center}
\end{figure}
\subsubsection{Observation}
We can observe that in log-log scale, all datasets exhibits linear relationship between rank and frequency. Thus we find another appearance of {\bf power law} in natural graph. An abnormal phenomenon is that the slope of Roadnet datasets is nearly flat. This reflects another aspects of the fundamental property of Roadnet, that all nodes in a roadnet graph are nearly equal to each other, it's a decentralized graph. While in ordinary social network, we always expect to have some important authorities.
| {
"alphanum_fraction": 0.742411813,
"avg_line_length": 42.7719298246,
"ext": "tex",
"hexsha": "d69c1990397f76f2b100e00933fc304d50ba2c24",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2018-11-16T18:23:24.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-11-16T18:23:24.000Z",
"max_forks_repo_head_hexsha": "3b7652a99c1c0e3f4e680e04bfd08fac9708ea3f",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "spininertia/graph-mining-rdbms",
"max_forks_repo_path": "src/phase-3/doc/t2_exp.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "3b7652a99c1c0e3f4e680e04bfd08fac9708ea3f",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "spininertia/graph-mining-rdbms",
"max_issues_repo_path": "src/phase-3/doc/t2_exp.tex",
"max_line_length": 535,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "3b7652a99c1c0e3f4e680e04bfd08fac9708ea3f",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "spininertia/graph-mining-rdbms",
"max_stars_repo_path": "src/phase-3/doc/t2_exp.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2205,
"size": 7314
} |
\chapter{Appendix}
Appendix | {
"alphanum_fraction": 0.8214285714,
"avg_line_length": 9.3333333333,
"ext": "tex",
"hexsha": "4066fe4824b017b27f86b3b965b267f272f92f60",
"lang": "TeX",
"max_forks_count": 5,
"max_forks_repo_forks_event_max_datetime": "2021-08-24T12:13:42.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-11T08:47:43.000Z",
"max_forks_repo_head_hexsha": "e9e11db849ce240aac676f5d0a097eb7a1ee73cb",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "enridaga/polifonia-D1.3",
"max_forks_repo_path": "appendix.tex",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "e9e11db849ce240aac676f5d0a097eb7a1ee73cb",
"max_issues_repo_issues_event_max_datetime": "2021-05-14T10:21:48.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-05-14T10:21:05.000Z",
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "enridaga/polifonia-D1.3",
"max_issues_repo_path": "appendix.tex",
"max_line_length": 18,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "e9e11db849ce240aac676f5d0a097eb7a1ee73cb",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "enridaga/polifonia-D1.3",
"max_stars_repo_path": "appendix.tex",
"max_stars_repo_stars_event_max_datetime": "2020-10-16T11:44:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-04-09T10:45:23.000Z",
"num_tokens": 8,
"size": 28
} |
\chapter{Introduction}
% \minitoc
% \printMarginPartialToc
As the year went on, I started typesetting my personal notes during class and realized that the \LaTeX format,
while great for publications and lecture notes in general, was lacking a few small but useful template for me.
\section{Required Packages}\label{sec:reqpackages}
For \textit{Subook,} the following packages are required
\begin{center}
\texttt{marginnote, sidenotes, fancyhdr, titlesec, geometry, and tcolorbox.}
\end{center}
For a brief summary, the \texttt{marginnote}, \texttt{sidenote}, \texttt{titlesec},
and \texttt{tcolorbox} packages are used in creating the \texttt{$\backslash$part} environment,
the package \texttt{geometry} is used globally to set the page width, page height,
and margin width, and finally, \texttt{fancyhdr},
which is overridden on the title page,
the contents page, and the \texttt{$\backslash$part} page, sets the header for the body.
\section{License}\label{sec:license}
This work may be distributed and/or modified under the conditions of the LaTeX Project Public License,
either version 1.3 of this license or (at your option) any later version.
The latest version of this license is found in \url{http://www.latex-project.org/lppl.txt},
and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.
The current maintainer of this work is Changxing Su.
\section{Features}\label{sec:Features}
\textit{Subook} includes the following:
\begin{enumerate}
\item Several mathematics and physics packages.
\item Margins and margin environments for tables, figures, and asides.
\item \TeX\ shortcuts for various math scripts namely vector bold math, \texttt{mathbb}, \texttt{mathfrak}, and \texttt{mathcal}.
\item \texttt{amsthm} integrations and special environments for theorems, lemmas, proofs, definitions, examples, and remarks.\
\item Stylized support for the \texttt{part} environment.
\item A fullpage environment that spans across the text width and the margin for longer equations and horizontal figures.
\end{enumerate}
Each of these will be discussed in the following subsections.
\section{\TeX\ Shortcuts}\label{sec:shortcuts}
\textit{subook} comes built in with a minimal set of keyboard shortcuts for a few special characters. All of these shortcuts can be found in \texttt{subook.cls} just under
\begin{verbatim}
% ----------------------------------------------------------------------
% User Created Commands
% ----------------------------------------------------------------------
...
\end{verbatim}
If one has their own macros\mn{Most people have their own shortcuts for commonly used mathematics, such as derivatives or integrals. For those looking for physics shortcuts, the {excellent} \texttt{physics} package (automatically included in \textit{subook}) has possible everything that one can imagine.} then simply add it under this area.
\section{\texttt{amsthm} Environments}\label{Sub:Special}
\texttt{amsthm} environments are defined as usual being enclosed by \texttt{$\backslash$begin\{environment\}}$\cdots$ \texttt{$\backslash$end\{environment\}}
and most have been modified ostensibly from the original \texttt{amsthm} presets.
Primarily, most environments,
with the exception of the exercise environment, are now integrated with the wonderful \texttt{tcolorbox} package.
Note that the counting for \texttt{theorems} and \texttt{lemmas} is distinct from the counting for \texttt{definitions}.
Also note that the \texttt{breakable} for \texttt{tcolorbox} allows these environments to span multiple pages.
All of these environment and the associated \texttt{tcolorbox} are provided by the code in \texttt{subook.cls} just under \lecture.
\begin{verbatim}
% ----------------------------------------------------------------------
% User Created Environments
% ----------------------------------------------------------------------
...
%% ------------------------------ tcolorbox ---------------------------
...
\end{verbatim}
\begin{definition}[Test]
The \texttt{definition} environment
\end{definition}
\begin{lemma}[Test]
The \texttt{lemma} environment
\end{lemma}
\begin{theorem}[Test]
The \texttt{theorem} environment
\end{theorem}
\begin{corollary}[Test]
The \texttt{corollary} environment
\end{corollary}
\begin{proposition}[Test]
The \texttt{proposition} environment
\end{proposition}
\begin{example}[Test]
The \texttt{example} environment
\end{example}
\begin{proof}
The \texttt{proof} environment
\end{proof}
\begin{remark}
The \texttt{remark} environment
\end{remark}
\begin{assumption}
asdasd
\end{assumption}
\begin{exercise}
sdadsa
\end{exercise}
\begin{tbox}{Some extra box environment}
The \texttt{something extra} environment
\end{tbox}
% \begin{examplebox}{Test}
% I use my ``examplebox'' as usual text and margin figure work as they should be but I want my example box spread out to the right margin on an odd page, breakable, and spread out to the left margin on the even page.
% \tcblower
% I use my ``examplebox'' as usual text and margin figure work as they should be but I want my example box spread out to the right margin on an odd page, breakable, and spread out to the left margin on the even page.
% \end{examplebox}
\subsection{\texttt{tcolorbox} Environment and Known Issues}
\label{ssub:tcolorbox environments_and_known_issues}
The \texttt{breakable} should allow the \texttt{proof} environment to span multiple pages. If one wishes to change the color, simply modify the line which states \texttt{borderline west=\{1pt\}} \texttt{\{0pt\}\{blue\}}. The first numeric value dictates the width of the line, the second dictates how close it is away from the \textit{left} margin, while the last argument obviously dictates the color. This code could also be used to change any of the other \texttt{amsthm} environments
\marginpar{
\centering
\includegraphics[width=0.4\textwidth]{example-image-a}
\captionof{figure}{marginfigure}}.
\section{Fullpage Environment}\label{Sec: Fullpage}
\begin{fullpage}
The \texttt{fullpage} environment is defined by
\begin{center}
\texttt{$\backslash$begin\{fullpage\}}\\
$\cdots$\\
\texttt{$\backslash$end\{fullpage\}}
\end{center}
with the width of the \texttt{fullpage} environment given by \texttt{$\backslash$textwidth}+\texttt{$\backslash$marginparsep}+\texttt{$\backslash$marginparwidth}
There are some clear benefits of having use of the full page at times. Suppose that one wants to place a figure that cannot fit into the margins, or if an equation is quite long and it bleeds into
the margin,
then the \texttt{fullpage} environment can both clearly separate these from the surrounding text and allot for the dimensions without hassle.
%% //FIXME : When using figure enviorment, recipe terminated with error by message"Float(s) lost."
% \begin{figure}
\centering
\includegraphics{img/f08Young.pdf}
\captionof{figure}{Figure caption}
\label{fig:example} % Unique label used for referencing the figure in-text
% %\addcontentsline{toc}{figure}{Figure \ref{fig:placeholder}} % Uncomment to add the figure to the table of contents
% \end{figure}
\begin{definition}[big box]
dsdd
\end{definition}
\end{fullpage}
\texttt{Figure} is a floating environment and \texttt{minipage} is, unfortunately, not. Therefore, if you put a floating object inside a non-floating minipage, you will get an error.One way is to avoid using figure entirely. This can be done with help of the caption package (with its captionof facility, so that you can have a caption for the figure):
%% solution from https://tex.stackexchange.com/questions/55337/how-to-use-figure-inside-a-minipage
\begin{lstlisting}
\centering
\includegraphics{img/f08Young.pdf}
\captionof{figure}{Figure caption}
\label{fig:example} % Unique label used for referencing the figure
\end{lstlisting}
Table\marginpar{\centering
\begin{tabular}{lll}
\toprule
1 & 1 & 1\\
\midrule
1 & 1 & 0.562 \\
2 & 1 & 0.910 \\
3 & 11 & 0.296 \\
\bottomrule
\end{tabular}
\captionof{table}{Sophisticated margin table}
}The genomes of chimpanzees and humans are 99.9\% identical, yet the differences between the two species are vast. The relatively few differences in genetic endowment must explain \marginpar[right]{dsdsdsdsd}the possession of language by humans, the extraordinary athleticism of chimpanzees, and myriad other differences. Genomic comparison is allowing researchers to identify candidate genes linked to divergences in the developmental programs of humans and the other primates
% \lipsum[2-4]
% Tikz\marginpar{ \begin{center}
% \begin{tikzpicture}
% \draw[black,thick] (-1,-1) -- (-.06,-.06);
% \draw[black,thick] (.06,.06) -- (1,1);
% \draw[black,thick] (-1,1) -- (1,-1);
% \filldraw[black] (-1,-1) circle (2pt) node[anchor=north] {2};
% \filldraw[black] (-1,1) circle (2pt) node[anchor=south] {1};
% \filldraw[black] (1,-1) circle (2pt) node[anchor=north] {3};
% \filldraw[black] (1,1) circle (2pt) node[anchor=south] {4};
% \end{tikzpicture}
% \end{center}
% \captionof{figure}{Marginfigure: Tikz}}
\begin{fullpage}
\sidebysidecaption{0.555\linewidth}{0.42\linewidth}{%
\includegraphics[width=1\linewidth]{example-image-a}%
}{%
\captionof{figure}{Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.}
\label{fg:cam-mounting}
}
\end{fullpage}
\begin{fullpage}
\sidebysidecaption{0.7\linewidth}{0.25\linewidth}{%
\includegraphics[width=1\linewidth]{example-image-a}%
}{%
\captionof{figure}{Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.}
\label{fg:cam-mounting}
}
\end{fullpage}
\begin{fullpage}
\sidebysidecaption{0.4\linewidth}{0.55\linewidth}{%
\includegraphics[width=1\linewidth]{example-image-a}%
}{%
\captionof{figure}{Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.}
}
\end{fullpage}
\begin{fullpage}
\sidebysidecaption{0.4\linewidth}{0.55\linewidth}{%
\captionof{figure}{Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.Camera mounted between two
projections screens. Note that while the view direction can be
modified, the up vector of the camera is fixed.}
}{%
\includegraphics[width=1\linewidth]{example-image-a}%
}
\end{fullpage} | {
"alphanum_fraction": 0.7064372001,
"avg_line_length": 45.6075471698,
"ext": "tex",
"hexsha": "bf2c3d5ce134f993788564150adfb6a700bf660c",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "1b5f5025a611bb1cfbcee2c4adad3ab1237c5eee",
"max_forks_repo_licenses": [
"LPPL-1.3c"
],
"max_forks_repo_name": "chancey922/subook",
"max_forks_repo_path": "chapters/introduction.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "1b5f5025a611bb1cfbcee2c4adad3ab1237c5eee",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"LPPL-1.3c"
],
"max_issues_repo_name": "chancey922/subook",
"max_issues_repo_path": "chapters/introduction.tex",
"max_line_length": 488,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "1b5f5025a611bb1cfbcee2c4adad3ab1237c5eee",
"max_stars_repo_licenses": [
"LPPL-1.3c"
],
"max_stars_repo_name": "chancey922/subook",
"max_stars_repo_path": "chapters/introduction.tex",
"max_stars_repo_stars_event_max_datetime": "2022-02-22T02:14:01.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-02-21T07:37:07.000Z",
"num_tokens": 3139,
"size": 12086
} |
\documentclass[a4paper, twoside, 11pt]{article}
% deutsche Silbentrennung
% \usepackage[ngerman]{babel}
% wegen deutschen Umlauten
\usepackage[utf8]{inputenc}
\usepackage{a4}
% fuer links im dokument
\usepackage[colorlinks, linkcolor = black, citecolor = black, filecolor = blue, urlcolor = blue]{hyperref}
% for code examples
\usepackage{listings}
% for equations with multiple lines
\usepackage{amsmath}
% for including graphics
\usepackage{graphicx}
% for floatbarriers
\usepackage{placeins}
\begin{document}
\title{Evaluation of lightweight virtualization using Docker in the context of ASTERICS to enhance reproducibility of analyses}
\author{Stefan Geißelsöder\\
ECAP, Erlangen}
\date{\today}
\maketitle
\section{Motivation}
As analyses in astronomy, astrophysics and particle astrophysics tend to increase in complexity
with the abilities available on modern computer systems,
the basic requirement of (short and long term) reproducibility is becoming harder to achieve.
The high number of dependencies on other software packages, which have implicitly been used to obtain a result,
are non-trivial to be reproduced exactly and sometimes not all dependencies are recognized explicitly.
Techniques like Docker can help not only to achieve this reproducibility,
but also in situations where checks or changes are desired after the know-how is not fully available anymore,
e.g. when the original creator has left a collaboration, or when a new person is to become involved in a workflow.
\section{Considerations that led to Docker}
Why do we recommend Docker instead of another technology for experiments in ASTERICS?
Here are a few considerations of alternatives.
\subsection{Plain scripts}
Plainly executing custom scripts on a machine in its currently available state
risks not to be able to reproduce the computation and results with updated hard/software.
This does not constitute an acceptable solution.
\subsection{Virtual machines}
In principle virtual machines (VMs) are a reasonable idea to keep analyses reproducible.
While there are different competing standards, most of the technologies are compatible with each other.
Without additional care, VMs can decrease the efficiency of computations \cite{ieee:vmperformance}, but
as the effect is not too big for our application
(and can be reduced by certain VM techniques \cite{xen:about, ieee:vmperformance}),
this is not considered a major drawback here.
The main problem with VMs for the envisioned application is that the memory requirement doesn't
scale good enough for a large number of analyses,
since a whole virtual machine has to be stored for each analysis.
\subsection{Docker}
Docker \cite{docker:about} is based on layered containerization.
It allows direct access
to the underlying kernel while abstracting the software dependencies.
Since only the changes to a common base system required by an analysis have to be stored for an analysis,
the main drawback of virtual machines in the envisioned application scenario is dealt with,
namely the large memory requirements to store analyses.
A drawback of the current status of Docker is the danger of ``privilege escalation'',
which potentially allows users to perform actions on a machine they otherwise wouldn't have the rights to.
This is no relevant concern for the application to physics analyses,
but it prevents several clusters from supporting Docker directly.
Desktop and cloud systems on the other hand support Docker.
\subsection{Singularity}
Singularity \cite{singu:about} is another recent
option that could help with reproducibility similar to Docker.
While it even deals with privilege escalations,
so far it is not available on Microsoft Windows operating systems which are used by some members of some collaborations.
Furthermore the already established user basis is not as large as Dockers
and therefore the risk is higher that it might not be supported
in the long run\footnote{Future developments can't be predicted, but a large existing user base tends to be
correlated with a longer support and compatibility of following technologies.}.
\subsection{Nix}
Nix \cite{nix:about} also constitutes a development that could be suited to help keeping analyses reproducible.
However it focuses on an application and its dependencies.
While it offers an elegant way to deal with these dependencies, it does not (and is not intended to) deal with e.g. input files.
Furthermore it doesn't support Microsoft Windows and,
judging from the current size of the Nix community, is also less widespread than Docker.
\subsection{Others}
% flock none
There are many other, similar approaches
(e.g. rkt \cite{rkt:about}, Flockport \cite{flockport:about}),
but on the one hand, there is no essential feature lacking in Docker that would be required
for our use-case.
On the other hand, to achieve a long-term reproducibility, which is key to us,
a solution should be supported by a large community and as many other cooperations or companies as possible.
The current status is that this is fulfilled best by Docker.
Furthermore, many alternatives also support Docker images or Dockerfiles, while their extensions usually are incompatible to others.
\section{Summary}
Table \ref{tab:summary} is a summary of the comparison with perceived most relevant disadvantages in red.
While it should be clear at this point that there is no single perfect solution,
Docker seems to be the best choice. It does solve the problem of reproducibility of physics analyses,
is relatively easy to use \cite{km3net:howdocker}
and doesn't have major drawbacks as far as the investigated use-case is concerned.
As this lightweight virtualization promises significant benefits,
first efforts have already begun to employ Docker for KM3NeT \cite{github:dockerprojects}.
The same concepts for packaging an analysis with Docker that are being worked out with KM3NeT
(e.g. a common base image, not using the common tag ``latest'' or a default input/output interface)
can also be applied for other experiments.
\begin{center}
\begin{tabular}{ l | c | c | c | c | c }
\label{tab:summary}
& Plain & VMs & Docker & Nix & Singularity \\
\hline
Reproducible & \textcolor{red}{Maybe not} & Yes & Yes & Yes & Yes \\
\hline
All OS & Yes & Yes & Yes & \textcolor{red}{No} & \textcolor{red}{No} \\
\hline
Widespread* & Yes & Yes & Yes & No & No \\
\hline
Efficient & Yes & Possible & Yes & Yes & Yes \\
\hline
Storage required & Low & \textcolor{red}{High} & Moderate & Low & Moderate \\
\end{tabular}
\end{center}
\bigskip
\begin{center}
*Community for different lightweight techniques on github.com, \\ state as of 2017-03-07 \\
\bigskip
\begin{tabular}{ l | c | c }
\label{tab:popularity}
& Commits & Contributors \\
\hline
Docker & 31219 & 1627 \\
\hline
Nix & 2048 & 34 \\
\hline
Singularity & 5075 & 110 \\
\hline
rkt & 5167 & 177 \\
\hline
\end{tabular} \\
\end{center}
\bibliography{dockerRefs}
\bibliographystyle{alpha}
\end{document}
| {
"alphanum_fraction": 0.7753633413,
"avg_line_length": 42.6927710843,
"ext": "tex",
"hexsha": "1ade302101390fdb35b0ed8bd649f41ac6fa5c0e",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b5f68658590145800b0a212a3863ffe9b4eca17b",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "sgeisselsoeder/dockerProjects",
"max_forks_repo_path": "documents/whyDocker.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b5f68658590145800b0a212a3863ffe9b4eca17b",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "sgeisselsoeder/dockerProjects",
"max_issues_repo_path": "documents/whyDocker.tex",
"max_line_length": 133,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "b5f68658590145800b0a212a3863ffe9b4eca17b",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "sgeisselsoeder/dockerProjects",
"max_stars_repo_path": "documents/whyDocker.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1691,
"size": 7087
} |
% -*- latex -*-
\chapter{Strings and characters}
Strings are the basic communication medium for {\Unix} processes, so a
Unix programming environment must have reasonable facilities for manipulating
them.
Scsh provides a powerful set of procedures for processing strings and
characters.
Besides the the facilities described in this chapter, scsh also provides
\begin{itemize}
\itum{Regular expressions (chapter~\ref{chapt:sre})}
A complete regular-expression system.
\itum{Field parsing, delimited record I/O and the awk loop
(chapter~\ref{chapt:fr-awk})}
These procedures let you read in chunks of text delimited by selected
characters, and
parse each record into fields based on regular expressions
(for example, splitting a string at every occurrence of colon or
white-space).
The \ex{awk} form allows you to loop over streams of these records
in a convenient way.
\itum{The SRFI-13 string libraries}
This pair of libraries contains procedures that create, fold, iterate over,
search, compare, assemble, cut, hash, case-map, and otherwise manipulate
strings.
They are provided by the \ex{string-lib} and \ex{string-lib-internals}
packages, and are also available in the default \ex{scsh} package.
More documentation on these procedures can be found at URLs
\begin{tightinset}
% The gratuitous mbox makes xdvi render the hyperlinks better.
\texonly
\mbox{\url{http://srfi.schemers.org/srfi-13/srfi-13.html}}\\
\url{http://srfi.schemers.org/srfi-13/srfi-13.txt}
\endtexonly
% Changed the \mbox into \urlh for tex2page to avoid problems runing tex2page
\htmlonly
\urlh{http://srfi.schemers.org/srfi-13/srfi-13.html}{http://srfi.schemers.org/srfi-13/srfi-13.html}\\
\urlh{http://srfi.schemers.org/srfi-13/srfi-13.txt}{http://srfi.schemers.org/srfi-13/srfi-13.txt}
\endhtmlonly
\end{tightinset}
\itum{The SRFI-14 character-set library}
This library provides a set-of-characters abstraction, which is frequently
useful when searching, parsing, filtering or otherwise operating on
strings and character data. The SRFI is provided by the \ex{char-set-lib}
package; it's bindings are also available in the default \ex{scsh} package.
More documentation on this library can be found at URLs
\begin{tightinset}
% The gratuitous mbox makes xdvi render the hyperlinks better.
\texonly
\mbox{\url{http://srfi.schemers.org/srfi-14/srfi-14.html}}\\
\url{http://srfi.schemers.org/srfi-14/srfi-14.txt}
\endtexonly
% Changed the \mbox into \urlh for tex2page to avoid problems runing tex2page
\htmlonly
\urlh{http://srfi.schemers.org/srfi-14/srfi-14.html}{http://srfi.schemers.org/srfi-14/srfi-14.html}\\
\urlh{http://srfi.schemers.org/srfi-14/srfi-14.txt}{http://srfi.schemers.org/srfi-14/srfi-14.txt}
\endhtmlonly
\end{tightinset}
\end{itemize}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Manipulating file names}
\label{sec:filenames}
These procedures do not access the file-system at all; they merely operate
on file-name strings. Much of this structure is patterned after the gnu emacs
design. Perhaps a more sophisticated system would be better, something
like the pathname abstractions of {\CommonLisp} or MIT Scheme. However,
being {\Unix}-specific, we can be a little less general.
\subsection{Terminology}
These procedures carefully adhere to the {\Posix} standard for file-name
resolution, which occasionally entails some slightly odd things.
This section will describe these rules, and give some basic terminology.
A \emph{file-name} is either the file-system root (``/''),
or a series of slash-terminated directory components, followed by
a a file component.
Root is the only file-name that may end in slash.
Some examples:
\begin{center}
\begin{tabular}{lll}
File name & Dir components & File component \\\hline
\ex{src/des/main.c} & \ex{("src" "des")} & \ex{"main.c"} \\
\ex{/src/des/main.c} & \ex{("" "src" "des")} & \ex{"main.c"} \\
\ex{main.c} & \ex{()} & \ex{"main.c"} \\
\end{tabular}
\end{center}
Note that the relative filename \ex{src/des/main.c} and the absolute filename
\ex{/src/des/main.c} are distinguished by the presence of the root component
\ex{""} in the absolute path.
Multiple embedded slashes within a path have the same meaning as
a single slash.
More than two leading slashes at the beginning of a path have the same
meaning as a single leading slash---they indicate that the file-name
is an absolute one, with the path leading from root.
However, {\Posix} permits the OS to give special meaning to
\emph{two} leading slashes.
For this reason, the routines in this section do not simplify two leading
slashes to a single slash.
A file-name in \emph{directory form} is either a file-name terminated by
a slash, \eg, ``\ex{/src/des/}'', or the empty string, ``''.
The empty string corresponds to the current working directory,
whose file-name is dot (``\ex{.}'').
Working backwards from the append-a-slash rule,
we extend the syntax of {\Posix} file-names to define the empty string
to be a file-name form of the root directory ``\ex{/}''.
(However, ``\ex{/}'' is also acceptable as a file-name form for root.)
So the empty string has two interpretations:
as a file-name form, it is the file-system root;
as a directory form, it is the current working directory.
Slash is also an ambiguous form: \ex{/} is both a directory-form and
a file-name form.
The directory form of a file-name is very rarely used.
Almost all of the procedures in scsh name directories by giving
their file-name form (without the trailing slash), not their directory form.
So, you say ``\ex{/usr/include}'', and ``\ex{.}'', not
``\ex{/usr/include/}'' and ``''.
The sole exceptions are
\ex{file-name-as-directory} and \ex{directory-as-file-name},
whose jobs are to convert back-and-forth between these forms,
and \ex{file-name-directory}, whose job it is to split out the
directory portion of a file-name.
However, most procedures that expect a directory argument will coerce
a file-name in directory form to file-name form if it does not have
a trailing slash.
Bear in mind that the ambiguous case, empty string, will be
interpreted in file-name form, \ie, as root.
\subsection{Procedures}
\defun {file-name-directory?} {fname} \boolean
\defunx {file-name-non-directory?} {fname} \boolean
\begin{desc}
These predicates return true if the string is in directory form, or
file-name form (see the above discussion of these two forms).
Note that they both return true on the ambiguous case of empty string,
which is both a directory (current working directory), and a file name
(the file-system root).
\begin{center}
\begin{tabular}{lll}
File name & \ex{\ldots-directory?} & \ex{\ldots-non-directory?} \\
\hline
\ex{"src/des"} & \ex{\sharpf} & \ex{\sharpt} \\
\ex{"src/des/"} & \ex{\sharpt} & \ex{\sharpf} \\
\ex{"/"} & \ex{\sharpt} & \ex{\sharpf} \\
\ex{"."} & \ex{\sharpf} & \ex{\sharpt} \\
\ex{""} & \ex{\sharpt} & \ex{\sharpt}
\end{tabular}
\end{center}
\end{desc}
\begin{defundesc} {file-name-as-directory} {fname} \str
Convert a file-name to directory form.
Basically, add a trailing slash if needed:
\begin{exampletable}
\ex{(file-name-as-directory "src/des")} & \ex{"src/des/"} \\
\ex{(file-name-as-directory "src/des/")} & \ex{"src/des/"} \\[2ex]
%
\header{\ex{.}, \ex{/}, and \ex{""} are special:}
\ex{(file-name-as-directory ".")} & \ex{""} \\
\ex{(file-name-as-directory "/")} & \ex{"/"} \\
\ex{(file-name-as-directory "")} & \ex{"/"}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {directory-as-file-name} {fname} \str
Convert a directory to a simple file-name.
Basically, kill a trailing slash if one is present:
\begin{exampletable}
\ex{(directory-as-file-name "foo/bar/")} & \ex{"foo/bar"} \\[2ex]
%
\header{\ex{/} and \ex{""} are special:}
\ex{(directory-as-file-name "/")} & \ex{"/"} \\
\ex{(directory-as-file-name "")} & \ex{"."} (\ie, the cwd) \\
\end{exampletable}
\end{defundesc}
\begin{defundesc} {file-name-absolute?} {fname} \boolean
Does \var{fname} begin with a root or \ex{\~} component?
(Recognising \ex{\~} as a home-directory specification
is an extension of {\Posix} rules.)
%
\begin{exampletable}
\ex{(file-name-absolute? "/usr/shivers")} & {\sharpt} \\
\ex{(file-name-absolute? "src/des")} & {\sharpf} \\
\ex{(file-name-absolute? "\~/src/des")} & {\sharpt} \\[2ex]
%
\header{Non-obvious case:}
\ex{(file-name-absolute? "")} & {\sharpt} (\ie, root)
\end{exampletable}
\end{defundesc}
\begin{defundesc} {file-name-directory} {fname} {{\str} or false}
Return the directory component of \var{fname} in directory form.
If the file-name is already in directory form, return it as-is.
%
\begin{exampletable}
\ex{(file-name-directory "/usr/bdc")} & \ex{"/usr/"} \\
{\ex{(file-name-directory "/usr/bdc/")}} &
{\ex{"/usr/bdc/"}} \\
\ex{(file-name-directory "bdc/.login")} & \ex{"bdc/"} \\
\ex{(file-name-directory "main.c")} & \ex{""} \\[2ex]
%
\header{Root has no directory component:}
\ex{(file-name-directory "/")} & \ex{""} \\
\ex{(file-name-directory "")} & \ex{""}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {file-name-nondirectory} {fname} \str
Return non-directory component of fname.
%
\begin{exampletable}
{\ex{(file-name-nondirectory "/usr/ian")}} &
{\ex{"ian"}} \\
\ex{(file-name-nondirectory "/usr/ian/")} & \ex{""} \\
{\ex{(file-name-nondirectory "ian/.login")}} &
{\ex{".login"}} \\
\ex{(file-name-nondirectory "main.c")} & \ex{"main.c"} \\
\ex{(file-name-nondirectory "")} & \ex{""} \\
\ex{(file-name-nondirectory "/")} & \ex{"/"}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {split-file-name} {fname} {{\str} list}
Split a file-name into its components.
%
\begin{exampletable}
\splitline{\ex{(split-file-name "src/des/main.c")}}
{\ex{("src" "des" "main.c")}} \\[1.5ex]
%
\splitline{\ex{(split-file-name "/src/des/main.c")}}
{\ex{("" "src" "des" "main.c")}} \\[1.5ex]
%
\splitline{\ex{(split-file-name "main.c")}} {\ex{("main.c")}} \\[1.5ex]
%
\splitline{\ex{(split-file-name "/")}} {\ex{("")}}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {path-list->file-name} {path-list [dir]} \str
Inverse of \ex{split-file-name}.
\begin{code}
(path-list->file-name '("src" "des" "main.c"))
{\evalto} "src/des/main.c"
(path-list->file-name '("" "src" "des" "main.c"))
{\evalto} "/src/des/main.c"
\cb
{\rm{}Optional \var{dir} arg anchors relative path-lists:}
(path-list->file-name '("src" "des" "main.c")
"/usr/shivers")
{\evalto} "/usr/shivers/src/des/main.c"\end{code}
%
The optional \var{dir} argument is usefully \ex{(cwd)}.
\end{defundesc}
\begin{defundesc} {file-name-extension} {fname} \str
Return the file-name's extension.
%
\begin{exampletable}
\ex{(file-name-extension "main.c")} & \ex{".c"} \\
\ex{(file-name-extension "main.c.old")} & \ex{".old"} \\
\ex{(file-name-extension "/usr/shivers")} & \ex{""}
\end{exampletable}
%
\begin{exampletable}
\header{Weird cases:}
\ex{(file-name-extension "foo.")} & \ex{"."} \\
\ex{(file-name-extension "foo..")} & \ex{"."}
\end{exampletable}
%
\begin{exampletable}
\header{Dot files are not extensions:}
\ex{(file-name-extension "/usr/shivers/.login")} & \ex{""}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {file-name-sans-extension} {fname} \str
Return everything but the extension.
%
\begin{exampletable}
\ex{(file-name-sans-extension "main.c")} & \ex{"main"} \\
\ex{(file-name-sans-extension "main.c.old")} & \ex{"main.c""} \\
\splitline{\ex{(file-name-sans-extension "/usr/shivers")}}
{\ex{"/usr/shivers"}}
\end{exampletable}
%
\begin{exampletable}
\header{Weird cases:}
\ex{(file-name-sans-extension "foo.")} & \ex{"foo"} \\
\ex{(file-name-sans-extension "foo..")} & \ex{"foo."} \\[2ex]
%
\header{Dot files are not extensions:}
\splitline{\ex{(file-name-sans-extension "/usr/shivers/.login")}}
{\ex{"/usr/shivers/.login}}
\end{exampletable}
Note that appending the results of \ex{file-name-extension} and
{\ttt file\=name\=sans\=extension} in all cases produces the original file-name.
\end{defundesc}
\begin{defundesc} {parse-file-name} {fname} {[dir name extension]}
Let $f$ be \ex{(file-name-nondirectory \var{fname})}.
This function returns the three values:
\begin{itemize}
\item \ex{(file-name-directory \var{fname})}
\item \ex{(file-name-sans-extension \var{f}))}
\item \ex{(file-name-extension \var{f}\/)}
\end{itemize}
The inverse of \ex{parse-file-name}, in all cases, is \ex{string-append}.
The boundary case of \ex{/} was chosen to preserve this inverse.
\end{defundesc}
\begin{defundesc} {replace-extension} {fname ext} \str
This procedure replaces \var{fname}'s extension with \var{ext}.
It is exactly equivalent to
\codex{(string-append (file-name-sans-extension \var{fname}) \var{ext})}
\end{defundesc}
\defun{simplify-file-name}{fname}\str
\begin{desc}
Removes leading and internal occurrences of dot.
A trailing dot is left alone, as the parent could be a symlink.
Removes internal and trailing double-slashes.
A leading double-slash is left alone, in accordance with {\Posix}.
However, triple and more leading slashes are reduced to a single slash,
in accordance with {\Posix}.
Double-dots (parent directory) are left alone, in case they come after
symlinks or appear in a \ex{/../\var{machine}/\ldots} ``super-root'' form
(which {\Posix} permits).
\end{desc}
\defun{resolve-file-name}{fname [dir]}\str
\begin{desc}
\begin{itemize}
\item Do \ex{\~} expansion.
\item If \var{dir} is given,
convert a relative file-name to an absolute file-name,
relative to directory \var{dir}.
\end{itemize}
\end{desc}
\begin{defundesc} {expand-file-name} {fname [dir]} \str
Resolve and simplify the file-name.
\end{defundesc}
\begin{defundesc} {absolute-file-name} {fname [dir]} \str
Convert file-name \var{fname} into an absolute file name,
relative to directory \var{dir}, which defaults to the current
working directory. The file name is simplified before being
returned.
This procedure does not treat a leading tilde character specially.
\end{defundesc}
\begin{defundesc} {home-dir} {[user]} \str
\ex{home-dir} returns \var{user}'s home directory.
\var{User} defaults to the current user.
\begin{exampletable}
\ex{(home-dir)} & \ex{"/user1/lecturer/shivers"} \\
\ex{(home-dir "ctkwan")} & \ex{"/user0/research/ctkwan"}
\end{exampletable}
\end{defundesc}
\begin{defundesc} {home-file} {[user] fname} \str
Returns file-name \var{fname} relative to \var{user}'s home directory;
\var{user} defaults to the current user.
%
\begin{exampletable}
\ex{(home-file "man")} & \ex{"/usr/shivers/man"} \\
\ex{(home-file "fcmlau" "man")} & \ex{"/usr/fcmlau/man"}
\end{exampletable}
\end{defundesc}
The general \ex{substitute-env-vars} string procedure,
defined in the previous section,
is also frequently useful for expanding file-names.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Other string manipulation facilities}
\begin{defundesc} {substitute-env-vars} {fname} \str
Replace occurrences of environment variables with their values.
An environment variable is denoted by a dollar sign followed by
alphanumeric chars and underscores, or is surrounded by braces.
\begin{exampletable}
\splitline{\ex{(substitute-env-vars "\$USER/.login")}}
{\ex{"shivers/.login"}} \\
\cd{(substitute-env-vars "$\{USER\}_log")} & \cd{"shivers_log"}
\end{exampletable}
\end{defundesc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{ASCII encoding}
\defun {char->ascii}{\character} \integer
\defunx {ascii->char}{\integer} \character
\begin{desc}
These are identical to \ex{char->integer} and \ex{integer->char} except that
they use the {\Ascii} encoding.
\end{desc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Character predicates}
\defun {char-letter?}\character\boolean
\defunx{char-lower-case?}\character\boolean
\defunx{char-upper-case?}\character\boolean
\defunx{char-title-case?}\character\boolean
\defunx{char-digit?}\character\boolean
\defunx{char-letter+digit?}\character\boolean
\defunx{char-graphic?}\character\boolean
\defunx{char-printing?}\character\boolean
\defunx{char-whitespace?}\character\boolean
\defunx{char-blank?}\character\boolean
\defunx{char-iso-control?}\character\boolean
\defunx{char-punctuation?}\character\boolean
\defunx{char-hex-digit?}\character\boolean
\defunx{char-ascii?}\character\boolean
\begin{desc}
Each of these predicates tests for membership in one of the standard
character sets provided by the SRFI-14 character-set library.
Additionally, the following redundant bindings are provided for {\RnRS}
compatibility:
\begin{inset}
\begin{tabular}{ll}
{\RnRS} name & scsh definition \\ \hline
\ex{char-alphabetic?} & \ex{char-letter+digit?} \\
\ex{char-numeric?} & \ex{char-digit?} \\
\ex{char-alphanumeric?} & \ex{char-letter+digit?}
\end{tabular}
\end{inset}
\end{desc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Deprecated character-set procedures}
\label{sec:char-sets}
The SRFI-13 character-set library grew out of an earlier library developed
for scsh.
However, the SRFI standardisation process introduced incompatibilities with
the original scsh bindings.
The current version of scsh provides the library
\ex{obsolete-char-set-lib}, which contains the old bindings found in
previous releases of scsh.
The following table lists the members of this library, along with
the equivalent SRFI-13 binding. This obsolete library is deprecated and
\emph{not} open by default in the standard \ex{scsh} environment;
new code should use the SRFI-13 bindings.
\begin{inset}
\begin{tabular}{ll}
Old \ex{obsolete-char-set-lib} & SRFI-13 \ex{char-set-lib} \\ \hline
\ex{char-set-members} & \ex{char-set->list} \\
\ex{chars->char-set} & \ex{list->char-set} \\
\ex{ascii-range->char-set} & \ex{ucs-range->char-set} (not exact) \\
\ex{predicate->char-set} & \ex{char-set-filter} (not exact) \\
\ex{char-set-every}? & \ex{char-set-every} \\
\ex{char-set-any}? & \ex{char-set-any} \\
\\
\ex{char-set-invert} & \ex{char-set-complement} \\
\ex{char-set-invert}! & \ex{char-set-complement!} \\
\\
\ex{char-set:alphabetic} & \ex{char-set:letter} \\
\ex{char-set:numeric} & \ex{char-set:digit} \\
\ex{char-set:alphanumeric} & \ex{char-set:letter+digit} \\
\ex{char-set:control} & \ex{char-set:iso-control}
\end{tabular}
\end{inset}
Note also that the \ex{->char-set} procedure no longer handles a predicate
argument.
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "man"
%%% End:
| {
"alphanum_fraction": 0.6466271238,
"avg_line_length": 39.6294820717,
"ext": "tex",
"hexsha": "862d22c6e6e0a6b86bc3f16c72a8cd69a02d639d",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "fbde75aea19724631c5dfc582baf3cf85651cdc0",
"max_forks_repo_licenses": [
"X11"
],
"max_forks_repo_name": "takusuman/scsh",
"max_forks_repo_path": "src/doc/scsh-manual/strings.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "fbde75aea19724631c5dfc582baf3cf85651cdc0",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"X11"
],
"max_issues_repo_name": "takusuman/scsh",
"max_issues_repo_path": "src/doc/scsh-manual/strings.tex",
"max_line_length": 104,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "fbde75aea19724631c5dfc582baf3cf85651cdc0",
"max_stars_repo_licenses": [
"X11"
],
"max_stars_repo_name": "takusuman/scsh",
"max_stars_repo_path": "src/doc/scsh-manual/strings.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 5725,
"size": 19894
} |
\chapter{Discussion}\label{discussion}
\setlength{\parindent}{0ex}
The project containing the mining cart system has been an experience where several decisions have been made regarding the C++ code and ROS interaction. Firstly, it was to add a namespace to the two nodes and construct classes containing methods for executing various functions. This has been done as an overall personal preference, but also because the raw code is a lot easier to navigate when structured like this. The object oriented approach brings modularity into the code, and future expansion would be less complicated with this structure, this "expansion" would be done by converting some of the current methods to header files and enabling usage across nodes and subtracting them into classes relative to their function, but still in a structured manner as the code progresses in size.
\iffalse
A note to the above:
The object oriented approach adds modularity to the code which prevents monolith coding, thus enabling the ability to easily scale the code.
\fi
\vspace{2mm}
A second initial thought in the planning stage of the mining cart software was to make a custom message containing a string, this has been done since a custom message gives more control but also the fact that a message can be changed in its original structure, thus adding the ability to expand the software as needed or if needed.
\vspace{40mm}
{\let\clearpage\relax \chapter{Conclusion}}
This mini-project shows a demonstration of a simple ROS package with two nodes, that contains a separate publisher in the first node, which publishes a custom string message to a subscriber in the second node.
The main functionality of the two nodes is as described in \textit{\autoref{implementation}} and this implementation are in the project groups opinion concluded as a success with room and functionality for expansion as described in \textit{\autoref{discussion}}.
| {
"alphanum_fraction": 0.8082120582,
"avg_line_length": 80.1666666667,
"ext": "tex",
"hexsha": "aa9916ae79a5f8ce1fddcd33fe90aed8588c3cb9",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f4b8c0d0056a2e30fbb12d2e8ec5a335ada4dff7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "RiceCurry2/rpro-mini-project",
"max_forks_repo_path": "RPro-Mini-Project-B332b/02 - Sections/04-Discussion.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f4b8c0d0056a2e30fbb12d2e8ec5a335ada4dff7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "RiceCurry2/rpro-mini-project",
"max_issues_repo_path": "RPro-Mini-Project-B332b/02 - Sections/04-Discussion.tex",
"max_line_length": 795,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "f4b8c0d0056a2e30fbb12d2e8ec5a335ada4dff7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "RiceCurry2/rpro-mini-project",
"max_stars_repo_path": "RPro-Mini-Project-B332b/02 - Sections/04-Discussion.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 382,
"size": 1924
} |
\chapter{\protect\program{plastex} --- The Command-Line Interface}
While \plasTeX\ makes it possible to parse \LaTeX\ directly from Python
code, most people will simply use the supplied command-line interface,
\program{plastex}. \program{plastex} will invoke the parsing processes
and apply a specified renderer. By default, \program{plastex} will
convert to HTML, although this can be changed in the \program{plastex}
configuration.
Invoking \program{plastex} is very simple. To convert a \LaTeX\ document
to HTML using all of the defaults, simply type the following at shell prompt.
\begin{verbatim}
plastex mylatex.tex
\end{verbatim}
where \file{mylatex.tex} is the name of your \LaTeX\ file. The
\LaTeX\ source will be parsed, all packages will be loaded and macros
expanded, and converted to HTML. Hopefully, at this point you will have
a lovely set of HTML files that accurately reflect the \LaTeX\ source
document. Unfortunately, converting \LaTeX\ to other formats can be
tricky, and there are many pitfalls. If you are getting warnings or
errors while converting your document, you may want to check the FAQ
in the appendix to see if your problem is addressed.
Running \program{plastex} with the default options may not give you output
exactly the way you had envisioned. Luckily, there are many options
that allow you to change the rendering behavior. These options are
described in the following section.
\section{Command-Line and Configuration Options}
There are many options to \program{plastex} that allow you to control
things input and output file encodings, where files are generated and
what the filenames look like, rendering parameters, etc. While
\program{plastex} is the interface where the options are specified, for
the most part these options are simply passed to the parser and renderers
for their use. It is even possible to create your own options for use
in your own Python-based macros and renderers.
The following options are currently available
on the \program{plastex} command. They are categorized for convenience.
\subsection{General Options}
\begin{configuration}{Configuration files}
\options{\longprogramopt{config=\optval{config-file}} or
\programopt{-c \optval{config-file}}}
\config{general}{config}
specifies a configuration file to load. This should be the first option
specified on the command-line.
\end{configuration}
\begin{configuration}{Kpsewhich}
\options{\longprogramopt{kpsewhich=\optval{program}}}
\config{general}{kpsewhich}
\default{kpsewhich}
specifies the \program{kpsewhich} program to use to locate \LaTeX\
files and packages.
\end{configuration}
\begin{configuration}{Renderer}
\options{\longprogramopt{renderer=\optval{renderer-name}}}
\config{general}{renderer}
\default{XHTML}
specifies which renderer to use.
\end{configuration}
\begin{configuration}{Themes}
\options{\longprogramopt{theme=\optval{theme-name}}}
\config{general}{theme}
\default{default}
specifies which theme to use.
\end{configuration}
\begin{configuration}{Extra theme files}
\options{\longprogramopt{copy-theme-extras} or
\longprogramopt{ignore-theme-extras}}
\config{general}{copy-theme-extras}
\default{yes}
indicates whether or not extra files that belong to a theme (if there are
any) should be copied to the output directory.
\end{configuration}
\subsection{Document Properties\label{sec:config-document}}
\begin{configuration}{Base URL}
\options{\longprogramopt{base-url=\optval{url}}}
\config{document}{base-url}
specifies a base URL to prepend to the path of all links.
\end{configuration}
\begin{configuration}{Number of Columns in the Index}
\options{\longprogramopt{index-columns=\optval{integer}}}
\config{document}{index-columns}
specifies the number of columns to group the index into.
\end{configuration}
\begin{configuration}{Section number depth}
\options{\longprogramopt{sec-num-depth=\optval{integer}}}
\config{document}{sec-num-depth}
\default{6}
specifies the section level depth that should appear in section numbers.
This value overrides the value of the secnumdepth counter in the document.
\end{configuration}
\begin{configuration}{Title for the document}
\options{\longprogramopt{title=\optval{string}}}
\config{document}{title}
specifies a title to use for the document instead of the title given
in the \LaTeX\ source document
\end{configuration}
\begin{configuration}{Table of contents depth}
\options{\longprogramopt{toc-depth=\optval{integer}}}
\config{document}{toc-depth}
specifies the number of levels to include in each table of contents.
\end{configuration}
\begin{configuration}{Display sections in the table of contents that do not create files}
\options{\longprogramopt{toc-non-files}}
\config{document}{toc-non-files}
specifies that sections that do not create files should still appear in the
table of contents. By default, only sections that create files will show
up in the table of contents.
\end{configuration}
\subsection{Counters}
It is possible to set the initial value of a counter from the
command-line using the \longprogramopt{counter} option or the
``counters'' section in a configuration file. The configuration
file format for setting counters is very simple. The option name
in the configuration file corresponds to the counter name, and the
value is the value to set the counter to.
\begin{verbatim}
[counters]
chapter=4
part=2
\end{verbatim}
The sample configuration above sets the chapter counter to 4, and the
part counter to 2.
The \longprogramopt{counter} can also set counters. It accepts multiple
arguments which must be surrounded by square brackets ([~]).
Each counter set in the \longprogramopt{counter}
option requires two values: the name of the counter and the value to
set the counter to. An example of \longprogramopt{counter} is shown below.
\begin{verbatim}
plastex --counter [ part 2 chapter 4 ] file.tex
\end{verbatim}
Just as in the configuration example, this command-line sets the
part counter to 2, and the chapter counter to 4.
\begin{configuration}{Set initial counter values}
\options{\longprogramopt{counter=\optval{[ counter-name initial-value ]}}}
specifies the initial counter values.
\end{configuration}
\subsection{Document Links\label{sec:config-links}}
The links section of the configuration is a little different than the
others. The options in the links section are not preconfigured, they
are all user-specified. The links section includes information
to be included in the navigation object available on all sections in
a document. By default, the section's navigation object includes things
like the previous and next objects in the document, the child nodes,
the sibling nodes, etc. The table below lists all of the navigation
objects that are already defined. The names for these items came from
the link types defined at \url{http://fantasai.tripod.com/qref/Appendix/LinkTypes/ltdef.html}. Of course, it is up to the renderer to actually make use
of them.
\begin{tableii}{l|l}{var}{Name}{Description}
\lineii{home}{the first section in the document}
\lineii{start}{same as \var{home}}
\lineii{begin}{same as \var{home}}
\lineii{first}{same as \var{home}}
\lineii{end}{the last section in the document}
\lineii{last}{same as \var{end}}
\lineii{next}{the next section in the document}
\lineii{prev}{the previous section in the document}
\lineii{previous}{same as \var{prev}}
\lineii{up}{the parent section}
\lineii{top}{the top section in the document}
\lineii{origin}{same as \var{top}}
\lineii{parent}{the parent section}
\lineii{child}{a list of the subsections}
\lineii{siblings}{a list of the sibling sections}
\lineii{document}{the document object}
\lineii{part}{the current part object}
\lineii{chapter}{the current chapter object}
\lineii{section}{the current section object}
\lineii{subsection}{the current subsection object}
\lineii{navigator}{the top node in the document object}
\lineii{toc}{the node containing the table of contents}
\lineii{contents}{same as \var{toc}}
\lineii{breadcrumbs}{a list of the parent objects of the current node}
\end{tableii}
Since each of these items references an object that is expected to have
a URL and a title, any user-defined fields should contain these as well
(although the URL is optional in some items). To create a user-defined
field in this object, you need to use two options: one for the title
and one for the URL, if one exists. They are specified in the config
file as follows:
\begin{verbatim}
[links]
next-url=http://myhost.com/glossary
next-title=The Next Document
mylink-title=Another Title
\end{verbatim}
These option names are split on the dash (-) to create a key, before the dash,
and a member, after the dash. A dictionary is inserted into the navigation
object with the name of the key, and the members are added to that dictionary.
The configuration above would create the following Python dictionary.
\begin{verbatim}
{
'next':
{
'url':'http://myhost.com/glossary',
'title':'The Next Document'
},
'mylink':
{
'title':'Another Title'
}
}
\end{verbatim}
While you can not override a field that is populated by the document,
there are times when a field isn't populated. This occurs, for example,
in the \var{prev} field at the beginning of the document, or the
\var{next} field at the end of the document. If you specify a \var{prev}
or \var{next} field in your configuration, those fields will be used
when no \var{prev} or \var{next} is available. This allows you to link
to external documents at those points.
\begin{configuration}{Set document links}
\options{\longprogramopt{links=\optval{[ key optional-url title ]}}}
specifies links to be included in the navigation object. Since at
least two values are needed in the links (key and title, with an optional
URL), the values are grouped in square brackets on the command-line ([~]).
\end{configuration}
\subsection{Input and Output Files\label{sec:config-files}}
If you have a renderer that only generates one file, specifying the output
filename is simple: use the \longprogramopt{filename} option to specify
the name. However, if the renderer you are using generates multiple
files, things get more complicated. The \longprogramopt{filename} option
is also capable of handling multiple names, as well as giving you a
templating way to build filenames.
Below is a list of all of the options that affect filename generation.
\begin{configuration}{Characters that shouldn't be used in a filename}
\options{\longprogramopt{bad-filename-chars=\optval{string}}}
\config{files}{bad-chars}
\default{:~\#\$\%\textasciicircum\&*!\textasciitilde`"'=?/{}[]()|<>;\textbackslash,.}
specifies all characters that should not be allowed in a filename.
These characters will be replaced by the value in
\longprogramopt{bad-filename-chars-sub}.
\end{configuration}
\begin{configuration}{String to use in place of invalid characters}
\options{\longprogramopt{bad-filename-chars-sub}=\optval{string}}
\config{files}{bad-chars-sub}
\default{-}
specifies a string to use in place of invalid filename characters (
specified by the \longprogramopt{bad-chars-sub} option)
\end{configuration}
\begin{configuration}{Output Directory}
\options{\longprogramopt{dir=\optval{directory}} or \programopt{-d \optval{directory}}}
\config{files}{directory}
\default{\$jobname}
specifies a directory name to use as the output directory.
\end{configuration}
\begin{configuration}{Escaping characters higher than 7-bit}
\options{\longprogramopt{escape-high-chars}}
\config{files}{escape-high-chars}
\default{False}
some output types allow you to represent characters that are greater than
7-bits with an alternate representation to alleviate the issue of
file encoding. This option indicates that these alternate representations
should be used.
\note{The renderer is responsible for doing the translation into the
alternate format. This might not be supported by all output types.}
\end{configuration}
\begin{configuration}{Template to use for output filenames}
\options{\longprogramopt{filename=\optval{string}}}
\config{files}{filename}
specifies the templates to use for generating filenames.
The filename template is a list of space separated names. Each name
in the list is returned once. An example is shown below.
\begin{verbatim}
index.html toc.html file1.html file2.html
\end{verbatim}
If you don't know how many files you are going to be reproducing,
using static filenames like in the example above is not practical.
For this reason, these filenames can also contain variables as described in
Python's string Templates (e.g. \var{\$title}, \var{\${id}}). These variables
come from the namespace created in the renderer and include:
\var{\$id}, the ID (i.e. label) of the item, \var{\$title}, the title of the
item, and \var{\$jobname}, the basename of the \LaTeX\ file being processed.
One special variable is \var{\$num}. This value in generated dynamically
whenever a filename with \var{\$num} is requested. Each time a filename
with \var{\$num} is successfully generated, the value of \var{\$num}
is incremented.
The values of variables can also be modified by a format specified
in parentheses after the variable. The format is simply an integer
that specifies how wide of a field to create for integers
(zero-padded), or, for strings, how many space separated words
to limit the name to. The example below shows \var{\$num} being padded
to four places and \var{\$title} being limited to five words.
\begin{verbatim}
sect$num(4).html $title(5).html
\end{verbatim}
The list can also contain a wildcard filename (which should be
specified last). Once a wildcard name is reached, it is
used from that point on to generate the remaining filenames.
The wildcard filename contains a list of alternatives to use as
part of the filename indicated by a comma separated list of
alternatives surrounded by a set of square brackets ([ ]).
Each of the alternatives specified is tried until a filename is
successfully created (i.e. all variables resolve). For example,
the specification below creates three alternatives.
\begin{verbatim}
$jobname_[$id, $title, sect$num(4)].html
\end{verbatim}
The code above is expanded to the following possibilities.
\begin{verbatim}
$jobname_$id.html
$jobname_$title.html
$jobname_sect$num(4).html
\end{verbatim}
Each of the alternatives is attempted until one of them succeeds.
In order for an alternative to succeed, all of the variables referenced
in the template must be populated. For example, the \var{\$id} variable
will not be populated unless the node had a \macro{\$label} macro
pointing to it. The \var{title} variable would not be populated unless
the node had a title associated with it (e.g. such as section, subsection, etc.).
Generally, the last one should contain no variables except for
\var{\$num} as a fail-safe alternative.
\end{configuration}
\begin{configuration}{Input Encoding}
\options{\longprogramopt{input-encoding=\optval{string}}}
\config{files}{input-encoding}
\default{utf-8}
specifies which encoding the \LaTeX\ source file is in
\end{configuration}
\begin{configuration}{Output Encoding}
\options{\longprogramopt{output-encoding=\optval{string}}}
\config{files}{output-encoding}
\default{utf-8}
specifies which encoding the output files should use.
\note{This depends on the output format as well. While HTML and XML use
encodings, a binary format like MS Word, would not.}
\end{configuration}
\begin{configuration}{Splitting document into multiple files}
\options{\longprogramopt{split-level=\optval{integer}}}
\config{files}{split-level}
\default{2}
specifies the highest section level that generates a new file. Each section
in a \LaTeX\ document has a number associated with its hierarchical level.
These levels are -2 for the document, -1 for parts, 0 for chapters,
1 for sections, 2 for subsections, 3 for subsubsections, 4 for paragraphs,
and 5 for subparagraphs. A new file will be generated for every section
in the hierarchy with a value less than or equal to the value of this
option. This means that for the value of 2, files will be generated for
the document, parts, chapters, sections, and subsections.
\end{configuration}
\subsection{Image Options\label{sec:config-images}}
Images are created by renderers when the output type in incapable of
rendering the content in any other way. This method is commonly used
to display equations in HTML output. The following options control
how images are generated.
\begin{configuration}{Base URL}
\options{\longprogramopt{image-base-url=\optval{url}}}
\config{images}{base-url}
specifies a base URL to prepend to the path of all images.
\end{configuration}
\begin{configuration}{\LaTeX\ program to use to compile image document}
\options{\longprogramopt{image-compiler=\optval{program}}}
\config{images}{compiler}
\default{latex}
specifies which program to use to compile the images \LaTeX\ document.
\end{configuration}
\begin{configuration}{Enable or disable image generation}
\options{\longprogramopt{enable-images} or
\longprogramopt{disable-images}}
\config{images}{enabled}
\default{yes}
indicates whether or not images should be generated.
\end{configuration}
\begin{configuration}{Enable or disable the image cache}
\options{\longprogramopt{enable-image-cache} or
\longprogramopt{disable-image-cache}}
\config{images}{cache}
\default{yes}
indicates whether or not images should use a cache between runs.
\end{configuration}
\begin{configuration}{Convert \LaTeX\ output to images}
\options{\longprogramopt{imager=\optval{program}}}
\config{images}{imager}
\default{dvipng dvi2bitmap gsdvipng gspdfpng OSXCoreGraphics}
specifies which converter will be used to take the output from the
\LaTeX\ compiler and convert it to images. You can specify a space
delimited list of names as well. If a list of names is specified,
each one is verified in order to see if it works on the current machine.
The first one that succeeds is used.
You can use the value of ``none'' to turn the imager off.
\end{configuration}
\begin{configuration}{Image filenames}
\options{\longprogramopt{image-filenames=\optval{filename-template}}}
\config{images}{filenames}
\default{images/img-\$num(4).png}
specifies the image naming template to use to generate filenames. This
template is the same as the templates used by the \longprogramopt{filename}
option.
\end{configuration}
\begin{configuration}{Convert \LaTeX\ output to vector images}
\options{\longprogramopt{vector-imager=\optval{program}}}
\config{images}{vector-imager}
\default{dvisvgm}
specifies which converter will be used to take the output from the
\LaTeX\ compiler and convert it to vector images. You can specify a space
delimited list of names as well. If a list of names is specified,
each one is verified in order to see if it works on the current machine.
The first one that succeeds is used.
You can use the value of ``none'' to turn the vector imager off.
\note{When using the vector imager, a bitmap image is also created
using the regular imager. This bitmap is used to determine the
depth information about the vector image and can also be used as
a backup if the vector image is not supported by the viewer.}
\end{configuration}
| {
"alphanum_fraction": 0.7757541264,
"avg_line_length": 40.7742616034,
"ext": "tex",
"hexsha": "df499ce5594b6a453df35fdf7efdac46296d80ff",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "5900ee6ab0055a8047dd2b54b8667d05f3a145c2",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lisiynos/lisiynos.github.io",
"max_forks_repo_path": "plastex/Doc/command.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "5900ee6ab0055a8047dd2b54b8667d05f3a145c2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "lisiynos/lisiynos.github.io",
"max_issues_repo_path": "plastex/Doc/command.tex",
"max_line_length": 152,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "5900ee6ab0055a8047dd2b54b8667d05f3a145c2",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lisiynos/lisiynos.github.io",
"max_stars_repo_path": "plastex/Doc/command.tex",
"max_stars_repo_stars_event_max_datetime": "2019-03-02T17:20:25.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-03-02T17:20:25.000Z",
"num_tokens": 4749,
"size": 19327
} |
\section{Conclusion}
This paper has tried to establish how reinforcement learning can be used to solve dynamic models. I show that using these solution methods allow for solving models otherwise computationally infeasible. I argue that when using such methods, there is no guarantee of finding the optimal policy, and there exists a real risk of ending up in local maxima. Furthermore, have I presented an economic model of exogenous fertility and endogenous female labour supply, that can give a surprisingly good fit to data, and show comparable long term penalties for female participation rates, earnings, wage rates and hours worked to contemporary findings by \textcite{kleven_children_2019}, when a household gets a child.
In the first part of the paper, I draw on the literature of female labour supply and fertility to formulate a simple dynamic model of female labour supply and fertility, tracking households over the life cycle, where women can supply a discreet number of hours to the labour force. I use aggregate data for Statistics Denmark to calibrate the parameters of the income process. For this task I assume that the households follows a deterministic strategy regarding labour supply. I find, the model seem to approximate the income paths of both men and women very well. Next, I present the reader for reinforcement learning and deep learning allowing the reader to have an understanding of the algorithms used for solving the models presented in this paper. I go on to present three different solution methods: Value function Iteration using deep neural networks for value function approximation, Deep Q-learning and Double Deep Q-Learning. I find that these three solution methods have comparable performance, but the model does not seem to fit the data well! I formulate an extension to the inadequate model, and use Double Deep Q-learning as solution method. I estimate the extra parameters using method of simulated moments. Simulating from the model using the estimated parameters, I find that both the participation rate and the average number of supplied hours to the labour force is comparable to what is found in data. Finally I compare event graphs to those found by \textcite{kleven_children_2019} and find striking similarities, finding that women do experience a real penalty when getting a child. I find a long-term penalty of 15 \% on earnings for women with one child where \textcite{kleven_children_2019} find a 19 \% penalty and a long term reduction of 21 \% in the number of hours worked compared to 10 \% found by \textcite{kleven_children_2019}.
I hope this paper gives a convincing argument for the use of reinforcement learning within the field of economics. When economists formulates models the solution method often constraints what is explored. After writing this paper, I have come to believe, that reinforcement learning can be a way for exploring what previously has been assumed to be unsolvable using contemporary methods, possibly paving the way for new and exciting research and insights. | {
"alphanum_fraction": 0.817468106,
"avg_line_length": 436.7142857143,
"ext": "tex",
"hexsha": "b50d431d2b58276bea4c8f5864bbc92c09f25917",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "95d89c281b9d8f73065a823cba97a5bedcbf129d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "JakartaLaw/speciale",
"max_forks_repo_path": "chapters/conclusion.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "95d89c281b9d8f73065a823cba97a5bedcbf129d",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "JakartaLaw/speciale",
"max_issues_repo_path": "chapters/conclusion.tex",
"max_line_length": 1867,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "95d89c281b9d8f73065a823cba97a5bedcbf129d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "JakartaLaw/speciale",
"max_stars_repo_path": "chapters/conclusion.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 590,
"size": 3057
} |
\documentclass[]{book}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\else % if luatex or xelatex
\ifxetex
\usepackage{mathspec}
\else
\usepackage{fontspec}
\fi
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\hypersetup{unicode=true,
pdftitle={fulltext manual},
pdfborder={0 0 0},
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
\usepackage{natbib}
\bibliographystyle{apalike}
\usepackage{color}
\usepackage{fancyvrb}
\newcommand{\VerbBar}{|}
\newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
% Add ',fontsize=\small' for more characters per line
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\AlertTok}[1]{\textcolor[rgb]{0.94,0.16,0.16}{#1}}
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.77,0.63,0.00}{#1}}
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\BuiltInTok}[1]{#1}
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{#1}}
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{0.64,0.00,0.00}{\textbf{#1}}}
\newcommand{\ExtensionTok}[1]{#1}
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.00,0.00,0.81}{#1}}
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\ImportTok}[1]{#1}
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
\newcommand{\NormalTok}[1]{#1}
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.81,0.36,0.00}{\textbf{#1}}}
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{#1}}
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textit{#1}}}
\newcommand{\RegionMarkerTok}[1]{#1}
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.00,0.00,0.00}{#1}}
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.31,0.60,0.02}{#1}}
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.56,0.35,0.01}{\textbf{\textit{#1}}}}
\usepackage{longtable,booktabs}
\usepackage{graphicx,grffile}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
% Redefines (sub)paragraphs to behave more like sections
\ifx\paragraph\undefined\else
\let\oldparagraph\paragraph
\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}
\fi
\ifx\subparagraph\undefined\else
\let\oldsubparagraph\subparagraph
\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}
\fi
%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}
%%% Change title format to be more compact
\usepackage{titling}
% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
\posttitle{
\begin{center}\large#1\end{center}
}
}
\setlength{\droptitle}{-2em}
\title{fulltext manual}
\pretitle{\vspace{\droptitle}\centering\huge}
\posttitle{\par}
\author{}
\preauthor{}\postauthor{}
\predate{\centering\large\emph}
\postdate{\par}
\date{2017-12-19 - fulltext v0.1.9.9621}
\usepackage{booktabs}
\usepackage{amsthm}
\makeatletter
\def\thm@space@setup{%
\thm@preskip=8pt plus 2pt minus 4pt
\thm@postskip=\thm@preskip
}
\makeatother
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\theoremstyle{definition}
\newtheorem{definition}{Definition}[chapter]
\newtheorem{corollary}{Corollary}[chapter]
\newtheorem{proposition}{Proposition}[chapter]
\theoremstyle{definition}
\newtheorem{example}{Example}[chapter]
\theoremstyle{definition}
\newtheorem{exercise}{Exercise}[chapter]
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{solution}{Solution}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{1}
\tableofcontents
}
\hypertarget{fulltext-manual}{%
\chapter{fulltext manual}\label{fulltext-manual}}
\begin{quote}
An R package to search across and get full text for open access journals
\end{quote}
The \texttt{fulltext} package makes it easy to do text-mining by
supporting the following steps:
\begin{itemize}
\tightlist
\item
Search for articles
\item
Fetch articles
\item
Get links for full text articles (xml, pdf)
\item
Extract text from articles / convert formats
\item
Collect bits of articles that you actually need
\item
Download supplementary materials from papers
\end{itemize}
\hypertarget{info}{%
\section{Info}\label{info}}
\begin{itemize}
\tightlist
\item
Code: \url{https://github.com/ropensci/fulltext/}
\item
Issues: \url{https://github.com/ropensci/fulltext/issues}
\item
CRAN: \url{https://cran.rstudio.com/web/packages/fulltext/}
\end{itemize}
\hypertarget{citing-fulltext}{%
\section{Citing fulltext}\label{citing-fulltext}}
\begin{quote}
Scott Chamberlain \& Will Pearse (2017). fulltext: Full Text of
`Scholarly' Articles Across Many Data Sources. R package version
0.1.9.9621. \url{https://github.com/ropensci/fulltext}
\end{quote}
\hypertarget{installation}{%
\section{Installation}\label{installation}}
Stable version from CRAN
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{install.packages}\NormalTok{(}\StringTok{"fulltext"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
Development version from GitHub
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{devtools}\OperatorTok{::}\KeywordTok{install_github}\NormalTok{(}\StringTok{"ropensci/fulltext"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
Load library
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{library}\NormalTok{(}\StringTok{'fulltext'}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
\hypertarget{intro}{%
\chapter{Introduction}\label{intro}}
\hypertarget{user-interface}{%
\section{User interface}\label{user-interface}}
Functions in \texttt{fulltext} are setup to make the package as easy to
use as possible. The functions are organized around use cases:
\begin{itemize}
\tightlist
\item
Search for articles
\item
Get full text links
\item
Get articles
\item
Get abstracts
\item
Pull out article sections of interest
\end{itemize}
Because there are so many data sources for scholarly texts, it makes a
lot of sense to simplify the details of each data source, and present a
single user interface to all of them.
\hypertarget{data-sources}{%
\chapter{Data sources}\label{data-sources}}
Data sources in \texttt{fulltext} include:
\begin{itemize}
\tightlist
\item
\href{http://www.crossref.org/}{Crossref} - via the \texttt{rcrossref}
package
\item
\href{https://www.plos.org/}{Public Library of Science (PLOS)} - via
the \texttt{rplos} package
\item
\href{http://www.biomedcentral.com/}{Biomed Central}
\item
\href{https://arxiv.org}{arXiv} - via the \texttt{aRxiv} package
\item
\href{http://biorxiv.org/}{bioRxiv} - via the \texttt{biorxivr}
package
\item
\href{http://www.ncbi.nlm.nih.gov/}{PMC/Pubmed via Entrez} - via the
\texttt{rentrez} package
\item
Many more are supported via the above sources (e.g., \emph{Royal
Society Open Science} is available via Pubmed)
\item
We \textbf{will} add more, as publishers open up, and as we have
time\ldots{}See the
\href{https://github.com/ropensci/fulltext/issues/4\#issuecomment-52376743}{master
list here}
\end{itemize}
\hypertarget{authentication}{%
\chapter{Authentication}\label{authentication}}
Some data sources require authentication. Here's a breakdown of how to
do authentication by data source:
\begin{itemize}
\tightlist
\item
\textbf{BMC}: BMC is integrated into Springer Publishers now, and that
API requires an API key. Get your key by signing up at
\url{https://dev.springer.com/}, then you'll get a key. Pass the key
to a named parameter \texttt{key} to \texttt{bmcopts}. Or, save your
key in your \texttt{.Renviron} file as \texttt{SPRINGER\_KEY}, and
we'll read it in for you, and you don't have to pass in anything.
\item
\textbf{Scopus}: Scopus requires an API key to search their service.
Go to \url{https://dev.elsevier.com/index.html}, register for an
account, then when you're in your account, create an API key. Pass in
as variable \texttt{key} to \texttt{scopusopts}, or store your key
under the name \texttt{ELSEVIER\_SCOPUS\_KEY} as an environment
variable in \texttt{.Renviron}, and we'll read it in for you. See
\texttt{?Startup} in R for help.
\item
\textbf{Microsoft}: Get a key by creating an Azure account at
\url{https://www.microsoft.com/cognitive-services/en-us/subscriptions},
then requesting a key for \textbf{Academic Knowledge API} within
\textbf{Cognitive Services}. Store it as an environment variable in
your \texttt{.Renviron} file - see {[}Startup{]} for help. Pass your
API key into \texttt{maopts} as a named element in a list like
\texttt{list(key\ =\ Sys.getenv(\textquotesingle{}MICROSOFT\_ACADEMIC\_KEY\textquotesingle{}))}
\item
\textbf{Crossref}: Crossref encourages requests with contact
information (an email address) and will forward you to a dedicated API
cluster for improved performance when you share your email address
with them.
\url{https://github.com/CrossRef/rest-api-doc\#good-manners--more-reliable-service}
To pass your email address to Crossref via this client, store it as an
environment variable in \texttt{.Renviron} like
\texttt{crossref\_email\ =\ [email protected]}
\end{itemize}
None needed for \textbf{PLOS}, \textbf{eLife}, \textbf{arxiv},
\textbf{biorxiv}, \textbf{Euro PMC}, or \textbf{Entrez} (though soon you
will get better rate limtits with auth for Entrez)
\hypertarget{search}{%
\chapter{Search}\label{search}}
Search is what you'll likely start with for a number of reasons. First,
search functionality in \texttt{fulltext} means that you can start from
searching on words like `ecology' or `cellular' - and the output of that
search can be fed downstream to the next major task: fetching articles.
\hypertarget{usage}{%
\section{Usage}\label{usage}}
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{library}\NormalTok{(fulltext)}
\end{Highlighting}
\end{Shaded}
List backends available
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{ft_search_ls}\NormalTok{()}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
#> [1] "arxiv" "biorxivr" "bmc" "crossref" "entrez"
#> [6] "europe_pmc" "ma" "plos" "scopus"
\end{verbatim}
Search - by default searches against PLOS (Public Library of Science)
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{res <-}\StringTok{ }\KeywordTok{ft_search}\NormalTok{(}\DataTypeTok{query =} \StringTok{"ecology"}\NormalTok{)}
\end{Highlighting}
\end{Shaded}
The output of \texttt{ft\_search} is a \texttt{ft} S3 object, with a
summary of the results:
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{res}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
#> Query:
#> [ecology]
#> Found:
#> [PLoS: 41094; BMC: 0; Crossref: 0; Entrez: 0; arxiv: 0; biorxiv: 0; Europe PMC: 0; Scopus: 0; Microsoft: 0]
#> Returned:
#> [PLoS: 10; BMC: 0; Crossref: 0; Entrez: 0; arxiv: 0; biorxiv: 0; Europe PMC: 0; Scopus: 0; Microsoft: 0]
\end{verbatim}
and has slots for each data source:
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{names}\NormalTok{(res)}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
#> [1] "plos" "bmc" "crossref" "entrez" "arxiv" "biorxiv"
#> [7] "europmc" "scopus" "ma"
\end{verbatim}
Get data for a single source
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{res}\OperatorTok{$}\NormalTok{plos}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
#> Query: [ecology]
#> Records found, returned: [41094, 10]
#> License: [CC-BY]
#> id
#> 1 10.1371/journal.pone.0001248
#> 2 10.1371/journal.pone.0059813
#> 3 10.1371/journal.pone.0155019
#> 4 10.1371/journal.pone.0080763
#> 5 10.1371/journal.pone.0150648
#> 6 10.1371/journal.pcbi.1003594
#> 7 10.1371/journal.pone.0102437
#> 8 10.1371/journal.pone.0175014
#> 9 10.1371/journal.pone.0166559
#> 10 10.1371/journal.pone.0054689
\end{verbatim}
\hypertarget{links}{%
\chapter{Links}\label{links}}
links
\hypertarget{fetch}{%
\chapter{Fetch}\label{fetch}}
fetch
\hypertarget{chunks}{%
\chapter{Chunks}\label{chunks}}
chunks
\hypertarget{supplementary}{%
\chapter{Supplementary}\label{supplementary}}
supplementary
\hypertarget{use-cases}{%
\chapter{Use cases}\label{use-cases}}
use cases
\hypertarget{literature}{%
\chapter{Literature}\label{literature}}
Here is a review of existing methods.
\bibliography{book.bib,packages.bib}
\end{document}
| {
"alphanum_fraction": 0.7308062079,
"avg_line_length": 31.2489270386,
"ext": "tex",
"hexsha": "1e57da110f4cf6dc05b447498b4d13af38e96ca6",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2021-10-04T12:29:20.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-05-28T04:44:15.000Z",
"max_forks_repo_head_hexsha": "b8ae0eb7da41f3c8f1b861d31cd7afe2d4154821",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "rossmounce/fulltext",
"max_forks_repo_path": "docs/_main.tex",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "b8ae0eb7da41f3c8f1b861d31cd7afe2d4154821",
"max_issues_repo_issues_event_max_datetime": "2021-10-04T17:16:14.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-02-24T16:05:19.000Z",
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "rossmounce/fulltext",
"max_issues_repo_path": "docs/_main.tex",
"max_line_length": 122,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "b8ae0eb7da41f3c8f1b861d31cd7afe2d4154821",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "rossmounce/fulltext",
"max_stars_repo_path": "docs/_main.tex",
"max_stars_repo_stars_event_max_datetime": "2018-01-16T11:16:08.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-12-19T09:37:03.000Z",
"num_tokens": 4942,
"size": 14562
} |
% Bismillahi-r-Rahmani-r-Rahim
\documentclass{article}
\usepackage[round]{natbib}
\author{Daoud Clarke}
\date{\today}
\title{An Analysis of Logical and Vector Space Approaches to Semantics}
\begin{document}
\maketitle
\section{Introduction}
Current approaches to vector-based semantics take the following
two-stage approach:
\begin{itemize}
\item Find vectors for terms based on their occurrences in large
corpora
\item Define or learn a composition for these vectors
\end{itemize}
Here we propose investigating the theory behind a more holistic
approach in which the vectors and composition are learnt
simultaneously.
This idea is inspired by looking at logical approaches to semantics
and contrasting them with current approaches to vector-based
semantics.
\section{Approaches to Logical Semantics}
There are two main approaches to logical semantics, which I shall call
the ``theorem proving'' approach and the ``model building''
approach. In either case I assume we have the following:
\begin{itemize}
\item A collection of sentences forming the \textbf{background
knowledge}. This may include pseudo-sentences derived from an
ontology, such as ``all cats are animals''.
\item The \textbf{text} and \textbf{hypothesis} sentences
\end{itemize}
One question we may ask is whether the text implies the hypothesis
given the background knowledge. Other questions we may be interested
in is whether the text and hypothesis are paraphrases (logically
equivalent), or contradictory given the background knowledge.
In both approaches, each sentence is translated to some logical
form. The background knowledge is represented by the logical form $B$,
the logical form of the text by $T$, and the logical form of the
hypothesis by $H$.
\subsection*{Theorem proving approach}
In this approach, to determine entailment we simply see if we can
prove $B\land T \rightarrow H$ using a theorem prover. Normally, we
would simultaneously trying to build a model for $\lnot(B\land T
\rightarrow H)$; if we do find a model then we know we can give up
trying to prove the theorem.
The other tasks can be attacked similarly, for example the text is
inconsistent with the hypothesis given the background knowledge if we
can prove that $B\land T \rightarrow \lnot H$.
\subsection*{Model building approach}
There are several ways we can use model builders with natural language
semantics, but the basic idea is that given some knowledge, we can
build a model of the world that is representative of that
knowledge. We then query the model to determine what is true.
Under this approach, the model that is built is only required to be
consistent, so any assumptions can be made building the model as long
as these are not inconsistent with the knowledge that is
presented. This allows for a much more flexible approach than the
theorem proving approach.
A simple way you might use a model builder to determine entailment is
to build a model for $B\land T$ and see if $H$ is true in that
model.\footnote{The problem with this approach is that any additional
assumptions we make in building the model could potentially make $H$
arbitrarily true or false. There are ways to work around this that are
not relevant to the discussion --- see \cite{Bos:06}.}
\section{Analogies with Vector Space Approaches}
The approach of \cite{Clark:08} is most closely related to the model
building approach of logical semantics. The ``model'' is the
representation of the words as linear operators. Combining these
operators for a sentence results in a ``truth value'' just as when you
have a logical model, you can get a truth value for any sentence.
This analogy suggests new ways we can use use Clark et al's
approach. For example, we can build a model using the background
knowledge (a text corpus) and evaluate the degree to which the
hypothesis is true in the model, then a build a model using the
background model and the text sentence and evaluate the degree to
which the hypothesis is true with respect to the new model. Following
\cite{Glickman:05}, we can view entailment as holding if the degree to
which the hypothesis is true is greater when the text is included
along with the background knowledge.
It also suggests that the approach of learning vectors and then
learning how to compose them is sub-optimal. What we should really be
doing is learning vectors and composition together such that when we
compose sentences from the background knowledge we get a high value,
and other sentences (or non-sentences) give us a low value.
\bibliographystyle{plainnat}
\bibliography{contexts}
\end{document}
| {
"alphanum_fraction": 0.7949609036,
"avg_line_length": 39.3504273504,
"ext": "tex",
"hexsha": "e2aa419807b14e199145343b88eb9c7433418e25",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "36aee144032dfa203dc774cbe6bbefe5f69beac1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "daoudclarke/daoudclarke.github.com",
"max_forks_repo_path": "notes/approaches/approaches.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "36aee144032dfa203dc774cbe6bbefe5f69beac1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "daoudclarke/daoudclarke.github.com",
"max_issues_repo_path": "notes/approaches/approaches.tex",
"max_line_length": 71,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "36aee144032dfa203dc774cbe6bbefe5f69beac1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "daoudclarke/daoudclarke.github.com",
"max_stars_repo_path": "notes/approaches/approaches.tex",
"max_stars_repo_stars_event_max_datetime": "2015-09-20T07:19:29.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-09-20T07:19:29.000Z",
"num_tokens": 1046,
"size": 4604
} |
\clearpage
\subsection{C++ Comments} % (fold)
\label{sub:c_comments}
Comments allow you to embed documentation and explanatory text within your program's code. The comments are skipped by the compiler, so they have no affect on the program's machine code. You write comments to help yourself and other people understand what you intend the program to do, and any thoughts you want to record along with the code.
\csyntax{csynt:program-creation-comment}{comments}{program-creation/comment}
\mynote {
\begin{itemize}
\item Figure \ref{csynt:program-creation-comment} shows the syntax for comments in C++.
\item In standard C++ the first style of comments must be used, \csnipet{/* Comment */}.
\item Most modern C++ compilers also allow single line comments using \csnipet{// Comment}.
\item Standard C++ comments can span multiple lines, these are also known as `\emph{block comments}'.
\item A compiler ignores comments when compiling your code.
\item You can type almost anything in the comment, represented by the \texttt{...} in the diagram.
\end{itemize}
}
% subsection c_comments (end) | {
"alphanum_fraction": 0.7622061483,
"avg_line_length": 55.3,
"ext": "tex",
"hexsha": "f9f82e05bb3899113405068fa51061e0d541299b",
"lang": "TeX",
"max_forks_count": 6,
"max_forks_repo_forks_event_max_datetime": "2022-03-24T07:42:53.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-06-02T03:18:37.000Z",
"max_forks_repo_head_hexsha": "8f3040983d420129f90bcc4bd69a96d8743c412c",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "macite/programming-arcana",
"max_forks_repo_path": "topics/program-creation/c/c-comments.tex",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "bb5c0d45355bf710eff01947e67b666122901b07",
"max_issues_repo_issues_event_max_datetime": "2021-12-29T19:45:10.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-12-29T19:45:10.000Z",
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "thoth-tech/programming-arcana",
"max_issues_repo_path": "topics/program-creation/c/c-comments.tex",
"max_line_length": 342,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "bb5c0d45355bf710eff01947e67b666122901b07",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "thoth-tech/programming-arcana",
"max_stars_repo_path": "topics/program-creation/c/c-comments.tex",
"max_stars_repo_stars_event_max_datetime": "2021-08-10T04:50:54.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-08-10T04:50:54.000Z",
"num_tokens": 264,
"size": 1106
} |
%\subsubsection{System Tasks}
\noindent\textbf{Recording}
\noindent A \textit{recording} is a process of collecting and storing physiological signals (e.g., breathing data) from sensors over an extended period (e.g., overnight). To enable a recording, we need to establish connections to available sensors, collect samples from the sensors, and store the samples on the device. A \textit{sensor} is a device that transforms analog signals from the real world into digital signals. The digital signals are transmittable over Link Layer technologies (e.g., BlueTooth), and the communication between a sensor and device occurs based on the protocols the sensor supports. A \textit{sample} is a single sensor reading containing data and metadata, such as time and the physiological data. During the recording session, ensuring that the sensors and the devices maintain connectivity is important, such that the record contains more meaningful data upon analysis. Once a recording session has terminated, a \textit{record} with metadata about the recording session is stored, alongside the samples.
\newpage
\noindent \textbf{Sharing}
\noindent Sharing is a mechanism to export and import records across applications. \textit{Exporting} consists of bundling one or more records with correlated samples into a transmittable format and transferring the bundled records over a media (e.g., mail). \textit{Importing}, on the other hand, consists of locating the bundled records on the device, parsing the content and storing it on the device. The sharing mechanism allows the patients to send their records to researchers/doctors.
\noindent \textbf{Module}
\noindent A \textit{module} is an independent application that is installed and launched in Nidra (hereafter: application), to provide extended functionality and data enrichment. A module does not necessarily interact with the application. However, it utilizes the data (e.g., records). For example, a module could be using the records to feed a machine-learning algorithm to predict obstructive sleep apnea. Installing a module is achieved by locating the module-application on the device, and storing the reference in the application. Due to limitations in Android, the module-application cannot be executed within the application. Therefore, the module-application is a standalone Android application. Furthermore, the development of the module-application is independent from the application.
\noindent \textbf{Analytics}
\noindent Analytics is the visualization and interpretation of patterns in the records. The application facilitates the recording of breathing data, which aids in the detection and analysis of sleep-related breathing disorder. There are various analytical methods, ranging from graphs to advanced machine learning algorithms, and incorporating a simple time series plot can indirectly aid in the analysis. For example, plotting a time series graph where the breathing data are on the Y-axis and the time on X-axis, provides a graphical representation of the data that can be further analyzed within the application.
\noindent \textbf{Storage}
\noindent Storage is the objective of achieving persistent data; data remain available after application termination. To enable storage, we use a database for a collection of related data that is easily accessed, managed, and updated. The database should be able to store records, samples, modules, and biometrical data related to the user (i.e., gender, age, height, and weight). Structuring a database that is reliable, efficient, and secure is a crucial part of achieving persistent storage. Android provides several options to enable storage on the device (e.g., internal storage and database).
\noindent \textbf{Presentation}
\noindent Presentation is the concept of exhibiting the functionality of the application to the user. A user interface (UI) is the part of the system that facilitates interaction between the user and the system. In Nidra, determining the screen layout, color palette, interactions, and feedback on actions is part of the development of a user interface. | {
"alphanum_fraction": 0.8112703425,
"avg_line_length": 158.3461538462,
"ext": "tex",
"hexsha": "2cfa179639e970c5da6b71cd9c6c7d2e9085867f",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "1f6dfe2c19686782a0acbcc3466b80b1df072156",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "RiatIO/Master",
"max_forks_repo_path": "Thesis/sections/design/systemtasks.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "1f6dfe2c19686782a0acbcc3466b80b1df072156",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "RiatIO/Master",
"max_issues_repo_path": "Thesis/sections/design/systemtasks.tex",
"max_line_length": 1037,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "1f6dfe2c19686782a0acbcc3466b80b1df072156",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "RiatIO/Master",
"max_stars_repo_path": "Thesis/sections/design/systemtasks.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 813,
"size": 4117
} |
\section*{Chapter 7: Deriving a Generic Algorithm}
\paragraph{Exercise 7.1}
How many additions are needed to compute \texttt{fib0(n)}?
\begin{proof}[Answer]
Let $\alpha(n)$ be the number of additions needed to compute
\texttt{fib0(}$n$\texttt{)}. $\alpha(n)$ can be characterized by
the following recurrence relation:
$$
\alpha(n) =
\begin{cases}
0 & \textrm{if } n \leq 1 \\
1 + \alpha(n-1) + \alpha(n-2) & \textrm{if } n \geq 2
\end{cases}
$$
It can be shown by induction on $n$ that $\alpha(n) = F_{n+1} - 1$.
In fact, if $n \leq 1$, $\alpha(n) = 0 = F_{n+1} - 1$, since
by definition $F_1 = F_2 = 1$. For $n \geq 2$,
\begin{eqnarray*}
\alpha(n) &=& 1 + \alpha(n-1) + \alpha(n-2) \\
&=& 1 + (F_n - 1) + (F_{n-1} - 1) \\
&=& (F_n + F_{n-1}) - 1 \\
&=& F_{n+1} - 1
\end{eqnarray*}
Thus, the number of additions we seek is
$\alpha(n) = F_{n+1} -1 \in \Theta(\varphi^n)$, where $\varphi$ is the
golden ratio.
\end{proof}
| {
"alphanum_fraction": 0.58221303,
"avg_line_length": 31.1935483871,
"ext": "tex",
"hexsha": "d1d0f7fd7a9449cf3dcb3b15145418558dcb11ac",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2020-08-29T14:01:30.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-05-15T07:07:43.000Z",
"max_forks_repo_head_hexsha": "4809c0b430fa05a2676db5750e502b112941d6d7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lukius/fmtgp",
"max_forks_repo_path": "math/src/chapter7.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "4809c0b430fa05a2676db5750e502b112941d6d7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "lukius/fmtgp",
"max_issues_repo_path": "math/src/chapter7.tex",
"max_line_length": 71,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "4809c0b430fa05a2676db5750e502b112941d6d7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lukius/fmtgp",
"max_stars_repo_path": "math/src/chapter7.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-23T03:00:43.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-10-12T17:40:40.000Z",
"num_tokens": 386,
"size": 967
} |
\subsection{Target Group - Fishing Enthusiasts}
\label{TargetGroup}
\begin{wrapfigure}{r}[15pt]{0.35\textwidth}
\vspace{-\baselineskip}
\centering
\includegraphics[width=0.35\textwidth]{Img/FishingEnthusiast}
\caption{Fishing Enthusiast.}
\end{wrapfigure}
The main purpose of the application is to bring closer people living in the area, mainly those that are fishing pros and people who come to the area because of fishing and other similar activities in the nature, everything to the economic benefit of locals without damaging the already fragile environment. It is expected that it could also attract new people unaware of the region to visit the area.
Since we decided to focus on fishing aspect, our target group are \textbf{fishing enthusiasts}, which can actually be divided into two different groups:
\begin{itemize}
\item Locals.
\item Tourists.
\end{itemize}
\subsubsection{Their needs}
\paragraph*{Locals} need a new income system, something new that could bring jobs and opportunities in the area using
the natural environment of the zone such as the river and the woods that follow the Elk River.
\paragraph*{Tourists} coming from other counties want instead a different experience, somewhere new where
they can fish different species and enjoy a new area different from the ones they usually go to.
\subsubsection{What are we offering them?}
A service that will facilitate the organization and the building of an infrastructure for fishing enthusiasts using
modern technologies, this would create new job opportunities (such as local guides, fishing instructors,
boat rentals, ecc...) for the locals and allow tourists to easily come to the Elk River and enjoy
a weekend without the stress of organizing everything by themselves.
\subsubsection{Other information}
\paragraph*{How many are there?} About 1.5Million.
\paragraph*{How many will we reach?} Around 50.000 people.
\paragraph*{How frequently will we interact with them?} Weekly.
\paragraph*{What do we get in return?} Economic growth.
\paragraph*{How can our relationship grow?} With people talking about the service.
\clearpage
\subsection{Personas}
\subsubsection{Bob The Fishing Enthusiast}
\begin{wrapfigure}{r}[15pt]{0.3\textwidth}
\vspace{-\baselineskip}
\centering
\includegraphics[width=0.3\textwidth]{Img/Bob}
\caption{Bob the local.}
\vspace{-2cm}
\end{wrapfigure}
\paragraph*{Who is Bob?}
Bob (40) is father of 2 young children (10 and 12) and has lived his entire life in the small town (700 people) of Webster Springs West Virginia. He used to work at Freedom Industries before the spill of 2014 when shortly after the company filed for bankruptcy and Bob was left without a job. Given that he never attended college and the little possibilities in his hometown, Bob now works at his wife's bakery while he is still searching for another job to help the family put aside some money for the children tuition and health care plan.
\paragraph*{His interests:}
Interests: Fishing, camping, hiking, restoring classic cars and classical music.
\paragraph*{Reasons for him to engage with us:}
He is looking for a new job, knows the territory and believes it can be used for tourism and fishing enthusiasts like himself, has been fishing all his life and would love to teach people how to fish.
\paragraph*{Reasons for him NOT to engage with us:}
He isn't sure it would provide enough for his family the water is still not completely clean, too many tourists may destroy the natural environment of the area.
\paragraph*{His skills:}
Fishing expert, Great sense of direction, it's almost impossible for him to get lost in the local area he has been roaming since childhood, good survival skills, basic medical training, he can also cook the best trout on the grill of the state.
\paragraph*{His typical day:}
Bob wakes up with his wife every weekday at 4:40 AM and they both head up to the bakery in order to prepare everything the little community needs during the day. At around 7:00 AM he takes the little van they have for the activity and starts the delivery for the other businesses of the area and once he is done he goes back home to work on his latest car project until he has to go and pick up the kids from school. Once home again, they eat all together and then he watches some baseball with the kids before helping then with their homework until it's time for dinner. After the boys are in bed he likes to relax for some time on his chair listening to some classical music before going to bed himself, always waiting for the next fishing trip during the weekend.
\paragraph*{His personality:}
Bob is a kind man that always has a smile on his face, no matter the situation. He is an optimist at heart and always believes that everything will be alright and no problem can't be solved if people work together. He is always the first one to volunteer when work for the community has to be done and takes pride and joy in helping the others when they are in need, often refusing any form of compensation.
\paragraph*{His social environment:}
Active member of the community in the small town of Webster Springs West Virginia he is well known and respected. He's usually more forward thinking than the older people that live in town and since he is more accepting of new ideas for the future he often can convince the others to back up new opportunities.
\paragraph*{His dreams:}
Have an independent job, spend more time with his kids, provide more for his family, buy a 1968 Mustang and then restore it with his children
\clearpage
\subsubsection*{Jack The Tourist Fisherman}
\begin{wrapfigure}{r}[15pt]{0.3\textwidth}
\vspace{-\baselineskip}
\centering
\includegraphics[width=0.3\textwidth]{Img/Jack}
\caption{Jack the tourist.}
\vspace{-1.5cm}
\end{wrapfigure}
\paragraph*{Who is Jack?}
Jack(36) is a father of a little girl (6 years) and lives with her and his wife in Columbus, Ohio. He is an IT technician in a medium size company where he has been working since 2007 and is a respected employee. He never obtained a degree but studies IT in high school and has always been tech savvy. Jack's father always brought him to do outdoors activities when he was younger, from rafting to camping, he always loved playing football until he got a knee injury, but his true passion has always been fishing, which he does to this day with his father and friend.
\paragraph*{His interests:}
Fishing, camping, driving, football, rafting and bowling.
\paragraph*{Reasons for him to engage with us:}
He wants a new place to spend the weekend fishing, even though he knows how to fish the "usual" way he never tried fly fishing and would like to try, he also loves natural places and off the grid camping spots.
\paragraph*{Reasons for him NOT to engage with us:}
He's never been to West Virginia, he knows of the spill and still doesn't trust the area after it and it's a longer drive than usual.
\paragraph*{His skills:}
Fishing expert, tech enthusiast, problem solver, knows his way in the great outdoors.
\paragraph*{His typical day:}
Jack wakes up every weekday at 7:00 AM with the family, they all have breakfast together and then he brings his daughter to preschool and then goes to work which starts at 8:00 AM. Around 12:30 AM he heads back home for lunch, which he usually prepares when his wife arrives home with the little girl. After lunch he helps his daughter to bed for the afternoon nap and heads back to work for the afternoon shift. Once home again in the evening they have dinner and spend some more time together watching some TV until it's bedtime for the kid, once she is asleep Jack usually caches up with the latest football updates until it's time for him too to go to sleep.
\paragraph*{His personality:}
Jack is a loving father and husband, a great friend and he is know at work for his great work ethic. He rarely gets upset and is always glad to learn something new, from a simple fact, to a new tech that is going to change the marker, up to a better way to do his job. He worked for what he has but does not like to remind people of this and is a great teacher, whether it is on the job, at the bowling alley or during a fishing trip with someone new joining the group.
\paragraph*{His social environment:}
One of the most experienced people in the company he works for and between the ones that have been there since the early years, Jack is well known and respected by his colleagues and loved by his friends. He is always present at every social event, from birthdays to a quite evening in the bar.
\paragraph*{His dreams:}
Become a manager of the company, teach his daughter to fish, buy a house with a pond.
| {
"alphanum_fraction": 0.7896443878,
"avg_line_length": 100.3837209302,
"ext": "tex",
"hexsha": "cc959af15e387d8a2db6d8eaa4e436b604155e07",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "febeda55fd647943a1b8c49b3c5192fcd69fdaf5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Riccardo95Facchini/DIL-2019",
"max_forks_repo_path": "Report - Latex Files/Files/PersonasGroup.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "febeda55fd647943a1b8c49b3c5192fcd69fdaf5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Riccardo95Facchini/DIL-2019",
"max_issues_repo_path": "Report - Latex Files/Files/PersonasGroup.tex",
"max_line_length": 766,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "febeda55fd647943a1b8c49b3c5192fcd69fdaf5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Riccardo95Facchini/DIL-2019",
"max_stars_repo_path": "Report - Latex Files/Files/PersonasGroup.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1985,
"size": 8633
} |
\documentclass{ansnse}
\usepackage{authblk}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{isotope}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\usepackage{verbatim}
\usepackage{graphicx}
\usepackage{todonotes}
\usepackage{subfig}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{hyperref}
\hypersetup{colorlinks=true,
citecolor=black,
linkcolor=black}
\sisetup{list-final-separator={, and },
separate-uncertainty=true,
range-phrase={--},
multi-part-units=single,
list-units=single,
range-units=single}
\widowpenalty=1000
\clubpenalty=1000
\author{Jeremy Lloyd Conlin\footnote{\texttt{[email protected]}} } % PNAR, MC
\author{Stephen J. Tobin} % Overall effort
\author{Adrienne M. LaFleur} % SINRD
\author{Jianwei Hu} % CIPN
\author{TaeHoon Lee} % DDA
\author{Nathan P. Sandoval} % DN
\author{Melissa A. Schear} % DDSI
\affil{\normalsize\emph{Los Alamos National Laboratory,
Los Alamos, NM 87544}}
\title{On Using Code Emulators and Monte Carlo Estimation to Predict Assembly Attributes of Spent Fuel Assemblies for Safeguards Applications}
\date{}
\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}
\newcommand{\PuEff}{\ensuremath{\isotope[239]{Pu}_{\text{e}}}}
\newcommand{\Pub}{\ensuremath{\PuEff'}}
\newcommand{\dd}{\ensuremath{\mathop{}\!\mathrm{d}}}
\newcommand{\weight}{\ensuremath{\mathpzc{w}}}
\begin{document}
\maketitle
%\ansabstract{The quantification of the plutonium mass in spent nuclear fuel assemblies is an important measurement for nuclear safeguards practitioners. A program is well underway to develop nondestructive assay instruments which, when combined, will be able to quantify the plutonium content of a spent nuclear fuel assembly. Each instrument will quantify a specific attribute of the spent fuel assembly e.g., the fissile content. In this paper, we present a Monte Carlo-based method of estimating the mean and distribution of some assembly attributes. An MCNPX model of each instrument has been created and the response of the instrument was simulated for a range of spent fuel assemblies with discrete parameters (e.g., burnup, initial enrichment, and cooling time). The Monte Carlo-based method interpolates between the modeled results for an instrument to emulate a response for parameters not explicitly modeled. We demonstrate the usefulness of this technique in applying the technique to six different instruments under investigation. The results show that this Monte Carlo-based method can be used to estimate the assembly attributes of a spent fuel assembly based upon the measured response from the instrument.
%}
keywords: Monte Carlo, emulation, safeguards.
\doublespacing
\section{Introduction}\label{sec:Introduction}
Quantifying the plutonium mass in spent nuclear fuel assemblies is a problem of concern to the International Atomic Energy Agency (IAEA). Ensuring that no nuclear material is maliciously diverted from an assembly requires close monitoring of the spent fuel assemblies after their removal from nuclear reactors around the world.
The IAEA already monitors spent nuclear fuel reprocessing plants and storage facilities, typically by using cameras and visual inspections. In addition, gamma and neutron measurements are taken, but the operator's declaration of the parameters (i.e., burnup, initial enrichment, and time since removed from a reactor) are used as a reference to the measurements. These radiation measurements and visual inspection can't measure the plutonium content of the spent nuclear fuel assembly, they can only
detect some types of changes to the assembly.
Under the sponsorship of the Next Generation Safeguards Initiative (NGSI) an effort is underway \citep{Tobin:2008Deter-0} to measure the plutonium content of spent nuclear fuel assemblies without relying on the operator's declaration of the operating parameters of the nuclear reactor and without previous measurements of the spent nuclear fuel assembly. This effort is focusing on a variety of non-destructive assay (NDA) techniques that can be used in a variety of surroundings (e.g., air, water, borated water), and are fast enough to not be a burden on the operational procedures in a nuclear reactor, spent fuel storage, or reprocessing facility. A few of these techniques will be integrated into one instrument to allow a safeguards inspector to measure the mass of plutonium in a spent nuclear fuel assembly and determine whether spent fuel pins have been removed from the assembly.
The program to develop a combination of instruments---integrated in such a way as to quantify the mass of plutonium---is, recognizably, a grand challenge.\cite{Veal:2010NGSI--0} We are currently investigating fourteen different NDA instruments as part of this program. No single instrument can measure the plutonium mass directly, but each instrument provides a measurement, which contributes a piece of the puzzle necessary to quantify the plutonium mass. Some of the quantities that can be measured from an individual measurement are: the average burnup of an assembly; the ratio of the mass of the fissile isotopes to the mass of the fertile isotopes (fissile/fertile ratio); the ratio of the mass of elemental uranium to the mass of elemental plutonium (elemental U/Pu ratio); the mass of \isotope[235]{U} to the mass of \isotope[239]{Pu} (\isotope[235]{U}/\isotope[239]{Pu} ratio); and a combination of the masses of the three fissile isotopes, \isotope[235]{U}, \isotope[239]{Pu}, and \isotope[241]{Pu} (fissile content).
In order to determine the response of each of the fourteen NDA techniques to spent nuclear fuel assemblies, we have created an MCNPX\cite{Pelowitz:2009MCNPX-0} model of each instrument. A library of spent fuel assemblies has been created \cite{Fensin:2009A-Mon-0} which contains a wide variety of spent fuel assemblies. The models are \mbox{17 x 17}, PWR assemblies with assembly parameters of \SIlist[list-final-separator={, or }]{15; 30; 45; 60}{GWd/tU} burnup; \SIlist[list-final-separator={, or }]{2; 3; 4; 5}{wt \% \isotope[235]{U}} initial enrichment; and \SIlist[list-final-separator={, or }]{1; 5; 20; 80}{yr} cooling time. The parameters of burnup, initial enrichment, and cooling time define the mass and spatial distribution of the many isotopes in the spent fuel assembly.
The combination of assembly parameters of burnup, initial enrichment, and cooling time give 64 different models of spent nuclear fuel assemblies which are representative of spent nuclear fuel assemblies in existence in nuclear reprocessing, storage, or reactor sites. The models are combined with the geometry of the detectors and a fixed source MCNPX calculation is performed with a variety of tallies to estimate the response of the detectors used in the technique. The detector responses can then be used to estimate the measured quantity of the technique. The MCNPX simulations can be performed with the assembly surrounded by either water, borated water (2200 ppm), or air.
Each of the fourteen NDA instruments has some detector response that changes with some attribute of the assembly (e.g., fissile content, elemental U/Pu ratio, etc.). The goal for each instrument is to accurately predict an assembly attribute for a given detector response. One detector may measure neutrons while the instrument response scales with the fissile content. Another detector may preferentially measure delayed neutrons that scales with the \isotope[235]{U}/\isotope[239]{Pu} ratio. Both the fissile content and \isotope[235]{U}/\isotope[239]{Pu} ratio are assembly attributes. Though an individual MCNPX simulation can estimate the detector response and can estimate or calculate a particular assembly attribute, it can be computationally expensive. However, a single simulation cannot estimate a \emph{distribution} of assembly attributes for a measured detector response. Furthermore, one MCNPX simulation estimates the detector response from a single set of parameters defining a spent fuel assembly and there can be many sets of parameters that produce the same detector response.
To illustrate, we show in Figure \ref{fig:Example} a typical detector response vs.\ assembly attribute. These are the results of simulating one of our instruments using the 64 spent fuel assembly models surrounded by water. The colors in the figure represent the burnup parameter and the marker shape represents the initial enrichment. The difference in cooling time is not explicitly shown, but it is known that the cooling time increases as the assembly attribute decreases. Error bars arising from using a finite number of MCNPX histories are shown in this figure (and in all the figures of this paper) but are smaller than the plot markers. The statistical uncertainty (the standard deviation of the reproducibility of the MCNPX results) in these calculations is approximately 0.2\% relative to the true value. If a measurement was made and the detector gave a response of \num{1.600(8)}, there are no fewer than five assemblies that would give the same detector response and each has a different value for the assembly attribute such as \isotope[235]{U} or elemental \isotope{Pu} mass. As well, there are many additional assemblies not specifically modeled that would have the same detector response, e.g.,\ a spent fuel assembly with \SI{30}{GWd/tU}, \SI{2.5}{wt \% \isotope[235]{U}} initial enrichment, and \SI{5}{yr} cooling time parameters. We see, therefore, the difficulty in using the measured detector response to predict the assembly attribute for an unknown spent fuel assembly.
\begin{figure}[h]\centering
\includegraphics[width=0.75\textwidth, keepaspectratio]{Figures/Plain/PNARH2O}
\caption{Sample data showing detector response scaling with assembly attribute.}
\label{fig:Example}
\end{figure}
This paper reports a Monte Carlo-based method developed to predict certain assembly attributes from a measured detector response. The method relies on explicit modeling of the detector response for a variety of spent fuel assemblies for which the assembly attribute is known or can be estimated in the MCNPX simulation. This Monte Carlo method of estimating assembly attributes from modeled data requires interpolation between the modeled data points and is akin to emulating MCNPX simulations. In Section \ref{sec:MCEstimate} we discuss the emulation of MCNPX simulations and the interpolation between explicitly simulated results. We also introduce the Monte Carlo-based method of estimating the assembly attributes.
We present some numerical results in Section \ref{sec:Simulations} for several of the NDA techniques we have simulated to demonstrate the effectiveness of the Monte Carlo method. Finally in Section \ref{sec:Conclusions} we draw some conclusions and discuss future work.
\section{Code Emulation and Monte Carlo Estimates}\label{sec:MCEstimate}
In each of the instruments being explored as part of the effort to quantify the plutonium content of spent nuclear fuel assemblies, some assembly attribute is desired from some measured detector response. We only have the detector response (e.g., total neutron count) and we must infer some assembly attribute (e.g., fissile content). A one-to-one relationship between the detector response and assembly attribute is ideal as the assembly attribute mean and distribution would be known exactly from the measured detector response and its associated uncertainty.
In dealing with the complexity of spent nuclear fuel, we are not so fortunate as to work with such ideal assemblies. A spent nuclear fuel assembly has myriad of different isotopes, some are fissile and others have large absorption cross sections. Each isotope behaves differently as the assembly parameters change. Nevertheless, it is possible to estimate a mean value and distribution for a particular assembly attribute given a measured detector response. An example of the complexity in the relationship between the detector response and the assembly attribute is shown in Figure \ref{fig:Example}. We can see that there are some general trends in the data with regards to burnup, initial enrichment, and cooling time. However, we do not have a one-to-one relationship between the detector response and the assembly attribute.
\subsection{Interpolation and Code Emulation}\label{sec:InterpolationandEmulation}
The 64 models in our library of spent fuel assembly models span a wide range of burnup, cooling time, and initial enrichment, and encompass most of the spent fuel assemblies expected in spent fuel storage facilities. Despite the broad range of assemblies modeled, it is in no way a complete set of spent nuclear fuel assemblies. Reactor operators are free to operate their reactor and burn their fuel to whatever specifications for which the reactor was designed; they are not limited to \SIlist[list-final-separator={, or }]{15; 30; 45; 60}{GWd/tU}. Similarly, it is unlikely that measurements of a spent fuel assembly will be made at exactly \SIlist[list-final-separator={, or }]{1; 5; 20; 80}{yr} since the assembly was removed from the reactor or that the assembly will initially have had an enrichment of \SIlist[list-final-separator={, or }]{2;3;4;5}{wt \% \isotope[235]{U}}.
Many of the simulations performed in our investigation of the fourteen NDA techniques require more than 200 CPU hours to reduce the level of statistical uncertainty in our calculations to acceptable values. This is in addition to computer time required to create the assembly model. The computational expense of performing such a simulation is too great to be used for every measurement of a spent fuel assembly.
Instead of running MCNPX for every measured spent fuel assembly, the results of the simulations of the 64 spent fuel assembly models can be interpolated to create functions that map assembly parameters (e.g., burnup, initial enrichment, and cooling time) to the detector response and desired assembly attribute. Once mapping functions have been created, through interpolation of existing data, new data can be inferred from the mapping functions.
The idea of using knowledge of a system from previous measurements or simulations with specific parameters to predict a system response at other parameters is not new. In geostatistics this is known as ``kriging''\cite{Krige:1951A-Sta-0,Matheron:1973The-i-0} and has been used for decades. In their paper, \citet{Heitmann:2006Cosmi-0} call this code \emph{emulation} as compared to the explicit \emph{simulation} of the system response. To the best of our knowledge, this is the first time this has been applied to safeguards applications.
We have chosen to use radial basis functions to perform the interpolation between the 64~spent fuel assembly models and the detector response or assembly attribute. The interpolating function is a linear function between the data points. Radial basis functions are well suited for applications\cite{Buhmann:2003Radia-0}
\begin{enumerate}
\item that depend on many variables or parameters,
\item that are defined by possibly very many data, and
\item for which the data are `scattered' in their domain.
\end{enumerate}
We see from Figure \ref{fig:Example} that our data are many, scattered, and depend on many parameters, thus radial basis functions meet the needs for our interpolation. In addition, radial basis functions are capable of performing interpolations in many dimensions.
For our work, two different, three dimensional, mapping functions are needed
\begin{subequations}
\label{eq:Maps}
\begin{align}
D &= M_{D}(B, E, C) \label{eq:Response} \\
P &= M_{P}(B, E, C), \label{eq:Attribute}
\end{align}
\end{subequations}
where $B$, $E$, and $C$ are the burnup, initial enrichment, and cooling time respectively. Together these three parameters define an assembly model, $A$. $M_{D}$ is the mapping function from the assembly model to the detector response, $D$, and $M_{P}$ is the mapping function from the assembly model to the assembly attribute $P$.
\subsection{Monte Carlo Estimate of Assembly Attributes}
With the mapping functions defined, we can estimate the mean and distribution of an assembly attribute via a Monte Carlo-based method given a detector response. Typically the detector response will be measured by an instrument in the field and the assembly attribute must be inferred from the detector response. Since none of our NDA techniques have yet been built, all detector responses in this paper are the results of MCNPX simulations. Regardless of whether the detector response is measured or simulated we refer to it as the \emph{measured} detector response.
The mean assembly attribute can be calculated as
\begin{equation}
\overline{P} = \int_{\Delta B}\int_{\Delta E}\int_{\Delta C} R(D, \mu, \sigma) M_{P}(B, E, C)f(B,E,C) \dd C \dd E \dd B,
\label{eq:AttributeIntegral}
\end{equation}
where $\Delta B$, $\Delta E$, and $\Delta C$ are ranges of possible burnup, initial enrichment, and cooling time for the assembly and $M_{P}$ is the mapping function from assembly parameters to the assembly attribute (Eq. \eqref{eq:Attribute}). $f(B,E,C)$ is a three-dimensional probability density function (PDF) defining the probability of each $B$, $E$, and $C$.
The function $R\left(D,\mu,\sigma\right)$ in Eq. \eqref{eq:AttributeIntegral} is the response function and is defined to be
\begin{equation}
R(D, \mu,\sigma) = e^{-\frac{(D-\mu)^{2}}{2\sigma^{2}}},
\label{eq:ResponseWeight}
\end{equation}
where $\mu, \sigma$ are the measured detector response and its standard deviation, and $D$ comes from Eq. \eqref{eq:Response}. The response is dependent on the assembly parameters, $B$, $E$, and $C$. We can see that the response function ranges from 0, when $D$ is infinitely far away from the measured detector response, $\mu$, to 1 when $D = \mu$. The response function serves to reduce the importance of assemblies with a simulated detector response far from the measured detector response.
To illustrate why we have included the response function we refer again to Figure \ref{fig:Example} and suppose that our measured response is approximately 1.65. This measured response could be produced by an assembly with \SI{45}{GWd/tU} burnup, \SI{5}{wt \% \isotope[235]{U}}, and \SI{80}{yr} cooling time (represented by the lowest blue diamond in Figure \ref{fig:Example}), with an approximate assembly attribute value of 6500. However any of the four assemblies with \SI{15}{GWd/tU} burnup and \SI{3}{wt \% \isotope[235]{U}} (green triangles in Figure \ref{fig:Example}) have a value for the assembly attribute close to 6500. The response function, $R\left(D, \mu,\sigma\right)$, will have to be smaller for the assemblies with \SI{15}{GWd/tU} burnup than the assemblies with \SI{45}{GWd/tU} and its contribution to $\overline{P}$ is reduced.
The multi-dimensional integral in Eq. \eqref{eq:AttributeIntegral} can be estimated using a simple Monte Carlo integration\cite{Lewis:1993Compu-0},
\begin{equation}
\hat{P} \approx \frac{1}{N} \sum_{k=1}^N R(D_{k},\mu,\sigma) M_{P}(B_k, E_k, C_k),
\label{eq:MCAttributeIntegral}
\end{equation}
where $B_{k}$, $E_{k}$, and $C_{k}$ are random samples of burnup, initial enrichment and cooling time that define a randomly sampled spent fuel assembly, $A_{k}$, and $D_{k} = M_{D}(B_{k}, E_{k}, C_{k})$ is the simulated detector response for $A_{k}$. To calculate the distribution, or probability density function, associated with $\hat{P}$, one can simply bin the individually sampled results and their weights and construct a frequency plot of the assembly attribute.
The values for the assembly parameters $B_{k}$, $E_{k}$, and $C_{k}$, are randomly sampled from the PDF $f(B,E,C)$. Without additional knowledge, we assume that these values are equally probable throughout the whole range of possible values; i.e., \SIrange{15}{60}{GWd/tU}, \SIrange{2}{5}{wt \% \isotope[235]{U}}, and \SIrange{1}{80}{yr}. The PDF, $f(B,E,C)$ would be defined as
\begin{equation}
f_{\Pi} = \Pi_{B}\Pi_{E}\Pi_{C},
\label{eq:UniformPDF}
\end{equation}
with $\Pi_{X}$ being the uniform PDF of picking parameter $X$ over its appropriate range;
\begin{subequations}
\label{eq:UniformPi}
\begin{align}
\Pi_{B} &= \frac{1}{60-15}, \\
\Pi_{E} &= \frac{1}{5-2}, \\
\Pi_{C} &= \frac{1}{80-1}.
\end{align}
\end{subequations}
Suppose an independent measurement provided information about burnup i.e., \SI{45.00(225)}{GWd/tU} (5\% uncertainty). Rather than sampling an assembly parameter from the uniform PDFs in Eqs. \eqref{eq:UniformPi}, we can sample from a PDF that uses information about the measured assembly parameter. Independent measurements of the other assembly parameters can also be included. With information about all three assembly parameters from independent measurements, our PDF, $f(B,E,C)$ can be defined as
\begin{equation}
f_{\Lambda} = \Lambda_{B}\Lambda_{E}\Lambda_{C},
\label{eq:GaussianPDF}
\end{equation}
with $\Lambda_{X}$ being the uniform PDF of picking parameter $X$ over its appropriate range;
\begin{subequations}
\label{eq:GaussianLambda}
\begin{align}
\Lambda_{B} &= \frac{1}{\sqrt{2\pi \left(\sigma_{B}\right)^{2}}} e^{-\frac{\left(B-B_{m}\right)^{2}}{2 \left(\sigma_{B}\right)^{2}}}, \\
\Lambda_{E} &= \frac{1}{\sqrt{2\pi \left(\sigma_{E}\right)^{2}}} e^{-\frac{\left(E-E_{m}\right)^{2}}{2 \left(\sigma_{E}\right)^{2}}}, \\
\Lambda_{C} &= \frac{1}{\sqrt{2\pi \left(\sigma_{C}\right)^{2}}} e^{-\frac{\left(C-C_{m}\right)^{2}}{2 \left(\sigma_{C}\right)^{2}}}.
\end{align}
\end{subequations}
In these equations, $B_{m}$, $E_{m}$, and $C_{m}$ are the independent measurements of the burnup, initial enrichment, and cooling time, respectively; $\sigma_{B}$, $\sigma_{E}$, and $\sigma_{C}$ are the associated uncertainties.
The PDFs in Eqs. \eqref{eq:GaussianLambda} are Gaussian, centered at the measured value and the standard deviation equal to the uncertainty in the measured value. When an independent measurement gives a value for one of the assembly parameters, this information is used to reduce the range of values from which to sample the assembly parameter. The PDF from which the assembly parameter is sampled becomes a Gaussian instead of a uniform distribution which arises when no additional knowledge about the assembly parameter is known. We will see later that the reduction in the range of possible values from which we can sample narrows the distribution of assembly attributes thus providing a more precise estimate of the assembly attribute.
The assembly parameters, $B$, $E$, and $C$ are sampled from the PDF $f(B,E,C)$ $N$ times. After each sample, values for $D$, $P$, and $R$ are estimated using Eqs. \eqref{eq:Maps} and \eqref{eq:ResponseWeight}. The results are separated into bins to estimate the distribution of the assembly attribute. Finally, the mean value of all the results is calculated using Eq. \eqref{eq:MCAttributeIntegral}.
\section{Numerical Simulations}\label{sec:Simulations}
Results will be given for using the Monte Carlo-based method described in Section \ref{sec:MCEstimate}, on several of the NDA instruments we are investigating, as listed below. Descriptions of each instrument are beyond the scope of this paper; however, explanations can be found through the references of each instrument.
\begin{itemize}
\item Passive Neutron Albedo Reactivity with Fission Chambers (PNAR-FC)\cite{Conlin:2010Deter-1}
\item Californium-252 Interrogation with Prompt Neutrons (CIPN)\cite{Hu:2010Deter-0}
\item Differential Die-Away (DDA)\cite{Lee:2010Monte-1}
\item Delayed Neutron (DN)\cite{Sandoval:2010The-V-0}
\item Differential Die-Away Self Interrogation (DDSI)\cite{Schear:2010Fissi-0}
\item Self-Interrogation Neutron Resonance Densitometry (SINRD)\cite{LaFleur:2010Devel-0}
\end{itemize}
In the discussion of the Monte Carlo-based method to estimate attributes of a spent fuel assembly, we have intentionally been vague regarding what an assembly attribute is. This was done to illustrate that the Monte Carlo-based method is useful for any assembly attribute and any detector response. Some assembly attributes quantified through simulation of various instruments were given in Section \ref{sec:Introduction}; they are: fissile/fertile ratio, elemental U/Pu ratio, \isotope[235]{Pu}/\isotope[239]{Pu} ratio, and the fissile content. All of the instruments in the above list quantify the fissile content of an assembly except for the SINRD instrument, which quantifies the \isotope[239]{Pu} mass or \isotope[235]{U} mass, primarily from the outer few rows of an assembly.
We now show our results for this Monte Carlo-based method of estimating a mean and distribution for an assembly attribute (e.g.,\ the fissile content) for instruments delineated above. For each instrument, the ``measured'' detector response will be the simulated detector response for a reference assembly with \SI{45}{GWd/tU} burnup, \SI{4}{wt \% \isotope[235]{U}} initial enrichment, and \SI{5}{year} cooling time. For the results given in this paper the uncertainty (the relative random error standard deviation) in the measured response was chosen to be 1.0\% for all instruments. (In practice, each instrument will have a different uncertainty; a single value for the uncertainty was chosen for simplicity and to allow for easy comparison.) The choice to pick the result from this assembly was made in order to have a known value to which we can compare the Monte Carlo estimates. In addition, picking the same assembly for each instrument makes for consistent and simple results across all the instruments. The reference assembly is still used to define the mapping functions from Eqs. \eqref{eq:Maps}. The number of Monte Carlo samples, or random assemblies emulated, is \num{1E5}. The individual results are separated into bins and the frequency plot of the assembly attribute is calculated.
For each instrument, two calculations are performed. The first calculation samples assembly parameters from the full range of values, i.e., \SIrange{15}{60}{GWd/tU}, \SIrange{2}{5}{wt \% \isotope[235]{U}}, and \SIrange{1}{80}{yr}. The second calculation samples assembly parameters from a limited range of values; \SI{45.00(225)}{GWd/tU}, \SI{4.0(2)}{wt \% \isotope[235]{U}}, \SI{5(1)}{yr}. The results of the calculations are shown in Table~\ref{tab:Results}. The ``Simulation'' results are the explicit MCNPX simulations; the ``Full'' and ``Limited'' results are, respectively, those Monte Carlo calculations using either a full or limited range of parameter values as discussed.
\begin{table}[h]\centering
% \begin{multirowtabular}{rSSSSSS}
\begin{tabular}{r@{}S@{}S@{}S@{}S@{}S@{}S}
\toprule
& {PNAR-FC} & {CIPN} & {DDA} & {DN} & {DDSI} & {SINRD} \\
\midrule
Figure & {\ref{fig:PNAR}} & {\ref{fig:CIPN}} & {\ref{fig:DDA}} & {\ref{fig:DN}} & {\ref{fig:DDSI}} & {\ref{fig:SINRD}} \\
\midrule
Simulation & 5535 & 5.76 & 5902 & 149 & 4956 & 2817 \\
Full & 5562(386) & 5.35(34) & 5480(419) & 144.0(77) & 4615(297) & 2687(174) \\
Limited & 5596(177) & 5.75(08) & 5901(105) & 146.0(23) & 4905(77) & 2812(35) \\
\bottomrule
\end{tabular}
\caption{Results of using a Monte Carlo-based estimator of an assembly attribute for six, independent NDA instruments: PNAR-FC, CIPN, DDA, DN, DDSI and SINRD. The Simulation results are the explicit MCNPX simulation results; the Full and Limited results are from the Monte Carlo calculations sampling from a full or limited range of parameter values, respectively. The figure numbers where the results are plotted are also given.}
\label{tab:Results}
\end{table}
We can see that for all the instruments, the estimated mean is well within two standard deviations---and sometimes within one standard deviation---of the explicit MCNPX simulation for the reference assembly. In addition, when sampling from a limited range of assembly parameters the distribution of possible values of the assembly attribute is much narrower than for the simulation with the full sampling range of assembly parameters.
The results for all calculations are plotted in Figures \ref{fig:PNAR}--\ref{fig:SINRD}. For each instrument, two figures are plotted. The figure on the left shows the calculation results from sampling from the full range of assembly parameter values and the figure on the right shows the calculation from sampling from the limited range of assembly parameter values. In both figures, the colored markers represent the MCNPX simulation results for the 64 models in the spent fuel library, and the mean (red line) and distribution (black line) of the assembly attribute are shown.
The distribution of possible assembly attributes is estimated by binning the results into 50 equally spaced bins of the assembly attribute. The black line in the figures is a frequency plot of the assembly attribute as compared with all the calculated assembly attributes. We see that in the full simulations, the distribution is often asymmetric. The asymmetry of the distribution is due to the asymmetry of the explicitly simulated assemblies that provide the data for the interpolation. We can see in Figure \ref{fig:PNARFull}, for example, that the density of the colored markers is greater for smaller values of the assembly attribute, thus we expect a tail of the distribution on the left side of the distribution. In Figure \ref{fig:PNARLimited}, the distribution is more symmetric because the assembly parameters are sampled from a limited range (as explained above).
Figure~\ref{fig:PNAR} shows the results from the PNAR-FC instrument. (This data is the same as in Figure~\ref{fig:Example}.) While not individually distinguishable, the emulated results from the randomly sampled assemblies are plotted with small black markers making a smudge across the figure; the blackness of each point is equal to the weight of the result with a weight of 1 being fully black and a weight of 0 being fully white. The randomly sampled results span a range much larger than the smudge indicates; the other results are simply not visible due to their white color. The individual results are not plotted for the other instruments as they only distract from the information, but they are similar to the individual results of the PNAR-FC calculations.
The Monte Carlo estimation of the mean and distribution of the assembly attribute requires only a few seconds to perform \num{1E5} samples, including calculating the interpolated mapping functions. In contrast, a single MCNPX simulation of one of the spent fuel library models can require more than 200 CPU hours to complete and cannot estimate the distribution of possible values. The difference in the computational expense is ten orders of magnitude and is due to emulating MCNPX simulations using $M_{D}(B,E,C)$ and $M_{P}(B,E,C)$ rather than performing explicit MCNPX simulations.
\begin{figure}[p!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/PNARFull.png} \label{fig:PNARFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/PNARLimited.png} \label{fig:PNARLimited}}
\caption{Results of estimating the assembly attribute measured by the PNAR-FC instrument using the Monte Carlo-based method. The colored markers indicate the simulation results from the 64 spent fuel library models. The black smudge is the emulated results from the randomly sampled assemblies.}
\label{fig:PNAR}
\end{figure}
\begin{figure}[p!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CIPNFull.pdf} \label{fig:CIPNFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CIPNLimited.pdf} \label{fig:CIPNLimited}}
\caption{Results of estimating the assembly attribute measured by the CIPN instrument.}
\label{fig:CIPN}
\end{figure}
\begin{figure}[p!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DDAFull.pdf} \label{fig:DDAFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DDALimited.pdf} \label{fig:DDALimited}}
\caption{Results of estimating the assembly attribute measured by the DDA instrument.}
\label{fig:DDA}
\end{figure}
\begin{figure}[p!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DNFull.pdf} \label{fig:DNFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DNLimited.pdf} \label{fig:DNLimited}}
\caption{Results of estimating the assembly attribute measured by the DN instrument.}
\label{fig:DN}
\end{figure}
\begin{figure}[p!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DDSIFull.pdf} \label{fig:DDSIFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/DDSILimited.pdf} \label{fig:DDSILimited}}
\caption{Results of estimating the assembly attribute measured by the DDSI instrument.}
\label{fig:DDSI}
\end{figure}
The results from the SINRD (Figure \ref{fig:SINRD}) instrument are different than the other instruments because all 64 models from the spent fuel library have not yet been simulated; only those assembly models with a \SI{5}{yr} cooling time have been simulated. Nevertheless the Monte Carlo-based method is still capable of accurately predicting the assembly attribute well within one standard deviation. The asymmetry of the distribution of assembly attributes is due to the asymmetry of the explicitly simulated assemblies that provide the data for the interpolation; i.e.; the \SI{15}{GWd/tU} results (green markers) tend to stretch the distribution to lower values of the assembly parameter. Furthermore, in the limited sampling result (Figure \ref{fig:SINRDLimited}) we see a symmetric distribution of assembly attribute because the \SI{15}{GWd/tU} results are never chosen.
\begin{figure}[h!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/SINRDFull.pdf} \label{fig:SINRDFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/SINRDLimited.pdf} \label{fig:SINRDLimited}}
\caption{Results of estimating the assembly attribute measured by the SINRD instrument.}
\label{fig:SINRD}
\end{figure}
\clearpage
\section{Validation of the Monte Carlo-Based Method}\label{sec:Validation}
We now turn our attention to validating the Monte Carlo-based method described in Section \ref{sec:MCEstimate}. Validating a method is necessary to know the limits of the method as well as ensuring the results are unbiased and accurate. In this section, we will show four different simulations assessing the validity of this Monte Carlo-based method of analysis.
To begin, we repeat the above Monte Carlo estimations without the explicit simulated MCNPX results for the assemblies with \SI{45}{GWd/tU} burnup parameter values. This cross-validation\cite{Hastie:2001The-e-0} assessment shows how accurately the method can predict the assembly attribute for an assembly which has not been explicitly modeled. To perform this check, we repeated the simulation from Section \ref{sec:Simulations} for the PNAR-FC technique, but have excluded the \SI{45}{GWd/tU} results when the mapping functions, $M_{D}$ and $M_{P}$, are defined. By excluding some results from the data which define the mapping functions, we can still define the mapping functions, but we also have data to which we can compare the Monte Carlo simulation results.
The results are shown in Figure \ref{fig:Check}, where in Figure \ref{fig:CheckFull}, a full range of parameter values is used for sampling and in Figure \ref{fig:CheckLimited}, a limited range of parameter values is used. The limited ranges from which the assembly parameters were sampled are the same as before; \SI{45.00(225)}{GWd/tU}, \SI{4.0(2)}{wt \% \isotope[235]{U}}, \SI{5(1)}{yr}. The two figures are directly comparable with Figures \ref{fig:PNARFull} and \ref{fig:PNARLimited}. Note the absence of the blue markers in Figure \ref{fig:Check}, indicating that the simulation results from assemblies with \SI{45}{GWd/tU} burnup were not included in the interpolation. The mean assembly attribute was estimated as \num{5586(359)} for the simulation with full range of parameter sampling and \num{5621(122)} for the simulation with a limited range of parameter sampling. There is no difference graphically or statistically between these results and the simulations that include the \SI{45}{GWd/tU} simulation results giving confidence in the accuracy and usability of this analysis method.
\begin{figure}[hp!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckFull.pdf} \label{fig:CheckFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckLimited.pdf} \label{fig:CheckLimited}}
\caption{Results of estimating the assembly attribute measured by the PNAR-FC instrument without using the MCNPX simulation results for assembly models with \SI{45}{GWd/tU} burnup values.}
\label{fig:Check}
\end{figure}
The second assessment we have attempted is to know how sensitive the Monte Carlo-based method is to a change in the uncertainty in the ``measured'' detector response. Remember we have assumed an uncertainty of 1\%. We have repeated the simulations, but with measured detector uncertainties of 1, 5, and 10\%. The results are summarized in Table \ref{tab:CheckManyUncertainty} and shown graphically in Figure \ref{fig:CheckManyUncertainty}; Figure \ref{fig:CheckManyUncertaintyFull} shows the results when a full range of parameter values are used for sampling and Figure \ref{fig:CheckManyUncertaintyLimited} shows a limited range of sampling values.
\begin{table}[h!]\centering
\begin{tabular}{@{}S@{}S@{}S}
\toprule
{Measured} & {\multirow{2}{*}{Full}} & {\multirow{2}{*}{Limited}} \\
{Uncertainty} & & \\
\midrule
\SI{10}{\percent} & 5265(877) & 5619(260) \\
\SI{5}{\percent} & 5405(652) & 5615(255) \\
\SI{1}{\percent} & 5568(382) & 5597(176) \\
\bottomrule
\end{tabular}
\caption{Results obtained by changing the ``measured'' uncertainty from 10\% to 1\% of the detector response. The underlying data came from the PNAR-FC instrument.}
\label{tab:CheckManyUncertainty}
\end{table}
\begin{figure}[hp!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckManyUncertaintyFull.pdf} \label{fig:CheckManyUncertaintyFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckManyUncertaintyLimited.pdf} \label{fig:CheckManyUncertaintyLimited}}
\caption{Demonstration of the change in assembly attribute distribution with changing measured uncertainty. The measured uncertainty shown is 10\%, 5\%, and 1\%; the 1\% uncertainty is the same as for the previous simulations. The underlying data came from the PNAR-FC instrument.}
\label{fig:CheckManyUncertainty}
\end{figure}
The results show that as the measured uncertainty increases, the uncertainty in the Monte Carlo results increase (as expected) but that the results are all within one standard deviation of each other. This gives confidence that there is no bias introduced when the measured uncertainty increases. Perhaps more interesting is that when independent information is known about the assembly parameters allowing a more limited range of sampling, the measured uncertainty is much less important. Figure \ref{fig:CheckManyUncertaintyLimited} shows that the three simulations have nearly the same result---well within one standard deviation---and that the uncertainty in the assembly attribute is similar regardless of the measured uncertainty.
We now show another set of three simulations where we investigate the sensitivity of the estimated assembly attribute is to the number of Monte Carlo trials. The results of these simulations are given in Table \ref{tab:CheckManyN} and shown in Figure \ref{fig:CheckManyN}. The number of Monte Carlo trials for these simulations ranged from \num{1E2} to \num{1E6}.
\begin{table}[h!]\centering
\begin{tabular}{r@{}S@{}S}
\toprule
{$N$} & {Full} & {Limited} \\
\midrule
\num{1E2} & 5430(752) & 5612(283) \\
\num{1E4} & 5405(645) & 5614(254) \\
\num{1E6} & 5404(651) & 5616(255) \\
\bottomrule
\end{tabular}
\caption{Results obtained by changing the number of Monte Carlo trials, $N$, from \num{1E2} to \num{1E6}. The underlying data came from the PNAR-FC instrument.}
\label{tab:CheckManyN}
\end{table}
\begin{figure}[hp!]\centering
\subfloat[Full parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckManyNFull.pdf} \label{fig:CheckManyNFull}} \qquad
\subfloat[Limited parameter range sampling.]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/CheckManyNLimited.pdf} \label{fig:CheckManyNLimited}}
\caption{Demonstration of the change in assembly attribute distribution with changing measured uncertainty. The measured uncertainty shown is 10\%, 5\%, and 1\%; the 1\% uncertainty is the same as for the previous simulations. The underlying data came from the PNAR-FC instrument.}
\label{fig:CheckManyN}
\end{figure}
It is easy to see in Figure \ref{fig:CheckManyN} that changing the number of Monte Carlo Trials has big effect on the noise of an individual bin of assembly attribute, but that the distribution of the assembly attribute remains the same. Table \ref{tab:CheckManyN} shows that the results of all the simulations are well within one standard deviation of each other indicating once again that no bias is introduced for a different number of Monte Carlo trials. As before, we can see by comparing Figures \ref{fig:CheckManyNFull} and \ref{fig:CheckManyNLimited} that limiting the range of sampled parameter values greatly improves the estimate of the assembly attribute; in this case by reducing the noise of the individual assembly attribute bins in addition to reducing the uncertainty of the assembly attribute distribution.
In all of the simulations shown in this paper, we have chosen to estimate the assembly attribute for a reference assembly with parameters: \SI{45}{GWd/tU} burnup, \SI{4}{wt \% \isotope[235]{U}} initial enrichment, and \SI{5}{year} cooling time. Our final validation assessment looks at the ability of the Monte Carlo-based method to accurately predict the assembly attribute for assemblies with parameters that differ from our reference assembly. It would be impossible to explore all the possible combinations of assembly parameters in this paper so we have limited our assessment to four additional assemblies. These four assemblies all have \SI{4}{wt \% \isotope[235]{U}} initial enrichment and \SI{5}{yr} cooling time; they differ in their burnup with a range of \SIrange{15}{60}{GWd/tU}.
As with all of our simulations in this paper, we have done two simulations for each assembly; one with a full range of parameter values to sample, the other with a limited range of parameters. The results of all the simulations are given in Table \ref{tab:AlternateAssemblies}; the results with the full range of parameter sampling are shown in Figure \ref{fig:AltFull} and the results with the limited range of parameter sampling are shown in Figure \ref{fig:AltLimited}. These results again show the validity of the Monte Carlo-based method for estimating the assembly attribute. With the exception of the assembly with \SI{15}{GWd/tU} burnup, all of the simulations utilizing the full range of parameter sampling fall within one standard deviation of the reference value; the assembly with \SI{15}{GWd/tU} is easily within two standard deviations. All of the simulations utilizing a limited range of parameter sampling are well within the one standard deviation of the reference assembly. Again we see the importance of using information on assembly parameters from independent measurements.
\begin{table}[h!]\centering
\begin{tabular}{rc@{}S@{}S}
\toprule
Burnup & {Simulation} & {Full} & {Limited} \\
\midrule
15 & 8155 & 8407(215) & 8100(183) \\
30 & 6803 & 6407(449) & 6778(192) \\
45 & 5535 & 5567(386) & 5597(177) \\
60 & 4571 & 4898(386) & 4789(170) \\
\bottomrule
\end{tabular}
\caption{Estimated assembly attribute for four reference assemblies. All assemblies have \SI{4}{wt \% \isotope[235]{U}} initial enrichment and \SI{5}{yr} cooling time; they differ in their burnup with a range of \SIrange{15}{60}{GWd/tU}. The underlying data came from the PNAR-FC instrument.}
\label{tab:AlternateAssemblies}
\end{table}
\begin{figure}[hp]\centering
\subfloat[\SI{15}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup15Full.pdf} \label{fig:Alt15GWdFull}} \qquad
\subfloat[\SI{30}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup30Full.pdf} \label{fig:Alt30GWdFull}} \\
\subfloat[\SI{45}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup45Full.pdf} \label{fig:Alt45GWdFull}} \qquad
\subfloat[\SI{60}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup60Full.pdf} \label{fig:Alt60GWdFull}}
\caption{Results from estimating the assembly assembly attribute for an assembly with \SI{4}{wt \% \isotope[235]{U}} initial enrichment and \SI{5}{yr} cooling time and a burnup of \SI{15}{GWd/tU} \subref{fig:Alt15GWdFull}, \SI{30}{GWd/tU} \subref{fig:Alt30GWdFull}, \SI{45}{GWd/tU} \subref{fig:Alt45GWdFull}, \SI{60}{GWd/tU} \subref{fig:Alt60GWdFull}. The sampling range of parameters in the Monte Carlo estimation is the full range of possible assembly parameters. The underlying data comes from the PNAR-FC instrument.}
\label{fig:AltFull}
\end{figure}
\begin{figure}[hp]\centering
\subfloat[\SI{15}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup15Limited.pdf} \label{fig:Alt15GWdLimited}} \qquad
\subfloat[\SI{30}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup30Limited.pdf} \label{fig:Alt30GWdLimited}} \\
\subfloat[\SI{45}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup45Limited.pdf} \label{fig:Alt45GWdLimited}} \qquad
\subfloat[\SI{60}{GWd/tU}]{\includegraphics[width=0.45\textwidth, keepaspectratio]{Figures/AlternateAssemblies/Burnup60Limited.pdf} \label{fig:Alt60GWdLimited}}
% \caption{Limited The underlying data came from the PNAR-FC instrument.}
\caption{Results from estimating the assembly assembly attribute for an assembly with \SI{4}{wt \% \isotope[235]{U}} initial enrichment and \SI{5}{yr} cooling time and a burnup of \SI{15}{GWd/tU} \subref{fig:Alt15GWdFull}, \SI{30}{GWd/tU} \subref{fig:Alt30GWdFull}, \SI{45}{GWd/tU} \subref{fig:Alt45GWdFull}, \SI{60}{GWd/tU} \subref{fig:Alt60GWdFull}. The sampling range of parameters in the Monte Carlo estimation is: \SI{4.0(2)}{wt \% \isotope[235]{U}}, \SI{5(1)}{yr} with the burnup sampled from a gaussian centered at the burnup value (\SIlist[list-final-separator={, or }]{15; 30; 45; 60}{GWd/tU}) with a 5\% standard deviation. The underlying data comes from the PNAR-FC instrument.}
\label{fig:AltLimited}
\end{figure}
The fact that the estimate of the assembly attribute of the assembly with \SI{15}{GWD/tU} burnup falls slightly outside one standard deviation of the reference value is not too surprising. Note that the estimate from the assembly with \SI{60}{GWd/tU} is almost outside one standard deviation. Both of these assemblies lie on the edge of the mapped parameter space and we expect the quality of the mapping to be less certain on the edges of the parameter space. Nevertheless, the Monte Carlo-based technique was able to accurately (within two standard deviations or better) estimate the assembly attribute even at the extremes of the parameter space.
\section{Conclusions}\label{sec:Conclusions}
This paper introduced a Monte Carlo-based method of estimating attributes of spent fuel assemblies, such as the fissile content of the assembly. The method utilizes results from MCNPX simulations of a variety of spent fuel assembly models and interpolates between these results to construct functions that map assembly parameters (e.g., burnup, initial enrichment, and cooling time) to either a detector response or an assembly attribute. We have chosen to use radial basis functions to perform our interpolation since they can interpolate in many dimensions. The use of the mapping functions is a method of emulating MCNPX simulations and reduces the computational expense by ten orders of magnitude.
This analysis was developed to estimate the mean and distribution of values for a specific assembly attribute and is applicable to all of the fourteen NDA instruments we are currently investigating. This Monte Carlo-based method is independent of the detector response and assembly attribute. While all the results from the instruments shown in this paper detect neutrons in some fashion, the quantified assembly attributes include the fissile content of the assembly as well as the \isotope[239]{Pu} mass.
We have demonstrated this method for six different NDA instruments whose responses and assembly attributes were simulated for 64 different spent fuel assembly models. For each instrument, we performed this Monte Carlo-based analysis and compared the result to one of the individually simulated spent fuel assembly model results. Two simulations were performed, one using the full range of possible assembly parameter values and the another with a limited range of assembly parameter values. In both cases, the estimated mean was well within two standard deviations of the original MCNPX simulation and for some instruments, within one standard deviation.
We have made a few additional simulations (in Section \ref{sec:Validation}) to assess the validity and sensitivity of this technique. All of the simulations indicate that the Monte Carlo-based method is appropriate for estimating the assembly attribute of an unknown assembly, based upon a measured detector response. One must be careful when estimating the assembly attribute for assemblies on the periphery of the mapped parameter space.
We would like to emphasize the importance of using independent measurements of the assembly parameters of burnup, initial enrichment, and cooling time. When independent measurements of these parameters are used, the estimate of the assembly attribute is always better (i.e., a smaller uncertainty) compared to when independent measurements are not available. In addition to reducing the uncertainty of the estimated assembly attribute, using independent measurements to estimate the assembly parameters reduces the number of Monte Carlo trials needed, improves the assembly attribute estimate at the periphery of the parameter space, and reduces the dependence on the measured detector response.
The Monte Carlo-based method introduced in this paper is a promising approach for estimating assembly attributes using emulated data based upon results from explicit simulation. In creating the mapping functions we have assumed that the results from explicit MCNPX modeling had no uncertainty. To accurately quantify the uncertainty in the estimated assembly attribute, the uncertainty in the simulations that provide the framework for the mapping functions must be propagated to the uncertainty in the distribution of the assembly attribute.
We intend to use the Monte Carlo-based method to assist measuring the plutonium content in spent nuclear fuel assemblies as part of the NGSI effort. A calibration is needed so that the modeled assemblies match the real-world assemblies. A calibration of this sort would require an assembly with well known parameters. The detector response from the NDA techniques would be calibrated to this known assembly and the modeled assemblies could alter the mapping of assembly attributes and detector responses to make the Monte Carlo-based estimate of the assembly attribute accurate to the specific system being measured. One goal of such a calibration is to allow us to include an MCNPX model-error component of uncertainty, which is currently ignored.
Once the calibration has been performed measurements of the spent fuel assembly would be made with a variety of NDA techniques. Inevitably, the assemblies measured would not have the same parameters as the assemblies which have been explicitly modeled. The Monte Carlo-based method for estimating the assembly attribute would be used and the detector responses would be used as inputs to the method. The estimated assembly attribute from the Monte Carlo-based method would be the best estimate based upon the measured detector response and the independent measurements of the assembly attributes.
\section{Acknowledgements}
This work was performed under the sponsorship of the Next Generation Safeguards Initiative.
The authors would like to thank the following individuals (in no particular order) Dr.~John Lestone at Los Alamos National Laboratory for his idea of using Monte Carlo techniques for this type of analysis. Dr. Tom Burr at Los Alamos National Laboratory for his statistical help. Dr.~Jesse Cheatham at Oak Ridge National Laboratory for his initial investigation into this domain. Dr.~John Hendricks for his comments and suggestions on the Monte Carlo process.
\bibliography{Bibliography}
\end{document}
| {
"alphanum_fraction": 0.7756550617,
"avg_line_length": 140.1636828645,
"ext": "tex",
"hexsha": "90e43d755bb6aef36efd0973e3c097c9fe30e81c",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "bf68f83d22b435af8305b5da071f96aa6b00479b",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "jlconlin/NSEPNAR",
"max_forks_repo_path": "MCPNAR.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bf68f83d22b435af8305b5da071f96aa6b00479b",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "jlconlin/NSEPNAR",
"max_issues_repo_path": "MCPNAR.tex",
"max_line_length": 1501,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "bf68f83d22b435af8305b5da071f96aa6b00479b",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "jlconlin/NSEPNAR",
"max_stars_repo_path": "MCPNAR.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 13399,
"size": 54804
} |
\documentclass[10pt]{memoir}
\usepackage{hott}
\title{Introduction to homotopy type theory}
\author{Egbert Rijke}
\date{2019}%\\Version: \today}
%\address{Carnegie Mellon University}
%\email{[email protected]}
\pretitle{\begin{center}\textsc\bgroup\LARGE}
\posttitle{\egroup\end{center}\vspace{2cm}}
\preauthor{\begin{center}\textsc\bgroup\Large}\postauthor{\egroup\end{center}\vfill}
\predate{\begin{center}\textsc\bgroup}{\postdate{\egroup\end{center}}
% The following is to avoid overfull hboxes in the table of contents.
% https://tex.stackexchange.com/questions/49887/overfull-hbox-warning-for-toc-entries-when-using-memoir-documentclass
%\renewcommand*{\cftdotsep}{1}
\setpnumwidth{2em}
\setrmarg{3em}
\setlength{\cftchapternumwidth}{2em}
\setlength{\cftsectionindent}{2em}
\setlength{\cftsectionnumwidth}{2em}
\setlength{\cftsubsectionindent}{4em}
\setlength{\cftsubsectionnumwidth}{3em}
% We number sections independently of chapters, and subsections will be
% numbered too.
\counterwithout{section}{chapter}
\settocdepth{subsection}
% We set up the exercise environment, which produces list environment in a new
% unnumbered subsection that also gets mentioned in the table of contents.
\newtotcounter{exercisecounter}
\newcommand{\exercise}{\item\stepcounter{exercisecounter}}
\newlist{exenum}{enumerate}{1}
\setlist[exenum]{noitemsep,label=\thesection.\arabic*}
%,ref=\thechapter.\arabic*}
\crefname{exenumi}{Exercise}{Exercises}
\newlist{subexenum}{enumerate}{1}
\setlist[subexenum]{noitemsep,label=(\alph*),ref=\theexenumi.\alph*}
\crefname{subexenumi}{Exercise}{Exercises}
\newenvironment{exercises}
{%
\subsection*{Exercises}%
\addcontentsline{toc}{subsection}{Exercises}%
\sectionmark{Exercises}%
\begin{exenum}}
{%
%\addtocounter{exercisecounter}{\theexenumi}%
\end{exenum}}
%\makeatletter
%\AtEndDocument{\write\@auxout{\protect\total@exercises{\arabic{exercisecounter}}}}
%\def\total@exercises#1{\global\def\totalexercises{#1}}
%\total@exercises{0}
%\makeatother
\addbibresource{bibliography.bib}
\makeindex
\begin{document}
\begin{titlingpage}
\maketitle
\end{titlingpage}
\mbox{}
\vfill
Total number of exercises: \total{exercisecounter}
\bigskip
The author gratefully acknowledges the support of the Air Force Office of Scientific Research through MURI grant FA9550-15-1-0053.
\bigskip
\doclicenseThis\thispagestyle{empty}
\cleardoublepage
\frontmatter
\tableofcontents
%\include{intro}
\begin{comment}
\chapter{Introduction}
To include introduction:
\begin{enumerate}
\item What are types in mathematics. Dependent types and dependent functions are everywhere in mathematics.
\item Why univalent foundations. Why should homotopy be in the foundation of mathematics
\item Constructive nature of homotopy type theory. Discuss differences with set theory.
\item What this course is about
\item How to use this book
\item Formal type theory versus informal type theory
\item Mention the formalization
\end{enumerate}
\begin{rmk}
One difference between set theory and type theory is that every well-formed term is specified along with its type and with its context. One way of looking at this is that there are three sorts in type theory: contexts, types, and terms. On the other hand, there is only one sort in set theory: sets. Sets are governed by the elementhood relation: the formula $x\in y$ is a well-formed formula of set theory for any two sets $x$ and $y$. In particular, for a given set $x$, the formula $x\in y$ can be true for many sets $y$, which is very different to the situation in type theory, where every term is assigned a unique type.
Another important difference between set theory and type theory is that set theory is formulated in the language of first order logic, whereas type theory is its own deductive system, not making use of any ambient logic. We will see in the present chapter and in the next few chapters what this deductive system looks like.
\end{rmk}
\end{comment}
\mainmatter
\renewcommand{\thechapter}{\Roman{chapter}}
\setsecnumdepth{subsection}
\chapter{Martin-L\"of's dependent type theory}
In this first chapter we explain what dependent type theory is. We begin with the structural rules of dependent type theory. The important concepts here are contexts, types in context, and terms in context, and the concept of judgmental equality. The structural rules contain rules for substitution and weakening, but they do not yet contain rules for forming new types. The informed reader may recognize that the rules we present are those of Voevodsky's \emph{B-systems}, which are equivalent to Cartmell's \emph{contextual categories}.
\input{dtt}
\input{pi}
\input{nat}
\input{inductive}
\input{identity}
\input{universes-relations}
\chapter{The univalent foundations for mathematics}
In this chapter we study the foundational concepts of univalent mathematics.
The first concept we study is that of equivalences. Equivalent types are the same for all practical purposes. The concept of equivalence generalizes the concept of isomorphism of sets to type theory. As we delve deeper into synthetic homotopy theory, we will see how vast this generalization really is, even though the type theoretic definition is really simple.
The next topic is that of contractible types and maps. Contractible types that are singletons up to homotopy, i.e., types that come equipped with a point so that every (other) point can be identified with it. Contractible maps are maps $f:A\to B$ such that for every $b:B$ the type $\sm{a:A}f(a)=b$ is contractible. We will show that a map is an equivalence if and only if it is a contractible map in this sense.
It is a very important observation that for any $a:A$, the type
\begin{equation*}
\sm{x:A}a=x
\end{equation*}
is contractible. In other words, the total space of the path fibration is contractible. The fundamental theorem of identity types asserts that a type family $B$ over $A$ with $b:B(a)$ has a contractible total space
\begin{equation*}
\sm{x:A}B(x)
\end{equation*}
if and only if $(a=x)\simeq B(x)$ for all $x:A$. The fundamental theorem of identity types helps us characterizing the identity types of virtually any type that we will encounter. Since types are only fully understood if we also have a clear understanding of their identity types, it is one of the core tasks of a homotopy type theorist to characterize identity types and the fundamental theorem is the main tool.
Not all types have very complicated identity types. For example, some types have the property that all their identity types are contractible. Such types have up to homotopy at most one term, so they are in a sense ``proof irrelevant''. The only thing that matters about such types is whether or not we can construct a term. Since this is also the case for propositions in first order logic, we call such types propositions.
At the next level there are types of which the identity types are propositions. In other words, the identity types of such types have the property of proof irrelevance. We are familiar with this situation from set theory, where equality is a proposition, so we call such types sets. One of our first major theorems is that the type of natural numbers is a set in this sense.
It is now clear that there is a hierarchy arising: first we have the contractible types; then we have the propositions, of which the identity types are contractible; after the propositions we have the sets, of which the identity types are propositions. Defining sets to be of truncation level $0$, we define a type to be of truncation level $n+1$ if its identity types are of truncation level $n$.
The hierarchy of truncation level is due to Voevodsky, who recognized the importance of specifying the level which you are working in. Most mathematics, for example, takes place at truncation level $0$, the level of sets. Groups, rings, posets, and so on are all set-level objects. Categories, on the other hand, are objects of truncation level $1$, the level of groupoids. The study of all these objects will be greatly facilitated by the univalence axiom, so we will postpone a detailed discussion of them until then.
We end the chapter with a section on elementary number theory, the way it is done in type theory. Our goal is to show how to prove in type theory that there are infinitely many prime numbers. Here it will be important to show that the ordering and divisilibility are properties, i.e., that the types $m\leq n$ and $d\mid n$ are propositions. Even more so, we will show that these are \emph{decidable} propositions. Type theory is by its very nature a constructive theory, but that doesn't stop us from showing that either $P$ or $\not P$ holds for some specific propositions $P$, like $m\leq n$ or $d\mid n$. One of the goals in the chapter on elementary number theory is to show how this is done, and how it is used.
\input{equivalences}
\input{contractible}
\input{fundamental}
\input{hierarchy}
\input{funext}
\input{univalence}
\input{propositional-truncation}
\input{image}
\chapter{Topics in univalent mathematics}\label{chap:univalent-mathematics}
\input{number-theory}
\input{sets}
\input{groups}
\input{circle}
\input{circle-fundamental-cover}
\input{classifying}
\chapter{Concepts of higher category theory in type theory}
\input{pullback}
\input{pushout}
\input{cubical}
\input{descent}
\input{id-pushout}
\input{projective}
\input{sequences}
\chapter{Synthetic homotopy theory}
\input{homotopy-groups}
\input{hopf}
\input{truncation}
\input{connected}
\input{blakers-massey}
\input{higher-group-theory}
\backmatter
\appendix
\input{axioms}
\printbibliography
\printindex
\end{document}
| {
"alphanum_fraction": 0.782770375,
"avg_line_length": 47.9257425743,
"ext": "tex",
"hexsha": "32f4db87f7a27941f3ff829cc926a7eae63474bc",
"lang": "TeX",
"max_forks_count": 30,
"max_forks_repo_forks_event_max_datetime": "2022-03-16T00:33:50.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-09-26T09:08:57.000Z",
"max_forks_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "hemangandhi/HoTT-Intro",
"max_forks_repo_path": "Book/hott-intro.tex",
"max_issues_count": 8,
"max_issues_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_issues_repo_issues_event_max_datetime": "2020-10-16T15:27:01.000Z",
"max_issues_repo_issues_event_min_datetime": "2019-06-18T04:16:04.000Z",
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "hemangandhi/HoTT-Intro",
"max_issues_repo_path": "Book/hott-intro.tex",
"max_line_length": 717,
"max_stars_count": 333,
"max_stars_repo_head_hexsha": "09c710bf9c31ba88be144cc950bd7bc19c22a934",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "hemangandhi/HoTT-Intro",
"max_stars_repo_path": "Book/hott-intro.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-22T23:50:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-09-26T08:33:30.000Z",
"num_tokens": 2484,
"size": 9681
} |
\section{Experiment}
\label{sec:exp}
We conducted extensive experiments to evaluate the performance of HINGCN.
This section summarizes our results.
We compare the various methods using three popular measures,
namely, \emph{accuracy}, \emph{micro-F1}, and \emph{macro-F1}.
These measures evaluate clustering quality and their values range from 0 to 1,
with a larger value indicating a better
clustering quality.
%We first describe the performance measures (Section~\ref{sec:measures}) and
%existing methods against which ROSC is compared (Section~\ref{sec:algo-comp}).
%We then show the performance results on both real and synthetic datasets (Section~\ref{sec:results}).
%We illustrate the grouping effect of matrix $\tilde{Z}$ (Section~\ref{}).
%Finally, we conduct a parameter sensitivity study of ROSC (Section~\ref{}).
\subsection{Datasets}
We use three datasets, namely DBLP \footnote{https://dblp.uni-trier.de/}, Yelp\footnote{https://www.yelp.com/academic{\_}dataset/} and Freebase \footnote{https://www.freebase.com/}. A summary of statistics of the datasets are shown in table \ref{tab:dataset}.
% Please add the following required packages to your document preamble:
% \usepackage{multirow}
\begin{table*}[!htbp]
\centering
\caption{Statistics of the datasets}
\label{tab:dataset}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
Dataset & Relations & Number of A & Number of B & Number o A-B & Feature & Number of target nodes & Meta-paths \\ \hline
\multirow{3}{*}{DBLP} & \multirow{2}{*}{Paper-Author} & \multirow{2}{*}{14328} & \multirow{2}{*}{4057} & \multirow{2}{*}{} & \multirow{3}{*}{8789} & \multirow{3}{*}{4057} & APA \\ \cline{8-8}
& & & & & & & APAPA \\ \cline{2-5} \cline{8-8}
& Paper-Conf & 14328 & 20 & & & & APCPA \\ \hline
\multirow{3}{*}{Yelp} & Business-Review & 2614 & 33360 & & \multirow{3}{*}{} & \multirow{3}{*}{} & - \\ \cline{2-5} \cline{8-8}
& Review-Keyword & 33360 & 82 & & & & BRKRB \\ \cline{2-5} \cline{8-8}
& Review-User & 33360 & 1286 & & & & BRURB \\ \hline
\multirow{3}{*}{Freebase} & Movie-Actor & 1465 & 4019 & & \multirow{3}{*}{} & \multirow{3}{*}{} & MAM \\ \cline{2-5} \cline{8-8}
& Movie-Director & 1465 & 1093 & & & & MDM \\ \cline{2-5} \cline{8-8}
& Movie-Writer & 1465 & 1458 & & & & MWM \\ \hline
\end{tabular}
\end{table*}
\noindent{\small$\bullet$}
\textbf{DBLP }: We extract a subset of DBLP which contains 4057 authors ($A$), 14328 papers ($P$) and 20 conferences ($C$). Authors are classified into four areas: \textit{database}, \textit{data mining}, \textit{machine learning}, \textit{information retrieval}. In addition, 8789 keyword terms are assigned to each author as feature, following tf-idf transformation.
Links include A-P ( author publishes a paper) and P-C (paper published at a conference).
We consider meta-paths $\{APA,APAPA,APCPA\}$ for experiments. The task of semi-supervised classification is to predict which area of research an author is focusing on.
We obtained the ground truth from the dataset dblp-4area \cite{SunYH09}, which
labels each author by his/her primary research area.
\noindent{\small$\bullet$}
\textbf{Yelp-Restaurant}: We extracted information related to restaurant businesses in YELP. From extracted information, we constructed a dataset which contains 2614 business objects ($B$); 33360 review objects ($R$); 1286 user objects ($U$) and 82 food relevant keyword objects ($K$).
Restaurant businesses falls into three categories: "Fast Food", "Sushi Bars" and "American (New) Food".
Each business object is associated with 3 categorical attributes which includes reservation (whether reservation is required), service (waiter service or self service) and parking; as well as 1 numerical attribute: review count; and 1 ordinal attribute: quality star.
Links include B-R (business receives a review), U-R (user writes a review), K-R (keyword included in a review). We consider the meta-path set $\{BRURB, BRKRB\}$. The semi-supervised classification task is to classify business objects by state. We use the class information provided in the dataset as the ground truth.
\noindent{\small$\bullet$}
\textbf{Freebase-Movie}: We extract a subset of Freebase movie data which contains ? movies ($M$); ? actors ($A$); ? directors ($D$) and ? writers ($W$). The movies are divided into three classes: \textit{Action}, \textit{Comedy} and \textit{Drama}.
%Each movie has a 5-dimensional meta-data as feature.
No attribute is provided with movies.
Links include M-A (movie and its actor), M-D (movie and its director), M-W (movie and its writer).
We consider meta-paths $\{MAM,MDM,MWM\}$ for experiments. The task of semi-supervised classification is to predict the class of movies. We use the class information provided in the dataset as the ground truth.
\comment{
\subsection{Measures}
\label{sec:measures}
We use three popular measures, namely, \emph{purity}, \emph{adjusted mutual information (AMI)}, and \emph{rand index (RI)}, to evaluate clustering quality~\cite{vinh2010information,lin2010power}.
Consider a clustering $\mathcal{C} = \{C_1, \ldots, C_k\}$ produced by a clustering algorithm
and a gold standard (true) clustering
$\mathcal{C}_t = \{ \hat{C}_1, \ldots, \hat{C}_k\}$.
For each cluster $C_i \in \mathcal{C}$, we find the cluster $\hat{C}_j \in \mathcal{C}_t$ that overlaps
with $C_i$ the most.
The purity of cluster $C_i$ is the fraction of objects in $C_i$ that fall in the overlap, i.e.,
($\max_j |C_i \cap \hat{C}_j|) / |C_i|$.
The purity of a clustering $\mathcal{C}$ is the average of its clusters' purities, weighted by the cluster sizes:
\begin{equation}
purity(\mathcal{C}_t,\mathcal{C}) = \frac{1}{n}\sum_{i}\max_{j}|C_i \cap \hat C_j|.
\end{equation}
The adjusted mutual information ({\it AMI}) is mutual information with the agreement due to chance between clusterings corrected, and
is given by,
\begin{equation}
\mathit{AMI}(\mathcal{C}_t,\mathcal{C}) = \frac{MI(\mathcal{C}_t,\mathcal{C}) - E\{MI(\mathcal{C}_t,\mathcal{C})\}}{\max\{H(\mathcal{C}_t),H(\mathcal{C})\} - E\{MI(\mathcal{C}_t,\mathcal{C})\}},
\end{equation}
where $MI(\mathcal{C}_t,\mathcal{C})$ is the mutual information between $\mathcal{C}_t$ and $\mathcal{C}$,
$H(\mathcal{C}_t)$ and $H(\mathcal{C})$ are the entropies of $\mathcal{C}_t$ and $\mathcal{C}$, respectively,
and $E\{MI(\mathcal{C}_t,\mathcal{C})\}$ is the expected mutual information between the two clusterings
$\mathcal{C}_t$ and $\mathcal{C}$.
Rand index ({\it RI}) considers object pairs in measuring clustering quality. It is defined as:
\begin{equation}
RI(\mathcal{C}_t,\mathcal{C}) = (N_{00} + N_{11}) / {\tbinom n2},
\end{equation}
where $N_{00}$ is the number of object pairs that are put into the same cluster in $\mathcal{C}_t$
as well as in the same cluster in $\mathcal{C}$, and
$N_{11}$ is the number of object pairs that are put into different clusters in
$\mathcal{C}_t$ and also in different clusters in $\mathcal{C}$.
Note that values of all three measures range from 0 to 1, with a larger value indicating a better
clustering quality.
}
\subsection{Algorithms for comparison}
\label{sec:algo-comp}
We evaluate HINGCN and 9 other methods. To demonstrate effectiveness of our edge update mechanism and meta-path GLU layer, we also includes two variants of HINGCN.
\noindent{\small$\bullet$}
\textbf{Node2vec\cite{GroverL16}}: A random walk based homogeneous graph embedding method. Here we ignore the heterogeneity of nodes and perform node2vec on the whole heterogeneous graph. The prediction is generated by feeding embeddings to a logistics classifier.
\noindent{\small$\bullet$}
\textbf{Metpath2vec\cite{DongCS17}}: A random walk based heterogeneous graph embedding method. The algorithm performs meta-path specific random walks and generates embeddings for each meta-path. The prediction is generated by feeding embeddings to a logistics classifier. We test all meta-paths and report the best performance.
\noindent{\small$\bullet$}
\textbf{GCN\cite{KipfW17}}: A semi-supervised graph convolution network that is designed for homogeneous graphs. Here we ignore the heterogeneity of nodes and perform GCN on the whole heterogeneous graph.
\noindent{\small$\bullet$}
\textbf{GAT\cite{VelickovicCCRLB18}}: A semi-supervised graph neural network that utilizes attention mechanism on homogeneous graphs. Here we ignore the heterogeneity of nodes and perform GAT on the whole heterogeneous graph.
\noindent{\small$\bullet$}
\textbf{HAN\cite{WangJSWYCY19}}:
A hierarchical semi-supervised graph neural network on heterogeneous graphs. HAN employs node-level attention and meta-path level aggregation to capture node-level and semantic-level heterogeneity.
\noindent{\small$\bullet$}
\textbf{HINGCN$_{ne}$}:
A variant of HINGCN which removes edge feature in the update process of node embeddings.
\noindent{\small$\bullet$}
\textbf{HINGCN$_{nu}$}:
A variant of HINGCN which replace update of edge embedding by identity propagation.
\noindent{\small$\bullet$}
\textbf{HINGCN$_{at}$}:
A variant of HINGCN which uses attention mechanism for meta-path level aggregation.
\noindent{\small$\bullet$}
\textbf{HINGCN}:
The proposed semi-supervised classification method based on heterogeneous graph convolution networks.
\subsection{Experiment setup}
\label{sec:setup}
We implement HINGCN using PyTorch. We use the same learning rate 0.001 for all HINGCN variants. The models are trained with two NVIDIA 1080Ti GPUs using data parallelism. The batch size is 1024 for each GPU. We stack two graph aggregators, and each aggregator samples 16 neighbors for both training and testing. Each aggregator is then followed by a ReLU activation layer and a dropout layer with dropout rate 0.5. Output dimension of the layers are set to 64 and 32 respectively. For dataset without node features, we encode a 1-hot matrix as input feature. As mentioned in section \ref{sec:edge}, we ensemble edge feature from pre-trained path-sim and node embeddings. These node embeddings are trained using metapath2vec \citep{DongCS17} with default parameters on the same graph and corresponding meta-paths.
%code release
To make our experiment results repeatable, we release our datasets and implementation on Github with an anonymous account\footnote{http://github.com/TODO}.
%Baseline settings
For all baseline methods, we employ exactly the same training set, validation set and test sets for fairness. For GCNNs including GCN, GAT and HAN, we tune hyper-parameters of baseline methods on validation sets. For unsupervised random walk methods including Node2vec and Metapath2vec, we train the embedding using the whole graph, but only send training set embeddings to downstream logistics classifier. For these random walk methods, we set window size to 5, walk length to 100, walks per node to 1000, the number of negative samples to 5.
For each experiment setting, we set 10 different random seed for dataset partition and report the average statistics.
\subsection{Performance results}
\label{sec:results}
Here we present the experiment result of applying all \dan{10?} methods on \textsc{DBLP},\textsc{Yelp} and \textsc{Freebase}. We report the averaged \textit{Macro-F1} and \textit{Micro-F1} on Tab.~\ref{tab:result}.
As is shown in Tab.~\ref{tab:result}, HINGCN generally achieves the best results on all datasets.
Surprisingly, although Metapath2vec was proposed for heterogeneous graphs, it cannot produce a better result than methods designed for homogeneous graphs. One possible reason is that during training process, only part of semantic (i.e. single meta-path) is considered. ESim, however, considers multiple meta-paths at the same time and gives a better result than Node2vec. Graph neural network methods utilize both graph structure information and node feature information, and generally perform best. Among these GCNN methods, we can see that highly engineered neural structures tailored for heterogeneous graph, e.g. HAN and HINGCN, usually perform better. Compared to GCN and GAT, HAN considers hierarchical semantic relationship instead of entire neighborhood of nodes in heterogeneous graphs. And HINGCN further includes edge features that are excluded from HAN model. Also, without edge features (HINGCN$_{ne}$) or without edge updates (HINGCN$_{ne}$), the performance is worse than HINGCN, indicating the effectiveness of proposed architecture. A comparison between HINGCN$_{at}$ and HINGCN suggest that GLU is indeed a better choice for meta-path level aggregation as suggested in section \ref{sec:mp_aggr}.
%Results
\begin{table*}[!htbp]
\centering
%\resizebox{0.9\linewidth}{!}
\caption{Quantitative results (\%) on semi-supervised classification task}
\label{tab:result}
\begin{tabular}{|c|c|c||c|c|c|c|c||c|c|c|c|}
\hline
Datasets & Metrics & Training & Node2vec & Metapath2vec & GCN & GAT & HAN & HINGCN$_{ne}$ & HINGCN$_{nu}$ & HINGCN$_{at}$ & HINGCN \\ \hline
\multirow{8}{*}{DBLP} & \multirow{4}{*}{Macro-F1} & 10\% & 92.62 & 92.75 & & & & & & & \\
& & 20\% & 93.15 & 93.20 & & & & & & & \\
& & 30\% & 93.35 & 93.42 & & & & & & & \\
& & 40\% & 93.35 & 94.79 & & & & & & & \\ \cline{2-12}
& \multirow{4}{*}{Micro-F1} & 10\% & 93.10 & 93.23 & & & & & & & \\
& & 20\% & 93.60 & 93.65 & & & & & & & \\
& & 30\% & 93.79 & 93.89 & & & & & & & \\
& & 40\% & 93.67 & 93.82 & & & & & & & \\ \hline
\multirow{8}{*}{Yelp} & \multirow{4}{*}{Macro-F1} & 10\% & 89.24 & 90.59 & & & & & & & \\
& & 20\% & 91.57 & 91.08 & & & & & & & \\
& & 30\% & 91.17 & 93.07 & & & & & & & \\
& & 40\% & 90.70 & 93.07 & & & & & & & \\ \cline{2-12}
& \multirow{4}{*}{Micro-F1} & 10\% & 87.76 & 89.48 & & & & & & & \\
& & 20\% & 90.25 & 90.06 & & & & & & & \\
& & 30\% & 89.87 & 92.16 & & & & & & & \\
& & 40\% & 89.29 & 92.16 & & & & & & & \\ \hline
\multirow{8}{*}{Freebase} & \multirow{4}{*}{Macro-F1} & 10\% & & 64.68 & & & & & & & \\
& & 20\% & & 66.10 & & & & & & & \\
& & 30\% & & 65.66 & & & & & & & \\
& & 40\% & & 65.35 & & & & & & & \\ \cline{2-12}
& \multirow{4}{*}{Micro-F1} & 10\% & & 70.53 & & & & & & & \\
& & 20\% & & 72.10 & & & & & & & \\
& & 30\% & & 72.39 & & & & & & & \\
& & 40\% & & 72.25 & & & & & & & \\ \hline
\end{tabular}
\end{table*}
\subsection{Analysis of HINGCN layers}
We provide a detailed analysis of each component layer of HINGCN model.
\textbf{Analysis of edge feature.}
As mentioned in section \ref{sec:edge}, before training of HINGCN, we fuse edge features as supplementary information. To justify its effectiveness, we make a variant of HINGCN by removing edge feature in the update process in Eq.~\ref{eq:key}. We name this variant as HINGCN$_{ne}$. From Fig.~\ref{tab:result}, we can see that compared to HINGCN, removal of edge feature results in a severe degradation of performance. This experiment result confirms our claim.
\textbf{Analysis of effect of updating edge.}
\textbf{Analysis of different meta-path aggregation units.}
\subsection{Sensitivity Experiments of Hyper-parameters}
In this section, we investigate the sensitivity of hyper-parameters. We vary concerned parameters and compare against default settings described in Sec.~\ref{sec:setup}
%\textbf{Learning rate.}We first analysis the effect of changing learning rate.
\textbf{Dimension of edge feature.}We first analysis the effect of changing edge dimension in pre-processing. We use experiment to see whether HINGCN is sensitive to input feature dimensions. The result is shown in Fig.~\ref{??}.
%In principle, edge feature is learned from graph structures, independent of vertex feature. Intuitively, different edge feature dimension may impose different significance in attention calculation and therefore affect model performance. On the other hand, however, the 2 layer MLP in Eq.~\ref{eq:key} may be capable address this difference.
\textbf{Number of sampled neighbors.}
\textbf{Number of node update layers.} In HINGCN, we adopt an alternative update scheme of node and edge embeddings. We would like to see if stacking more update layers would cause degradation of performance. The performance of HINGCN variants with or withour jumping connections is shown in Fig.~\ref{fig:??}.
| {
"alphanum_fraction": 0.5936595031,
"avg_line_length": 91.5488372093,
"ext": "tex",
"hexsha": "880883d82c87e60d315b9d30d218580d14eff45f",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "281b73c03bd3b00e35bce4c5e1c27076233555e4",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "dingdanhao110/HINGCN",
"max_forks_repo_path": "paper/HINGCN/tex/experiment.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "281b73c03bd3b00e35bce4c5e1c27076233555e4",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "dingdanhao110/HINGCN",
"max_issues_repo_path": "paper/HINGCN/tex/experiment.tex",
"max_line_length": 1214,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "281b73c03bd3b00e35bce4c5e1c27076233555e4",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "dingdanhao110/HINGCN",
"max_stars_repo_path": "paper/HINGCN/tex/experiment.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 5099,
"size": 19683
} |
\subsection{VIPUR approach}
Variant interpretation using Rosetta (VIPUR) is a machine learning approach for predicting deleteriousness of proteins (loss of function) and uses sequential and structural information.
To train it the VIPUR training set (VTS) was made which contained sequential an structural features from protein structures that were acquired from Modbase \cite{pieper_modbase_2009} and
% modbase, a database of annotated comparative protein structure models and associated resources, pieper
SWISS-MODEL \cite{guex_automated_2009,bertoni_modeling_2017,benkert_toward_2011,bienert_swiss-model_2017,waterhouse_swiss-model:_2018}.
% Automated comparative protein structure modeling with SWISS-MODEL and Swiss-PdbViewer: A historical perspective, Guex
% Modeling protein quaternary structure of homo- and hetero-oligomers beyond binary interactions by homology, Bertoni
% Toward the estimation of the absolute quality of individual protein structure models, Benkert
% The SWISS-MODEL Repository—new features and functionality, Bienert
% SWISS-MODEL: homology modelling of protein structures and complexes, Waterhouse
Proteins that did not have a structure in modbase or SWISS-MODEL were modeled with Modeller (Section \ref{subsec:MM_Modeller}) from proteins that had the highest amino acid sequence identity to the desired protein.
based on protein fragments that had the highest amino acid sequence identity to the protein
Some structures from the databases had: duplicate chains, ligands, metals and non-standard amino acids which were removed to avoid inconsistencies for the generated features by tools.
For all proteins a mutation file was made that described which and how many residues had to be mutated, with this file DDG monomer (Section \ref{subsubsec:MM_DDG_Monomer}) could determine changes in the protein structure, most results by ddg were used as features.
Structural mutations of proteins that are in the VTS were introduced by a script using PyMOL (Section \ref{subsec:MM_PyMOL}) by default or PyRosetta (Section \ref{subsec:MM_PyRosetta}) when PyMOL was not available.
After a mutation the structure was optimized by the relax application (Section \ref{subsubsec:MM_Relax}) that produced 50 structures of a single variant, for each of these structures property scores where available of which all quartiles have been used as a machine learning feature.
of which the quartiles are used as a learning feature. Probe (Section \ref{subsec:MM_Probe}) calculated the solvent accessible surface area (SASA/ACCP) of a protein in square {\AA}ngstrom ({\AA}$^2$) which was used as a structural machine learning feature.
The sequence features of VIPUR were produced by PSI-blast (Section \ref{subsec:MM_PSI_BLAST}) on non mutated sequences and blasted against the NCBI protein database (nr) which resulted in a position specific scoring matrix (PSSM).
From the PSSM scores of the information content, non-mutated, mutated, the difference in scores between non-mutated and mutated and the difference between groups \cite{baugh_robust_2016, poultney_rational_2011} used as sequential feature for VIPUR.
% Robust classification of protein variation using structural modelling and large-scale data integration, Baugh et al.
% Rational Design of Temperature-Sensitive Alleles Using Computational Structure Prediction, Poultney et al.
With 106 features generated by the mentioned tools deleteriousness of a protein variant is determined with sparse logistic regression. The term sparse implies that a limited set of features was used because the weights "shrink" to 0 with regularization \cite{baugh_supplementary:_2016}.
%SUPPLEMENTARY: Robust classification of protein variation using structural modelling and large-scale data integration, Baugh et al.
\label{subsec:MM_VIPUR}
\subsection{VIPUR specific tools}
\subsubsection{PSI-BLAST}
Position specific iterative basic local alignment search tool (PSI-BLAST) focuses on distant relatives of proteins by making a profile of the sequence and querying it at a protein sequence database. With the generated results a new profile is constructed which is queried to the same database as the previous query. These steps are repeated several times to determine which residues are found in distant relatives and results is a position specific scoring matrix (PSSM) that describes the frequency of which residues are substituted by a specific other residue \cite{ncbi_psiblast_nodate,ncbi_pssm_nodate,wikipedia_blast_2019}.
%PSIBLAST, NCBI
%PSSM Viewer, NCBI
%BLAST, Wikipedia
From the PSSMs sequences features were acquired for the VIPUR machine learning method.
\label{subsec:MM_PSI_BLAST}
\newline
\textit{Position-Specific Iterated BLAST 2.7.1+}
\subsubsection{Probe}
Probe is able to evaluate atom packing for a single protein or for interacting proteins. It does this by creating a probe, which is described as a sphere like object, that marks an area with dots when at least two non-covalent atoms are in contact with the probe. \cite{word_visualizing_1999, richardson_lab_probe_nodate}. VIPUR used this tool to calculate solvent accessible surface area (SASA or ACCP).
%Visualizing and quantifying molecular goodness-of-fit: small-probe contact dots with explicit hydrogen atoms11Edited by J. Thornton,Word
%Probe Software : Kinemage Website, Richardson LAB
\label{subsec:MM_Probe}
\newline
\textit{version 2.16.130520}
\subsection{Rosetta}
Rosetta is a software suite that has a variety of tools that are developed to aid in macro molecular and antibody, analysis, design and prediction \cite{rosetta_commons_about_nodate}.
% About | RosettaCommons, Rosetta Commons
However no tools in the suite have been encountered that could introduce missense mutations in the proteins and was done by other software (Sections \ref{subsec:MM_PyMOL}, \ref{subsec:MM_PyRosetta}, \ref{subsec:MM_Modeller}). With the introduced mutations water had to be removed because some tools cannot predict structures well with: water, metals and amino acids that are no part of the standard (20) amino acids \cite{rosetta_commons_how_nodate}.
%How to prepare structures for use in Rosetta, Rosetta commons
Within the tools from Rosetta various scores are assigned to different properties related to bonds, interactions, energies and geometries within structures and are written into a score file.
From all different scoring metrics the Rosetta score, Rosetta energy unit (REU) or total\_score in the score files, can be used to compare models from the same protein with the same tool.
Not only is the score based on energy but also it has statistical terms which influence the score based on known favorable folds from existing structures that reside in the curated Rosetta database \cite{shourya_scoring_nodate}.
In summary to asses models, a lower Rosetta score makes a more natural model.
%Scoring Tutorial, Shourya et al.
\label{subsec:MM_Rosetta}
\newline
\textit{Rosetta software suite Version 3.10}
\subsubsection{Relax}
The Relax application was used by VIPUR and by SPVAA to relax the side chains to minimize energy levels within the local conformational search space \cite{rosetta_commons_relax_nodate} of the structure.
It determines the energy levels with a Monte Carlo method (Section \ref{section:Chap_Monte_Carlo}) and after a certain set of moves it produces a structure and starts anew \cite{conway_relaxation_2014,tyka_alternate_2011}.
%Relax application, Rosetta Commons
%Relaxation of backbone bond geometry improves protein energy landscape modeling, Conway et al.
%Alternate States of Proteins Revealed by Detailed Energy Landscape Mapping, Tyka et al.
\label{subsubsec:MM_Relax}
\subsubsection{DDG Monomer}
DDG monomer is meant to predict energetic stability of a point mutation in monomeric protein.
The application was used by VIPUR to collect features related to energies bonds, bridges and constraints differences between the wild type and a mutated protein.
To execute the tool a script had to be ran which renumbered the wild type pdb file and it required a "mutation file" that described the changes of a residues based on name and position\cite{leaver-fay_ddg_monomer_nodate}.
%ddg_monomer application, Andrew Leaver-Fay
\label{subsubsec:MM_DDG_Monomer}
\subsubsection{Rescore}
With this tool Rosetta scores can be calculated based on PDB files proteins structures \cite{jared_score_2016} , the output is identical to that is written within the score files produced by Relax (Section \ref{subsubsec:MM_Relax}).
%Score Commands, Jared
\label{subsubsec:MM_Rescore}
\subsubsection{Backrub}
The backrub application is based on the Monte Carlo method (Section \ref{section:Chap_Monte_Carlo}), and alters a protein by moving its backbone residues with a strategy called fix end move (FEM).
With this strategy, groups of residues are selected at random from the structure that can contain up to: four dihedral, two bond angles and two end points.
Both ends of a group are fixated at their position in which a new angle $\alpha$ arises, within this angle residues are pivoted in their natural occurring maximum range of $\pm \ang{10}$ \cite{betancourt_efficient_2005, smith_backrub_nodate}.
%Efficient Monte Carlo trial moves for polypeptide simulations, Betancourt
%Backrub application, Smith
With this application backbones of newly introduced mutations were altered, for each attempt a new file was generated and the scores were written to a score file. The lowest Rosetta scoring model was selected to undergo side chain relaxation with the Relax application (Section \ref{subsubsec:MM_Relax}).
\label{subsubsec:MM_Backrub}
\subsection{Structure prediction web services}
\subsubsection{Robetta prediction server}
The web tool Robetta integrates several tools to form protein structures with homology modeling (Section \ref{subsec:GD_Protein_modeling_techniques}).
Its only requirement is an amino acid sequence, but optionally constrains and fragments can be added to disallow movement of certain structures or add known fragments to avoid calculating pieces that are already known. With this information Robetta searches with the help of sequence aligners for known fragments and tries to incorporate them into a single protein structure \cite{song_high-resolution_2013,soding_protein_2005,kallberg_template-based_2012,yang_improving_2011,ovchinnikov_protein_2017}.
%High-Resolution Comparative Modeling with RosettaCM, Song
%Protein homology detection by HMM-HMM comparison, Soding
%Template-based protein structure modeling using the RaptorX web server,Källberg
%Improving protein fold recognition and template-based modeling by employing probabilistic-based matching between predicted one-dimensional structural properties of query and corresponding native properties of templates, Yang
%Protein structure determination using metagenome sequence data,Ovchinnikov
The known fragments of TNFRSF1A (Section \ref{subsec:GD_Protein_modeling_techniques}) were given as a template to Robetta and modeled into a whole protein to make it possible to introduce mutations and predict pathogenicity of a variants.\\
\label{subsec:MM_Robetta}
\textit{http://new.robetta.org/}
\subsubsection{I-TASSER prediction server}
The I-TASSER web server is a tool that is able to predict protein structures with a FASTA sequence. The first step it takes is finding structural templates which resemble the sequence by local meta-threading server (LOMETS).
LOMETS starts with multiple sequence alignment of which several sequences will undergo protein threading by different programs to form structural templates.
The templates are assessed made from: the highest alignment Z-score, a program within LOMETS specific confidence score and sequence identity \cite{zhang_lab_lomets_nodate, wu_lomets:_2007}.
%LOMETS, Zhang LAB
%LOMETS: A local meta-threading-server for protein structure prediction, Wu
The known fragments of TNFRSF1A (Section \ref{subsec:GD_Protein_modeling_techniques}) were given as a template to I-TASSER and modeled into a whole protein to make it possible to introduce mutations and predict pathogenicity of a variants.
\label{subsec:MM_I_TASSER}
\newline
\textit{Server version, https://zhanglab.ccmb.med.umich.edu/I-TASSER/}
\subsubsection{HOPE}
Have yOur Protein Explained (HOPE) is a web service that collects information of about a user specified missense mutation in a protein and comes from various sources. Uniprot (Section \ref{subsec:MM_Uniprot}) is queried with BLAST to find homologous sequences and structures, other features that are found on Uniprot are active sites, domains and various other sequence features that help to identify the function of a region. From the BLAST results homology models are made with Yasara that are sent of to WHAT IF web services that calculate structural information about the protein. Before the formation of a report all information is put into a decision tree to asses mutational effects in context of: contacts, structural locations, non-structural features, previous variant information and amino acid properties. \cite{venselaar_protein_2010,cmbi_hope_nodate,cmbi_hope_nodate-1,cmbi_hope_nodate-2}.
%Protein structure analysis of mutations causing inheritable diseases. An e-Science approach with life scientist friendly interfaces, Venselaar
%HOPE, CMBI
%HOPE about, CMBI
%HOPE methods, CMBI
With this method it is not possible to asses ligands and complexes at once but only a single missense mutation within a protein.
\label{subsec:MM_HOPE}
\textit{Version 1.1.1, https://www3.cmbi.umcn.nl/hope/}
\subsection{Structural modification and visualization software}
\subsubsection{Modeller}
The Modeller software that is developed for homology modeling but it was used for its utilities. Which allowed to complete protein data bank (PDB) structures with missing atoms, predict disulfide bonds that were missing and mutate protein residues \cite{modeller_about_nodate,eswar_comparative_2006,sali_comparative_1993,fiser_modeling_2000}.
%About MODELLER, Modeller
%Comparative Protein Structure Modeling Using Modeller, Eswar
%Comparative Protein Modelling by Satisfaction of Spatial Restraints, Sali
%Modeling of loops in protein structures., Fiser
\label{subsec:MM_Modeller}
\newline
\textit{Version 9.21}
\subsubsection{PyMOL}
Visualization of 3D structures, making images of proteins, putting monomeres in the correct position, replacing TNF $\beta$ structure with a TNF $\alpha$ in the bound structure and aligning the structures to measure the distance between models and X-ray structures were done with PyMOL \cite{schrodinger_pymol_nodate}. PyMOL was in VIPUR used in combination with Python (Section \ref{subsec:MM_Python}) to perform mutagenesis on the protein structures.
% PyMOL | pymol.org, Schrödinger
\label{subsec:MM_PyMOL}
\newline
\textit{Version 2.2.3}
\subsubsection{PyRosetta}
Is an application programming (API) which has Python bindings (Section \ref{subsec:MM_Python}) for the Rosetta software suite (Section \ref{subsec:MM_Rosetta}) and founds its use in VIPUR when no PyMOL (Section \ref{subsec:MM_PyMOL}) was available to mutate residues in a structure \cite{jeffrey_pyrosetta_nodate}.
%PyRosetta, Jeffry
\label{subsec:MM_PyRosetta}
\newline
\textit{Version 4}
\subsection{Amino acid sequence variant tables}
\subsubsection{GAVIN Machine Learning Data Table}
Is a collection of nucleotide mutations from rare diseases used by the GAVIN \cite{van_der_velde_gavin:_2017} machine learning approach. From this set the genes of TNFRSF1A (Section \ref{section:Chap_Cell_Death}) with a missense mutation were filtered (Section \ref{subsec:MM_R}) and written into a format which the variant effect predictor could (VEP) \cite{ensembl_variant_nodate} could read and translate from nucleotide to protein mutations. The classification of the variants was done by experts based on the five tier IARC classification system \cite{plon_sequence_2008}.
%GAVIN: Gene-Aware Variant INterpretation for medical sequencing, Van der Velde
%Variant Effect Predictor - Homo sapiens - GRCh37 Archive browser 96, ensembl
%Sequence variant classification and reporting: recommendations for improving the interpretation of cancer susceptibility genetic test results, Plon
\label{subsec:MM_GAVIN_data_table}
\subsubsection{gnomAD}
The gnomAD database consists of unified data from large scale genome sequencing data projects and is based on genome reference consortium human genome build 37 human genome 19 (GRCh37/hg19). From this database missense mutations were collected for TNFRSF1A (Section \ref{subsec:CD_TNFRSF1A}), no classification was known from these mutations \cite{gnomad_gnomad_nodate}.
%gnomAD,gnomAD
\label{subsec:MM_GnomAD}
\subsubsection{Infevers}
Infevers is a website about auto hereditary inflammatory diseases for which each are tables that contain information about mutations and their classification. The table for TRAPS (Section \ref{subsec:CD_TNFRSF1A}) was used to collect missense mutations of TNFRSF1A gene \cite{sarrauste_de_menthiere_infevers:_2003}.
%INFEVERS: the Registry for FMF and hereditary inflammatory disorders mutations, Sarrauste de Menthière
\label{subsec:MM_Infevers}
\subsection{Protein functional and structural databases}
\subsubsection{Research Collaboratory for Structural Bioinformatics}
Research Collaboratory for Structural Bioinformatics (RCSB) is a database where whole or fragmented experimentally determined proteins structures, that are published, can be found and downloaded. The Fragments for modeling (Sections \ref{subsec:MM_Robetta}, \ref{subsec:MM_I_TASSER}) whole TNFRSF1A (Section \ref{subsec:CD_TNFRSF1A}) (1EXT \cite{naismith_structures_1996}) and determining the differences in energy levels (Section \ref{subsubsec:MM_Relax}) with TNF $\alpha$ -$\beta$ (1TNR \cite{banner_crystal_1993}) with the interaction site were acquired from this database \cite{burley_rcsb_2018}.
%Structures of the extracellular domain of the type I tumor necrosis factor receptor,Naismith
%Crystal structure of the soluble human 55 kd TNF receptor-human TNFβ complex: Implications for TNF receptor activation, Banner
%RCSB Protein Data Bank: Sustaining a living digital data resource that enables breakthroughs in scientific research and biomedical education, Burley
\label{subsec:MM_RCSB}
\subsubsection{Uniprot}
Knowledge from various omic domains about proteins have been linked together into single database called Uniprot which makes all information accessible at once. For TNFRSF1A (Section \ref{section:Chap_Cell_Death}) the FASTA sequences were collected from Uniprot and for structures it redirected to (Section \ref{subsec:MM_RCSB}) \cite{the_uniprot_consortium_uniprot:_2015}.
%UniProt: a hub for protein information,The UniProt Consortium
\label{subsec:MM_Uniprot}
\subsection{Scripting languages}
\subsubsection{Python}
Both VIPUR and the single protein variant analysis approach (SPVAA) were written in Python. SPVAA was written in Python because of its ease of use and the modeller bindings (Section \ref{subsec:MM_Modeller}) that were available.
The mutations that were put together from the different tables (Sections \ref{subsec:MM_GnomAD}, \ref{subsec:MM_Infevers}, \ref{subsec:MM_GAVIN_data_table}) with R (Section \ref{subsec:MM_R}) were filtered by a Python script.
From the mutations a compact list was made by a different script that described the chains that had to be altered by modeller to introduce the appropriate mutation into a PDB file. From these PDB files several were selected to be optimized by pipeline that used backrub (Section \ref{subsubsec:MM_Backrub}) and Relax (Section \ref{subsubsec:MM_Relax} ) to optimize the structure.
\label{subsec:MM_Python}
\newline
\textit{Laptop version 2.7.15}
\newline
\textit{Server version 2.7.11}
\subsubsection{R scripting language}
With R the tables from gnomAD, GAVIN and Infevers (Sections \ref{subsec:MM_GnomAD}, \ref{subsec:MM_GAVIN_data_table}, \ref{subsec:MM_Infevers}) of TNFRSF1A missense mutations (Section \ref{subsec:CD_TNFRSF1A}) were merged together in a new comma seperated values file with their known classifications. Ordering and filtering the double mutations and removing double classifcations where done with Python (Section \ref{subsec:MM_Python}). It has also been used in combination ggplot2 \cite{wickham_create_nodate} and data.table \cite{dowle_rs_2019} to make density plots of all scores acquired from Rosetta Backrub and Relax (See the supplementary for R package versions).
%ggplot Wickham
% data table, Dowl et al
\label{subsec:MM_R}
\newline
\noindent
\textit{R scripting front-end version 3.5.2 (2018-12-20)}
\subsection{Utility software}
\subsubsection{Bash}
Unix like operating systems (OS) have a shell which allows users to interact with programs on a computer or with the computer itself based on commands submitted. The default shell for MacOS and also for several Linux distributions is the Bourne again shell (Bash) which was used to launch Python scripts (Section \ref{subsec:MM_Python}) and submit jobs to the SLURM workload manager (Section \ref{subsec:MM_SLURM}).
\label{subsec:MM_Bash}
\newline
\textit{Laptop Version GNU bash, version 3.2.57(1)-release (x86\_64-apple-darwin18)}
\newline
\textit{Server Version GNU bash, version 4.1.2(2)-release (x86\_64-redhat-linux-gnu)}
\subsubsection{SLURM}
For computational jobs where a laptop or desktop does not suffice because due to the lack computational resources a computer cluster could come to aid.
These clusters consist out of several computers that execute resource intensive tasks, to manage these systems as optimal and fair as possible a workload manager like simple Linux utility resource management (SLURM), is installed. Jobs are submitted that request resources for execution and are scheduled on the systems queue.
\label{subsec:MM_SLURM}
\subsubsection{MPI}
Some tools from the Rosetta software suite (Sections \ref{subsec:MM_Rosetta}) have the ability to use multiple central processing unit (CPU) cores from a single computer or from multiple computers. With a message parsing interface (MPI) it is possible for software to communicate between CPU cores on the same and on different computers to exchange information about processes giving the ability to share work between computers and CPUs.
\label{subsec:MM_MPI}
\newline
\textit{OpenMPI/1.8.8-GNU-4.9.3-2.25}
\newline
| {
"alphanum_fraction": 0.8204612497,
"avg_line_length": 97.7030567686,
"ext": "tex",
"hexsha": "4785f4d15066b5dd4b5ad66b1601b51d93fb486e",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2a4451636907e7c54b58c648893b7d92167d1f7e",
"max_forks_repo_licenses": [
"Python-2.0",
"OLDAP-2.7"
],
"max_forks_repo_name": "Sylt-CSI/variant-protein-prediction",
"max_forks_repo_path": "Report/Chapters/Materials_And_Methods.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2a4451636907e7c54b58c648893b7d92167d1f7e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Python-2.0",
"OLDAP-2.7"
],
"max_issues_repo_name": "Sylt-CSI/variant-protein-prediction",
"max_issues_repo_path": "Report/Chapters/Materials_And_Methods.tex",
"max_line_length": 903,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2a4451636907e7c54b58c648893b7d92167d1f7e",
"max_stars_repo_licenses": [
"Python-2.0",
"OLDAP-2.7"
],
"max_stars_repo_name": "Sylt-CSI/variant-protein-prediction",
"max_stars_repo_path": "Report/Chapters/Materials_And_Methods.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 5415,
"size": 22374
} |
\begin{document}
\chapter{Integration}
\section{Reduction Formul\ae}
Integrating using a reduction formula is in essence repeating integration by parts over and over again.\\
We can think of the process of finding a reduction formula for a given integral as a \emph{recursive approach} to integration by parts. By listing all the iterations of $\textstyle\int u\od vx\,dx= uv-\int v\od ux\,dx$, more specifically the $\textstyle\int v\od ux\,dx$ part in terms of $I_n$ where $n$ is the \emph{iterative index}, or the \textit{step number}, if you will.\\
As expected, finding this recursively valid form is not as direct, and thus, the exponent has to be \textit{split} in such a way that trigonometric identities can be used.
\begin{example}
If $I_n = \int \cos^n x \, dx$ show that $I_n = \frac{1}{n} \sin\cos^{n-1}x + \frac{n-1}{n}\cdot I_{n-2}$. Hence find $\int \cos^5x\, dx$.
\end{example}
\begin{align*}
I_n & = \int \cos^n x \, dx \\
& = \int \cos x \cdot \cos^{n-1}x\, dx \\
%&\quad \text{Integrating by parts: }\\
\therefore \quad I_n & = \cos^{n-1}x\sin x + (n-1)\int\cos^{n-2}x\sin^2x\,dx \\
& = \cos^{n-1}x\sin x + (n-1)\int\cos^{n-2}x(1-\cos^2x)\,dx \\
& = \cos^{n-1}x\sin x + (n-1)\int\cos^{n-2}x \, dx \,-\, (n-1)\int\cos^nx\,dx \\
& = \cos^{n-1}x\sin x + (n-1)I_{n-2} - (n-1)I_n \\
I_n + (n-1)I_n & = \cos^{n-1}x\sin x + (n-1)I_{n-2} \\
\implies nI_n & = \cos^{n-1}x\sin x + (n-1)I_{n-2} \\
\implies I_n & = \frac1n\cos^{n-1}x\sin x + \left(\frac{n-1}n\right)I_{n-2} \\
\end{align*}
\begin{align*}
\int \cos^5 x \, dx =\, & I_5 \\
& I_5 = \frac{1}{5} \cos^4x\sin x + \frac45I_3 \\
& I_3 = \frac{1}{5} \cos^4x\sin x + \frac{4}{5}I_1 \\
& I_1 = \int \cos x \, dx = \sin x + k \\
\therefore \quad \int \cos^5 x & = \frac{1}{5}\cos^4x \sin x + \frac{4}{5}\left(\frac{1}{3}\cos^2x\sin x + \frac{2}{3}\left(\sin x + k\right)\right) \\
& =\frac{1}{5}\cos^2x\cdot\sin x + \frac4{15} \cos^2 x \cdot \sin x + \frac{8}{15}\sin x + c \qed
\end{align*}
\hrulefill
\begin{example}
If $I_n = \int \tan^n\theta \, d\theta$, find a reduction formula for $I_n$ and use it to evaluate $\int_0^{\frac\pi4} \tan^6\theta\,d\theta$.
\end{example}
\begin{equation*}
\begin{split}
I_n &= \int \tan^n\theta \, d\theta\\
&= \int \tan^2\theta \tan^{n-2}\theta\, d\theta\\
&= \int (\sec^2\theta - 1) \tan^{n-2}\theta\, d\theta\\
&= \int \sec^2\theta\tan^{n-2}\theta\,d\theta - \int \underbrace{\tan^{n-2}\theta\,d\theta}\\
&= \frac{\tan^{n-1}\theta}{n-1} - \underbrace{I_{n-2}}
\end{split}
\qquad\qquad\qquad
\begin{split}
\int_0^{\frac\pi4}\tan^6\theta\,d\theta &= I_6\bigg|_0^{\frac\pi4}\\
I_6 &= \frac{tan^5\theta}{5} - I_4\\
I_4 &= \frac{\tan^3\theta}{3} - I_2\\
I_2 &= \tan\theta - I_0\\
I_0 &= \int 1 \, d\theta = \theta + k
\end{split}
\end{equation*}
\begin{align*}
\therefore \int_0^\frac\pi4 \tan^6\theta \, d\theta & = \frac{\tan^6\theta}5 - \frac{\tan^3\theta}{3} + \tan\theta - \theta\bigg|_0^\frac\pi4 \\
& = \frac15 - \frac13 + 1 - \frac{\pi}{4} \\
& = \frac{13}{15} - \frac{\pi}{4} \qed
\end{align*}
\hrulefill\newpage
\begin{example}
Establish a reduction formula that could be used to find $\int x^ne^x \, dx$ and use it to find $\int x^4e^4$.
\end{example}
\begin{equation*}
\begin{split}
\text{Let } I_n &= \int x^ne^x \, dx \\
\text{Let } u &= x^n \qquad \od{v}{x} = e^x \\
\od{u}{x} &= nx^{n-1} \qquad v = e^x \\
\therefore \quad I_n &= x^ne^x - n \int x^{n-1}e^x \, dx\qquad\\
&= x^ne^x - n\, I_{n-1}
\end{split}
\begin{split}
&\int x^4e^x = I_4\\
&I_4 = x^4e^x - 4I_3\\
&I_3 = x^3e^x - 3I_2\\
&I_2 = x^2e^x - 2I_1\\
&I_1 = xe^x - I_0\\
&I_0 = e^x + k
\end{split}
\end{equation*}
\begin{align*}
\therefore \quad I_4 & = x^4e^x -4(x^3e^x - 3(x^2e^x - 2(xe^x - e^x + k))) \\
& = x^4e^x -4x^3e^x + 12x^2e^x - 24xe^x + 24e^x + c \qed
\end{align*}
\hrulefill
\begin{example}
Establish a reduction formula which can be used to evaluate $\int x^n \sin x \, dx$.
\end{example}
\begin{align*}
\text{Let } I_n &= \int x^n \cdot \sin x\\
&= -x^n\cos x + \int nx^{n-1}\cos x\,dx\\
&= -x^n\cos x + n\left(x^{n-1}\sin x - \int (n-1)x^{n-2}\sin x\,dx\right)\\
&= -x^n\cos x + n\left(x^{n-1}\sin x - (n-1) \int x^{-2} \cdot x^n\sin x\,dx\right)\\
&= -x^n\cos x + n\left(x^{n-1}\sin x - (n-1) \underbrace{x^{n-2}\sin x\,dx}\right)\\
\therefore \quad I_n &= -x^n\cos x + n\left(x^{n-1}\sin x - (n-1)I_{n-2}\right)\\
&= -x^n\cos x + nx^{n-1}\sin x - n(n-1)I_{n-2} \qed
\end{align*}
\hrulefill\newpage
\begin{example}
Establish a reduction formula to find $\int \csc^nx \, dx$. Hence find $\int csc^5x \, dx$
\end{example}
\begin{align*}
\text{Let } I_n &= \int \csc^nx \, dx\\
&= \int \csc^2x \cdot \csc^{n-2}x \, dx\\
\text{Let } u & = \csc^{x-2} x \qquad \od{v}{x} = \csc^2x \, dx \\
\od{u}{x} & = -(n-2)\csc^{n-2}\cot x v \qquad = -\cot x \\
\therefore \int \csc^nx \, dx &= -\cot x \cdot \csc^{n-2}x - (n-2)\int \csc^{n-2}x\cot^2x \, dx\\
I_n &= -\cot x \cdot \csc^{n-2}x - (n-2)\int \csc^{n-2}x\left(\csc^2x - 1\right) \, dx\\
&= -\cot x \cdot \csc^{n-2}x - (n-2)\int \csc^{n}x\,dx + (n-2)\int\csc^{n-2}xdx\\
&=-\cot x \cdot \csc^{n-2}x - (n-2)\, I_n + (n-2)I_{n-2}\\
I_n + nI_n -2I_n &= -\cot x\cdot \csc^{n-2}x + (n-2)I_{n-2}\\
(n-1)I_n &= -\cot x\cdot \csc^{n-2}x + (n-2)I_{n-2}\\
I_n &= \frac{-1}{n-1}-\cot x\cdot \csc^{n-2}x + \frac{n-2}{n-1}I_{n-2}\\
&= \left(1-\frac{1}{n-1}\right)I_{n-2}-\frac{\cot x\csc^{n-2}x}{n-1}\qed
\end{align*}
\begin{example}
Show that if $I_n - \int_0^\pi x^n\sin x\,dx$, then $I_n = \pi^n - n(n-1)\,I_n-1$. Hence evaluate $\int_0^\pi\sin x\,dx$
\end{example}
\begin{align*}
I_n &=\left[-x^n\cos x\right]_0^\pi + n\int_0^\pi x^{n-1} \cos x \, dx\\
&=\pi^n + n\int_0^\pi x^{n-1} \cos x \, dx\\
&= \pi^n \int_0^\pi \\
\text {Let } u &=
\end{align*}
\begin{example}
Show that, if $I_n = \int_0^1 x^n e^{x^3} \, dx$, then $I_n =\frac{e}{3} - \frac{n-2}{3} \cdot I_{n-3}$
\end{example}
\begin{align*}
I_n &= \int_0^1 x^n e^{x^3} \, dx\\
&= \int_0^1 x^{n-2}x^2e^{x^3} \, dx\\
\therefore \quad I_n &= \left[\frac{x^{n-2}e^{x^3}}3\right]_0^1 - \frac{n-2}3 \int_0^1 x^{n-3}{e^{x^3}} \, dx\\
&= \frac{e}3 - \frac{n-2}3 \cdot I_{n-3}
\end{align*}
\begin{example}
Show that, if $I_n= \int_0^1 x^n(1+x^5)^4 \, dx$, then $I_n = \frac1{n+21} \left[32-(n-4)\cdot I_{n-5}\right]$
\end{example}
\begin{align*}
I_n & = \int_0^1 x^n(1+x^5)^4 \, dx \\
& = x^{n-4}x^4(1+x^5)^4\,dx \\
& =\left[x^{n-4} \frac{(1+x^5)^5}{25}\right]_0^1 - \frac{n-4}{25} \int x^{n-5}(1+x^5)^5\,dx \\
& = \frac{32}{25} -\frac{n-4}{25} \int_0^1x^n-5(1+x^5)(1+x^5)^4\,dx \\
& = \frac{32}{25} - \frac{n-5}{25}\int_0^1x^{n-5}(1+x^5)^4\, dx - \frac{n-4}{25}\int_0^1x^n(1+x^5)^4\, dx \\
& = \frac{32}{25} - \left(\frac{n-4}{25}\right)I_{n-5} - \left(\frac{n-4}{25}\right)I_n \\
25I_n & = 32 - (n-4)I_{n-5} - \left(\frac{n-4}{25}\right)\,I_n \\
25I_n + nI_n - 4I_n & = 32-(n-4)\,I_{n-5}\\
(n+21)I_n &= 32-(n-4)I_{n-5}\\
I_n &= \frac{1}{n+21}\left(32-(n-4)I_{n-5}\right)
\end{align*}
\hrulefill
\newpage
\begin{example}
Given $I_n = \int_0^1 (1+x^2)^{-n}\,dx$, show that $2n\,I_{n+1} = 2^{-n} + (2n-1)\,I_n$
\end{example}
\begin{align*}
I_n & = \int_0^1 (1+x^2)^{-n}\,dx \\
& = \int_0^1 (1+x^2)^{-n}\cdot 1 \,dx \\
\therefore \quad I_n & = -2nx^2(1+x^2)^{-(n+1)}\bigg|_0^1 + 2n \int_0^1x^2(1+x^2)^{-n-1}\,dx \\
& =2^{-n} + 2n\int_0^1(x^2+1-1)(1+x^2)^{-(n+1)}\,dx \\
& =2^{-n} + 2n \int_0^1(1+x^2)^{-2}\,dx - 2n\int_0^1 (1+x^2)^{-(n+1)}\,dx \\
& = 2^{-n} + 2n\,I_n - 2n\,I_{n+1} \\
2n\,I_{n+1} & = 2^{-n} + (2n-1)\,I_n
\end{align*}
\end{document} | {
"alphanum_fraction": 0.4541884817,
"avg_line_length": 52.6896551724,
"ext": "tex",
"hexsha": "138f61f8b7a99c2fe64a3f8b21b6744066ece516",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "706ec7cb4d62af1b5a9ad7547589889240c755bb",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Girogio/My-LaTeX",
"max_forks_repo_path": "Pure Mathematics/Integration.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "706ec7cb4d62af1b5a9ad7547589889240c755bb",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Girogio/My-LaTeX",
"max_issues_repo_path": "Pure Mathematics/Integration.tex",
"max_line_length": 380,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "706ec7cb4d62af1b5a9ad7547589889240c755bb",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Girogio/My-LaTeX",
"max_stars_repo_path": "Pure Mathematics/Integration.tex",
"max_stars_repo_stars_event_max_datetime": "2021-05-30T21:47:25.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-01-12T11:45:45.000Z",
"num_tokens": 4075,
"size": 9168
} |
\chapter{Inference with time series}
| {
"alphanum_fraction": 0.7692307692,
"avg_line_length": 9.75,
"ext": "tex",
"hexsha": "a420b1766906e920314fdb24941201f26265d15a",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "266bfc6865bb8f6b1530499dde3aa6206bb09b93",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "adamdboult/nodeHomePage",
"max_forks_repo_path": "src/pug/theory/statistics/time/00-00-Chapter_name.tex",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "266bfc6865bb8f6b1530499dde3aa6206bb09b93",
"max_issues_repo_issues_event_max_datetime": "2022-01-01T22:16:09.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-03-03T12:36:56.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "adamdboult/nodeHomePage",
"max_issues_repo_path": "src/pug/theory/statistics/time/00-00-Chapter_name.tex",
"max_line_length": 36,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "266bfc6865bb8f6b1530499dde3aa6206bb09b93",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "adamdboult/nodeHomePage",
"max_stars_repo_path": "src/pug/theory/statistics/time/00-00-Chapter_name.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 10,
"size": 39
} |
% Revised version of Part II, Chapter 9 of HOL DESCRIPTION
% Incorporates material from both of chapters 9 and 10 of the old
% version of DESCRIPTION
% Written by Andrew Pitts
% 8 March 1991
% revised August 1991
\chapter{Syntax and Semantics}\label{logic}
\section{Introduction}
\label{introduction}
This chapter describes the syntax and set-theoretic semantics of the
logic supported by the \HOL{} system, which is a variant of
Church's\index{Church, A.} simple theory of types \cite{Church} and
will henceforth be called the \HOL{} logic, or just \HOL. The
meta-language for this description will be English, enhanced with
various mathematical notations and conventions. The object language
of this description is the \HOL{} logic. Note that there is a
`meta-language', in a different sense, associated with the \HOL\
logic, namely the programming language \ML. This is the language used
to manipulate the \HOL{} logic by users of the system. It is hoped
that because of context, no confusion results from these two uses of
the word `meta-language'. When \ML\ is the object of study (as in
\cite{sml}), \ML\ is the object language under consideration---and
English is again the meta-language!
The \HOL{} syntax contains syntactic categories of types and terms whose
elements are intended to denote respectively certain sets and elements
of sets. This set theoretic interpretation will be developed along side
the description of the \HOL{} syntax, and in the next chapter the \HOL\
proof system will be shown to be sound for reasoning about properties
of the set theoretic model.\footnote{There are other, `non-standard'
models of \HOL, which will not concern us here.} This model is given in
terms of a fixed set of sets $\cal U$, which will be called the {\em
universe\/}\index{universe, in semantics of HOL logic@universe, in
semantics of \HOL{} logic} and which is assumed to have the following
properties.
\begin{description}
\item[Inhab] Each element of $\cal U$ is a non-empty set.
\item[Sub] If $X\in{\cal U}$ and $\emptyset\not=Y\subseteq X$, then
$Y\in{\cal U}$.
\item[Prod] If $X\in{\cal U}$ and $Y\in{\cal U}$, then $X\times
Y\in{\cal U}$. The set $X\times Y$ is the cartesian product,
consisting of ordered pairs $(x,y)$ with $x\in X$ and $y\in Y$, with
the usual set-theoretic coding of ordered pairs, \viz\
$(x,y)=\{\{x\},\{x,y\}\}$.
\item[Pow] If $X\in{\cal U}$, then the powerset
$P(X)=\{Y:Y\subseteq X\}$ is also an element of $\cal U$.
\item[Infty] $\cal U$ contains a distinguished infinite set $\inds$.
\item[Choice] There is a distinguished element $\ch\in\prod_{X\in{\cal
U}}X$. The elements of the product $\prod_{X\in{\cal U}}X$ are
(dependently typed) functions: thus for all $X\in{\cal U}$, $X$ is
non-empty by {\bf Inhab} and $\ch(X)\in X$ witnesses this.
\end{description}
There are some consequences of these assumptions which will be needed.
In set theory functions are identified with their graphs, which are
certain sets of ordered pairs. Thus the set $X\fun Y$ of all functions
from a set $X$ to a set $Y$ is a subset of $P(X\times Y)$; and it is a
non-empty set when $Y$ is non-empty. So {\bf Sub}, {\bf Prod} and {\bf
Pow} together imply that $\cal U$ also satisfies
\begin{description}
\item[Fun] If $X\in{\cal U}$ and $Y\in{\cal U}$, then $X\fun Y\in{\cal U}$.
\end{description}
By iterating {\bf Prod}, one has that the cartesian product of any
finite, non-zero number of sets in $\cal U$ is again in $\cal U$.
$\cal U$ also contains the cartesian product of no sets, which is to
say that it contains a one-element set (by virtue of {\bf Sub} applied
to any set in ${\cal U}$---{\bf Infty} guarantees there is one); for
definiteness, a particular one-element set will be singled out.
\begin{description}
\item[Unit] $\cal U$ contains a distinguished one-element set $1=\{0\}$.
\end{description}
Similarly, because of {\bf Sub} and {\bf Infty}, $\cal U$ contains
two-element sets, one of which will be singled out.
\begin{description}
\item[Bool] $\cal U$ contains a distinguished two-element set
$\two=\{0,1\}$.
\end{description}
The above assumptions on $\cal U$ are weaker than those imposed on a
universe of sets by the axioms of
Zermelo-Fraenkel\index{Zermelo-Fraenkel set theory} set theory with the
Axiom of Choice (\theory{ZFC})\index{axiom of choice}\index{ZFC@\ml{ZFC}},
principally because $\cal U$ is not
required to satisfy any form of the Axiom of
Replacement\index{axiom of replacement}.
Indeed, it is possible to prove the existence of a set
$\cal U$ with the above properties from the axioms of \theory{ZFC}.
(For example one could take $\cal U$ to consist of all non-empty sets
in the von~Neumann cumulative hierarchy formed before stage
$\omega+\omega$.) Thus, as with many other pieces of mathematics, it is
possible in principal to give a completely formal version within
\theory{ZFC} set theory of the semantics of the \HOL{} logic to be given
below.
\section{Types}
\label{types}
The types\index{type constraint!in HOL logic@in \HOL{} logic} of the
\HOL{} logic are expressions that denote sets (in the universe $\cal U$).
Following tradition,
$\sigma$, possibly decorated with subscripts or primes, is used to
range over arbitrary types.
There are four kinds of types in the \HOL{} logic. These can be described
informally by the following {\small BNF} grammar,
in which $\alpha$ ranges
over type variables, \textsl{c} ranges over atomic types and \textsl{op} ranges over
type operators.
\newlength{\ttX}
\settowidth{\ttX}{\tt X}
\newcommand{\tyvar}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,0){\makebox(0,0)[b]{\footnotesize type variables}}
\put(0,1.5){\vector(0,1){4.5}}
\end{picture}}
\newcommand{\tyatom}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,2.3){\makebox(0,0)[b]{\footnotesize atomic types}}
\put(.5,3.3){\vector(0,1){2.6}}
\end{picture}}
\newcommand{\funty}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,1.5){\makebox(0,0)[b]{\footnotesize function types}}
\put(.5,0){\makebox(0,0)[b]{\footnotesize (domain $\sigma_1$, range $\sigma_2$)}}
\put(1,2.5){\vector(0,1){3.5}}
\end{picture}}
\newcommand{\cmpty}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(2,3.3){\makebox(0,0)[b]{\footnotesize compound types}}
\put(1.9,4.5){\vector(0,1){1.5}}
\end{picture}}
%
$$\sigma\quad ::=\quad {\mathord{\mathop{\alpha}\limits_{\tyvar}}}
\quad\mid\quad{\mathord{\mathop{c}\limits_{\tyatom}}}
\quad\mid\quad\underbrace{(\sigma_1, \ldots , \sigma_n){op}}_{\cmpty}
\quad\mid\quad\underbrace{\sigma_1\fun\sigma_2}_{\funty}$$
\noindent In more detail, the four kinds of types are as follows.
\begin{enumerate}
\item {\bf Type variables:}\index{type variables, in HOL logic@type variables, in \HOL{} logic!abstract form of} these stand for arbitrary
sets in the universe. In Church's original formulation of simple type
theory, type variables are part of the meta-language and are used to
range over object language types. Proofs containing type variables
were understood as proof schemes (\ie\ families of proofs). To support
such proof schemes {\it within} the \HOL{} logic, type variables have
been added to the object language type system.\footnote{This technique
was invented by Robin Milner for the object logic \PPL\ of his \LCF\
system.}
\item {\bf Atomic types:}\index{atomic types, in HOL logic@atomic types, in \HOL{} logic} these denote fixed sets in the universe. Each
theory determines a particular collection of atomic types. For
example, the standard atomic types \ty{bool} and \ty{ind} denote,
respectively, the distinguished two-element set $\two$ and the
distinguished infinite set $\inds$.
\item {\bf Compound types:}\index{compound types, in HOL logic@compound types, in \HOL{} logic!abstract form of} These have the
form $(\sigma_1,\ldots,\sigma_n)\ty{op}$, where $\sigma_1$, $\dots$,
$\sigma_n$ are the argument types and $op$ is a {\it type operator\/}
of arity $n$. Type operators denote operations for constructing sets.
The type $(\sigma_1,\ldots,\sigma_n)\ty{op}$ denotes the set resulting
from applying the operation denoted by $op$ to the sets denoted by
$\sigma_1$, $\dots$, $\sigma_n$. For example,
\ty{list} is a type operator with arity 1. It denotes the operation
of forming all finite lists of elements from a given set. Another
example is the type operator \ty{prod} of arity 2 which denotes the
cartesian product operation. The type $(\sigma_1,\sigma_2)\ty{prod}$
is written as $\sigma_1\times\sigma_2$.
\item {\bf Function types:}\index{function types, in HOL logic@function types, in \HOL{} logic!abstract form of} If $\sigma_1$
and $\sigma_2$ are types, then $\sigma_1\fun\sigma_2$ is the function
type with {\it domain\/} $\sigma_1$ and {\it range} $\sigma_2$. It
denotes the set of all (total) functions from the set denoted by its
domain to the set denoted by its range. (In the literature
$\sigma_1\fun\sigma_2$ is written without the arrow and
backwards---\ie\ as $\sigma_2\sigma_1$.) Note that syntactically
$\fun$ is simply a distinguished type operator of arity 2 written with
infix notation. It is singled out in the definition of \HOL{} types
because it will always denote the same operation in any
model of a \HOL{} theory---in contrast to the other type operators which
may be interpreted differently in different models. (See
Section~\ref{semantics of types}.)
\end{enumerate}
It turns out to be convenient to identify atomic types with
compound types constructed with $0$-ary type operators. For example,
the atomic type \ty{bool} of truth-values can be regarded as being an
abbreviation for $()\ty{bool}$. This identification will be made in
the technical details that follow, but in the informal presentation
atomic types will continue to be distinguished from compound types,
and $()c$ will still be written as $c$.
\subsection{Type structures}
\label{type structures}
\index{type structure, in HOL logic@type structure, in \HOL{} logic}
The term `type constant' is used to cover both atomic types and type
operators. It is assumed that an infinite set {\sf
TyNames} of the {\em names of type constants\/} is given. The greek
letter $\nu$ is used to range over arbitrary members of {\sf TyNames},
\textsl{c} will continue to be used to range over the names of atomic
types (\ie\ $0$-ary type constants), and \textsl{op} is used to range
over the names of type operators (\ie\ $n$-ary type constants, where
$n>0$).
It is assumed that an infinite set {\sf TyVars} of {\em type
variables\/}\index{type variables, in HOL logic@type variables, in \HOL{} logic}
is given. Greek letters $\alpha,\beta,\ldots$, possibly with
subscripts or primes, are used to range over {\sf Tyvars}. The sets
{\sf TyNames} and {\sf TyVars} are assumed disjoint.
A {\it type structure\/} is a set $\Omega$ of type constants. A {\it
type constant\/}\index{type constants, in HOL logic@type constants, in \HOL{} logic} is a pair $(\nu,n)$ where $\nu\in{\sf TyNames}$ is the
name of the constant and $n$ is its arity. Thus $\Omega\subseteq{\sf
TyNames}\times\natnums$ (where $\natnums$ is the set of natural
numbers). It is assumed that no two distinct type constants have the
same name,
\ie\ whenever $(\nu, n_1)\in\Omega$ and
$(\nu, n_2)\in\Omega$, then $n_1 = n_2$.
The set {\sf Types}$_{\Omega}$ of types over a structure ${\Omega}$
can now be defined as the smallest set such that:
\begin{itemize}
\item {\sf TyVars}$\ \subseteq\ ${\sf Types}$_{\Omega}$.
\item If $(\nu,0)\in\Omega$ then $()\nu\in{\sf Types}_{\Omega}$.
\item If $(\nu,n)\in\Omega$ and $\sigma_i\in{\sf Types}_{\Omega}$ for
$1\leq i\leq n$, then $(\sigma_1,\ \ldots\ ,\sigma_n)\nu\in{\sf
Types}_{\Omega}$.
\item If $\sigma_1\in{\sf Types}_{\Omega}$ and $\sigma_2\in{\sf
Types}_{\Omega}$ then $\sigma_1\fun\sigma_2\in{\sf Types}_{\Omega}$.
\end{itemize}
The type operator $\fun$ is assumed to associate\index{type operators, in HOL logic@type operators, in \HOL{} logic!associativity of} to the
right, so that
\[
\sigma_1\fun\sigma_2\fun\ldots\fun \sigma_n\fun\sigma
\]
abbreviates
\[
\sigma_1\fun(\sigma_2\fun\ldots\fun (\sigma_n\fun\sigma)\ldots)
\]
The notation $tyvars(\sigma)$ is used to denote the set of type
variables occurring in $\sigma$.
\subsection{Semantics of types}
\label{semantics of types}
A {\em model} $M$ of a type structure $\Omega$ is specified by giving
for each type constant $(\nu,n)$ an $n$-ary function
\[
M(\nu):{\cal U}^{n}\longrightarrow{\cal U}
\]
Thus given sets $X_1,\ldots,X_n$ in the universe $\cal U$,
$M(\nu)(X_1,\ldots,X_n)$ is also a set in the universe. In case $n=0$,
this amounts to specifying an element $M(\nu)\in{\cal U}$ for the
atomic type $\nu$.
Types containing no type variables are called {\it monomorphic},
whereas those that do contain type variables are called {\it
polymorphic}\index{polymorphic types, in HOL logic@polymorphic types, in \HOL{} logic}\index{types, in HOL logic@types, in \HOL{} logic!polymorphic}. What is the meaning of a polymorphic type? One can
only say what set a polymorphic type denotes once one has instantiated
its type variables to particular sets. So its overall meaning is not a
single set, but is rather a set-valued function, ${\cal
U}^{n}\longrightarrow{\cal U}$, assigning a set for each particular
assignment of sets to the relevant type variables. The arity $n$
corresponds to the number of type variables involved. It is convenient
in this connection to be able to consider a type variable to be
involved in the semantics of a type $\sigma$ whether or not it
actually occurs in $\sigma$, leading to the notion of a
type-in-context.
A {\em type context}\index{type context}, $\alpha\!s$, is simply a
finite (possibly empty) list of {\em distinct\/} type variables
$\alpha_{1},\ldots,\alpha_{n}$. A {\em
type-in-context\/}\index{type-in-context} is a pair, written
$\alpha\!s.\sigma$, where $\alpha\!s$ is a type context, $\sigma$ is a
type (over some given type structure) and all the type variables
occurring in $\sigma$ appear somewhere in the list $\alpha\!s$. The
list $\alpha\!s$ may also contain type variables which do not occur in
$\sigma$.
For each $\sigma$ there are minimal contexts $\alpha\!s$ for which
$\alpha\!s.\sigma$ is a type-in-context, which only differ by the order
in which the type variables of $\sigma$ are listed in $\alpha\!s$. In
order to select one such context, let us assume that {\sf TyVars}
comes with a fixed total order and define the {\em
canonical}\index{canonical contexts, in HOL logic@canonical contexts, in \HOL{} logic!of types} context of the type $\sigma$ to consist of
exactly the type variables it contains, listed in order.\footnote{It is
possible to work with unordered contexts, specified by finite sets
rather than lists, but we choose not to do that since it mildly
complicates the definition of the semantics to be given
below.}
Let $M$ be a model of a type structure $\Omega$. For each
type-in-context
$\alpha\!s.\sigma$ over $\Omega$, define a function
\[
\den{\alpha\!s.\sigma}_{M}:{\cal U}^{n}\longrightarrow{\cal U}
\]
(where $n$ is the length of the context) by induction on the structure
of $\sigma$ as follows.
\begin{itemize}
\item If $\sigma$ is a type variable, it must be $\alpha_{i}$ for some unique
$i=1,\ldots,n$ and then $\den{\alpha\!s.\sigma}_{M}$ is the $i$\/th
projection function, which sends $(X_{1},\ldots,X_{n})\in{\cal U}^{n}$
to $X_{i}\in{\cal U}$.
\item If $\sigma$ is a function type\index{function types, in HOL logic@function types, in \HOL{} logic!formal semantics of}
$\sigma_{1}\fun\sigma_{2}$, then $\den{\alpha\!s.\sigma}_M$ sends
$X\!s\in{\cal U}^n$ to the set of all functions
from $\den{\alpha\!s.\sigma_1}_M(X\!s)$ to
$\den{\alpha\!s.\sigma_2}_M(X\!s)$. (This makes
use of the property {\bf Fun} of $\cal U$.)
\item If $\sigma$ is a
compound type $(\sigma_{1},\ldots,\sigma_{m})\nu$, then
$\den{\alpha\!s.\sigma}_{M}$ sends $X\!s$ to
$M(\nu)(S_{1},\ldots,S_{m})$ where each $S_{j}$ is
$\den{\alpha\!s.\sigma_{j}}_{M}(X\!s)$.
\end{itemize}
One can now define the meaning of a type $\sigma$ in a model $M$ to be
the function
\[
\den{\sigma}_{M}:{\cal U}^{n}\longrightarrow{\cal U}
\]
given by $\den{\alpha\!s.\sigma}_{M}$, where $\alpha\!s$ is the
canonical context of $\sigma$. If $\sigma$ is monomorphic, then $n=0$
and $\den{\sigma}_{M}$ can be identified with the element
$\den{\sigma}_{M}()$ of $\cal U$. When the particular model $M$ is
clear from the context, $\den{\_}_{M}$ will be written $\den{\_}$.
To summarize, given a model in $\cal U$ of a type structure $\Omega$,
the semantics interprets monomorphic types over $\Omega$ as sets in
$\cal U$ and more generally, interprets polymorphic types\index{types, in HOL logic@types, in \HOL{} logic!polymorphic}\index{polymorphic types, in HOL logic@polymorphic types, in \HOL{} logic!formal semantics of} involving $n$ type variables as $n$-ary functions ${\cal
U}^{n}\longrightarrow{\cal U}$ on the universe. Function types are
interpreted by full function sets.
\medskip
\noindent{\bf Examples\ }
Suppose that $\Omega$ contains a type constant $(\textsl{b},0)$ and that
the model $M$ assigns the set $\two$ to $\textsl{b}$. Then:
\begin{enumerate}
\item $\den{\textsl{b}\fun\textsl{b}\fun\textsl{b}}=\two\fun\two\fun\two\in{\cal U}$.
\item $\den{(\alpha\fun\textsl{b})\fun\alpha}:{\cal U}\longrightarrow{\cal U}$
is the function sending $X\in{\cal U}$ to $(X\fun\two)\fun X\in{\cal U}$.
\item $\den{\alpha,\beta . (\alpha\fun\textsl{b})\fun\alpha}:{\cal
U}^{2}\longrightarrow{\cal U}$ is the function sending $(X,Y)\in{\cal
U}^{2}$ to $(X\fun\two)\fun X\in{\cal U}$.
\end{enumerate}
\medskip
\noindent{\bf Remark\ }
A more traditional approach to the semantics would involve giving
meanings to types in the presence of `environments' assigning sets in
$\cal U$ to all type variables. The use of types-in-contexts is almost
the same as using partial environments with finite domains---it is
just that the context ties down the admissible domain to a particular
finite (ordered) set of type variables. At the level of types there is
not much to choose between the two approaches. However for the syntax
and semantics of terms to be given below, where there is a dependency
both on type variables and on individual variables, the approach used
here seems best.
\subsection{Instances and substitution}
\label{instances-and-substitution}
If $\sigma$ and $\tau_1,\ldots,\tau_n$ are types over a type structure
$\Omega$,
\[
\sigma[\tau_{1},\ldots,\tau_{p}/\beta_{1},\ldots,\beta_{p}]
\]
will denote the type resulting from the simultaneous substitution for
each $i=1,\ldots,p$ of
$\tau_i$ for the type variable $\beta_i$ in $\sigma$.
The resulting type is called an {\it instance\/}\index{types, in HOL logic@types, in \HOL{} logic!instantiation of} of $\sigma$. The
following lemma about instances will be useful later; it is proved by
induction on the structure of $\sigma$.
\medskip
\noindent{\bf Lemma 1\ }{\it
Suppose that $\sigma$ is a type containing distinct type variables
$\beta_1,\ldots,\beta_p$ and that
$\sigma'=\sigma[\tau_{1},\ldots,\tau_{n}/\beta_1,\ldots,\beta_p]$ is
an instance of $\sigma$. Then the types $\tau_1,\ldots,\tau_p$ are
uniquely determined by $\sigma$ and $\sigma'$.}
\medskip
We also need to know how the semantics of types behaves with respect
to substitution:
\medskip
\noindent{\bf Lemma 2\ }{\it Given types-in-context $\beta\!s.\sigma$ and
$\alpha\!s.\tau_i$ ($i=1,\ldots,p$, where $p$ is the
length of $\beta\!s$), let $\sigma'$ be the instance
$\sigma[\tau\!s/\beta\!s]$. Then $\alpha\!s.\sigma'$ is also a
type-in-context and its meaning in any model $M$ is related to that of
$\beta\!s.\sigma$ as follows. For all $X\!s\in{\cal U}^n$ (where $n$
is the length of $\alpha\!s$)
\[
\den{\alpha\!s.\sigma'}(X\!s) =
\den{\beta\!s.\sigma}(\den{\alpha\!s.\tau_{1}}(X\!s),
\ldots ,\den{\alpha\!s.\tau_{p}}(X\!s))
\]
}
Once again, the lemma can be proved by induction on the structure of
$\sigma$.
\section{Terms}
\label{terms}
The terms of the \HOL{} logic are expressions that denote elements of the sets
denoted by types. The meta-variable $t$
is used to range over arbitrary terms, possibly decorated
with subscripts or primes.
There are four kinds of terms in the \HOL{} logic. These can be
described approximately by the following {\small BNF} grammar, in
which $x$ ranges over variables and $c$ ranges over constants.
\index{combinations, in HOL logic@combinations, in \HOL{} logic!abstract form of}
\settowidth{\ttX}{\tt X}
\newcommand{\var}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,0){\makebox(0,0)[b]{\footnotesize variables}}
\put(0,1.5){\vector(0,1){4.5}}
\end{picture}}
\newcommand{\const}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,2.3){\makebox(0,0)[b]{\footnotesize constants}}
\put(.5,3.5){\vector(0,1){2.4}}
\end{picture}}
\newcommand{\app}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(.5,1.5){\makebox(0,0)[b]{\footnotesize function applications}}
\put(.5,0){\makebox(0,0)[b]{\footnotesize (function $t$, argument $t'$)}}
\put(0.5,2.5){\vector(0,1){3.5}}
\end{picture}}
\newcommand{\abs}{\setlength{\unitlength}{\ttX}\begin{picture}(1,6)
\put(1,3.3){\makebox(0,0)[b]{\footnotesize $\lambda$-abstractions}}
\put(0.7,4.5){\vector(0,1){1.5}}
\end{picture}}
%
$$ t \quad ::=\quad {\mathord{\mathop{x}\limits_{\var}}}
\quad\mid\quad{\mathord{\mathop{\con{c}}\limits_{\const}}}
\quad\mid\quad\underbrace{t\ t'}_{\app}
\quad\mid\quad\underbrace{\lambda x .\ t}_{\abs}$$
Informally, a $\lambda$-term\index{lambda terms, in HOL logic@lambda terms, in \HOL{} logic}\index{function abstraction, in HOL logic@function abstraction, in \HOL{} logic!abstract form of} $\lambda x.\ t$ denotes
a function $v\mapsto t[v/x]$, where $t[v/x]$ denotes the result of
substituting $v$ for $x$ in $t$. An application\index{function application, in HOL logic@function application, in \HOL{} logic!abstract form of} $t\ t'$ denotes the result of applying the
function denoted by $t$ to the value denoted by $t'$. This will be
made more precise below.
The {\small BNF} grammar just given omits mention of types. In fact, each
term in
the \HOL{} logic is associated with a unique type.
The notation $t_{\sigma}$ is
traditionally used to range over terms of type $\sigma$. A
more accurate grammar of
terms is:
$$ t_{\sigma} \quad ::=\quad {\mathord{\mathop{x_{\sigma}}\limits_{}}}
\quad\mid\quad
{\mathord{\mathop{\con{c}_{\sigma}}\limits_{}}}
\quad\mid\quad (t_{\sigma'\fun\sigma}\ t'_{\sigma'})_{\sigma}
\quad\mid\quad(\lambda x_{\sigma_1} .\ t_{\sigma_2})
_{\sigma_1\fun\sigma_2}$$\index{constants, in HOL logic@constants, in \HOL{} logic!abstract form of}
In fact, just as the definition of types was relative to a particular
type structure $\Omega$, the formal definition of terms is relative to
a given collection of typed constants over $\Omega$. Assume that an
infinite set {\sf Names} of names is given. A {\em constant\/} over
$\Omega$ is a pair $(\con{c}, \sigma)$, where $\con{c}\in{\sf Names}$
and $\sigma\in{\sf Types}_{\Omega}$. A {\em signature} over $\Omega$
is just a set $\Sigma_\Omega$ of such constants.
The set {\sf Terms}$_{\Sigma_{\Omega}}$ of terms over
$\Sigma_{\Omega}$ is defined to be the smallest set closed under the
following rules of formation:
\begin{enumerate}
\item {\bf Constants:} If $(\con{c},\sigma)\in{\Sigma_{\Omega}}$ and
$\sigma'\in{\sf Types}_{\Omega}$
is an instance of $\sigma$, then $(\con{c},{\sigma'})\in{\sf
Terms}_{\Sigma_{\Omega}}$. Terms formed in this way are called {\it
constants\/}\index{constants, in HOL logic@constants, in \HOL{} logic!abstract form of} and are written $\con{c}_{\sigma'}$.
\item {\bf Variables:} If $x\in{\sf Names}$ and $\sigma\in{\sf
Types}_{\Omega}$, then ${\tt var}\ x_{\sigma}\in{\sf
Terms}_{\Sigma_{\Omega}}$. Terms formed in this way are called {\it
variables}\index{variables, in HOL logic@variables, in \HOL{} logic!abstract form of}. The marker {\tt var}\ is purely a device to
distinguish variables from constants with the same name. A variable
${\tt var}\ x_{\sigma}$ will usually be written as $x_{\sigma}$, if it
is clear from the context that $x$ is a variable rather than a
constant.
\item {\bf Function applications:} If $t_{\sigma'{\fun}\sigma}\in{\sf
Terms}_{\Sigma_{\Omega}}$ and $t'_{\sigma'}\in{\sf
Terms}_{\Sigma_{\Omega}}$, then $(t_{\sigma'\fun\sigma}\
t'_{\sigma'})_{\sigma}\in {\sf Terms}_{\Sigma_{\Omega}}$.
(Terms formed in this way are sometimes called {\it combinations}.)
\item {\bf $\lambda$-Abstractions:} If ${\tt var}\ x_{\sigma_1}
\in{\sf Terms}_{\Sigma_{\Omega}}$ and $t_{\sigma_2}\in{\sf
Terms}_{\Sigma_{\Omega}}$, then $(\lambda x_{\sigma_1}.\
t_{\sigma_2})_{\sigma_1\fun\sigma_2}
\in{\sf Terms}_{\Sigma_{\Omega}}$.
\end{enumerate}
Note that it is possible for constants and variables\index{variables, in HOL logic@variables, in \HOL{} logic!with same names} to have the
same name. It is also possible for different variables to have the
same name, if they have different types.
The type subscript on a term may be omitted if it is clear from the
structure of the term or the context in which it occurs what its type
must be.
Function application\index{function application, in HOL logic@function application, in \HOL{} logic!associativity of} is assumed to associate
to the left, so that $t\ t_1\ t_2\ \ldots\ t_n$ abbreviates $(\
\ldots\ ((t\ t_1)\ t_2)\ \ldots\ t_n)$.
The notation $\lambda x_1\ x_2\ \cdots\ x_n.\ t$ abbreviates $\lambda
x_1.\ (\lambda x_2.\ \cdots\ (\lambda x_n.\ t)\ \cdots\ )$.
A term is called polymorphic\index{polymorphic terms, in HOL logic@polymorphic terms, in \HOL{} logic} if it contains a type
variable. Otherwise it is called monomorphic. Note that a term
$t_{\sigma}$ may be polymorphic even though $\sigma$ is
monomorphic --- for example,
$(f_{\alpha\fun\textsl{b}}\ x_{\alpha})_{\textsl{b}}$, where $\textsl{b}$ is an atomic type. The expression
$tyvars(t_{\sigma})$ denotes the set of type variables occurring in
$t_{\sigma}$.
An occurrence of a variable $x_{\sigma}$ is called {\it
bound\/}\index{bound variables, in HOL logic@bound variables, in \HOL{} logic}\index{variables, in HOL logic@variables, in \HOL{} logic!abstract form of}
if it occurs within the scope of a textually enclosing
$\lambda x_{\sigma}$, otherwise the occurrence is called {\it
free\/}\index{free variables, in HOL logic@free variables, in \HOL{} logic!abstract form of}. Note that $\lambda x_{\sigma}$ does not bind
$x_{\sigma'}$ if $\sigma\neq \sigma'$. A term in which all occurrences
of variables are bound is called {\it closed\/}.
\subsection{Terms-in-context}
\label{terms-in-context}
A {\em context\/}\index{contexts, in semantics of HOL logic@contexts, in semantics of \HOL{} logic} $\alpha\!s,\!x\!s$ consists of a type
context $\alpha\!s$ together with a list $x\!s=x_{1},\ldots,x_{m}$ of
distinct variables whose types only contain type variables from the
list $\alpha\!s$.
The condition that $x\!s$ contains {\em distinct\/} variables needs
some comment. Since a variable is specified by both a name and a
type, it is permitted for $x\!s$ to contain repeated
names\index{variables, in HOL logic@variables, in \HOL{} logic!with same names},
so long as different types are attached to the
names. This aspect of the syntax means that one has to proceed with
caution when defining the meaning of type variable instantiation,
since instantiation may cause variables to become equal
`accidentally': see Section~\ref{term-substitution}.
A {\em term-in-context\/}\index{term-in-context}
$\:\;\alpha\!s,\!x\!s.t\;\:$ consists of a context together with a term
$t$ satisfying the following conditions.
\begin{itemize}
\item $\alpha\!s$ contains any type variable that occurs in $x\!s$ and $t$.
\item $x\!s$ contains any variable that occurs freely in $t$.
\item $x\!s$ does not contain any variable that occurs
bound in $t$.
\end{itemize}
The context $\alpha\!s,\!x\!s$ may contain (type) variables which do
not appear in $t$. Note that the combination of the second and third
conditions implies that a variable cannot have both free and bound
occurrences in $t$. For an arbitrary term, there is always an
$\alpha$-equivalent term which satisfies this condition, obtained by
renaming the bound variables as necessary.\footnote{Recall that two
terms are said to be $\alpha$-equivalent if they differ only in the
names of their bound variables.} In the semantics of terms to be given
below we will restrict attention to such terms. Then the meaning of an
arbitrary term is taken to be the meaning of some $\alpha$-variant of
it having no variable both free and bound. (The semantics will equate
$\alpha$-variants, so it does not matter which is chosen.) Evidently
for such a term there is a minimal context $\alpha\!s,\!x\!s$, unique
up to the order in which variables are listed, for which
$\alpha\!s,\!x\!s.t$ is a term-in-context. As for type variables, we
will assume given a fixed total order on variables. Then the unique
minimal context with variables listed in order will be called the {\em
canonical}\index{canonical contexts, in HOL logic@canonical contexts, in \HOL{} logic!of terms} context of the term $t$.
\subsection{Semantics of terms}
\label{semantics of terms}
Let $\Sigma_{\Omega}$ be a signature\index{signatures, of HOL logic@signatures, of \HOL{} logic!formal semantics of} over a type
structure $\Omega$ (see Section~\ref{terms}). A {\em model\/} $M$ of
$\Sigma_{\Omega}$ is specified by a model of the type structure plus
for each constant\index{primitive constants, of HOL logic@primitive constants, of \HOL{} logic} $(\con{c},\sigma)\in\Sigma_{\Omega}$ an
element
\[
M(\con{c},\sigma) \in
\prod_{X\!s\in{\cal U}^{n}}\den{\sigma}_{M}(X\!s)
\]
of the indicated cartesian product, where $n$ is the number of type
variables occurring in $\sigma$. In other words
$M(\con{c},\sigma)$ is a (dependently typed) function
assigning to each $X\!s\in{\cal U}^{n}$ an element of
$\den{\sigma}_{M}(X\!s)$. In the case that $n=0$ (so that
$\sigma$ is monomorphic), $\den{\sigma}_{M}$ was identified
with a set in $\cal U$ and then $M(c,\sigma)$ can be
identified with an element of that set.
The meaning of \HOL{} terms in such a model will now be described. The
semantics interprets closed terms involving no type variables as
elements of sets in $\cal U$ (the particular set involved being derived
from the type of the term as in Section~\ref{semantics of types}). More
generally, if the closed term involves $n$ type variables then it is
interpreted as an element of a product $\prod_{X\!s\in{\cal
U}^{n}}Y(X\!s)$, where the function $Y:{\cal U}^{n}\longrightarrow{\cal
U}$ is derived from the type of the term (in a type context derived
from the term). Thus the meaning of the term is a (dependently typed)
function which, when applied to any meanings chosen for the type
variables in the term, yields a meaning for the term as an element of a
set in $\cal U$. On the other hand, if the term involves $m$ free
variables but no type variables, then it is interpreted as a function
$Y_1\times\cdots\times Y_m\fun Y$ where the sets $Y_1,\ldots,Y_m$ in
$\cal U$ are the interpretations of the types of the free variables in
the term and the set $Y\in{\cal U}$ is the interpretation of the type
of the term; thus the meaning of the term is a function which, when
applied to any meanings chosen for the free variables in the term,
yields a meaning for the term. Finally, the most general case is of a
term involving $n$ type variables and $m$ free variables: it is
interpreted as an element of a product
\[
\prod_{X\!s\in{\cal
U}^{n}}Y_{1}(X\!s)\times\cdots\times Y_{m}(X\!s) \;\fun\; Y(X\!s)
\]
where the functions $Y_{1},\ldots,Y_{m},Y:{\cal
U}^{n}\longrightarrow{\cal U}$ are determined by the types of the free
variables and the type of the term (in a type context derived from the
term).
More precisely, given a term-in-context $\alpha\!s,\!x\!s.t$
over $\Sigma_{\Omega}$ suppose
\begin{itemize}
\item $t$ has type $\tau$
\item $x\!s=x_{1},\ldots,x_{m}$ and each $x_{j}$ has type $\sigma_{j}$
\item $\alpha\!s=\alpha_{1},\ldots,\alpha_{n}$.
\end{itemize}
Then since $\alpha\!s,\!x\!s.t$ is a term-in-context, $\alpha\!s.\tau$
and $\alpha\!s.\sigma_{j}$ are types-in-context, and hence give rise
to functions $\den{\alpha\!s.\tau}_{M}$ and
$\den{\alpha\!s.\sigma_{j}}_{M}$ from ${\cal U}^{n}$ to $\cal U$ as in
section~\ref{semantics of types}. The meaning of $\alpha\!s,\!x\!s.t$
in the model $M$ will be given by an element
\[
\den{\alpha\!s,\!x\!s.t}_{M} \in \prod_{X\!s\in{\cal U}^{n}}
\left(\prod_{j=1}^{m}\den{\alpha\!s.\sigma_{j}}_{M}(X\!s)\right)
\fun \den{\alpha\!s.\tau}_{M}(X\!s) .
\]
In other words, given
\begin{eqnarray*}
X\!s & = & (X_{1},\ldots,X_{n})\in{\cal U}^{n} \\
y\!s & = & (y_{1},\ldots,y_{m})\in\den{\alpha\!s.\sigma_{1}}_{M}(X\!s)
\times\cdots\times \den{\alpha\!s.\sigma_{m}}_{M}(X\!s)
\end{eqnarray*}
one gets an element $\den{\alpha\!s,\!x\!s.t}_{M}(X\!s)(y\!s)$ of
$\den{\alpha\!s.\tau}_{M}(X\!s)$. The definition of
$\den{\alpha\!s,\!x\!s.t}_{M}$ proceeds by induction on the structure of
the term $t$, as follows. (As before, the subscript $M$ will be dropped from
the semantic brackets $\den{ \_ }$ when the particular model involved is
clear from the context.)
\begin{itemize}
\item
If $t$ is a variable\index{variables, in HOL logic@variables, in \HOL{} logic!formal semantics of}, it must be $x_{j}$ for some unique
$j=1,\ldots,m$, so $\tau=\sigma_{j}$ and then
$\den{\alpha\!s,\!x\!s.t}(X\!s)(y\!s)$ is defined to be $y_{j}$.
\item
Suppose $t$ is a constant\index{constants, in HOL logic@constants, in \HOL{} logic!formal semantics of} $\con{c}_{\sigma'}$, where
$(\con{c},\sigma)\in\Sigma_{\Omega}$ and $\sigma'$ is an instance of
$\sigma$. Then by Lemma~1 of \ref{instances-and-substitution},
$\sigma'=\sigma[\tau_{1},\ldots,\tau_{p}/\beta_{1},\ldots,\beta_{p}]$
for uniquely determined types $\tau_{1},\ldots,\tau_{p}$ (where
$\beta_{1},\ldots,\beta_{p}$ are the type variables occurring in
$\sigma$). Then define $\den{\alpha\!s,\!x\!s.t}(X\!s)(y\!s)$ to be
$M(\con{c},\sigma)(\den{\alpha\!s.\tau_{1}}(X\!s),
\ldots,\den{\alpha\!s.\tau_{p}}(X\!s))$,
which is an element of $\den{\alpha\!s.\tau}(X\!s)$ by Lemma~2 of
\ref{instances-and-substitution} (since $\tau$ is $\sigma'$).
\item
Suppose $t$ is a function application\index{combinations, in HOL logic@combinations, in \HOL{} logic!formal semantics of} term $(t_{1}\
t_{2})$\index{function application, in HOL logic@function application, in \HOL{} logic!formal semantics of} where $t_{1}$ is of type
$\tau'\fun\tau$ and $t_{2}$ is of type $\tau'$. Then
$f=\den{\alpha\!s,\!x\!s.t_{1}}(X\!s)(y\!s)$, being an element of
$\den{\alpha\!s.\tau'\fun\tau}(X\!s)$, is a function from the set
$\den{\alpha\!s.\tau'}(X\!s)$ to the set $\den{\alpha\!s.\tau}(X\!s)$
which one can apply to the element
$y=\den{\alpha\!s,\!x\!s.t_{2}}(X\!s)(y\!s)$. Define
$\den{\alpha\!s,\!x\!s.t}(X\!s)(y\!s)$ to be $f(y)$.
\item Suppose $t$ is the abstraction\index{function abstraction, in HOL logic@function abstraction, in \HOL{} logic!formal semantics of}
term $\lambda x.t_{2}$where $x$ is of type $\tau_{1}$ and $t_{2}$ of
type $\tau_{2}$. Thus $\tau=\tau_{1}\fun\tau_{2}$ and
$\den{\alpha\!s.\tau}(X\!s)$ is the function set
$\den{\alpha\!s.\tau_{1}}(X\!s)\fun\den{\alpha\!s.\tau_{2}}(X\!s)$.
Define $\den{\alpha\!s,\!x\!s.t}(X\!s)(y\!s)$ to be the element of
this set which is the function sending
$y\in\den{\alpha\!s.\tau_{1}}(X\!s)$ to
$\den{\alpha\!s,\!x\!s,\!x.t_{2}}(X\!s)(y\!s,y)$. (Note that since
$\alpha\!s,\!x\!s.t$ is a term-in-context, by convention the bound
variable $x$ does not occur in $x\!s$ and thus
$\alpha\!s,\!x\!s,\!x.t_{2}$ is also a term-in-context.)
\end{itemize}
Now define the meaning of a term $t_{\tau}$ in a model $M$ to be the
dependently typed function
\[ \den{t_{\tau}} \in \prod_{X\!s\in{\cal U}^{n}}
\left(\prod_{j=1}^{m}\den{\alpha\!s.\sigma_{j}}(X\!s)\right)
\fun \den{\alpha\!s.\tau}(X\!s)
\]
given by $\den{\alpha\!s,\!x\!s.t_{\tau}}$, where $\alpha\!s,\!x\!s$ is the
canonical context of $t_{\tau}$. So $n$ is the number of type variables in
$t_{\tau}$, $\alpha\!s$ is a list of those type variables, $m$ is the
number of ordinary variables occurring freely in $t_{\tau}$ (assumed to be
distinct from the bound variables of $t_{\tau}$) and the $\sigma_{j}$ are
the types of those variables. (It is important to note that the list
$\alpha\!s$, which is part of the canonical context of $t$, may be strictly
bigger than the canonical type contexts of $\sigma_{j}$ or $\tau$. So it
would not make sense to write just $\den{\sigma_{j}}$ or $\den{\tau}$ in
the above definition.)
If $t_{\tau}$ is a closed term, then $m=0$ and for each $X\!s\in{\cal
U}^{n}$ one can identify $\den{t_{\tau}}$ with the element
$\den{t_{\tau}}(X\!s)()\in\den{\alpha\!s.\tau}(X\!s)$. So for closed terms
one gets
\[ \den{t_{\tau}} \in \prod_{X\!s\in{\cal U}^{n}}
\den{\alpha\!s.\tau}(X\!s)
\]
where $\alpha\!s$ is the list of type variables occurring in $t_{\tau}$ and
$n$ is the length of that list. If moreover, no type variables occur in
$t_{\tau}$, then $n=0$ and $\den{t_{\tau}}$ can be identified with the
element $\den{t_{\tau}}()$ of the set $\den{\tau}\in{\cal U}$.
The semantics of terms appears somewhat complicated because of the
possible dependency of a term upon both type variables and ordinary
variables. Examples of how the definition of the semantics
works in practice can be found in Section~\ref{LOG}, where the meaning
of several terms denoting logical constants is given.
\subsection{Substitution}
\label{term-substitution}
Since terms may involve both type variables and
ordinary variables, there are two different operations of substitution
on terms which have to be considered---substitution of types for type
variables and substitution of terms for variables.
\subsubsection*{Substituting types for type variables in terms}
\index{substitution rule, in HOL logic@substitution rule, in \HOL{} logic!formal semantics of}
Suppose $t$ is a term, with canonical context $\alpha\!s,\!x\!s$ say,
where $\alpha\!s = \alpha_1,\ldots,\alpha_n$, $x\!s = x_1,\ldots,x_m$
and where for $j=1,\ldots,m$ the type of the variable $x_j$ is
$\sigma_j$. If $\alpha\!s'.\tau_{i}$ ($i=1,\ldots,n$) are
types-in-context, then substituting\index{type substitution, in HOL logic@type substitution, in \HOL{} logic!formal semantics of} the types
$\tau_{i}$ for the type variables $\alpha_{i}$ in the list $x\!s$, one
obtains a new list of variables $x\!s'$. Thus the $j$\/th entry of
$x\!s'$ has type $\sigma'_{j} = \sigma_{j}[\tau\!s/\alpha\!s]$. Only
substitutions with the following property will be considered.
\begin{quote}
In instantiating\index{types, in HOL logic@types, in \HOL{} logic!instantiation of} the type variables $\alpha\!s$ with the types
$\tau\!s$, no two distinct variables in the list $x\!s$ become equal in
the list $x\!s'$.\footnote{Such an identification of variables could
occur if the variables had the same name component and their types
became equal on instantiation.}
\end{quote}
This condition ensures that $\alpha\!s',x\!s'$ really is a context. Then
one obtains a new term-in-context $\alpha\!s',\!x\!s'.t'$ by
substituting the types $\tau\!s=\tau_{1},\ldots,\tau_{n}$ for the type
variables $\alpha\!s$ in $t$ (with suitable renaming of bound
occurrences of variables to make them distinct from the variables in
$x\!s'$). The notation
\[
t[\tau\!s/\alpha\!s]
\]
is used for the term $t'$.
\medskip
\noindent{\bf Lemma 3\ }{\it
The meaning of $\alpha\!s',\!x\!s'.t'$ in a model is related to that
of $t$ as follows. For all $X\!s'\in{\cal U}^{n'}$ (where $n'$ is the
length of $\alpha\!s'$)}
\[
\den{\alpha\!s',\!x\!s'.t'}(X\!s') =
\den{t}(\den{\alpha\!s'.\tau_{1}}(X\!s'),\ldots,
\den{\alpha\!s'.\tau_{n}}(X\!s')).
\]
\medskip
Lemma~2 in \ref{instances-and-substitution} is needed to see that both
sides of the above equation are elements of the same set of functions.
The validity of the equation is proved by induction on the structure
of the term $t$.
\subsubsection*{Substituting terms for variables in terms}
\index{substitution rule, in HOL logic@substitution rule, in \HOL{} logic!formal semantics of}
Suppose $t$ is a term, with canonical context $\alpha\!s,\!x\!s$ say,
where $\alpha\!s = \alpha_1,\ldots,\alpha_n$, $x\!s = x_1,\ldots,x_m$
and where for $j=1,\ldots,m$ the type of the variable $x_j$ is
$\sigma_j$. If one has terms-in-context $\alpha\!s,\!x\!s'.t_{j}$ for
$j=1,\ldots,m$ with $t_{j}$ of the same type as $x_{j}$, say
$\sigma_{j}$, then one obtains a new term-in-context
$\alpha\!s,\!x\!s'.t''$ by substituting the terms
$t\!s=t_1,\ldots,t_m$ for the variables $x\!s$ in $t$ (with suitable
renaming of bound occurrences of variables to prevent the free
variables of the $t_{j}$ becoming bound after substitution). The
notation
\[
t[t\!s/x\!s]
\]
is used for the term $t''$.
\medskip
\noindent{\bf Lemma 4\ }{\it
The meaning of $\alpha\!s,\!x\!s'.t''$ in a model is related to that of
$t$ as follows. For all $X\!s\in{\cal U}^{n}$ and all
$y\!s'\in\den{\alpha\!s.\sigma'_{1}} \times\cdots\times
\den{\alpha\!s.\sigma'_{m'}}$ (where $\sigma'_{j}$ is the type of
$x'_{j}$)}
\[
\den{\alpha\!s,\!x\!s'.t''}(X\!s)(y\!s') = \den{t}(X\!s)(
\den{\alpha\!s,\!x\!s'.t_{1}}(X\!s)(y\!s'),\ldots,
\den{\alpha\!s,\!x\!s'.t_{m}}(X\!s)(y\!s'))
\]
\medskip
Once again, this result is proved by induction on the structure of
the term $t$.
\section{Standard notions}
Up to now the syntax of types and terms has been very general. To
represent the standard formulas of logic it is necessary to
impose some specific structure. In particular, every type structure
must contain an atomic type \ty{bool} which is intended to denote
the distinguished two-element set $\two\in{\cal U}$, regarded as a set
of truth-values. Logical formulas are then identified with
terms\index{type variables, in HOL logic@type variables, in \HOL{} logic!abstract form of}\index{terms, in HOL logic@terms, in \HOL{} logic!as logical formulas} of type \ty{bool}. In addition, various
logical constants are assumed to be in all signatures. These
requirements are formalized by defining the notion of a
standard signature.
\subsection{Standard type structures}
\label{standard-type-structures}
A type structure $\Omega$ is {\em standard\/} if it contains the
atomic types \ty{bool} (of booleans or truth-values) and \ty{ind} (of
individuals). (In the literature, the symbol $o$ is often used
instead of \ty{bool} and $\iota$ instead of \ty{ind}.)
A model $M$ of $\Omega$ is {\em standard\/} if $M(\bool)$ and $M(\ind)$ are
respectively the distinguished sets $\two$ and $\inds$ in the universe
$\cal U$.
It will be assumed from now on that type structures and their models
are standard.
\subsection{Standard signatures}
\label{standard-signatures}
\index{signatures, of HOL logic@signatures, of \HOL{} logic!standard}\index{standard signatures, of HOL logic@standard signatures, of \HOL{} logic}
A signature $\Sigma_{\Omega}$ is {\em standard\/} if it contains the
following three primitive constants\index{primitive constants, of HOL logic@primitive constants, of \HOL{} logic}\index{constants, in HOL logic@constants, in \HOL{} logic!primitive, abstract form of}:
\[
{\imp}_{\ty{bool}\fun\ty{bool}\fun\ty{bool}}
\]
\[
{=}_{\alpha\fun\alpha\fun\ty{bool}}
\]
\[
\hilbert_{(\alpha\fun\ty{bool})\fun\alpha}
\]
The intended interpretation of these constants is that $\imp$ denotes
implication, $=_{\sigma\fun\sigma\fun\ty{bool}}$ denotes equality on
the set denoted by $\sigma$, and
$\hilbert_{(\sigma\fun\ty{bool})\fun\sigma}$ denotes a choice function
on the set denoted by $\sigma$. More precisely, a model $M$ of
$\Sigma_{\Omega}$ will be called {\em standard\/}\index{standard models, of HOL logic@standard models, of \HOL{} logic} if
\begin{itemize}
\item
$M({\imp},\bool\fun\bool\fun\bool)\in(\two\fun\two\fun\two)$ is the
standard implication\index{implication, in HOL logic@implication, in \HOL{} logic!formal semantics of} function, sending $b,b'\in\two$ to
\[
(b\imp b') = \left\{ \begin{array}{ll}
0 & \mbox{if $b=1$ and $b'=0$} \\
1 & \mbox{otherwise}
\end{array}
\right.%}
\]
\item
$M({=},\alpha\fun\alpha\fun\bool)\in\prod_{X\in{\cal U}}.X\fun
X\fun\two$ is the function assigning to each $X\in{\cal U}$ the
equality\index{equality, in HOL logic@equality, in \HOL{} logic!formal semantics of} test function, sending $x,x'\in X$ to
\[
(x=_{X}x') = \left\{ \begin{array}{ll}
1 & \mbox{if $x=x'$} \\
0 & \mbox{otherwise}
\end{array}
\right.%}
\]
\item
\index{epsilon operator}$M(\hilbert,(\alpha\fun\bool)\fun\alpha)\in\prod_{X\in{\cal
U}}.(X\fun\two)\fun X$ is the function assigning to each $X\in{\cal
U}$ the choice\index{choice operator, in HOL logic@choice operator, in \HOL{} logic!formal semantics of} function sending $f\in(X\fun\two)$ to
\[
\ch_{X}(f) = \left\{ \begin{array}{ll}
\ch(f^{-1}\{1\})
& \mbox{if $f^{-1}\{1\}\not=\emptyset$}\\
\ch(X) & \mbox{otherwise}
\end{array}
\right.%}
\]
where $f^{-1}\{1\}=\{x\in X : f(x)=1\}$. (Note that $f^{-1}\{1\}$ is in
$\cal U$ when it is non-empty, by the property {\bf Sub} of the
universe $\cal U$ given in Section~\ref{introduction}. The function
$\ch$ is given by property {\bf Choice}.)
\end{itemize}
It will be assumed from now on that signatures and their models are
standard.
\medskip
\noindent{\bf Remark\ }
This particular choice of primitive constants is arbitrary. The
standard collection of logical constants includes $\T$ (`true'), $\F$
(`false')\index{truth values, in HOL logic@truth values, in \HOL{} logic!abstract form of}, $\imp$ (`implies'), $\wedge$ (`and'), $\vee$
(`or'), $\neg$ (`not'), $\forall$ (`for all'), $\exists$ (`there
exists'), $=$ (`equals'), $\iota$ (`the'), and $\hilbert$ (`a'). This
set is redundant, since it can be defined (in a sense explained in
Section~\ref{defs}) from various subsets. In practice, it is
necessary to work with the full set of logical constants, and the
particular subset taken as primitive is not important. The interested
reader can explore this topic further by reading Andrews'
book~\cite{Andrews} and the references it contains.
\medskip
Terms of type \ty{bool} are called {\it formulas\/}\index{formulas as terms, in HOL logic@formulas as terms, in \HOL{} logic}.
The following notational abbreviations are used:
\begin{center}
\index{equality, in HOL logic@equality, in \HOL{} logic!abstract form of}
\index{implication, in HOL logic@implication, in \HOL{} logic!abstract form of}
\index{choice operator, in HOL logic@choice operator, in \HOL{} logic!abstract form of}
\index{existential quantifier, in HOL logic@existential quantifier, in \HOL{} logic!abstract form of}
\index{universal quantifier, in HOL logic@universal quantifier, in \HOL{} logic!abstract form of}
\index{epsilon operator}
\begin{tabular}{|l|l|}\hline
{\rm Notation} & {\rm Meaning}\\ \hline
$t_{\sigma}=t'_{\sigma}$ &
$=_{\sigma\fun\sigma\fun\ty{bool}}\ t_{\sigma}\ t'_{\sigma}$\\ \hline
$t\imp t'$ &
$\imp_{\ty{bool}\fun\ty{bool}\fun\ty{bool}}\ t_\ty{bool}\
t'_\ty{bool}$\\ \hline
$\hilbert x_{\sigma}.\ t$ &
$ \hilbert_{(\sigma\fun\ty{bool})\fun\sigma}
(\lambda x_{\sigma}.\ t)$\\ \hline
\end{tabular}
\end{center}
These notations are special cases of general abbreviatory conventions
supported by the \HOL{} system. The first two are infixes and the
third is a binder (see \DESCRIPTION's sections on parsing and
pretty-printing).
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "logic"
%%% End:
| {
"alphanum_fraction": 0.7009312694,
"avg_line_length": 46.7370983447,
"ext": "tex",
"hexsha": "0050511bc2d9ceb03aa9c2714e1f5e54efd41f2d",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "8de43bf3176993a37fb2f917fe978964c9d0591c",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "LiLiming/HOL",
"max_forks_repo_path": "Manual/Logic/syntax.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "8de43bf3176993a37fb2f917fe978964c9d0591c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "LiLiming/HOL",
"max_issues_repo_path": "Manual/Logic/syntax.tex",
"max_line_length": 270,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "8de43bf3176993a37fb2f917fe978964c9d0591c",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "LiLiming/HOL",
"max_stars_repo_path": "Manual/Logic/syntax.tex",
"max_stars_repo_stars_event_max_datetime": "2018-12-27T07:51:47.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-12-27T07:51:47.000Z",
"num_tokens": 15092,
"size": 47999
} |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{\label{sec:Networking}Networking (includes sections on Port Usage, CCB, and GCB)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\index{network}
This section on
network communication in Condor
discusses which network ports are used,
how Condor behaves on machines with multiple network interfaces
and IP addresses,
and how to facilitate functionality in a pool that spans
firewalls and private networks.
The security section of the manual contains some
information that is relevant to the discussion of network
communication which will not be duplicated here, so please
see section~\ref{sec:Security} as well.
Firewalls, private networks, and network address translation (NAT)
pose special problems for Condor.
There are currently two main mechanisms for dealing with firewalls
within Condor:
\begin{enumerate}
\item Restrict Condor to use a specific range of port numbers, and
allow connections through the firewall that use any port within the
range.
\item Use \Term{Condor Connection Brokering} (CCB) or \Term{Generic Connection Brokering} (GCB).
\end{enumerate}
Each method has its own advantages and disadvantages,
as described below.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% all of these define their own \subsection, so include them directly
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\input{admin-man/ports.tex}
\input{admin-man/shared-port-daemon.tex}
\input{admin-man/multiple-interfaces.tex}
\input{admin-man/gcb.tex}
\input{admin-man/tcp-update.tex}
% NAT -- Network address translation
% when access to internet uses a single IP addr/port,
% but there are multiple computers communicating by this single
% place
% The NAT is an extra layer that translates the multiple addr/port
% to the single, and visa versa (from the single to one of the
% multiple).
% Lore from Derek:
% however, "nat" is also one of those strange condor-team terms (like
% "frank") that has it's own, special meaning. :)
%
% a "nat" is a unit for measuring productivity (or lack thereof) in
% condor work over time. it can be normalized to any time unit you
% want, by dividing the amount of work accomplished into the time scale
% you want. 1 nat is *very* little work over a given time period,
% almost too small to measure unless you use a long time scale. at the
% time it first came up, we decided that jim basney *sleeps* at about 40
% nats, just for comparison. :)
| {
"alphanum_fraction": 0.6849529781,
"avg_line_length": 34.9589041096,
"ext": "tex",
"hexsha": "4398a9b837ea122a6266b9ce7b6da3519bbc7b4c",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-08-29T14:03:10.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-08-29T14:03:10.000Z",
"max_forks_repo_head_hexsha": "391c85153e60cccfd201779ceae520d15561a8ea",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "djw8605/condor",
"max_forks_repo_path": "doc/admin-man/networking.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "391c85153e60cccfd201779ceae520d15561a8ea",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "djw8605/condor",
"max_issues_repo_path": "doc/admin-man/networking.tex",
"max_line_length": 96,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "391c85153e60cccfd201779ceae520d15561a8ea",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "djw8605/condor",
"max_stars_repo_path": "doc/admin-man/networking.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 554,
"size": 2552
} |
\NewChapter{1}{INTRODUCTION}
\subsection{Heading}
\begin{figure}[h]
\includegraphics{static/logo.png}
\centering
\caption{KVIS LOGO}%
\end{figure}
\begin{table}[h]
\centering
\begin{tabular}{c|c}
K & V \\
I & S
\end{tabular}
\caption{MY FIRST TABLE!}
\end{table}
I also want to cite \cite{Nobody06} for nothing
| {
"alphanum_fraction": 0.6232686981,
"avg_line_length": 18.05,
"ext": "tex",
"hexsha": "013b12257a0b8894a82b73869c9d8d4cee4d3dd6",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "616a067f728e1e49b144ecb400c045279e872555",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "vzsky/KVIS_SeminarReport_Latex",
"max_forks_repo_path": "src/Chapter1.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "616a067f728e1e49b144ecb400c045279e872555",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "vzsky/KVIS_SeminarReport_Latex",
"max_issues_repo_path": "src/Chapter1.tex",
"max_line_length": 47,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "616a067f728e1e49b144ecb400c045279e872555",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "vzsky/KVIS_SeminarReport_Latex",
"max_stars_repo_path": "src/Chapter1.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 118,
"size": 361
} |
% This is the main latex file for the
% submission to RuleML 2015 about
% API4KB ontologies
%
\documentclass[runningheads]{llncs}
\usepackage{amsmath,amssymb,amsfonts,textcomp}
\usepackage{url}
\usepackage{cite}
\usepackage{footnote}
\usepackage{hyperref}
\usepackage{enumitem}
\usepackage{rotating}
\usepackage[final]{todonotes}
%
\title{API4KP Prrofs}
\date{}
%
\begin{document}
%
\author{Tara Athan\inst{1}}
\institute{
Athan Services (athant.com), West Lafayette, Indiana, USA\\
\email{[email protected]}
}
%
\maketitle
\begin{abstract}
These are the proofs that the M-tree monads satisfy the monad laws.
\end{abstract}
\section{Monad Laws}
In seminal work that established a theoretical foundation for proving the equivalence of programs, Moggi\cite{moggi_notions_1991} applied the notion of monad from category theory\cite{MacLane1998} to computation.
As defined in category theory, a monad is an endofunctor on a category C (a kind of mapping from C into itself) which additionally satisfies some requirements (the monad laws).
In functional programming, monads on a particular category are of interest - the category with types as objects and programs as arrows.
For example, the List[\_] typeclass is a monad, e.g. List[Int] is a type that is a member of List[\_].
Each monad has the following transformations (exemplified for the List monad where lists are denoted with angle brackets)
\begin{itemize}
\item unit: A $\Rightarrow$ M[A] lifts the input into the monad (e.g. unit(2) = $\langle$2$\rangle$)
\item join: M[M[A]] $\Rightarrow$ M[A] collapses nested monad instances by one level (e.g. join($\langle$$\langle$1, 2$\rangle$, $\langle$3, 4$\rangle$$\rangle$) = $\langle$1, 2, 3, 4$\rangle$)
\item map: (A $\Rightarrow$ B) $\Rightarrow$ (M[A] $\Rightarrow$ M[B]) takes a function between two generic types and returns a function relating the corresponding monadic types (e.g. map( s $\Rightarrow$ 2*s)($\langle$1, 2$\rangle$) = $\langle$2, 4$\rangle$)
\end{itemize}
Note that we choose the unit, join and map transformations\cite{Wadler1992} as fundamental in this development of the monad laws because it is useful for later discussion on tree structures, whereas the usual theoretical treatment, based on unit and bind = join o map, is more concise.
The map transformation defines a functor M, satisfying the functor laws:
\begin{description}
\item[Functor Identity] map(id)(y) = y
\item[Functor Associativity] map(f o g) = map(f) o map(g)
\end{description}
where id is identity function s $\Rightarrow$ s.
The unit and join transformations arise from natural transformations related to M, satisfying:
\begin{description}
\item[Unit from Natural Transformation] map(f)(unit(x)) = unit(f(x))
\item[Join from Natural Transformation] join(map(join)(x)) = join(join(x))
\end{description}
Further, these transformations must obey the monad laws:
\begin{description}
\item[Monad Left Identity] join(map(unit)(x)) = x
\item[Monad Right Identity] join(unit(x)) = x
\item[Monad Associativity] join(map(map(f))(x)) = map(f)(join(x))
\end{description}
Monads of relevance to API4KP include
\begin{description}
\item [Option:] handles nullability, has subclasses Some, which wraps a knowledge resource, and None, which is empty
\item [Try:] handles exceptions, has subclasses Success, which wraps a knowledge resource, and Failure, which wraps a (non-fatal) exception
\item [Future:] handles concurrency, describes a process whose output may become available at some time
\item [IO:] handles IO side-effects, wraps a knowledge resource and an \emph{item configuration}
\item [Task:] handles general side-effects, wraps a knowledge resource and a description of a side-effectful task
\item [Observable:] handles streams, wraps a sequence of knowledge resources that become available over time
\item [Key-Value Map:] handles labelled structure, a knowledge resource is associated with each key in some set
\item [Heterogeneous List:] handles a specified pattern of knowledge resource subclasses (e.g. RuleML rulebase together with an OWL ontology defining the sort hierarchy, CL text with sidecar RDF metadata).
\item [State:] handles state, wraps a knowledge resource (the state) and implements state transitions
\end{description}
These monad functors may be composed; for example, given a basic knowledge expression type E, the type (State o Try o List) [E] = State[Try[List[E]]] may be defined.
%be of type State of type Try of type List of type basic knowledge expression.
In general, the composition of monads is not necessarily a monad.
%For example, (Set o List)[\_] is a typeclass, with members of type Set[List[A]], i.e. sets of lists of type A.
\section{Either Bifunctor}
Because the Either bifunctor is utilized to define the M-tree monad, the following functions regarding Either are useful in the proofs that follow.
The function $bimap$ takes two arguments of type function and returns a function that applies those functions in a map-like fashion to the left and right types, respectively.
$$ bimap : (A=>C) => (B=>D) => ((A \mathop{\mathrm{or}} B)=> (C \mathop{\mathrm{or}} D))$$
Special cases are
$$ mapRight = bimap( s -> s)$$
$$ mapLeft(f) = bimap(f)(s -> s)$$
The function $bimapOne$ is similar to $bimap$ in that it takes two arguments of type function, but these two functions are required to have the same output type. The function returned by $bimapOne$ unwraps the Either into the common output type.
$$bimapOne: (A=>C) => (B=>C) => ((A \mathop{\mathrm{or}} B)=> C)$$
Let $unit_L$, $unit_R$ be the left and right-biased monadic type constructor for Either, respectively.
%In general, a right-biased disjunction (REither) of monads instances of the same generic type can serve as a basis for tree structures as follows:
% M[E] = REither[M1[E], M2[E]] is a monad provided:
% unit_M(x) = Right( unit_M2(x))
% map_M(x) = map_M1(x) if x is Left, map_M2(x) if x is Right
% join_M(x) = join_M2(x) if x is Right[Right],
% otherwise, the value is obtained by lifting x into Right[Right] by
% applying a (full) lifting functor G:M1 => M2 that is a right adjoint of a
% (restricted) forgetful functor F: M2 => M1
% Purpose: For use with two languages, A and B where M2 is a monad that is compatible with A and B, while
% M1 is a monad compatible only with A.
% N1[A] = M1[Q1[A]]
% Q1[A] = Either[A, N1[A]]
% E = Either[Q1[A], B]
% Let N2[E] = M2[Q2[E]]
% Q2[E] = Either[E, N2[E]]
% R[A, B] = Q2[Either[Q1[A], B]]
\section{Monadic Tree Structures}
The monad structures needed for API4KP are a restricted form of the monads seen in functional programming - rather than applying to category of all types, these monads are functors on a smaller category of knowledge resource types. In DOL, the concept of structured expression using sets is introduced. For example, let B be the category of (basic) Common Logic text expressions, and Q[B] = B or Set[Q[B]], where Set[Q[B]] is the typeclass of SetTree-structured Common Logic expressions. In particular, a member of type SetTree[B] is specified by a Set whose members are either basic leaves (of type B) or structured branches (of type Set[Q[B]]).
The Set monad is appropriate for defining structured expressions in monotonic logics, like Common Logic, because the order and multiplicity of expressions in a collection has no effect on semantics. The semantics of CL is provided by the CL interpretation structure that assigns a truth-value to each basic CL text expression. The truth-value of a set of CL text expressions is true in an interpretation I if each member of the set maps to true in I. The truth value I(y) of a SetTree-structured CL expression y is defined to be I(flatten(y)), where flatten(y) is the set of leaves of y.
We generalize this approach for defining the semantics of structured expressions to an arbitrary language L with basic expressions E and M-tree structured expressions. We assume that
\begin{itemize}
\item M is a monad on the category of types,
\item model-theoretic semantics is supplied through an interpretation structure I defined for basic expressions in E and simply-structured expressions M[E],
\item a post-condition contract for side-effects is specified by a truth-valued function P(F, y) for all supported void knowledge actions F and all y in E or M[E].
\end{itemize}
Let N[\_] be the M-tree monad corresponding to the minimal (finite) fixed point of N[E] = M[E + N[E]], where "A + B" is the coproduct, which can also be denoted as a bifunctor Either[A, B].
The unit function for N is the same as the unit function for M.
The map and join functions for N are defined from a straight-forward recursive application of the map and join functions for M, given in the next section.
The satisfaction of the monad laws is dependent on the use of the Either bifunctor to handle the union types, so that the left or right intention is preserved even in the case when the types are not disjoint. In particular,
$$join_N = (join_M o map_M)( bimapOne( id) (unit_M o unit_R o join_N) ) $$
$$ map_N(f) = map_M( bimap(f, map_N(f)) ) $$
where casting between M and N is implicit and the following functions for the Either bifunctor are used:
If E is a type of basic knowledge resources, then N[E] is the type of M-tree-structured knowledge resources, and
Q[E] = E or N[E] is the corresponding type of knowledge resources (either basic or structured). By convention, the M-tree monad is named by appending "Tree" to the name of the underlying monad; thus, SetTree[E] = Set[E or Set[SetTree[E]]].
For all x, y $\in$ Q[E], define
\begin{description}
\item[level:] Q[E] $\Rightarrow$ N[E]
%= bimapL(unit, id)
such that level(x) = unit(x), if x $\in$ E, x otherwise
\item[flatten:] Q[E] $\Rightarrow$ M[E]
such that flatten(y) = y if y $\in$ E or M[E], flatten( join$_N$(map$_M$(level)(y)) otherwise
%= bimap(id, flatten_N)
%\item[flatten_N:] N[E] $\Rightarrow$ M[E] = bimap(id, flatten_N)
\end{description}
%where bimapL is a left-biased
Then for all y $\in$ Q[E], we may define the interpretation I(y) = I(flatten(y)), with entailments defined accordingly. %Similarly the pragmatics (side-effects) are specified by P(flatten(y)).
Implementations that honor the semantics must satisfy P(F, y) = P(F, flatten(y)), where P is a function representing the post-conditions after execution of side-effectful knowledge operation F on the knowledge resource y.
% composition of monads is a functor (not necessarily a monad)
Like other monads, M-tree monads are functors and so can be combined through composition.
For example, a system of multiple concurrent threads may be modelled as a Set-structure of Stream-structured knowledge resources: SetTree o StreamTree.
% StreamTree[A] = Stream[A or Stream[StreamTree[A]]]
\section{Heterogeneous Structures}
% monad tree in two langauges, with focus A and leaf B
Suppose A and B are expression types of two languages where an environment provides a semantics-preserving transformation T from B to A.
Further suppose that an interpretation mapping I is defined on A or M[A].
The Either type E = A or B defines the basic knowledge expressions in this environment, while structured expressions are N[E] where N is the M-tree monad N[E].
The Either type Q[E] = E or N[E] contains all expressions in this environment, basic or structured.
Using the transformation T from the environment, we may define the interpretation of the M-tree structured expressions in terms of the interpretations of basic expressions in A and operations on monads. In particular,
\begin{itemize}
\item S(x) = T(x) if x $\in$ B, x otherwise
\item I(x) = I( map(S)(flatten(x)) )
\end{itemize}
Notice that the expressions of type B are not required to be in a knowledge representation language. They could be in a domain-specific data model based on XML, JSON or SQL. The semantics of expressions of type B are derived from the transformation to type A, the focus knowledge representation language of the environment. API4KP employs this feature to model ontology-based data access (OBDA) and rule-based data access (RBDA).
Structured expressions can always be constructed in a monad that has more structure than necessary for compatibility with the semantics of a given language.
For example, List and Stream monads can be used for monotonic, effect-free languages even though the Set monad has sufficient structure for these languages;
a forgetful functor is used to define the semantics in the monad with greater structure in terms of the monad of lesser structure.
A heterogeneous structure of languages containing some languages with effects and others without effects (e.g. an ECA rulebase supported by ontologies) could thus make primary use of an M-tree monad that preserves order, such as ListTree or StreamTree, while permitting some members of the collection to have a SetTree structure.
%In particular, if A is an ECA rulebase language and B is an ontology language, then ListTree[ A or SetTree[B]] would be an appropriate monadic tree structure for heterogeneous knowledge expressions in these two languages.
%
\section{Proof}
%Proof of satisfaction of monad laws by M-trees
% Note - a shorter proof could probably be obtained using Kleisli's
%[Functor Identity] map(id)(y) = y
%where id is identity function s $\Rightarrow$ s.
To verify the Functor Identity law for an M-tree, it is sufficient to show that map$_N$(id) = id.
In terms of the definition of map$_N$,
$$ map_N(f) = map_M( bimap(f, map_N(f)) ) $$
we must show
$$ map_N(id) = map_M( mapRight (map_N(id)) ) = id $$
If x is Left, then mapRight(_)(x) = (x), so the law holds in the base case.
Now suppose x is Right; i.e. it is an M-tree of some depth k.
If the law holds for the components of x, then it holds for x.
If k=1, then all the components of x are left, and the law holds.
Suppose that the law holds for all M-trees of depth less then k.
Then law holds for the components of x, and hence the law holds for x.
Because M-trees are finite, then the law holds by induction.
%
%
%[Functor Associativity] map(f o g) = map(f) o map(g)
To verify the functor associativity law, it is sufficient to show
$$ map_N(f o g) = map_N(f) o map_N(g) $$
or
$$ map_M(bimap(f o g, map_N(f o g)) = map_M(bimap(f, map_N(f)) o map_M(bimap(g, map_N(g)) $$
If x is left, then
$$ bimap(f o g, map_N(f o g)(x) = mapLeft(f o g)(x)$$
Because $mapLeft$ satisfies functor associativity, then the law holds for x.
Now
$$ map_M(bimap(f o g, map_N(f o g)) = map_M(mapLeft(f o g) o mapRight(map_N(f o g)))$$
Since $map_M$, $mapLeft$ and $mapRight$ are satisfy functor associativity, we have
$$ map_M(bimap(f o g, map_N(f o g)) = map_M(mapLeft(f)) o map_M( mapLeft(g)) o map_M(mapRight(map_N(f o g))))$$
Similarly
$$map_M(bimap(f, map_N(f)) o map_M(bimap(g, map_N(g)) = map_M(mapLeft(f)) o map_M(mapRight( map_N(f)) o map_M(mapLeft(g)) o map_M(mapRight(map_N(g)))$$
Because $mapLeft$ and $mapRight$ are commutative, then
$$map_M(bimap(f, map_N(f)) o map_M(bimap(g, map_N(g)) = map_M(mapLeft(f))o map_M(mapLeft(g)) o map_M(mapRight( map_N(f)) o map_M(mapRight(map_N(g)))$$
Therefore we need to show
$$map_M(mapRight(map_N(f o g))) = map_M(mapRight( map_N(f)) o map_M(mapRight(map_N(g)))$$
and this follows provided
$$map_M(mapRight(map_N(f o g))) = map_M(mapRight( map_N(f) o map_N(g))$$
Consider the sequence of M-trees of maximum depth $k$, denoted as $N_k$.
$$ N_0[E] = Unit$$
$$ N_1[E] = M[Either[E, N0[E]]$$
$$ N_2[E] = M[Either[E, N1[E]]$$
$$ N_n[E] = M[Either[E, N_{n-1}[E]]$$
$N_0$ is a monad by default, since it has no instances.
We wish to show that P[E] = M2[Either[E, M1[E]]] is a monad, provided M1 and M2 are monads,
where
$$ map_P(f) = map_M2( bimap(f, map_M1(f)) ) $$
%[Functor Identity] map(id)(y) = y
%where id is identity function s $\Rightarrow$ s.
To verify functor identity, we need to show
$$ map_P(id) = map_M2( bimap(id, map_M1(id)) ) = id $$
Now
$$ map_M2( bimap(id, map_M1(id)) ) = map_M2( mapRight(map_M1(id)) )$$
Since M2, M1 and REither are monads, then
$$map_M2( mapRight(map_M1(id)) ) =id$
and functor identity holds.
%[Functor Associativity] map(f o g) = map(f) o map(g)
To verify the functor associativity law, it is sufficient to show
$$ map_P(f o g) = map_P(f) o map_P(g) $$
or
$$ map_M2( bimap(f o g, map_M1(f o g)) ) = map_M2( bimap(f, map_M1(f)) ) o map_M2( bimap(g, map_M1(g)) ) $$
Working first on the left-hand side of the equation,
\begin{align*}
map_M2( bimap(f o g, map_M1(f o g)) ) = map_M2( mapLeft(f o g) o mapRight(map_M1(f o g)) ) \\
&= map_M2( mapLeft(f) o mapLeft(g) o mapRight(map_M1(f)) o mapRight(map_M1(g)))) ) \\
&= map_M2( mapLeft(f) o mapRight(map_M1(f)) o mapLeft(g) omapRight(map_M1(g)))) ) \\
\end{align*}
because $mapLeft$ and $mapRight$ are commutative.
Similarly, the right-hand side becomes
\begin{align*}
map_M2( bimap(f, map_M1(f)) ) o map_M2( bimap(g, map_M1(g)) )
&= map_M2( mapLeft(f) o mapRight(map_M1(f)) ) o map_M2( mapLeft(g) o mapRight(map_M1(g)) ) \\
&= map_M2( mapLeft(f) o mapRight(map_M1(f)) ) o map_M2( mapLeft(g) o mapRight(map_M1(g)) ) \\
&= map_M2( mapLeft(f)) o map_M2(mapRight(map_M1(f)) ) o map_M2( mapLeft(g)) o map_M2(mapRight(map_M1(g)) ) \\
\end{align*}
%[Unit from Natural Transformation] map(f)(unit(x)) = unit(f(x))
%[Join from Natural Transformation] join(map(join)(x)) = join(join(x))
%[Monad Left Identity] join(map(unit)(x)) = x
%[Monad Right Identity] join(unit(x)) = x
%[Monad Associativity] join(map(map(f))(x)) = map(f)(join(x))
\bibliographystyle{splncs03}
\bibliography{api4kbonto}
\end{document}
| {
"alphanum_fraction": 0.7356825686,
"avg_line_length": 63.4151624549,
"ext": "tex",
"hexsha": "a7966e8c18d6fa4a8e0c95d679c1805c08498311",
"lang": "TeX",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2020-07-01T19:10:26.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-05-31T19:06:30.000Z",
"max_forks_repo_head_hexsha": "6b5b055f445e2615fc102d04da2c76e3759f498d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "API4KBs/api4kbs",
"max_forks_repo_path": "publications/ruleml2015_src/paper/proofs.tex",
"max_issues_count": 39,
"max_issues_repo_head_hexsha": "6b5b055f445e2615fc102d04da2c76e3759f498d",
"max_issues_repo_issues_event_max_datetime": "2016-06-17T06:49:28.000Z",
"max_issues_repo_issues_event_min_datetime": "2015-02-19T14:50:50.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "API4KBs/api4kbs",
"max_issues_repo_path": "publications/ruleml2015_src/paper/proofs.tex",
"max_line_length": 648,
"max_stars_count": 5,
"max_stars_repo_head_hexsha": "6b5b055f445e2615fc102d04da2c76e3759f498d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "API4KBs/api4kbs",
"max_stars_repo_path": "publications/ruleml2015_src/paper/proofs.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-27T20:36:13.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-02-19T14:53:10.000Z",
"num_tokens": 4866,
"size": 17566
} |
\documentclass{subfile}
\begin{document}
\section{The Equal Variable Method}\label{sec:ev}
\textcite{cirtoaje_2007}
\end{document} | {
"alphanum_fraction": 0.7819548872,
"avg_line_length": 22.1666666667,
"ext": "tex",
"hexsha": "ac62b96ae79452d6951879d21bc17cde0a1ae88e",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ebf89351c843b6a7516e10e2ebf0d64e3f1f3f83",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "ineq-tech/inequality",
"max_forks_repo_path": "ev.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ebf89351c843b6a7516e10e2ebf0d64e3f1f3f83",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "ineq-tech/inequality",
"max_issues_repo_path": "ev.tex",
"max_line_length": 50,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "ebf89351c843b6a7516e10e2ebf0d64e3f1f3f83",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "ineq-tech/inequality",
"max_stars_repo_path": "ev.tex",
"max_stars_repo_stars_event_max_datetime": "2022-02-06T08:29:30.000Z",
"max_stars_repo_stars_event_min_datetime": "2022-02-06T08:29:30.000Z",
"num_tokens": 44,
"size": 133
} |
\documentclass[11pt]{article}
\usepackage{listings}
\usepackage{hyperref}
\usepackage{fullpage}
\usepackage{amsmath}
\usepackage{url}
\lstdefinelanguage{pbcc}{
morekeywords={transform, if, else, for, from, to, using, case, do, where,
return, or, in_training, secondary, primary, priority, generator,
template, assert, while, config, MatrixRegion1D, MatrixRegion2D,
MatrixRegion3D, cell, region, row, col},
sensitive=true,
morecomment=[l]{\#},
morecomment=[l]{//},
morestring=[b]',
morestring=[b]",
}
\lstset{language=pbcc}
\lstset{numbers=left}
\lstset{tabsize=2}
\lstset{commentstyle=\textit}
\lstset{literate=
{REFTransform}{{\ref{sec:transform}}}{3}
{REFRule} {{\ref{sec:rule}}}{3}
{REFBody} {{\ref{sec:body}}}{3}
}
\begin{document}
\title{PetaBricks Language Specification}
\author{Jason Ansel}
\maketitle
\tableofcontents
\newpage
\section{Syntax}
\subsection{Minimal PetaBricks Program}
Figure~\ref{ex1} is an example of a (near) minimal PetaBricks program. It
copies the matrix A to the matrix B.
\begin{figure}[h]
\begin{lstlisting}
transform Copy2D REFTransform
to B[w,h] REFTransform
from A[w,h] REFTransform
{
to(B.cell(x,y) b) REFRule
from(A.cell(x,y) a) REFRule
{
b=a; REFBody
}
}
\end{lstlisting}
This defines the transform Copy2D, which can be invoked as follows:
\begin{lstlisting}
MatrixRegion2D a,b;
...
Copy2D(a,b);
\end{lstlisting}
\caption{
A minimal PetaBricks program. This invocation will result in the rule,
defined on lines~5-9, being invoked on every pair of elements in $a$
and $b$ in an undefined order.
\label{ex1}
}
\end{figure}
\subsection{Transform Structure}
The high level structure of a transform is as follows.
\begin{lstlisting}
Transform Header [REFTransform]
{
Rule Header [REFRule]
{
Rule Body [REFBody]
}
Rule Header [REFRule]
{
Rule Body [REFBody]
}
...
}
\end{lstlisting}
\subsection{Transform Header}
\label{sec:transform}
The header of a transform consists of an unordered, whitespace separated
list of clauses. The minimal set of clauses are TRANSFORM, FROM, and TO.
All of the allowed clauses are defined as follows:
\begin{figure}[h]
\begin{lstlisting}
transform Sum1Da
to Total
from A[n]
{
//Compute the total sequentially
to(Total t) from(A a) {
t=0;
for(int i=0; i<n; ++i)
t+=a.cell(i);
}
//Divided and conquer
to(Total t) from(A.region(0,n/2) left, A.region(n/2,n) right) {
t=Sum1Da(left)+Sum1Da(right);
}
}
\end{lstlisting}
\caption{
Sum all of the elements in an array.
\label{ex2}
}
\end{figure}
\begin{figure}[h]
\begin{lstlisting}
transform Sum1Db
to Total
using Partial[n/2]
from A[n]
{
//sum two neighboring elements
to(Partial.cell(i) p) from(A.cell(2*i) a1, A.cell(2*i+1) a2){
p=a1+a2;
}
//lower priority rule to handle odd sized arrays
secondary to(Partial.cell(i) p) from(A.cell(2*i) a1){
p=a1;
}
//recursively call self to finish summing
to(Total t) from(Partial p){
Sum1Db(t,p);
}
//optionally skip Partial and just compute the output directly
//this serves as the base case for the recursive calls
to(Total t) from(A a){
Sum1Da(t,a);
}
}
\end{lstlisting}
\caption{
Sum all of the elements in an array, by making an intermediate array of size n/2 or by calling Sum1Da.
\label{ex3}
}
\end{figure}
\subsubsection{TRANSFORM Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & Yes \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt transform IDENTIFIER[\ref{IDENTIFIER}] \\
\bf Example & \tt transform Foo \\
\bf Used in & \tt Figure~\ref{ex1} \\
\hline
\end{tabular}
~
\noindent
Specifies the externally visible name of the transform.
\subsubsection{FROM Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & Yes \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt from MATRIXDEFLIST[\ref{MATRIXDEFLIST}] \\
\bf Example & \tt from A[w,h], B[w] \\
\bf Used in & \tt Figure~\ref{ex2} \\
\hline
\end{tabular}
~
\noindent
\noindent Defines the inputs of the transform. The sizes of the outputs
are given as expressions containing unbound variables. The compiler and
runtime must find a valid assignment for these unbound variables to match
the sizes of the inputs given. The values assigned to these variables are
visible both in rule headers and in rule bodies.
\subsubsection{TO Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & Yes \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt to MATRIXDEFLIST[\ref{MATRIXDEFLIST}] \\
\bf Example & \tt to C[w,h], D[w] \\
\bf Used in & \tt Figure~\ref{ex2} \\
\hline
\end{tabular}
~
\noindent Defines the outputs of the transform. The sizes of the outputs
are given as expressions containing unbound variables that are set based on the size
of the inputs.
\subsubsection{USING Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt using MATRIXDEFLIST[\ref{MATRIXDEFLIST}] \\
\bf Example & \tt using E[w,h], F[w] \\
\bf Used in & \tt Figure~\ref{ex3} \\
\hline
\end{tabular}
~
\noindent Defines intermediate data used during the transform execution. This
data is temporary and neither an input nor an output. The sizes are given
as expressions containing unbound variables that are set based on the size
of the inputs.
\subsubsection{GENERATOR Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\bf Syntax & \tt generator IDENTIFIERLIST[\ref{IDENTIFIERLIST}]\\
\bf Example & \tt generator Bar\\
\bf Used in & \tt Figure~\ref{ex4} \\
\hline
\end{tabular}
~
\noindent Specifies the name of another transform (or list of transforms)
that should be used to generate inputs to this transform during training.
The outputs of the other transforms are paired left to right with the inputs
of this transform. The other transforms inputs are seeded with random data
of the desired input size.
If this clause is not used, transforms will be given random data during
training.
\begin{figure}[h]
\begin{lstlisting}
transform Permute
to B[n]
from A[n], Indices[n]
generator PermuteGenerator
{
to(B.cell(i) b) from(A a, Indices.cell(i) idx){
assert idx < n;
b=a.cell(idx);
}
}
//generate random test data for Permute
transform PermuteGenerator
to A[n], Indices[n]
from A[n]
{
to(Indices.cell(i) idx) {
idx=randint(0, n-1);
}
}
\end{lstlisting}
\caption{
Example usage for generator keyword. Computes $B[i]=A[Indicies[i]]$.
\label{ex4}
}
\end{figure}
\subsubsection{TEMPLATE Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\bf Syntax & \tt template < IDENTIFIER(INT, INT), ... > \\
\bf Example & \tt template < precision(1,5) > \\
\bf Used in & \tt Figure~\ref{ex5} \\
\hline
\end{tabular}
~
\noindent Defines a parameter to the transform that requires independent
training for each value. This causes N transforms to be generated, one for
each possible value. The first INT specifies the minimum value while the
second specifies the maximum value. The new transforms can be called with
the syntax: Name$<$ParamValue$>$.
\begin{figure}[h]
\begin{lstlisting}
template < reps(1,5) >
transform Foo
to B[n]
from A[n]
{
to(B b) from(A a) {
Bar(b, a);
for(int i=1; i<reps; ++i)
Bar(b, b);
}
}
MatrixRegion1D a,b;
...
Foo<3>(b, a);
\end{lstlisting}
\caption{
Example usage for template keyword.
\label{ex5}
}
\end{figure}
\subsubsection{Default Values}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\bf Example & \tt from IN[h,w]=OUT[h,w], iterations=5 \\
\hline
\end{tabular}
In the {\tt FROM} clause, the programmer may specify default values for transform inputs.
These default values work the same way as default values in {\tt C++}. This provides an easy way for defining in place transforms.
\subsection{Rule Header}
\label{sec:rule}
The header for a rule consists of an unordered, whitespace-separated list
of clauses. The meanings of these clauses are defined below. The only
required clause is TO.
\subsubsection{TO Clause}
\label{TO}
\begin{tabular}{| l | l |}
\hline
\bf Required & Yes \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt to( MATRIXARGLIST[\ref{MATRIXARGLIST}] ) \\
\bf Example & \tt to( A.cell(x,y) a, B.region(0, 0, x, y) b)\\
\hline
\end{tabular}
~
\noindent Specifies the outputs for the rule.
The coordinates in the TO and FROM clause must correspond to an affine
transformation of each other.
\subsubsection{FROM Clause}
\label{FROM}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt from( MATRIXARGLIST[\ref{MATRIXARGLIST}] ) \\
\bf Example & \tt from( A.cell(x,y) a, B.region(0, 0, x, y) b)\\
\hline
\end{tabular}
~
\noindent Specifies the inputs for the rule.
The coordinates in the TO and FROM clause must correspond to an affine
transformation of each other.
\subsubsection{USING Clause}
\label{USING}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\bf Syntax & \tt using( MATRIXDEFLIST[\ref{MATRIXDEFLIST}] ) \\
\bf Example & \tt using( T1[10], T2[w+h, w+h] ) \\
\hline
\end{tabular}
~
\noindent Defines temporary buffers required by the body of the rule.
PetaBricks will automatically allocate and reuse these temporary buffers.
\subsubsection{HINT Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt hint( EXPRESSION[\ref{EXPRESSION}] ) \\
\bf Example & \tt hint( n ) \\
\hline
\end{tabular}
~
\noindent Provide a hint to to autotuner that the decision to use this
rule should be based on comparing the given EXPRESSION to some constant.
Note that as of version 2.0 this language feature should no longer be needed
except in special cases.
\subsubsection{WHERE Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\bf Syntax & \tt where EXPRESSION[\ref{EXPRESSION}] \\
\bf Example & \tt where x<10 \\
\hline
\end{tabular}
~
\noindent Limits the range where this rule may be applied.
\subsubsection{PRIORITY Clause}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt priority(int) \\
\bf Example & \tt priority(1) \\
\hline
\end{tabular}
~
\noindent Specify the priority for the given rule. This is a clean way for
specifying handling of corner cases. For a given cell, only rule with a
minimum priority may be applied. The default priority is $1$.
\subsubsection{PRIMARY Keyword}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt primary \\
\hline
\end{tabular}
~
\noindent Equivalent to {\tt priority(0)}
\subsubsection{SECONDARY Keyword}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt secondary \\
\hline
\end{tabular}
~
\noindent Equivalent to {\tt priority(2)}
\subsubsection{ROTATABLE Keyword}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\bf Syntax & \tt rotatable \\
\hline
\end{tabular}
~
TODO: Define this more precisely.
\noindent Syntactic sugar for defining four rules with the coordinate
system rotated by $\frac \pi 2$ in each consecutive one.
\subsubsection{Return-style}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 1.0 \\
\hline
\end{tabular}
~
PetaBricks allows a shorter version of rule headers that eliminates
the need for a TO clause. It is similar to function style return syntax.
\begin{minipage}{\linewidth}
\begin{lstlisting}
B.cell(x,y) from(A.cell(x,y) a) {
return a;
}
\end{lstlisting}
\end{minipage}
Is desugared to:
\begin{minipage}{\linewidth}
\begin{lstlisting}
to(B.cell(x,y) _rv) from(A.cell(x,y) a) {
_rv=a;
return;
}
\end{lstlisting}
\end{minipage}
\subsubsection{OR Keyword}
\begin{tabular}{| l | l |}
\hline
\bf Required & No \\
\bf Available In Version & 2.0 \\
\hline
\end{tabular}
~
PetaBricks provides an ``OR'' keyword to eliminate the need for redundant
rule headers. ``OR'' simply means repeat the last rule header. For example:
\begin{minipage}{\linewidth}
\begin{lstlisting}
to(B b) from(A a) {
Foo(b,a);
} or {
Bar(b,a);
}
\end{lstlisting}
\end{minipage}
Is desugared to:
\begin{minipage}{\linewidth}
\begin{lstlisting}
to(B b) from(A a) {
Foo(b,a);
}
to(B b) from(A a) {
Bar(b,a);
}
\end{lstlisting}
\end{minipage}
\subsection{Rule Body}
\label{sec:body}
Rule bodies are standard {\tt C++} code with some preprocessing performed.
All variables defined in the corresponding rule header are visible from the
rule body.
\subsubsection{MatrixRegion Class}
Inputs an output matrix regions are of the template type {\tt
MatrixRegion<N,T>}, where $N$ is the number of dimensions and $T$ is the
element type. The typedefs: {\tt MatrixRegion0D}, {\tt MatrixRegion1D},
{\tt MatrixRegion2D}, ... are provided to refer to output matrix regions of each
dimensionality. Additionally the typedefs {\tt ConstMatrixRegion0D}, {\tt
ConstMatrixRegion1D}, {\tt ConstMatrixRegion2D}, ... refer to matrix
regions with read only data and are used for inputs to a rule.
This class is by reference, so using it never copies data. To make a copy,
one must explicitly call {\tt MatrixRegion::allocate} and then copy.
MatrixRegion supports numerous operations not discussed here. The API
documentation for this class can be found here:
\noindent
\url{http://kleptocracy.csail.mit.edu/pbapi/d9/db0/classpetabricks_1_1MatrixRegion.html}
\subsubsection{Configuration/Tunable Parameters}
The user may specify configuration parameters with:
\begin{verbatim}
config(name, initial, min, max);
\end{verbatim}
in the file header. Both min and max are optional and default to 0 and
MAX\_INT. These parameters are stored in the program configion file, but are
{\bf not} autotuned. The value may be changed by hand, with {\tt configtool}
(included in the scripts folder), and at runtime with {\tt name.setValue(int)}.
The current value can be accessed with either {\tt name} or {\tt name.value()}.
The user may specify tunable parameters with:
\begin{verbatim}
tunable(name, initial, min, max);
\end{verbatim}
in the file header. This is the same as a {\tt config} except that autotuner
will attempt to determine an optimal value automatically.
\subsubsection{Training Runs}
Some transforms require a training phase to determine configuration parameters
such as the number of iterations. The autotuner supports this through the
API function {\tt PetabricksRuntime::isTrainingRun()}, or the conditional macro
{\tt in\_training}. On the first execution with a given configuration,
calling this method will return {\tt true} and as a side effect the timing
results will be discarded and the test re-run. On subsequent executions
this method will return {\tt false} and have no side effects.
\begin{figure}[h]
\begin{lstlisting}
transform Foo
to B[n]
from A[n]
{
to(B b) from(A a) {
config(reps);
in_training {
// experimentally determine how many reps are needed
// for convergence in the current configuration
reps = 0;
while(! isConverged(b,a) ){
reps++;
Bar(b, b, a);
}
}else{
for(int i=1; i<reps; ++i){
Bar(b, b, a);
}
}
}
}
\end{lstlisting}
\caption{
Example usage for training runs
\label{ex6}
}
\end{figure}
\subsubsection{Clean Abort}
Transforms can abort execution (in the event of an invalid configuration or
input) using the API function {\tt PetabricksRuntime::abort()}. During training
this will cleanly end the current trail and remove the source configuration
from consideration.
\subsection{Definitions}
\subsubsection{MATRIXDEFLIST}
\label{MATRIXDEFLIST}
A comma separated list of {\tt MATRIXDEF[\ref{MATRIXDEF}]}.
\subsubsection{MATRIXDEF}
\label{MATRIXDEF}
Declares a new matrix of a given (symbolic) size.
Of the format: {\tt NAME} [ {\tt DIMENSIONS} ]
Where {\tt NAME} is an identifier and {\tt DIMENSIONS} is a comma separated
list of list of symbolic expressions.
\subsubsection{MATRIXARGLIST}
\label{MATRIXARGLIST}
A comma separated list of {\tt MATRIXARG[\ref{MATRIXARG}]}.
\subsubsection{MATRIXARG}
\label{MATRIXARG}
Declares an argument to a rule that references a matrix defined by a MATRIXDEF.
Of the format: {\tt MATRIX.REGIONSPEC } {\tt NAME}
Where MATRIX is name of the matrix the data is from. REGIONSPEC is the part
of the matrix to get and NAME is the identifier defined by this statement.
\subsubsection{REGIONSPEC}
One of:
\begin{itemize}
\item \tt cell(EXPRESSION...)
\item \tt region(EXPRESSION...)
\item \tt row(EXPRESSION)
\item \tt col(EXPRESSION)
\item \tt all()
\end{itemize}
\subsubsection{IDENTIFIERLIST}
\label{IDENTIFIERLIST}
A comma separated list of {\tt IDENTIFIER[\ref{IDENTIFIER}]}.
\subsubsection{IDENTIFIER}
\label{IDENTIFIER}
A name matching the regular expression: {\tt [a-zA-Z\_][a-zA-Z0-9\_]*}
\subsubsection{EXPRESSION}
\label{EXPRESSION}
An algebraic expression consisting of identifiers, integers, floats, and the operators: [*/()+-]
Unless stated otherwise, expressions must correspond to affine transformation
of the output coordinates.
\section{Semantics}
\subsection{Semantics for Rule Execution}
The header (defined Sec.~\ref{sec:rule}) of each rule contains a set of
free variables used to reference an explicit list input and output regions.
A rule may be {\em instantiated} by binding these free variables to values
determined by the compiler and runtime. The compiler may bind these free
variables to any value such that:
\begin{itemize}
\item All values are non-negative integers.
\item All regions referenced exist (i.e. not out of bounds access).
\item All input regions referenced have already been computed.
\item Any WHERE clauses evaluate to true.
\end{itemize}
Once the inputs and outputs are bound to an explicit set of cells, rule
execution follows a semantics and syntax similar to that of {\tt C++} with
the additional features defined in Section~\ref{sec:body}.
\subsection{Semantics for Transform Execution}
The semantics for the execution of a transform revolve around executing
rules in parallel. This section defines a internal state of an executing
transform and an operational semantics over this internal state for how a
running transform may progress from an initial state to a completion state.
The following definitions are required:
\begin{itemize}
\item
Let $r[\alpha]$ represent rule $r$ instantiated with free variables
bound to the set of definitions $\alpha$.
\item
Let $\mbox{depends}(r[\alpha])$ be the set of cells $r[\alpha]$
depends on (all the regions specified in the FROM[\ref{FROM}] clause when
free variables are bound using the mapping $\alpha$).
\item
Let $\mbox{provides}(r[\alpha])$ be the set of cells $r[\alpha]$
outputs on (all the regions specified in the TO[\ref{TO}] clause when free
variables are bound using the mapping $\alpha_j$).
\item Let $T$ be a static reference of a transform, consisting of a set of rules.
\item Let $R$ be a set of rule instances $r_0[\alpha_0] ... r_n[\alpha_n]$
\item Let $D$ be a set of cells. Each element in this contains both the $x,y$ coordinate and the matrix in which the cell belongs.
\item Let $\langle T, R, D_0, D_1, D_2 \rangle$ represent the internal state for a running transform where:
\begin{itemize}
\item $T$ is the transform being executed.
\item $R$ are the rules that may currently executing in parallel. (Initially $\epsilon$)
\item $D_0$ are cells already computed. (Initially those defined by the FROM clause.)
\item $D_1$ are cells that can be computed, but need not be. (Initially those defined by the USING clause.)
\item $D_2$ are cells that must be computed. (Initially those defined by the TO clause.)
\end{itemize}
\end{itemize}
The following transition rules govern the progression of the internal state
of a transform during execution. This semantics intentionally gives a lot of
freedom to the PetaBricks runtime. Specifically, the order of computation
is defined only as producers-before-consumers, data may be computed more
than once, and unfinished computations may be arbitrarily discarded.
~
\noindent
{\it
Transform initialization:}
~
\begin{tabular}{c}
Transform $T$ is called with inputs $D_0$ and outputs $D_2$.
\\
$D_1$ is the intermediate (USING) data required by $T$.
\\\hline
$\rightarrow \langle T, \epsilon, D_0, D_1, D_2 \rangle$
\end{tabular}
~
\noindent
{\it
Rule execution begins:}
~
\begin{tabular}{c}
$r \in T$ \\
$\alpha$ is a legal assignment for free variables in $r$ \\
depends$(r[\alpha]) \subset D_0$
\\\hline
$
\langle T, R, D_0, D_1, D_2 \rangle
\rightarrow
\langle T, R \cup \{r[\alpha]\}, D_0, D_1, D_2 \rangle$
\end{tabular}
~
\noindent
{\it
Rule execution ends:}
~
\begin{tabular}{c}
$r[\alpha]$ has finished executing
\\
$D_0' = D_0 \cup {\mbox{provides}(r[\alpha])}$
\\
$D_1 = D_1' \cup {\mbox{provides}(r[\alpha])}$
\\
$D_2 = D_2' \cup {\mbox{provides}(r[\alpha])}$
\\\hline
$
\langle T, R \cup \{r[\alpha]\}, D_0, D_1, D_2 \rangle
\rightarrow
\langle T, R, D_0', D_1', D_2' \rangle$
\end{tabular}
~
\noindent
{\it
Rule execution aborted:}
~
\begin{tabular}{c}
$
\langle T, R \cup \{r[\alpha]\}, D_0, D_1, D_2 \rangle
\rightarrow
\langle T, R, D_0, D_1, D_2 \rangle$
\end{tabular}
~
\noindent
{\it
Transform completion:}
~
\begin{tabular}{c}
$R=\epsilon$
\\
$D_2=\epsilon$
\\\hline
$
\langle T, R, D_0, D_1, D_2 \rangle
\rightarrow$
\end{tabular}
\end{document}
| {
"alphanum_fraction": 0.6799472296,
"avg_line_length": 26.0183066362,
"ext": "tex",
"hexsha": "66243fc8b8c5086307f7dc89f0ab12522c4860bc",
"lang": "TeX",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2021-01-12T15:05:34.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-06-28T06:01:03.000Z",
"max_forks_repo_head_hexsha": "b498b93880b0c4ac3924ddb82cff2e6541e60bd1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "petabricks/petabricks",
"max_forks_repo_path": "doc/spec/pbspec.tex",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "b498b93880b0c4ac3924ddb82cff2e6541e60bd1",
"max_issues_repo_issues_event_max_datetime": "2022-03-22T07:47:37.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-01-12T15:12:21.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "petabricks/petabricks",
"max_issues_repo_path": "doc/spec/pbspec.tex",
"max_line_length": 131,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "b498b93880b0c4ac3924ddb82cff2e6541e60bd1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "petabricks/petabricks",
"max_stars_repo_path": "doc/spec/pbspec.tex",
"max_stars_repo_stars_event_max_datetime": "2022-03-17T03:18:36.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-03-12T18:09:57.000Z",
"num_tokens": 6352,
"size": 22740
} |
\documentclass[tikz, border=5pt]{thesis}
\usepackage[edges]{forest}
\title{Data Storage and Serving Architecture for HTRC Corpus}
\author{HTRC IU Team}
\begin{document}
\maketitle
\tableofcontents
\begin{abstract}
TBD.
\end{abstract}
\section{Introduction}
With the recent acquisition of full Hathitrust corpus of 13.8 million digitized volumes, HTRC is working towards providing non-consumptive access to the full corpus. HTRC stores the corpus in IU Data Capacitor 2 structured according to pairtree~\cite{pairtree} file system heirarchy. Also, there is a copy of pairtree content packed into binary blobs that work with a in-house data processing and serving solution for HPC.
Data Capsules enable non-consumptive access to HTRC corpus and HTRC serves data to Data Capsules via the Data API~\cite{dataapi} which is a REST service backed by a Cassandra cluster. Current Data API provides access to a part of the full corpus, which is about 4 million digitized volumes.
HTRC aims to provide non-consumptive access to full Hathitrust corpus in coming months and this document discusses requirements -- both functional and non functional, data models, and solutions for enabling non-consumptive access to full corpus efficiently.
In addition to serving the full corpus via Data API, we are envisioning the use of Big Data frameworks such as Hadoop and Spark to process the corpus. This document will also address future use cases similar to mention above as well.
\section{Requirements}
\begin{itemize}
\item Serve the full corpus via a REST API (Data API)
\item
page level access
\item Read throughput of the system should be sufficient to utilize at least 50\% or more of the 40Gb/s network link
\item An API to check the availability of volumes
\item Access to volume metadata via REST API
\item Enable processing the corpus using Big Data frameworks such as Hadoop and Spark
\end{itemize}
\section{Data Models}
\subsection{Raw Data}
For each raw volume, we have a \texttt{<volume-id>.mets.xml} containing all the volume metadata including page information and a \texttt{<volume-id>.zip} file containing the OCRed content. The zip file contains all the individual pages defined in the mets file as well as a single text file which is a concatenation of all the pages.
\begin{forest}
for tree={%
folder,
grow'=0,
fit=band
}
[<vol-id>
[<vol-id>.mets.xml]
[<vol-id>.zip
[<vol-id>
[00000001.txt]
[00000002.txt]
[...]
[00000266.txt]]]]
\end{forest}
\subsection{Data API}
Data API will respond with a ZIP file containing volume content in following format upon a request with a list of volumes ids (\texttt{inu.3011012|uc2.ark:/13960/t2qxv15}) or a list of pages ids (\texttt{inu.3011012[1,2,20,30]|uc2.ark:/13960/t2qxv15[11,45\\,30,17,22,55]}).
\begin{forest}
for tree={%
folder,
grow'=0,
fit=band
}
[volumes.zip
[inu.3011012
[00000001.txt]
[00000002.txt]
[00000020.txt]
[00000030.txt]
[mets.xml]]
[uc2.ark:/13960/t2qxv15
[00000011.txt]
[00000045.txt]
[00000030.txt]
[00000017.txt]
[00000022.txt]
[00000055.txt]
[mets.xml]]]
\end{forest}
In addition to above Data API sends back concatenated text content if user requests the output to be concatenated.
\subsection{Storage}
\section{Discussion Notes}
\begin{figure}[ht!]
\centering
\includegraphics[width=0.95\textwidth]{IMG_0475}
\caption{Notes from the July 13th discussion (Milinda and Beth)}
\label{fig:notes}
\end{figure}
\bibliographystyle{abbrv}
\bibliography{references}
\end{document} | {
"alphanum_fraction": 0.737650933,
"avg_line_length": 34.0560747664,
"ext": "tex",
"hexsha": "a87a85f8608292f320d6b3edf3507d470f2aa67d",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2e49cd2944e4d3223ce3165544aa70f72b485873",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "milinda/DataServingAndStorageForHTRC",
"max_forks_repo_path": "report.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2e49cd2944e4d3223ce3165544aa70f72b485873",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "milinda/DataServingAndStorageForHTRC",
"max_issues_repo_path": "report.tex",
"max_line_length": 422,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2e49cd2944e4d3223ce3165544aa70f72b485873",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "milinda/DataServingAndStorageForHTRC",
"max_stars_repo_path": "report.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 985,
"size": 3644
} |
\lab{Intro to pandas II}{Intro to pandas II}
In this lab, we explore in further detail two specific areas where pandas can be a very useful tool:
analyzing sequential data, and working with large datasets that can't be stored entirely in memory.
\begin{warn}
This lab assumes pandas 0.14.0. Errors may occur if you have an earlier version.
You can check the version of pandas you are running by the following:
\begin{lstlisting}
>>> import pandas as pd
>>> pd.__version__
'0.14.0'
\end{lstlisting}
\end{warn}
\section*{Time Series Analysis}
A \emph{time series} is a particular type of data set that consists of a sequence of measurements or observations
generated at successive points in time. Examples include the yearly average temperate of a city, or
the price of a given stock measured daily.
\begin{comment}
This section needs beefing up. Topics to cover include:
-using the date_range function to create dateTimeIndexes
-showing different types of string reps that can be parsed, using format string to speed up parsing
-resampling of a time series to change frequency levels.
-slicing time series using date strings
-the truncate method for time series
-load in financial data, use some of the above techniques, do a fun, simple application.
\end{comment}
\section*{Working With Large Datasets}
In the real world, a data scientist is often confronted with large datasets that can't be held in memory all at once.
There are various solutions to this problem; in this section, we will explore how pandas uses the HDF5 file format
to allow us to work with datasets on disk.
HDF5, which stands for ``Hierarchical Data Format", is a data storage system especially suited for large numerical datasets.
Rich and efficient software libraries have been developed over the years to enable fast read and write operations,
which make HDF5 a competitive option for working with large datasets in many applications. The Python library pytables
is one such library, and the HDF5 capabilities in pandas are built directly on top of pytables.
We have two primary learning goals: how to get our data into the proper HDF5 format, and how to intelligently work with
the data once it's tidied up. Let's dive in.
\subsection*{Writing HDF5 Data}
The primary way we will interact with HDF5 data goes through the \li{HDFStore} object, which behaves somewhat like a dictionary.
To begin, let's instantiate such an object, and write data to it. Make sure to execute the code snippets throughout to ensure that
everything works as expected on your machine.
\begin{lstlisting}
>>> # we will create an HDFStore with the filename test_store.h5
>>> my_store = pd.HDFStore('test_store.h5')
>>> my_store
<class 'pandas.io.pytables.HDFStore'>
File path: test_store.h5
Empty
\end{lstlisting}
The file \li{'test_store.h5'} has just been created in your working directory, although it contains nothing as yet.
Write some pandas data to the store:
\begin{lstlisting}
>>> # instantiate data, write to store
>>> ts = pd.Series(index=['A', 'B', 'C', 'D'], data = np.random.randn(4))
>>> df = pd.DataFrame(index=range(6), columns=['a','b'], data=np.random.random((6,2)))
>>> my_store['ts'] = ts
>>> my_store['df'] = df
>>> my_store
<class 'pandas.io.pytables.HDFStore'>
File path: test_store.h5
/df frame (shape->[6,2])
/ts series (shape->[4])
\end{lstlisting}
Note the dict-like syntax for writing data to the store. We now see that the store contains two objects, which
can easily be retrieved in the following manner:
\begin{lstlisting}
>>> # retrieve the df from the store, check it is the same
>>> store_df = my_store['df']
>>> (df == store_df).all()
a True
b True
dtype: bool
\end{lstlisting}
Removing an object that you have written to the store can be accomplished as follows (although note that removing the
object doesn't necessarily free up space on the hard disk, so the file size may not decrease):
\begin{lstlisting}
>>> # let's remove the series ts
>>> del my_store['ts'] # or my_store.remove('ts')
>>> my_store
<class 'pandas.io.pytables.HDFStore'>
File path: test_store.h5
/df frame (shape->[6,2])
\end{lstlisting}
The read and write operations that we have explored so far work just fine for small objects that can fit entirely in memory,
but the story is different when it comes to writing large datasets to an HDF5 file. Suppose we have a CSV file containing the
large dataset that we want to work with. One basic approach to storing this data in HDF5 format is to read and write it by
\emph{chunks}, that is, move the data into an HDF5 store a few lines at a time. This ensures that we never have to read too much
of the data into memory at once.
The \li{read_csv} function in pandas allows for reading a file by chunks of rows. We simply need to specify the keyword argument
\li{chunksize}, which gives the number of rows of the file to read in each time. Most other pandas data readers have a similar
option for loading data by chunks. It is also important to specify the correct data types of each column when reading in the chunks
of data. This will ensure that a consistent data type is used when writing to the HDF5 store. To do this, create a dict that
maps each column name to its correct data type. Columns containing strings should have the \li{object} datatype, and columns
containing numerical data may be ints or floats. Any column that contains date data should NOT be included in the dictionary,
but rather should be passed as the \li{parse_dates} keyword argument (a list of the column names containing dates).
To iteratively write data to a single object in an HDF5 store, we must use the \li{append} method. This will store the data in a
particular format called a \emph{table}, an on-disk data structure geared toward efficient querying of the rows. There are a few
parameters that we must tune in order to write the data successfully.
\begin{itemize}
\item \li{key}: This is the target object in the HDF5 store to which we want to write.
\item \li{value}: This is the actual chunk of data (such as a \li{DataFrame}) that we want to append to the store.
\item \li{data_columns}: A list of the column names of the incoming data that should be indexed. You should include all
columns that you will use in subsequent queries of the data. For example, if my dataset has a column labeled `A', and I anticipate
wanting to select all rows where the value in column `A' is greater than, say, 0, then it is imperative that \li{data_columns} includes
`A'. Try to avoid including columns that aren't needed in the queries, as performance can decrease with a larger number of indexed
columns. This argument only needs to be specified for the \emph{first} chunk to be written.
\item \li{min_itemsize}: This is an int that specifies the maximum length of a string found in the dataset. If you are unsure of the
exact length of the longest string, try setting this to a high default value (say 100). If you attempt to write data containing
a string whose length exceeds \li{min_itemsize}, an error is raised. This argument is also only required for the first chunk.
\item \li{index}: This argument is a boolean flag that indicates whether the data should be indexed as it is written. By setting
\li{index=False}, the data is written much faster.
\end{itemize}
In the code below, we create a CSV file containing toy data, then write it by chunks to our HDF5 store.
\begin{lstlisting}
>>> # first create the toy CSV file
>>> n_rows = 10000
>>> n_cols = 3
>>> csv_path = 'toy_data.csv'
>>> csv_file = open(csv_path, 'w')
>>> csv_file.write("A B C\n")
>>> for i in xrange(n_rows):
>>> for num in np.random.randn(3):
>>> csv_file.write(' ' + str(num))
>>> csv_file.write('\n')
>>> csv_file.close()
>>> # now iteratively write the data to the store
>>> n_chunk = 1000
>>> col_types = {'A':np.float, 'B':np.float, 'C':np.float}
>>> reader = pd.read_csv(csv_path, sep=' ', dtype=col_types, index_col=False, chunksize=n_chunk, skipinitialspace=True)
>>> first = True # a flag for the very first chunk
>>> data_cols=['B', 'C'] # queries involving cols B and C will be allowed
>>> for chunk in reader:
>>> if first:
>>> my_store.append('toy_data', chunk, data_columns=data_cols, index=False)
>>> first = False
>>> else:
>>> my_store.append('toy_data', chunk, index=False)
>>> my_store
<class 'pandas.io.pytables.HDFStore'>
File path: test_store.h5
/df frame (shape->[6,2])
/toy_data frame_table (typ->appendable,nrows->10000,ncols->3,indexers->[index],dc->[B,C])
\end{lstlisting}
If an error of any type occurs when writing your data, and you need to start over, it is necessary to remove
the previously written data, since the \li{append} function doesn't overwrite existing data.
Now that the data is in the HDF5 store, we should index the table, which can speed up query operations.
This is done as follows:
\begin{lstlisting}
>>> my_store.create_table_index('toy_data', optlevel=9, kind='full')
\end{lstlisting}
Obviously the toy data in this example is small enough to fit in memory, but it illustrates a basic approach
to moving large datasets into a HDF5 store.
\begin{problem}
Write the data contained in the file \li{campaign.csv} to an HDF5 store using the chunking approach.
We recommend setting the \li{chunksize} argument to 50,000. There will be just over 100 chunks for this
chunk size, so you can track your progress by printing out a counter, if you wish. The whole writing
process will likely take a few minutes.
The file \li{campaign_format.txt} contains information about the dataset, including the column names and descriptions.
Consult this file and note which, if any, columns contain date information. Use this information to appropriately
set the \li{parse_dates} argument in the \li{read_csv} function. This argument should be a list of the column names
that include date information. Note also that some of the columns contain strings, so remember the
\li{min_itemsize} argument. Finally, you will be analyzing this data in the remainder of the lab, so glance over
the problems below to determine which columns need to be indexed.
Once you have finished writing to the store, create a table index for the data, just as shown in the example above.
\end{problem}
\subsection*{Working With On-Disk Arrays}
Now that we have the data in a HDF5 table, how do we work with it? The key here is to only read in subsets
of the data, since trying to read the entire dataset at once may result in swamping the memory and crashing
the system. The \li{select} method allows us to do just this. It takes two basic arguments: first, the name
of the table in the store that we want to query, and second, a query statement. Remember, the
query statement may not reference columns that weren't included in \li{data_columns}.
\begin{lstlisting}
>>> # this query is OK
>>> my_store.select('toy_data', where = ["'B' < 0", "'C' > 0"])
>>> # this query is NOT OK
>>> my_store.select('toy_data', where = ["'A' < .5"])
\end{lstlisting}
Note that each logical statement in the \li{where} list is combined with a logical AND.
Let's look at some simple examples with our campaign dataset. We assume that the data is in a HDF5 store called
\li{store}. Follow along to make sure you get the same results.
\begin{lstlisting}
>>> # get a list of the candidates; result should be 14 candidates
>>> cands = store.select_column('campaign', 'cand_nm').unique()
>>> # find number of contributions from UT
>>> n_UT = len(store.select('campaign',where = ["'contbr_st' == 'UT'", "columns='contbr_st'"]))
>>> n_UT
50462
>>> # find number of UT contributions to Romney
>>> n_rom_UT = len(store.select('campaign', where = ["'contbr_st' == 'UT'", "'cand_nm'=='Romney, Mitt'", "columns='contbr_st'"]))
>>> n_rom_UT
26962
>>> # proportion of UT contributions that went to Romney
>>> np.float(n_rom_UT)/n_UT
0.534303039911
\end{lstlisting}
\begin{problem}
How many contributors in California gave to Obama? To Romney?
\end{problem}
It is also possible to execute more complicated queries involving grouping operations, although some care is required.
Consider the following question: how many contributions came from each state, and what is the average contribution
from each state? To answer this question, we need to aggregate information grouped by each state. If we could hold
the data in memory, we could use a simply \li{groupby} operation, but since our data resides on disk, the solution is
a bit more involved. Fortunately, the \li{'contbr_st'} column alone is small enough to load into memory, so we do that.
We can then utilize the \li{Series} method \li{value_counts}, which counts the number of occurrences of each distinct
value in the column. In this way, we obtain a \li{Series} indexed by the states, and containing the number of
contributions from each state.
\begin{lstlisting}
>>> # load in the state column, then calculate the counts
>>> states = store.select_column('campaign','contbr_st')
>>> states = states.value_counts()
\end{lstlisting}
Next, we want to iterate through each state, and calculate the mean contribution.
\begin{lstlisting}
>>> st_contb = []
>>> for state in states.index:
>>> grp = store.select('campaign', where=["'contbr_st'=\"{}\"".format(state), "columns='contb_receipt_amt'"])
>>> st_contb.append(grp['contb_receipt_amt'].mean())
\end{lstlisting}
To tidy up our results, we create a \li{DataFrame} indexed by the state, containing the number of contributions
and average contribution. Then we plot top results.
\begin{lstlisting}
>>> state_info = pd.DataFrame({'Count':states, 'Avg Contb':st_contb})
>>> state_info.sort(columns='Count', ascending=False, inplace=True)
>>> plt.subplot(211)
>>> state_info['Count'][:10].plot(kind='bar')
>>> plt.subplot(212)
>>> state_info['Avg Contb'][:10].plot(kind='bar')
>>> plt.show()
\end{lstlisting}
Results are shown in Figure \ref{pandas:states}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{states.pdf}
\caption{Top 10 contributing states (top), and their average contributions (bottom).}
\label{pandas:states}
\end{figure}
\begin{problem}
Calculate the total net contributions to each candidate, and plot the results in a bar graph.
Your result should match Figure \ref{pandas:cand_contb}.
\end{problem}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{cand_contb.pdf}
\caption{Total net contributions to each candidate.}
\label{pandas:cand_contb}
\end{figure}
\begin{problem}
Calculate the frequency of the 20 most common occupations of contributors in the dataset.
Also calculate the average positive contribution amount for each of these 20 occupations.
Plot the results in two bar graphs. You results should match Figure \ref{pandas:occupation}.
\end{problem}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{occupation.pdf}
\caption{Top 20 occupations of contributors (above) and average contribution of each
occupation (below).}
\label{pandas:occupation}
\end{figure}
What if you are interested in the contributions to a candidate as a function of time?
Let's first aim to create a \li{DataFrame} containing the contribution amount and date for
all contributions going to Ron Paul.
\begin{lstlisting}
>>> cand = 'Paul, Ron'
>>> cand_contb = store.select('campaign', where=["'cand_nm'==\"{}\"".format(cand)])[['contb_receipt_amt', 'contb_receipt_dt']]
\end{lstlisting}
Next, we need to group by date, and apply the sum function to add up contributions for each particular date.
This can be done with the \li{groupby} function as follows:
\begin{lstlisting}
>>> contb = cand_contb.groupby(by='contb_receipt_dt').sum()
\end{lstlisting}
Plotting this time series yields Figure \ref{pandas:paul}.
\begin{figure}
\centering
\includegraphics[width=\textwidth]{paul.pdf}
\caption{Campaign Contributions to Ron Paul over time.}
\label{pandas:paul}
\end{figure}
\begin{problem}
Plot the running total of campaign contributions as a function of time
for Mitt Romney, Barack Obama, and Newt Gingrich (all on the same graph).
Your results should match Figure \ref{pandas:cand_time}.
\end{problem}
\begin{figure}
\centering
\includegraphics[width=\textwidth]{cand_time.pdf}
\caption{Running contribution totals for three candidates.}
\label{pandas:cand_time}
\end{figure}
Each data project brings with it a new set of problems and pitfalls, but a careful application of the principles
in this lab will provide a good starting point for working with large datasets in pandas.
| {
"alphanum_fraction": 0.7514175413,
"avg_line_length": 51.9686520376,
"ext": "tex",
"hexsha": "f62a41b66d7e6735feec76bd838cece09768e4cf",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2020-06-20T09:05:06.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-05-14T16:07:59.000Z",
"max_forks_repo_head_hexsha": "cc71f51f35ca74d00e617af3d1a0223e19fb9a68",
"max_forks_repo_licenses": [
"CC-BY-3.0"
],
"max_forks_repo_name": "jessicaleete/numerical_computing",
"max_forks_repo_path": "Python/PandasII/pandasII.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "cc71f51f35ca74d00e617af3d1a0223e19fb9a68",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-3.0"
],
"max_issues_repo_name": "jessicaleete/numerical_computing",
"max_issues_repo_path": "Python/PandasII/pandasII.tex",
"max_line_length": 135,
"max_stars_count": 10,
"max_stars_repo_head_hexsha": "cc71f51f35ca74d00e617af3d1a0223e19fb9a68",
"max_stars_repo_licenses": [
"CC-BY-3.0"
],
"max_stars_repo_name": "jessicaleete/numerical_computing",
"max_stars_repo_path": "Python/PandasII/pandasII.tex",
"max_stars_repo_stars_event_max_datetime": "2021-10-09T20:12:38.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-10-18T19:54:25.000Z",
"num_tokens": 4058,
"size": 16578
} |
% = = = = = = = = = = = = = = = = = = = = = %
% Conclusion %
% = = = = = = = = = = = = = = = = = = = = = %
\let\clearpage\relax
\chapter{Discussions and Conclusion}
\blindtext
\section{Figures}
\subsection{Single Figure}
\begin{figure}[!htp]
\centering
\includegraphics[scale=0.5]{example-image-a}
\caption{Figure-A.}
\label{fig:a}
\end{figure}
\subsection{Subfigures}
\begin{figure}[!htp]
\begin{minipage}{0.48\textwidth}
\centering
% include first image
\includegraphics[scale=0.5]{example-image-a}
\caption{Subfigure-A.}
\label{fig:sub_a}
\end{minipage}\hfill
\begin{minipage}{0.48\textwidth}
\centering
% include second image
\includegraphics[scale=0.5]{example-image-b}
\caption{Subfigure-B.}
\label{fig:sub_b}
\end{minipage}
\end{figure}
\section{Table}
\begin{table}[!htp]
\begin{center}
\caption{Table-1.}
\label{tab:tab-1}
\begin{tabular}{cc}
\toprule
Item & Value \\
\midrule
A & 1,000 \\
B & 2,000 \\
C & 3,000 \\
\bottomrule
\end{tabular}
\end{center}
\end{table}
\section{Citation}
Single document with available page number~\quickcite{kopka1995guide}.
Single document without available page number~\quickcitenopage{kottwitz2015latex}.
Two documents at the same time~\quickcitetwo{lamport1985i1}{kopka1995guide}.
| {
"alphanum_fraction": 0.5568551007,
"avg_line_length": 23.6769230769,
"ext": "tex",
"hexsha": "4b3de1ed30de9e662082aa0ba13b4bca9b127703",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "224c1d798e772f39043401afafb3832ef1fe2518",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "UMJI-VE450-21SU/SJTU-Thesis-JI-Adaption",
"max_forks_repo_path": "sections/100-format.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "224c1d798e772f39043401afafb3832ef1fe2518",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "UMJI-VE450-21SU/SJTU-Thesis-JI-Adaption",
"max_issues_repo_path": "sections/100-format.tex",
"max_line_length": 82,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "224c1d798e772f39043401afafb3832ef1fe2518",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "UMJI-VE450-21SU/SJTU-Thesis-JI-Adaption",
"max_stars_repo_path": "sections/100-format.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 480,
"size": 1539
} |
Every Rust program has at least one function, the \code{main} function:
\begin{rustc}
fn main() {
}
\end{rustc}
This is the simplest possible function declaration. As we mentioned before, \code{fn} says 'this is a function', followed by
the name, some parentheses because this function takes no arguments, and then some curly braces to indicate the body. Here's
a function named \code{foo}:
\begin{rustc}
fn foo() {
}
\end{rustc}
So, what about taking arguments? Here's a function that prints a number:
\begin{rustc}
fn print_number(x: i32) {
println!("x is: {}", x);
}
\end{rustc}
Here's a complete program that uses \code{print\_number}:
\begin{rustc}
fn main() {
print_number(5);
}
fn print_number(x: i32) {
println!("x is: {}", x);
}
\end{rustc}
As you can see, function arguments work very similar to \keylet\ declarations: you add a type to the argument name, after a
colon.
\blank
Here's a complete program that adds two numbers together and prints them:
\begin{rustc}
fn main() {
print_sum(5, 6);
}
fn print_sum(x: i32, y: i32) {
println!("sum is: {}", x + y);
}
\end{rustc}
You separate arguments with a comma, both when you call the function, as well as when you declare it.
\blank
Unlike \keylet, you must declare the types of function arguments. This does not work:
\begin{rustc}
fn print_sum(x, y) {
println!("sum is: {}", x + y);
}
\end{rustc}
You get this error:
\begin{verbatim}
expected one of `!`, `:`, or `@`, found `)`
fn print_number(x, y) {
\end{verbatim}
This is a deliberate design decision. While full-program inference is possible, languages which have it, like Haskell, often
suggest that documenting your types explicitly is a best-practice. We agree that forcing functions to declare types while
allowing for inference inside of function bodies is a wonderful sweet spot between full inference and no inference.
\blank
What about returning a value? Here's a function that adds one to an integer:
\begin{rustc}
fn add_one(x: i32) -> i32 {
x + 1
}
\end{rustc}
Rust functions return exactly one value, and you declare the type after an 'arrow', which is a dash (\code{-}) followed by a
greater-than sign (\code{>}). The last line of a function determines what it returns. You'll note the lack of a semicolon here.
If we added it in:
\begin{rustc}
fn add_one(x: i32) -> i32 {
x + 1;
}
\end{rustc}
We would get an error:
\begin{verbatim}
error: not all control paths return a value
fn add_one(x: i32) -> i32 {
x + 1;
}
help: consider removing this semicolon:
x + 1;
^
\end{verbatim}
This reveals two interesting things about Rust: it is an expression-based language, and semicolons are different from semicolons
in other 'curly brace and semicolon'-based languages. These two things are related.
\subsection*{Expressions vs. Statements}
Rust is primarily an expression-based language. There are only two kinds of statements, and everything else is an expression.
\blank
So what's the difference? Expressions return a value, and statements do not. That's why we end up with 'not all control paths
return a value' here: the statement \code{x + 1;} doesn't return a value. There are two kinds of statements in Rust: 'declaration
statements' and 'expression statements'. Everything else is an expression. Let's talk about declaration statements first.
\blank
In some languages, variable bindings can be written as expressions, not statements. Like Ruby:
\begin{verbatim}
x = y = 5
\end{verbatim}
In Rust, however, using \keylet\ to introduce a binding is \emph{not} an expression. The following will produce a compile-time
error:
\begin{rustc}
let x = (let y = 5); // expected identifier, found keyword `let`
\end{rustc}
The compiler is telling us here that it was expecting to see the beginning of an expression, and a \keylet\ can only begin a
statement, not an expression.
\blank
Note that assigning to an already-bound variable (e.g. \code{y = 5}) is still an expression, although its value is not
particularly useful. Unlike other languages where an assignment evaluates to the assigned value (e.g. \code{5} in the previous
example), in Rust the value of an assignment is an empty tuple \code{()} because the assigned value can have only one owner
(see \nameref{sec:syntax_ownership}), and any other returned value would be too surprising:
\begin{rustc}
let mut y = 5;
let x = (y = 6); // x has the value `()`, not `6`
\end{rustc}
The second kind of statement in Rust is the \emph{expression statement}. Its purpose is to turn any expression into a statement.
In practical terms, Rust's grammar expects statements to follow other statements. This means that you use semicolons to separate
expressions from each other. This means that Rust looks a lot like most other languages that require you to use semicolons at the
end of every line, and you will see semicolons at the end of almost every line of Rust code you see.
\blank
What is this exception that makes us say "almost"? You saw it already, in this code:
\begin{rustc}
fn add_one(x: i32) -> i32 {
x + 1
}
\end{rustc}
Our function claims to return an \itt, but with a semicolon, it would return \code{()} instead. Rust realizes this
probably isn't what we want, and suggests removing the semicolon in the error we saw before.
\subsection*{Early returns}
But what about early returns? Rust does have a keyword for that, \code{return}:
\begin{rustc}
fn foo(x: i32) -> i32 {
return x;
// we never run this code!
x + 1
}
\end{rustc}
Using a \code{return} as the last line of a function works, but is considered poor style:
\begin{rustc}
fn foo(x: i32) -> i32 {
return x + 1;
}
\end{rustc}
The previous definition without \code{return} may look a bit strange if you haven't worked in an expression-based language
before, but it becomes intuitive over time.
\subsection*{Diverging functions}
Rust has some special syntax for 'diverging functions', which are functions that do not return:
\begin{rustc}
fn diverges() -> ! {
panic!("This function never returns!");
}
\end{rustc}
\panic\ is a macro, similar to \code{println!()} that we've already seen. Unlike \code{println!()}, \code{panic!()} causes
the current thread of execution to crash with the given message. Because this function will cause a crash, it will never return,
and so it has the type '\code{!}', which is read 'diverges'.
\blank
If you add a main function that calls \code{diverges()} and run it, you'll get some output that looks like this:
\begin{verbatim}
thread '<main>' panicked at 'This function never returns!', hello.rs:2
\end{verbatim}
If you want more information, you can get a backtrace by setting the \code{RUST\_BACKTRACE} environment variable:
\begin{verbatim}
$ RUST_BACKTRACE=1 ./diverges
thread '<main>' panicked at 'This function never returns!', hello.rs:2
stack backtrace:
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w
3: 0x7f402773960e - rt::unwind::begin_unwind_inner::h2844b8c5e81e79558Bw
4: 0x7f4027738893 - rt::unwind::begin_unwind::h4375279447423903650
5: 0x7f4027738809 - diverges::h2266b4c4b850236beaa
6: 0x7f40277389e5 - main::h19bb1149c2f00ecfBaa
7: 0x7f402773f514 - rt::unwind::try::try_fn::h13186883479104382231
8: 0x7f402773d1d8 - __rust_try
9: 0x7f402773f201 - rt::lang_start::ha172a3ce74bb453aK5w
10: 0x7f4027738a19 - main
11: 0x7f402694ab44 - __libc_start_main
12: 0x7f40277386c8 - <unknown>
13: 0x0 - <unknown>
\end{verbatim}
\code{RUST\_BACKTRACE} also works with Cargo's \code{run} command:
\begin{verbatim}
$ RUST_BACKTRACE=1 cargo run
Running `target/debug/diverges`
thread '<main>' panicked at 'This function never returns!', hello.rs:2
stack backtrace:
1: 0x7f402773a829 - sys::backtrace::write::h0942de78b6c02817K8r
2: 0x7f402773d7fc - panicking::on_panic::h3f23f9d0b5f4c91bu9w
3: 0x7f402773960e - rt::unwind::begin_unwind_inner::h2844b8c5e81e79558Bw
4: 0x7f4027738893 - rt::unwind::begin_unwind::h4375279447423903650
5: 0x7f4027738809 - diverges::h2266b4c4b850236beaa
6: 0x7f40277389e5 - main::h19bb1149c2f00ecfBaa
7: 0x7f402773f514 - rt::unwind::try::try_fn::h13186883479104382231
8: 0x7f402773d1d8 - __rust_try
9: 0x7f402773f201 - rt::lang_start::ha172a3ce74bb453aK5w
10: 0x7f4027738a19 - main
11: 0x7f402694ab44 - __libc_start_main
12: 0x7f40277386c8 - <unknown>
13: 0x0 - <unknown>
\end{verbatim}
A diverging function can be used as any type:
\begin{rustc}
let x: i32 = diverges();
let x: String = diverges();
\end{rustc}
\subsection*{Function pointers}
We can also create variable bindings which point to functions:
\begin{rustc}
let f: fn(i32) -> i32;
\end{rustc}
\code{f} is a variable binding which points to a function that takes an \itt\ as an argument and returns an \itt.
For example:
\begin{rustc}
fn plus_one(i: i32) -> i32 {
i + 1
}
// without type inference
let f: fn(i32) -> i32 = plus_one;
// with type inference
let f = plus_one;
\end{rustc}
We can then use \code{f} to call the function:
\begin{rustc}
let six = f(5);
\end{rustc}
| {
"alphanum_fraction": 0.7222939531,
"avg_line_length": 31.3986486486,
"ext": "tex",
"hexsha": "82a3d2aaf485af0f94e6d96d5532ce5abfcfb693",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2d86097002e09eb6338a8b2c143da86dec81092e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Darth-Revan/rust-lang_Doc-LaTeX",
"max_forks_repo_path": "src/syntax/functions.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2d86097002e09eb6338a8b2c143da86dec81092e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Darth-Revan/rust-lang_Doc-LaTeX",
"max_issues_repo_path": "src/syntax/functions.tex",
"max_line_length": 130,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "2d86097002e09eb6338a8b2c143da86dec81092e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Darth-Revan/rust-lang_Doc-LaTeX",
"max_stars_repo_path": "src/syntax/functions.tex",
"max_stars_repo_stars_event_max_datetime": "2017-07-21T14:09:39.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-07-21T14:09:39.000Z",
"num_tokens": 2811,
"size": 9294
} |
% !TeX root = ../main.tex
\section{Rust and Lifetimes}\label{section:background-rust}
We provide here a short introduction of some concepts of \rust that are relevant for this thesis.
A more detailed introduction of the programming language can be found in the official \rust book \cite{RustBook} and the \emph{Rustonomicon} \cite{Rustonomicon}.
\rust aims to provide a fast and yet safe programming language.
Our focus is to examine its memory model, to see how it can provide automatic memory management without garbage collection.
The three main terms related to this are \emph{ownership}, \emph{borrowing} and \emph{lifetimes}.
Reed \cite{Patina} established a formal model for the key features that provide memory safety and proved soundness of that model.
\subsection{Stack, Heap and Ownership}
Like many programming languages, \rust allows to allocate memory on the stack or on the heap.
The stack is an automatically managed portion of memory, where each function execution allocates a so-called \emph{stack frame} that contains all local variables.
The stack-frame will be freed automatically once the function returns and therefore anything allocated there cannot outlive the function itself.
On the other hand, the heap is a portion of memory that is managed more dynamically.
Memory there can live longer than a single function execution.
In \rust, we can use \emph{variable bindings} to bind a value to a name.
The following program simply binds an integer \rustinline{42} to the variable \rustinline{x}.
\begin{rustcode}
fn main() {
let x = 42;
}
\end{rustcode}
The compiler will insert an integer with value \rustinline{42} into the current stack frame and use its address whenever \rustinline{x} is used.\footnote{For the sake of simplicity we do not consider unspilled variables stored in registers and ignore optimizations like constant propagation.} Variable \rustinline{x} is said to \emph{own} that portion of memory.
When the owner goes out of scope, the memory will be freed.
The scope of a variable is just the enclosing pair of curly braces \rustinline{{ }}.
In this example there is nothing special to do, as the stack frame holding our integer will be freed automatically once function \rustinline{main} returns.
Consider now a different program.
Since all addresses within a stack frame have to be calculated at compile time, we cannot store constructs of unknown size in it.
Instead, that data has to be stored on the heap.
One example for constructs of variable size in \rust are vectors.
\begin{rustcode}
fn main() {
let fib = vec![1, 1, 2, 3, 5, 8];
}
\end{rustcode}
This example creates a vector containing the first six Fibonacci numbers.
Internally, the vector is stored as a triple denoting its current length, its capacity and a pointer to the actual data on the heap.
In line~3, variable \rustinline{fib} goes out of scope.
The vector owned by it will then be deallocated, which includes freeing its data on the heap.
This deallocation step happens directly and deterministically in line~3.
There is no need for reference counting or a garbage collector that eventually finds some unreachable vector data on the heap.
Note that a vector in \rust differs from an \javainline{ArrayList} in \java:
to access an element in a vector, we have to take the address of the data pointer, add a calculated offset and access the resulting address.
These pointers are called \emph{fat pointers}, because they store additional information (length and capacity) together with the address.
For an \javainline{ArrayList}, we must first dereference the list object.
Then we read the reference to the contained array, add the appropriate offset and access that address.
There are two dereference operations necessary while only one is needed for vectors in \rust.
Dereferences are expensive, because the machine's caching system does not benefit from fetching larger blocks \cite{kahn1998mechanism}.
\subsection{Move Semantics}
One important property of \rust's safety system is that there must only be one owner for each memory location at any time.
When we simply assign one variable to another, then ownership is transferred because \rust uses so-called \emph{move semantics}.
Consider the following modified program:
\begin{rustcode}
fn main() {
let mut fib = vec![1, 1, 2, 3, 5, 8];
let mut fib2 = fib;
fib2.push(13);
println!("fib[0] is {}", fib[0]); // illegal
}
\end{rustcode}
First of all we notice the newly inserted \rustinline{mut} keyword.
It states that the bound value is mutable, i.e. we can later modify the assigned vector.
In line~3, we assign our vector from variable \rustinline{fib} to a new variable \rustinline{fib2}.
In line~4, we append one more number to that vector.
The following will happen internally: we start with our initial vector, where length, capacity and a pointer is stored on the stack and the actual data on the heap.
In line~3, we \emph{move} \rustinline{fib} to \rustinline{fib2}.
Moving means that all data at \rustinline{fib}'s memory location will be copied to \rustinline{fib2}.
So we copy the triple consisting of length, capacity and pointer, but not the actual vector elements.
The operation therefore runs in constant time, independent of the vector's length.
Now we push a new entry to that vector.
That updates the vector's length and adds the new element.
If the capacity does not allow to add an element, a new and bigger portion of memory will be allocated on the heap such that the data can be transfered there.
Afterwards, the pointer is updated and the old heap data freed.
The last line now tries to access the vector through our old name \rustinline{fib}.
This is illegal, as the value has moved to the new name \rustinline{fib2}.
If we allow accessing it via its old variable, then we might access a dangling pointer.
The \rustinline{push} call in the previous line might have deallocated the old data array after allocating a bigger one.
The semantics of \rust therefore forbids using moved variable bindings.
For some types this protection provided by move semantics is not necessary.
For example, a primitive type like a number or boolean value can just be copied without invalidating the old binding.
\rust uses a marker trait called \rustinline{Copy} to identify those types.
After doing an assignment with such a type, there are two independent values with separate owners.
All primitive types are \rustinline{Copy}.
\rustinline{Copy} can be derived for records if all their fields are \rustinline{Copy}.
More complex types like vectors are not \rustinline{Copy}.
Some types that are not marked as \rustinline{Copy} can still be \emph{cloned} explicitly, but this process involves creating a complete deep copy, which is expensive for big data structures.
\subsection{Boxes and Reference-Counted Pointers}
Even bigger structures can be allocated on the stack, if their size is statically known.
To avoid moving around big structures, we can explicitly allocate them on the heap.
\rust uses the type \rustinline{Box} for a heap-allocated portion of memory.
A \rustinline{Box} is just a pointer to the heap.
It is similar to a vector with length one, but as the length cannot change there is no need to store length or capacity.
Each \rustinline{Box} has a single owner.
Once the owner goes out of scope, the \rustinline{Box}'s content on the heap will be deallocated.
For moving a \rustinline{Box}, only the pointer itself has to be copied into the new location.
This happens analogue to the behavior already described for vectors.
Boxes are allocated with \rustinline{let b = Box::new(5)} and can be accessed as \rustinline{*b}.
In some cases it might be very difficult to find a flow through your program such that a \rustinline{Box} always has only one owner.
For these cases, \rust provides the type \rustinline{Rc} which are \emph{reference-counted} pointers.
This type imposes a runtime overhead, as it manages a counter that tracks how many pointers to it exist.
The \rustinline{Rc} owns its contained value and deallocates it when the last pointer to it goes out of scope.
\rustinline{Rc} cannot be shared over different threads in a multi-threaded scenario.
There is a special type \rustinline{Arc} (\emph{atomic \rustinline{Rc}}) for that use case.
It has proper synchronization and therefore imposes more overhead than the simpler \rustinline{Rc}.
The programmer has to be aware that cyclic reference counted structures will not be freed automatically and therefore lead to memory leaks \cite{RustCycles}.
These cycles have to be broken manually.
\subsection{Borrowing}
Instead of moving the value and thereby transferring ownership to another variable, the owner can also \emph{lend} a value to another variable that \emph{borrows} it for a specific amount of time.
Borrowing allows to give another variable or a called function access to a value without transferring ownership.
\begin{rustcode}
fn main() {
let fib_original = vec![1, 1, 2, 3, 5, 8];
let fib_borrowed = &fib_original;
println!("The 4th fibonacci number is {}", fib_original[4]);
println!("The 5th fibonacci number is {}", fib_borrowed[5]);
}
\end{rustcode}
The notation \rustinline{let fib_borrowed = &fib_original} states that \rustinline{fib_borrowed} borrows the vector from \rustinline{fib_original}.
We can access it through both names, as \rustinline{fib_borrowed} is just a reference to the original value.
This immediately should raise the question how to prevent the situation described above, where one of both variables contains a dangling pointer after an update.
To see how that problem is solved, we again need to consider mutability.
As seen before, variable bindings must be declared with the \rustinline{mut} keyword to allow the value to be modified.
There are mutable and immutable values.
The same holds for borrowed references: A value can be borrowed mutable or immutable.
Consider the following program:
\begin{rustcode}
fn main() {
let mut fib_original = vec![1, 1, 2, 3, 5, 8];
let fib_borrowed = &fib_original;
println!("The 4th fibonacci number is {}", fib_original[4]);
fib_original.push(13); // illegal
println!("The 5th fibonacci number is {}", fib_borrowed[5]);
}
\end{rustcode}
This program contains four borrowings: the immutable borrowing in line~3 is directly visible.
But there are two more immutable borrowings in line~4 and 6 to read the value that is printed.
And finally there is a mutable borrowing in line~5.
The type \rustinline{Vec<T>} contains a function \rustinline{fn push(&mut self, value: T)}, which is the one called in line~5.
\rustinline{&mut self} hereby means that the object receiving the function call is borrowed mutable until the function returns.
Another way to borrow the vector mutable would be to replace line~3 by \rustinline{let mut fib_borrowed = &mut fib_original;}.
One fundamental principle of \rust's borrow system is that there can be only a single mutable borrowing or multiple immutable borrowings at any time.
In line~3 of the program above \rustinline{fib_borrowed} borrows \rustinline{fib_original} immutable.
That borrowing remains as long as \rustinline{fib_borrowed} stays in scope, i.e. until the closing brace in line~7.
Line~4 is allowed, as it just initiates a second immutable borrowing lasting for that single statement, and multiple immutable borrowings are allowed.
If we had changed line~3 to a mutable borrowing, line~4 would already have been illegal as it would have combined a mutable borrowing with an immutable one.
Line~5 attempts to borrow \rustinline{fib_original} mutable while it is still borrowed immutable by \rustinline{fib_borrowed}.
This is not allowed and the program gets rejected by the compiler's borrow checker.
These constraints might look restrictive, but they provide a safe memory model without additional runtime checks.
Data races are avoided by design, as they would need two pointers to the same variables where at least one of them is mutable.
Consider the following example that iterates over a vector:
\begin{rustcode}
fn main() {
let mut fib = vec![1, 1, 2, 3, 5, 8];
for x in &fib {
// ...
}
fib.push(13);
}
\end{rustcode}
Hidden in syntactic sugar within line~3, we implicitly call the \rustinline{iter} function on \rustinline{fib} which borrows the vector immutable until the end of our loop.
Therefore, we cannot modify the vector within the loop.
However, line~6 is fine as the immutable borrowing ends in line~5 and we can borrow the vector mutable afterwards.
Modifying what you are iterating over is problematic also in other languages.
If you try to modify a Collection in \java while iterating over it, the iterator will throw a \javainline{ConcurrentModificationException} at runtime.
\rust does not allow that situation and the program does not compile in the first place.
\subsection{Lifetimes}
Memory whose owner goes out of scope will be freed.
This is either unavoidable, as the memory is allocated on the stack and the enclosing stack frame will be deallocated once the function returns, or it is by design to manage heap-allocated memory without garbage collection.
In either case we must ensure that there are no other accessible references to the freed portion of memory.
This is why \rust enforces one simple rule for borrowed references: a borrowed reference must not outlive the actual value.
Consider the following program:
\begin{rustcode}
fn main() {
let mut x = &1;
{
let y = 2;
x = &y; // illegal
}
println!("x points to value {}", *x);
}
\end{rustcode}
Line~2 allocates memory for an integer with value \rustinline{1}.
A pointer to this memory is stored into another portion of memory, which is bound to variable \rustinline{x}.
The curly braces start a new scope that spreads from line~3 to 6.
Inside this scope, we allocate another integer that is bound to \rustinline{y}.
Afterwards we try to store a reference to it into \rustinline{x}.
This is not allowed! The memory bound to \rustinline{y} will be freed once \rustinline{y} goes out of scope.
This is at line~6.
As \rustinline{x} is still in scope, we might still access it.
In fact, we attempt to read the integer pointed to by \rustinline{x} in line~7.
As \rustinline{y} has been deallocated, we access a dangling pointer.
The \rust compiler rejects the program above due to \emph{lifetimes}.
Each value and each borrowing is assigned with a lifetime.
It describes a part of the program where that value can be used, i.e. roughly the scope of its declaration.
The lifetime for a local variable starts at its declaration and ends at the end of its enclosing scope.
In our example, lifetime of \rustinline{x} goes from line~2 to line~8 and lifetime of \rustinline{y} from line~4 to line~6.
In line~5, \rustinline{x} tries to borrow the value of \rustinline{y}, but it's own lifetime is longer than the lifetime of \rustinline{y}.
We say that the lifetime of \rustinline{y} does not \emph{outlive} the lifetime of \rustinline{x}.
This is not allowed.
There is no runtime overhead for checking lifetimes, as they are just a restriction checked by the compiler to ensure memory safety.
To handle lifetimes across functions, \rust offers lifetime parameters.
Consider the following program:
\begin{rustcode}
fn inc<'a>(x : &'a mut u32) -> &'a mut u32 {
*x = *x + 1;
return x;
}
fn main() {
let mut x = 1;
let p = inc(&mut x);
}
\end{rustcode}
Function \rustinline{inc} is declared to take one parameter \rustinline{x} that is a mutable reference to an unsigned 32 bit integer.
The return value will also be a reference to such an integer.
And the annotated lifetime \rustinline{'a} states that both references will have the same lifetime.
While the above program is fine, the following modification will not compile:
\begin{rustcode}
fn main() {
let p : &u32; // uninitialized declaration
{
let mut x = 1;
p = inc(&mut x); // illegal
}
println!("p points to {}", *p);
}
\end{rustcode}
Because \rustinline{inc} returns a reference of the same lifetime as it gets passed as as an argument, the lifetime of the argument \rustinline{x} in line~5 must be at least the lifetime of \rustinline{p}, where the result gets assigned to.
But \rustinline{x} does not outlive \rustinline{p} because it is declared in a smaller scope.
If the function has only one reference type parameter, then you can leave out lifetime parameters, as \rust automatically declares a lifetime parameter for that reference type and assigns it to all reference types in the return value.
This feature is called \emph{lifetime elision}\footnote{Lifetime elision actually can handle more cases than described here.
They are not needed for a basic understanding and therefore left out for simplicity.}.
\subsection{Variance and Subtyping}
In \rust, lifetimes are part of the type system and must therefore be considered when talking about subtyping.
To understand the subtyping constraints defined by a programming language, it is helpful to ask the following question:
\textit{if I expect type T, what other types can I be given without breaking safety?}
For the following, we consider two types \emph{Square} and \emph{Rectangle}, where \emph{Square} is a subtype of \emph{Rectangle}.
If you expect to get an immutable reference to a rectangle, you can safely use a mutable one instead;
you just do not make use of its ability to mutate the value pointed to.
There is also no problem if the provided reference is actually a reference to a square, because its special characteristic does not affect read-only access.
Lastly, if the given reference has a longer lifetime than expected, then you can still safely access it.
If the expected reference is a mutable reference to a rectangle, then the provided one must obviously be mutable.
But now we cannot accept a reference to a square:
you might want to store a non-quadric rectangle to it.
This would break safety for other readers that still expect the reference to point to a square.
To summarize and formalize, the following rules hold for subtyping in \rust (cf. \cite{Rustonomicon}):
\begin{itemize}
\item \rustinline{&'a mut T} is a subtype of \rustinline{&'a T}
\item \rustinline{&'a T} is covariant over \rustinline{'a} and \rustinline{T}
\item \rustinline{&'a mut T} is covariant over \rustinline{'a} but invariant over \rustinline{T}
\end{itemize}
\subsection{Summary: Different Ways to Store and Share Values}
We have seen different ways to store values in a \rust program.
Most importantly, every value needs a single owner at all times.
A value can be directly owned by a local variable.
These \emph{variable bindings} are \emph{immutable} unless declared as \emph{mutable} using the \rustinline{mut} keyword.
A normal assignment always \emph{moves} the value, which makes the former name invalid for future access.
To share a value, it can be \emph{borrowed} by another reference, using the \rustinline{&T} and \rustinline{&mut T} types.
A borrowing is immutable unless the \rustinline{mut} keyword is used.
The borrow checker imposes constraints to prevent data races.
Furthermore, each borrowing has a \emph{lifetime} that must be within the lifetime of the borrowed value.
To store a value on the heap, a \rustinline{Box} can be used.
It owns its contained value, but needs a single owner for itself.
If you are unable to provide a single owner for a value, then it can be wrapped in one of the types \rustinline{Rc} or \rustinline{Arc}, but that imposes runtime overhead.
| {
"alphanum_fraction": 0.7799733114,
"avg_line_length": 60.1358024691,
"ext": "tex",
"hexsha": "3ac28c6a460ca70ac4d6b64e6e3ba17860ec937c",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "bf75f44d79deb57c2133624cd08dd92b11e0b951",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "SebastianS90/MastersThesis",
"max_forks_repo_path": "thesis/content/021_rust.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bf75f44d79deb57c2133624cd08dd92b11e0b951",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "SebastianS90/MastersThesis",
"max_issues_repo_path": "thesis/content/021_rust.tex",
"max_line_length": 362,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "bf75f44d79deb57c2133624cd08dd92b11e0b951",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "SebastianS90/MastersThesis",
"max_stars_repo_path": "thesis/content/021_rust.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4561,
"size": 19484
} |
%!TEX root = ../thesis.tex
\chapter{Conclusion and Future works}
\ifpdf
\graphicspath{{Chapter1/Figs/Raster/}{Chapter1/Figs/PDF/}{Chapter1/Figs/}}
\else
\graphicspath{{Chapter1/Figs/Vector/}{Chapter1/Figs/}}
\fi
Fraud detection is a challenging and complex problem in many real-world applications, particularly credit card fraud detection problem. This thesis investigates on how to use Machine Learning and Data Science to address some of the issues in this problem. This chapter summarizes the main results of this thesis, discusses open issues and presents our future work.
Chapter 3 is the survey on various challenges of the fraud detection problem, with each challenge we also presented some most suitable solutions. After they are analyzed, we have proposed the most simple and effective strategy to build the Fraud Detection Pipeline that could be used as the backbone of one fraud detection system. Based on our Fraud Detection Pipeline, we also suggest many ways to extend or upgrade it. With this comprehensive survey, we want to write more details and clearly to contribute to the community the most recent works in the fraud detection problem.
Using our Fraud Detection Pipeline, which requires to update all models in the system every time frame (e.g daily), in chapter 4 we presented the mechanism to predict the improvement if we update a model, then with the pre-defined threshold we could decide which model need to update. The result shows that our system reduces the number of update times significantly, i.e 80\%. In future work, we want to replace the pre-defined threshold with a dynamic threshold that can make our system more stable and also not-sensitive with our parameter.
In the Fraud Detection Pipeline, we have proposed to use undersampling technique and ensemble learning for the credit card fraud detection dataset, which is not only huge but also very high imbalanced. In chapter 5, we presented the study of this combination on the case of extremely imbalanced big data classification and the result shows that our approach is very effective and promising if the dataset is bigger or more imbalance. In future work, we want to investigate deeper on this new gap of two difficult problems, e.g feature selection on the extremely imbalanced big data classification.
Most of the Machine Learning algorithms are applied to the fraud detection problem, but the graph-based learning has not been considered. In chapter 6, we used the graph p-Laplacian based semi-supervised learning with undersampling on this problem and the result shows that it outperforms the current state of the art graph Laplacian based semi-supervised method. Finding the relationship of the fraud network is one of the hardest tasks in the fraud detection problem and the graph-based learning attracts more attention recently. In future work, we want to apply the graph-based learning to detect the fraud networks in our data.
| {
"alphanum_fraction": 0.8098471986,
"avg_line_length": 155,
"ext": "tex",
"hexsha": "5546cb314b9e27f54c91564c7f058f919fd4bde3",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "218b3b6a1a6dc02b19b360b5bf903612d34dd0d9",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "88d52bdba0366127fffca9dfa93895/thesis-master",
"max_forks_repo_path": "Chapter7/chapter7.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "218b3b6a1a6dc02b19b360b5bf903612d34dd0d9",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "88d52bdba0366127fffca9dfa93895/thesis-master",
"max_issues_repo_path": "Chapter7/chapter7.tex",
"max_line_length": 631,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "218b3b6a1a6dc02b19b360b5bf903612d34dd0d9",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "88d52bdba0366127fffca9dfa93895/thesis-master",
"max_stars_repo_path": "Chapter7/chapter7.tex",
"max_stars_repo_stars_event_max_datetime": "2018-11-04T04:14:28.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-11-04T04:14:28.000Z",
"num_tokens": 581,
"size": 2945
} |
\subsection{Attack on 3.5-step \aead{} Instances without Rate Whitening}
Consider an instance of \aead{} with the rate equal to the capacity (i.e. one of
\aeadversion{128}{128},
\aeadversion{192}{192},
\aeadversion{256}{256}),
which uses the \aCipher{} permutation reduced to 3 steps and has no rate whitening.
Let $y$ denote the output of the linear Feistel function $\M$ in second step (as shown in Figure~\ref{fig:mitm3.5nowhit}). It lies on the following \emph{cyclic} structure (marked with dashed red rectangle):
{\FigTex{mitm_3p5steps_nowhitening.tex}}
$$
y = \M \circ
\BBBINV{2} \circ
\XOR{\RINV(\Mout)} \circ
\M \circ
\AAA{2} \circ
\R \circ
\XOR{\BBB{1} (\AAA{0} (\Min))} \circ
(y).
$$
Let
\begin{align*}
&\Min' = \BBB{1} (\AAA{0} (\Min)),\\
&\Mout' = \MINV(\RINV(\Mout)).
\end{align*}
Then
\begin{equation}
\label{eq:mitm-3step-cycle}
y = \Big(
\M \circ
\BBBINV{2} \circ
\M \Big) \circ
\Big(
\XOR{\Mout'} \circ
\AAA{2} \circ
\R \circ
\XOR{\Min'} \Big)
(y), ~\text{and}
\end{equation}
\begin{equation}
\label{eq:mitm-3step}
\MINV \circ
\BBB{2} \circ
\MINV (y)
=
\XOR{\Mout'} \circ
\AAA{2} \circ
\R \circ
\XOR{\Min'} (y).
\end{equation}
Note that Equation~\ref{eq:mitm-3step-cycle} shows that the unknown part of the state $y$ is a \emph{fixed point} of a particular bijective structure using the constants $\Min',\Mout'$. This is an interesting formulation of the constraint on the unknown part of the state.
\paragraph{Precomputation/data trade-off attack.}
Note that the left part of Equation~\ref{eq:mitm-3step} is independent of $\Min',\Mout'$. Moreover, the right part consists of independent ARX-boxes. Therefore, guessing one $64$-bit branch of $y$ leads to knowledge of an input and an output $64$-bit branches of the function from the left-hand side. A data trade-off attack follows. The trade-off parameterized by an integer $r$, $0 < r \le 64$.
We start by the precomputation phase.
Let $z = \MINV \circ \BBB{2} \circ \MINV(y)$. We iterate over all $y_1 \in \bField{64-r}$ and all $y_i \in \bField{64}$ for $i \ne 1$, and generate the table mapping $(y_1, z_0)$ to all values $y$ satisfying the constraint.
On average, we expect $2^{64\halfbranches-r}/2^{64}=2^{64(\halfbranches-1)-r}$ candidates per each $(y_1, z_0)$ in the table.
This step requires $2^{64\halfbranches-r}$ time and memory blocks.
In the online phase,
we collect $2^r$ known plaintexts-ciphertext pairs and compute the corresponding $\Min',\Mout'$ for each pair. Then, for each $y_1 \in \bField{64-r}$ we compute
$$
z_0 = (\Mout')_0 \oplus \A{2}{0} ((\Min')_1 \oplus y_1).
$$
For each preimage candidate of $(y_1, z_0)$ in the precomputed table, we recover the full state in the middle of the second step. We then check if the corresponding state correctly connects $\Min,\Mout$ and possibly recover the secret key by inverting the sponge operation.
If a considered plaintext-ciphertext pair is such that the leftmost $r$ bits of $y_1$ are equal to zero, then the attack succeeds. Indeed, then, for one of the guesses of $y_1$, the pair $(y_1, z_0)$ corresponds to the correct preimage.
For each of $2^r$ plaintext-ciphertext pairs we guess $2^{64-r}$ values of $(y_1, z_0)$. Correct $y_1$ identifies a table mapping the
$z_0$ to all possible $y$. Therefore, on average, there will be $2^{64-r}\cdot 2^{64(\halfbranches-1)-r}= 2^{64\halfbranches-2r}$ total candidates. The time required to check a candidate and to recover the secret key is negligible.
The online phase requires $2^r$ different 2-block plaintext-ciphertext pairs, $2^{64\halfbranches-2r}$ time and negligible amount of extra memory.
The following attacks on \aead{} instances follow:
\begin{enumerate}
\item \aeadversion{128}{128}: with $r=64$, the full attack requires $2^{64}$ time, memory and data; with $r=32$, the full attack requires $2^{96}$ time and memory, and $2^{32}$ data.
\item \aeadversion{192}{192}: with $r=64$, the full attack requires $2^{128}$ time, memory and $2^{64}$ data.
\item \aeadversion{256}{256}: with $r=64$, the full attack requires $2^{192}$ time, memory and $2^{64}$ data.
\end{enumerate}
\paragraph{Low-data variant of the attack on \aeadversion{256}{256}.}
Due to the high branching number of $\M$, it is hard to exploit the structure of the function $\MINV \circ \BBB{2} \circ \MINV$ by guessing several branches. However, for the largest instance \aeadversion{256}{256}, a simple attack requiring one known-plaintext and $2^{192}$ time is possible.
The key observation is that when $\El(x)$ is fixed, $\M(x)$ splits into $\halfbranches$ independent xors with $\El(x)$. In the attack, we simply guess the corresponding $\El$ for the two calls to $\M$. Precisely, let $\El_y = \El(\MINV(y))$ and $\El_z = \El(\MINV\circ\BBB{2}\circ\MINV(y))$. The computations from Equation~\ref{eq:mitm-3step-cycle} then split into one large cycle:
\begin{align*}
&y_0 = \XOR{\El_y} \circ \BINV{2}{0} \circ \XOR{\El_z} \circ \XOR{(\Mout')_0} \circ \A{2}{0} \circ \XOR{(\Min')_1} (y_1),\\
&y_1 = \XOR{\El_y} \circ \BINV{2}{1} \circ \XOR{\El_z} \circ \XOR{(\Mout')_1} \circ \A{2}{1} \circ \XOR{(\Min')_2} (y_2),\\
&y_2 = \XOR{\El_y} \circ \BINV{2}{2} \circ \XOR{\El_z} \circ \XOR{(\Mout')_2} \circ \A{2}{2} \circ \XOR{(\Min')_3} (y_3),\\
&y_3 = \XOR{\El_y} \circ \BINV{2}{3} \circ \XOR{\El_z} \circ \XOR{(\Mout')_3} \circ \A{2}{3} \circ \XOR{(\Min')_0} (y_0).
\end{align*}
Let us guess $y_0$ and compute the whole cycle. If the result matches guessed $y_0$, then we obtain a candidate for the full $y = (y_0, y_1, y_2, y_3)$. On average, we can expect to find one false-positive candidate.
The attack requires 1 known plaintext-ciphertext pair, negligible amount of memory, and $2^{192}$ time.
\paragraph{Birthday-differential attack.}
A birthday-differential attack can be mounted too. We are looking for a pair having zero difference in $y$. Then the expression
\begin{equation}
\XOR{\Mout'} \circ
\AAA{2} \circ
\R \circ
\XOR{\Min'} (y)
\end{equation}
has zero difference in the input $y$ and zero difference in the output. Therefore, the difference in $\Min'$ is transformed into the difference in $\R(\Mout')$ by an ARX-box layer. This is the first problem we noted in~Section~\ref{sec:mitm-arx-assum}.
Note that the amount of pairs of encryptions in the pool has to be greater than $2^{64\halfbranches}$ in order for a pair with zero difference in $y$ to exist. Therefore, enumeration of all pairs and checking the possibility of the differential transition $\Min' \xrightarrow{\AAA{2} \circ \R} \Mout'$ results in an ineffective attack.
As described in the birthday-differential attack framework, we further strengthen the constraints in order to obtain an efficient initial filtering. We require that $t$ branches of $\Min'$ starting from the second branch have zero difference too, $0 < t < \halfbranches$. Then, $\Mout'$ must have zero difference in the first $t$ branches. This allows us to obtain initial filtering with $\mu=2t$, i.e. with the probability $2^{-64\cdot 2t}$. In total we need zero difference in $\halfbranches+t$ branches. Therefore, we need $2^{64(\halfbranches+t)/2+1/2}$ data and we expect to keep $2^{64(\halfbranches+t)}\cdot2^{-64\cdot2t}=2^{64(\halfbranches-t)}$ pairs on average after the initial filtering procedure.
The second filtering step is based on filtering possible differential transitions. In the correct pair, the differences $\Delta\Min'$ and $\Delta\Mout'$ of the values $\Min'$ and $\Mout'$ respectively are related by the layer $\AAA{2}$ of ARX-boxes. More precisely, for all $i, 0\le i < \halfbranches,$ the following differential transition holds:
$$
(\Delta\Min')_{i+1} \xlongrightarrow{\A{2}{i}} (\Delta\Mout')_i.
$$
Verifying a pair requires checking whether a differential transition over an ARX-box is possible or not (see Problem 1 in Section~\ref{sec:mitm-arx-assum}). We assume that there only a fraction $\solratio$ of all differential transitions over an ARX-box is possible, and that for any differential transitions all solutions can be found in time $\soltime$ on average.
The branch values corresponding to zero difference transitions can be found exhaustively in time $\finalrec \le 2^{64t}$ or more efficiently by exploiting the structure further.
We estimate the final complexity of the attack by $2^{64(\halfbranches+t)/2+1/2}$ data and $2^{64(\halfbranches-t)}(\soltime + \solratio^{\halfbranches-t} \finalrec)$ time.
Assuming low values of $\solratio,\soltime$ and $\finalrec$, we estimate the following attack complexities for different instances of \aead{}:
\begin{enumerate}
\item \aeadversion{128}{128}: with $t=1$, the attack requires $2^{96.5}$ data, and slightly more than $2^{64}$ time.
By the precomputation cost of $2^{96+\epsilon}$ time and memory, the data requirement can be reduced to $2^{96-\epsilon}$ for any $\epsilon < 32$.
\item \aeadversion{192}{192}: with $t=1$, the attack requires $2^{128.5}$ data, and slightly more than $2^{128}$ time.
By the precomputation cost of $2^{128+\epsilon}$ time and memory, the data requirement can be reduced to $2^{128-\epsilon}$ for any $\epsilon < 64$.
\item \aeadversion{256}{256}: with $t=1$, the attack requires $2^{160.5}$ data, and slightly more than $2^{192}$ time.
By the precomputation cost of $2^{160+\epsilon}$ time and memory, the data requirement can be reduced to $2^{160-\epsilon}$ for any $\epsilon < 96$.
\end{enumerate}
| {
"alphanum_fraction": 0.7052819865,
"avg_line_length": 70.9253731343,
"ext": "tex",
"hexsha": "de11ac3e5c0ce4b82c14d509325768ad32ac46ff",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2021-08-05T19:40:16.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-08-05T19:40:16.000Z",
"max_forks_repo_head_hexsha": "6ba1c2b241e63c07cf76108481c1b67f21a50f12",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "hellman/thesis",
"max_forks_repo_path": "thesis-source/9deSPARKLE/guessdetermine1.tex",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "6ba1c2b241e63c07cf76108481c1b67f21a50f12",
"max_issues_repo_issues_event_max_datetime": "2021-08-09T11:26:45.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-08-09T11:26:45.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "hellman/thesis",
"max_issues_repo_path": "thesis-source/9deSPARKLE/guessdetermine1.tex",
"max_line_length": 709,
"max_stars_count": 19,
"max_stars_repo_head_hexsha": "6ba1c2b241e63c07cf76108481c1b67f21a50f12",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "hellman/thesis",
"max_stars_repo_path": "thesis-source/9deSPARKLE/guessdetermine1.tex",
"max_stars_repo_stars_event_max_datetime": "2021-12-31T15:36:12.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-05-16T19:55:41.000Z",
"num_tokens": 2942,
"size": 9504
} |
\newif\ifonline
\documentstyle[11pt,makeidx,a4]{book}
\title{LaTeX OnLine Users' Guide}
\newcommand{\LO}{LaTeX OnLine}
\setlength{\parindent}{0 pt}
\setlength{\parskip}{6 pt}
\begin{document}
\noindent
\chapter{About LaTeX OnLine}
{\bf \LO} is a translator from a subset of \LaTeX{}
macro package to various on-line document formats, either
target or intermediate. The currently supported formats are:
\begin{itemize}
\item IPF tag language, which is a source for OS/2 INF and
HLP files. An IPF compiler is available as a part of IBM
Developer's Toolkit and along with some C/C++ compilers.
\item Microsoft Help Compiler compatible subset of RTF,
which can be used to produce a Windows Help file.
\item HTML, which can be viewed with any Web browser
immediately after translation.
\end{itemize}
\LO{} was originally developed for xTech internal use.
The current manual is very brief and was written with assumption
that a reader is used to \LaTeX{}. Its source, is bundled with the
program to serve as a sample.
\chapter{Using \LO{}}
To invoke \LO{}, type
\verb' convert {<option>} <source file>'
at the command prompt and press Enter. An option is
preceded with either slash (\verb'"/"') or minus sign.
Available options are:
\begin{center}
\begin{tabular}{ll}
\verb'-i' & emit IPF \\
\verb'-r[c[#]]' & emit RTF and, optionally, CNT (\verb'#' is a top heading level) \\
\verb'-h' & emit HTML \\
\verb'-e' & emit extern file (see \ref{})
\end{tabular}
\end{center}
In the current version, if no output format is specified, IPF is assumed.
On startup, \verb'convert' searches for a file called \verb'convert.ini'
in the current directory and then in the directory where the executable
resides. This file consists of lines in format:
\verb'<LaTeX command>' \\
\verb'<optional arguments number>' \\
\verb'<mandatory arguments number>'
The commands listed in this file will be ignored along with their arguments.
Any commands. which should have no effect on on-line documents anyway,
may be added to it.
Format of \verb'convert.ini' is subject to change in future versions of
\LO. It will contain configuration options for all output formats.
\verb'convert' reports warnings and errors in format:
\verb'"(" <file> <line> ":" <column> ")" <message>'
Processing is stopped on first encountered error.
\chapter{Supported LaTeX features}
The structure of this chapter closely matches the Appendix C of Leslie
Lamport's book called \LaTeX: {\em A Document Preparation System}, which
was used as a main information source during the development of \LO.
With rare exceptions, the supported features exist in \LaTeX{} 2.09.
They are is very briefly listed in the following sections.
\section{Commands and Environments}
\verb' {}' (scopes) \\
\verb' \begin{'{\it name}\verb'} ... \end{'{\it name}\verb'}'
\verb' \\'
The *-form and optional argument are not supported for \verb'\\'.
\section{Sentences and Paragraphs}
\subsection{Making Sentences}
{\bf special characters}
\verb' \$ \% \{ \_ \& \# \}'
{\bf logos}
\verb' \TeX \LaTeX'
\subsection{Making Paragraphs}
\verb' \par'
The \verb'\indent' and \verb'\noindent' commands are currently not supported.
In produced output, paragraphs are always indentless.
Style parameters are not supported. % !!!
\subsection{Footnotes}
\verb' \footnote{'{\it text}\verb'}'
Optional \verb'\footnote' argument is not supported.
Style parameters are not supported. % !!!
\subsection{Accents and Special Symbols}
Accents are not supported.
Many special, foreign, and mathematical symbols are recognized,
but only a few of them are supported in output formats.
\section{Sectioning and Table of Contents}
\subsection{Sectioning Commands}
\verb' \part' \\
\verb' \chapter' \\
\verb' \section' \\
\verb' \subsection' \\
\verb' \subsubsection' \\
\verb' \paragraph' \\
\verb' \subparagraph'
*-forms are also supported.
The optional {\it toc\_entry} argument is not supported yet.
{\bf Warning:} the \verb'\part' command is recognized, but its usage may
cause unpredictable results in the current version.
The \verb'\appendix' declaration is ignored.
\subsection{Table of Contents}
A table of contents is always formed, but its placement and representation
depends on the target format. % !!! desribe.
\subsection{Style parameters}
Section numbering and table of contents style parameters ar not supported.
\section{Document and Page Styles}
\verb' \title{'{\it text}\verb'}'
The only command from this group which is supported is \verb'\title'.
It defines the on-line document title.
\section{Displayed paragraphs}
\subsection{Quotations and Verse}
Nothing is supported.
\subsection{Horizontal Alignment}
\verb' \begin{flushleft} ... \end{flushleft}' \\
\verb' \begin{flushright} ... \end{flushright}' \\
\verb' \begin{center} ... \end{center}'
The \verb'flushleft' environment has no effect since output is left
flushed by default.
{\bf Note:} \verb'flushright' and \verb'center' environments are not
supported in IPF.
\subsection{List-making Environments}
\verb' \begin{itemize} '{\it item\_list}\verb' \end{itemize}' \\
\verb' \begin{enumerate} '{\it item\_list}\verb' \end{enumerate}' \\
\verb' \begin{description} '{\it item\_list}\verb' \end{description}' \\
\verb' \item['{\it label}\verb']'
The \verb'list' and \verb'trivlist' environments are not supported.
\subsection{Verbatim}
\verb' \begin{verbatim} '{\it literal\_text}\verb' \end{verbatim}' \\
\verb' \verb'{\it char literal\_text char}
*-forms are not supported.
\section{Mathematical formulas}
In the current version, the one-character command \verb'$' causes font
to be switched to roman style. No other math mode features are supported.
\section{Definitions}
\verb' \newcommand {'{\it cmd}\verb'}['{\it args}\verb']{'{\it def}\verb'}' \\
\verb' \renewcommand{'{\it cmd}\verb'}['{\it args}\verb']{'{\it def}\verb'}'
\verb'#'{\it n} parameters are supported. Arguments and {\it def} may contain
other user-defined commands.
\section{Figures and Other Floating bodies}
\verb' \begin{table}['{\it loc}\verb'] '{\it body}\verb' \end{table}'
The *-form and the \verb'figure' environment are not supported yet.
\verb' \caption{'{\it heading}\verb'}'
Optional {\it lst\_entry} parameter of the \verb'\caption' command is not
supported. The \verb'\label' command should {\em not} be placed inside
{\it heading}.
Style parameters are not supported.
Marginal notes are not supported.
\section{Lining It Up in Columns}
\subsection{The tabbing Environment}
Not supported yet.
\subsection{The array and tabular Environments}
\verb' \begin{tabular}['{\it pos}\verb']{'{\it cols}\verb'} '{\it body}\verb' \end{table}'
The \verb'array' and \verb'tabular*' environments are not supported yet.
Tables is the most difficult thing to translate, so the results
shown by the current version most probably will not satisfy you.
\section{Moving information around}
\subsection{Cross-References}
\verb' \label{'{\it key}\verb'}' \\
\verb' \ref{'{\it key}\verb'}' \\
%\verb' \public' \\ !!!
%\verb' \extern' !!!
\subsection{Bibliography and Citation}
Not supported yet.
\subsection{Splitting the input}
\verb' \input{'{\it file\_name}\verb'}' \\
\verb' \include{'{\it file}\verb'}'
The \verb'\includeonly' command is not currently supported.
\subsection{Index}
\verb' \index{'{\it str}\verb'}'
Index is not supported for HTML yet. The format of {\it str} is
compatible with \verb'makeindx' 2.12, but is not fully supported yet.
\section{Line and Page Breaking}
\verb' \\' \\
\verb' \newline'
The optional {\it len} argument of \verb'\\' is not supported.
\section{Length, Spaces, and Boxes}
Nothing is supported.
% \verb' \mbox break; // mbox == group !!!'
\section{The picture Environment}
Not supported.
\section{Font Selection}
\subsection{Changing the Type Style}
The following type style selection declarations are recognized:
\verb' \rm \bf \sf \it \sl \sc \tt \em'
However, for a particular output format some of them may be mapped
to the same type style.
\subsection{Changing the Type Size}
The following font size selection declarations are recognized:
\begin{verbatim}
\tiny \scriptsize \footnotesize
\small \normalsize \large
\Large \LARGE \huge
\Huge
\end{verbatim}
However, for a particular output format some of them may be mapped
to the same size.
\section{Conditional sections}
\verb' \newif\if'{\it name} \\
\verb' \if'{\it name} \\
\verb' \else' \\
\verb' \fi' \\
\verb' \'{\it name}\verb'true' \\
\verb' \'{\it name}\verb'false'
In \LO, there is a special value of {\it name}:
\verb'\newif\ifonline' implies \verb'\onlinetrue'
and \verb'\onlinefalse' has no effect.
This is not a LaTeX 2.09 feature.
% !!! \verb' \output' drop it off
\end{document}
| {
"alphanum_fraction": 0.6671591389,
"avg_line_length": 28.2023809524,
"ext": "tex",
"hexsha": "e0edd81bb30afb77d8eb1ff94f379bc75c5d65f5",
"lang": "TeX",
"max_forks_count": 20,
"max_forks_repo_forks_event_max_datetime": "2021-10-02T19:46:42.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-06-10T18:09:16.000Z",
"max_forks_repo_head_hexsha": "cfd20e209193c9cfcee94ad2ca30d8c32ead48c9",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "undecidedzogvisvitalispotent8stars360/xds",
"max_forks_repo_path": "Sources/Doc/convertn/doc/convert.tex",
"max_issues_count": 5,
"max_issues_repo_head_hexsha": "cfd20e209193c9cfcee94ad2ca30d8c32ead48c9",
"max_issues_repo_issues_event_max_datetime": "2021-07-30T07:17:50.000Z",
"max_issues_repo_issues_event_min_datetime": "2020-07-10T16:06:48.000Z",
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "undecidedzogvisvitalispotent8stars360/xds",
"max_issues_repo_path": "Sources/Doc/convertn/doc/convert.tex",
"max_line_length": 94,
"max_stars_count": 53,
"max_stars_repo_head_hexsha": "b4a32b9c9c91fe513fa5ff78ec87bb44102a3b72",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "zanud/xds-2.60",
"max_stars_repo_path": "misc/Doc/convert/convert.tex",
"max_stars_repo_stars_event_max_datetime": "2021-12-28T18:56:00.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-06-10T18:19:44.000Z",
"num_tokens": 2453,
"size": 9476
} |
% !TEX root = ../main.tex
\section{Project scope}
\subsection{Problem formulation}
\begin{frame}{\insertsubsec}
\begin{itemize}
\item Work centered around PMHNK dataset
\item Medical Image analysis problem
\item Current results show a CI of 0,628
\end{itemize}
Can a better survival prediction than the current results, be obtained using image
data and Deep Neural Networks?
\end{frame}
\subsection{State-of-the-art}
\begin{frame}{\insertsubsec}
The most typical approach is to extract radiomic features, usually with
the \emph{PyRadiomics} package, from the MRI, PET or CT scans.
\vspace{.5cm}
An alternative approach is to use deep-learning based models for prediction or
feature extraction. Pre-trained models have reduced the requirements for big data sets.
Possible strategies are:
\begin{itemize}
\item Use a pre-trained CNN as a feature extractor
\item Fine tune a pre-trained CNN on medical data
\end{itemize}
\vspace{.5cm}
In survival models \emph{DeepSurv} is uses a deep neural network to fit a Cox Proportional
Hazards model
\end{frame}
\begin{frame}
In 3D imaging \emph{DeepMedic} used 3D CNNs to analyze MRI scans for brain lesion segmentation
\vspace{.5cm}
\begin{figure}
\centering
\includegraphics[width=.9\textwidth]{images/deepmedic}
\caption{\emph{DeepMedic} architecture}
\end{figure}
\end{frame}
\subsection{Objectives}
\begin{frame}{\insertsubsec}
\begin{itemize}
\item Get a better understanding of survival prediction problems.
\item Be able to analyze the PMHNK dataset and develop a survival model that improves the
prediction rate of PMHNK dataset patients.
\item Investigate and compare the performance of the deep learning-based method to
the more conventional methods.
\item Get a better CI than the \emph{volume} feature, which is often used in clinic as a
prognostic feature, its CI is 0,628.
\end{itemize}
\end{frame}
\subsection{Stakeholders}
\begin{frame}{\insertsubsec}
\begin{itemize}
\item Developer: responsible for research, document and implement the software
\item Director: responsible for guiding, giving advice and helping the Developer
\item Beneficiaries: future researchers or patients depending on the outcome
\end{itemize}
\end{frame}
\subsection{Methodology}
\begin{frame}{\insertsubsec}
\begin{itemize}
\item As a research project it has a process of trial and error, using an agile method.
\item Once in a while the project has been presented in the lab weekly meetings
\item Every week a meeting with the Principal Investigator has been scheduled
\end{itemize}
\end{frame}
\subsection{Obstacles}
\begin{frame}{\insertsubsec}
Some obstacles may be found during the project:
\begin{itemize}
\item Training time
\item Bugs
\item Scheduling
\item Not enough data
\end{itemize}
\end{frame}
| {
"alphanum_fraction": 0.7446808511,
"avg_line_length": 33.1136363636,
"ext": "tex",
"hexsha": "0073757417772322c7ef3c62c7fbf270efc65ae2",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2019-10-23T08:11:28.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-10-23T08:11:28.000Z",
"max_forks_repo_head_hexsha": "7551a3c13a985ee7eecf7a4f38a6ee4803b05ff1",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "jmigual/FIB-TFG",
"max_forks_repo_path": "LATEX/final_presentation/sections/02_scope.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "7551a3c13a985ee7eecf7a4f38a6ee4803b05ff1",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "jmigual/FIB-TFG",
"max_issues_repo_path": "LATEX/final_presentation/sections/02_scope.tex",
"max_line_length": 96,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "7551a3c13a985ee7eecf7a4f38a6ee4803b05ff1",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "jmigual/FIB-TFG",
"max_stars_repo_path": "LATEX/final_presentation/sections/02_scope.tex",
"max_stars_repo_stars_event_max_datetime": "2019-04-02T15:17:51.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-04-02T15:17:51.000Z",
"num_tokens": 769,
"size": 2914
} |
\chapter{Exponentials and Logarithms}
\section{Properties of the exponential function}
\section{Gradient of \(e^{kx}\)} % TODO: Typeset better
\section{Properties of the logarithm}
\section{Laws of logarithms}
\section{Equations involving exponentials}
\section{Reduction to linear form}
\section{Modelling using exponential functions}
| {
"alphanum_fraction": 0.798816568,
"avg_line_length": 30.7272727273,
"ext": "tex",
"hexsha": "fac99468ff3f597e226cc8012f7c584cd1a8d2ab",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ee461679e51e92a0e4b121f28ae5fe17d5e5319e",
"max_forks_repo_licenses": [
"Apache-2.0",
"MIT"
],
"max_forks_repo_name": "aDotInTheVoid/ltxmk",
"max_forks_repo_path": "corpus/a-level-notes/math/content/pure/exp_log.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ee461679e51e92a0e4b121f28ae5fe17d5e5319e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0",
"MIT"
],
"max_issues_repo_name": "aDotInTheVoid/ltxmk",
"max_issues_repo_path": "corpus/a-level-notes/math/content/pure/exp_log.tex",
"max_line_length": 55,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ee461679e51e92a0e4b121f28ae5fe17d5e5319e",
"max_stars_repo_licenses": [
"Apache-2.0",
"MIT"
],
"max_stars_repo_name": "aDotInTheVoid/ltxmk",
"max_stars_repo_path": "corpus/a-level-notes/math/content/pure/exp_log.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 84,
"size": 338
} |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CS624: Analysis of Algorithms
% Copyright 2015 Pejman Ghorbanzade <[email protected]>
% Creative Commons Attribution-ShareAlike 4.0 International License
% More info: https://github.com/ghorbanzade/beacon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Question 1}
A stack supports two operations: \textsc{Push} and \textsc{Pop}.
Implementing the two operations using a linked-list takes $\mathcal{O}(1)$ time per operation.
Suppose we are given two stacks, $A$ and $B$ with $n$ and $m$ elements, respectively.
We want to implement the following operations:
\begin{description}\itemsep=0pt
\item[\textsc{Push}($A, x$)] Push $x$ elements into $A$.
\item[\textsc{Push}($B, x$)] Push $x$ elements into $B$.
\item[\textsc{MultipopA($k$)}] pop $\text{min}\{k,n\}$ elements from $A$.
\item[\textsc{MultipopB($k$)}] pop $\text{min}\{k,m\}$ elements from $B$.
\item[\textsc{Transfer($k$)}] repeatedly pop an element from $A$ and push it to $B$ until either $k$ elements have been transferred or $A$ is empty.
\end{description}
\begin{enumerate}[label=(\alph*)]
\item What is the worst-case running time of \textsc{MultipopA}, \textsc{MultipopB} and \textsc{Transfer}?
\item Show that the amortized running time per operation is $\mathcal{O}(1)$ for a sequence of \textsc{Push}($A,n$) and \textsc{Transfer}($n$).
You may use any technique shown in class on a sequence on $n$ operations.
\end{enumerate}
\subsection*{Solution}
\begin{enumerate}[label=(\alph*)]
\item Operations \textsc{Push}($A,x$) and \textsc{Push}($B,x$) have a runtime cost of $\mathcal{O}(x)$ as \textsc{Push}() operation with runtime $\mathcal{O}(1)$ should be performed for $x$ times.
Operations \textsc{MultipopA}($k$) and \textsc{MultipopB}($k$) both repeat the \textsc{Pop()} operation for $\text{min}(k,n)$ and $\text{min}(k,m)$ times, respectively.
In the worst-case where $n,m < k$, the operations are limited by the number of elements in the stacks.
Therefore, their worst-case runtime cost are $\mathcal{O}(n)$ and $\mathcal{O}(m)$, respectively.
Operation \textsc{Transfer($k$)} has a worst-case runtime of $\mathcal{O}(k)$, since worst scenario happens when $k < n$ and $k < m$ and there will be $k$ items to \textsc{Pop()} from stack $A$ and $k$ items to \textsc{Push()} to stack $B$.
\item For \textsc{Push}($A,n$), amortized runtime would be constant $C$ where $C$ is the cost to push one element to a stack.
This can be shown easily using the aggregate method as shown in Eq. \ref{eq11}.
\begin{equation}
\sum_{i=1}^{n} c_i = \sum_{i=1}^{n} c = c \sum_{i=1}^{n} 1 = nc \Rightarrow \text{Amortized Cost} = \frac{nc}{n} = c
\label{eq11}
\end{equation}
For \textsc{Transfer($k$)} operation, the worst case happens when there are at least $k$ elements in stack $k$, in which case amortized cost of the operation can be obtained as given in Eq. \ref{eq12}.
\begin{equation}
\sum_{i=1}^{k} c_i = \sum_{i=1}^{k}(c_1 + c_2) = (c_1 + c_2) \sum_{i=1}^{k} 1 = (c_1 + c_2) k
\label{eq12}
\end{equation}
Since cost of \textsc{Pop()} ($c_1$) and \textsc{Push()} ($c_2$) are $\mathcal{O}(1)$, amortized cost of \textsc{Transfer($k$)} is obtained from \ref{eq12}.
\begin{equation}
\text{Amortized Cost} = \frac{k(c_1 + c_2)}{k} = c_1 + c_2 = 2
\end{equation}
\end{enumerate}
| {
"alphanum_fraction": 0.6672619048,
"avg_line_length": 56,
"ext": "tex",
"hexsha": "c287954c177fb7f647c3b6a939696d61009d9ae1",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2020-12-06T17:18:05.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-09-20T05:58:32.000Z",
"max_forks_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "ghorbanzade/beacon",
"max_forks_repo_path": "umb-cs624-2015s/src/tex/m02/m02q01.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "ghorbanzade/beacon",
"max_issues_repo_path": "umb-cs624-2015s/src/tex/m02/m02q01.tex",
"max_line_length": 240,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "ghorbanzade/beacon",
"max_stars_repo_path": "umb-cs624-2015s/src/tex/m02/m02q01.tex",
"max_stars_repo_stars_event_max_datetime": "2020-01-01T11:16:51.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-11-13T20:00:10.000Z",
"num_tokens": 1099,
"size": 3360
} |
\title{\bf Images}
\section{Basics \& Nomenclature}
Two-dimensional array-based detectors at the focal planes of
telescopes produce images --- two-dimension rasters of values. Here
we consider the basic properties such images with an emphasis on the
sorts of issues affecting ultraviolet, optical, and infrared imaging
instruments. Many of the principles hold for other sorts of data sets.
These images can be thought of as noisy samplings of an {\it image
function} which is the convolution of the image coming from space with
a response function known as the {\it point spread function}
(PSF). The PSF can have contributions from the Earth's atmosphere, the
telescope's physical and geometric optics, and the detector.
The width of the PSF is usually characterized by its full-width
half-maximum (FWHM). An important property of an imaging system is its
sampling density relative to the FWHM. If this density is high enough,
typically greater than 2 pixels per FWHM, the PSF will be close to
{\it Nyquist sampled}, meaning that if the image were noiseless it
would preserve all of the information in the image function. The
exercises describe the origin of this criterion, which is related to
the true Nyquist sampling criterion of a particular band-limited
function (one with constant Fourier amplitudes out to some
wavenumber). Typically instruments do not truly Nyquist sample the
image function, but in certain circumstances it can be possible.
Images taken outside the Galactic Plane which are not extraordinarily
deep usually allow one to separate the flux into individual objects,
which are generally classifiable as {\it point sources} or {\it
extended sources}. The point sources are those whose images are
consistent with the PSF. With ordinary imaging capability, stars are
point sources. Galaxies are often extended sources, with FWHM larger
than the PSF FWHM. High redshift, luminous quasars usually appear as
point sources, though with high contrast imaging from space their
extended host galaxies can be detected.
The image locations can be quantified by their $x$ and $y$ pixel
values. The center of each object is typically determined by the mode
of the light distribution, or sometimes by a weighted centroid of the
flux distribution (which is less precise but for extended sources may
be more desirable at times). The relationship between these $x$ and
$y$ pixel values and the RA and Dec locations they correspond to is
called the {\it astrometric solution}. Usually the astrometric
solution is expressed in terms of a World Coordinate System
(\citealt{greisen02a}) description of the image, which provides the
metadata encoding an approximate projection of the image and
distortions in that projection.
The raw image is usually obtained in some uncalibrated form. In terms
of the specific intensity of the image $I_\nu(\alpha, \delta)$ coming
from outside the Earth's atmosphere convolved with the instrumental
resolution, the raw image in DN$(x,y)$ in pixel coordinates may be
written:
\begin{equation}
\mathrm{DN}(x, y, t) = \mathrm{DN}_{\mathrm{back}}(x, y, t) +
\int \frac{\dd{\nu}}{\nu} Q(\nu, {\rm alt}, {\rm az}, x, y, t)
\left[I_\nu(\nu, \alpha, \delta) + S_{\nu}(\nu, {\rm alt}, {\rm az},
t)\right]
\end{equation}
$Q$ is a general response function written to depend on the pixels
detecting the objects, the local sky coordinates (though it might have
a more general form in some cases), frequency, and time. $S_{\nu}$ is
background, generally due to sky emission, and written in terms of
altitude and azimuth, to suggest the important axes, but also in terms
of time (e.g. where the Moon is). DN$_{\mathrm{back}}$ is the
instrumental background.
Often the response $Q$ is at least roughly separable as follows
\begin{equation}
Q(\nu) = R(\nu) A({\rm alt}, {\rm az}, \nu) F(x, y)
\end{equation}
where $R(\nu)$ is the instrumental bandpass, $A$ is the atmospheric
throughput, and $F$ is the flat-field. $R$ is often defined to
incorporate the dependence of the atmosphere on wavelength at some
nominal altitude, so that $A$ would express only the differences from
that. $F$ is often defined to include the determinant of the Jacobian
between $(\alpha, \delta)$ and $(x, y)$ which would otherwise need to
appear and which primarily depends on the instrument. $F$ is usually
defined to have a mean around unity.
A final common approximation is that the functions are sufficiently
separable or the dependence on angle is sufficient small over the
field of view of the image that we can write:
\begin{equation}
\mathrm{DN}(x, y, t) = \mathrm{DN}_{\mathrm{back}}(x, y, t) +
\bar{A} F(x, y) \left[\mu(\alpha, \delta) + \mu_S({\rm alt}, {\rm az},
t)\right]
\end{equation}
Here, $\bar{A}$ is the throughput of the instrument and atmosphere
averaged over wavelength. We separate DN$_{\rm back}$ and $\mu_S$
because they are from different physical sources. For example, in a
CCD, DN$_{\rm back}$ is due to dark current and and bias in the
device, whereas $\mu_S$ is emission from the sky itself.
The process of {\it photometric calibration} is the conversion of the
observed DN to $\mu$. In its most basic form, calibration requires
subtracting the instrumental background, scaling the remaining flux by
the overall factor $1/\bar{A}$, dividing by the flat field, and then
subtracting the sky. Typically, the instrumental background is
determined through bias frames taken with the shutter shut. The flat
field is determined by observing either the sky in twilight or by
observing a screen (sometimes just the dome wall) illuminated such
that it mimics light uniformly entering the telescope aperture.
It is somewhat less standard how $\mu_S$ and $\bar{A}$ are
determined. In most cases, determining either one requires some
detection and measurement of objects in the image to occur, and their
determination is usually somewhat iterative.
For $\mu_s$, usually one takes an initial stab at the background level
(e.g. just a median), detecting the bright objects, and then
redetermining the background and its variation across the image when
excluding ``detected'' pixels; one can then iterate this
procedure. Typically this procedure subtracts not just the atmospheric
sky emission, but also other sources such as zodiacal light, and also
some fraction of the light from detected stars and galaxies. Whether
these other sources should or should not be subtracted depends on what
is wanted out of the image.
For $\bar{A}$, the concept is to use detected objects in the field
whose $\mu$ is known from a catalog of standards to calibrate the
entire image. Sometimes the objects used for calibration are not in
the same field but are objects observed close in time to the field of
interest with the same instrument; in such cases the difference in
airmass of the field and the standard field needs to be accounted
for. Often in these cases the standards are not known in exactly the
same filters as the observations, and these color-dependent effects
must be taken into account. Sometimes there are no standards as such,
but instead a suite of overlapping observations can be calibrated onto
a self-consistent scale (e.g., \citealt{finkbeiner15a}).
Once an image is calibrated, the stars, galaxies, or other objects may
be measured for their fluxes and other properties. The fluxes may be
measured through fixed apertures, or one may fit models to the data
and infer fluxes from those models.
\section{Commentary}
The description above of calibration procedures is roughly accurate,
but is more illustrative than anything. There are many different
techniques in use, driven by the nature of the instrument and
observations as well as individual tastes. In part because each
individual experiment is so different, astronomers (including myself)
tend to learn about this subject in the context of a particular set of
observations rather than from a generalized perspective. Keep that in
mind when people (including me!) are telling you how this process
works!
At the highest precision, the calibration effects described above are
not truly separable. For example, the astrometric solution depends on
the definition of the PSF, because that determines what exactly you
consider the location of each object, and the flat-fielding, which can
also affect the centroiding.
A more subtle example is that the flux definitions cannot truly be
separated from the calibration. The calibration must assume some
effective aperture for the fluxes of the calibrating sources, but some
flux will leak outside the aperture, in ways that can vary across the
images used in the calibration. These aperture effects need to be
accounted for for percent level calibration accuracy.
\section{Key References}
\begin{itemize}
\item
{\it Design and Construction of Large Telescopes},
\citet{bely03a}
\item
{\it Astrophysical Techniques}, \citet{kitchin09a}
\end{itemize}
%\section{Order-of-magnitude Exercises}
%%
%\begin{enumerate}
%\item Proper motion of galaxies
%\end{enumerate}
\section{Analytic Exercises}
\begin{enumerate}
\item {\it Origin of the Nyquist criterion}. The Nyquist
sampling criterion is based on the concept of a ``band
limit.''
\begin{enumerate}
\item Show that if the 2D Fourier
transform $f(\vec{k})$ of the point spread function has zero power
higher than the band limit $k_{\rm max}$, then it can be perfectly
described using a discrete Fourier transform that extends only up
to that $k_{\rm max}$. What is the necessary configuration-space
sampling for the discrete Fourier transform?
\item Assume $f(\vec{k}) = {\rm constant}$
below the band limit, and zero above it. What is the resulting PSF
$f(\vec{x})$?
\item Under what circumstances might the criterion in part (b)
hold, given what you know about how telescopes work?
\item What is the FWHM of $f(\vec{x})$ in units of the sampling?
This sets the Nyquist criterion for sampling.
\end{enumerate}
\item {\it Interpolation}. Imagine starting with an image sampled on a
rectangular grid. Interpolation is the process of inferring
the value of an image in between the given sampled points of the
image. The case of Nyquist sampled, band limited images motivates
a particular method of interpolation.
\begin{enumerate}
\item Explain how linear interpolation can be recast as
constructing a model of the image using a set of basis functions,
or ``kernels,'' centered on the original grid points.
\item Explain why a (noiseless) Nyquist sampled, band limited
image contains all the information necessary for perfect
interpolation.
\item If you interpolate perfectly in that situation, what is the
effective kernel you are using? Note that this is called {\it
sinc interpolation}.
\item Explain why using exactly that interpolation kernel might be
problematic.
\end{enumerate}
\item Following the methods of Section 2 of \citet{vakili16a}, show
how the best possible centroiding accuracy depends on the FWHM and
on the total signal-to-noise ratio ($S/N$) of a Gaussian point
source.
\end{enumerate}
\section{Numerics and Data Exercises}
\begin{enumerate}
\item {\it Interpolation}. Create an image of a critically sampled
Gaussian PSF centered at the middle of a pixel. Create another
image of the same PSF, but with its center offset some fraction of
a pixel from the first case. We will test how well different types
of interpolation work by trying to shift the first image using
interpolation and comparing it to the second image.
\begin{enumerate}
\item Use linear interpolation to try to shift the first image
so the PSF has the same center as in the second image. Compare the
absolute and fractional differences (pixel-by-pixel) between first
image shifted and the second image.
\item
Perform the same test with sinc interpolation.
\item Perform the same test with a ``damped'' version of sinc
interpolation, which multiplies the kernel by a broad Gaussian
(say, a few FWHM broad).
\end{enumerate}
\item CCD images from SDSS are available
as \href{https://www.sdss.org/dr14/imaging/images/#corr}{corrected
frames}. Those images have valid WCS headers associated with
them. Using the tools from {\tt astropy}, take RA and Dec values from
objects in a randomly chosen field (get these from the {\tt photoObj}
table in CAS) and overplot their locations on the CCD $r$-band image.
\item This problem tests the measurement of image centroids.
\begin{enumerate}
\item Write a piece of code to generate a fake, critically-sampled
image of a double Gaussian, with a center that isn't necessarily at
the center of a pixel. For the second Gaussian, use $A_2 = 0.1 A_1$
and $\sigma_2 = 2.47\sigma_1$, where $A$ indicates the value at the
center of the Gaussian. This choice is an approximate description of
the atmospheric PSF (Jim Gunn, private communication).
\item Write a routine to find the light-weighted centroid of the
image. Start by using the maximum pixel value, and use your knowledge
of the PSF FWHM to calculate the center based on the light within 3
FWHM, and iterate to convergence.
\item Write a routine to find the mode of the image. Start by using
the maximum pixel value, but then use the 3$\times$3 grid of pixels in
the center to perform a quadratic interpolation to find the peak.
\item Now add noise to the images, and use a Monte Carlo test to
evaluate how the precision of each estimate depends on the total $S/N$
within 3 FWHM.
\end{enumerate}
\item It is common to use the measured signal from a Poisson process
to estimate the noise. Use a Monte Carlo technique to estimate the
bias that this causes as a function of the expectation value $\bar N$
for the Poisson process.
\end{enumerate}
\bibliographystyle{apj}
\bibliography{exex}
| {
"alphanum_fraction": 0.7722029988,
"avg_line_length": 49.8992805755,
"ext": "tex",
"hexsha": "8662de51f74059918559cac036751d8f582cba56",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b4d9d52b4fe8af761783f49b2c197a109d94cfdf",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "blanton144/exex",
"max_forks_repo_path": "tex/images-text.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b4d9d52b4fe8af761783f49b2c197a109d94cfdf",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "blanton144/exex",
"max_issues_repo_path": "tex/images-text.tex",
"max_line_length": 70,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "b4d9d52b4fe8af761783f49b2c197a109d94cfdf",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "blanton144/exex",
"max_stars_repo_path": "tex/images-text.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3283,
"size": 13872
} |
%!TEX root = main.tex
\section{Acknowledgements}
\label{sec:acknowledgements}
Gousios is funded throught the NWO TestRoots project (639.022.314).
Vasilescu is supported through the NWO 600.065.120.10N235 project.
%financed by Nederlandse Organisatie voor Wetenschappelijk Onderzoek (NWO).
| {
"alphanum_fraction": 0.801369863,
"avg_line_length": 32.4444444444,
"ext": "tex",
"hexsha": "09f9e08d47a01809b0692463efaa1ae2f0a6f204",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2022-01-29T13:57:12.000Z",
"max_forks_repo_forks_event_min_datetime": "2022-01-29T13:57:12.000Z",
"max_forks_repo_head_hexsha": "e39f43658ee158ca2c5517ffed87bb77b283e14f",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "gousiosg/ghtorrent-service",
"max_forks_repo_path": "paper/acknowledgements.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e39f43658ee158ca2c5517ffed87bb77b283e14f",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "gousiosg/ghtorrent-service",
"max_issues_repo_path": "paper/acknowledgements.tex",
"max_line_length": 76,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "e39f43658ee158ca2c5517ffed87bb77b283e14f",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "gousiosg/ghtorrent-service",
"max_stars_repo_path": "paper/acknowledgements.tex",
"max_stars_repo_stars_event_max_datetime": "2020-01-16T20:07:18.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-01-18T22:35:58.000Z",
"num_tokens": 88,
"size": 292
} |
% Captions
\begin{figure}
\caption{Test Figure Label} \label{fig:figure}
\end{figure}
\begin{table}
\subcaption{Test Subcaption} \label{tab:subtable}
\caption{Test Table Label} \label{tab:table}
\end{table}
\begin{align}
x = 2 \label{eq:equation}
\end{align}
% Sections
\part{part} \label{sec:part}
\section{section} \label{sec:section}
\subsection{subsection} \label{sec:subsection}
\subsubsection{subsubsection} \label{sec:subsubsection}
\paragraph{paragraph} \label{sec:paragraph}
\subparagraph{subparagraph} \label{sec:subparagraph}
\minisec{minisec} \label{sec:minisec}
% Section Command Variations
\section[Test]{section} \label{sec:sectionwithoption}
\section*{section} \label{sec:sectionwithstar}
% Eqref filter
\begin{align}
x = 2 \label{eq:section}
\end{align}
| {
"alphanum_fraction": 0.7487309645,
"avg_line_length": 23.1764705882,
"ext": "tex",
"hexsha": "61c9c4c4e10d30b9135f3726123d9d294b254471",
"lang": "TeX",
"max_forks_count": 4,
"max_forks_repo_forks_event_max_datetime": "2018-03-05T12:19:50.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-12-12T05:15:05.000Z",
"max_forks_repo_head_hexsha": "401a072f87596800aba455ca4c43207231b0a7f8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "fabiofortkamp/fatomrc",
"max_forks_repo_path": "packages/autocomplete-latex-references/spec/spec.tex",
"max_issues_count": 10,
"max_issues_repo_head_hexsha": "401a072f87596800aba455ca4c43207231b0a7f8",
"max_issues_repo_issues_event_max_datetime": "2021-07-25T14:52:47.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-10-27T15:53:44.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "fabiofortkamp/fatomrc",
"max_issues_repo_path": "packages/autocomplete-latex-references/spec/spec.tex",
"max_line_length": 55,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "65504d5e7084de9b548d38db65e6680b2fbd27b4",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "bavandrade/atom-autocomplete-latex-references",
"max_stars_repo_path": "spec/spec.tex",
"max_stars_repo_stars_event_max_datetime": "2019-12-02T13:39:38.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-12-13T07:20:59.000Z",
"num_tokens": 256,
"size": 788
} |
\chapter{Vector bundles} | {
"alphanum_fraction": 0.8333333333,
"avg_line_length": 24,
"ext": "tex",
"hexsha": "6d1fc2c5e1585d20fae823e98b80e50cffea3510",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0f5a2e7fe9ffb54554ecce78b8f8b4670a64522e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "luisgrivas/simplemath",
"max_forks_repo_path": "diff-top-broker/chapter3.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0f5a2e7fe9ffb54554ecce78b8f8b4670a64522e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "luisgrivas/simplemath",
"max_issues_repo_path": "diff-top-broker/chapter3.tex",
"max_line_length": 24,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "0f5a2e7fe9ffb54554ecce78b8f8b4670a64522e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "luisgrivas/simplemath",
"max_stars_repo_path": "diff-top-broker/chapter3.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 6,
"size": 24
} |
% -*- root: ../thesis.tex -*-
%!TEX root = ../thesis.tex
% ******************************* Thesis Appendix A ****************************
\chapter{Appendix A }
| {
"alphanum_fraction": 0.3726708075,
"avg_line_length": 32.2,
"ext": "tex",
"hexsha": "fe4bbad1c6030ed3fca2c7336897087060b21b5a",
"lang": "TeX",
"max_forks_count": 10,
"max_forks_repo_forks_event_max_datetime": "2021-04-23T07:56:48.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-04-07T16:53:55.000Z",
"max_forks_repo_head_hexsha": "f1f36a42437966ea7037ac1496224f08d42308c0",
"max_forks_repo_licenses": [
"Zlib",
"MIT"
],
"max_forks_repo_name": "visenger/TUB_PhDThesisTemplate",
"max_forks_repo_path": "Appendix1/appendix1.tex",
"max_issues_count": 6,
"max_issues_repo_head_hexsha": "f1f36a42437966ea7037ac1496224f08d42308c0",
"max_issues_repo_issues_event_max_datetime": "2021-11-17T16:41:27.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-04-02T16:14:31.000Z",
"max_issues_repo_licenses": [
"Zlib",
"MIT"
],
"max_issues_repo_name": "visenger/TUB_PhDThesisTemplate",
"max_issues_repo_path": "Appendix1/appendix1.tex",
"max_line_length": 80,
"max_stars_count": 26,
"max_stars_repo_head_hexsha": "f1f36a42437966ea7037ac1496224f08d42308c0",
"max_stars_repo_licenses": [
"Zlib",
"MIT"
],
"max_stars_repo_name": "holgern/TUB_PhDThesisTemplate",
"max_stars_repo_path": "Appendix1/appendix1.tex",
"max_stars_repo_stars_event_max_datetime": "2021-09-15T17:47:55.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-09-15T13:08:03.000Z",
"num_tokens": 33,
"size": 161
} |
\section{Conclusions and future work}
We have defined a \clos{}-based protocol for lexical environments.
This protocol can be used by any code walker such as a compiler or a
version of \texttt{macroexpand-all}. Compared to the protocol defined
in CLtL2 \cite{Steele:1990:CLL:95411}, ours is complete in that it has
operators for querying an environment for references to tags and
blocks, and for augmenting environments with such entities.
Furthermore, our protocol is implemented in the \trucler{} library.
\trucler{} supplies implementations for some existing \commonlisp{}
implementations, currently \sbcl{} and \ccl{}. The library also
contains a \emph{reference implementation} that can be used in new
\commonlisp{} implementations that do not have an existing native
representation of lexical environments, such as \sicl{} and \clasp{}.
Future work involves adding more supported existing \commonlisp{}
implementations. Individual implementations may require additional
protocol functions, but such functions will have names in a package
that is specific to the implementation.
Future work also involves investigating what new functionality might
be required in the reference implementation in order to support
specific requirements of new \commonlisp{} implementations that choose
to use an extended version of the \trucler{} reference
implementation.
| {
"alphanum_fraction": 0.8103953148,
"avg_line_length": 50.5925925926,
"ext": "tex",
"hexsha": "a6bf94bd5585a16d31d33b0a05772112876cd257",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ca5b57f8e4b6b87d45de9d7d06cab6980ca6154e",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "Passw/robert-strandh-SICL",
"max_forks_repo_path": "Papers/Environment-info/sec-conclusions.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ca5b57f8e4b6b87d45de9d7d06cab6980ca6154e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "Passw/robert-strandh-SICL",
"max_issues_repo_path": "Papers/Environment-info/sec-conclusions.tex",
"max_line_length": 70,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ca5b57f8e4b6b87d45de9d7d06cab6980ca6154e",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "Passw/robert-strandh-SICL",
"max_stars_repo_path": "Papers/Environment-info/sec-conclusions.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 294,
"size": 1366
} |
% Option must be passed this way (See https://tex.stackexchange.com/a/74828/187883}
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[aspectratio=169]{beamer}
% Should be first
\usepackage[english]{babel}
\usepackage{fontspec}
\usepackage[utf8]{luainputenc}
% Must be included before tikz when using dvipsnames option (See https://en.wikibooks.org/wiki/LaTeX/Colors#The_68_standard_colors_known_to_dvips)
\usepackage{xcolor}
% No special constraints on order
\usepackage{academicons}
\usepackage[%
backend=biber,
safeinputenc,
sorting=none,
style=numeric
]{biblatex}
\usepackage{calc}
\usepackage{csquotes}
\usepackage{pgf-umlsd}
\usepackage{multicol}
\usepackage{nameref}
\usepackage{smartdiagram}
\usepackage{svg}
\usepackage{tikz}
\usepackage[absolute, overlay]{textpos}
\usepackage{xspace}
\usetikzlibrary{positioning}
\input{commands.tex}
\title{DriveBuild}
\subtitle{Automation of Simulation-based Testing\\of Autonomous Vehicles}
\author{\orcid{0000-0002-6780-6055}Stefan Huber} % chktex 8
\institute{University of Passau}
\titlegraphic{\includegraphics[height=.10\textheight]{media/logoUniPassau.jpg}}
\date{November 27, 2019}
\usetheme{Rochester}
\beamertemplatenavigationsymbolsempty%
\newcommand{\defaultfootline}{%
\raisebox{5pt}{\makebox[\paperwidth]{\hfill\makebox[10pt]{\scriptsize\insertframenumber}}}
}
\setbeamertemplate{footline}{\defaultfootline}
\addbibresource{biblio.bib}
\nocite{*}
\renewcommand*{\bibfont}{\scriptsize}
\begin{document}
{
\setbeamertemplate{footline}{}
\maketitle%
}
\section{Motivation}
\subsection{Background}
% Driving is dangerous
\imageFrame{media/carCrashes.png}
% Most common reasons could be avoided with AVs
\imageFrame[5pt]{media/car-accident-statistics_causes.png} % chktex 8
% Companies want to make the world safer
\imageFrame{media/save-the-world-2.jpg}
% Many companies work on AVs
\imageFrame[60pt]{media/corps-in-autonomous-header.png}
% Companies invest lots of money
\imageFrame[15pt]{media/Autonomous-Vehicle-Investments-Are-Poised-to-Set-a-New-Record-in-2019.png}
% People do not trust AVs
% \imageFrame{media/chartoftheday_13450_perceived_safety_of_self_driving_cars_n.jpg} % chktex 8
% AVs are not safe
\imageFrame{media/lsaqi1oct4aguj5dd7jm.png}
% Number of AV crashes increases
\imageFrame{media/avCrashes.png}
% Testing required
\imageFrame[25pt]{media/testing.jpg}
% Testing requires many cars
% \imageFrame{media/self-parking-vehicles-i-3-1000x675.jpg} % chktex 8 chktex 29
% Testing is very expensive
\imageFrame[15pt]{media/2ef78b50bedc31ec-2048x1024.jpg} % chktex 29
% Testing takes lots of time
\imageFrame{media/clocks.jpg}
% Drive more miles to train AIs
% \imageFrame{media/waymo_10_million_miles.png} % cktex 8
% Infeasible without simulations
\imageFrame[15pt]{media/unnamed__1_.jpg} % chktex 8
\subsection{Problems and Requirements}
% What do testers need?
\imageFrame{media/How-good-are-you-at-I-dont-know.jpg}
% Read lots of papers about testing AVs
\imageFrame{media/lotsOfPaper.jpeg}
% Use students as testers
\input{slides/studentsAsTesters.tex}
% Goals of testers
\input{slides/goalsOfTesters.tex}
% Problems testers share
\input{slides/problemsTestersFace.tex}
\section{Approach of \drivebuild{}}
% Which aspects does DriveBuild handle?
\definecolor{colorFormalize}{HTML}{008148}
\definecolor{colorExecute}{HTML}{C6C013}
\definecolor{colorVerify}{HTML}{EF8A17}
\definecolor{colorGatherData}{HTML}{EF2917}
\input{slides/handledAspects.tex}
\subsection{Formalization}
% Why formalization?
\input{slides/whyFormalization.tex}
\subsection{Execution}
% Why micro services and distribution?
\input{slides/whyExecution.tex}
\subsection{Runtime Verification}
% Why synchronous simulation?
\input{slides/whySynchronousSimulation.tex}
\subsection{Data Collection}
% Why serialization?
\input{slides/whySerialization.tex}
\section{Evaluation}
% What did I evaluate?
\input{slides/whatEvaluated.tex}
% How did I check generality?
\input{slides/generalityMethod.tex}
% Conclusion of generality evaluation?
\input{slides/generalityConclusions.tex}
% How did I check scalability?
\input{slides/scalabilityMethod.tex}
% Scalability on single real node
\imageFrameSvg{diagrams/diagram20a.svg}
% VMs are unreliable
\imageFrameSvg{diagrams/diagram18a.svg}
% Conclusions of scalability evaluation
\input{slides/scalabilityConclusions.tex}
% Where did students struggle?
\input{slides/studentsStruggle.tex}
% Summarize talk
\input{slides/summarizeTalk.tex}
% Whats next?
\input{slides/whatsNext.tex}
% \section{Sources}
% \sectionFrame{}
% \begin{frame}[allowframebreaks]{Sources}
% \printbibliography%
% \end{frame}
\section{Backup Slides}
\sectionFrame{}
\subsection{Formalization}
% What can be formalized?
\input{slides/componentsOfFormalization.tex}
\subsection{Execution}
% How are tests distributed?
\input{slides/dataFlowDistribution.tex}
\subsection{Runtime Verification}
% What steps does the runtime verification?
\input{slides/runtimeVerificationSteps.tex}
% How does the client scheme look like?
\input{slides/clientScheme.tex}
\subsection{Data Collection}
% Which data is available?
\input{slides/availableData.tex}
\subsection{Available Metrics}
% Succeeded/failed/errored/... tests
\imageFrameSvg{diagrams/diagram12a.svg}
% Visualize start up of tests
\imageFrameSvg{diagrams/diagram19b.svg}
% Curvature of evolutionary computing
\imageFrame{diagrams/roadVisualization_G3_translated.png}
% Traveled distance on evolutionary computing
\imageFrame{diagrams/roadVisualization_G3_traveled.png}
% Execution times of tests
\imageFrameSvg{diagrams/diagram14a.svg}
% Sizes of goal areas
\imageFrameSvg{diagrams/diagram13a.svg}
% DeepDriving Example
\videoFrame{media/2019-10-20_DeepDriving_2.mp4}{{\scshape DeepDriving} Example} % chktex 8
\end{document}
| {
"alphanum_fraction": 0.7889876881,
"avg_line_length": 25.5371179039,
"ext": "tex",
"hexsha": "176e7df06ef8353e066a72a0071b95ad71b82bcc",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "TrackerSB/MasterThesis",
"max_forks_repo_path": "2019-11-27_finalPresentation/2019-11-27_finalPresentation.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "TrackerSB/MasterThesis",
"max_issues_repo_path": "2019-11-27_finalPresentation/2019-11-27_finalPresentation.tex",
"max_line_length": 146,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "TrackerSB/MasterThesis",
"max_stars_repo_path": "2019-11-27_finalPresentation/2019-11-27_finalPresentation.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1688,
"size": 5848
} |
\begin{bibunit}[gbt7714-numerical]
\section{Foo}
Foo\cite{oclc2012about}
\putbib[standard]
\end{bibunit}
| {
"alphanum_fraction": 0.752293578,
"avg_line_length": 10.9,
"ext": "tex",
"hexsha": "304c50a11a863e5d1ab0e47e7a15899b7668d2b5",
"lang": "TeX",
"max_forks_count": 120,
"max_forks_repo_forks_event_max_datetime": "2021-10-04T10:01:26.000Z",
"max_forks_repo_forks_event_min_datetime": "2018-12-01T00:42:21.000Z",
"max_forks_repo_head_hexsha": "2cb5f32991bdc10e5499438c81c88111e405291a",
"max_forks_repo_licenses": [
"LPPL-1.3c"
],
"max_forks_repo_name": "shenhao-stu/gbt7714-bibtex-style",
"max_forks_repo_path": "test/testfiles-bibunits/support/section1.tex",
"max_issues_count": 57,
"max_issues_repo_head_hexsha": "2cb5f32991bdc10e5499438c81c88111e405291a",
"max_issues_repo_issues_event_max_datetime": "2021-10-23T00:26:10.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-12-25T23:36:51.000Z",
"max_issues_repo_licenses": [
"LPPL-1.3c"
],
"max_issues_repo_name": "shenhao-stu/gbt7714-bibtex-style",
"max_issues_repo_path": "test/testfiles-bibunits/support/section1.tex",
"max_line_length": 34,
"max_stars_count": 442,
"max_stars_repo_head_hexsha": "2cb5f32991bdc10e5499438c81c88111e405291a",
"max_stars_repo_licenses": [
"LPPL-1.3c"
],
"max_stars_repo_name": "walkerguo/gbt7714-bibtex-style",
"max_stars_repo_path": "test/testfiles-bibunits/support/section1.tex",
"max_stars_repo_stars_event_max_datetime": "2021-10-22T02:47:40.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-12-03T11:00:26.000Z",
"num_tokens": 41,
"size": 109
} |
% Copyright 2018 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\section{Installation}
There are different ways of installing \pgfname, depending on your system and
needs, and you may need to install other packages as well, see below. Before
installing, you may wish to review the licenses under which the package is
distributed, see Section~\ref{section-license}.
Typically, the package will already be installed on your system. Naturally, in
this case you do not need to worry about the installation process at all and
you can skip the rest of this section.
\subsection{Package and Driver Versions}
This documentation is part of version \pgfversion\ of the \pgfname\ package. In
order to run \pgfname, you need a reasonably recent \TeX\ installation. When
using \LaTeX, you need the following packages installed (newer versions should
also work):
%
\begin{itemize}
\item |xcolor| version \xcolorversion.
\end{itemize}
%
With plain \TeX, |xcolor| is not needed, but you obviously do not get its
(full) functionality.
Currently, \pgfname\ supports the following backend drivers:
%
\begin{itemize}
\item |luatex| version 0.76 or higher. Most earlier versions also work.
\item |pdftex| version 0.14 or higher. Earlier versions do not work.
\item |dvips| version 5.94a or higher. Earlier versions may also work.
For inter-picture connections, you need to process pictures using
|pdftex| version 1.40 or higher running in DVI mode.
\item |dvipdfm| version 0.13.2c or higher. Earlier versions may also
work.
For inter-picture connections, you need to process pictures using
|pdftex| version 1.40 or higher running in DVI mode.
\item |dvipdfmx| version 0.13.2c or higher. Earlier versions may also
work.
\item |dvisvgm| version 1.2.2 or higher. Earlier versions may also work.
\item |tex4ht| version 2003-05-05 or higher. Earlier versions may also
work.
\item |vtex| version 8.46a or higher. Earlier versions may also work.
\item |textures| version 2.1 or higher. Earlier versions may also work.
\item |xetex| version 0.996 or higher. Earlier versions may also work.
\end{itemize}
Currently, \pgfname\ supports the following formats:
%
\begin{itemize}
\item |latex| with complete functionality.
\item |plain| with complete functionality, except for graphics inclusion,
which works only for pdf\TeX.
\item |context| with complete functionality, except for graphics
inclusion, which works only for pdf\TeX.
\end{itemize}
For more details, see Section~\ref{section-formats}.
\subsection{Installing Prebundled Packages}
I do not create or manage prebundled packages of \pgfname, but, fortunately,
nice other people do. I cannot give detailed instructions on how to install
these packages, since I do not manage them, but I \emph{can} tell you were to
find them. If you have a problem with installing, you might wish to have a look
at the Debian page or the MiK\TeX\ page first.
\subsubsection{Debian}
The command ``|aptitude install pgf|'' should do the trick. Sit back and relax.
\subsubsection{MiKTeX}
For MiK\TeX, use the update wizard to install the (latest versions of the)
packages called |pgf| and |xcolor|.
\subsection{Installation in a texmf Tree}
For a permanent installation, you place the files of the \textsc{pgf} package
in an appropriate |texmf| tree.
When you ask \TeX\ to use a certain class or package, it usually looks for the
necessary files in so-called |texmf| trees. These trees are simply huge
directories that contain these files. By default, \TeX\ looks for files in
three different |texmf| trees:
%
\begin{itemize}
\item The root |texmf| tree, which is usually located at
|/usr/share/texmf/| or |c:\texmf\| or somewhere similar.
\item The local |texmf| tree, which is usually located at
|/usr/local/share/texmf/| or |c:\localtexmf\| or somewhere similar.
\item Your personal |texmf| tree, which is usually located in your home
directory at |~/texmf/| or |~/Library/texmf/|.
\end{itemize}
You should install the packages either in the local tree or in your personal
tree, depending on whether you have write access to the local tree.
Installation in the root tree can cause problems, since an update of the whole
\TeX\ installation will replace this whole tree.
\subsubsection{Installation that Keeps Everything Together}
Once you have located the right texmf tree, you must decide whether you want to
install \pgfname\ in such a way that ``all its files are kept in one place'' or
whether you want to be ``\textsc{tds}-compliant'', where \textsc{tds} means
``\TeX\ directory structure''.
If you want to keep ``everything in one place'', inside the |texmf| tree that
you have chosen create a sub-sub-directory called |texmf/tex/generic/pgf| or
|texmf/tex/generic/pgf-|\texttt{\pgfversion}, if you prefer. Then place all
files of the |pgf| package in this directory. Finally, rebuild \TeX's filename
database. This is done by running the command |texhash| or |mktexlsr| (they are
the same). In MiK\TeX, there is a menu option to do this.
\subsubsection{Installation that is TDS-Compliant}
While the above installation process is the most ``natural'' one and although I
would like to recommend it since it makes updating and managing the \pgfname\
package easy, it is not \textsc{tds}-compliant. If you want to be
\textsc{tds}-compliant, proceed as follows: (If you do not know what
\textsc{tds}-compliant means, you probably do not want to be
\textsc{tds}-compliant.)
The |.tar| file of the |pgf| package contains the following files and
directories at its root: |README|, |doc|, |generic|, |plain|, and |latex|. You
should ``merge'' each of the four directories with the following directories
|texmf/doc|, |texmf/tex/generic|, |texmf/tex/plain|, and |texmf/tex/latex|. For
example, in the |.tar| file the |doc| directory contains just the directory
|pgf|, and this directory has to be moved to |texmf/doc/pgf|. The root |README|
file can be ignored since it is reproduced in |doc/pgf/README|.
You may also consider keeping everything in one place and using symbolic links
to point from the \textsc{tds}-compliant directories to the central
installation.
\vskip1em For a more detailed explanation of the standard installation process
of packages, you might wish to consult
\href{http://www.ctan.org/installationadvice/}{|http://www.ctan.org/installationadvice/|}.
However, note that the \pgfname\ package does not come with a |.ins| file
(simply skip that part).
\subsection{Updating the Installation}
To update your installation from a previous version, all you need to do is to
replace everything in the directory |texmf/tex/generic/pgf| with the files of
the new version (or in all the directories where |pgf| was installed, if you
chose a \textsc{tds}-compliant installation). The easiest way to do this is to
first delete the old version and then proceed as described above. Sometimes,
there are changes in the syntax of certain commands from version to version. If
things no longer work that used to work, you may wish to have a look at the
release notes and at the change log.
| {
"alphanum_fraction": 0.751962111,
"avg_line_length": 42.9651162791,
"ext": "tex",
"hexsha": "307e972f66fd9713de2dbca57546daffaef643d3",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "52fe6e0cd5af6b4610fd344a7392cca11bc5a72e",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "waqas4afzal/LatexUrduBooksTools",
"max_forks_repo_path": "Texlive_Windows_x32/2020/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-installation.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "52fe6e0cd5af6b4610fd344a7392cca11bc5a72e",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "waqas4afzal/LatexUrduBooksTools",
"max_issues_repo_path": "Texlive_Windows_x32/2020/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-installation.tex",
"max_line_length": 90,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "52fe6e0cd5af6b4610fd344a7392cca11bc5a72e",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "waqas4afzal/LatexUrduBooksTools",
"max_stars_repo_path": "Texlive_Windows_x32/2020/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-installation.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1917,
"size": 7390
} |
documentclass{beamer}
\usepackage[italian]{babel}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
%\usepackage{pgfplots}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{subfiles}
\usepackage{verbatim}
\AfterEndEnvironment{lstlisting}{\leavevmode}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{quotes,angles,positioning}
\usepackage{xcolor} % for setting colors
% set the default code style
\lstset{
language=Prolog,
breaklines = true,
basicstyle=\ttfamily\scriptsize,
tabsize=3,
showstringspaces=false,
numbers=none,
%keywordstyle=\color{blue},
%stringstyle=\color{red},
commentstyle=\color{gray}
}
\usetheme{Szeged}
%\usetheme{Darmstadt}
%\usetheme{Frankfurt}
%\usetheme{AnnArbor}
%\usetheme{Berkeley}
%\usetheme{Madrid}
%\usetheme{Hannover}
%\usetheme{Luebeck}
%\usetheme{Berlin}
%\usetheme{Rochester}
%\usetheme{default}
%\usetheme{Warsaw}
%\usecolortheme{spruce}
\usecolortheme{dolphin}
%\usecolortheme{rose}
%\usecolortheme{seahorse}
%\usecolortheme{whale}
%\setbeamertemplate{navigation symbols}{}
%------------------------------------------------------------
%This block of code defines the information to appear in the
%Title page
\titlegraphic{\hfill\includegraphics[scale=0.05]{img/logo_unipr.png}}
\title {JSetL: a Java library to support Constraint Logic Programming}
\author[Vetere F.] {
\large{\textsc{Author}: Francesco Vetere\\ \small \textsc{e-mail:} \href{mailto:[email protected]}{[email protected]} }
}
\institute[Francesco Vetere]
{
\textsc{University of Parma}
}
\date {\textsc{A.Y. 2019/2020}}
%End of title page configuration block
%------------------------------------------------------------
\usepackage{algorithm}
\usepackage{algpseudocode}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\begin{document}
%The next statement creates the title page.
\begin{frame}
\maketitle
\end{frame}
%This block of code is for the table of contents after
%the title page
%\begin{frame}
%\frametitle{Sommario}
%\tableofcontents
%\end{frame}
\section{Logic Programming}
\begin{frame}{Logic Programming}
\begin{itemize}
\item \textbf{Declarative programming} is a programming style in which, generally speaking, the
programmer provides the properties that the desired solution should have, rather than specifying the actual sequence of operations needed in order to obtain that solution.
\item \textbf{Logic programming} is a declarative programming paradigm based on formal logic: basically, any program is composed by a list of \emph{facts} and \emph{rules}.\\
Given a certain \textit{goal}, we want to demonstrate the truth of the goal using the \emph{knowledge base} formed by facts and rules.
\end{itemize}
\end{frame}
\begin{frame}{Unification}
A key concept in logic programming is the one of unification.\\
\begin{itemize}
\item In logic, \textbf{unification} is the algorithmic procedure used in solving equations involving symbolic expressions. \\
\item In other words, by replacing certain sub-expression variables with other expressions, unification tries to \textbf{identify two symbolic expressions}.\\
\item We say that two terms unify if they are the same term or if they contain variables that can be uniformly instantiated with terms in such a way that the resulting terms are equal. \\
\item In \textbf{Prolog}, for example, when we try to unify two terms, the interpreter performs all the necessary variable instantiations, so that the terms really are equal afterwards: if the unification succeeds, Prolog also gives us the value of the instantiated variables.
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Logic programming in Prolog}
\begin{columns}
\column{0.7\textwidth}
Let's see a basic example in Prolog:
\column{0.3\textwidth}
\includegraphics[scale=0.15]{img/logo_swipl.png}
\end{columns}
\begin{exampleblock}{family.pl}
\lstinputlisting[basicstyle=\ttfamily\scriptsize]{code/family.pl}
\end{exampleblock}
Let's now query our program:\\
\begin{lstlisting}
?- grandfather(a, c).
true.
?- grandfather(X, c).
X = a .
\end{lstlisting}
\end{frame}
\section{Constraint Logic Programming}
\begin{frame}{Constraint Logic Programming}
\begin{itemize}
\setlength\itemsep{2em}
\item \textbf{Constraint Logic Programming} (\emph{CLP}) is a form of logic programming in which the user can explicitly manipulate \emph{constraints} (= relations over certain domains).\\
\item Basically, it's an extension of the logic paradigm, in which we allow the user to use constraints into rules.\\
These kind of problems are often called \textbf{Constraint Satisfaction Problems} (\emph{CSP}), and Prolog supports them through different modules, like \emph{clpfd}.
\end{itemize}
\end{frame}
\begin{frame}{SEND + MORE = MONEY}
\begin{columns}
\column{0.5\textwidth}
\begin{itemize}
\item Let's analyze a classic CSP, the SEND + MORE = MONEY puzzle.\\
\item It is a cryptarithmetic problem, in which we want to find numeric values for the letters S,E,N,D,M,O,R,Y, such that, if they are considered in decimal ordering, the equation holds.
\end{itemize}
\column{0.5\textwidth}
\includegraphics[scale=0.2]{img/money.jpg}
\end{columns}
\end{frame}
\begin{frame}[fragile]
\frametitle{SEND + MORE = MONEY in Prolog}
Let's see the solution in Prolog:
\begin{exampleblock}{money.pl}
\begin{lstlisting}[mathescape]
:- use_module(library(clpfd)).
money(S, E, N, D, M, O, R, Y) :-
[S,E,N,D,M,O,R,Y] ins 0..9,
all_different([S, E, N, D, M, O, R, Y]),
S $\color{red} \#>=$ 1, M $\color{red} \#>=$ 1,
1000*S + 100*E + 10*N + 1*D +
1000*M + 100*O + 10*R + 1*E $\color{red} \#=$
10000*M + 1000*O + 100*N + 10*E + 1*Y,
label([S, E, N, D, M, O, R, Y]).
\end{lstlisting}
\end{exampleblock}
\begin{columns}
\column{0.7\textwidth}
Let's now query our program:
\begin{lstlisting}
?- money(S, E, N, D, M, O, R, Y).
S = 9, E = 5, N = 6, D = 7,
M = 1, O = 0, R = 8, Y = 2.
\end{lstlisting}
\column{0.3\textwidth}
\includegraphics[scale=0.04]{img/money_result.png}
\end{columns}
\end{frame}
\section{JSetL}
\begin{frame}{What is JSetL?}
\begin{columns}
\column{0.75\textwidth}
\begin{itemize}
\setlength\itemsep{2em}
\item \textbf{JSetL} is a Java library that has been developed at the University of Parma since 2002.\\
(\url{http://www.clpset.unipr.it/jsetl/})\\
\item It allows the user to use a \textbf{declarative programming style} inside Java, making it very easy to \textbf{declare and solve constraints} on logical objects.
\end{itemize}
\column{0.25\textwidth}
\includegraphics[scale=0.3]{img/JSetL.png}
\end{columns}
\end{frame}
\begin{frame}{Main Features}
JSetL combines the classical O-O paradigm of Java with some \textbf{typical concepts} of the \textbf{constraint logic paradigm}, such as:
\vspace{5 mm}
\begin{itemize}
\setlength\itemsep{2em}
\item Logical variables
\item Unification
\item Constraints resolution
\item Non-determinism
\end{itemize}
\end{frame}
\begin{frame}{JSetL classes}
JSetL offers a series of useful \textbf{Java classes}, in order to fully support the declarative style we discussed.\\
Some of these classes are:
\vspace{5mm}
\begin{itemize}
\setlength\itemsep{2em}
\item LVar
\item LSet
\item Constraint
\item Solver
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{LVar}
\begin{itemize}
\setlength\itemsep{3em}
\item The class \texttt{LVar} implements the concept of \textbf{logical variable}, as already seen in Prolog: a variable in a logic programming language is initially undefined (\textbf{unbound}), but may get \textbf{bound} to a value or another logic variable during unification of the containing clause with the current goal.\\
The value bounded to the variable may contain other variables which may themselves be bound or unbound.\\
\item Clearly, this is \textbf{quite different} from the concept of variable in the \textbf{imperative paradigm}!\\
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{LVar}
Examples:\\
\begin{lstlisting}
/* Creation of an unbounded LVar (no associated name) */
LVar A = new LVar();
/* Creation of a LVar bounded to the integer 1 (no associated name) */
LVar B = new LVar(1);
/* Creation of a LVar bounded to the integer 3, with associated name "C" */
LVar C = new LVar("C", 3);
\end{lstlisting}
A special subclass of \texttt{LVar} is \texttt{IntLVar}:
\begin{lstlisting}
/* Creation of an unbounded IntLVar with domain [0..9], and associated name "X" */
IntLVar D = new IntLVar("X", 0, 9);
\end{lstlisting}
These kind of \texttt{LVar} objects are very important, because we can apply to them constraints like \texttt{sum}, \texttt{mul}, and many others.
\end{frame}
\begin{frame}[fragile]
\frametitle{LSet}
\begin{itemize}
\setlength\itemsep{2em}
\item The class \texttt{LSet} implements the concept of a \textbf{logical object collection}, organized in the form of a \textbf{mathematical set}.\\
\item A logical set can contain any other object (in particular, other \texttt{LSet} objects), ignoring any element repetition.\\
\item Similarly to \texttt{LVar}, \texttt{LSet} object can be bound or unbound, but they can also be \textbf{completely} or \textbf{partially specified}!\\
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{LSet}
Examples:\\
\begin{lstlisting}[mathescape]
/* Creation of an unbounded LSet without any associated name
(it represent a completely variable(unspecified) set) */
LSet A = new LSet();
/* Creation of a completely specified set, bounded and without any associated name
(it represents the set {1,2,3}) */
LSet B = LSet.empty().ins(1).ins(2).ins(3);
/* Creation of a partially specified set, unbounded and with associated name "C"
(it represents the set {_LV1, _LV2} $\color{gray} \cup$ C)
(note that the first two LVar have no associated name) */
LSet C = new LSet("C").ins(new LVar()).ins(new LVar());
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Constraint}
\begin{itemize}
\setlength\itemsep{2em}
\item The class \texttt{Constraint} implements the concept of \textbf{logical constraint} in JSetL.\\
\item A constraint is a \emph{relation} that can be applied to a logical variable (\texttt{LVar}) or to a logical set (\texttt{LSet}).\\
\item It can be either \emph{atomic} or \emph{composed}.\\
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Constraint}
\begin{itemize}
\setlength\itemsep{2em}
\item \textbf{Atomic constraints}, which can be:\\
\begin{itemize}
\setlength\itemsep{1em}
\item The \emph{empty} constraint (denoted as \texttt{[]})\\
\item $ e_{0}.op(e_{1},...,e_{n}) $ or $op(e_{0},e_{1},...,e_{n}) $ with $ n = 0,...,3 $\\
where $op$ is the constraint name, and $e_{i} (0 \le i \le 3)$ are expressions whose type depends on $op$.\\
\end{itemize}
\item \textbf{Composed constraints}, which can be obtained by:
\begin{itemize}
\setlength\itemsep{1em}
\item Conjuction ($ c_{1}.and(c_{2}) $)
\item Disjunction ($ c_{1}.or(c_{2}) $)
\item Implication ($ c_{1}.impliesTest(c_{2}) $)\\
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}{Some constraints on LSet}
\begin{table}[]
\begin{tabular}{|l|l|l|}
\hline
\textsc{Constraint} & \textsc{JSetL} & \textsc{Semantic}\\ \hline
Equality & \texttt{A.eq(B)} & \texttt{A} $=$ \texttt{B} \\ \hline
Disjunction & \texttt{A.disj(B)} & \texttt{A} $\cap$ \texttt{B} $=$ $\varnothing$ \\ \hline
Union & \texttt{A.union(B,C)} & \texttt{C} $=$ \texttt{A} $\cup$ \texttt{B} \\ \hline
Intersection & \texttt{A.inters(B,C)} & \texttt{C} $=$ \texttt{A} $\cap$ \texttt{B} \\ \hline
Difference & \texttt{A.diff(B,C)} & \texttt{C} $=$ \texttt{A} $\setminus$ \texttt{B} \\ \hline
\end{tabular}
\end{table}
\end{frame}
\begin{frame}[fragile]
\frametitle{Solver}
\begin{itemize}
\setlength\itemsep{2em}
\item The \textbf{constraint solver} is implemented by the class \texttt{Solver}.\\
\item This class provides methods to \textbf{add, show} and \textbf{solve} constraints.\\
\item Constraints are solved through \textbf{syntax-rewriting rules}, and the solving algorithm ends when there are no more rules to apply (or when a \texttt{Failure} exception is thrown, in the case of a non satisfiable constraint).\\
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Solver class methods}
These are the main methods provided by the \texttt{Solver} class:\\
\begin{itemize}
\item public void \textbf{add}(Constraint c)\\
Adds the constraint \texttt{c} to the constraint store of the solver.\\
\item public void \textbf{showStore}()\\
Prints the conjuction of all the constraint in the constraint store which are still in a non-solved form.\\
\item public void \textbf{solve}()\\
Tries to solve the constraints in the constraint store: if they are not satisfiable, it throws a \texttt{Failure} exception.\\
\item public boolean \textbf{check}()\\
Like \texttt{solve()}, but no exceptions are thrown: it just returns \texttt{true} if the constraints in the constraint store are satisfiable, \texttt{false} otherwise.\\
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{SEND + MORE = MONEY with JSetL}
Let's try to implement the previous SEND + MORE = MONEY puzzle seen before in Prolog, this time in Java using JSetL:\\
\begin{exampleblock}{Money.java}
\begin{lstlisting}
IntLVar s = new IntLVar("S", 0, 9);
/*...*/
IntLVar money = new IntLVar("MONEY");
IntLVar[] letters = {s, e, n, d, m, o, r, y};
Solver solver = new Solver();
/* S >= 1 and M >= 1 */
solver.add(s.ge(1).and(m.ge(1)));
/* Each variable is different from each other */
solver.add(Constraint.allDifferent(
(Object[]) letters)
);
\end{lstlisting}
\end{exampleblock}
\end{frame}
\begin{frame}[fragile]
\frametitle{SEND + MORE = MONEY with JSetL}
\begin{lstlisting}
/* SEND = S*1000 + E*100 + N*10 + D */
solver.add(send.eq(s.mul(1000).sum(e.mul(100).sum(n.mul(10).sum(d)))));
/* MORE = M*1000 + O*100 + R*10 + E */
solver.add(more.eq(m.mul(1000).sum(o.mul(100).sum(r.mul(10).sum(e)))));
/* MONEY = M*10000 + O*1000 + N*100 + E*10 + Y */
solver.add(money.eq(m.mul(10000).sum(o.mul(1000).sum(n.mul(100).sum(e.mul(10).sum(y))))));
/* MONEY = SEND + MORE */
solver.add(money.eq(send.sum(more)));
/* Labeling on the variables */
solver.add(s.label());
/*...*/
/* Try to find a solution */
solver.solve();
\end{lstlisting}
\end{frame}
\begin{frame}{ }
\centering \huge Thanks for your attention!
\end{frame}
\end{document}
| {
"alphanum_fraction": 0.7045531425,
"avg_line_length": 33.6697038724,
"ext": "tex",
"hexsha": "1f3e0cb763a20ad7df30993c1d15a44df55cd4f0",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "637b1b2744b295ce6a28c9b4af59e70ddd53ebf8",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "francescovetere/jsetl-presentation",
"max_forks_repo_path": "presentation/presentation-vetere-francesco.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "637b1b2744b295ce6a28c9b4af59e70ddd53ebf8",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "francescovetere/jsetl-presentation",
"max_issues_repo_path": "presentation/presentation-vetere-francesco.tex",
"max_line_length": 328,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "637b1b2744b295ce6a28c9b4af59e70ddd53ebf8",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "francescovetere/jsetl-presentation",
"max_stars_repo_path": "presentation/presentation-vetere-francesco.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 4598,
"size": 14781
} |
% $Header$
% $Author: fager $
% $Date: 2009-04-28 20:51:04 +0200 (ti, 28 apr 2009) $
% $Revision: 99 $
% $Log$
% Revision 1.4 2005/02/27 18:32:56 fager
% Correction from BH implemented.
%
% Revision 1.3 2005/02/22 07:31:00 fager
% Corrections from M.Kelly implemented
%
% Revision 1.2 2004/10/21 18:59:06 fager
% Version logging added. Comments from KA implemented.
%
\section{X-parameter data access and manipulation}\label{sec:SPMod}
The most valuable feature of MuWave is for most users the
possibility to handle and manipulate S/Y/Z/T\footnote{Hereafter
``X-parameter'' is used to refer either of the
S/Y/Z/T-parameters.} in a convenient way. This section gives an
overview of the variety of possibilities offered.
\subsection{Direct parameter access}
Any of the X-parameters can be directly accessed from the
\verb"meassp" object by using the ``dot-operator'' notation or a
get command:
\begin{small}
\begin{verbatim}
>> msp.Z11
ans =
1.0e+002 *
1.0467 - 5.6792i
0.8499 - 3.9010i
...
>> 20*log10(abs(get(msp,'S21')))
ans =
11.9806
12.0251
11.9318
...
\end{verbatim}
\end{small}
By this it was also illustrated how MuWave automatically converts
from the S-para\-meters in \verb"msp" into the desired type, as in
\verb"msp.Z11". Note that these functions all return a row vector
that can be involved in any complex mathematical vector
manipulation that \matlab supports.
\subsection{Parameter assignment}
It is also possible to assign new values for a particular
X-parameter data using a simple assignment:
\begin{small}
\begin{verbatim}
>> msp.S11 = 0.1*msp.S11;
\end{verbatim}
\end{small}
If the parameter type being assigned differs from the type of the
\verb"meassp" object it is operating on, a conversion takes place
to match the type of parameter that is being assigned:
\begin{small}
\begin{verbatim}
>> msp
...
xparam-object
type: S
reference: 50
ports: 2
elements: 101
freq: 1E+009 -> 5E+010
...
>> msp.Z11 = zeros(length(msp.freq),1);
>> msp
...
xparam-object
type: Z
reference: 50
ports: 2
elements: 101
freq: 1E+009 -> 5E+010
\end{verbatim}
\end{small}
\subsection{Matrix operations}
There are three levels one can choose from when doing matrix
operations on one or several X-parameter objects. Which to choose
depends on the complexity of the operations involved.
\subsubsection{xparam}
On the highest level it is possible to operate directly with the
\verb"xparam"-objects. The \verb"xparam"-object is extracted from
the \verb"meassp" object using:
\begin{small}
\begin{verbatim}
xparam-object
type: S
reference: 50
ports: 2
elements: 101
freq: 1E+009 -> 5E+010
\end{verbatim}
\end{small}
where, again, the dot-operator has been applied to the
\verb"meassp" object.
The \verb"xparam" objects contain information about i.e. the type
of data (S/Z/Y/T). MuWave therefore automatically converts between
these types so that they match i.e. when adding two objects.
\begin{small}
\begin{verbatim}
>> Zp = msp.Z;
>> Yp = msp.Y;
>> Zp_sum = Zp + Yp
Warning: XPARAM.PLUS: Arguments not of same type. Conversion performed
> In xparam.plus at 25
xparam-object
type: Z
reference: 50
ports: 2
elements: 101
freq: 1E+009 -> 5E+010
\end{verbatim}
\end{small}
Although only shown for addition here, a lot of other algebraic
manipulations have been implemented for the \verb"xparam" class.
However, be careful that the conversions sometimes taking place
when operating on \verb"xparam" objects of different type may give
undesired results. Please check out the online help for details on
how each operation works.
It often turns out to be more reliable to operate on the data
directly by accessing the underlying \verb"arraymatrix" object.
\subsubsection{arraymatrix}
The \verb"arraymatrix" is accessed from the \verb"xparam" object:
\begin{small}
\begin{verbatim}
>> Sp = msp.S;
>> Sp_array = get(Sp,'arraymatrix')
arraymatrix-object
dimension: 2 x 2
elements: 101
First matrix element:
0.9921 - 0.0697i 0.0009 + 0.0037i
-3.9645 + 0.2474i 0.8495 - 0.0128i
\end{verbatim}
\end{small}
The \verb"arraymatrix" can also be directly accessed from the
\verb"meassp" object by
\begin{small}
\begin{verbatim}
>> Sp_array = get(msp,'arraymatrix');
\end{verbatim}
\end{small}
Individual parameters of the \verb"arraymatrix" object are
accessed and assigned using parentheses \verb"()",
\begin{small}
\begin{verbatim}
>> Sp_array2 = Sp_array;
>> Sp_array2(1,1) = Sp_array2(2,2)
arraymatrix-object
dimension: 2 x 2
elements: 101
First matrix element:
0.8495 - 0.0128i 0.0009 + 0.0037i
-3.9645 + 0.2474i 0.8495 - 0.0128i
\end{verbatim}
\end{small}
Matrix operations are carried out in a similar straightforward fashion,
\begin{small}
\begin{verbatim}
>> Sp_array3 = Sp_array2*Sp_array
arraymatrix-object
dimension: 2 x 2
elements: 101
First matrix element:
0.8376 - 0.0866i 0.0016 + 0.0063i
-7.2809 + 0.7830i 0.7172 - 0.0365i
\end{verbatim}
\end{small}
where the matrix multiplication of \verb"Sp_array2" and
\verb"Sp_array" is carried out independently for each frequency
point. A variety of other algebraic operations are implemented for
the \verb"arraymatrix" class.
Finally, it is usually to put the manipulated \verb"arraymatrix"
object back into the \verb"meassp" context:
\begin{small}
\begin{verbatim}
>> Sp = xparam(Sp_array3,'S',50);
>> msp_new = msp;
>> msp_new.data = Sp;
\end{verbatim}
\end{small}
\subsubsection{3d-matrix}
In rare cases, the functions implemented for the
\verb"arraymatrix" class are not sufficient to solve a particular
problem. The way out is then to access the X-parameter data in its
raw form, i.e. in the way it is \emph{actually} stored in \matlab.
The data is stored as a 3-dimensional matrix, where the first two
dimensions correspond to the row and columns of the X-parameter
matrix at each frequency. The third dimension is the frequency.
This means that, e.g. a two-port S-parameter measurement with 101
frequency points will be stored as a 2x2x101-sized complex vector.
This raw data matrix can be accessed directly from the
\verb"xparam", \verb"arraymatrix", or the \verb"meassp" objects by
getting the \verb"mtrx" property:
\begin{small}
\begin{verbatim}
>> Sp = msp.S;
>> raw_data = get(Sp,'mtrx')
raw_data(:,:,1) =
0.9921 - 0.0697i 0.0009 + 0.0037i
-3.9645 + 0.2474i 0.8495 - 0.0128i
raw_data(:,:,2) =
0.9887 - 0.1027i 0.0011 + 0.0053i
-3.9762 + 0.3613i 0.8527 - 0.0303i
...
...
raw_data(:,:,101) =
-0.5639 - 0.5608i 0.0775 + 0.0227i
1.1758 + 1.5074i 0.2195 - 0.7032i
\end{verbatim}
\end{small}
After manipulation, it can be used to create an \verb"arraymatrix"
object,
\begin{small}
\begin{verbatim}
>> new_array = arraymatrix(raw_data);
\end{verbatim}
\end{small}
which, in turn can be converted back into \verb"xparam" and
\verb"meassp" objects as was described above.
| {
"alphanum_fraction": 0.6988723375,
"avg_line_length": 29.8049792531,
"ext": "tex",
"hexsha": "c5754ab19463ad6ebb7b85ff7fc1d7b774420b72",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a91c034b0383dda5458eb4935926b8b65a211311",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "extrakteon/muwave",
"max_forks_repo_path": "doc/usersmanual/SPAccessManipulation.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a91c034b0383dda5458eb4935926b8b65a211311",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "extrakteon/muwave",
"max_issues_repo_path": "doc/usersmanual/SPAccessManipulation.tex",
"max_line_length": 74,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "a91c034b0383dda5458eb4935926b8b65a211311",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "extrakteon/muwave",
"max_stars_repo_path": "doc/usersmanual/SPAccessManipulation.tex",
"max_stars_repo_stars_event_max_datetime": "2017-04-30T17:44:29.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-04-30T17:44:29.000Z",
"num_tokens": 2247,
"size": 7183
} |
\chapter{Error, Warning, and Informational Messages}\label{ch:errors}
Several error, warning, and informational messages will be printed by
\aprepro{} if certain conditions are encountered during the parsing of an
input file. The messages are of the form:
\begin{apinp}
Aprepro: Type: Message (file, line line\#)
\end{apinp}
Where \cmd{Type} is \cmd{ERROR} for an error message, \cmd{WARN} for a
warning message, or \cmd{INFO} for an informational message; \cmd{Message}
is an explanation of the problem, \cmd{file} is the filename being processed
at the time of the message, and \cmd{line\#} is the number of the line
within that file. Error messages are always output, Warning messages
are output by default and can be turned off by using the \cmd{-W} or
\cmd{--warning} command option, and Informational messages are turned off by
default and can be turned on by using the \cmd{-M} or \cmd{--message} command
option. (See Chapter~ref{ch:execution}.)
\section{Error Messages}
\begin{description}
\item[Aprepro: ERROR: parse error (file, line line\#)]
An unrecognized or ill-formed expression has been entered. Parsing of
the file continues following this expression.
\item[Aprepro: ERROR: Can't open 'file': No such file or directory] The file specified
in the include or import command cannot be found or does not exist. Aprepro will terminate
processing following this error message.
\item[Aprepro: ERROR: Can't open 'file': Permission denied] The file specified in the
include, import, or output command could not be opened due to insufficient permission.
Aprepro will terminate processing following this error message.
\item[Aprepro: ERROR: Improperly Nested ifdef/ifndef statements (file, line line\#)]
An invalid ifdef/ifndef block has been detected. Typically this is caused by an
extra endif or else statement.
\item[Aprepro: ERROR: Zero divisor (file, line line\#)] An expression tried
to divide by zero. The expression is given the value of the dividend and parsing continues.
\item[Aprepro: ERROR: Invalid units system type. Valid types are: 'si', 'cgs', 'cgs-ev', 'shock', 'swap', 'ft-lbf-s', 'ft-lbm-s', 'in-lbf-s']
The units system specified in the command could not be found. This
is most likely due to a misspelling of the units system name.
\item[Aprepro: ERROR: function (file, line line\#) DOMAIN error: Argument out of domain]
The arithmetic function function has been passed an invalid
argument. For example, the above error would be printed for each of
the expressions:
\begin{apinp}
\{sqrt(-1.0)\} \{log(0.0)\} \{asin(1.1)\}
\end{apinp}
since the arguments are out of the valid domain for the function. The
value returned by the function following an error is
system-dependent. See the function's man page on your system for more
information.
\end{description}
\section{Warning Messages}
\begin{description}
\item[Aprepro: WARN: Undefined variable 'variable' (file, line line\#)]
A variable is used in an expression before it has been defined. The variable is
set equal to zero or the null string (\texttt{"}\texttt{"}) and parsing continues.
\item[Aprepro: WARN: Variable 'variable' redefined (file, line line\#)]
A previously defined variable is being set equal to a new value.
\item[Aprepro: (IMMUTABLE) Variable 'variable' is immutable and cannot be modified (file, line line\#)]
The value of a variable that was created as an immutable variable was
modified. No value will be returned by the expression. See page~\pageref{immutable} and
page~\ref{immutable_block} for a description of immutable variables.
\end{description}
\section{Informational Messages}
\begin{description}
\item[Aprepro: INFO: Included File: 'filename' (file, line line\#)] The file filename
is being included at line line\# of file file. This message will also be printed
during the execution of a loop block since temporary files are used to implement
the looping function, and during the execution of the units conversion and material
database access routines.
\end{description}
| {
"alphanum_fraction": 0.7615042058,
"avg_line_length": 45.4157303371,
"ext": "tex",
"hexsha": "a0016a7305c96db49b51d9357c1b76de3d206a88",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "54d9c3b68508ca96e3db1fd00c5d84a810fb330b",
"max_forks_repo_licenses": [
"Zlib",
"NetCDF",
"MIT",
"BSL-1.0",
"X11",
"BSD-3-Clause"
],
"max_forks_repo_name": "tokusanya/seacas",
"max_forks_repo_path": "packages/seacas/doc-source/aprepro/errors.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "54d9c3b68508ca96e3db1fd00c5d84a810fb330b",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Zlib",
"NetCDF",
"MIT",
"BSL-1.0",
"X11",
"BSD-3-Clause"
],
"max_issues_repo_name": "tokusanya/seacas",
"max_issues_repo_path": "packages/seacas/doc-source/aprepro/errors.tex",
"max_line_length": 141,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "54d9c3b68508ca96e3db1fd00c5d84a810fb330b",
"max_stars_repo_licenses": [
"Zlib",
"NetCDF",
"MIT",
"BSL-1.0",
"X11",
"BSD-3-Clause"
],
"max_stars_repo_name": "tokusanya/seacas",
"max_stars_repo_path": "packages/seacas/doc-source/aprepro/errors.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1033,
"size": 4042
} |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% GEANT manual in LaTeX form %
% %
% Michel Goossens (for translation into LaTeX) %
% Version 1.00 %
% Last Mod. Jan 24 1991 1300 MG + IB %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Documentation{F.Bruyant}
\Version{Geant 3.16}\Routid{CONS001}
\Submitted{01.10.84} \Revised{17.12.93}
\Makehead{Introduction to the section CONS}
\section{Introduction}
The setup where the particles are transported is represented by a
structure of geometrical volumes. Each volume is
filled with matter (which can have the properties of the vacuum in case
of it contains no matter).
The matter composing the volumes is described via
two sets of attributes. The first set is relative to the nature
of the {\it material} composing the volume, and contains information
such as the atomic number, the atomic weight, the density and so on
(see the description of the routine \Rind{GSMATE} in this section for
more information).
The second set of attributes is relevant to the
process of particle transport
and they define a so-called {\it tracking medium}. These are
parameters such as the material composing the volume,
the magnetic field, the required tracking precision,
the maximum energy that can be lost in one step and so on (see the
description of the routine \Rind{GSTMED} in this section for more
information).
Each tracking medium refers to a material via a {\it material
number} which is assigned by the user. Different tracking media can, with
some limitation, refer to the same material.
Each volume is filled by a tracking medium identified by
a {\it medium number}.
Different volumes may have the same medium number (see {\tt [GEOM]}).
The transport of particles through a
setup ({\tt [TRAK]}) requires access to
data which describe:
\begin{itemize}
\item the geometry of the setup;
\item the {\it material} and {\it tracking medium} parameters;
\item the particle properties.
\end{itemize}
The section {\tt [CONS]} contains the routines
for the storage and retrieval of information related to materials,
tracking media and the particles.
{\bf Important note:} many entities in {\tt GEANT} are user-defined
via a subroutine call. One of the arguments of this subroutine is
a integer number which identifies the entity. Examples are materials,
tracking media, particles and so on. It can be tempting, for booking
purposes, to use very large numbers. For instance, in a large detector,
the number of all the materials in the hadronic calorimeter could be
$1001 \leq I \leq 2000$. Even if these conventions are very handy, they
can introduce a performance penalty.
For reasons of speed, the number provided by the user is used directly
as the number of the link in the {\tt ZEBRA} data structure indicating
where to store the pointer to
the bank containing the information on the entity. {\tt ZEBRA}
pointers are contiguous. Defining an object with a user number of $1000$
forces {\tt ZEBRA} to allow space for $1000$ links. This entails a loss
of space ($999$ words), but much worse than that, induces {\tt ZEBRA} to
believe that there are in fact $999$ more banks. At every operation which
causes a {\it relocation} of banks, {\tt ZEBRA} will check all the possible
links, which can be very time consuming.
So values of user-defined entities must be kept as small as possible and
contiguous. In large applications one could write a routine which returns
the next free number to be allocated, which can then be stored in a variable
and always referenced symbolically, freeing the user from the need to define
ranges. As an example we give here a function performing this operation
for the material number:
\begin{verbatim}
FUNCTION NEXTMA()
+SEQ, GCBANK
IF(JMATE.LE.0) THEN
NEXTMA = 1
ELSE
DO 10 IMAT = 1, IQ(JMATE-2)
IF(LQ(JMATE-IMAT).EQ.0) GOTO 20
10 CONTINUE
20 NEXTMA = IMAT
ENDIF
END
\end{verbatim}
\section{Materials}
The material constants are stored in the data structure {\tt JMATE} via the
routine \Rind{GSMATE} and can be retrieved via the routine \Rind{GFMATE} and
printed via the routine \Rind{GPMATE}. The routine \Rind{GMATE} calls
repeatedly the routine \Rind{GSMATE} to define a standard set of materials,
but its use is not mandatory. Mixtures of basic materials, compounds or
molecules with atoms
from different basic materials, may also be defined and their characteristics
are stored in the structure {\tt JMATE}, through calls to the routine
\Rind{GSMIXT}. Mixtures of compounds are allowed.
Quantities such as energy loss and cross-section tables (see {\tt [PHYS]}),
computed during the initialisation of the program are stored in the
structure {\tt JMATE}. These can be accessed through the routine \Rind{GFTMAT}
and plotted or printed through the routines \Rind{GPLMAT} and \Rind{GPRMAT}
respectively.
\section{Tracking media}
The tracking medium
parameters are stored in the data
structure {\tt JTMED} by the routine \Rind{GSTMED}. Details
about these parameters are given
in {\tt [TRAK]}. They can be accessed with the routine
\Rind{GFTMED} and printed with the routine \Rind{GPTMED}.
The correctness of the transport process and thus the reliability
of the results obtained with {\tt GEANT} depend critically on the
values of the {\it tracking medium parameters}. To help the user,
most of the parameters are recalculated by default by {\tt GEANT}
irrespective of the value assigned by the user. Advanced users
can control the value of the parameters thus bypassing the automatic
computation. See the description of the routine \Rind{GSTMED} for
more information.
The tracking thresholds, and other parameters and flags that control
the physics processes, defined in \Rind{GINIT} and possibly
modified through the relevant data records, are also stored in the structure
{\tt JTMED}. These parameters can be redefined for each tracking medium
via the routine \Rind{GSTPAR}.
\section{Particles}
The parameters of the particles transported by {\tt GEANT}
are stored in the data structure
{\tt JPART} via the routine \Rind{GSPART}.
The decay properties of particles are defined via the routine \Rind{GSDK}.
The particle constants can be
accessed with the routine \Rind{GFPART} and printed with the routine
\Rind{GPPART}.
The routine \Rind{GPART} defines the standard table of particles,
branching ratios and decay modes. This routine needs to be called for
the {\tt GEANT} system to work properly.
\Rind{GPART} calls the routine \Rind{GSPART} for the
particle properties and \Rind{GSDK} for the decays for
each particle in the standard {\tt GEANT} table.
The user may call \Rind{GSPART} and
\Rind{GSDK} to extend or modify the table defined by \Rind {GPART}.
| {
"alphanum_fraction": 0.7191973056,
"avg_line_length": 45.9741935484,
"ext": "tex",
"hexsha": "cb2a5629a95b33fc5c83bff82c07878800abdc99",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "berghaus/cernlib-docs",
"max_forks_repo_path": "geant/cons001.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "berghaus/cernlib-docs",
"max_issues_repo_path": "geant/cons001.tex",
"max_line_length": 78,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "berghaus/cernlib-docs",
"max_stars_repo_path": "geant/cons001.tex",
"max_stars_repo_stars_event_max_datetime": "2019-07-24T12:30:01.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-07-24T12:30:01.000Z",
"num_tokens": 1689,
"size": 7126
} |
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}
\usepackage[scaled=0.8]{beramono}
\usepackage[margin=1.5in]{geometry}
\usepackage{url}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{nicefrac}
\usepackage{microtype}
\usepackage{sectsty}
\sectionfont{\large}
\subsectionfont{\normalsize}
\usepackage{titlesec}
\titlespacing{\section}{0pt}{10pt plus 2pt minus 2pt}{0pt plus 2pt minus 0pt}
\titlespacing{\subsection}{0pt}{5pt plus 2pt minus 2pt}{0pt plus 2pt minus 0pt}
\usepackage{pgfplots}
\pgfplotsset{
compat=newest,
plot coordinates/math parser=false,
tick label style={font=\footnotesize, /pgf/number format/fixed},
label style={font=\small},
legend style={font=\small},
every axis/.append style={
tick align=outside,
clip mode=individual,
scaled ticks=false,
thick,
tick style={semithick, black}
}
}
\pgfkeys{/pgf/number format/.cd, set thousands separator={\,}}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=tikz/]
\newlength\figurewidth
\newlength\figureheight
\setlength{\figurewidth}{8cm}
\setlength{\figureheight}{6cm}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\newcommand{\acro}[1]{\textsc{\MakeLowercase{#1}}}
\newcommand{\given}{\mid}
\newcommand{\mc}[1]{\mathcal{#1}}
\newcommand{\data}{\mc{D}}
\newcommand{\intd}[1]{\,\mathrm{d}{#1}}
\newcommand{\inv}{^{-1}}
\begin{document}
\section*{Coin flipping}
Suppose there is a coin that may be biased -- this coin has unknown
probability $\theta$ of giving a ``heads.'' If we repeatedly flip
this coin and observe the outcomes, how can we maintain our belief
about $\theta$?
Note that the coin-flipping problem can be seen as a simplification of
the survey problem we discussed last time, where we assume that people
always tell the truth, are sampled uniformly at random, and whose
opinions are generated independently (by flipping a coin!).
Before we select a prior for $\theta$, we write down the likelihood.
For a particular problem, it is almost always easier to derive an
appropriate likelihood than it is to identify an appropriate prior
distribution.
Suppose we flip the coin $n$ times and observe $x$ ``heads.'' Every
statistician, regardless of philosophy, would agree that the
probability of this observation, given the value of $\theta$, comes
from a binomial distribution:
\begin{equation*}
\Pr(x \given n, \theta)
=
\binom{n}{x} \theta^x (1 - \theta)^{n - x}.
\end{equation*}
\subsection*{Classical method}
Before we continue with the Bayesian approach, we pause to discuss how
a classical statistician would proceed with this problem. Recall that
in the frequentist approach, the value $\theta$ can only be considered
in terms of the frequency of success (``heads'') seen during an
infinite number of trials. It is not valid in this framework to represent
a ``belief'' about $\theta$ in terms of probability.
Rather, the frequentist approach to reasoning about $\theta$ is to
construct an \emph{estimator} for $\theta$, which in theory can be any
function of the observed data: $\hat{\theta}(x, n)$. Estimators are
then analyzed in terms of their behavior as the number of observations
goes to infinity (for example, we might prove that $\hat{\theta} \to
\theta$ as $n \to \infty$). The classical estimator in this case is
the empirical frequency $\hat{\theta} = \nicefrac{x}{n}$.
\subsection*{Bayesian method}
An interesting thing to note about the frequentist approach is that it
ignores all prior information, opting instead to only look at the
observed data. To a Bayesian, every such problem is different and
should be analyzed contextually given the known information.
With the likelihood decided, we must now choose a prior distribution
$p(\theta)$. A convenient prior in this case is the \emph{beta
distribution,} which has two parameters $\alpha$ and $\beta$:
\begin{equation*}
p(\theta \given \alpha, \beta)
=
\mc{B}(\theta; \alpha, \beta)
=
\frac{1}{B(\alpha, \beta)}
\theta^{\alpha - 1}(1 - \theta)^{\beta - 1}.
\end{equation*}
Here the normalizing constant $B(\alpha, \beta)$ is the \emph{beta
function:}
\begin{equation*}
B(\alpha, \beta)
=
\int_{0}^{1} \theta^{\alpha - 1}(1 - \theta)^{\beta - 1} \intd{\theta}.
\end{equation*}
The support of the beta distribution is $\theta \in (0, 1)$, and by
selecting various values of $\alpha$ and $\beta$, we can control its
shape to represent a variety of different prior beliefs.
Given our observations $\data = (x, n)$, we can now compute the
posterior distribution of $\theta$:
\begin{equation*}
p(\theta \given x, n, \alpha, \beta)
=
\frac
{ \Pr(x \given n, \theta) p(\theta \given \alpha, \beta)}
{\int \Pr(x \given n, \theta) p(\theta \given \alpha, \beta) \intd{\theta}}.
\end{equation*}
First we handle the normalization constant $\Pr(x \given n, \alpha, \beta)$:
\begin{align*}
\int \Pr(x \given n, \theta) p(\theta \given \alpha, \beta) \intd{\theta}
&=
\binom{n}{x}
\frac{1}{B(\alpha, \beta)}
\int_{0}^{1}
\theta^{\alpha + x - 1}(1 - \theta)^{\beta + n - x - 1} \intd{\theta}
\\
&=
\binom{n}{x}
\frac{B(\alpha + x, \beta + n - x)}{B(\alpha, \beta)}.
\end{align*}
Now we apply Bayes theorem:
\begin{align*}
p(\theta \given x, n, \alpha, \beta)
&=
\frac
{ \Pr(x \given n, \theta) p(\theta \given \alpha, \beta)}
{\int \Pr(x \given n, \theta) p(\theta \given \alpha, \beta) \intd{\theta}}
\\
&=
\biggl[
\binom{n}{x}
\frac{B(\alpha + x, \beta + n - x)}{B(\alpha, \beta)}
\biggr]\inv
\biggl[
\binom{n}{x} \theta^x (1 - \theta)^{n - x}
\biggr]
\biggl[
\frac{\theta^{\alpha - 1}(1 - \theta)^{\beta - 1}}{B(\alpha, \beta)}
\biggr]
\\
&=
\frac{1}{B(\alpha + x, \beta + n - x)}
\theta^{\alpha + x - 1}(1 - \theta)^{\beta + n - x - 1}
\\
&=
\mc{B}(\alpha + x, \beta + n - x).
\end{align*}
The posterior is therefore another beta distribution with parameters
$(\alpha + x, \beta + n - x)$; we have added the number of successes
to the first parameter and the number of failures to the second.
The rather convenient fact that the posterior remains a beta
distribution is because the beta distribution satisfies a property
known as \emph{conjugacy} with the binomial likelihood. This fact
also leads to a common interpretation of the parameters $\alpha$ and
$\beta$: they serve as ``pseudocounts,'' or fake observations we
pretend to have seen before seeing the data.
Figure \ref{coin_flipping} shows the relevant functions for the coin
flipping example for $(\alpha, \beta) = (3, 5)$ and $(x, n) = (5, 6)$.
Notice that the likelihood favors higher values of $\theta$, whereas
the prior had favored lower values of $\theta$. The posterior, taking
into account both sources of information, lies in between these
extremes. Notice also that the posterior has support over a narrower
range of plausible $\theta$ values than the prior; this is because we
can draw more confident conclusions from having access to more
information.
\begin{figure}
\centering
\input{figures/beta_example.tex}
\caption{An example of Bayesian updating for coin flipping. Figure
produced by \texttt{plot\_beta\_example.m}.}
\label{coin_flipping}
\end{figure}
\section*{Hypothesis testing}
We often wish to use our observed data to draw conclusions about the
plausibility of various hypotheses. For example, we might wish to
know whether the parameter $\theta$ is less than $\nicefrac{1}{2}$.
The Bayesian method allows us to compute this value directly from the
posterior distribution:
\begin{equation*}
\Pr(\theta < \nicefrac{1}{2} \given x, n, \alpha, \beta)
=
\int_{0}^{\nicefrac{1}{2}} p(\theta \given x, n, \alpha, \beta) \intd{\theta}.
\end{equation*}
For the example in Figure \ref{coin_flipping}, this probability is
approximately 15\%.
There is a sharp contrast between the simplicity of this approach and
the frequentist method. The classical approach to hypothesis testing
uses the likelihood as a way of generating fake datasets of the same
size as the observations. The likelihood then serves as a so-called
``null hypothesis'' that allows us to generate hypothetical datasets
under some condition.
From these, we compute \emph{statistics,} which, like estimators, can
be any function of the hypothesized data. We then identify some
critical set $C$ for this statistic which contains some large portion
$(1 - \alpha)$ of the values corresponding to the datasets generated
by our null hypothesis. If the statistic computed from the observed
data falls outside this set, we reject the null hypothesis with
``confidence'' $\alpha$. Note that the ``rejection'' of the null
hypothesis in classical hypothesis testing is purely a statement about
the observed data (that it looks ``unusual''), and not about the
plausibility of alternative hypotheses!
\end{document}
| {
"alphanum_fraction": 0.7134964483,
"avg_line_length": 35.7620967742,
"ext": "tex",
"hexsha": "abd87d1de17e270202da0c3410f126104656cad2",
"lang": "TeX",
"max_forks_count": 39,
"max_forks_repo_forks_event_max_datetime": "2021-11-02T09:12:54.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-01-14T23:29:17.000Z",
"max_forks_repo_head_hexsha": "2a7c9657ede4664e080e2914be402de85a8e3c6d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Aahana1/cse515t",
"max_forks_repo_path": "lecture_notes/Bayesian Inference I/notes.tex",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "2a7c9657ede4664e080e2914be402de85a8e3c6d",
"max_issues_repo_issues_event_max_datetime": "2019-02-25T22:00:05.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-01-18T00:14:26.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Aahana1/cse515t",
"max_issues_repo_path": "lecture_notes/Bayesian Inference I/notes.tex",
"max_line_length": 82,
"max_stars_count": 80,
"max_stars_repo_head_hexsha": "2a7c9657ede4664e080e2914be402de85a8e3c6d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Aahana1/cse515t",
"max_stars_repo_path": "lecture_notes/Bayesian Inference I/notes.tex",
"max_stars_repo_stars_event_max_datetime": "2021-12-22T13:35:22.000Z",
"max_stars_repo_stars_event_min_datetime": "2015-01-12T22:26:40.000Z",
"num_tokens": 2571,
"size": 8869
} |
\section{Implementation}
Figure~\ref{fig:prototype_component_overview} describes interaction between the chatbot and the Facebook Messenger servers. The user interacts with the chatbot using the Facebook Messenger platform on either a mobile phone or the desktop via the website (\url{www.messenger.com}). When the user sends a message to the chatbot, it is sent via the Facebook servers who decide where to forward the message onto. The message comes in a \textit{json} format that is parsed by the chatbot application to understand the content of the message and how the user interacted with the bot. For example, if the response is from a quick reply, then additional parameters are sent. The chatbot reads and writes the necessary information into a database to decide a response. When it is ready, it sends a request to the Facebook servers that forward it onto the user's Facebook Messenger account that can be read from the Messenger platform (Figure~\ref{fig:prototype_component_overview}). All code is open-source and hosted on \textit{GitHub} (\url{www.github.com/harrymt/harryshabits}).
\begin{figure}[H]
\centering
\includegraphics[width=5.1in]{../resources/diagrams/chatbot-component-overview.pdf}
\caption{Interaction between a user and the chatbot application via Facebook servers.}
\label{fig:prototype_component_overview}
\end{figure}
The prototype is written in JavaScript running on a \textit{node.js} (\url{www.nodejs.org}) server, built on the Facebook Messenger chatbot platform and hosted on \textit{Heroku} (\url{www.heroku.com}) --- a free PaaS (Platform-as-a-Service) option. Facebook Messenger encourages developers to create bots to interact with their users as these bots act as a real person with similar interaction flow, plus a few additional features, such as \textit{Quick Replies}~\cite{doc_fb_quick_replies} for revealing a list of options to a user. Simple call and responses were used to interact with users and track their data instead of natural language processing to limit the scope of the project. Instead of natural language processing, the location of the bot (inside an existing messaging app) ease of interaction and the additional features (quick replies) help easily communicate with users.
Different languages, server, hosting provider and database provider were considered. JavaScript with node.js on Heroku with \textit{PostgreSQL} (\url{https://www.postgresql.org/}) were chosen because of the following reasons: node.js enables us to share the same language for the server and the client; large amount of packages to handle client and server side functionality; suitable for prototyping and rapid product iteration; Heroku has a free-tier which allows full deployment with a PostgreSQL database of up to 10,000 rows; Heroku hosts the application in the cloud, giving benefits for scalable deployments that benefit any potential future application growth. Finally, \textit{Airtable} (\url{www.airtable.com}) --- a database integration was tested, however, it only provided 3,000 free rows and therefore was discarded in favour of the PostgreSQL database hosted on Heroku.
\subsection{Database}
The bot tracked data about how people logged their habits, such as what day they tracked their habit and how many times they delayed their checking messages. Heroku provides 10,000 rows as their free option in a \textit{PostgreSQL} database. Figure~\ref{fig:db_diagram} outlines each table in the database with what information is stored. The \textit{Facebook user ID} is used to identify each user and what habits they tracked. When a user has told the bot they completed their habit, a new row in the \textit{Habits} table would be added and linked to the user in the \textit{Users} table. Two global variables are used to maintain the state across local and live versions of the system to display the length of study and if it is active.
\begin{figure}[H]
\centering
\includegraphics[width=4in]{../resources/diagrams/database-diagram.pdf}
\caption{PostgreSQL Database entity table relationship diagram showing all information stored for Harry's Habits.}
\label{fig:db_diagram}
\end{figure}
\subsection{Custom Application}
Figure~\ref{fig:prototype_detailed_overview} shows a detailed overview of the custom chatbot application and how it interacts with the database and the Facebook servers.
\begin{figure}[H]
\centering
\includegraphics[width=6in]{../resources/diagrams/chatbot-detailed-overview.pdf}
\caption{Overview of Harry's Habits interacting with Facebook servers to send and receive messages from the Messenger platform.}
\label{fig:prototype_detailed_overview}
\end{figure}
When a user messages the chatbot on Facebook Messenger, the message is first sent to Facebook servers who make a HTTP request to a specified \textit{webhook URL} with a secret parameter for security. The chatbot handles this request then sends another with the same secret. The incoming HTTP request contains a payload with either a simple string of characters with a Facebook user ID (\textit{fbid}) or a quick reply key with a fbid. The chatbot application handles the incoming request with four components.
First, the \verb|read()| function checks if the incoming object is valid, then decides if it is a quick reply or just a regular message and strips the object of the unimportant parts until it is left with the fbid and either the message as a \verb|string| or the quick reply key.
Second, the \verb|getUser()| function uses the extracted fbid to collect information about the Facebook user from the database. If the fbid already exists in the database, it means the user has previously interacted with the chatbot, so details about that user e.g. the type of reward, are extracted from the \textit{Users} Table (Figure~\ref{fig:db_diagram}). Or if the user does not exist, it means the user has never interacted with the chatbot before.
Third, the \verb|send()| function decides what message to send back to the user. If this is the first time the user has messaged the chatbot, then a setup quick reply message is created and sent to start the setup flow (Section~\ref{setup_flow}). Otherwise, based on the quick reply key or the individual message, the chatbot will respond differently. For example, if a user sends `help' as a message, the application will prepare to display a list of quick reply options that users can choose to show more information about the bot. After the message is prepared, the application sends a request back to the Facebook servers containing a regular message or a quick reply object with options and keys.
Finally after the message is sent, the \verb|updateUser()| will create a new row in the database if there is a new fbid, or it will update information about the user if they responded with a quick reply. For example, during the Trigger flow (Section~\ref{trigger_flow}) the chatbot asks users using a quick reply, if they completed their habit. If a user marked a habit as completed, the message will have a quick reply key that the application can understand and a new row in the Habits Table will be created with that habit information.
\subsection{Delivering Rewards}
\begin{figure}[H]
\centering
\includegraphics[width=6in]{../resources/diagrams/diagram-delivering-rewards.pdf}
\caption{Overview of how notifications are sent by the application using a scheduler to check if it is time to send the notifications every hour.}
\label{fig:prototype_sending_notifications}
\end{figure}
A post completion notification is sent to a user just after the time of their habit context. Figure~\ref{fig:prototype_sending_notifications} shows how the Heroku scheduler (\url{https://elements.heroku.com/addons/scheduler}) handles this process by running a job on the chatbot application at scheduled intervals, similar to a \textit{cron job}. The scheduler runs every hour to run a node.js JavaScript file. This script first checks if the current time matches any of the 11 pre-defined times (Figure~\ref{fig:reminder_times}) and if it does, it reads the database to get information about all users that want to be sent a notification at that time. Then sends a quick reply message asking the user if they completed their habit or would like to be asked later (unless it is the night). If the latter is chosen, the next reminder time later in the day is set to that user. Otherwise a reward is delivered.
\begin{figure}[H]
\centering
\begin{lstlisting}
const reminderTimes = {
earlyMorning: 7,
midMorning: 9,
lateMorning: 11,
earlyAfternoon: 12,
midAfternoon: 14,
lateAfternoon: 16,
earlyEvening: 18,
midEvening: 20,
lateEvening: 21,
night: 22,
newDay: 23
};
\end{lstlisting}
\caption{The JavaScript object that defines the scheduler times that users can set to receive post-completion notification.}
\label{fig:reminder_times}
\end{figure}
The type of reward delivered is chosen when a user sends the `completed habit' quick reply response. The reward modality is based on the fbid of the user and is read from the database, then another message is delivered to that user containing the reward. A consistent method was built to deliver the reward to users, instead of sending the rewards in-line a \textit{webview} was used to display a website where users can open their reward. The website uses \textit{HTML}, \textit{CSS}, \textit{JavaScript} and also used server-side template rendering with \textit{Pug} (\url{www.pugjs.org}) and CSS preprocessing with \textit{SASS} (\url{www.sass-lang.com/}). The full source code for the webview is available on GitHub (\url{www.github.com/harrymt/harryshabits/tree/master/docs}). This also allowed us to break free of the Messenger chatbot sandbox and use \textit{HTML} elements to display the content in the same way, ensuring consistency across devices. The website could start the GIF or play the music or both for each reward type when a user pressed a button. Although this was not without limitations. The auditory reward would not stop playing when users closed the webview. This could be performed programatically, however during testing, would not always work. This was worked around by only playing the music for 15 seconds --- an appropriate time to view the reward. Auto-playing the auditory reward was not available when sending the audio in-line and the webview could use the \textit{HTML5} \verb|<audio>| element to enable auto-play.
But, for auto-play elements, the HTML5 standard needs a button press before it starts~\cite{mozilla_autoplay}.
This required another button to create a \textit{JavaScript} hook to auto-play.
However, during tests on low mobile data speeds, users found that they would have to press the button multiple times before the audio played.
This was because the audio would only play after it had loaded and created a lengthy delay, along with seemingly broken display.
Figure~\ref{fig:fast_slow_opening_rewards} describes the process of loading a reward on fast internet speeds and slow internet speeds. To create a better user experience, the button disappeared when pressed, using \textit{CSS} that would execute even if the audio hadn't loaded, and even on a poor connection.
Then JavaScript would execute after the page had fully loaded and play the audio if the button had already been pressed from the CSS, but if it hadn't then it would create a hook to play the audio after it had been pressed.
This ensured a seemly experience when using rewards for all levels of connection.
\begin{figure}[H]
\centering
\includegraphics[width=6in]{../resources/diagrams/webview-flow-diagram.pdf}
\caption{How rewards are displayed to the user when they are on fast internet (top lane) and slow internet (bottom lane) over time.}
\label{fig:fast_slow_opening_rewards}
\end{figure}
\subsection{Testing and Continuous Integration}
To get a measure of code quality, three online services: codacy (\url{www.codacy.com}), codebeat (\url{www.codebeat.co}) and code climate (\url{www.codeclimate.com}), were used to track quality over time (see more on the GitHub repo \url{www.github.com/harrymt/harryshabits}). A test harness was also written to perform functional testing on the chatbot. An on-line continuous integration (CI) service, Travis CI (\url{https://travis-ci.org/harrymt/harryshabits}) was used to programatically run these tests when a \textit{commit} in \textit{git} (the \textit{version control} used) was performed on the \textit{master branch}. \textit{Travis CI} ran the defined tests to ensure the functionality worked throughout development. A pilot trial with three users also tested the basic chatbot functionality preparing for the full evaluation study (Section~\ref{study_comparing_rewards}).
\subsection{Technical Issues}
Throughout the implementation process different techniques were explored to implement the design.
Some of the research areas were not used in the final prototype due to technical issues and limitations with the approach.
\subsubsection*{Habit Context}
During the pilot trails one participant added the word `before' inside of their habit context (Figure~\ref{fig:study_bot_issues}). This resulted in post completion messages being awkwardly worded, e.g. ``After 'before dinner' have you completed your daily press ups?''. This would be solved by adding another option to ask if they would like to perform it before or after, when asking for their habit context. Users also reported that after they snoozed the notifications several times, their habit context no longer became relevant, e.g. ``After 'eating lunch' have you completed your daily press ups?'' at 7pm. The context should be removed or altered in snoozed notifications. In addition, users should be asked if they want to change their context when being asked to change the time they receive their post-completion checks.
\begin{figure}[H]
\centering
\includegraphics[width=2.1in]{../resources/feedback/after-before.jpg}
\hspace{10px}
\includegraphics[width=2.1in]{../resources/feedback/double-messages.jpg}
\caption{Example of 2 issues that occurred. First, the problem with habit context using the word `after'. Second, the bot sending the same message multiple times.}
\label{fig:study_bot_issues}
\end{figure}
\subsubsection*{Message Delivery}
The chatbot would sometimes send multiple of the same message (Figure~\ref{fig:study_bot_issues}). This occurred when Facebook sent the same HTTP request multiple times. This could perhaps be improved by moving to a specific Facebook Messenger node JavaScript library module (\url{https://github.com/rickydunlop/fbmessenger-node}) to better suit interactions between Facebook servers and the application. This issue also effected another area during the process of handling free text input from users. When the bot asked users to enter in a free text, e.g. an email, a flag would be set, to signal a wait for free text input. However, if duplicate messages were sent at this time, the application would assume users did not enter anything for the free text and the flow would continue. Finally, if users accidentally sent the bot a message instead of using the quick replies, they would be unable to return to that quick reply menu and therefore break the flow of interaction. To fix this the question should be re-asked if it didn't fit the expected criteria.
\begin{figure}[H]
\centering
\includegraphics[width=1.5in]{../resources/design/vibration-reward.png}
\caption{Vibration was tested, but due to technical limitations was difficult to implement.}
\label{fig:vibration_reward_issue}
\end{figure}
\subsubsection*{Vibration}
Using vibration as a reward modality would have been useful for evaluating the effect of tactile vibration on habit performance and automaticity. Unfortunately the chatbot sandbox prevented the vibration feature on the device from being used, so another device would be used in combination with the bot.
Smart watches and fitness trackers were researched to test if they could programatically vibrate using the pattern of vibration to match the frequency of the audio.
However, the majority of these devices did not have an API that exposed the vibration aspect. The best method found, was to programatically set an alarm 1-minute into the future using a Fitbit fitness tracker.
This would trigger the vibration when the alarm sounded.
Although this would mean a 1-minute delay after completing a habit, a good user flow could have reduced the wait time with some additional dialogue (Figure~\ref{fig:vibration_reward_issue}).
But, this approach relied on the fitness tracker to sync with the phone after the alarm was programatically set. Unfortunately forcing the tracker to sync wasn't available, so this reward modality was abandoned.
\subsubsection*{Scheduler Time Zone}
The scheduler had several limitations. First, the documentation stated it runs on a best effort basis and cannot guarantee to run every time, however, this did not impact the chatbot as it missed very few schedules. Second, the time zone of the scheduler had to be converted to Coordinated Universal Time (UTC) time before checking against the defined times. This issue was revealed in a pilot trail and fixed, however, for this application to work across different time-zones (ones that were not UTC), Figure~\ref{fig:reminder_times} would have to be custom to each user.
Another issue occurred with stopping the audio after it had been played during a reward. If a user closed the reward box, there was no way to stop the audio, unless a user waited until it had finished. This limitation was very minor, but also showed how difficult it is to seemly connect a website and a chatbot. Finally, edge cases throughout interaction were revealed during development and were coded for, for example deciding what would happen if users snoozed their post completion notification when it reached the end of the day led to additional logic to stop users from snoozing when it reached the end of the day.
\newpage
| {
"alphanum_fraction": 0.7813875156,
"avg_line_length": 128.7202797203,
"ext": "tex",
"hexsha": "326cc648baab72970f060a9bfdd6c25601574c33",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "0312b53b9a58dc92c46ef0e2ed33003c7066c83c",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "harrymt/masters-thesis",
"max_forks_repo_path": "thesis/chapters/5_implementation.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "0312b53b9a58dc92c46ef0e2ed33003c7066c83c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "harrymt/masters-thesis",
"max_issues_repo_path": "thesis/chapters/5_implementation.tex",
"max_line_length": 1550,
"max_stars_count": 4,
"max_stars_repo_head_hexsha": "0312b53b9a58dc92c46ef0e2ed33003c7066c83c",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "harrymt/masters-thesis",
"max_stars_repo_path": "thesis/chapters/5_implementation.tex",
"max_stars_repo_stars_event_max_datetime": "2021-09-04T12:10:49.000Z",
"max_stars_repo_stars_event_min_datetime": "2018-05-17T09:45:30.000Z",
"num_tokens": 3990,
"size": 18407
} |
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\subsection{Allowable Values for Standard Trade Data}
\label{sec:allowable_values}
%- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
\begin{table}[H]
\centering
\begin{tabu} to 1.0\linewidth {| X[-1.65,l,m] | X[-5.7,l,m] |}
\hline
\bfseries{Trade Data} & \bfseries{Allowable Values} \\
\hline
\lstinline!Date! & \begin{tabular}[l]{@{}l@{}} The following date formats are supported: \\ \emph{yyyymmdd} \\ \emph{yyyy-mm-dd} \\ \emph{yyyy/mm/dd} \\ \emph{yyyy.mm.dd} \\ \emph{dd-mm-yy} \\ \emph{dd/mm/yy} \\ \emph{dd.mm.yy} \\ \emph{dd-mm-yyyy} \\ \emph{dd/mm/yyyy} \\ \emph{dd.mm.yyyy} \\ and \\ Dates as serial numbers, comparable to Microsoft Excel \\dates, with a minimum of 367 for Jan 1, 1901,\\ and a maximum of 109574 for Dec 31, 2199. \end{tabular} \\ \hline
\lstinline!Currency! & \emph{ATS, AUD, BEF, BRL, CAD, CHF, CNY,
CZK, DEM, DKK, EUR, ESP, FIM, FRF, GBP, GRD, HKD, HUF, IEP, ITL,
INR, ISK, JPY, KRW, LUF, NLG, NOK, NZD, PLN, PTE, RON, SEK, SGD,
THB, TRY, TWD, USD, ZAR, ARS, CLP, COP, IDR, ILS, KWD, PEN, MXN,
SAR, RUB, TND, MYR, UAH, KZT, QAR, MXV, CLF, EGP, BHD, OMR, VND,
AED, PHP, NGN, MAD}, Note: Currency codes must also match available currencies in the {\tt simulation.xml} file. \\ \hline
%\lstinline!DayCount! \lstinline!Convention! & \begin{tabular}[l]{@{}l@{}}\indent Actual 360 can be expressed by:\\ \emph{A360, Actual/360, ACT/360}\\ \indent Actual 365 Fixed can be expressed by: \\ \emph{A365, A365F, Actual/365, Actual/365 (fixed)} \\ \indent Thirty 360 (US) can be expressed by: \\ \emph{T360, 30/360, 30/360 (Bond Basis), ACT/nACT} \\ \indent Thirty 360 (European) can be expressed by: \\ \emph{30E/360, 30E/360 (Eurobond Basis)}\\ \indent Thirty 360 (Italian) is expressed by: \\ \emph{30/360 (Italian)} \\ \indent Actual Actual (ISDA) can be expressed by: \\ \emph{ActActISDA, ActualActual (ISDA), ACT/ACT, ACT} \\ \indent Actual Actual (ISMA) can be expressed by: \\ \emph{ActActISMA, ActualActual (ISMA)} \\ \indent Actual Actual (AFB) can be expressed by:\\ \emph{ActActAFB, Actual/Actual (AFB)} \end{tabular} \\ \hline
\lstinline!Roll Convention! & \begin{tabular}[l]{@{}l@{}}
\emph{F, Following, FOLLOWING}\\
\emph{MF, ModifiedFollowing, Modified Following, MODIFIEDF}\\
\emph{P, Preceding, PRECEDING}\\
\emph{MP, ModifiedPreceding, Modified Preceding, MODIFIEDP}\\
\emph{U, Unadjusted, INDIFF }\end{tabular} \\ \hline
\end{tabu}
\caption{Allowable values for standard trade data.}
\label{tab:allow_stand_data}
\end{table}
\begin{table}[H]
\centering
\begin{tabu} to 0.9\linewidth {| X[-1.5,l,m] | X[-5,l,m] |}
\hline
% \multicolumn{2}{|l|} {\lstinline{Calendar} } \\ \hline
\multicolumn{2}{|l|} {\tt Calendar} \\ \hline
\bfseries{Allowable Values} & \bfseries{Resulting Calendar} \\
\hline
\emph{TARGET, TGT, EUR} & Target Calendar \\ \hline
\emph{CA,TRB, CAD} & Canada Calendar \\ \hline
\emph{TKB, JP, JPY} & Japan Calendar \\ \hline
\emph{ZUB, CHF} & Switzerland Calendar \\ \hline
\emph{GB, LNB, UK} & UK Calendar \\ \hline
\emph{London stock exchange} & London Stock Exchange Calendar \\ \hline
\emph{US, NYB, USD} & US Calendar \\ \hline
\emph{US-SET} & US Settlement Calendar \\ \hline
\emph{US-GOV} & US Government Bond Calendar \\ \hline
\emph{US-NYSE, New York stock exchange} & US NYSE Calendar \\ \hline
\emph{US with Libor impact} & US Calendar for Libor fixings \\ \hline
\emph{US-NERC} & US NERC Calendar \\ \hline
\emph{AU, AUD} & Australia Calendar \\ \hline
\emph{SA, ZAR} & South Africa Calendar \\ \hline
\emph{SS, SEK} & Sweden Calendar \\ \hline
\emph{ARS} & Argentina Calendar \\ \hline
\emph{BRL} & Brazil Calendar \\ \hline
\emph{CNY} & China Calendar \\ \hline
\emph{CZK} & Czech Republic Calendar \\ \hline
\emph{DEN, DKK} & Denmark Calendar \\ \hline
\emph{FIN} & Finland Calendar \\ \hline
\emph{HKD} & HongKong Calendar \\ \hline
\emph{ISK} & Iceland Calendar \\ \hline
\emph{INR} & India Calendar \\ \hline
\emph{IDR} & Indonesia Calendar \\ \hline
\emph{MXN} & Mexico Calendar \\ \hline
\emph{NZD} & New Zealand Calendar\\ \hline
\emph{NOK} & Norway Calendar \\ \hline
\emph{PLN} & Poland Calendar \\ \hline
\emph{RUB} & Russia Calendar \\ \hline
\emph{SAR} & Saudi Arabia \\ \hline
\emph{SGD} & Singapore Calendar \\ \hline
\emph{KRW} & South Korea Calendar \\ \hline
\emph{TWD} & Taiwan Calendar \\ \hline
\emph{TRY} & Turkey Calendar \\ \hline
\emph{UAH} & Ukraine Calendar \\ \hline
\emph{WeekendsOnly} & Weekends Only Calendar \\ \hline
% \emph{US+TARGET, NYB\_TGT, TGT\_NYB} & US and Target Calendar \\ \hline
% \emph{NYB\_LNB, LNB\_NYB} & US and UK Calendar \\ \hline
% \emph{LNB\_ZUB, ZUB\_LNB} & Switzerland and UK Calendar \\ \hline
% \emph{TGT\_ZUB, ZUB\_TGT} & Switzerland and Target Calendar \\ \hline
% \emph{NYB\_SYB} & US and Australia Calendar \\ \hline
% \emph{TGT\_BDP, BDP\_TGT} & Hungary and Target Calendar \\ \hline
% \emph{LNB\_NYB\_TGT} & UK, US and Target Calendar \\ \hline
% \emph{TKB\_TGT\_LNB} & Japan, Target and UK Calendar \\ \hline
% \emph{LNB\_NYB\_ZUB} & UK, US and Switzerland Calendar \\ \hline
% \emph{LNB\_NYB\_TRB} & UK, US and Canada Calendar \\ \hline
% \emph{LNB\_NYB\_TKB} & UK, US and Japan Calendar \\ \hline
% \emph{NullCalendar} & Null Calendar, i.e. all days are business days \\ \hline
\end{tabu}
\caption{Allowable Values for Calendar. Combinations of up to four
calendars can be provided using comma separated calendar names.}
\label{tab:calendar}
\end{table}
\begin{table}[H]
\centering
\begin{tabu} to 0.9\linewidth {| X[-1.5,l,m] | X[-5,l,m] |}
\hline
%\multicolumn{2}{|l|}{\lstinline{DayCount Convention} } \\ \hline
\multicolumn{2}{|l|}{\tt DayCount Convention} \\ \hline
\bfseries{Allowable Values} & \bfseries{Resulting DayCount Convention} \\
\hline
\emph{A360, Actual/360, ACT/360}& Actual 360 \\ \hline
\emph{A365, A365F, Actual/365, Actual/365 (fixed)} & Actual 365 Fixed \\ \hline
\emph{T360, 30/360, 30/360 (Bond Basis), ACT/nACT} & Thirty 360 (US) \\ \hline
\emph{30E/360, 30E/360 (Eurobond Basis)} & Thirty 360 (European) \\ \hline
\emph{30/360 (Italian)} & Thirty 360 (Italian) \\ \hline
\emph{ActActISDA, ActualActual (ISDA), ACT/ACT, ACT} & Actual Actual (ISDA) \\ \hline
\emph{ActActISMA, ActualActual (ISMA)} & Actual Actual (ISMA) \\ \hline
\emph{ActActAFB, Actual/Actual (AFB)} & Actual Actual (AFB) \\ \hline
\end{tabu}
\caption{Allowable Values for DayCount Convention}
\label{tab:daycount}
\end{table}
\begin{table}[H]
\centering
\begin{tabular}{|l|l|}
\hline
%\multicolumn{2}{|l|}{\lstinline!Index!} \\ \hline
\multicolumn{2}{|l|}{\tt Index} \\ \hline
\multicolumn{2}{|l|}{On form CCY-INDEX-TENOR, and matching available } \\
\multicolumn{2}{|l|}{ indices in the market data configuration.} \\ \hline
\textbf{Index Component} & \textbf{Allowable Values} \\ \hline
CCY-INDEX &
\textit{\begin{tabular}[c]{@{}l@{}}
EUR-EONIA\\ EUR-EURIBOR\\ EUR-LIBOR\\ EUR-CMS\\
USD-FedFunds\\ USD-LIBOR\\ USD-SIFMA\\ USD-CMS\\
GBP-SONIA\\ GBP-LIBOR\\ GBP-CMS\\
JPY-LIBOR\\ JPY-TIBOR \\ JPY-TONAR \\ JPY-CMS \\
CHF-LIBOR\\ CHF-SARON\\
AUD-LIBOR\\ AUD-BBSW\\
CAD-CDOR\\ CAD-BA\\
SEK-STIBOR\\ SEK-LIBOR\\
DKK-LIBOR\\ DKK-CIBOR \\
SGD-SIBOR\\ SGD-SOR \\
HKD-HIBOR \\
NOK-NIBOR \\
HUF-BUBOR \\
IDR-IDRFIX \\
INR-MIFOR \\
MXN-TIIE \\
PLN-WIBOR \\
SKK-BRIBOR \\
NZD-BKBM \\
\end{tabular}} \\ \hline
TENOR & An integer followed by \emph{D, W, M or Y} \\ \hline
\end{tabular}
\caption{Allowable values for Index.}
\label{tab:indices}
\end{table}
| {
"alphanum_fraction": 0.5826707203,
"avg_line_length": 56.6357615894,
"ext": "tex",
"hexsha": "dee9e7e57df91fe9b51bcc40499a8b130e48ea2f",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2022-02-07T02:04:10.000Z",
"max_forks_repo_forks_event_min_datetime": "2022-02-07T02:04:10.000Z",
"max_forks_repo_head_hexsha": "8360b5de32408f2a37da5ac3ca7b4e913bf67e9f",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "PiotrSiejda/Engine",
"max_forks_repo_path": "Docs/UserGuide/allowablevalues.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "8360b5de32408f2a37da5ac3ca7b4e913bf67e9f",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "PiotrSiejda/Engine",
"max_issues_repo_path": "Docs/UserGuide/allowablevalues.tex",
"max_line_length": 852,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "8360b5de32408f2a37da5ac3ca7b4e913bf67e9f",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "PiotrSiejda/Engine",
"max_stars_repo_path": "Docs/UserGuide/allowablevalues.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3016,
"size": 8552
} |
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
%\usepackage[ddmmyyyy]{datetime}
\usepackage[short,nodayofweek,level,12hr]{datetime}
%\usepackage{cite}
%\usepackage{wrapfig}
%\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\newcommand{\e}{\epsilon}
\newcommand{\dl}{\delta}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\describe}[2]{\underbrace{#2}_{\text{#1}}}% \describe{}{} - First bracket is for description
%\describe{$\substack{this \\ is \\ substacking}$}{b} - To split the description over multiple lines
\newcommand{\vect}[1]{\underline{#1}}
\newcommand{\uvect}[1]{\hat{#1}}
\newcommand{\1}{\vect{1}}
\newcommand{\grad}{\nabla}
\newcommand{\RR}{\Rightarrow}
\title{Matched Asymptotics for the Axisymmetric Meniscus}
\date{\displaydate{date}}
\newdate{date}{23}{09}{2018}
\author{}
\begin{document}
\maketitle
\section{The Axisymmetric Meniscus}
The setup consists of a cylinder of radius $R$ dipped halfway into a fluid of density $\rho$ and surface tension $\Gamma$ and we are required to find out the shape of the resulting meniscus under the influence of gravity and surface tension. The shape of the meniscus is denoted by $z=f(r)$. Since the problem is axisymmetric, there is no $\theta$ dependence.
We know that at any $r$, the pressure of fluid over the horizontal $z=0$ is being balanced by the pull of surface tension. If pressure inside the fluid is $\hat p$ and outside it is $p$, the unit normal to the meniscus being $\vect n$, then:
\begin{align*}
&\hat p - p = \rho g z = \Gamma \grad \cdot \vect n
\end{align*}
Writing $F = z-f(r) = 0$ and the unit normal as $\vect n=\grad F/|\grad F|$, the divergence of the unit normal comes out to be:
\begin{align*}
&\grad\cdot n = \frac{\frac{-1}{r}\frac{d}{dr}\frac{rdf}{dr}}{\Big(1+\frac{df}{dr}^2\Big)^{1/2}} + \frac{\frac{d^2f}{dr^2}\frac{df}{dr}^2}{\Big(1+\frac{df}{dr}^2\Big)^{3/2}}
\end{align*}
Before proceeding, we would like to scale our equation to make it dimensionless. But, as opposed to the 2D meniscus near a flat wall, this problem has 2 length scales - $R$ and $l_c(=\sqrt{\Gamma/\rho g})$. Therefore, the solution will, in general, be a function of the non-dimensional parameter $R/l_c$ or $(R/l_c)^2=\rho g R^2/\Gamma$ which is the Bond Number $(Bo)$. If $Bo \to \infty$, the radius of the cylinder is much larger than $l_c$ and hence we approach the 2D mensicus case (as long as $r$ remains less than $R$). This is the limit in which the mensicus doesn't sense the curvature of the cylinder.
We are now interested in the opposite limit where the effects of curvature of the cylinder are prominent, $\lim Bo \ll 1$. If we now scale the lengths by $l_c = \sqrt{\Gamma/\rho g}$, The non-dimensional Young-Laplace Equation becomes:
\begin{align*}
& z = \frac{\frac{-1}{r}\frac{d}{dr}\frac{rdf}{dr}}{\Big(1+\frac{df}{dr}^2\Big)^{1/2}} + \frac{\frac{d^2f}{dr^2}\frac{df}{dr}^2}{\Big(1+\frac{df}{dr}^2\Big)^{3/2}}
\end{align*}
which looks nasty by itself, so we will solve the far-field and near-field problems separately and later patch the two solutions.
\subsection*{Far-field solution ($\lim r \gg R$)}
In the far-field, the slope of the meniscus will be small and the equation becomes:
\begin{align*}
&z = \frac 1 r\frac{d}{dr}\frac{rdf}{dr}\\
\Rightarrow& \frac{d^2z}{dr^2} +\frac{dz}{rdr} - z = 0 \tag{using $z=f(r)$}
\end{align*}
which is the modified Bessel's Equation with solutions given by:
\begin{align*}
\RR &z = \describe{Growing solution}{I_0(r)}, \describe{Decaying solution}{K_0(r)}
\end{align*}
$I's$ grow with $r$ and have a essential singularity at infinity. $K's$ decay with $r$ and have singularity at origin (which is fine with us as long as the cylinder has any finite thickness). Hence, we conclude that:
\begin{align*}
&z = A K_0(r/l_c) \quad \text{if} \quad r \gg R
\end{align*}
Thus we obtain the far-field solution.
\subsection*{Near-field solution ($\lim r \ll l_c$)}
Now consider the limit, $r \ll l_c$. Here, we cannot make the linear approximation because slope near the cylinder is not small. But within this limit, it is reasonable to assume that the effect of surface tension will dominate gravity. In the full equation:
\begin{align*}
& z = \frac{\frac{-1}{r}\frac{d}{dr}\frac{rdf}{dr}}{\Big(1+\frac{df}{dr}^2\Big)^{1/2}} + \frac{\frac{d^2f}{dr^2}\frac{df}{dr}^2}{\Big(1+\frac{df}{dr}^2\Big)^{3/2}}
\end{align*}
the term containing gravity (clearly seen if we re-dimensionalize the equation and bring out the implicit $\sqrt{\Gamma/\rho g}$ is $z$. Therefore, we neglect this term and proceed to obtain:
\begin{align*}
&\frac{d^2z}{dr^2} + \frac{1}{r}\frac{dz}{dr}\Big( 1 + \frac{dz}{dr}^2\Big) = 0
\end{align*}
This can be integrated with a little effort to give:
\begin{align*}
&z = D - C \log\Big[ \frac{r}{C}+\Big(\big(\frac{r}{C}\big)^2-1\Big)^{1/2}\Big]
\end{align*}
%The boundary condition at the wall requires, in dimensional terms, $z=H$ at $r = R$. In non-dimensional terms $z = H/l_c$ at $r = Bo$. For convenience, we will denote the unknown $H/l_c$ as $H$ itself, keeping in mind that height is being measured in units of $l_c$. Therefore the boundary condition gives us:
%\begin{align*}
%& H = C \log\Big[ \frac{Bo}{C}+\Big(\big(\frac{Bo}{C}\big)^2-1\Big)^{1/2}\Big] + D\\
%\RR& D = H - C \log\Big[ \frac{Bo}{C}+\Big(\big(\frac{Bo}{C}\big)^2-1\Big)^{1/2}\Big]
%\end{align*}
%Substituting this in the equation for $z$, we get:
%\begin{align*}
%&z = H + C (\log\Big[ \frac{r}{C}+\Big(\big(\frac{r}{C}\big)^2-1\Big)^{1/2}\Big] - \log\Big[ \frac{Bo}{C}+\Big(\big(\frac{Bo}{C}\big)^2-1\Big)^{1/2}\Big])\\
%&z = H + C \log\Bigg[ \frac{\frac{r}{C}+\Big(\big(\frac{r}{C}\big)^2-1\Big)^{1/2}}{\frac{Bo}{C}+\Big(\big(\frac{Bo}{C}\big)^2-1\Big)^{1/2}}\Bigg]
%\end{align*}
%Or in dimensional terms:
%\begin{align*}
%&z = H + C \log\Bigg[ \frac{\frac{r}{C}+\Big(\big(\frac{r}{C}\big)^2-1\Big)^{1/2}}{\frac{R}{C}+\Big(\big(\frac{R}{C}\big)^2-1\Big)^{1/2}}\Bigg] \quad \text{if} \quad r\ll l_c
%\end{align*}
which is our near-field solution ($C$ and $D$ being arbitrary constants to be determined).
\subsection*{Overlap region}
From the two solutions obtained above, we must construct the solution in the overlap region given by $R \ll r \ll l_c$. In order to do this, we obtain the inner limit of the outer solution and the outer limit of the inner solution and equate the two.
\begin{align*}
&\lim_{r \ll l_c} A K_0(r/l_c) = -A (\log(r/l_c) + \gamma) \tag{\footnotesize{Inner limit of the outer solution}}\\
&\lim_{r \gg R} D - C \log\Big[ \frac{r}{C}+\Big(\big(\frac{r}{C}\big)^2-1\Big)^{1/2}\Big] = D - C \log(\frac{2r}{C}) \tag{\footnotesize{outer limit of the inner solution}}
\end{align*}
where $\gamma$ is the Euler-Mascheroni constant. These two solutions are, in fact, the same and hence we can equate them:
\begin{align*}
&-A (\log(r/l_c)+\gamma) = D - C \log(\frac{2r}{C})\\
\RR&-A\log(r/l_c) - A\gamma = D - C \log(\frac{2l_c}{C}\frac{r}{l_c})\\
\RR&-A\log(r/l_c) - A\gamma = D - C \log(\frac{2l_c}{C}) - C\log(\frac{r}{l_c})\\
\RR& -A\log(r/l_c) = -A\log(r/l_c) \quad \text{and} \quad - A\gamma = D - C \log(\frac{2l_c}{C})\\
\RR& A = C \quad \text{and} \quad D = C (\log(\frac{2l_c}{C} - \gamma))
\end{align*}
We have three constants ($A,C,D$) and 2 equations. Third equation comes from the contact angle boundary condition. Denoting the inner solution as $z^i$, we have
\begin{align*}
&\frac{dz^i}{dr} = \tan(\frac{\pi}{2} + \theta_c) = -\cot(\theta_c) \quad @ \quad r=R
\end{align*}
which eventually yields
\begin{align*}
&C = R\cos\theta_c
\end{align*}
This gives us the significance of $C$. When $\theta_c=0$, $C=R$. Finally, we can obtain the height of the meniscus at the surface of the cylinder. Using the near field solution and expressions for $C$ and $D$, we can write:
\begin{align*}
&H = R\cos\theta_c\Bigg[\log\bigg(\frac{2l_c}{R(1+\sin\theta_c)} \bigg)- \gamma \Bigg]
\end{align*}
If $\theta_c = 0$, we get $H = R\log(l_c/R)$. Note that $\log(l_c/R)$ is usually an order one quantity (when $Bo \ll 1$ or $R \ll l_c$). Then the rise is of the order of $R$. This is much less than the rise for the case of flat plate where it was $\sqrt 2 l_c$, of the order of $l_c$.
\section{Appendix}
\subsection{Interpretation of the far-field meniscus using Helmholtz Equation}
The far-field solution was obtained using
\begin{align*}
&z = \frac 1 r\frac{d}{dr}\frac{rdf}{dr}
\end{align*}
which has the form of a Helmholtz equation given by
\begin{align*}
&\grad^2f-k^2f=0
\end{align*}
where $k$ has the dimensions of inverse length scale. To make it explicit, we write the equation as
\begin{align*}
&\grad^2f-\frac{f}{\lambda^2}=0
\end{align*}
where $\lambda$ is a some characterstic length. When $r \ll \lambda$, then the second term is neglected and the equation reduces to a Laplace equation
\begin{align*}
&\grad^2f=0
\end{align*}
and hence, in this limit, $f$ will behave as a solution to the Laplacian. Specifically, if there is a point source in 3D, then $f = -1/4\pi r$ and in 2D it would be $\log(r)/2\pi$. But outside this limit, the form of the solution will be different. If $r \gg \lambda$ we observe an exponential decay of the solution.
For the equation governing the far-field meniscus
\begin{align*}
&z = \frac 1 r\frac{d}{dr}\frac{rdf}{dr}\\
\Rightarrow& \frac{d^2z}{dr^2} +\frac{dz}{rdr} - z = 0 \tag{using $z=f(r)$}\\
\Rightarrow& \grad^2f - \frac{f}{l_c^2} = 0 \tag{dimensionalizing}
\end{align*}
we can similarly deduce the two types of behaviour. At length scales much greater than $l_c$, the term $\frac{dz}{rdr}$ is small and the remaining terms give the decaying exponential solution. Whereas, if we are in the regime where $r \ll l_c$, then $l_c$ is large compared to $r$ and hence the term $z$ gets neglected. The remaining terms then give the logarithmically decaying solution. The full solution, $K_0(r)$, decays exponentially for large $r$ and goes as $-\log(r)$ for small $r$. Thus it respects both the limiting cases.
Consider a positive ion surrounded by a sphere of negative charges of radius $R$. If we want to evaluate the potential close to the charge ($r \ll R$), then the governing equation is a Laplacian and hence potential due to the point charge goes as $1/r$ within the sphere and decays exponentially $e^{-r/R}$ for $r \gg R$.
\subsection{Calculations for the inner region}
\end{document}
| {
"alphanum_fraction": 0.6868242273,
"avg_line_length": 59.0451977401,
"ext": "tex",
"hexsha": "4fdd44eca4a5358391bc029f5f2e70e1097a4a19",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_forks_repo_path": "tex_files/lecture14.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_issues_repo_path": "tex_files/lecture14.tex",
"max_line_length": 611,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_stars_repo_path": "tex_files/lecture14.tex",
"max_stars_repo_stars_event_max_datetime": "2021-02-16T04:19:07.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-02-16T04:19:07.000Z",
"num_tokens": 3561,
"size": 10451
} |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% CS624: Analysis of Algorithms
% Copyright 2015 Pejman Ghorbanzade <[email protected]>
% Creative Commons Attribution-ShareAlike 4.0 International License
% More info: https://github.com/ghorbanzade/beacon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section*{Question 1}
The operation \textsc{Heap-Delete}$(A,i)$ deletes the item in node $i$ from heap $A$.
Give an implementation of \textsc{Heap-Delete} that runs in $\mathcal{O}(\log n)$ time for an $n$-element max-heap.
You are as well expected to show that your proposed algorithm run in $\mathcal{O}(\log n)$ time.
\subsection*{Solution}
To remove node $i$ from array $A$ where $A$ is a \textit{Heap} data structure with $n$ elements, we first replace $A[i]$ with $A[n]$; last node in height $H$ where $H$ is height of the tree.
This is done to maintain \textit{completeness} of the binary tree.
Obviously this step has a constant runtime cost which is negligible.
As it is likely that such modification violates the \textit{heap} structure of the tree, we should \textsc{Heapify} the modified binary tree to maintain the heap structure after deletion.
Now the following two cases might occur:
\begin{enumerate}[label=(\alph*)]
\item $A[n] < A[\lceil \frac{i}{2} \rceil ] $\\
If node $n$ is within the subtree with root at node $i$, we can rest assured that the value of node $n$ is less than the value of parent of node $i$, in which case \textsc{Heapify} can only be called for the subtree whose root is node $\lceil \frac{i}{2} \rceil$, to move node $i$ one step lower.
\item $A[n] > A[\lceil \frac{i}{2} \rceil ] $
If there is no subtree that includes nodes $i$ and $n$, the value of node $n$ may be higher than the value of parent of node $i$, in which case each call of \textsc{Heapify} is likely to move node $i$ one step higher.
\end{enumerate}
In either case, the number of calls to \textsc{Heapify} is surely less than or equal to the the height $H$ of the tree.
Since $ 2^{H} - 1 < n $, we can derive $ h < \log {n+1} $ and thus the runtime of proposed \textsc{Heap-Delete} algorithm is $\mathcal{O}(\log n)$.
| {
"alphanum_fraction": 0.6774783006,
"avg_line_length": 66.3333333333,
"ext": "tex",
"hexsha": "e90dc826db588d4a688fdb626d6cf20d5cc8f297",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2020-12-06T17:18:05.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-09-20T05:58:32.000Z",
"max_forks_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "ghorbanzade/beacon",
"max_forks_repo_path": "umb-cs624-2015s/src/tex/hw02/hw02q01.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "ghorbanzade/beacon",
"max_issues_repo_path": "umb-cs624-2015s/src/tex/hw02/hw02q01.tex",
"max_line_length": 296,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "c36e3d1909b9e1e47b1ad3cda81f7f33b713adc4",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "ghorbanzade/beacon",
"max_stars_repo_path": "umb-cs624-2015s/src/tex/hw02/hw02q01.tex",
"max_stars_repo_stars_event_max_datetime": "2020-01-01T11:16:51.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-11-13T20:00:10.000Z",
"num_tokens": 610,
"size": 2189
} |
\section{Bar}
%=========================================================
\import{.}{baz}
%=========================================================
| {
"alphanum_fraction": 0.125,
"avg_line_length": 16.8888888889,
"ext": "tex",
"hexsha": "9864a23d2c9539c0b16f894895ca6510344becf3",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "98d4829ef45ef7e83e61903ba99db9c6ad188f59",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "vanam/thesiskiv",
"max_forks_repo_path": "src/chapters/foo/bar.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "98d4829ef45ef7e83e61903ba99db9c6ad188f59",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "vanam/thesiskiv",
"max_issues_repo_path": "src/chapters/foo/bar.tex",
"max_line_length": 58,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "98d4829ef45ef7e83e61903ba99db9c6ad188f59",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "vanam/thesiskiv",
"max_stars_repo_path": "src/chapters/foo/bar.tex",
"max_stars_repo_stars_event_max_datetime": "2019-03-03T20:20:10.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-03-03T20:20:10.000Z",
"num_tokens": 20,
"size": 152
} |
\chapter{External Tools}
\label{chap:external_tools}
This chapter provides some information on using QMCPACK with external tools.
\section{LLVM Sanitizer Libraries}\label{tool:LLVM-Sanitizer-Libraries}
Using CMake, set one of these flags for using the clang sanitizer libraries with or without lldb.
\begin{shade}
-DLLVM_SANITIZE_ADDRESS link with the %*\href{https://clang.llvm.org/docs/AddressSanitizer.html}{Clang address sanitizer library}*
-DLLVM_SANITIZE_MEMORY link with the %*\href{https://clang.llvm.org/docs/MemorySanitizer.html}{Clang memory sanitizer library}*
\end{shade}
These set the basic flags required to build with either of these sanitizer libraries. They require a build of clang with dynamic libraries somehow visible (i.e., through \ishell{LD_FLAGS=-L/your/path/to/llvm/lib}). You must link through clang, which is generally the default when building with it. Depending on your system and linker, this may be incompatible with the ``Release'' build, so set \ishell{-DCMAKE_BUILD_TYPE=Debug}. They have been tested with the default spack install of [email protected] and been manually built with llvm 7.0.1. See the preceding links for additional information on use, run time, and build options of the sanitizers.
In general, the address sanitizer libraries will catch most pointer-based errors. ASAN can also catch memory links but requires that additional options be set. MSAN will catch more subtle memory management errors but is difficult to use without a full set of MSAN-instrumented libraries.
\section{Intel VTune}
Intel's VTune profiler has an API that allows program control over collection (pause/resume) and can add information to the profile data (e.g., delineating tasks).
\subsection{VTune API}
If the variable \ishell{USE\_VTUNE\_API} is set, QMCPACK will check that the
include file (\ishell{ittnotify.h}) and the library (\ishell{libittnotify.a}) can
be found.
To provide CMake with the VTune paths, add the include path to \ishell{CMAKE\_CXX\_FLAGS} and the library path to \ishell{CMAKE\_LIBRARY\_PATH}.
An example of options to be passed to CMake:
\begin{shade}
-DCMAKE_CXX_FLAGS=-I/opt/intel/vtune_amplifier_xe/include \
-DCMAKE_LIBRARY_PATH=/opt/intel/vtune_amplifier_xe/lib64
\end{shade}
\section{NVIDIA Tools Extensions}
NVIDIA's Tools Extensions (NVTX) API enables programmers to annotate their source code when used with the NVIDIA profilers.
\subsection{NVTX API}
If the variable \ishell{USE_NVTX_API} is set, QMCPACK will add the library (\ishell{libnvToolsExt.so}) to the QMCPACK target. To add NVTX annotations
to a function, it is necessary to include the \ishell{nvToolsExt.h} header file and then make the appropriate calls into the NVTX API. For more information
about the NVTX API, see \url{https://docs.nvidia.com/cuda/profiler-users-guide/index.html#nvtx}. Any additional calls to the NVTX API should be guarded by
the \ishell{USE\_NVTX\_API} compiler define.
\subsection{Timers as Tasks}
To aid in connecting the timers in the code to the profile data, the start/stop of
timers will be recorded as a task if \ishell{USE_VTUNE_TASKS} is set.
In addition to compiling with \ishell{USE_VTUNE_TASKS}, an option needs to be set at run time to collect the task API data.
In the graphical user interface (GUI), select the checkbox labeled ``Analyze user tasks" when setting up the analysis type.
For the command line, set the \ishell{enable-user-tasks} knob to \ishell{true}. For example,
\begin{shade}
amplxe-cl -collect hotspots -knob enable-user-tasks=true ...
\end{shade}
Collection with the timers set at ``fine" can generate too much task data in the profile.
Collection with the timers at ``medium" collects a more reasonable amount of task data.
\section{Scitools Understand}
Scitools Understand (\url{https://scitools.com/}) is a tool for static
code analysis. The easiest configuration route is to use the JSON output
from CMake, which the Understand project importer can read directly:
\begin{enumerate}
\item Configure QMCPACK by running CMake with
\ishell{CMAKE_EXPORT_COMPILE_COMMANDS=ON}, for example:
\begin{lstlisting}[style=SHELL]
cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
-DQMC_MPI=0 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../qmcpack/
\end{lstlisting}
\item Run Understand and create a new C++ project. At the import files
and settings dialog, import the \ishell{compile_commands.json} created by
CMake in the build directory.
\end{enumerate}
| {
"alphanum_fraction": 0.788767062,
"avg_line_length": 58.8026315789,
"ext": "tex",
"hexsha": "c353bf0b5ba592e37cf9593c3e55586237fbd38c",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "280f67e638bae280448b47fa618f05b848c530d2",
"max_forks_repo_licenses": [
"NCSA"
],
"max_forks_repo_name": "djstaros/qmcpack",
"max_forks_repo_path": "legacy_manual/external_tools.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "280f67e638bae280448b47fa618f05b848c530d2",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"NCSA"
],
"max_issues_repo_name": "djstaros/qmcpack",
"max_issues_repo_path": "legacy_manual/external_tools.tex",
"max_line_length": 644,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "280f67e638bae280448b47fa618f05b848c530d2",
"max_stars_repo_licenses": [
"NCSA"
],
"max_stars_repo_name": "djstaros/qmcpack",
"max_stars_repo_path": "legacy_manual/external_tools.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1142,
"size": 4469
} |
\documentclass[a4paper,10pt]{article}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{eucal}
\usepackage{amscd}
\usepackage{url}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\I}{\mathbb{I}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Pee}{\mathbb{P}}
\newcommand{\EuO}{\mathcal{O}}
\newcommand{\Qbar}{\overline{\mathbb{Q}}}
\newcommand{\code}{\lstinline}
\newcommand{\ljk}[2]{\left(\frac{#1}{#2}\right)}
\newcommand{\trans}[2]{(\,#1\;\;#2\,)}
\newcommand{\modulo}[1]{\;\left(\mbox{mod}\;#1\right)}
\newcommand{\fr}{\mathfrak}
\newcommand{\qed}{\square}
\DeclareMathOperator{\Log}{Log}
\def\notdivides{\mathrel{\kern-3pt\not\!\kern4.5pt\bigm|}}
\def\nmid{\notdivides}
\def\nsubseteq{\mathrel{\kern-3pt\not\!\kern2.5pt\subseteq}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newenvironment{proof}[1][Proof]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{definition}[1][Definition]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{example}[1][Example]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}
\parindent=0pt
\parskip 4pt plus 2pt minus 2pt
\title{Complex Variables}
\author{William Hart}
\begin{document}
\maketitle
\section{Limits}
\begin{definition}
We say that the \textbf{limit} of a complex function $f(z)$ as $z$ approaches $z_0$ is $w$, written
$$\lim_{z\to z_0}f(z) = w$$
if for each $\epsilon > 0$ there is a $\delta > 0$ such that $|f(z) - w| < \epsilon$ whenever $0 < |z - z_0| < \delta$.
\end{definition}
\begin{theorem}
Let $f(z) = u(x, y) + iv(x, y)$ and $z_0 = x_0 + iy_0$ for real valued functions $u$ and $v$ and real variables $x_0$ and $y_0$. Then
$$\lim_{z \to z_0}f(z) = u_0 + iv_0$$
iff
$$\lim_{(x, y) \to (x_0, y_0)}u(x, y) = u_0 \;\;\mbox{and}\;\; \lim_{(x, y) \to (x_0, y_0)}v(x, y) = v_0.$$
\end{theorem}
Pick $\delta_1$ and $\delta_2$ such that $|u - u_0|$ and $|v - v_0|$ are both less than $\epsilon/2$ whenever $||(x, y) - (x_0, y_0)||$ is less than $\delta_1$ or $\delta_2$ respectively.
Both hold if we use $\delta =$ min$(\delta_1, \delta_2)$ instead.
Using the triangle inequality, we can bound $|(u + iv) - (u_0 + iv_0)|$ by $\epsilon$ and the result follows from the definition of the limit.
The converse also follows by application of the triangle inequality.
\begin{theorem}
Suppose that
$$\lim_{z\to z_0}f_1(z) = w_1 \;\;\mbox{and}\;\; \lim_{z\to z_0}f_2(z) = w_2$$
then
\begin{itemize}
\item $\lim_{z \to z_0}f_1(z) + f_2(z) = w_1 + w_2$
\item $\lim_{z \to z_0}f_1(z)f_2(z) = w_1w_2$
\item If $w_2 \neq 0$ then $\lim_{z \to z_0}\frac{f_1(z)}{f_2(z)} = \frac{w_1}{w_2}.$
\end{itemize}
\end{theorem}
These follow from the corresponding results for real functions.
\begin{definition}
By
$$\lim_{z \to z_0}f(z) = \infty$$
we mean that for each $\epsilon > 0$ there is a $\delta > 0$ such that $|f(z)| > \frac{1}{\epsilon}$ whenever $0 < |z - z_0| < \delta$ and by
$$\lim_{z\to \infty}f(z) = w$$
we mean that for each $\epsilon > 0$ there exists a $\delta > 0$ such that $|f(z) - w| < \epsilon$ whenever $|z| > \frac{1}{\delta}$.
\end{definition}
\section{Continuity}
\begin{definition}
A function $f(z)$ of a complex variable is \textbf{continuous} at $z_0$ if
$$\lim_{z \to z_0}f(z) = f(z_0).$$
We say that $f$ is continuous in a region $R$ if it is continuous at every point in $R$.
\end{definition}
\begin{theorem}
We have that
\begin{itemize}
\item the sum and product of continuous functions is continuous.
\item excluding division by zero, the quotient of continuous functions is continuous.
\item The composition $f(g(z))$ of continuous functions $f(w)$, $g(z)$ is continuous.
\item the function $f(z) = u(x, y) + iv(x, y)$ for $z = x + iy$ is continuous iff the components $u, v$ are continuous functions of two real variables.
\end{itemize}
\end{theorem}
All of these follow easily from the definition and relevant properties of limits.
\begin{corollary}
Any polynomial function $f(z) = a_0 + a_1z + \cdots + a_nz^n$ for $a_i \in \C$ is continuous everywhere in the complex plane.
\end{corollary}
\begin{theorem}
If $f(z)$ and $g(z)$ are continuous at $z_0$ then
\begin{itemize}
\item $f(z) + g(z)$ is continuous at $z_0$
\item $f(z)g(z)$ is continuous at $z_0$
\item $f(z)/g(z)$ is continuous at $z_0$ if $g(z_0) \neq 0$
\end{itemize}
\end{theorem}
These follow from the corresponding results on limits.
\begin{theorem}
If $f(x)$ is continuous at $x_0$, $z_0 = f(x_0)$ and $g(z)$ is continuous at $z_0$ then $(g\circ f)(x)$ is continuous at $x_0$.
\end{theorem}
We have an $(\epsilon, \delta)$ statement for $g(z)$ at $z_0$. By continuity of $f(x)$ at $x_0$ we know there is a $\gamma > 0$ such that $|f(x) - f(x_0)| < \delta$ whenever $|x - x_0| < \gamma$. Thus we have an $(\epsilon, \gamma)$ statement for $(g\circ f)(x)$.
\begin{corollary}
If $f(z)$ is continuous at $z_0$ and $f(z_0) \neq 0$, then there is a neighbourhood of $z_0$ for which $f(z) \neq 0$.
\end{corollary}
If $|f(z_0)| = \epsilon$, there is a $\delta$ neighbourhood of $z_0$ for which $|f(z) - f(z_0)| < \epsilon$, i.e. $f(z)$ can't reach as far as $0$ in this neighbourhood.
\begin{theorem}
A function $f(z) = u(x, y) + iv(x, y)$ for real-valued functions $u$ and $v$ is continuous at $z_0$ iff $u$ and $v$ are.
\end{theorem}
This follows from the corresponding theorem for limits.
\begin{corollary}
If $f(z)$ is continuous on a closed, bounded region $R$, then $f$ is bounded on $R$ and $|f(z)|$ achieves a maximum somewhere on $R$.
\end{corollary}
Write $f(z) = u(x, y) + iv(x, y)$ for real-valued $u$ and $v$. By the theorem $u$ and $v$ are continuous on $R$. Thus $u$ and $v$ and hence $f$ are bounded on $R$.
The function $\sqrt{u(x, y)^2 + v(x, y)^2}$ achieves a maximum on $R$, and thus so does $|f(z)|$.
\begin{definition}
We say that a function $f(z)$ is \textbf{uniformly continuous} on a region $R$ if for any $\epsilon > 0$ there is a single value of $\delta > 0$ such that
$$|f(z) - f(z_0)| < \epsilon \;\;\mbox{whenever}\;\; |z - z_0| < \delta$$
for all $z_0 \in R$.
\end{definition}
\begin{theorem}
A function $f(z)$ which is continuous in a closed, bounded region $R$ is uniformly continuous there.
\end{theorem}
Write $f(z) = u(x, y) + iv(x, y)$ for real-valued $u$ and $v$. The result follows from the corresponding theorem for real-valued functions.
\section{Derivatives}
\begin{definition}
Let $f(z)$ be a function defined in a neighbourhood of a point $z_0$. The \textbf{derivative} of $f$ at $z_0$ is defined to be
$$f'(z_0) = \lim_{z\to z_0} \frac{f(z) - f(z_0)}{z - z_0}$$
if the limit exists. The function is said to be \textbf{differentiable} at $z_0$ if it does.
\end{definition}
\begin{theorem}
If the derivative of $f(z)$ exists at $z_0$ then $f(z)$ is continuous there.
\end{theorem}
Multiply the expression for the derivative at $z_0$ above by $\lim_{z\to z_0}(z - z_0) = 0$ and we have that $\lim_{z\to z_0}(f(z) - f(z_0)) = 0$. This is precisely the statement of the continuity of $f(z)$ at $z_0$.
\begin{theorem}
If $c \in \C$ and $f(z)$ is differentiable then
\begin{itemize}
\item $\frac{d}{dz}c = 0$
\item $\frac{d}{dz}z = 1$
\item $\frac{d}{dz}cf(z) = cf'(z)$
\end{itemize}
\end{theorem}
These follow directly from the definition.
\begin{theorem}
We have
$$\frac{d}{dz}z^n = nz^{n-1}$$
for all $n > 0$, and also for $n < 0$ when $z \neq 0$.
\end{theorem}
To prove this, we use the definition of the derivative and write $\delta = z - z_0$. We expand $(z_0 + \delta)^n$ using the binomial theorem.
\begin{theorem}
If $f(z)$ and $g(z)$ are both differentiable at $z$ then
\begin{itemize}
\item $\frac{d}{dz}\left(f(z) + g(z)\right) = f'(z) + g'(z)$
\item $\frac{d}{dz}\left(f(z)g(z)\right) = f(z)g'(z) + f'(z)g(z)$
\item $\frac{d}{dz}\left(f(z)/g(z)\right) = \frac{f'(z)g(z) - f(z)g'(z)}{g(z)^2}$ when $g(z) \neq 0$
\end{itemize}
\end{theorem}
The first part follows directly from the definitions.
For the second part we use
\begin{multline*}
f(z + \delta)g(z + \delta) - f(z)g(z) = f(z)\left[g(z + \delta) - g(z)\right] \\
+ \left[f(z + \delta) - f(z)\right]g(z + \delta).
\end{multline*}
For the third part, we prove the result first for $f(z) = 1$, which follows from the definition, and then use the second part.
\begin{theorem}
If $f(z)$ has a derivative at $z_0$ and $g(z)$ has a derivative at $f(z_0)$ then $h(z) = g(f(z))$ has a derivative at $z_0$, and
$$h'(z_0) = g'\left[f(z_0)\right]f'(z_0).$$
\end{theorem}
Writing $w = f(z)$ and $w_0 = f(z_0)$ we must show that
$$\lim_{z\to z_0}\frac{g(w) - g(w_0)}{z - z_0} = g'(w_0)\lim_{z\to z_0}\frac{w - w_0}{z - z_0}.$$
This would be true if
$$g(w) - g(w_0) = (g'(w_0) + T(w))(w - w_0),$$
for $T(w)$ defined in a neighbourhood of $w_0$, so long as $\lim_{z\to z_0}T(w) = 0$.
The function defined by
$$T(w) = \frac{g(w) - g(w_0)}{w - w_0} - g'(w_0),$$
when $w \neq w_0$ and $T(w) = 0$ at $w = w_0$, has precisely the required properties.
It is easy to see that $T(w)$ is continuous at $w = w_0$ and $w = f(z)$ is continuous at $z = z_0$. Thus $T(w) = T(f(z))$ is continuous at $z_0$. Thus
$$\lim_{z\to z_0}T(f(z)) = T(f(z_0)) = T(w_0) = 0,$$
as required.
\section{The Cauchy-Riemann identities}
We can find some necessary conditions for $f(z) = u(x, y) + iv(x, y)$ to be differentiable at $z_0 = x_0 + iy_0$.
\begin{theorem}
If $f(z) = u(x, y) + iv(x, y)$ is differentiable at $z_0 = x_0 + iy_0$ then
\begin{equation}
\begin{split}
f'(z_0) & = u_x(x_0, y_0) + iv_x(x_0, y_0) \\
& = -i\left[u_y(x_0, y_0) + iv_y(x_0, y_0)\right]
\end{split}
\end{equation}
\end{theorem}
This follows by expanding the expression for $f'(z)$ in terms of $u$ and $v$ and noting that the limits must still hold if we approach $z_0$ along the line $z = x + iy_0$ or along the line $z = x_0 + iy$, respectively.
\begin{corollary} (Cauchy-Riemann)
If $f(z) = u(x, y) + iv(x, y)$ is differentiable at $z_0 = x_0 + iy_0$ then
$$u_x(x_0, y_0) = v_y(x_0, y_0)$$
and
$$u_y(x_0, y_0) = -v_x(x_0, y_0).$$
\end{corollary}
We obtain this by equating the two expressions in the theorem and comparing real and imaginary parts.
The Cauchy-Riemann equations are only a necessary condition. But with some additional continuity conditions, we can find sufficient conditions for differentiability.
\begin{theorem}
If $f(z) = u(x, y) = iv(x, y)$ is defined in a neighbourhood of $z_0 = x_0 + iy_0$ then $f'(z_0)$ exists if
\begin{itemize}
\item the partial derivatives of $u$ and $v$ exist everywhere in the neighbourhood
\item the partial derivatives are continuous at $(x_0, y_0)$
\item the Cauchy-Riemann equations hold at $(x_0, y_0)$
\end{itemize}
\end{theorem}
Because the partial derivatives are continuous at $(x_0, y_0)$ we can write
$$\Delta u = u_x(x_0, y_0)\Delta x + u_y(x_0, y_0)\Delta y + \epsilon_1 |\Delta z|$$
and
$$\Delta v = v_x(x_0, y_0)\Delta x + v_y(x_0, y_0)\Delta y + \epsilon_2 |\Delta z|$$
for some functions $\epsilon_1$, $\epsilon_2$ that tend to $0$ as $(\Delta x, \Delta y)$ tends to $(0, 0)$.
Making use of the Cauchy-Riemann relations, we obtain an expression for $f'(z_0)$ which clearly exists.
One can restate the Cauchy-Riemann equations in polar coordinates when $z_0 \neq 0$.
To convert to polar form, we write
$$x = r\cos\theta \;\;\mbox{and}\;\; y = r\sin\theta.$$
\begin{theorem} (Cauchy-Riemann)
If $f(z) = u(r, \theta) + iv(r, \theta)$ is differentiable at $z_0 \neq 0$ then
$$u_r = v_\theta/r \;\;\mbox{and}\;\; u_\theta = -rv_r.$$
The derivative is given by
$$f'(z_0) = e^{-i\theta_0}\left(u_r(r_0, \theta_0) + iv_r(r_0, \theta_0)\right).$$
\end{theorem}
We have
$$u_r = u_x\cos\theta + u_y\sin\theta$$
$$u_\theta = -u_x r\sin\theta + u_y r\cos\theta$$
$$v_r = v_x\cos\theta + v_y\sin\theta$$
$$v_\theta = -v_x r\sin\theta + v_y r\cos\theta.$$
Applying the Cauchy-Riemann relations yields the stated result.
The necessary conditions for differentiability become the following.
\begin{theorem}
If $f(z) = u(r, \theta) + iv(r, \theta)$ is defined in a neighbourhood of $z_0 = r_0\exp(i\theta_0) \neq 0$ then $f'(z_0)$ exists if
\begin{itemize}
\item the partial derivatives of $u$ and $v$ with respect to $r$ and $\theta$ exist
\item the partial derivatives are continuous at $(r_0, \theta_0)$
\item the partial derivatives satisfy the polar form of the Cauchy-Riemann relations
\end{itemize}
\end{theorem}
This is a straightforward translation of the result for rectangular coordinates.
\begin{definition}
A region of the complex plane is \textbf{connected} if any two points in the region can be joined by a series of straight lines.
\end{definition}
\begin{definition}
A \textbf{domain} is an open region of the complex plane that is connected.
\end{definition}
\begin{theorem}
If $f'(z) = 0$ at all points in a domain $D$ then $f(z)$ is constant in $D$.
\end{theorem}
We write $f(z) = u(x, y) + iv(x, y)$ and note that if $f'(z) = 0$ then $u_x + iv_x = 0$. By the Cauchy-Riemann equations we then have
$$u_x = u_y = v_x = v_y = 0.$$
But this means that any directional derivative of $u$ at any point in $D$ is zero, and similarly for $v$. In particular, this means that the value of $f$ along any line in $D$ must be constant.
As $D$ is connected, the result follows.
\section{Analytic functions}
\begin{definition}
A function $f(z)$ is \textbf{analytic} (or holomorphic) in an open set if it is differentiable at each point in that set. The function $f(z)$ is analytic at a point $z_0$ if it is analytic in a neighbourhood of $z_0$.
\end{definition}
\begin{definition}
A function $f(z)$ is \textbf{entire} if it is analytic at every point in the complex plane.
\end{definition}
\begin{definition}
If a function $f(z)$ is analytic at every point in a neighbourhood of $z_0$ except $z_0$ itself, then $z_0$ is called a \textbf{singular} point of $f$.
\end{definition}
\begin{theorem}
If $f(z)$ and $g(z)$ are analytic in a domain $D$ then
\begin{itemize}
\item $f(z) + g(z)$ is analytic in $D$
\item $f(z)g(z)$ is analytic in $D$
\item $f(z)/g(z)$ is analytic in $D$ if $g(z) \neq 0$ for all $z \in D$
\end{itemize}
\end{theorem}
\begin{theorem}
If $f(z)$ is analytic in a domain $D$ and $g(z)$ is analytic in a domain containing the image of $D$ under $z \mapsto f(z)$, then $g(f(z))$ is analytic in $D$.
\end{theorem}
These follow from the corresponding facts about differentiability.
\section{The exponential function}
For real-valued $x$, the exponential function $e^x$ satisfies two important identities.
\begin{itemize}
\item $e^x$ is entire and $\frac{d}{dx}e^x = e^x$
\item for all $x, y \in \R$ we have $e^{x + y} = e^xe^y$
\end{itemize}
When defining the exponential function $e^z$ for complex $z = x + iy$ it is natural to define it to be a function that has the above properties and that reduces to the ordinary real-valued function when $y = 0$.
In fact, there is a unique complex-valued function with these properties.
\begin{theorem}
The function
$$f(z) = e^x(\cos y + i\sin y)$$
is entire and $f'(z) = f(z)$.
\end{theorem}
Writing $f(z) = u(x, y) + iv(x, y)$ we have $u_x = v_y$ and $u_y = -v_x$, which are everywhere continuous. Thus $f(z)$ is differentiable everywhere.
We have that $f'(z) = u_x + iv_x = f(z)$.
Note that $f(z)$ as defined in the theorem reduces to $e^x$ when $y = 0$.
\begin{theorem}
The only complex-valued function $f(z)$ which satisfies
\begin{itemize}
\item $f(x) = e^x$ for $x \in \R$
\item $f$ is entire and $f'(z) = f(z)$ for all $z \in \C$
\end{itemize}
is the function $f(z) = e^x(\cos y + i\sin y)$.
\end{theorem}
Let us write $e^z$ as a shorthand for $e^x(\cos y + i\sin y)$. Let $f(z)$ be a function with the required properties. Write $g(z) = f(z)e^{-z}$.
As $f(z)$ and $e^{-z}$ are entire, so is $g(z)$. By the product rule and chain rule, we have
$g'(z) = f'(z)e^{-z} - f(z)e^{-z} = 0$.
Thus $g'(z) = c$ for some constant $c \in \C$, i.e. $f(z) = c/e^{-z} = ce^z$ as can be verified by expanding out $e^{-z}$.
Clearly $c = 1$ in order for the first condition to hold.
It makes sense to define the complex exponential as follows.
\begin{definition}
We define
$$e^z = e^x(\cos y + i\sin y),$$
for all $z = x + iy \in \C$.
\end{definition}
\begin{theorem}
We have
$$e^{z_1 + z_2} = e^{z_1}e^{z_2},$$
for all $z_1, z_2 \in \C$.
\end{theorem}
Write $z_1 = x_1 + iy_1$ and $z_2 = x_2 + iy_2$. We check that
$$(\cos y_1 + i\sin y_1)(\cos y_2 + i\sin y_2) = \cos (y_1 + y_2) + i\sin (y_1 + y_2)$$
using standard trig identities. The rest of the result is straightforward.
\begin{corollary}
For $n \in \Z$ we have
$$e^{nz} = (e^z)^n.$$
\end{corollary}
Follows from the theorem by induction for positive $n$. As we already saw above, $e^{-z} = 1/e^z$, so the result also follows for negative $n$. For $n = 0$, use $e^0 = e^ze^{-z} = 1$.
\section{Trigonometric functions}
From $e^{iy} = \cos y + i\sin y$ and $e^{-iy} = \cos y - i\sin y$ we obtain
$$\sin y = \frac{e^{iy} - e^{-iy}}{2i} \;\;\mbox{and}\;\; \cos y = \frac{e^{iy} + e^{-iy}}{2}.$$
This leads us to the following definition.
\begin{definition}
For $z \in C$ we define
$$\sin z = \frac{e^{iz} - e^{-iz}}{2i} \;\;\mbox{and}\;\; \cos y = \frac{e^{iz} + e^{-iz}}{2}.$$
\end{definition}
These are entire function by the rules of sums and quotients of entire functions.
\begin{theorem}
We have
$$\frac{d}{dz}\sin z = \cos z \;\;\mbox{and}\;\; \frac{d}{dz}\cos z = -\sin z.$$
\end{theorem}
This follows directly from the definition and the derivative of the exponential function.
We also have
$$\sin(-z) = -\sin z \;\;\mbox{and}\;\; \cos(-z) = \cos z.$$
\begin{theorem}
We have the following identities
$$\sin(z_1 + z_2) = \sin z_1\cos z_2 + \cos z_1\sin z_2$$
$$\cos(z_1 + z_2) = \cos z_1\cos z_2 - \sin z_1\sin z_2$$
$$\sin^2 z + \cos^2 z = 1$$
$$\sin(z + \pi/2) = \cos z$$
$$\sin(z - \pi/2) = -\cos z$$
$$\sin(z + \pi) = -\sin z$$
$$\cos(z + \pi) = -\cos z$$
$$\sin(z + 2\pi) = \sin z$$
$$\cos(z + 2\pi) = \cos z$$
\end{theorem}
These follow by straightforward algebraic manipulation and standard trig identities for real variables.
Recall that for $y \in \R$ we have
$$\sinh y = \frac{e^y - e^{-y}}{2} \;\;\mbox{and}\;\; \cosh y = \frac{e^y + e^{-y}}{2}.$$
We can use these to obtain the real and complex parts of $\sin$ and $\cos$.
\begin{theorem}
We have
$$\sin z = \sin x\cosh y + i\cos x \sinh y$$
$$\cos z = \cos x\cosh y - i\sin x \sinh y$$
\end{theorem}
We note that $\sin(iy) = i\sinh y$ and $\cos(iy) = \cosh y$.
\begin{theorem}
We have
$$|\sin z|^2 = \sin^2 x + \sinh^2 y$$
$$|\cos z|^2 = \cos^2 x + \sinh^2 y$$
\end{theorem}
We use the previous theorem and the fact that $\sin^2 y + \cos^2 y = 1$ and $\cosh^2 y - \sinh^2 y = 1$.
\begin{theorem}
The zeroes of $\sin z$ are $z = n\pi$ for $n \in \Z$, and the zeroes of $\cos z$ are offset from those by $\pi/2$.
\end{theorem}
We use the previous theorem and note that we must have $\sin x = 0$ and $\sinh y = 0$.
\begin{definition}
We define
$$\tan z = \frac{\sin z}{\cos z}, \;\; \cot z = \frac{\cos z}{\sin z},$$
$$\sec z = \frac{1}{\cos z}, \;\; \csc z = \frac{1}{\sin z}.$$
\end{definition}
\begin{theorem}
We have
$$\frac{d}{dz}\tan z = \sec^2 z, \;\; \frac{d}{dz}\cot z = -\csc^2 z,$$
$$\frac{d}{dz}\sec z = \sec z\tan z, \;\; \frac{d}{dz}\csc z = -\csc z\cot z.$$
\end{theorem}
We use the quotient rule in the definitions and standard trig identities.
\section{The logarithm}
Recall that $\ln x$ is the inverse of the exponential function $e^x$ for $x \in \R$. As the latter takes on every positive real value, the domain of $\ln x$ is $\R^{+}$.
\begin{theorem}
If $z = re^{i\theta}$ is a complex number in modulus/argument format, with $-\pi < \theta \leq \pi$, the multi-valued function
$$\log z = \ln r + i(\theta + 2n\pi), \;\; n \in \Z$$
satisfies
$$e^{\log z} = z.$$
\end{theorem}
As $e^{2\pi i} = 1$, the result follows by substitution.
\begin{definition}
We define the complex logarithm by
$$\log z = \ln r + i(\theta + 2n\pi), \;\; n \in \Z$$
for all $z = re^{i\theta}$ with $-\pi < \theta \leq \pi$. The function
$$\Log z = \ln r + i\theta$$
is called the \textbf{principal branch} of $\log z$.
\end{definition}
Recall that $\ln x$ is continuous and differentiable for $x > 0$ with
$$\frac{d}{dx}\ln x = \frac{1}{x}.$$
\begin{theorem}
The function $\Log z$ is analytic (and therefore continuous) on the domain $r > 0$, $-\pi < \theta < \pi$.
\end{theorem}
Writing $\Log z$ in polar form we get $u(r, \theta) = \ln r$ and $v(r, \theta) = \theta$. The first order partial derivatives are continuous on the stated domain.
We also have
$$u_r = v_\theta/r \;\;\mbox{and}\;\; u_\theta = -rv_r,$$
so that the polar form of the Cauchy-Riemann equations is satisfied. Thus $\Log z$ is analytic on the stated domain.
\begin{theorem}
We have
$$\frac{d}{dz}\Log z = \frac{1}{z}$$
on the domain $r > 0$, $-\pi < \theta < \pi$.
\end{theorem}
We have
$$\frac{d}{dz}\Log z = e^{-i\theta}(u_r + iv_r) = \frac{1}{re^{i\theta}} = \frac{1}{z}.$$
\begin{definition}
A \textbf{branch} of a multi-valued function $f(z)$ is a single-valued function $F(z)$ analytic on some domain where it takes one of the values of $f(z)$.
\end{definition}
\begin{definition}
A \textbf{branch cut} is a line or curve that is used to define a branch $F(z)$ of a multi-valued function $f(z)$. Points on a branch cut are singular values for the single valued function $F(z)$. Any point that is on every branch cut of $f$ is called a \textbf{branch point}.
\end{definition}
For example, the ray $\theta = \pi$ is a branch cut for $\log z$, and the origin is a branch point.
The following theorem holds for the multivalued function $\log$, by which we mean that if two of the values in the identity are specified, there is a value of the third function making the identity hold.
\begin{theorem}
We have
$$\log(z_1z_2) = \log z_1 + \log z_2$$
for all $z_1, z_2 \in \C$.
\end{theorem}
This follows immediately from the definition of $\log z$.
Note that this result doesn't hold everywhere for the principal branch.
\section{Complex exponents}
\begin{definition}
For $z \neq 0$ and $c$ any complex number, we define
$$z^c = e^{c\log z}.$$
\end{definition}
Note that this is may be multi-valued function. For example, if $c = 1/n$ for an integer $n$, then there are $n$ distinct values of the function.
\begin{definition}
The \textbf{principal value} of $z^c$ is given when $\log z$ is replaced with the principal branch $\Log z$ in the definition.
\end{definition}
\begin{theorem}
The derivative of a branch of $z^c$ is given by
$$\frac{d}{dz}z^c = cz^{c - 1},$$
which is single-valued on the same domain as $z^c$.
\end{theorem}
Follows by the chain rule.
\section{Inverse trigonometric functions}
\begin{theorem}
The inverse sine function is given by the multi-valued function
$$\sin^{-1} z = -i\log\left[iz + (1 - z^2)^{1/2}\right].$$
\end{theorem}
We want $w$ where
$$z = \frac{e^{iw} - e^{-iw}}{2i}.$$
Expressing as a quadratic and solving for $e^{iw}$ we get
$$e^{iw} = iz + (1 - z^2)^{1/2}.$$
Taking logarithms of both sides yields the stated result.
The same technique can be used to show the following.
\begin{theorem}
$$\cos^{-1} z = -i\log\left[z + i(1 - z^2)^{1/2}\right]$$
\end{theorem}
\begin{theorem}
$$\tan^{-1} z = \frac{i}{2}\log\frac{i+z}{i-z}.$$
\end{theorem}
We easily differentiate these expressions to obtain the following.
\begin{theorem}
$$\frac{d}{dz}\sin^{-1} z = \frac{1}{(1 - z^2)^{1/2}},$$
$$\frac{d}{dz}\cos^{-1} z = -\frac{1}{(1 - z^2)^{1/2}},$$
$$\frac{d}{dz}\tan^{-1} z = \frac{1}{1 + z^2}.$$
\end{theorem}
The first two depend on the choice of square root made, whereas the last is single-valued regardless of what branch of $\log$ is taken.
\section{Complex-valued functions of a real variable}
\begin{definition}
If $f(t) = u(t) + iv(t)$ is a complex-valued function of a real parameter $t$, the derivative of $f$ with respect to $t$ is given by
$$f'(t) = u'(t) + iv'(t).$$
\end{definition}
\begin{definition}
If $f(t) = u(t) + iv(t)$ is a complex-valued function of a real parameter $t$, the definite integral of $f$ with respect to $t$ in the interval $a \leq t \leq b$ is given by
$$\int_a^b f(t)dt = \int_a^b u(t) + i\int_a^b v(t)dt.$$
\end{definition}
The definite integral exists if both $u$ and $v$ are piecewise continuous on the interval $a \leq t \leq b$.
Similar definitions exist for improper integrals.
The Fundamental Theorem of Calculus holds for functions of this type.
\begin{theorem}
If $f(t) = u(t) + iv(t)$ and $F(t) = U(t) + iV(t)$ are continuous on $a \leq t \leq b$ with $F'(t) = f(t)$ then
$$\int_a^b f(t)dt = F(b) - F(a).$$
\end{theorem}
Follows from the definition of the integral.
\begin{theorem}
For $a \leq b$ we have
$$\left|\int_a^b f(t)dt\right| \leq \int_a^b |f(t)|dt.$$
\end{theorem}
We obtain the absolute value of the integral on the left side by multiplying it by the inverse of $e^{i\theta}$ where $\theta$ is its argument. The scaled integral then has a real value.
This means we only need to consider the real part of this scaled integral. But
$$\mbox{Re}(e^{-i\theta}f(t)) \leq \left|e^{-i\theta}f(t)\right| = \left|f(t)\right|.$$
This gives the stated inequality by standard inequalities for integrals of real-valued functions.
\section{Contours}
Integrals of complex-valued functions of a complex variable $z$ are defined for curves in the complex plane. The curve is first parameterised by a real parameter $t$, so that we can use the integrals of the previous section to define such path integrals.
\begin{definition}
An \textbf{arc} $C$ in the complex plane is a set of points $z = x(t) + iy(t)$ for $a \leq t \leq b$ for continuous real-valued functions $x(t)$ and $y(t)$.
\end{definition}
\begin{definition}
An arc $C$ is said to be \textbf{simple} if it doesn't cross itself. An arc $C$ is said to be a \textbf{simple closed curve} if it doesn't cross itself except for $z(a) = z(b)$.
\end{definition}
Examples include straight line segments and circles, or arcs of circles.
\begin{definition}
An arc $C$ with points $z(t) = x(t) + iy(t)$ for $a \leq t \leq b$ is said to be a \textbf{differentiable arc} if $x'(t)$ and $y'(t)$ exist and are continuous.
\end{definition}
We can compute the length of a differentiable arc.
\begin{theorem}
If $C$ is a differentiable arc with points $z(t) = x(t) + iy(t)$ for $a \leq t \leq b$ then the length of the arc is given by
$$L = \int_a^b \left|z'(t)\right| dt.$$
\end{theorem}
Thinking of the points in the complex plane as points in the $(x, y)$ plane, this is just the standard formula for arc length from calculus.
The parameterisation of an arc by a parameter $t$ is not unique. If we have another parameter $\tau$ such that
$$t = \phi(\tau), \;\; \alpha \leq \tau \leq \beta,$$
we can convert between the two parameterisations.
In order to ensure that $t$ increases whenever $\tau$ does, we require that $\phi'(\tau) > 0$ for all $\alpha \leq \tau \leq \beta$.
\begin{theorem}
If $C$ is a differentiable arc with points $z(t) = x(t) + iy(t)$ for $a \leq t \leq b$ and $t = \phi(\tau)$ for $\alpha \leq \tau \leq \beta$ with $\phi'(\tau) > 0$ for all $\alpha \leq \tau \leq \beta$ then the length of $C$ is given by
$$L = \int_{\alpha}^\beta \left|z'(\phi(\tau))\right|\phi'(\tau)d\tau.$$
\end{theorem}
Follows by splitting $z(t)$ into real and imaginary parts and then making use of the corresponding result for real-valued functions.
Note that if $z(t) = Z(\tau) = z(\phi(\tau))$ for $\alpha \leq \tau \leq \beta$ then
$$Z'(\tau) = z'(\phi(\tau))\phi'(\tau)$$
by the chain rule.
\begin{definition}
A differentiable arc $C$ given by $z(t) = x(t) + iy(t)$ for $a \leq t \leq b$ is said to be \textbf{smooth} if $z'(t) \neq 0$ on the open interval $a < t < b$.
\end{definition}
\begin{definition}
The unit tangent vector to a smooth arc $C$ given by $z(t) = x(t) + iy(t)$ for $a \leq t \leq b$ is given by
$$\underbar{T} = \frac{z'(t)}{|z'(t)|}.$$
\end{definition}
Note that the unit tangent vector doesn't depend on the parameter $t$, since changing the parameter $t$ by $t = \phi(\tau)$ for $\phi'(\tau) > 0$ only changes $z'$ by a positive real factor, which is subsequently scaled out.
The unit tangent vector is in fact the unit tangent vector to the curve $C$ when thought of as a curve in the $(x, y)$ plane.
\begin{definition}
A \textbf{contour} is a piecewise smooth arc.
\end{definition}
The integral of a function $f(z)$ along a contour $C$ is denoted
$$\int_C f(z)dz$$
\begin{definition}
If the contour $C$ is given by points $z = z(t)$ for $a \leq t \leq b$ and $f(z)$ is a piecewise continuous function on $C$, then the \textbf{contour integral} of $f$ along $C$ is given by
$$\int_C f(z)dz = \int_a^b f(z(t))z'(t)dt$$
\end{definition}
Note that as $C$ is a contour, $z'(t)$ is piecewise continuous. As $f(z)$ is piecewise continuous, so is $f(z(t))$ and thus the integral exists.
\begin{theorem}
The value of the contour integral is independent is independent of the representation of $C$.
\end{theorem}
The proof is essentially the same as the proof of independence of arc length.
\begin{theorem}
For any constant $z_0$ and piecewise continuous functions $f(z)$ and $g(z)$ we have
$$\int_C z_0f(z)dz = z_0\int_C f(z)dz$$
and
$$\int_C [f(z) + g(z)]dz = \int_C f(z)dz + \int_C g(z) dz$$
\end{theorem}
These follow immediately from the definitions of the contour integral and the corresponding definitions of complex-valued functions of a real parameter.
\begin{theorem}
If we write $-C$ for the contour $C$ in reverse, then for a piecewise continuous function $f(z)$ we have
$$\int_{-C}f(z)dz = -\int_C f(z)dz$$
\end{theorem}
The contour $-C$ has points $z = z(-t)$ for $-b \leq t \leq -a$. Thus
$$\int_{-C}f(z)dz = \int_{-b}^{-a} f(z(-t))(-z'(t))dt$$
The result follows by making a change of variables $s = -t$.
\begin{theorem}
If $C_1$ is a contour whose endpoint is the starting point of a contour $C_2$, then for any piecewise continuous function $f(z)$ we have
$$\int_C f(z)dz = \int_{C_1}f(z)dz + \int_{C_2}f(z)dz,$$
where $C$ is the contour that first follows $C_1$ then $C_2$.
\end{theorem}
We note that shifting the representation of a contour with points $z(t)$ for $a \leq t \leq b$ so that it has points $Z(s) = z(s - d)$ for $a + d \leq s \leq b + d$ doesn't change the value of the integral, since $s'(t) = 1$.
Thus the points of $C$ can be represented as a function of a single parameter $t$, with the points of $C_2$ shifted so that the starting point of $C_2$ is the end point of $C_1$.
The result follows by the corresponding theorem for the sum of two integrals of a real-valued parameter.
\begin{theorem}
If $f(z)$ is a piecewise continuous function on a contour $C$ of length $L$ such that $|f(z)| \leq M$ for some nonnegative constant $M$ for all points on $C$ then
$$\left|\int_C f(z)dz\right| \leq LM$$
\end{theorem}
If the points of $C$ are given by $z(t)$ for $a \leq t \leq b$ then
$$\left|\int_C f(z)dz\right| \leq \int_a^b |f(z(t))z'(t)|dt.$$
The result now follows by replacing $|f(z)|$ by $M$ and pulling out the constant $M$, and noticing that what remains is the length of the contour.
\section{Antiderivatives}
Sometimes contour integrals are independent of the path that is taken between the endpoints. We examine when this is the case.
\begin{definition}
An \textbf{antiderivative} of a continuous function $f$ in a domain $D$ is a function $F$ such that $F'(z) = f(z)$ for all $z \in D$.
\end{definition}
Note that an antiderivative is analytic on $D$.
\begin{theorem}
The antiderivate $F(z)$ of a continuous function $f(z)$ is unique up to addition of a constant, if it exists.
\end{theorem}
If $G(z)$ is also an antiderivative then $F(z) - G(z)$ has derivative zero. This implies that $F(z) - G(z) = c$ for some constant $c$.
\begin{theorem}
If $f(z)$ is continuous on a domain $D$ then the following are equivalent
\begin{itemize}
\item $f$ has an antiderivative $F$ on $D$
\item integrals of $f$ along contours lying entirely in $D$ with the same start and end points, have the same value
\item integrals of $f$ around closed contours lying entirely in $D$ have value zero
\end{itemize}
\end{theorem}
To show the first implies the second, consider first the case of smooth arcs $C$ between fixed endpoints $z_1$ and $z_2$.
If $C$ is parameterised by $z = z(t)$ for $a \leq t \leq b$ then
$$\frac{d}{dz}F(z(t)) = F'(z(t))z'(t) = f(z(t))z'(t).$$
By the Fundamental Theorem of Calculus extends to complex functions of a real variable, we have
$$\int_C f(z)dz = \int_a^b f(z(t))z'(t)dt = F(z(b)) - F(z(a)).$$
This clearly only depends on the values of $F$ at the endpoints.
The result holds for an arbitrary contour by additivity.
The third part obviously follows from the second, by considering any two distinct points on the closed contour and thinking of the closed contour in two parts, between those points.
Clearly the converse of this implication also holds, by reversing the argument. Thus to show that the third part of the theorem implies the first, it is sufficient to show that the second part implies the first.
To accomplish this, we define
$$F(z) = \int_{z_0}^z f(s)ds,$$
where the integral notation means to take any contour from $s = z_0$ to $s = z$ lying wholly within $D$.
We are done if we show that $F$ is an antiderivative of $f$, i.e. that $F'(z) = f(z)$ on $D$.
To do so, let $\Delta z$ be any point distinct from $z$ in a neighbourhood of $z$ contained in $D$. By additivity
$$F(z + \Delta z) - F(z) = \int_z^{z + \Delta z} f(s)ds.$$
By path independence, we can take the path of integration to be a straight line.
It is easy to show that
$$f(z) = \frac{1}{\Delta z}\int_z^{z + \Delta z}f(z) ds,$$
for any fixed value of $z$ (so that $f(z)$ is a constant in the integral).
Thus
$$\frac{F(z + \Delta z) - F(z)}{\Delta z} - f(z) = \frac{1}{\Delta z}\int_z^{z + \Delta z}f(s) - f(z)ds.$$
The derivative we are after is the limit of the first expression on the left side as $\Delta z \to 0$.
But $f$ is continuous at $z$. Thus the right hand side can be made as close to zero as one wishes.
Thus $F'(z) = f(z)$ and we are done.
\section{The Cauchy-Goursat theorem}
Suppose that $C$ is a simple, closed contour given by points $z(t)$ for $a \leq t \leq b$ and that the contour is counterclockwise. Also suppose that $f(z)$ is analytic in the interior of, and at each point of $C$.
We recall that
$$\int_C f(z)dz = \int_a^b f(z(t))z'(t)dt.$$
Writing
$$f(z) = u(x(t), y(t)) + iv(x(t), y(t)),$$
for $z = x + iy$ and making use of the chain rule, we have
$$\int_C f(z)dz = \int_a^b (ax' - vy')dt + i\int_a^b (vx' + uy')dt.$$
In terms of line integrals of real-valued functions of real variables, this yields
$$\int_C f(z)dz = \int_C udx - vdy + i\int vdx + udy.$$
Now recall the following theorem from multivariable calculus.
\begin{theorem} (Green)
If two real-valued functions $P(x, y)$ and $Q(x, y)$ and their first-order partial derivatives are continuous throughout the closed region $R$ with boundary $C$ then
$$\int_C Pdx + Qdy = \int \int_R (Q_x - P_y)dA.$$
\end{theorem}
Since the function $f$ above is analytic on $R$, it is continuous there. Thus $u$ and $v$ are also continuous in $R$.
Suppose in addition that $f'$ is also continuous in $R$. Then the first order partial derivatives of $u$ and $v$ will be too. Then Green's theorem gives us
$$\int_C f(z) dz = \int \int_R (-v_x - u_y)dA + i\int \int_R (u_x - v_y)dA.$$
But since $f$ is analytic on $R$ we have by the Cauchy-Riemann equations that
$$u_x = v_y \;\;\mbox{and}\;\; u_y = -vx.$$
Thus the previous integral is zero, i.e. we have
$$\int_C f(z) dz = 0.$$
Along the way, we added the assumption that $f$ had continuous derivative. But Goursat was able to remove this assumption. In fact, the following theorem holds.
\begin{theorem} (Cauchy-Goursat)
If a function $f$ is analytic at all points interior to and on a simple, closed countour $C$, then
$$\int_C f(z)dz = 0.$$
\end{theorem}
We give only a sketch of the proof of this result, since the full proof is quite long.
The idea is that we will divide the region $R$ enclosed by $C$ into a collection of squares, and partial squares along the boundary.
We claim that it is possible to divide the region in such a way, using squares not necessarily of the same size, such that for each of the squares, indexed by $j = 1, 2, \ldots, n$ there is a point $z_j$ for which
$$\left|\frac{f(z) - f(z_j)}{z - z_j} - f'(z_j)\right| < \epsilon$$
for all $z \neq z_j$ in that square, where $\epsilon$ is fixed and as small as one desires.
This follows from the definition of the derivative as a limit. If the number of squares were not finite, then it must be possible to subdivide a given square into four equal sized squares, and one of those into four more an so on, so that the inequality never holds. We end up with a sequence of every smaller squares converging on a point, for which the inequality doesn't hold. But this then contradicts the definition of the derivative at that point. Thus there are a finite number of squares.
Next we define the function
$$\delta_j = \begin{cases}\frac{f(z) - f(z_j)}{z - z_j} - f'(z_j) & \mbox{when}\;\; z \neq z_j,\\ 0 & \mbox{when}\;\; z = z_j\end{cases}.$$
On the $j$-th square, we have $|\delta_j(z)| < \epsilon$. The function $\delta_j(z)$ is also continuous on that region.
Let $C_j$ be the boundary of the $j$-th square or partial square. Critically, we have
$$f(z) = f(z_j) - z_jf'(z_j) + f'(z_j)z + (z - z_j)\delta_j(z)$$
on such a region.
Because each of these terms has an antiderivative except the last, their integrals along $C_j$ are zero, leading to
$$\int_{C_j} f(z)dz = \int_{C_j} (z - z_j)\delta_j(z)dz.$$
The integral of $f(z)$ on $C$ is the sum of the integrals along the boundaries of all the squares and partial squares, since each boundary of a square on the interior of $R$ is part of the boundary of two different squares in the opposite sense and so their integrals cancel.
Letting $s_j$ be the side length of the $j$-th square, we have
$$|z - z_j| \leq \sqrt{s}s_j.$$
The length of the boundary of the $j$-th square is either $4s_j$ if it is a square, or if not, it is bounded by $4s_j + L_j$ where $L_j$ is the length of the portion of the region $R$ included in the boundary of the partial square.
Using these inequalities, it is possible to obtain a bound of the following form
$$\left|\int_C f(z)dz\right| < D\epsilon,$$
where $D$ is some constant in terms of say the area of a square bounding $R$ and the length of the boundary of $R$.
Since $\epsilon$ may be taken as small as one desires, the result follows.
\end{document}
| {
"alphanum_fraction": 0.6531550775,
"avg_line_length": 42.6049250535,
"ext": "tex",
"hexsha": "53d5e5a55cd7a9c8b54d0131c472a0ef058aaf6d",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "bb10ca85044cc4767dcdbd5bd41ce530edad3667",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "wbhart/ShortMathNotes",
"max_forks_repo_path": "ComplexVariablesSummary.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "bb10ca85044cc4767dcdbd5bd41ce530edad3667",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "wbhart/ShortMathNotes",
"max_issues_repo_path": "ComplexVariablesSummary.tex",
"max_line_length": 497,
"max_stars_count": 3,
"max_stars_repo_head_hexsha": "bb10ca85044cc4767dcdbd5bd41ce530edad3667",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "wbhart/ShortMathNotes",
"max_stars_repo_path": "ComplexVariablesSummary.tex",
"max_stars_repo_stars_event_max_datetime": "2022-01-10T06:53:30.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-07-23T15:01:27.000Z",
"num_tokens": 13397,
"size": 39793
} |
\section{Elementary Equations and Elementary Matrices}
\begin{definition}
An elementary column operation on an $m\times n$ matrix $A$ are one of the followings:\\
(i) Swap columns $i,j$ with $i\neq j$.\\
(ii) Multiply the entire column $i$ by $\lambda\in F\setminus\{0\}$.\\
(iii) Add $\lambda$ times column $i$ to column $j$ where $\lambda\in F$.
\end{definition}
We can do row operations in a analogous (transposed) way.
Something remarkable is that these operations are invertible.
Instead of find the inverses one-by-one, we realise these operations via the action of elementary matrices.
Let $E_{ij}$ be the matrix with $1$ on the $i,j$ entry and zero anywhere else, we have:
\begin{definition}[Elementary Matrices]
The elementary matrices are $T_{ij}=I-E_{ii}-E_{jj}+E_{ij}+E_{ji}$ for $i\neq j$, $M_{i,\lambda}=I+(\lambda-1)E_{ij}$ for $\lambda\neq 0$ and $C_{i,j,\lambda}=I+\lambda E_{ij}$.
\end{definition}
Then, we easily see that $T_{ij}$ corresponds to column (row) operation (i), $M_{i,\lambda}$ to operation (ii) and $C_{i,j,\lambda}$ to operation (iii) via the operation of multiplying $A$ with the correspondinng matrix from the right (left).
\begin{example}
$$\begin{pmatrix}
1&2\\
3&4
\end{pmatrix}\begin{pmatrix}
0&1\\
1&0
\end{pmatrix}=\begin{pmatrix}
2&1\\
4&3
\end{pmatrix}$$
\end{example}
\begin{proof}[Constructive Proof of Proposition \ref{eqv_form}]
It suffices to show that we can get from any matrix to
$$\left( \begin{array}{c|c}
I_r&0\\
\hline
0&0
\end{array} \right)$$
via elementary column and row operations.
Start with a matrix $A$.
If $A=0$ then we are done.
Otherwise pick $a_{ij}=\lambda\neq 0$ and swap rows $i$ and $1$ and then columns $j$ and $1$, after which $\lambda$ is at position $1,1$.
Then multiply column $1$ by $\lambda^{-1}$.
So we get $1$ at position $1,1$.
Now we clean up row $1$ and column $1$ via operation (iii) (both row and column).
Afterwards we can perform the same procedure on the submatrix by removing the first row and column.
By induction we can get the desired form at the end.
\end{proof}
There are a few variations on these row and column operations.
The first one is Gauss' pivot algorithm.
If one use only row operations, then one will reach the ``row echelon form'' (which we will define later) in the following way:
Assume $a_{i1}\neq 0$ for some $i$.
Otherwise just move on by deleting the first zero columns.
Then swap rows $i$ and $1$ and divide row $1$ by $\lambda=a_{i1}$ to get $1$ at position $1,1$ and use (iii) to clean up the first column.
And one can move on with the same method to the submatrix removing the first row and first column.
Do this repeatedly and at the end we can get a matrix satisfying:\\
1. For any $i$ here exists $k(i)\ge i$ such that $a_{ij}=0$ for any $j<k(i)$.\\
2. $k(i)$ is increasing in $i$.\\
3. Row $k(i)$ equals $e_{k(i)}$.\\
And matrices satisfying these conditions are called matrices in row echelon form.
Note that the operations above is exactly what we will get when solving a linear system of equations.
So this can be an algorithm of doing that, which is now known as Gauss' pivot algorithm (or Gaussian elimination).\\
Another variation is the following:
\begin{lemma}
We can obtain the identity matrix from any invertible square matrix via column operations only.
\end{lemma}
By transpose, we can replace column operations by row operations.
\begin{proof}
We argue by induction on the $k$ where we can guarantee to transform $A$ to the form
$$\begin{pmatrix}
I_k&0\\
\ast&\ast
\end{pmatrix}$$
The initial case is obvious.
Suppose we can do this for some $k$, we shall show that we can do this for $k+1$.
Now there must be some $j>k$ such that $a_{k+1,j}=\lambda\neq0$.
Otherwise the vector $e_{k+1}$ is not in the span of the column vectors of $A$, contradiction.
So we swap columns $k+1$ and $j$ and then divide column $k+1$ by $\lambda$.
This gets us $1$ at position $k+1,k+1$.
Then we can clean up the row $k+1$ by this $1$, which completes the induction process.
\end{proof}
This immediately provides an algorithm (a quite cost-effective one) for computing the inverse.
As one can see, this algorithm is analogous to the algorithm of solving a nonsingular linear system.
Also,
\begin{proposition}
Any invertible matrix is a product of elementary matrices.
\end{proposition}
\begin{proof}
Writing the operations in the preceding lemma as a product of elementary matrices representing the operations gives the inverse of that matrix.
But any invertible matrix is the inverse of its own inverse.
\end{proof} | {
"alphanum_fraction": 0.6855255007,
"avg_line_length": 55.6666666667,
"ext": "tex",
"hexsha": "95d897124399c08f0fe67d18f19e9813cfb590c9",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "5a499f7ed33ef0110facb27323e13f42883aa0c5",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "david-bai-notes/IB-Linear-Algebra",
"max_forks_repo_path": "7/ele.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "5a499f7ed33ef0110facb27323e13f42883aa0c5",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "david-bai-notes/IB-Linear-Algebra",
"max_issues_repo_path": "7/ele.tex",
"max_line_length": 243,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "5a499f7ed33ef0110facb27323e13f42883aa0c5",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "david-bai-notes/IB-Linear-Algebra",
"max_stars_repo_path": "7/ele.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1362,
"size": 4843
} |
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
%\usepackage{cite}
%\usepackage{wrapfig}
%\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\newcommand{\e}{\epsilon}
\newcommand{\dl}{\delta}
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\vect}[1]{\underline{#1}}
\newcommand{\uvect}[1]{\hat{#1}}
\newcommand{\1}{\vect{1}}
\newcommand{\grad}{\nabla}
%By changing \underline to \bold or \hat, the vector notation can be changed accordingly
\title{Lecture 10: Hydrostatics}
\author{}
\begin{document}
\maketitle
\section*{Overview}
The key objectives are to use the hydrostatic balance equation $\rho \vect F = \grad p$ to obtain the equilibrium shape of the free surface under a given body force $\vect F$ and describe the buoyant force on a submerged body.
\section{Potential}
We know that total body force on a small volume of fluid can be written as $\int\rho \vect F dV$ and the total surface force (in hydrostatic equilibrium) is $-\int p \vect n dA$. This surface integral can be transformed to volume integral using divergence theorem for a scalar field. It gives $-\int p \vect n dA = -\int \grad p dV$. Balancing the two terms gives
\begin{align*}
\int&(\rho \vect F - \grad p) dV =0\\
\Rightarrow& \rho \vect F = \grad p
\end{align*}
which is the governing equation for hydrostatics. Moreover, if the body forces are conservative, then the force $\vect F$ can be written as the gradient of a scalar potential as $\vect F= -\grad \Psi$. Therefore, the equation becomes:
\begin{align*}
\rho -\grad \Psi &= \grad p \\
\end{align*}
Taking curl of this equation gives
\begin{align*}
\grad \rho \wedge \grad \Psi &= 0
\end{align*}
which implies that, for hydrostatic balance, the constant pressure surfaces must be parallel to the constant potential surfaces. This is a necessary and sufficient condition for hydrostatic equilibrium. For further analysis, we need to know how $\rho$ varies with $\vect x$. But if the density is constant, the solution of $\rho \grad \Psi = \grad p$ is simply $p=p_0 - \rho \Psi$
As an example of equipotential surfaces, we can consider a vessel rotating with $\Omega$. The fluid in the vessel is rotating at the same rate and we observe the system in the rotating frame. Then force per unit mass $F$ is given by
\begin{align*}
F &= \vect g - \Omega^2 (x^2+y^2)^{1/2}\\
\Rightarrow \Psi &= gz - \frac{1}{2}\Omega^2(x^2+y^2)
\end{align*}
If the radius of the beaker is $R$, then we can scale the coordinates with $R$ and non-dimensionalize the above equations as
\begin{align*}
\Psi &= z - \frac{\Omega^2 R}{2g}(x^2+y^2)
\end{align*}
For a fixed value of $\Psi$ we get different paraboloids. All parallel to each other. These are the equipotential surfaces and hence also give us the shape of the free surface because the free surface has a constant pressure and hence a constant potential everywhere on it.
\section{Force on a submerged particle}
Let a particle of volume $V_p$ be submerged completely in a fluid of constant density $\rho_0$. If gravity is the only force, then $\vect F = \vect g$. Under these assumptions then, we have
\begin{align*}
F_B &= -\int_{V_p} p \vect n dA \\
&= -\int \grad p dV \\
&= -\int \rho \vect F dV \\
&= -\rho_0 \int -\vect g dV \\
&= \rho_0 \vect g V_p
\end{align*}
And so the force of buoyancy is equal to the weight of the liquid displaced. Note that we started this derivation with an integration of forces on the solid particle but in the third step we switched to an equivalent fluid blob, thus bringing in the density of fluid instead of the density of the object. The second step required us to integrate the pressure gradient over the volume of the particle. Therefore, we replaced the particle with ambient fluid and integrated the pressure gradient over the required volume.
\section{Continuous density stratification}
If density of the fluid varies over the length of the submerged body, then the density at the centroid of the body gives us required the buoyant force on the body. To show this, consider a fluid with density variation as
\begin{align*}
\rho(\vect x) = \rho(\vect x_0) + D\rho \uvect{g} \cdot (\vect x - \vect x_0)
\end{align*}
Here $D\rho$ ($> 0$) is the density gradient. It must be in the direction of pressure gradient (which is gravity here, denoted by the unit vector $\uvect g$), otherwise there will be a flow due to the baroclinic source of vorticity ($\grad p \wedge \grad \rho$ must be zero).
\begin{align*}
F_B &= -\int_{V_p}\rho \vect{F}dV \\
&= -\int_{V_p}\rho(\vect{x}) \vect{g} dV \\
&= -\vect{g}\int_{V_p}\rho(\vect x_0) + D\rho \uvect{g} \cdot (\vect x - \vect x_0) dV \\
&= -\vect{g}(V_p\rho(\vect x_0) + D\rho \uvect{g} (\int_{V_p}\vect x - \vect x_0V_p) \\
&= -\vect{g}(V_p\rho(\vect x_0) + D\rho \uvect{g}V_p (\big(\frac{1}{V_p}\int_{V_p}\vect x dV\big) - \vect x_0) \\
&= -\vect{g}(V_p\rho(\vect x_0) + D\rho \uvect{g}V_p (\vect x_c - \vect x_0) \\
&= -\vect{g}V_p(\rho(\vect x_0) + D\rho \uvect{g} (\vect x_c - \vect x_0) \\
&= -\vect{g}V_p \rho(\vect x_c) \\
\end{align*}
And so only the density at the centroid needs to be used while evaluating the buoyant force on a body submerged in a linearly stratified medium.
\section{Centrifugal buoyancy}
Under the action of centrifugal forces, the heavier fluids get pushed outwards and the lighter fluids get pulled towards the axis of rotation. This can be seen from the final expression for force due to centrifugal buoyancy
\begin{align*}
F_B = \Omega^2 V_p (\rho_p - \rho_0)r
\end{align*}
If density of the particle $\rho_p$ is greater than the medium density $\rho_0$, then it is centrifuged out, otherwise it gets pulled inwards. This can be used in experiments to visualize vortices.
\section{Dynamics of approach to equilibrium}
Let there be a fluid parcel of mass $m$ and density $\rho_1$ in a medium of density $\rho_2$ and a damping coefficient of $C$. Then force balance can be written as
\begin{align*}
& m\frac{d^2 \vect x_c}{t^2} = v_p \rho_1(\vect x_c)g - v_p \rho_2(\vect x_c)g - C\frac{d \vect x_c}{dt}
\end{align*}
If we consider only vertical motions, then after some rearrangement, this can be written as
\begin{align*}
V_p\rho_1\frac{d^2 z^*}{dt^2} + C\frac{d z^*}{dt} + g V_p D\rho_2 z^* &= 0
\end{align*}
where $z^*= z - z_c$ and $D\rho_2$ is the density gradient in the fluid medium. Comparing it with the standard equation for damped oscillations, $m\ddot{x} + c\dot{x} + \omega^2 x = 0$, we get the natural frequency of oscillations of fluid parcel as $\omega = (\frac{gD\rho_2}{\rho_1})^{1/2}$. The approach can be defined as underdamped or overdamped if the sign of $C^2-4(gV_pD\rho_2)(v_p\rho_1)$ is negative or positive respectively (this can be seen by assuming an exponential solution $e^{mz}$ and substituting in the differential equation - the condition for real roots translates to condition for overdamped oscillations).
If the system is overdamped with a large damping coefficient $C\to\infty$, then we neglect the second order term in the equation and just consider the equation
\begin{align*}
C\frac{d z^*}{dt} + g V_p D\rho_2 z^* &= 0
\end{align*}
which has an exponentially decaying solution $z^* \propto e^{-t/\tau}$ where $\tau = \frac{g v_p D\rho_2}{C}$. Therefore, we get the overdamped solution with the appropriate time-scale.
\section{Appendix}
\subsection{Derivation for centrifugal buoyancy}
\end{document}
| {
"alphanum_fraction": 0.7217425953,
"avg_line_length": 46.1901840491,
"ext": "tex",
"hexsha": "aac7122367b20cad07805a6ef2c14dbbb73d9587",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_forks_repo_path": "tex_files/lecture10.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_issues_repo_path": "tex_files/lecture10.tex",
"max_line_length": 628,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "f4ffd25fa16fa08c2c2a5d465bb8a19a1d02d850",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "pulkitkd/Fluid_Dynamics_notes",
"max_stars_repo_path": "tex_files/lecture10.tex",
"max_stars_repo_stars_event_max_datetime": "2021-02-16T04:19:07.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-02-16T04:19:07.000Z",
"num_tokens": 2265,
"size": 7529
} |
\chapter{Testy}
\label{chapter-5}
| {
"alphanum_fraction": 0.6944444444,
"avg_line_length": 12,
"ext": "tex",
"hexsha": "ed3eb0a9bfe6fb944cc54cbc5b1daa6c7cc1d430",
"lang": "TeX",
"max_forks_count": 2,
"max_forks_repo_forks_event_max_datetime": "2021-12-28T13:34:39.000Z",
"max_forks_repo_forks_event_min_datetime": "2021-05-30T10:02:17.000Z",
"max_forks_repo_head_hexsha": "b80937d8746858c493bf58e1c0e4f50bfdab4257",
"max_forks_repo_licenses": [
"Unlicense"
],
"max_forks_repo_name": "piotrjurkiewicz/agh_latex_template",
"max_forks_repo_path": "chapter5.tex",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "b80937d8746858c493bf58e1c0e4f50bfdab4257",
"max_issues_repo_issues_event_max_datetime": "2018-09-03T13:04:59.000Z",
"max_issues_repo_issues_event_min_datetime": "2018-09-03T13:04:59.000Z",
"max_issues_repo_licenses": [
"Unlicense"
],
"max_issues_repo_name": "piotrjurkiewicz/agh_latex_template",
"max_issues_repo_path": "chapter5.tex",
"max_line_length": 18,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "b80937d8746858c493bf58e1c0e4f50bfdab4257",
"max_stars_repo_licenses": [
"Unlicense"
],
"max_stars_repo_name": "piotrjurkiewicz/agh_latex_template",
"max_stars_repo_path": "chapter5.tex",
"max_stars_repo_stars_event_max_datetime": "2019-11-26T17:52:16.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-11-26T17:52:16.000Z",
"num_tokens": 13,
"size": 36
} |
\chapter{Examples}
\label{chap:Examples}
\section{Bar Chart}
\section{Grouped Bar Chart}
\section{Stacked Bar Chart}
\section{Scatterplot}
\TODO{Write about application example (newspaper article?)} | {
"alphanum_fraction": 0.7733990148,
"avg_line_length": 16.9166666667,
"ext": "tex",
"hexsha": "f09860b1ce0b8c1724c8b98b9ac0a5befc0fabac",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "e13095c84f68f87f23ffe97ada1349f893eb2538",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "AlmostBearded/respvis-thesis",
"max_forks_repo_path": "thesis-examples.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e13095c84f68f87f23ffe97ada1349f893eb2538",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "AlmostBearded/respvis-thesis",
"max_issues_repo_path": "thesis-examples.tex",
"max_line_length": 59,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "e13095c84f68f87f23ffe97ada1349f893eb2538",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "AlmostBearded/respvis-thesis",
"max_stars_repo_path": "thesis-examples.tex",
"max_stars_repo_stars_event_max_datetime": "2021-02-07T18:00:19.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-02-06T11:51:06.000Z",
"num_tokens": 55,
"size": 203
} |
\documentclass[a4paper,12pt]{article}
% Font
\usepackage[T1]{fontenc}
\usepackage{gentium}
% Math packages
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{bm}
% Define symbol shortcuts
\newcommand{\cc}{\mathcal{C}}
\newcommand{\dd}{\mathcal{D}}
\newcommand{\hh}{\mathcal{H}}
\newcommand{\xx}{{\bm x}}
\newcommand{\yy}{{\bm y}}
% Math environment
\newtheorem*{thm}{Theorem}
% Better list management:
% - vertical spacing in lists
% - items in lists start with dash not bullet point.
\usepackage{enumitem}
\setlist{label=\textemdash,
itemsep=0pt, topsep=3pt, partopsep=0pt}
% Include graphics
\usepackage{graphicx}
\usepackage{subcaption}
% Page format
\usepackage[top=2cm,left=2cm,right=2cm,bottom=2cm]{geometry}
\begin{document}
%%% HEADER
\raisebox{0.6in}[0in]{\makebox[\textwidth][r]{\it Unproofed version }}
\vspace{-0.7in}
\begin{center}
\bf\large MA2823: Foundations of Machine Learning \\
Chapter 8: Tree-based Methods
\end{center}
\noindent
Lecturer: Chlo\'e-Agathe Azencott
\hfill
Scribe: LIN Laurent \\
\null \hfill PHAM Olivier \\
\null \hfill SCHNITZLER Pierre-Louis
\noindent
\rule{\textwidth}{1pt}
\medskip
In this chapter we will :
\begin{itemize}
\item see how to build decision trees (and more precisely how to grow a tree and when to stop growing a tree);
\item explain why they are examples of non-metric learning and hierarchical learning;
\item combine decision trees (or other weak learners) to make more powerful classifiers.
\end{itemize}
\section{Decision trees}
\subsection{Hierarchical learning}
As single classifiers assign a class to an object x using a single operation and use a single set of features for all classes, they can face difficulties in case of non-metric learning, so when classes have multi-modal distributions or when features are nominal. We are talking about nominal data when the attributes are discrete without any natural notion of similarity/ordering (such as \{color, shape, texture, size\} for a fruit classification). In order to avoid those problems, decision trees are based on hierarchical classifiers, which make multiple successive tests. \\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/Structure.jpg}
\caption{Example of a decision tree}
\label{fig:ensemble learning}
\end{figure}
\subsection{Multiclass classification}
There are strategies for reducing a problem of multiclass classification to multiple binary classification problems. It can be categorized into One-versus-one (Build K (K-1) / 2 classifiers and make them vote) and One-versus-all (Build K classifiers and make them vote). To solve those problems, we have to use an algorithm that naturally handles multiple classes. It is the case of tree algorithms and Neural networks (that we will study in Chap. 10).\\
\subsection{Vocabulary Reminder}
Here is a short reminder of tree vocabulary:\\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/s1.jpg}
\caption{Tree vocabulary}
\label{fig:ensemble learning}
\end{figure}
\subsection{Partition of the feature space}
Classification and regression trees (CART) is the generic name for a recursive procedure to split a training set and organize it into a tree. The models are obtained by recursively partitioning
the training set into smaller and smaller subsets and fitting a simple prediction model within each partition. As a result, the partitioning can be represented graphically as a decision tree. During the CART procedure we will have to do several choices:
\begin{itemize}
\item Binary or multi-way splits?
\item Which feature(s) to use at each node? i.e. how to split?
\item When to stop growing a tree?
\end{itemize}
\section{Binary-tree versus non binary-tree}
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. A tree with arbitrary branching factor can always be equivalently represented by a binary tree. \\
The following binary tree is equivalent to the non-binary tree of Figure 1.
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/s2.jpg}
\caption{Binary tree equivalent to Figure. 1}
\label{fig:ensemble learning}
\end{figure}
\newpage
\section{How to grow a tree}
\subsection{Introduction}
We are only considering monothetic trees, that is to say trees with only one feature per node. In this conditions, the decision boundary is orthogonal to the axes. The splitting variable (j) and the splitting point (s) define 2 regions: \\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/s3.jpg}
\label{fig:ensemble learning}
\end{figure}
For a regression tree, we choose j and s to minimize SE (standard error):\\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/s4.jpg}
\label{fig:ensemble learning}
\end{figure}
For a classification tree, we choose j and s to minimize impurity : \\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/s5.jpg}
\label{fig:ensemble learning}
\end{figure}
\subsection{Impurity}
Decision trees are grown by posing a series of questions about the feature of the items. In order to do so, we add question nodes incrementally, using labeled training examples to guide the choice of questions. Ideally, a single, simple question would perfectly split the training examples into their classes. If no question exists that gives such a perfect separation, we choose a question that separates the examples as cleanly as possible. \\
Several measures have been designed to evaluate the degree of inhomogeneity, or impurity, in a set of items. For decision trees, the most common measures are entropy, the Gini index and the classification error. Given a measure of impurity, we choose a question that minimizes the weighted average of the impurity of the resulting children nodes.
\subsection{Classification error}
The classification error corresponds to the minimum probability that a training point will be misclassied at node (s,j) and is defined by the following formula :
\[
\textrm{Imp}(R_m)= 1 - \textrm{max}_{ k}(\hat{p}_{mk})
\]
where \( \hat{p}_{mk} \) is the proportion of training instances from class k in \(R_m\). \\
The value of the classification error is always between 0 and 1. If all examples from one class belong to \(R_m\) then \( \textrm{Imp}(R_m)= 1 - \textrm{max}{(1)} = 0 \). If we have 2 balanced classes and instances are randomly split at (s, j), then \( \textrm{Imp}(R_m)= 1 - \textrm{max}{(
0.5, 0.5)} = 0.5 \)
\subsection{Entropy}
The concept of entropy comes from the information theory. Entropy is a measurement of information (or rather lack of information). We calculate the information gain by making a split. This measures how you reduce the uncertainty about the label. It is defined by the following formula:
\[
\textrm{Imp}(R_m)= - \sum_{k}\hat{p}_{mk} \log_{2}(\hat{p}_{mk})
\]
where \( \hat{p}_{mk} \) is the proportion of training instances from class k in \(R_m\). \\
If all examples from one class belong to \(R_m\) then \( \textrm{Imp}(R_m) = 0 \). If we have 2 balanced classes and instances are randomly split at (s, j), then \( \textrm{Imp}(R_m)= - (\frac{1}{2}\log_{2}(\frac{1}{2})+ \frac{1}{2}\log_{2}(\frac{1}{2}))= 1 \)
\subsection{Gini Impurity}
Used by the CART (classification and regression tree) algorithm, Gini impurity is a measure of how often a randomly chosen element from the set would be incorrectly labeled if it was randomly labeled according to the distribution of labels in the subset.
It is defined by the following formula:
\[
\textrm{Imp}(R_m)= \sum_{k=1}^{K}\hat{p}_{mk}(1-\hat{p}_{mk})
\]
where \( \hat{p}_{mk} \) is the proportion of training instances from class k in \(R_m\). \\
If all examples from one class belong to \(R_m\) then \( \textrm{Imp}(R_m) = 0 \). If we have 2 balanced classes and instances are randomly split at (s, j), then \( \textrm{Imp}(R_m)= \frac{1}{2}\frac{1}{2}+ \frac{1}{2}\frac{1}{2}= \frac{1}{2} \) . \\
If we have two regions \( R_l \) and \( R_r \) then the impurity is defined by:
\[
\textrm{GI}(j,s)= \frac{\left | R_l(j,s) \right |}{n_{tot}} \textrm{Imp}(R_l(j,s)) + \frac{\left | R_r(j,s) \right |}{n_{tot}} \textrm{Imp}(R_r(j,s))
\]
Assuming that the split respects the overall distribution \( \forall k ,p_{mk}=\frac{\left | C_k \right |}{N} \) , then all regions are identically distributed and have Gini impurity:
\[
\textrm{GI}(R)= \sum_{k=1}^{K} \frac{\left | C_k \right |}{N} (1-\frac{\left | C_k \right |}{N} ) = 1 - \sum_{k=1}^{K} (\frac{\left | C_k \right |}{N})^{2} \]
For a K-way split \(\textrm{GI}(j,s)= \sum_{l=1}^{K} \frac{1}{K} \textrm{GI}(R) = \textrm{GI}(R)\) and in particular if \(\left | C_k \right | = \frac{N}{K} \) then \(\textrm{GI}= 1 - \frac{1}{K} \). If the split is perfect then all regions have a proportion of 1 of one class and of 0 of
the other, and hence have Gini impurity \(\textrm{GI}(R)=0 \).
\subsection{When to stop growing a tree?}
If a tree is too large it might overfit while a small tree might underfit. Therefore we have to establish a strategy in order to decide when to stop growing a tree.
There are two main strategies:
\begin{itemize}
\item we can either grow the tree until a minimum node size (number of training points in the region) is reached
\item or we can prune the tree using cost-complexity pruning
\end{itemize}
\subsection*{Cost-complexity pruning}
In a similar way to what we did with regularisation we define the cost complexity with the following formula which includes a complexity penalty :
\[
C_\alpha (Tree)= \sum_{m=1}^{\# Tree} N_m Q_m(Tree) + \alpha (\# Tree)
\]
where:
\begin{itemize}
\item \#Tree is the number of regions in our pruned tree
\item \(N_m\) is the number of training instances in \(R_m\)
\item \(Q_m\) is the error on \(R_m\)
\item \(\alpha \) is a coefficient which defines the balance between model complexity and goodness of fit
\end{itemize}
The goal is to find a subtree which will minimise the cost-complexity.
The more leaf nodes that the tree contains the higher complexity of the tree because we have more flexibility in partitioning the space into smaller pieces, and therefore more possibilities for fitting the training data. There is also the issue of how much importance to put on the size of the tree. The complexity parameter \(\alpha \) adjusts that.
\section{Advantages and drawbacks of trees}
\begin{tabular}{|c|c|}
\hline
Advantages & Drawbacks \\
\hline
Easy to explain & Bad predictive accuracy in general \\
Mirror human-decision making & \\
Displayed graphically and easily interpreted & \\
Can easily handle quatitative variables & \\
Naturally handle multiclass problems & \\
\hline
\end{tabular}\\
In order to improve the predictive accuracy we will use forests.
\newpage
\section{Forest}
\paragraph{Ensemble learning.}The idea is that aggregating many weak learners can substantially increase their performance, because trees have weak predictive power in general. This method is called ensemble learning and uses the principle of wisdom of crowds, that by combining multiple individual classifiers, we can average out their uncorrelated errors. This is what we can observe with the example below, by combining many 'staircase' boundaries, we finally obtain a diagonal separation. \\
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/Staircase.png}
\caption{Principle of ensemble learning}
\label{fig:ensemble learning}
\end{figure}
\subsection{Building ensembles}
To build ensembles, we have to:
\begin{itemize}
\item \textbf{subsample the training data} : by either bagging the data, picking multiple times the same point, or boosting which is resampling based on performance.
\item Use \textbf{different features} (with multiple input representations, we will also learn how to select features in the chapter 11).
\item Use different \textbf{parameters} of the learning algorithm.\\
\end{itemize}
When we combine weak learners :
\begin{itemize}
\item if it is a non-trainable combination: it should be done by \textbf{voting} (classification) or \textbf{averaging} (regressing).
\item if it is a trainable combination: we use \textbf{weighted averaging} based on performance on a validation set or \textbf{meta-learner} with which the outputs of the individual learners are features for another learning algorithm.
\end{itemize}
\subsection{Bagging trees}
The principle is to bootstrap the training data (take repeated samples) and build one predictor from each of these samples. The final prediction is the \textbf{average} of the samples when considering a \textbf{regression} problem and a \textbf{majority vote} for a \textbf{classification} problem.
\subsection{Random forest}
The idea in random forests is to improve the variance reduction of bagging by reducing the correlation between the trees, without increasing the variance too much. This is achieved in the tree-growing process through random selection of the input variables: before each split, select q (out of p) input variables at random as candidates for splitting. We typically choose q = $\sqrt[]{p}$ .
This method has very good predictive power in practice!
\section{Summary}
Decision trees are easy to interpret.\\
Decisions trees elegantly deal with :
\begin{itemize}
\item Quantitative variables
\item Multiple classes
\item Multimodal distributions
\end{itemize}
Decision trees have limited predictive power, but this can be addressed thanks to ensemble methods:
\begin{itemize}
\item Bagging
\item Random forests
\end{itemize}
\end{document} | {
"alphanum_fraction": 0.750509165,
"avg_line_length": 46.1342281879,
"ext": "tex",
"hexsha": "bf071a686e70bdfa322ee39e0874712c3df7a5d2",
"lang": "TeX",
"max_forks_count": 62,
"max_forks_repo_forks_event_max_datetime": "2021-06-30T13:21:05.000Z",
"max_forks_repo_forks_event_min_datetime": "2016-09-07T06:25:40.000Z",
"max_forks_repo_head_hexsha": "9a963f800b4eb35ccee4f8fe347f11ea221cad58",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "chagaz/ma2823_2016",
"max_forks_repo_path": "lecture_notes/chap08_trees.tex",
"max_issues_count": 1,
"max_issues_repo_head_hexsha": "9a963f800b4eb35ccee4f8fe347f11ea221cad58",
"max_issues_repo_issues_event_max_datetime": "2016-10-03T10:43:16.000Z",
"max_issues_repo_issues_event_min_datetime": "2016-10-03T10:42:43.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "chagaz/ma2823_2016",
"max_issues_repo_path": "lecture_notes/chap08_trees.tex",
"max_line_length": 578,
"max_stars_count": 19,
"max_stars_repo_head_hexsha": "9a963f800b4eb35ccee4f8fe347f11ea221cad58",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "chagaz/ma2823_2016",
"max_stars_repo_path": "lecture_notes/chap08_trees.tex",
"max_stars_repo_stars_event_max_datetime": "2021-01-05T02:16:53.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-09-13T16:35:40.000Z",
"num_tokens": 3646,
"size": 13748
} |
% !TeX root = ../main.tex
% Add the above to each chapter to make compiling the PDF easier in some editors.
\chapter{Conclusions and Future Work}\label{chapter:conclusion}
The purpose of this thesis is to research the impact of using HPB instead of SMRA on efficiency and revenue in big spectrum auctions by running simulations based on the German Auction from 2015. A value model was developed to describe the valuations of the participating bidders, as well as a selector model that incorporated the characteristics of the German Auction like spectrum caps and super-additive item bundling. Also, the selector was extended to support package bidding behaviour of the agents and two different HPB hierarchies featuring a competitive and less competitive structure were developed.
Simulations were run on different parameter settings on the bonuses valuations for the super-additive item packages and bidder strengths for the two different HPB hierarchy structures, comparing the results to the SMRA format. The analysis indicates that when choosing an appropriate package structure, HPB might help finding more efficient overall allocations during the auction, but due to the signalling properties of the package bids it might reduce overall revenue. HPB showed to be more stable in relation to different super-additive valuations than SMRA, indicating that it might be a useful tool in auctions that have those characteristics. When using less competitive package structures, the established SMRA showed to be superior in creating higher revenues. The response of revenue to different competition environment seems to be very similar in HPB and SMRA.
Still, HPB is an auction format that is simple to implement and facilitates signalling desired item combinations. With a pre-defined package structure it reduces the need for computationally expensive combinatorial calculations and substitutes it for a simple "tax system" that hands down price increases on packages to the item level. This makes price calculations understandable in comparison to the often intricate price calculations in combinatorial auctions.
To further investigate the eligibility of using HPB in big spectrum auctions more research needs to be done. In particular, the impact of the pre-defined item packages and to what extent it might help with bidder collusion. The research showed that more competitive hierarchies might lead to more efficient auctions and less competitive hierarchies can negatively impact revenue. To evaluate if this is an inherent property of HPB, more experiments with a broad spectrum of different hierarchies need to be run to ascertain if this is only an artifact of the modelling done in this thesis. If this verifies, choosing the right HPB hierarchy has big implications on the auctions run.
Also, the simulations were run based on the value model developed in this thesis. Further work can be put into constructing a more complex model that also takes into account the six item bundle in the 1800 MHz as stated in \cite{Bichler2016} as well as incorporating the 1500 MHz frequency band, which was left out due to lack of importance, because as of writing of this thesis no
devices that can utilize this frequency band exist. Also, the prices yielded in the auction were very low in comparison to the other bands.
Additionally, subsequent research needs to be done to show the effect of HPB on the exposure of bidders. This work excluded exposure by technically allowing bidders to bid over multiples of an item's valuation, which would not be feasible in real auctions. Analysing the impact would have been out of the scope of this thesis and is strongly recommended as the focus for future research on this topic.
% BACKUP
%Findings HPB:
%- might help coordination between bidders (even though revenue might be lower than), but probably only with fitting HPB hierarchy
%
%Future work:
%- further develop value model - stated the 6 bundle package n 1800 MHz which was left out in this thesis as the sensitivy anslysi would bhave been out of the scope of this thesis
%- include exposure
%- research to what extent competitive and less competitive structures impact revenue (hält das weiterhin bestand) or is this just an artefact of the modelling from this thesis. If yes, choosing the right structure would have high implications on the outcome of an auction
%- find out if competitive hierachies really results in more efficient allocation all the time | {
"alphanum_fraction": 0.8182834153,
"avg_line_length": 165.7037037037,
"ext": "tex",
"hexsha": "d52d87ca1ebfe07b5f39ce837e2f242823ed0db4",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "4b34b0ab019ebf969b91dc2f8ee755a1cc8aba02",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "timbrgr/auction-simulation-SMRA-HPB-BA-thesis",
"max_forks_repo_path": "thesis/chapters/06_conclusion.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "4b34b0ab019ebf969b91dc2f8ee755a1cc8aba02",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "timbrgr/auction-simulation-SMRA-HPB-BA-thesis",
"max_issues_repo_path": "thesis/chapters/06_conclusion.tex",
"max_line_length": 872,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "4b34b0ab019ebf969b91dc2f8ee755a1cc8aba02",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "timbrgr/auction-simulation-SMRA-HPB-BA-thesis",
"max_stars_repo_path": "thesis/chapters/06_conclusion.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 869,
"size": 4474
} |
\section{The \texttt{Job} and \texttt{CurrentJob} Classes}
\label{sec:classes:job}
The \texttt{Job} class is used to represent and operate on existing
jobs. An object of this class is returned from job \texttt{build()}
calls as well as when retreiving jobs from Urd or a \texttt{JobList}
object. The \texttt{CurrentJob} class is an extension that provides
mechanisms for operations performed while a job is executing, such as
saving files to the job's jobdir. The classes are derived from
the \texttt{str} class, and objects of these classes decay to
(unicode) strings when pickled.
The following attributes are available on both the \texttt{Job}
and \texttt{CurrentJob} classes:
\starttabletwo
\texttt{method} & The job method. This can be overriden by \texttt{name=} if job instance is output from Urd or a \texttt{build()} call.\\
\texttt{path} & The filesystem directory where the job is stored.\\
\texttt{workdir} & The workdir name (the part before \texttt{-number} in the jobid).\\
\texttt{number} & The job number as an \texttt{int}.\\
\texttt{filename()} & Return absolute path to a file in a job.\\
\texttt{withfile()} & A \texttt{JobWithFile} with this job.\\
\texttt{params} & Return a dict corresponding to the file \texttt{setup.json} for this job.\\
\texttt{post} & Return a dict corresponding to \texttt{post.json} for this job.\\
\texttt{open()} & Similar to standard \texttt{open}, use to open files\\
\texttt{load()} & Load a pickle file from the job's directory.\\
\texttt{json\_load()} & Load a json file from the job's directory.\\
\texttt{dataset()} & Return a named dataset from the job.\\
\texttt{datasets} & List of datasets in this job.\\
\texttt{output()} & Return what the job printed to \texttt{stdout} and \texttt{stderr}.\\
\stoptabletwo
\noindent In addition, the \texttt{CurrentJob} class has these
attributes too:
\starttable
\texttt{datasetwriter()} && to get a DatasetWriter object. See documentation for \texttt{Dataset.DatasetWriter()}, section~\ref{sec:classes:datasetwriter}.\\
\texttt{open()}&& With extra temp argument.\\
\texttt{save()} && to store a pickle file\\
\texttt{json\_save()} && to store a json file\\
\stoptable
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{Job.filename()}}
%\begin{leftbar}
\starttable
\texttt{filename} & \textsl{Mandatory} & Name of file in job directory.\\
\texttt{sliceno} & \pyNone & Set to current slice number if sliced, otherwise \pyNone.\\
\stoptable
Return the absolute (full path) filename to a file stored in the job.
If the file is sliced, a particular slice file can be retrieved using
the \texttt{sliceno} parameter. Sliced files are described in section~\ref{sec:sliced_files}.
%\end{leftbar}
\subsection{\texttt{Job.open()}}
%\begin{leftbar}
\starttable
\texttt{filename} & \textsl{Mandatory} & Name of file.\\
\texttt{mode} & \texttt{r} & Open file in this mode, see Python's \texttt{open()}\\
\texttt{sliceno} & \pyNone & Read or write sliced files.\\
\texttt{encoding} & \pyNone & Same as Python's \texttt{open()}\\
\texttt{errors} & \pyNone & Same as Python's \texttt{open()}\\
\texttt{temp} & \pyNone & Control file persistence. See text.\\
\stoptable
This is a wrapper around the standard \texttt{open} function with some
extra features. Note that
\begin{itemize}
\item[--] \texttt{Job.open()} can only read files, not write
them, and therefore ``\texttt{r}'' flag must be set.
\item[--] \texttt{CurrentJob.open()} can both read and write.
\item[--] \texttt{CurrentJob.open()} must be used as a context manager,
like this
\begin{python}
with job.open(...) as fh:
....
\end{python}
\item[--] \texttt{CurrentJob.open()} can use the \texttt{temp} flag to
modify the persistence of written files.
\end{itemize}
The \texttt{temp} argument is used to control the persistence of files
written using \texttt{.open()}. This is useful mainly for debug
purposes, and explained in section~\ref{sec:debugflag}. Sliced files
are described in section~\ref{sec:slicedfiles}.
%\end{leftbar}
\subsection{\texttt{Job.withfile()}}
%\begin{leftbar}
\starttable
\texttt{filename} & \textsl{Mandatory} & Name of file.\\
\texttt{sliced} & \pyFalse & Boolean indicating if the file is sliced or not.\\
\texttt{extra} & \pyNone & Any additional information to the job to be built.\\
\stoptable
The \texttt{.withfile()} is used to highlight a specific file in a job
and feed it to another job \texttt{build()}. The file could be
sliced.
%\end{leftbar}
\subsection{\texttt{Job.load()}}
%\begin{leftbar}
\starttable
\texttt{filename} & \texttt{result.pickle} & \hspace{2ex}Name of file.\\
\texttt{sliceno} & \pyNone & \\
\texttt{encoding} & \texttt{bytes} & \\
\stoptable
Load a file from a job in Python's pickle format.
%\end{leftbar}
\subsection{\texttt{Job.json\_load()}}
%\begin{leftbar}
\starttable
\texttt{filename} & \texttt{result.json} & Name of file.\\
\texttt{sliceno} & \pyNone & \\
%\texttt{unicode\_as\_utf8bytes} & \texttt{PY2} & \\
\stoptable
Load a file from a job, in JSON format.
%The \texttt{unicode\_as\_utf8bytes} flag is active in Python2 in order
%to let strings decode as bytes. Override this for unicode. In
%Python3, strings decode as unicode.
%\end{leftbar}
\subsection{\texttt{Job.dataset()}}
%\begin{leftbar}
\starttable
\texttt{name} & \texttt{default} & \\
\stoptable
Get a dataset instance from a job.
%\end{leftbar}
\subsection{\texttt{Job.output()}}
%\begin{leftbar}
\starttable
\texttt{what} & \pyNone & \\
\stoptable
Get everything a job has printed to \texttt{stdout}
and \texttt{stderr} in a string variable.
%\end{leftbar}
\subsection{\texttt{Job.save()}}
%\begin{leftbar}
\starttable
\texttt{obj} & \textsl{Mandatory} & \\
\texttt{filename} & \texttt{result.pickle} & \\
\texttt{sliceno} & \pyNone & \\
\texttt{temp} & \pyNone & \\
\stoptable
For \texttt{CurrentJob} instances only. Save data into the current
job's directory in Python's pickle format.
The \texttt{temp} argument is used to control the persistence of files
written using \texttt{.save()}. This is useful mainly for debug
purposes, and explained in section~\ref{sec:debugflag}.
%\end{leftbar}
\subsection{\texttt{Job.json\_save()}}
%\begin{leftbar}
\starttable
\texttt{obj} & \textsl{Mandatory} & \\
\texttt{filename} & \texttt{result.json} & \\
\texttt{sliceno} & \pyNone & \\
\texttt{sort\_keys} & \pyTrue & \\
\texttt{temp} & \pyNone & \\
\stoptable
For \texttt{CurrentJob} instances only. Save data into the current
job's directory in JSON format.
The \texttt{temp} argument is used to control the persistence of files
written using \texttt{.json\_save()}. This is useful mainly for debug
purposes, and explained in section~\ref{sec:debugflag}.
%\end{leftbar}
\subsection{Sliced Files}
\label{sec:slicedfiles}
%\begin{leftbar}
A \textsl{sliced} file is actually a set of files used to store data
independently in each \analysis process using a common name. The
functions that operate on files, such as for example \texttt{.open()}
and \texttt{.load()}, can switch to sliced files using
the \texttt{sliceno} parameter. From a user's perspective, they
always appear to work on single files. For example
\begin{python}
def analysis(sliceno, job):
data = ...
job.date(data, "mydata", sliceno=sliceno, temp=False)
\end{python}
will create a set of files \texttt{mydata.\%d}, where \texttt{\%d} is
replaced by the slice number. In this way, data can be passed ``in
parallel'' between different jobs.
%\end{leftbar}
\subsection{File Persistence}
\label{sec:debugflag}
The \texttt{temp} argument controls persistence of files stored
using \texttt{.open()}, \texttt{.save()}, or \texttt{.json\_save()}.
By default it is being set to \pyFalse, which implies that the stored
file is \textsl{not} temporary. But setting it to \pyTrue, like in
the following
\begin{python}
job.save(data, filename, temp=True)
\end{python}
will cause the stored file to be deleted upon job completion. The
functionality can be combined with the \textsl{debug} mode, see below.
\begin{snugshade}
\begin{center}
\begin{tabular*}{\textwidth}{l@{\extracolsep{\fill}}ll}
\texttt{temp} & ``normal'' mode & debug mode \\\hline
\pyFalse & stored & stored\\
\pyTrue & stored and removed & stored\\
\end{tabular*}
\end{center}
\end{snugshade}
\noindent Debug mode is active if the Accelerator \texttt{daemon} is
started with the \texttt{---debug} flag.
\clearpage
\section{The \texttt{JobWithFile} Class}
The \texttt{JobWithFile} class is used to create a job input parameter
from a file stored in a job.
\starttabletwo
\texttt{resolve()} & Return filename. \\
\texttt{load()} & load file contents. \\
\texttt{json\_load()} & load JSON file contents.\\
\stoptabletwo
All three functions take the argument \texttt{sliceno}, which default
is set to \pyNone, indicating that it is actually a single file on
disk. If \texttt{sliceno} is set, it is assumed that the file is
sliced, see section~\ref{sec:slicedfiles}, and the function will look
up that slice of the file only.
\clearpage
\section{The \texttt{JobList} Class}
\label{sec:classes:joblist}
Objects of the \texttt{JobList} class are returned by member functions
to the \texttt{Urd} class. They are used to group sessions of jobs
together.
\starttabletwo
\texttt{find()} & Return a new \texttt{JobList} with only jobs with that method or name in it.\\
\texttt{get()} & Return the latest \texttt{Job} with that method or name.\\
\texttt{[<method>]} & Same as \texttt{.get} but error if no job with that method or name is in the list.\\
\texttt{as\_tuples} & The \texttt{JobList} represented as \texttt{(method, jid)} \texttt{tuple}s.\\
\texttt{pretty} & Return a prettified string version of the \texttt{JobList}.\\
\texttt{exectime} & Execution times in total as well as per method.\\
\texttt{print\_exectimes()} & Print execution time information to \texttt{stdout}.\\
\stoptabletwo
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{JobList.find()}}
%\begin{leftbar}
\starttable
\texttt{method} & \textsl{Mandatory} & Method or name to find.\\
\stoptable
Return a new \texttt{Joblist} will all jobs in the
current \texttt{JobList} matching the \texttt{method} argument. The
matching part is either the unique name of the method's source code,
or the name optionally given at build time using the \texttt{name=}
argument.
%\end{leftbar}
\subsection{\texttt{JobList.get()}}
%\begin{leftbar}
\starttable
\texttt{method} & \textsl{Mandatory} & Method or name to find.\\
\texttt{default} & \pyNone & Return the latest matching job.\\
\stoptable
Return the latest job that matches the \texttt{method} argument. The
matching part is either the unique name of the method's source code,
or the name optionally given at build time using the \texttt{name=}
argument. If no matches are found, it will return
the \texttt{default} argument.
%\end{leftbar}
\subsection{\texttt{JobList.print\_exectimes()}}
%\begin{leftbar}
\starttable
\texttt{verbose} & \pyTrue & In addition to total time, print execution time for each method in list.\\
\stoptable
Print total execution time for the \texttt{Joblist}, and,
conditionally, execution time for each job in the list,
to \texttt{stdout}.
%\end{leftbar}
\clearpage
\section{The \texttt{Dataset} Class}
The \texttt{Dataset} class is used to operate on small or large
datasets stored on disk. It decays to a (unicode) string when
pickled.
\starttabletwo
\texttt{columns} & A \texttt{dict} from column to properties, such as type, min, and max values.\\
\texttt{previous} & The dataset's previous dataset, if it exists, \pyNone otherwise.\\
\texttt{parent} & The dataset's parent dataset, if it exists, \pyNone otherwise.\\
\texttt{filename} & The dataset's filename, if it exists. (\texttt{csvimport} sets this.)\\
\texttt{hashlabel} & Column used for hash partitioning, or \pyNone.\\
\texttt{caption} & The dataset's caption.\\
\texttt{lines} & A \texttt{list} with number of lines per slice.\\
\texttt{shape} & A tuple containing number of columns and number of lines in dataset.\\
\texttt{link\_to\_here()} & Used to associate a subjob's dataset with the current job, see section~\ref{sec:subjobs}.\\
\texttt{merge()} & Merge this dataset with another dataset, see section~\ref{sec:classes:dataset_merge}.\\
\texttt{chain()} & A \texttt{DatasetChain} object, see section~\ref{sec:classes:datasetchain}\\
\texttt{iterate\_chain()} & Iterator over chains, see chapter~\ref{chap:iterators}.\\
\texttt{iterate()} & Iterator over dataset see chapter~\ref{chap:iterators}.\\
\texttt{iterate\_list()} & Iterator over a list of datasets, see chapter~\ref{chap:iterators}.\\
\stoptabletwo
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{Dataset.link\_to\_here()}}
%\begin{leftbar}
\starttable
\texttt{name} & \texttt{default} & The new name of the dataset.\\
\texttt{column\_filter} & \pyNone & Iterable of columns to include, or \pyNone to get all.\\
\texttt{override\_previous} & \texttt{\_no\_override} & Set this to the new previous.\\
\stoptable
Use this to expose a subjob as a dataset in your job, like in this
example:
\begin{python}
def synthesis():
job = build('ex')
job.dataset().link_to_here(name='new')
\end{python}
The current job will now appear to have a dataset named \texttt{new},
that is actually a link to the subjob's \texttt{default} dataset. It
is possible to filter which columns should be visible in the link
using \texttt{column\_filter}. For chaining purposes, it is possible
for the link to expose a parent dataset of choice, set using
the \texttt{override\_previous} parameter.
%\end{leftbar}
\subsection{\texttt{Dataset.merge()}}
\label{sec:classes:dataset_merge}
%\begin{leftbar}
\starttable
\texttt{other} & \textsl{Mandatory} & Merge with this dataset.\\
\texttt{name} & ``\texttt{default}''& Name of new dataset\\
\texttt{previous} & \pyNone& The new dataset's \texttt{previous} dataset.\\
\texttt{allow\_unrelated} & \pyFalse& Set this if the datasets do not share a common ancestor.\\
\stoptable
Merge this and other dataset. Columns from the other dataset take
priority. If datasets do not have a common ancestor you get an error
unless \texttt{allow\_unrelated} is set. The new dataset always has
the previous specified here (even if \pyNone). Returns the new
dataset.
%\end{leftbar}
\subsection{\texttt{Dataset.chain()}}
%\begin{leftbar}
\starttable
\texttt{length} & \texttt{-1} & Number of datasets in chain. The default value of \texttt{-1} will include all datasets in chain.\\
\texttt{reverse} & \pyFalse & Reverse order of chain.\\
\texttt{stop\_ds} & \pyNone & If set, chain will start at the dataset after \texttt{stop\_ds}.\\
\stoptable
This function will return a \texttt{DatasetChain} object, see
section~\ref{sec:classes:datasetchain}.
%\end{leftbar}
\clearpage
\section{The \texttt{DatasetChain} Class}
\label{sec:classes:datasetchain}
These are lists of datasets returned from Dataset.chain.
They exist to provide some convenience methods on chains.
\starttabletwo
\texttt{min()} & Min value for a specified column over the whole chain.\\
\texttt{max()} & Max value for a specified column over the whole chain.\\
\texttt{lines()} & Number of rows in this chain, optionally for a specific slice. \\
\texttt{column\_counts()} & The number of datasets each column appears in.\\
\texttt{column\_count()} & Number of datasets in this chain that contain a specified column.\\
\texttt{with\_column()} & Return a new chain without any datasets that don't contain a specified column.\\
\mintinline{python}|iterate(...)| & Same arguments as \texttt{Dataset.iterate()}. Will iterate over the whole chain.\\
\stoptabletwo
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{DatasetChain.min()}, \texttt{DatasetChain.max()}}
%\begin{leftbar}
\starttable
\texttt{column} & \textsl{Mandatory} & Min/max value of column, see text.\\
\stoptable
Minimum or maximum value for column over the whole chain. Will be
\pyNone if no dataset in the chain contains \texttt{column}, if all datasets are
empty or if \texttt{column} has a type without min/max tracking.
%\end{leftbar}
\subsection{\texttt{DatasetChain.lines()}}
%\begin{leftbar}
\starttable
\texttt{sliceno} & \pyNone & If set, return number of lines in speficied slice.\\
\stoptable
Number of rows in this chain, optionally for a specific slice.
%\end{leftbar}
\subsection{\texttt{DatasetChain.column\_counts()}}
%\begin{leftbar}
Return a Python \texttt{Counter},\mintinline{python}|{colname:
occurances}|, holding the number of datasets each column appears in.
Takes no options.
%\end{leftbar}
\subsection{\texttt{DatasetChain.column\_count()}}
%\begin{leftbar}
\starttable
\texttt{column} & \textsl{Mandatory} & A column name.\\
\stoptable
Number of datasets in this chain that contain a specified column.
%\end{leftbar}
\subsection{\texttt{DatasetChain.with\_column()}}
%\begin{leftbar}
\starttable
\texttt{column} & \textsl{Mandatory} & A column name.\\
\stoptable
Return a new \texttt{DatasetChain} with all datasets in this chain
containing a speficied column.
%\end{leftbar}
\clearpage
\section{The \texttt{DatasetWriter} Class}
\label{sec:classes:datasetwriter}
The \texttt{DatasetWriter} class is used to create datasets. Datasets
could be stand-alone, part of a chain, or an extension (new columns)
to an existing dataset.
The class has a number of member functions, described below, that may
be used for dataset creation. Alternatively, the new dataset could be
set up using the \texttt{DatasetWriter} \textsl{constructor}. The
constructor approach is currently only documented in the source code,
see \texttt{dataset.py}.
\starttabletwo
\texttt{add()} & Add a new column to the dataset under creation.\\
\texttt{hashcheck()} & Check if value belongs in current slice.\\
\texttt{set\_slice()} & Set which slice that will receive the next write.\\
\texttt{enable\_hash\_discard()} & Make the write functions silently discard data that does not hash to the current slice. \\
\texttt{get\_split\_write()} & Get a writer object, see section~\ref{sec:create_in_synthesis}.\\
\texttt{get\_split\_write\_list()} & Get a writer object, see section~\ref{sec:create_in_synthesis}.\\
\texttt{get\_split\_write\_dict()} & Get a writer object, see section~\ref{sec:create_in_synthesis}.\\
\texttt{discard()} & Discard the dataset under creation.\\
\texttt{finish()} & Call this if dataset is to be used before creating job finishes, e.g.\ if the dataset under creation is input to a subjob.\\
\stoptabletwo
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{DatasetWriter.add()}}
\label{sec:datasetwriter_add}
%\begin{leftbar}
\starttable
\texttt{colname} & \textsl{Mandatory} & Name of new column.\\
\texttt{coltype} & \textsl{Mandatory} & Type of new column.\\
\texttt{none\_support} & \pyFalse & Set to \pyTrue to allow storing {\pyNone}s.\\
\stoptable
Add a new column to a dataset in creation. This example will create
an \texttt{age} column of type \texttt{number}, where the values could
also be \pyNone.
\begin{python}
dw.add('age', 'number', none_support=True)
\end{python}
All dataset types are described in chapter~\ref{chap:datasets}.
%\end{leftbar}
\subsection{\texttt{DatasetWriter.hashcheck()}}
%\begin{leftbar}
\starttable
\texttt{value} & \textsl{Mandatory} & Some data/\\
\stoptable
Check if a value belongs to the current slice.
Return \pyTrue if \texttt{value} belongs to the current
slice, \pyFalse otherwise.
%\end{leftbar}
\subsection{\texttt{DatasetWriter.set\_slice()}}
%\begin{leftbar}
\starttable
\texttt{sliceno} & \textsl{Mandatory} & Slice number to use for writing.\\
\stoptable
Specify which slice that will receive the next write(s). Use this if
writing data in \prepare or \synthesis.
%\end{leftbar}
\subsection{\texttt{DatasetWriter.enable\_hash\_discard()}}
%\begin{leftbar}
Takes no options. Set this in each slice or after
each \texttt{set\_slice()} to make the writer discard values that do
not belong to the current slice.
%\end{leftbar}
\clearpage
\section{The \texttt{Urd} Class}
\label{sec:classes:urd}
\starttabletwo
\texttt{get()} & Get an Urd item from a specified list and timetamp.\\
\texttt{latest()} & Get the latest Urd item for a specified list.\\
\texttt{first()} & Get the first Urd item for a specified list.\\
\texttt{peek()} & Get an Urd item from a specified list and timetamp without recording.\\
\texttt{peek\_latest()} & Get the latest Urd item for a specified list without recording.\\
\texttt{peek\_first()} & Get the first Urd item for a specified list without recording.\\
\texttt{since()} & Get all timestamps later than a specified timestamp for a specified list.\\
\texttt{list()} & List all Urd lists\\
\texttt{begin()} & Start a new Urd session.\\
\texttt{abort()} & Abort a running Urd session.\\
\texttt{finish()} & Finish a running Urd session and store its contents.\\
\texttt{truncate()} & Discard all Urd items later than a specified timestamp for a specified list.\\
\texttt{set\_workdir()} & Set the target workdir.\\
\texttt{build()} & Build a job.\\
\texttt{build\_chained()} & Build a job with chaining.\\
\texttt{warn()} & Add a warning message to be displayed at the end of the build.\\
\stoptabletwo
\noindent Detailed description of the functions, where neccessary, follows.
\subsection{\texttt{Urd.get()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\stoptable
Get an Urd item with specified list and timestamp. The operation is
recorded in the current Urd session.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.latest()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\stoptable
Get the latest job in a specified Urd list. The operation is recorded
in the current Urd session.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.first()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\stoptable
Get the first job in a specified Urd list. The operation is recorded
in the current Urd session.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.peek()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\stoptable
Same as \texttt{.get()}, but without recording the dependency.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.peek\_latest()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\stoptable
Same as \texttt{.latest()}, but without recording the dependency.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.peek\_first()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\stoptable
Same as \texttt{.first()}, but without recording the dependency.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.since()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\stoptable
Return a list of all timestamps more recent than the
input \texttt{timestamp} for a specified Urd list.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.list()}}
Return a list of all available Urd lists.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.begin()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\texttt{caption} & \pyNone & \\
\texttt{update} & \pyFalse & \\
\stoptable
Start a new Urd session.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.abort()}}
Abort the current Urd session, discard its contents.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.finish()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\texttt{caption} & \pyNone & \\
\stoptable
Finish the current Urd session and store it in the Urd database.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.truncate()}}
\starttable
\texttt{path} & \textsl{Mandatory} & \\
\texttt{timestamp} & \textsl{Mandatory} & \\
\stoptable
Discard everything later than \texttt{timestamp} for the specified Urd
list.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.set\_workdir()}}
\starttable
\texttt{workdir} & \textsl{Mandatory} & \\
\stoptable
Set target workdir. It can be set to any workdir present in the
Accelerator's configuration file.
%\begin{leftbar}
%\end{leftbar}
\subsection{\texttt{Urd.build()}}
%\begin{leftbar}
\starttable
\texttt{method} & \textsl{Mandatory} & Method to build.\\
\texttt{options} & \texttt{\{\}} & Input options.\\
\texttt{datasets} & \texttt{\{\}} & Input datasets.\\
\texttt{jobs} & \texttt{\{\}} & Input jobs.\\
\texttt{name} & \pyNone & Record job using this name instead of method name.\\
\texttt{caption} & \pyNone & Optional caption\\
%\texttt{why\_build} & \pyFalse & \\
\texttt{workdir} & \pyNone & Store job in this workdir.\\
\stoptable
Build a job. If an Urd session is running, the job and its
dependencies will be recorded.
%\end{leftbar}
\subsection{\texttt{Urd.build\_chained()}}
Build a chained job. Same options as \texttt{.build()}. See
chapter~\ref{chap:datasets} for more information.
\subsection{\texttt{Urd.warn()}}
Print a string to \texttt{stdout} when the build script ends with no
errors.
\starttable
\texttt{line} & \textsl{Mandatory} & Some string\\
\stoptable
| {
"alphanum_fraction": 0.7348201269,
"avg_line_length": 36.6219336219,
"ext": "tex",
"hexsha": "5128a8cdac8b723afc4c25440f290fdaf6a237e7",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "22efb7eef7fe1449ff24ee967e38af7daf37c7a3",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "sebras/berkeman-accelerator_doc_users_reference",
"max_forks_repo_path": "classes.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "22efb7eef7fe1449ff24ee967e38af7daf37c7a3",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "sebras/berkeman-accelerator_doc_users_reference",
"max_issues_repo_path": "classes.tex",
"max_line_length": 158,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "22efb7eef7fe1449ff24ee967e38af7daf37c7a3",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "sebras/berkeman-accelerator_doc_users_reference",
"max_stars_repo_path": "classes.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 7510,
"size": 25379
} |
\section{Benefits of our method}
\label{sec-benefits}
| {
"alphanum_fraction": 0.7777777778,
"avg_line_length": 18,
"ext": "tex",
"hexsha": "0a913c10b84e7f1ed8a3c84cae05708312d1ccf7",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2015-05-20T16:05:36.000Z",
"max_forks_repo_forks_event_min_datetime": "2015-05-20T16:05:36.000Z",
"max_forks_repo_head_hexsha": "28fced8b1bb394ca8676638bb2cda375fb449831",
"max_forks_repo_licenses": [
"BSD-2-Clause"
],
"max_forks_repo_name": "cracauer/SICL",
"max_forks_repo_path": "Papers/Bootstrapping/sec-benefits.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "28fced8b1bb394ca8676638bb2cda375fb449831",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-2-Clause"
],
"max_issues_repo_name": "cracauer/SICL",
"max_issues_repo_path": "Papers/Bootstrapping/sec-benefits.tex",
"max_line_length": 32,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "28fced8b1bb394ca8676638bb2cda375fb449831",
"max_stars_repo_licenses": [
"BSD-2-Clause"
],
"max_stars_repo_name": "cracauer/SICL",
"max_stars_repo_path": "Papers/Bootstrapping/sec-benefits.tex",
"max_stars_repo_stars_event_max_datetime": "2019-05-11T18:29:52.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-05-11T18:29:52.000Z",
"num_tokens": 16,
"size": 54
} |
\chapter{Introduction}
\onehalfspacing
{\small
I am proud to finally and officially introduce \emph{Skedge}, a website I have been developing since December 2013. Skedge began as a weekend project after far too much time was spent trying to find interesting elective classes, and it wasn't until I briefly presented it at a RocHack ``Hacker Night'' when I realized the potential it had to help others as well.
I never expected the subject of my senior thesis to be something so close to my heart, so I am grateful for such a fun and motivating opportunity to continue work on Skedge, and, selfishly, for an outlet of recognition.
}
\doublespacing
\section{CDCS}
\begin{figure}
\centering
\begin{subfigure}[h]{14cm}
\centering
\fbox{
\includegraphics[width=1.00\textwidth]{images/cdcs/index}
}
\caption{CDCS, with the search query {\tt csc}}
\label{fig:cdcs-index}
\end{subfigure}\\
\vspace{10pt}\\
\begin{subfigure}[h]{14cm}
\centering
\fbox{
\includegraphics[width=1.00\textwidth]{images/cdcs/better}
}
\caption{Better CDCS, a separate browser extension that embeds buttons into the CDCS course results interface, allowing users to add courses to a locally-stored schedule}
\label{fig:cdcs-better}
\end{subfigure}
\caption{CDCS and Better CDCS in their current states}
\end{figure}
``Course Description / Course Schedule,'' (or \emph{CDCS} for short) is the University's official tool for browsing the course catalog \cite{cdcs}. The CDCS interface consists of fields on the left side for inputting a search, and search results on the right side (see Figure \ref{fig:cdcs-index}). Despite ``Course Schedule'' being in its name, CDCS does not offer scheduling functionality. Course times can only be viewed, and it is up to the user to keep track of courses considered for the next semester.
\subsection{``Better CDCS''}
\emph{Better CDCS} \cite{better-cdcs} is a browser extension, available for Firefox, Safari, and Chrome, that offers a solution to the lack of scheduling mentioned above. It works by injecting ``Add Section'' and ``Bookmark Section'' buttons into the existing CDCS interface, and providing a tab on top of the screen that will toggle between the user's schedule and the search results (see Figure \ref{fig:cdcs-better}).
%%%
\section{Skedge}
\begin{figure}[H]
\centering
\fbox{
\includegraphics[width=1.00\textwidth]{images/skedge/index}
}
\caption[Skedge with the search query {\tt csc}]{Skedge with the search query {\tt csc} and the user's current schedule on the right}
\label{fig:sk-index}
\end{figure}
\emph{Skedge} \cite{skedge} is, in short, CDCS combined with Better CDCS on a single platform (see Figure \ref{fig:sk-index}). Like CDCS, it is lightweight, service-oriented, and doesn't require login, but unlike Better CDCS, it also doesn't require a separate browser extension.
It matches feature-for-feature with the two tools (search options, information displayed, scheduling and bookmarks, etc.), and aims to improve upon the work of both on several fronts, which will be investigated in this paper in great detail. It is my contention that students, parents, faculty, staff, and administration can all benefit from such improvements.
\vspace{30pt}
\noindent
This paper is organized into two parts, with a brief intermission in between. First, I will explain many of Skedge's design decisions in response to what I call ``grievances'' with CDCS. We will break for a technical overview, and the second part will look at live usage data, extrapolating how Skedge is used by students and measuring its efficacy as a platform using some novel metrics. | {
"alphanum_fraction": 0.7301462905,
"avg_line_length": 59.8125,
"ext": "tex",
"hexsha": "118ad16f30a6d3915007fb9a8484f8dbfbe5c2ca",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "b5c89fe83f59adc0dd389e9712930ce26aa92824",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "dingbat/skedge-thesis",
"max_forks_repo_path": "introduction.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "b5c89fe83f59adc0dd389e9712930ce26aa92824",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "dingbat/skedge-thesis",
"max_issues_repo_path": "introduction.tex",
"max_line_length": 508,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "b5c89fe83f59adc0dd389e9712930ce26aa92824",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "dingbat/skedge-thesis",
"max_stars_repo_path": "introduction.tex",
"max_stars_repo_stars_event_max_datetime": "2016-11-05T23:19:24.000Z",
"max_stars_repo_stars_event_min_datetime": "2016-10-28T02:39:06.000Z",
"num_tokens": 924,
"size": 3828
} |
\documentclass[12pt]{article}
\usepackage[natbib=true,style=authoryear]{biblatex}
\addbibresource{references.bib}
\setlength\bibitemsep{0pt}
\usepackage{pgf}
\usepackage[colorlinks,citecolor=blue,linkcolor=black,bookmarks=false,hypertexnames=true]{hyperref}
\usepackage{url}
\usepackage[inline]{enumitem}
\usepackage{float}
\usepackage[bottom,perpage,multiple]{footmisc}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{setspace}
\setstretch{1.1}
\usepackage{enumitem}
\usepackage{caption}
\usepackage{xcolor}
\usepackage[top=1.3in, left=1.4in, includefoot]{geometry}
\setlist{nosep}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{multicol}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{charter}
\usepackage{listings}
\usepackage{authblk}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\sffamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\newcommand{\pattern}[3]{
{\bf #2. #1} \\
{\it Description:} #3 \\
}
\newcommand{\todo}{\textcolor{red}{\textbf{TODO}}}
\tolerance=800
\usepackage{pgfplots}
%\DeclareUnicodeCharacter{2212}{-}
\usepgfplotslibrary{groupplots,dateplot}
\usetikzlibrary{patterns,shapes.arrows}
\pgfplotsset{compat=newest}
\usepackage{url}
\renewcommand*{\bibfont}{\footnotesize}
\title{
\includegraphics[height=100pt]{logo.png}\\
\vspace{10pt}
\textsc{Aibolit:}\\
Static Analysis
Using Machine Learning}
\author{Yegor Bugayenko, Anton Cheshkov, Ekaterina Garmash, Andrey Gusev, Yaroslav Kishchenko, Pavel Lukyanov, Evgeny Maslov, Vitaly Protasov}
\affil{Huawei Technologies Co., Ltd. \\ System Programming Lab \\ Russian Research Institute (RRI) \\ Moscow, Russia}
\begin{document}
\maketitle
\pagebreak
\begin{abstract}
Aibolit is a next generation static analyzer powered by machine learning.
Aibolit gives recommendations to developers to avoid bad software patterns
in order to improve quality of the source code. Aibolit can be extended by adding
custom patterns and quality metrics of choice. In this paper, we explain
how Aibolit works and how it differs from other static analyzers.
\end{abstract}
\pagebreak
\section{Introduction}
\label{sec:intro}
\input{sections/introduction}
\section{Software quality and patterns}
\label{sec:related}
\input{sections/related_work}
\section{How the Aibolit recommender works}
\label{sec:how_aibolit_works}
\input{sections/how_aibolit_works}
\section{Other usage scenarios}
\label{sec:usage_scenarios}
\input{sections/pattern_emp_analysis}
\input{sections/usage_scenarios}
\section{Conclusion \& Future Work}
\label{sec:conclusion}
\input{sections/conclusion}
\newpage
\AtNextBibliography{\small}
\setstretch{1.0}
\raggedright
\begin{multicols}{2}\printbibliography\end{multicols}
\newpage
\section*{Appendix}
\label{sec:appendix}
\input{sections/appendix}
\end{document}
| {
"alphanum_fraction": 0.7814451383,
"avg_line_length": 24.9111111111,
"ext": "tex",
"hexsha": "2243b384c34b8ad55a71acddb8f88cc008019320",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "c4f350f5de824ebb4906aac066f1bd23f9a8c75a",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "lyriccoder/aibolit",
"max_forks_repo_path": "wp/wp.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "c4f350f5de824ebb4906aac066f1bd23f9a8c75a",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "lyriccoder/aibolit",
"max_issues_repo_path": "wp/wp.tex",
"max_line_length": 142,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "c4f350f5de824ebb4906aac066f1bd23f9a8c75a",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "lyriccoder/aibolit",
"max_stars_repo_path": "wp/wp.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1052,
"size": 3363
} |
\documentclass[letterpaper,11pt]{article}
\usepackage[utf8]{inputenc}
\title{Meeting 9}
\date{13~March 2018}
\begin{document}
\maketitle
\section*{Attendance}
\subsection*{Present}
\begin{list}{}{}
\item Viet
\item Mikael
\item Jan
\item Markus
\item Magnus
\item Anne Lise
\item Tom
\item Aleksander
\end{list}
\newpage
\section*{Highlights of the meeting}
\begin{itemize}
\item Briefing of work done
\item Discussion of problems and challenges that occured during implementation
\item Rediscussion of handling of parameters and variables between classes
\end{itemize}
\section*{To do}
\begin{itemize}
\item Continue with implementation
\end{itemize}
\section*{Notes taken under meeting}
Briefing: \\
Markus - Initialization of board, suggested to use numbered tiles. \\
Magnus - Found some sprites and made a GUI prototype. \\
Rest - Implementation of basic methods in the piece classes. \\
Going through code skeleton and discussing problems that occured during implementation with the current code setup. \\
How do the pieces access their start position? Sent through constructor? Call super? \\
Player object should have a list with pieces and start positions. \\
Seperate array lists with moves and attacks. \\
Use hashmap for better run time. \\
Should have planned better. \\
\end{document} | {
"alphanum_fraction": 0.7694063927,
"avg_line_length": 29.2,
"ext": "tex",
"hexsha": "da8c5984adae05fdd26e3ee92b6f5aaf0d122f21",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "eefa95fd4293081df62727d4b985652de835402d",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "markusmmm/Chess",
"max_forks_repo_path": "Documentation/Minutes/Meeting09.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "eefa95fd4293081df62727d4b985652de835402d",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "markusmmm/Chess",
"max_issues_repo_path": "Documentation/Minutes/Meeting09.tex",
"max_line_length": 118,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "eefa95fd4293081df62727d4b985652de835402d",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "markusmmm/Chess",
"max_stars_repo_path": "Documentation/Minutes/Meeting09.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 334,
"size": 1314
} |
% Note that the text in the [] brackets is the one that will
% appear in the table of contents, whilst the text in the {}
% brackets will appear in the main thesis.
%% APPENDIX HEADER ////////////////////////////////////////////////////////////////////////////////////
\chapter{Interfaces coupling matrix}
\label{app:algorithm}
%% APPENDIX CONTENT ///////////////////////////////////////////////////////////////////////////////////
\begin{algorithm}[H]
\SetAlgoLined
\KwResult{coupling matrix \textbf{G}}
\For{i = 1 \KwTo 2}{
create \(n^{\Gamma}\times n^{s_i}\) null matrix
\(\mathbf{G}_i\),\\
\For{j = 1 \KwTo \(n^{\Gamma}\)} {
find \(ownerElement^j_i\) in the structure \(s_i\)
containing interface node \(j\) with global coordinates vector:
\(X_p=(x^j_p,y^j_p)\)\;
assign vector \(X_e=(x_e,y_e)\) of coordinates of all nodes in
\(ownerElement^j_i\)\;
assign initial coordinates
\(X_{\kappa}=(x^j_{\kappa},y^j_{\kappa})\) to the nearest node in
\(ownerElement^j_i\) to node \(j\)\;
transform global coordinates \(X_{\kappa}\) to a local coordinate system \(\xi_{\kappa}=\xi(X_{\kappa});\quad
\eta_{\kappa}=\eta(X_{\kappa})\)\;
\While{\(\left|X_p-X_{\kappa}\right|>tol\)}{
\(\xi_{\kappa+1}=\xi_{\kappa}+(J^{-1}_{\kappa})_{11}.*(x^j_p-x_{\kappa}^j)
+(J^{-1}_{\kappa})_{12}.*(y^j_p-y_{\kappa}^j)\)\;
\(\eta_{\kappa+1}=\eta_{\kappa}+(J^{-1}_{\kappa})_{21}.*(x^j_p-x_{\kappa}^j)
+(J^{-1}_{\kappa})_{22}.*(y^j_p-y_{\kappa}^j)\)\;
\(X_{\kappa}=N_{\kappa+1}X_e\)\;
}
\(\mathbf{G}_i(j,n^{X_e})=N_{\kappa+1}\)\;
}
\uIf{\(s_i\) is 3D} {
\(\mathbf{G}_i=\left[\begin{array}{ccc}
\mathbf{G}_i & \mathbf{0} & \mathbf{0}\\
\mathbf{0} & \mathbf{G}_i & \mathbf{0}\\
\mathbf{0} & \mathbf{0} & \mathbf{G}_i
\end{array} \right]
\)\;
}
\ElseIf{\(s_i\) is 2D} {
\(\mathbf{G}_i=\left[\begin{array}{ccccc}
\mathbf{G}_i & \mathbf{0} & \mathbf{0} &
\frac{h_i}{2}\mathbf{G}_i & \mathbf{0}\\
\mathbf{0} & \mathbf{G}_i & \mathbf{0} & \mathbf{0} &
\frac{h_i}{2}\mathbf{G}_i\\
\mathbf{0} & \mathbf{0} & \mathbf{G}_i & \mathbf{0} &
\mathbf{0}
\end{array} \right]\)\;
}
}
\(\mathbf{G}=\left[\begin{array}{cc}
\mathbf{G}_1 & \mathbf{G}_2
\end{array} \right].\)
\caption{Interface coupling matrix formulation}
\label{alg:G_matrix}
\end{algorithm}
where \(s_i\) is the structure to, \(n^{\Gamma}\) and \(n^{s_i}\) are numbers of nodes of the interface, respectively; \(J_{\kappa}\) is the Jacobian evaluated at \((\xi_{\kappa},\eta_{\kappa})\) and \(N_{\kappa+1}\) is the shape function evaluated at \((\xi_{\kappa+1},\eta_{\kappa+1})\), \(n^{X_e}\) is the vector of global order numbers of all nodes in the \(ownerElements^j_i\), \(h_i\) is a thickness of the structure \(s_i\) and \(tol\) is a termination criterion for iterations. | {
"alphanum_fraction": 0.5675008812,
"avg_line_length": 45.7580645161,
"ext": "tex",
"hexsha": "ea14a3ada4d7ed734df9ec5e7d90858c77287574",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "e27cf98e5d8a5a8ad2ba0c5e70520c281dfd384c",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "pfiborek/model_hc",
"max_forks_repo_path": "docs/proposal/Dissertation/Appendices/app2.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "e27cf98e5d8a5a8ad2ba0c5e70520c281dfd384c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "pfiborek/model_hc",
"max_issues_repo_path": "docs/proposal/Dissertation/Appendices/app2.tex",
"max_line_length": 485,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "e27cf98e5d8a5a8ad2ba0c5e70520c281dfd384c",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "pfiborek/model_hc",
"max_stars_repo_path": "docs/proposal/Dissertation/Appendices/app2.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1124,
"size": 2837
} |
\chapter{Counterfactual Prediction, Sample Selection Bias, and Covariate Shift} \label{counterfactual-history}
Inferring causal relationships is a fundamental problem in history and the social sciences. The problem of causal inference is usually framed in terms of counterfactuals: outcomes that would have been observed had the path of history diverged \citep{lewis2013counterfactuals,pearl2009causality,imbens2015causal}. Historians frequently pose counterfactuals in terms of speculating about the `might-have-beens' of history, as it is put by \citet{elster1978logic}:
\begin{quote}
``In a non-experimental and non-comparative discipline one can hardly discuss the
relative importance of causes without engaging in some kind of thought experiment where one removes successively and separately each of the causes in
question and evaluates what difference the absence of this cause would have
made to the phenomenon in question. Some historians have come to recognize,
therefore, that they have been talking counterfactually all the time without
recognizing it.''
\end{quote}
This dissertation focuses on counterfactual questions in observational studies, where interventions and outcomes have already been recorded. In observational studies, interventions are not randomly assigned and thus there is no ``reasoned basis for inference'' for evaluating counterfactuals, according to Fisherian view of causal inference \citep{fisher1935}. This absence of randomization has not prevented political scientists from reasoning about counterfactuals in comparative case studies \citep{fearon1991counterfactuals, tetlock1996counterfactual,abadie2010synthetic,abadie2015comparative}. Counterfactual comparisons also have a long tradition in economic history \citep{fogel1964railroads,donaldson2016railroads}.
\section{Sample selection bias and covariate shift}
The problem of counterfactual prediction in observational studies is inevitably confronted with sample selection bias \citep{heckman1979sample} which arises because the units choose whether they are exposed to treatment, or because the researcher makes non-random sample selection decisions. In either case, inferences on observed samples are biased because they differ from what we would infer on random samples from the population.
The observational study in Chapter \ref{ga-lottery} makes the case that bias due to self-selection is ignorable because the treatment in the study -- winning land in the first two Georgia land lotteries --- was randomized by the state of Georgia; i.e., it is a true ``natural experiment.'' In Chapters \ref{land-reform} and \ref{rnns-causal}, it is acknowledged that treatment --- exposure to homestead policy or homestead entries authorized by those policies --- is not randomly assigned and units have selected into treatment. Both of these studies approach the problem of causal inference by counterfactual prediction via machine learning methods. The machine learning methods predict counterfactual outcomes of the treated units, which are then compared to the observed outcomes for estimating casual effects. These methods are data-driven, in that they do not require domain knowledge or pre-intervention covariates to generate counterfactual outcomes.
In machine learning terms, the sample selection bias problem occurs when test set data are drawn from a true distribution and training data are drawn from a biased distribution, where the support of biased distribution is included in that of the true distribution \citep{cortes2008sample}. The sample selection bias problem is a special case of the covariate shift problem, when the distributions of training and test sets differ \citep{bickel2007discriminative}.
The problem of causal inference by counterfactual prediction assumes that the training set (i.e., control unit observations) and test set (i.e., treated unit observations) are drawn from the same distribution and therefore, requires inference on a different distribution than training set. The approach described in Chapter \ref{rnns-causal} reweights the training loss function by the propensity score \citep{rosenbaum1983central}.\footnote{Note that the propensity score reweighting of the training loss can also be used to correct for the fact that treatment propensity increases over time in staggered treatment adoption settings, such as in Chapter \ref{land-reform}.} This correction technique, along with regularization approaches, prevent the model from learning an overreliance on certain control units or time periods when generalizing from the factual to counterfactual domains \citep{johansson2016learning}.
| {
"alphanum_fraction": 0.8305340224,
"avg_line_length": 185.76,
"ext": "tex",
"hexsha": "c772ddc9322a1d38d13a75ef72b2a48d87505e83",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "15a691e8cb940ea427641155c7d69df3be152569",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "jvpoulos/thesis",
"max_forks_repo_path": "t2.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "15a691e8cb940ea427641155c7d69df3be152569",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "jvpoulos/thesis",
"max_issues_repo_path": "t2.tex",
"max_line_length": 959,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "15a691e8cb940ea427641155c7d69df3be152569",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "jvpoulos/thesis",
"max_stars_repo_path": "t2.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 953,
"size": 4644
} |
\epigraph{``It is our choices, Harry, that show what we truly are, far more than our abilities."}{Albus Dumbledore}
The previous chapters have discussed the development of an open source implementation to simulating atmospheric dynamics both in the troposphere and the stratosphere on a synoptic scale. Although extremely time consuming, and with a few approximations made along the way, the importance of an open source implementation cannot be understated. It could potentially open up a field to a wider group, and often doesn't receive the media attention it rightfully deserves.
Future applications of this work are extremely wide ranging, from usage in numerical weather prediction schemes that take in observational data collected from satellites, and ground stations in order to provide a picture of future weather events; to forming at starting point in future research of atmospheric phenomena, ideally reducing the overall research time. While, at the moment, it definitely would be inaccurate to say the software is ready for such usage, with future enhancements which I will touch on in a minute, it most certainly will.
\section{Looking Back}
To prove the hypothesis that `it is possible to create open source implementation to simulating atmospheric dynamics both in the troposphere and the stratosphere, that such a software is consistent and reliable, and that the software consists of high quality code', a number of different bechmarking experiments were carried out in the areas of: performance, accuracy, and code quality.
It is clearly possible to create open source software implementation to simulating atmospheric dynamics, as evident by this report. In regards to performance benchmarking, two different benchmarks were carried out. The statistical analysis of the first benchmark indicated that the p-value of the null hypothesis was 0.0009, and hence therefore, we can reject the null hypothesis. This demonstrated that there was a significantly significant increase in execution time between the Python version of the software and the Cython version. The statistical analysis of the second benchmark found that the mean coefficient of variation ($\frac{\sigma}{\bar{x}}$) in regards to execution time was approximately, 0.04. This signified that there was a low variation in execution time, proving that the performance of the software was consistent and reliable. In regards to the accuracy benchmark, a mean absolute percentage error of approximately 1.56 \%, and a median absolute percentage error was approximately 0.81 \% were found. This shows that the forecast produced by the software is accurate, and proves that the software is consistent and reliable. In regards to the code accuracy benchmark, two distinct benchmarks were carried out. The first benchmark indicated that the software consists of high quality source code, as it received a numerical rating of 7.32 from Pylint which corresponds to an interpretation of `Great Code!' in table 6.3. The second benchmark indicated that the software had a code coverage of approximately 98 \%. This signifies that the software has a lower chance of containing undetected bugs, ultimately demonstrating that the quality of the source code is high. Both of these benchmarks clearly highlight that the software consists of high quality source code. All aspects of the hypothesis's statement have been verified, hence, the hypothesis as originally stated can be accepted.
\begin{figure}[H]
\centering
\includegraphics[width=.8\linewidth]{Images/anaconda.png}
\caption{A screenshot of the AMSIMP package on Anaconda Cloud.}
\label{pypi}
\end{figure}
While the hypothesis that was proposed has been proven, there is a few possible sources of error in the benchmarking method:
\begin{itemize}
\item The accuracy benchmark was carried out over the course of a month (Mid November to Mid December). While the benchmark demonstrated that the forecast produced by the software was accurate, one might argue that due to the fact that it wasn't tested in the month of June, for example, that it is unknown whether the forecast produced by the software is accurate for the entirety of the year. Therefore, in the future, the accuracy benchmark would be carried out over a longer period of time in order to get a better picture in regards to the overall accuracy of the software.
\item As mentioned in chapter \ref{5}, there is considerable debate as to whether there is a fixed cut off point for the mean and median absolute percentage errors. The reason one might argue is the fact that MAPE / MdAPE is levelled. Therefore, a potential remedy to this is, to switch to the mean absolute scaled error, which has a definite cut off point of 1. Problems with the MAPE and MdAPE can also occur when calculating them with a series of small denominators. A singularity problem of the form `one divided by zero' and the creation of very large changes in the Absolute Percentage Error, caused by a small deviation in error, can occur.
\item It is necessary to point out at this stage that the linting benchmark, which is a specific code quality benchmark, was carried out on AMSIMP v0.1.6, while all other benchmarks were carried out on the latest version of the software, AMSIMP v0.3.4. The reason for doing so is that Pylint is currently incompatible with Cython, and there is currently no similar linter available for this programming language. While the functionality of both versions is similar, with the source code being practically identical for all intents and purposes; it is still something to emphasise, and keep in mind.
\end{itemize}
\section{Looking Ahead}
The software is currently in a beta release state. Beta software is generally considered ``complete" by the developer but still not ready for general use due to a lack of testing ``in the wild."\cite{beta}. In this section, I will briefly outline the enhancements and features that will be released in the release candidate version of the software, which is planned for release in Fall 2020:
\begin{itemize}
\item The next fundamental step for the project will be utilising live, or near to it, atmospheric data in order to provide a forecast that is of a higher accuracy, and as a consequence, would be more useful to the general population. For the purposes of this project, the data used was provided by the NRLMSISE-00 Atmospheric Model. During the research phase of the project, it was discovered that the data provided by this model had a mean absolute percentage error of approximately 1.5 \% and a median absolute percentage error of approximately 0.8 \%. While one might argue that this is reasonable accurate, as a consequence of Chaos Theory, a tiny difference in the initial conditions in a large system can result in drastically different forecasted events. One can determine a system's sensitivity to initial conditions by utilising the Lyapunov exponent. The Lyapunov exponent can be determined by equation \ref{chaos}, where in this $e$ is Euler's number and $\lambda$ is the Lyapunov exponent \cite{lyapunov}.
\begin{equation}
\label{chaos}
\mid{\delta Z(t)}\mid \approx e^{\lambda t} \mid{\delta Z_{0}}\mid
\end{equation}
It cannot be determined analytically, similar to the Primitive Equations, and must be calculated numerically. If one determines its value, it would demonstrate that the atmosphere is a system that is extremely sensitive to initial conditions. Such a system is known as a chaotic dynamical system. Hence, while utilising live atmospheric data would add a significant amount of complexity, it would greatly improve the accuracy of the forecast produced by the software.
\item A key assumption that is held to be true within the software, and by extension the project, is that the atmosphere is in geostrophic balance. While this is a reasonably good approximation at a synoptic scale, especially in the mid-latitude mid-troposphere, it generally does not hold true in nature. The actual wind always differs from the geostrophic wind due to forces from surface level, such as friction. Thus, the actual wind would equal the geostrophic wind if there was no friction and the isobars were pretty straight. For release candidate version of the software, the current plan is to implement the Quasi-geostrophic theory into the software. The Quasi-geostrophic are used to model flows in the atmosphere more widely. These theories allow for divergence to take place and for weather systems to then develop\cite{quasi_future}.
\item The aforementioned features will be released in the AMSIMP v1.0.0, which as stated previously is planned for release in the Fall of 2020. Dependent on demand and utilisation of the software, and in the hopes of making the software more generally available and accessible to a wide audience of people; an app, most likely for iOS, will be created and would coincide with the launch of AMSIMP v2.0.0, which at this present moment is slated for release in the Summer of 2021.
\end{itemize} | {
"alphanum_fraction": 0.8005069988,
"avg_line_length": 221.2926829268,
"ext": "tex",
"hexsha": "31aedaa372c349fc46e471d0df5efd0eeb6c6b2a",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "a212b3f65140f0292d51055be324a7c1b084e121",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "amsimp/papers",
"max_forks_repo_path": "btyste/2020/project-book/Chapters/Conclusions.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "a212b3f65140f0292d51055be324a7c1b084e121",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "amsimp/papers",
"max_issues_repo_path": "btyste/2020/project-book/Chapters/Conclusions.tex",
"max_line_length": 1909,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "a212b3f65140f0292d51055be324a7c1b084e121",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "amsimp/papers",
"max_stars_repo_path": "btyste/2020/project-book/Chapters/Conclusions.tex",
"max_stars_repo_stars_event_max_datetime": "2020-05-15T10:06:17.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-05-15T10:06:17.000Z",
"num_tokens": 1881,
"size": 9073
} |
\chapter[The languages of northern Eurasia]{Adjective attribution marking in the languages of northern Eurasia}
%%%
The following chapter contains an overall survey of adjective attribution marking devices which occur in the languages of northern Eurasia. For each genealogical unit, both the prototypical and the known minor noun phrase type(s) will be characterized and illustrated with examples. A complete list of adjective attribution marking devices in over 200 single languages considered for the present survey is found in a table starting on page~\pageref{sample1} in the Appendix. The geographic spread of the different noun phrase types is shown on several maps starting on page~\pageref{WorldMap} in the Appendix.
\il{Eskimo-Aleut languages|(}
\il{Eskimo languages|(}
\il{Yupik languages|(}
\il{Central Siberian Yupik|(}
\section{Eskimo-Aleut (Central Siberian Yupik)}
%%%
Whereas most languages of the Eskimo-Aleut family are spoken on islands in the Bering Strait or on the \isi{North America}n continent, a few varieties of the Yupik subbranch of Eskimo can be localized to north-easternmost \isi{Siberia}. But only one of these languages, Central Siberian Yupik, is still spoken \citep[224]{salminen2007}.
In Central Siberian Yupik, only one adjective attribution marking device is attested:
%%%
\begin{itemize}
\item incorporation.
\end{itemize}
%%%
\paragraph*{Adjective incorporation in Central Siberian Yupik}
Items that correspond to property-denoting words in other languages (“adjectives”) are phonologically bound nominal roots in Central Siberian Yupik. Adjectival modification is thus expressed by means of polysynthetic morphology and can be characterized as adjective incorporation according to the ontology presented in Part~II (Typology).
%%%
\begin{exe}
\ex {\rm Central Siberian Yupik \citep{de-reuse1994}}
\begin{xlist}
\ex
\gll qawaagpag\textbf{-rukutaagh-\underline{gh}llag}-Ø\\
legendary\_big\_bird-huge.\textsc{noun}-big.\textsc{noun}-\textsc{abs}\\
\glt ‘huge big (legendary large) bird’ (54)
\ex
\gll mangteghagh\textbf{-\underline{gh}llag}-lgu-uq\\
house-big.\textsc{noun}-have.\textsc{noun}-\textsc{ind}(3s)\\
\glt ‘He has a big house.’ (55)
\ex
\gll mangteghagh\textbf{-\underline{gh}rugllag}-ngllagh-yug-nghit°e-unga\\
house-big.\textsc{noun}-make.\textsc{noun}-want\_to.\textsc{verb}-\textsc{neg}-\textsc{ind(1s)}\\
\glt ‘I did not want to make a big house.’ (56)
\end{xlist}
\end{exe}
%%%
\il{Yupik languages|)}
\il{Central Siberian Yupik|)}
\il{Eskimo languages|)}
\il{Eskimo-Aleut languages|)}
\il{Chukotko-Kamchatkan languages|(}
\section{Chukotko-Kamchatkan}
Although \citet{salminen2007} describes Chukotkan and Kamchatkan as two independent families, most scholars today agree that they are two branches of one family \citep[see also the comparative dictionary by][]{fortescue2005a}.
\il{Chukotkan languages|(}
\subsection{Chukotkan}
%%%
The Chukotkan branch (aka Chukchi-Koryak)\il{Chukchi-Koryak|see{Chukotkan languages}} of Chukotko-Kamchatkan consists of two sub-branches. The first branch, Chukchi, is represented by only one language, Chukchi proper. The second branch, Koryak-Alutor,\il{Koryak-Alutor languages} is represented by the two languages Alutor\il{Alutor} and Koryak\il{Koryak} proper. A third branch, Kerek,\il{Kerek languages} is probably extinct \citep[253]{salminen2007} and consequently not considered here.
Constituent order inside the noun phrase of Chukotkan languages is strictly head-final. Adjective attribution marking is also similar in all Chukotkan languages. Two types are attested:
%%%
\begin{itemize}
\item incorporation
\item head\hyp{}driven agreement.\is{head\hyp{}driven agreement}
\end{itemize}
%%%
\il{Chukchi languages|(}
\subsubsection{Chukchi}
%%%
\paragraph*{Adjective incorporation in Chukchi}
The use of the bound adjective morpheme in the polysynthetic structure (similar to Yupik)\il{Yupik languages} is illustrated in the following examples.\footnote{The vowel -ə- in these and the following examples is epenthetic.}
%%%
\newpage
\begin{exe}
\ex {\rm Chukchi \citep{skorik1960}}
\begin{xlist}
\ex
\gll \textbf{elg-}ə-qoranə\\
white-ə-deer:\textsc{abs.sg}\\
\glt ‘white reindeer’
\ex
\gll \textbf{elg-}ə-qorat\\
white-ə-deer:\textsc{abs.pl}\\
\glt ‘white reindeer (pl.)’
\end{xlist}
\end{exe}
\il{Chukchi languages|)}
\il{Koryak-Alutor languages|(}
\subsubsection{Koryak}
%%%
\paragraph*{Adjective incorporation in Alutor}
Similar to Chukchi,\il{Chukchi} adjective incorporation is the default adjective attribution marking device in Alutor.
%%%
\begin{exe}
\ex {\rm Alutor \citep{nagayama2003}}
\begin{xlist}
\ex
\gll \textbf{meŋ-}ə-rara-ŋa\\
big-ə-house-\textsc{abs.sg}\\
\glt ‘big house’
\ex
\gll \textbf{meŋ-}ə-rara-wwi\\
big-ə-house-\textsc{abs.pl}\\
\glt ‘big houses’
\end{xlist}
\end{exe}
\il{Koryak-Alutor languages|)}
\il{Chukchi|(}\il{Alutor|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Chukchi and Alutor}
Whereas adjective incorporation is the default and unmarked type of adjective attribution marking in Alutor and Chukchi, several descriptions of the Chukotkan languages mention that adjectives can also occur in an unbound form (for Alutor, see \citealt{nagayama2003}; for Chukchi, see \citealt[103–104, 421–429]{skorik1960} and \citealt[251]{comrie1981}). As unbound morphemes, adjectives take the stative marker \textit{n-} as well as agreement markers for person, number and case.
%%%
\begin{exe}
\ex
\label{chukchi alutor free adj}
\begin{xlist}
\ex {\rm Chukchi \citep{skorik1960}}
\begin{xlist}
\ex
\gll \textbf{n-ilg-ə-qin-Ø} qoranə\\
\textsc{stat}-white-ə-\textsc{3sg} deer:\textsc{abs.sg}\\
\glt ‘white reindeer’
\ex
\gll \textbf{n-ilg-ə-qine-t} qorat\\
\textsc{stat}-white-ə-3-\textsc{pl} deer:\textsc{abs.pl}\\
\glt ‘white reindeer (pl.)’
\end{xlist}
\newpage
\ex {\rm Alutor \citep{nagayama2003}}
\begin{xlist}
\ex
\gll \textbf{n-ə-meŋ-ə-qin} rara-ŋa\\
\textsc{stat}-ə-big-ə-\textsc{abs:3sg} house-\textsc{abs.sg}\\
\glt ‘big house’
\ex
\gll \textbf{n-ə-meŋ-ə-laŋ} rara-wwi\\
\textsc{stat}-ə-big-ə-\textsc{abs:3pl} house-\textsc{abs.pl}\\
\glt ‘big houses’
\end{xlist}
\end{xlist}
\end{exe}
%%%
The number/person/case-agreement suffixes of adjectives as well as the suffixes which mark possessive inflection of nouns belong to one and the same paradigm. Consequently, one could also interpret the Alutor and Chukchi data as another instance of \isi{modifier\hyp{}headed possessor agreement} (as in \ili{Oroch}, described in \S\ref{ModheadAgr}). If so, the examples in \REF{chukchi alutor free adj} should be translated literally as ‘reindeer's whiteness’, ‘house's bigness’. An analysis avoiding syntactic dependency reversal between noun and adjective \citep[cf.][]{malchukov2000}, however, is preferred here for two reasons: the first reason is the constituent order inside the noun phrase. The assumed head shift to a modifier\hyp{}headed possessor agreement construction would violate the otherwise strictly head-final constituent order rule in Alutor and Chukchi.
The other reason arguing against syntactic head shift between noun and adjective is that in order to use non-incorporating constructions as in the examples in \REF{chukchi alutor free adj}, the adjective is first transformed into a \isi{stative verb} by means of a verbalizing prefix (\textit{-n}, glossed as \textsc{stat} in example \ref{chukchi alutor free adj}).
The verbalizer together with the agreement affix is sometimes glossed as an adjectivizing\is{adjective derivation} circumfix (\textsc{adjz>-\dots-<adjz:agr}), for instance in Nagayama's (\citeyear{nagayama2003}) grammatical description of Alutor. The given noun phrase type should then perhaps be analyzed as attributive state marking (as in Russian,\il{Russian} see \S\S\ref{anti-constr agr}, \ref{russian synchr}). Unlike in Russian, however, the same agreement marking as in attributive constructions shows up on predicates as well.
%%%
\begin{exe}
\ex {\rm Alutor \citep{nagayama2003}}
\begin{xlist}
\ex
\gll \textbf{n-ə-tur-}iɣəm\\
\textbf{\textsc{stat}-ə-young-}\textsc{1sg}\\
\glt ‘I'm young’
\end{xlist}
\end{exe}
%%%
Consequently, an analysis of adjective attribution marking in Alutor and Chukchi as belonging to the state-marking type is rejected.
The semantic difference between the two constructions, with adjective incorporation on the one hand and head\hyp{}driven agreement marking on the other hand, is not clear. Whereas adjective incorporation is often described as the main or even only possible type (for Chukchi, see \citealt[37, 101]{kampfe-etal1995}), \citet[288]{kibrik-etal2000} state that this type indicates the corresponding quality or property as referring to background information in Alutor.
The following example from Chukchi, on the other hand, indicates that the non-incorporated adjective is used in an emphasized construction. Sentence (\ref{chukchi free adj}) was elicited by Vladimir Nedjalkov\ia{Nedjalkov, Vladimir} \citep[cited as a personal communication in][330]{rijkhoff2002} in order to find examples of multiple modifiers in one noun phrase, which seems to be avoided by speakers of Chukchi. In sentence (\ref{chukchi inc adj}) with the incorporated adjective, the speaker simply left out the demonstrative when translating into Chukchi.
%%%
\begin{exe}
\ex {\rm Chukchi \citep[Vladimir Nedjalkov, p.c., cit.][330]{rijkhoff2002}}
\begin{xlist}
\ex
\label{chukchi free adj}
\gll əngena-t ngəroq \textbf{n-ilg-ə-qine-t} qora-t\\
this-\textsc{pl} three \textsc{stat}-white-ə-3-\textsc{pl} deer-\textsc{pl}\\
\glt ‘these three white reindeer’
\ex
\label{chukchi inc adj}
\gll ətlon ga-twetcha-twa-len ga-ngəron-\textbf{elg-}ə-qaa-ma\\
\textsc{3sg} \textsc{pfct}-stand\_up-be-\textsc{3sg} \textsc{com}-white-ə-deer-\textsc{com}\\
\glt ‘He stood next to (these) three white reindeer.’
\end{xlist}
\end{exe}
%%%
\citet[716]{bogoras1922} states that the circum-positioned marker of the unbound adjective “sometimes corresponds to the definite\is{species marking!definite} article or designates an object as referred to before.” The unbound adjective, on the other hand, can only occur in absolutive case which is inherently connected to semantic definiteness\is{species marking!definite} \citep[cf.][207, passim]{dunn1999}.
\il{Chukchi|)}
\il{Alutor|)}
\il{Chukotkan languages|)}
\is{head\hyp{}driven agreement|)}
\il{Kamchatkan languages|(}
\il{Itelmen|(}
\subsection{Kamchatkan}
%%%
The only surviving member of the Kamchatkan branch is Itelmen (aka Western Kamchadal)\il{Western Kamchadal|see{Itelmen}} \citep[224]{salminen2007}.
The only attested type of adjective attribution marking in Itelmen is:\footnote{According to \citet{volodin1997}, a few adjectives (among them Russian\il{Russian} loan adjectives) occur in \isi{juxtaposition}.}
%%%
\begin{itemize}
\item anti\hyp{}construct state agreement.
\end{itemize}
%%%
\paragraph*{Anti\hyp{}construct state agreement in Itelmen}
\label{itelmen synchr}
Constituent order inside the noun phrase of Itelmen is head-final. Adjectives form a class that is clearly syntactically distinguished from nouns: unlike the latter, adjectives are never represented by their root morphemes alone. Unlike verbs, which take TAM\is{TAM marking} markers, adjectives take adjectival morphology and are licensed either by an attributive or predicative\is{predicative marking} (adverbal) suffix (\citealt{volodin1997}; \citealt[54]{georg-etal1999}).
%%%
\begin{exe}
\ex
\label{itelmen ex}
{\rm Itelmen \citep{volodin1997}}
\begin{xlist}
\ex {\rm Attributive state of adjectives}\\
\gll thun\textbf{-lah}\\
dark-\textsc{attr}\\
\glt ‘dark’
\ex {\rm Predicative state of adjectives}\\
\gll thun\textbf{-k}\\
dark-\textsc{pred}\\
\glt ‘(is) dark’
\end{xlist}
\end{exe}
%%%
Since attributive adjectives also agree in case (though restricted to instrumental case), the noun phrase type can be characterized as anti\hyp{}construct state agreement, structurally similar to the type found in Russian.\il{Russian} Consider the following example.\footnote{Note that the shape of the state marking suffix \textit{-lan'ļ} ($\leftarrow$ \textit{-lah-ļ}) is the result of a regular morpho-phonological process \citep{georg-etal1999}.}
%%%
\ea
{\rm Anti\hyp{}construct state agreement in Itelmen \citep{georg-etal1999}}\\
\gll Kəmma çasit t'-nu-qz-al-kiçen \textbf{teŋ-lan'ļ} \textbf{thalthe-ļ}, min~~~ kn-anke t-zapasa-qzo-çen\\
\textsc{1sg} now \textsc{1sg}>-eat-\textsc{ipfv-fut-<1sg} good-\textsc{attr:ins} meat-\textsc{ins} \textsc{rel} \textsc{1sg-dat} \textsc{1sg}-keep-\textsc{ipfv-3sg-prtc}\\
\glt ‘Now I will eat the good meat which I kept for you.’
\z
\il{Itelmen|)}
\il{Kamchatkan languages|)}
\il{Chukotko-Kamchatkan languages|)}
\il{Nivkh|(}
\section{Nivkh}
%%%
Nivkh (aka Gilyak)\il{Gilyak|see {Nivkh}} is an isolated language spoken in the far east of the Eurasian continent on Sakhalin Island in easternmost Russia \citep[222–223]{salminen2007}.
\is{head\hyp{}driven agreement|(}
The only type of adjective attribution marking attested in Nivkh is:
%%%
\begin{itemize}
\item head\hyp{}driven agreement.
\end{itemize}
%%%
\paragraph*{Head\hyp{}driven agreement in Nivkh}
Property words in Nivkh are verbal roots. As modifiers in noun phrases these adjectival verbs occur to the left of the head noun in a construction which is sometimes described as a polysynthetic structure (cf.~\citealt[16]{gruzdeva1998}; \citealt[80]{jakobson1971}, quoted by \citealt[138]{rijkhoff2002}). The reason for analyzing adjectives in Nivkh as being incorporated into the modified noun is the phonological boundedness of the constituents evidenced by regular alternations in the initial segments of the noun stem \citep[16]{gruzdeva1998}.
%%%
\begin{exe}
\ex {\rm Nivkh \citep[16]{gruzdeva1998}}
\begin{xlist}
\ex tu ‘lake’
\ex
\gll pily-du\\
be\_big-lake\\
\glt ‘big lake’
\end{xlist}
\end{exe}
%%%
In her sketch grammar of Nivkh, however, \citet{gruzdeva1998} writes adjectival words consistently as morphologically unbound words.\footnote{For instance \textit{čuz pitɣy-Ø} [new book-\textsc{nom}] (19), \textit{kyla n'iɣvn̦} [high man] (33), \textit{pila eri} [big river] (38).}
Interestingly, the phonological stem alternation rules also apply to the plural inflection of nouns and their adjectival attributes by means of reduplication.\is{reduplication} The reduplicated stem of the participle \textit{t'osk̦} in \REF{nivkh redup} ‘destroyed’ is therefore realized as \textit{-zosk̦}.
%%%
\begin{exe}
\ex
\label{nivkh redup}
{\rm Nivkh (Ekaterina Gruzdeva, p.c.)}
\begin{xlist}
\ex
\gll tuin \textbf{t'osq-mu} hum-d'\\
here break.\textsc{ptcp}-boat be-\textsc{ind}\\
\glt ‘there is a destroyed boat here’
\ex
\label{nivkh unaltered}
\gll tuin \textbf{t'osq\textasciitilde zosk̦-mu-ɣu} hum-d'[-ɣu]\\
here break.\textsc{ptcp}\textasciitilde \textsc{pl}-boat-\textsc{pl} be-\textsc{ind}[-\textsc{pl}]\\
\glt ‘there are destroyed boats here’
\end{xlist}
\end{exe}
%%%
Note that number agreement of the attributive forms of adjectives by means of reduplication is archaic in Nivkh. According to Ekaterina Gruzdeva (p.c.),\ia{Gruzdeva, Ekaterina} attributive adjectives practically never reduplicate\is{reduplication} any more. Examples of reduplicating adjectives are, however, included in the older grammar by Panfilov (\citeyear{panfilov1965}).
\il{Nivkh|)}
\is{head\hyp{}driven agreement|)}
\newpage
\il{Ainu|(}
\section{Ainu}
%%%
Ainu is an isolate spoken on Hokkaido Island in northern Japan.
%"isolate" is questionable, cf. Jeju
\is{juxtaposition|(}
The only type of adjective attribution marking attested in Ainu is:
%%%
\begin{itemize}
\item juxtaposition.
\end{itemize}
%%%
\paragraph*{Juxtaposition in Ainu}
\label{ainu synchr}
Ainu does not exhibit any morphological differences between adjectives and verbs \citep[27]{refsing1986}. Words expressing states (\ref{ainu state}) or properties (\ref{aini qual}) in Ainu are best described as \isi{stative verb}s. They form a subclass of intransitive verbs and are only semantically distinguished from verbs denoting an action \citep[141–142]{refsing1986}. As modifiers of a noun, these property words are juxtaposed to the left.
%%%
\begin{exe}
\il{Ainu!Shizunai}
\ex {\rm Ainu (Shizunai) \citep{refsing1986}}
\begin{xlist}
\ex {\rm “State adjective”}\\
\label{ainu state}
\gll \textbf{mokor} cep\\
sleep fish\\
\glt ‘a sleeping fish’ (141)
\ex {\rm “Quality adjective”}\\
\label{aini qual}
\gll \textbf{pirka} cep\\
be\_good fish\\
\glt ‘a fine fish’ (142)
\end{xlist}
\end{exe}
\il{Ainu|)}
\is{juxtaposition|)}
\is{juxtaposition|(}
\il{Japanese|(}
\section{Japanese}
%%%
%"isolate" is incorrect, cf. Ryukyuan languages etc.
The noun phrase structure in Japanese, an isolated language, is strictly head-final. Two types of adjective attribution marking devices are attested:
\begin{itemize}
%%%
\item juxtaposition
\item anti\hyp{}construct state marking.
\end{itemize}
%%%
\paragraph*{Juxtaposition in Japanese}
Two distinct lexical classes of words describe the state that an entity is in. Verbal adjectives belong to the first class. These adjectives are distinguished from \isi{stative verb}s by the adjectivizer\is{adjective derivation} suffix \textit{-i}. Used as predicates, the adjectivized verbs marked with \textit{-i} follow the noun but do not require any copula. Attributive adjectives, on the other hand, are juxtaposed to the left of the modified noun.
%%%
\begin{exe}
\ex {\rm Verbal adjectives in Japanese \citep[170]{backhouse1984}}
\begin{xlist}
\ex {\rm Adjective predication}\\
\gll kono rombun=wa \textbf{naga-i}\\
this article-\textsc{top} long-\textsc{adjz}\\
\glt ‘This article is long.’
\ex {\rm Adjective attribution}\\
\gll \textbf{naga-i} rombun\\
long-\textsc{adjz} article\\
\glt ‘long article’
\end{xlist}
\end{exe}
%%%
Since the adjectivizer\is{adjective derivation} suffix \textit{-i} simply marks \isi{stative verb} roots as (attributive and predicative) adjectives, it is not considered an attribution marking device. Hence, the class of verbal adjectives in Japanese is merely attributed by juxtaposition. Constituent order is crucial for differentiating attributive from predicative adjectives.\is{predicative marking}\footnote{Note that the description if the suffix \textit{-i} as an adjectivizer is simplified here. There is also overlap with \textsc{\isi{tense} marking}, cf.~\textit{rombun-wa naga-i} [\textsc{prs}] ‘the article is long’ versus \textit{rombun-wa naga‑kat-ta} [\textsc{pst}] ‘the article was long’.}
\is{juxtaposition|)}
\paragraph*{Anti\hyp{}construct state in Japanese}
Unlike “verbal adjectives”, which were described in the previous section, the few members of the second adjectival sub-class, i.e., “nominal adjectives” require a special attributive form marked by the invariable attributive suffix \textit{-na}.
%%%
\begin{exe}
\ex {\rm Japanese \citep[72–81]{pustet1989}}
\begin{xlist}
\ex {\rm Attribution: verbal adjective}\\
\gll \textbf{waka-i} hito\\
young-\textsc{adjz} person\\
\glt ‘a young person’
\ex {\rm Attribution: nominal adjective}\\
\gll \textbf{kirei-na} hito\\
beautiful-\textsc{attr} person\\
\glt ‘a beautiful person’
\end{xlist}
\end{exe}
%%%
Note that the word class boundary between nominal adjectives and nouns in Japanese is not always clear because some words take either the noun attribution marker \textit{-no} (\ref{japan na}) or the adjective attribution marker \textit{-na} (\ref{japan no}) when modifying a noun. The arbitrary behavior of attribution marking of nouns and nominal adjectives in Japanese indicates the continuous nature of these two word classes in this language \citep[79–80]{pustet1989}.
%%%
\begin{exe}
\ex {\rm Japanese \citep[72–81]{pustet1989}}
\begin{xlist}
\ex {\rm Noun attribution}\\
\label{japan na}
\gll \textbf{wazuka-na} okane\\
little-\textsc{attr} money\\
\glt ‘little money’
\ex {\rm Adjective attribution}\\
\label{japan no}
\gll \textbf{wazuka-no} okane\\
little-\textsc{attr} money\\
\glt ‘little money’
\end{xlist}
\end{exe}
\il{Japanese|)}
\il{Korean|(}
\section{Korean}
%%%
Korean is an isolated language spoken on the Korean peninsula in northeastern Asia.\is{Northeast Asia} The only type of adjective attribution marking attested in Korean is:
%%%
\begin{itemize}
\item anti\hyp{}construct state marking.
\end{itemize}
%%%
Note, however, that Korean does not have a distinct class of adjectives but adjectival notions are expressed by verbs.
\paragraph*{Anti\hyp{}construct state in Korean}
The constituent order in the noun phrase of Korean is strictly head-final. Modifying “property words” are verbs equipped with a special attributive suffix \textit{-(u)n} \citep{martin-etal1969}.
%%%
\begin{exe}
\ex {\rm Korean \citep[61]{chang1996}}
\begin{xlist}
\ex
\begin{xlist}
\ex
\gll i \textbf{ppalka-n} chayk\\
this be\_red-\textsc{attr} book\\
\ex
\gll i \textbf{ppalka-n} chayk i\\
this be\_red-\textsc{attr} book \textsc{subj}\\
\glt ‘this red book’
\end{xlist}
\ex
\begin{xlist}
\ex
\gll ce \textbf{khu-n} namwu\\
that be\_big-\textsc{attr} tree\\
\ex
\gll ce \textbf{khu-n} namwu lul\\
that be\_big-\textsc{attr} tree \textsc{obj}\\
\glt ‘that big tree’
\end{xlist}
\end{xlist}
\end{exe}
\il{Korean|)}
\il{Sino-Tibetan languages|(}
\il{Dungan|(}
\section{Sino-Tibetan (Dungan)}
\label{sinotibetan synchr}
%%%
The Sino-Tibetan language family is represented in northern Eurasia only by one language, Dungan (aka Dunganese),\il{Dunganese|see{Dungan}} which is a Gansu\il{Gansu languages} variety of Chinese spoken in the Kyrgyz Republic in \isi{Inner Asia} (cf.~\citealt[85]{yuo2003}; \citealt{kalimov1968}).
\is{juxtaposition|(}
Two types of adjective attribution marking are attested in Dungan:
%%%
\begin{itemize}
\item juxtaposition
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\paragraph*{Juxtaposition in Dungan}
Adjective attribution marking in the unmarked noun phrase in Dungan is characterized by juxtaposition. Hereby, the adjective either precedes or follows the noun.
%%%
\begin{exe}
\ex {\rm Dungan \citep[480]{kalimov1968}}
\label{dungan juxtap}
\begin{xlist}
\ex
\gll \textbf{da} fonzy\\
big house\\
\ex
\gll fonzy \textbf{da}\\
house big\\
\glt ‘big house’
\end{xlist}
\end{exe}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Dungan}
A second noun phrase type with the adjectival modifier marked by a suffix \textit{-di\textsuperscript{1}} occurs in Dungan as well. Whereas juxtaposition constitutes the general and unmarked type of adjective attribution marking, the attributive suffix \textit{-di\textsuperscript{1}} seems to be much more restricted and occurs for example in connection with a comparative (\ref{dungan compattr}) or negated attribute (\ref{dungan negattr}).
\is{juxtaposition|)}
%%%
\begin{exe}
\ex {\rm Dungan}
\begin{xlist}
\ex {\rm Negated attribute \citep[80]{zevachina2001}}\\
\label{dungan negattr}
\gll gubuə\textsuperscript{3} bu\textsuperscript{1} \textbf{da\textsuperscript{3}-di\textsuperscript{1}} gun\textsuperscript{1}fu\textsuperscript{1}\\
went \textsc{neg} big-\textsc{attr} time\\
\glt ‘Not much (lit. ‘not big’) time passed.’
%%%
\ex {\rm Comparative attribute \citep[480]{kalimov1968}}\\
\label{dungan compattr}
\gll \textbf{da-ščer-di} fonzy\\
bigger-\textsc{compar}-\textsc{attr} house\\
\glt ‘a somewhat bigr (i.e., different) house’\footnote{Note that the quoted transcriptions of the two authors differ from each other.}
\end{xlist}
\end{exe}
%%%
The marker \textit{-di\textsuperscript{1}} is clearly cognate with the functionally similar nominalizer \textit{-de} in Mandarin Chinese\il{Mandarin Chinese} (cf.~example \ref{multi mand} in Chapter~\ref{polyfunctionality}). In Dungan, however, \textit{-di\textsuperscript{1}} is sometimes also described as a marker of predicative\is{predicative marking} adjectives, as in \REF{dungan emphpred}.
%%%
\begin{exe}
\ex {\rm Attributive nominalization in Dungan \citep[82]{zevachina2001}}\\
\label{dungan emphpred}
\gll ž̨y\textsuperscript{3}gə\textsuperscript{1} mə\textsuperscript{1}mə\textsuperscript{2} \textbf{gan\textsuperscript{1}-di\textsuperscript{1}}\\
this bread stale-\textsc{attr}\\
\glt ‘This bread is \textsc{stale} (i.e., different).’
\end{exe}
%%%
\citet[82]{zevachina2001} labels the function of the marker as an “emphasizing\hyp{}predicative”. But looking at her other examples it becomes obvious that \textit{-di\textsuperscript{1}} does not mark predicative adjectives but rather nominalized attributive adjectives.
%%%
\begin{exe}
\ex {\rm Attributive nominalization in Dungan \citep[82]{zevachina2001}}\\
\gll ž̨y\textsuperscript{3}gə\textsuperscript{1} fu\textsuperscript{1} bu\textsuperscript{1}cy\textsuperscript{1} \textbf{xun\textsuperscript{1}-di\textsuperscript{1}}, \textbf{zy\textsuperscript{2}-di\textsuperscript{1}}\\
this book \textsc{neg} red-\textsc{attr} bordeaux-\textsc{attr}\\
\glt ‘This book is not \textsc{red}, but \textsc{bordeaux}.’\\
(lit. ‘This book is not a red one, but a bordeaux one.’)
\end{exe}
%%%
The nominalizing function of the suffix is also described by \citet{kalimov1968}.
%%%
\begin{exe}
\ex {\rm Attributive nominalization Dungan \citep[484]{kalimov1968}}\\
\label{dungan nmlz}
\gll \textbf{ščin-di} gǔjdixyn\\
new-\textsc{attr} expensive\\
\glt ‘The new (one) is expensive.’
\end{exe}
%%%
Attributive marking with the suffix \textit{-di\textsuperscript{1}} in Dungan needs to be investigated in more detail, especially in connection to constituent order. The head-initial structure seems to be used in order to emphasize the property denoted by the adjective.
However, according to the descriptions of Dungan taken into account here (i.e., \citealt{kalimov1968} and \citealt{zevachina2001}), the language exhibits two adjective attribution marking devices: \isi{juxtaposition} and attributive nominalization by means of the article \textit{-di\textsuperscript{1}}. While juxtaposition (with the order adjective-noun) seems to be the unmarked type, attributive nominalization is restricted to certain pragmatically marked constructions.
\is{attributive nominalization|)}
\il{Dungan|)}
\il{Sino-Tibetan languages|)}
\il{Mongolic languages|(}
\section{Mongolic}
%Mongolic-nördliches China: Dagurisch, Mongorisch, Bao'an, Donxiang, Oirat
The Mongolic language family consists of five branches (cf.~\citealt[222]{salminen2007}). The core branch, Mongolian, includes the languages Kalmyk,\il{Kalmyk} Khalkha,\il{Khalkha} Khamnigan Mongol,\il{Khamnigan Mongol} and Oyrat\il{Oyrat} (aka Oirat).\il{Oirat|see{Oyrat}} Kalmyk is spoken in easternmost \isi{Europe} (in the Republic of Kalmykia of the Russian Federation). The other Mongolian languages are all spoken in \isi{Inner Asia}, along with Dagur\il{Dagur} which belongs to a satellite branch of the Mongolic family. Languages of the remaining three satellite branches of Mongolic are not considered here since they are all spoken outside the northern Eurasian area.
\is{juxtaposition|(}
With regard to their principal noun phrase structure, all Mongolic languages of northern Eurasia exhibit the inherited \ili{Proto\hyp{}Mongolic} features, including strictly head-final constituent order and juxtaposition of attributive adjectives (“adjectival nouns”) as the only attribution marking device.
Note, however, that adjectives in Mongolic languages do not differ formally from regular nouns but are distinguishable from the latter only by their syntactic behavior and specific derivational patterns (cf.~\citealt[10]{janhunen2003b} for Proto\hyp{}Mongolic\il{Proto\hyp{}Mongolic} and \citealt[161]{svantesson2003} for Khalkha).\il{Khalkha}\footnote{In the two Mongolic languages \ili{Moghol} (spoken in Afghanistan) and Mangghuer\il{Mangghuer} (spoken in China) there is a distinct class of adjectives (cf.~\citealt[252]{weiers2003} for Moghol and \citealt[311]{slater2003} for Mangghuer). However, these languages are not considered since they are spoken outside the northern Eurasian area.}
The only type of adjective attribution marking attested in Mongolic languages of northern Eurasia is:
%%%
\begin{itemize}
\item juxtaposition.
\end{itemize}
%%%
\il{Mongolian languages|(}
\subsection{Mongolian}
%%%
\paragraph*{Juxtaposition in Khalkha}\hspace{0.4cm}
The only attested adjective attribution marking device in the languages of the Mongolian branch of Mongolic is juxtaposition, similar to the following example.
%%%
\begin{exe}
\ex {\rm Khalkha \citep{svantesson2003}}
\label{khalkha juxt}
\begin{xlist}
\ex
\gll sayin nom\\
good book\\
\glt ‘good book’
\ex
\gll sayin nom-uud\\
good book-\textsc{pl}\\
\glt ‘good books’
\end{xlist}
\end{exe}
\il{Mongolian languages|)}
\il{Monguor languages|(}
\il{Moghol languages|(}
\il{Dagur languages|(}
\subsection{Monguor, Moghol, Dagur}
%%%
The only attested adjective attribution marking device in the languages of the Monguor, Moghol and Dagur branches of Mongolic is juxtaposition \citep{slater2003,weiers2003,tsumagari2003}, similar to example (\ref{khalkha juxt}) from Khalkha Mongolian.
\il{Monguor languages|)}
\il{Moghol languages|)}
\il{Dagur languages|)}
\il{Mongolic languages|)}
\is{juxtaposition|)}
\il{Tungusic languages|(}
\section{Tungusic}
\label{tungusic synchr}
%%%
The Tungusic language family (aka Manchu-Tungus)\il{Manchu-Tungus languages|see{Tungusic languages}} comprises several single languages belonging to the three branches North Tungusic, Amur Tungusic and Manchu, all spoken in southern \isi{Siberia} (Russia), northern Mongolia and northern China.
The constituent order inside the noun phrase in all Tungusic languages is relatively strictly head-final. In several Tungusic languages, attributive adjectives (“adjectival nouns”) are simply juxtaposed with the modified noun. This type is also mentioned as being prototypical of adjective attribution marking devices in Tungusic languages (e.g., \citealt{sunik1968a}; \citealt[133]{kormusin2005}). However, several other types occur as well. The following adjective attribution marking devices are attested in Tungusic:
%%%
\begin{itemize}
\item juxtaposition\is{juxtaposition}
\item head\hyp{}driven agreement\is{head\hyp{}driven agreement}
\item attributive nominalization\is{attributive nominalization}
\item modifier\hyp{}headed possessor agreement.\is{modifier\hyp{}headed possessor agreement}
\end{itemize}
%%%
\il{North Tungusic languages|(}
\subsection{North Tungusic}
%%%
Languages belonging to the northern branch of Tungusic are Even (aka Lamut), Evenki (aka Oroqen in China), Negidal and Solon (aka Ewenke in China).
\is{head\hyp{}driven agreement|(}
The major North Tungusic languages, Even and Evenki, deviate from the Tungusic prototype and exhibit head\hyp{}driven agreement as their general type (\citealt[11]{malchukov1995}; \citealt[18]{bulatova-etal1999}). Attributive nominalization and modifier\hyp{}headed possessor agreement occur in these two languages as well, even though these devices are restricted to specially marked noun phrase types.
\il{Even|(}
\paragraph*{Head\hyp{}driven agreement in Even}
According to \citet[20]{malchukov1995}, the occurrence of head\hyp{}driven agreement marking of adjectives in Even is determined by discourse-pragmatic factors: attributes in the rhematic (focus) position always agree with their heads, whereas agreement is optional in non-focus positions \citep[31–32]{malchukov1995}.\footnote{According to \citet[31]{malchukov1995}, regular head\hyp{}driven agreement occurs as the default type of adjective attribution marking only in literary Even and hence in prescriptive grammars. This does not reflect, however, the actual language use.}
%%%
\begin{exe}
\ex
\label{even raising}
{\rm “Attribute raising agreement” in Even \citep[30–31]{malchukov1995}}
\begin{xlist}
\ex
\label{even juxt}
{\rm Juxtaposition}\is{juxtaposition}\\
{\rm (A N-\textsc{number}-\textsc{case})}\\
\gll \textbf{Eŋi} beji-l-bu emu-re-m.\\
strong man-\textsc{pl}-\textsc{acc} bring-\textsc{nonfut}-\textsc{1sg}\\
\ex
\label{even numagr}
{\rm Incomplete head\hyp{}driven agreement}\\
{\rm (A-\textsc{number} N-\textsc{number}-\textsc{case})}\\
\gll \textbf{Eŋi-l} beji-l-bu emu-re-m.\\
strong-\textsc{pl} man-\textsc{pl}-\textsc{acc} bring-\textsc{nonfut}-\textsc{1sg}\\
\ex
\label{even agr}
{\rm Complete head\hyp{}driven agreement}\\
{\rm (A-\textsc{number}-\textsc{case} N-\textsc{number}-\textsc{case})}\\
\gll \textbf{Eŋi-l-bu} beji-l-bu emu-re-m.\\
strong-\textsc{pl}-\textsc{acc} man-\textsc{pl}-\textsc{acc} bring-\textsc{nonfut}-\textsc{1sg}\\
\glt ‘I have brought back only strong men.’
\end{xlist}
\end{exe}
%%%
\citet[30–31]{malchukov1995} describes the attributive agreement patterns in Even in a hierarchical way: the adjective modifier can agree in all morphological features of the head-noun (\ref{even agr}) or just in number (\ref{even numagr}). Juxtaposition is also possible but restricted to adjectives in non-focus position (\ref{even juxt}).
\is{head\hyp{}driven agreement|)}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Even (I)}
The “attribute raising agreement” illustrated in the previous section (\S\ref{even raising}) can be extended with a fourth step, specifically with adjective attributes marked by the “restrictive” (i.e., \isi{contrastive focus}) marker \textit{=takan/=teken} (here glossed as a nominalizer).
%%%
\begin{exe}
\ex
{\rm Even \citep[32]{malchukov1995}}
\begin{xlist}
\ex[]{
\gll \textbf{Eŋi-l-bu=tken} beji-l-bu emu-re-m.\\
strong-\textsc{pl}-\textsc{acc}=\textsc{nmlz} man-\textsc{pl}-\textsc{acc} bring-\textsc{nonfut}-\textsc{1sg}\\
}
%%%
\ex[*]{
\gll \textbf{Eŋi=tken} beji-l-bu emu-re-m.\\
strong=\textsc{nmlz} man-\textsc{pl}-\textsc{acc} bring-\textsc{nonfut}-\textsc{1sg}\\
\glt ‘I have brought back only strong men.’
}
\end{xlist}
\end{exe}
%%%
Attributes marked as “restrictive” obligatorily agree with the head noun \citep[32]{malchukov1995}. Noun phrases marked by means of \textit{=takan / =teken} thus resemble the attributive nominalization type, i.e., the attribute is marked as a syntactically complex constituent (i.e., as an embedded complement to the head noun) by means of nominalization.
\paragraph*{Attributive nominalization in Even (II)}
A second attributive nominalization strategy by means of the possessive suffix 3\textsuperscript{rd} person singular (in “determinative”\is{species marking!definite} function; here glossed as a nominalizer) is attested in an investigation of the non-possessive use of the possessive marker in different Turkic and Tungusic languages \citep{benzing1993b}.
%%%
\begin{exe}
\ex
{\rm Even \citep[17–18 Footnote 58]{benzing1993b}}\\
\gll hagdiŋata\textbf{-n} orolcemŋā\\
oldest-\textsc{nmlz} reindeer\_herder\\
\glt ‘the \textsc{oldest} reindeer herder’
\end{exe}
%%%
According to \citet[17–18 Footnote 58]{benzing1993b}, the “determinative”\is{species marking!definite} suffix \textit{-n} ($\Leftarrow$ \textsc{poss:3sg}) can be used as a marker of contrastive focus in Even.
\il{Even|)}
\is{attributive nominalization|)}
\il{Evenki|(}
\is{modifier\hyp{}headed possessor agreement|(}
\paragraph*{Modifier\hyp{}headed possessor agreement in Evenki}
Evenki follows the general Tungusic rule of head-final constituent ordering inside the noun phrase. In constructions emphasizing the property denoted by the attributive adjectives, however, the unmarked adjective-noun order can be reversed. In these constructions, the adjective is obligatorily equipped with the possessive suffix 3\textsuperscript{rd} person (singular or plural).
%%%
\begin{exe}
\ex
{\rm Evenki \citep[18]{bulatova-etal1999}}
\begin{xlist}
\ex
\gll \textbf{aja} bəjə\\
good man\\
\glt ‘good man’
\newpage
\ex
\label{evenki poss}
\gll bi: bəjə \textbf{aja-βa:-n} sa:-m\\
\textsc{1sg} man good-\textsc{acc}-\textsc{poss:3sg} know-\textsc{1sg}\\
\glt ‘I know the \textsc{good} man’
\end{xlist}
\end{exe}
%%%
According to \citet[18]{bulatova-etal1999}, the phrase final adjective ‘good’ marked with the possessive suffix is used as a true possessive noun in \REF{evenki poss} and they translate the example like this: ‘I know the man's goodness’. This construction, however, is similar to the modifier\hyp{}headed possessor agreement described for \ili{Oroch} (\ref{oroch modhead}) and Udege\il{Udege} (\citealt[485, passim]{nikolaeva-etal2001}).\footnote{Similar modifier\hyp{}headed constructions are found in Even where modifier\hyp{}headed possessor agreement is in fact attested, cf.~\textit{Asatkan \textbf{nood-do-n} haaram.} [girl beautiful-\textsc{acc}-\textsc{poss:3sg} I\_know] \citep[11]{malchukov1995}. But unlike similar modifier\hyp{}headed participles (in possessor agreement constructions) in Even \citep[31]{malchukov1995} and similar modifier\hyp{}headed adjectives in Oroch (\citealt{malchukov2000}, cf.~also example \ref{oroch modhead}) Malchukov translates this example as a true possessive construction with a nominal attribute: ‘I know the girl's beauty’ (but not: ‘I know the beautiful girl’).}
\il{Evenki|)}
\il{North Tungusic languages|)}
\is{modifier\hyp{}headed possessor agreement|)}
\il{Amur Tungusic languages|(}
\subsection{Amur Tungusic}
%%%
The Amur (aka South)\il{South Tungusic|see{Amur Tungusic languages}} branch of Tungusic consists of five languages. According to \citet[223]{salminen2007}, however, it is better to assume two separate subbranches, one of them comprising Udege\il{Udege} and \ili{Oroch} and the other comprising Nanay\il{Nanay} (aka Hejen\il{Hejen|see{Nanay}} in China), \ili{Ulcha} and \ili{Orok} (aka Uilta).\il{Uilta|see{Orok}}
\is{head\hyp{}driven agreement|(}
\il{Oroch-Udege languages|(}
\subsubsection{Oroch-Udege}
%%%
\paragraph*{Head\hyp{}driven agreement in Udege}
Head\hyp{}driven agreement in Udege is restrict\-ed to the feature \textsc{number}. Morphologically plural head nouns obligatorily trigger plural marking on the attributive adjective.
%%%
\begin{exe}
\ex
{\rm Udege \citep[468]{nikolaeva-etal2001}}\\
\gll uligdig'a\textbf{-ŋku} moxo-ziga bi-si-ti\\
beautiful\textsc{-pl} cup\textsc{-pl} be\textsc{-pst-3pl}\\
\glt ‘There were beautiful cups.’
\end{exe}
\is{head\hyp{}driven agreement|)}
\il{Oroch|(}
\is{modifier\hyp{}headed possessor agreement|(}
\paragraph*{Modifier\hyp{}headed possessor agreement in Oroch}
Similar to Evenki\il{Evenki} from the northern branch of Tungusic, the Udege-Oroch languages from the Amur branch exhibit modifier\hyp{}headed possessor agreement. Oroch examples for this type of adjective attribution marking have already been discussed in \S\ref{ModheadAgr} but will be repeated here.
%%%
\begin{exe}
\ex
\label{oroch modhead}
{\rm Oroch (\citealt[207]{avrorin-etal1967}; \citealt[3]{malchukov2000})}
\begin{xlist}
\ex
\gll nia \textbf{aja-ni}\\
man good-\textsc{poss:3sg}\\
\glt ‘a \textsc{good} man’
\ex
\gll nia-sa \textbf{aja-ti}\\
man-\textsc{pl} good-\textsc{poss:3pl}\\
\glt ‘\textsc{good} men’
\end{xlist}
\end{exe}
%%%
Whereas \isi{juxtaposition} is the default type of adjective attribution marking in Oroch, modifier\hyp{}headed possessor agreement occurs only in a special noun phra\-se type where the adjective is marked for contrastive focus. The special function marked by this construction is to focus on the property denoted by the adjective: ‘a man, a property of whom is “to be good”’ \citep[3]{malchukov2000}. This noun phrase type thus resembles the function of relative clause\is{adnominal modifier!relative clause} formation.\footnote{Note also that a similar construction is found in Even\il{Even} from the Northern Tungusic branch where it is only attested with participles: \textit{Beji-l-bu \textbf{hör-če-wut-ten} emu-re-m.} [man-\textsc{pl}-\textsc{acc} go-\textsc{pfct.ptcp}-\textsc{acc}-\textsc{poss:3pl} bring-\textsc{nonfut}-\textsc{1sg}] ‘I brought back the men who had left’ \citep[31]{malchukov1995}.}
\il{Oroch|)}
\il{Oroch-Udege languages|)}
\is{modifier\hyp{}headed possessor agreement|)}
\il{Nanay-Ulcha-Orok languages|(}
\subsubsection{Nanay-Ulcha-Orok}
%%%
\il{Orok|(}
According to the few grammatical sketches available, the Tungusic languages of the Nanay-Ulcha-Orok branch exhibit \isi{juxtaposition} as the default device for adjective attribution marking, except Orok.
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Orok}
Attributive adjectives in Orok (also known as Ulta)\il{Ulta|see{Orok}} show agreement in number but not in case (or other categories) with the modified noun.
%%%
\begin{exe}
\ex
{\rm Orok \citep[55]{petrova1967}}
\begin{xlist}
\ex
\gll \textit{\textbf{dāi}} \textit{dalu(n)}\\
big store\\
\glt ‘big store (i.e., warehouse, storehouse)’
\ex
\gll \textit{\textbf{dāi-l}} \textit{dalu-l}\\
big-\textsc{pl} store-\textsc{pl}\\
\glt ‘big stores’
\ex
\gll \textit{\textbf{dāi-l}} \textit{dalu-l-tai}\\
big-\textsc{pl} store-\textsc{pl}-\textsc{loc}\\
\glt ‘in big stores’
\end{xlist}
\end{exe}
\il{Orok|)}
\is{head\hyp{}driven agreement|)}
\il{Ulcha|(}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Ulcha}
According to \citet[36, 52–53]{sunik1985}, adjectives do not “normally” agree with the modified noun in Ulcha. The language is thus characterized by simple \isi{juxtaposition} of attributive adjectives.\footnote{\citet[36]{sunik1985} mentions, however, that a few adjectives sometimes show agreement with the modified noun in case and number (according to the simple or the possessive declension (sic!), i.e., are equipped with a possessive suffix) if they are “derived into nouns”. Unfortunately, he does not provide examples.}
Another adjective attribution marking device mentioned in Sunik's grammar is attributive nominalization by means of the suffix \textit{-d\.uma \textasciitilde-dumE} \citep{sunik1985}.
%%%
\begin{exe}
\ex
{\rm Ulcha \citep[38]{sunik1985}}
\begin{xlist}
\ex \textit{n'ūči-dumE} {\rm ‘a/the little one (among other people)’}
\ex \textit{ulEn-dumE} {\rm ‘a/the good one (among other people)’}
\end{xlist}
\end{exe}
\il{Ulcha|)}
\il{Nanay-Ulcha-Orok languages|)}
\il{Amur Tungusic languages|)}
\is{attributive nominalization|)}
\il{Manchu languages|(}
\subsection{Manchu}
The two Manchu languages \ili{Manchu} proper and \ili{Sibe} exhibit \isi{juxtaposition} as the default adjective attribution marking device, similarly to the languages from the Nanay-Ulcha-Orok\il{Nanay-Ulcha-Orok languages} branch.
\il{Manchu languages|)}
\il{Tungusic languages|)}
\il{Yukaghir languages|(}
\section{Yukaghir}
\label{yukagir synchr}
%%%
Yukaghir (aka Yukagir)\il{Yukagir|see{Yukaghir languages}} is a small family consisting of the two individual languages Tundra Yukaghir\il{Tundra Yukaghir} and Kolyma Yukaghir\il{Kolyma Yukaghir} (aka Forest Yukaghir)\il{Forest Yukaghir|see{Kolyma Yukaghir}} (\citealt[223]{salminen2007}; \citealt[1–2]{maslova2003a}; \citealt[1]{maslova2003b}).
Noun phrases show strictly head-final constituent order in both Yukaghir languages. True adjective attribution scarcely exists because modifying “property words” in noun phrases are best coded as relative clauses.\is{adnominal modifier!relative clause}
%Martin: But (77) from Korean and (79a) from Dungan are also rel. clauses\\Micha: but there is no special attr-marking here
The following relevant attribution marking types are attested in Yukaghir languages:
%%%
\begin{itemize}
\item incorporation
\item anti\hyp{}construct state marking
\subitem of “verbal adjectives”
\subitem of “nominal adjectives”.
\end{itemize}
%%%
\il{Kolyma Yukaghir|(}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Kolyma Yukaghir}
There is no large class of lexical adjectives in Yukaghir. The only true adjectives in both Yukaghir languages belong to two semantic pairs: ‘small’ versus ’big’ and ‘old, ancient’ versus ‘new, fresh; (an)other’. The use of adjectives from the first pair is even restricted to a few lexicalized expressions \citep[70–71]{maslova2003b}. It is hard to categorize these adjectives according to their morpho-syntax. \citet[71]{maslova2003b} glosses the lexicalized expressions with the adjectives ‘small’ and ‘big’ as compounds, like in \textit{čom+parnā} [big+crow] ‘raven’. The adjective ‘new’, on the other hand can not only be used in such compounds but can even be marked additionally by the noun attribution suffix \textit{-d} or by the action nominal suffix \textit{-l} \citep[71]{maslova2003b}.
\is{juxtaposition|)}
\paragraph*{Anti\hyp{}construct state in Kolyma Yukaghir}
With the exception of the very small closed class described in the previous section, there are no adjectives in Kolyma Yukaghir (\citealt[79–112]{krejnovic1982}; \citealt[66–69, 145–147]{maslova2003b}). All other words denoting qualities constitute a subclass of verbs. Used as attributes, these \isi{stative verb}s take the 3\textsuperscript{rd} person singular intransitive suffix \mbox{\textit{-j(e)}}.\footnote{Note that this morpheme takes different phonological shapes as the result of allomorphic alternations.} The inflected finite verbs, as in \REF{yuk attr}, are described as “special attributive forms” by \citet[66, passim]{maslova2003b}. Syntactically, they have to be analyzed as juxtaposed relative clauses.\is{adnominal modifier!relative clause}
%%%
\begin{exe}
\ex
{\rm Kolyma Yukaghir \citep{maslova2003b}}
\begin{xlist}
\ex
\label{yuk attr}
{\rm Attribution}
\begin{xlist}
\ex
\gll \textbf{kellugī-je} šoromo\\
lazy-\textsc{attr:intr.3sg} person\\
\glt ‘lazy man (lit. ‘man who is lazy’)’ (146)
\ex
\gll \textbf{kie-s'e} šoromo\\
come-\textsc{attr:intr.3sg} person\\
\glt ‘man who comes’ (67)
\end{xlist}
\ex
\label{yuk pred}
{\rm Predication}\is{predicative marking}
\begin{xlist}
\ex
\gll id'ī pen \textbf{omo-s'}\\
here it good-\textsc{pred:intr.3sg}\\
\glt ‘this is a nice place (lit. ‘here, it is good’)’ (68)
\end{xlist}
\end{xlist}
\end{exe}
%%%
\largerpage %longdistance
Since verbs take different inflectional suffixes depending on their use as predicates or attributes (i.e., relative clauses, cf.~\ref{yuk attr}, \ref{yuk pred}) the suffix \textit{-j(e)} glossed as \textsc{attr:intr.3sg} can only be analyzed as an anti\hyp{}construct state marker, i.e., it constitutes a dependent\hyp{}marking attribution device which is not connected to noun phrase internal agreement. Even though the marker belongs to the verbal inflection paradigm it is a true licenser of the attributive relationship between a modifying verb phrase (relative clause)\is{adnominal modifier!relative clause} and a noun.
Anti\hyp{}construct state marking in Kolyma Yukaghir does not, however, belong to the domain of true adjective attribution marking but is a relative clause\is{adnominal modifier!relative clause} marking strategy.\footnote{In order to use a verb as modifier inside a noun phrase, the verb can also be nominalized, for example by means of an action nominal marker: \textit{kel-u-l} [come-0-\textsc{nmlz} ‘(a situation of) coming’ \citep[147]{maslova2003b}, \textit{kel-u-l šoromo} [come-0-\textsc{nmlz} person] ‘(a/the) man who came (i.e., (a/the) already arrived man)’ \citep[67]{maslova2003b}. This derivational nominalization of verbs to nominals is not considered to constitute an adjective attribution marking device either.}
\il{Kolyma Yukaghir|)}
\il{Tundra Yukaghir|(}
\paragraph*{Anti\hyp{}construct state in Tundra Yukaghir}
Tundra Yukaghir exhibits an anti\hyp{}construct state marking device of verbs using a relative clause\is{adnominal modifier!relative clause} marking strategy similar to Kolyma Yukaghir\il{Kolyma Yukaghir} \citep[49–50, passim]{maslova2003a}. In her short grammar, \citet{maslova2003a} mentions the occurrence of a second anti\hyp{}construct state marking device and gives the following example:
%%%
\begin{exe}
\ex
{\rm Tundra Yukaghir \citep[50]{maslova2003a}}\\
\gll lugu-je(\textbf{-d}) apanalā\\
very\_old-\textsc{attr:intr.3sg}-\textsc{attr} woman\\
\glt ‘very old woman’
\end{exe}
%%%
The use of the marker \textit{-d} is not obligatory and is even restricted to head nouns with vowel-initial stems \citep[50]{maslova2003a}.
Interestingly, the second attribution marking device in Tundra Yukaghir is polyfunctional and regularly serves the licensing of single nouns (\ref{yuk nounattr}) as well as complex noun phrases\is{adnominal modifier!noun} (\ref{yuk npattr}) as attributes.
%%%
\begin{exe}
\ex
{\rm Tundra Yukaghir \citep{maslova2003a}}
\begin{xlist}
\ex
\label{yuk nounattr}
\gll iŋli\textbf{-d} igije\\
breast-\textsc{attr} ropes\\
\glt ‘breast ropes’ (49)
\ex
\label{yuk npattr}
\gll tude kerewe\textbf{-d} ugurt'e\\
\textsc{3sg} cow-\textsc{attr} legs\\
\glt ‘the legs of his cow’\footnote{The regular use of the cognate attribution marker \textit{-d} (\textit{\textasciitilde-n}) with nouns and noun phrases as attributes is described for Kolyma Yukaghir as well. The use of the marker as a licenser of adjective attribution, however, seems to be restricted to one adjective, ‘new’ \citep[71]{maslova2003b}.} (44)
\end{xlist}
\end{exe}
\il{Tundra Yukaghir|)}
\il{Yukaghir languages|)}
\il{Yeniseian languages|(}
\il{Ket|(}
\section{Yeniseian}
\label{yeniseian synchr}
%%%
Three branches are posited for the Yeniseian family, but only the Ket language from the northern branch still exists today (\citealt{werner1997a}; \citealt[223]{salminen2007}).
\is{head\hyp{}driven agreement|(}
\is{juxtaposition|(}
The following adjective attribution marking devices are attested in Ket:
%%%
\begin{itemize}
\item juxtaposition
\item head\hyp{}driven agreement
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\paragraph*{Juxtaposition and head\hyp{}driven agreement in Ket}
Attributive adjectives in Ket are normally juxtaposed to the left of the noun they modify \citep[38]{vajda2004}. Only a few simple adjective stems describing visible shapes or sizes may optionally take the plural suffix \textit{-ŋ}, as shown in \REF{ket agr}. The other morphological features assigned to the noun phrase, i.e., gender (or class) and case, are not sensitive to syntax in Ket.
%%%
\begin{exe}
\ex
\label{ket agr}
{\rm Ket \citep[38]{vajda2004}}
\begin{xlist}
\ex
\gll \textbf{qà} quˀŋ\\
big tent:\textsc{pl}\\
\ex
\gll \textbf{qēŋ} quˀŋ\\
big:\textsc{pl} tent:\textsc{pl}\\
\glt ‘big tents’
\end{xlist}
\end{exe}
%%%
\citet[38]{vajda2004} notes that the optional number agreement marking is “a stylistic device used to emphasize the visual impression created by the quality being described”. This emphasizing construction probably marks \isi{contrastive focus} of the adjective: ‘big tents’ versus ‘\textsc{big} tents’.
\is{juxtaposition|)}
\is{head\hyp{}driven agreement|)}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Ket}
\citet[15, 84–85]{vajda2004} also mentions the nominalizing suffix \textsc{-s} which marks lexical and derived adjectives (\ref{ket adjn nmlz}), noun phrases\is{adnominal modifier!noun} (\ref{ket np nmlz}), and adposition phrases\is{adnominal modifier!adposition phrase} (\ref{ket ap nmlz}) as adnominal modifiers in \isi{headless noun phrase}s.\footnote{Note that the examples (\ref{ket np nmlz} and \ref{ket ap nmlz}) seem to represent phonological compounds. This is evidenced by the phonological reduction in syllable-mediate vowels. The non-nominalized phrases, according to \citet{vajda2005} are \textit{úgda ɔ́lin} ‘a long nose’ and \textit{qō-t-hɯtɯ-ɣa} ‘under the ice [ice-\textsc{gen}-under]’. It is not clear from the description, however, if incorporation is relevant to morpho-syntax as well. But this phenomenon deserves further attention since adjective incorporation is scarcely attested in the world's languages but occurs in a few other non-related branches of the northern Eurasia.}
%%%
\begin{exe}
\ex
{\rm Ket \citep{vajda2005}}
\begin{xlist}
\ex
\label{ket adjn nmlz}
{\rm Nominalized adjective}
\begin{xlist}
\ex
\gll sîn\textbf{-s}\\
old-\textsc{nmlz}\\
\glt ‘the old one’
\ex
\gll súl-tu\textbf{-s}\\
blood-\textsc{deriv-nmlz}\\
\glt ‘the bloody one’
\end{xlist}
%%%
\ex
\label{ket np nmlz}
{\rm Nominalized noun phrase}
\begin{xlist}
\ex
\gll úgd-ɔ́lin\textbf{-s}\\
long-nose-\textsc{nmlz}\\
\glt ‘the long-nosed one’
\end{xlist}
%%%
\ex
\label{ket ap nmlz}
{\rm Nominalized adposition phrase}
\begin{xlist}
\ex
\gll qó-t-{hɯtɯ-ɣa}\textbf{-s}\\
ice-\textsc{gen}-under-\textsc{nmlz}\\
\glt ‘the one under the ice’
\end{xlist}
\end{xlist}
\end{exe}
%%%
Grammatical descriptions of Ket (\citealt{vajda2004}, cf.~also \citealt{krukova2007}) only give examples where these nominalized (headless) noun phrases\is{headless noun phrase} are used in apposition, as in the \isi{contrastive focus} construction (\ref{ket contrfoc}).
%%%
\begin{exe}
\ex
\label{ket contrfoc}
{\rm Ket \citep{vajda2005}}
\begin{xlist}
\ex
{\rm Adjective predication}\\
\gll bū \textbf{sîn-du} / bū \textbf{sîn-dʌ}\\
3\textsc{sg} old-\textsc{m.cop} { } 3\textsc{sg} old-\textsc{f.cop}\\
\glt ‘s/he is old’
\ex
{\rm Contrastive focus construction}\\
\gll bū \textbf{sîn-s}\\
3\textsc{sg} old-\textsc{nmlz}\\
\glt ‘s/he is \textsc{old} (i.e., ‘an old one’)’
\end{xlist}
\end{exe}
%%%
The available data does not provide enough evidence for a detailed description and analyses of attributive nominalization by means of the suffix \textit{-s} as a regular attribution marking device in Ket. It it possible that these nominalizations cannot be used as true modifiers of nouns but are restricted to \isi{headless noun phrase}s and are used only in special \isi{contrastive focus} constructions.
There is even evidence against the analysis of nominalization as attributive marking in Ket. Vajda's examples of nominalized adverbials suggest that this contrastive focus marking is used predominantly in copular constructions (as predicates). Since the otherwise regular predicative agreement marking\is{predicative marking} never occurs on these nominalizations \citep[15]{vajda2004} it could also be argued that the nominalizer \textit{-s} constitutes a strategy for secondary predication marking rather than attribution marking.
Attributive nominalization in Ket definitely deserves more attention. The construction might constitute an example of the development of attributive nominalization independent of definiteness marking.\is{species marking!definite}
\il{Ket|)}
\il{Yeniseian languages|)}
\is{attributive nominalization|)}
\il{Turkic languages|(}
\section{Turkic}
%%%
Languages from the Turkic language family are spoken across all of northern Eurasia, including northeastern and southeastern \isi{Europe}, and beyond. The family is divided into two major branches: Bulgar and Common Turkic. Whereas Bulgar Turkic\il{Bulgar Turkic languages} is represented only by one language, the Common Turkic\il{Common Turkic languages} branch can be further divided into nine groups. Seven of these groups have members spoken in northern Eurasia: Oguz,\il{Oguz languages} Karluk,\il{Karluk languages} Kipchak,\il{Kipchak languages} Altay Turkic,\il{Altay Turkic languages} Yenisey Turkic\il{Yenisey Turkic languages} (Khakas),\il{Khakas|see{Yenisey Turkic languages}} Sayan Turkic,\il{Sayan Turkic languages} and Lena Turkic\il{Lena Turkic languages} \citep[221]{salminen2007}.
\is{juxtaposition|(}
All Turkic languages are characterized by strict head-finality in their noun phrase structure. The prototypical adjective attribution marking device in Turkic languages is juxtaposition. This type occurs as the unmarked construction in all Turkic languages. In some Turkic languages, however, an attributive nominalizer marks an attributive adjective in \isi{contrastive focus} constructions. This construction is systematically described (more or less) only for Chuvash\il{Chuvash} from the Bulgar Turkic branch.
The following types of adjective attribution marking are attested:
%%%
\begin{itemize}
\item juxtaposition
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\il{Bulgar Turkic languages|(}
\subsection{Bulgar Turkic}
The Bulgar (aka Oghur)\il{Oghur Turkic|see{Bulgar Turkic languages}} subbranch of the Turkic language family is represented only by a single language, Chuvash.
\il{Chuvash|(}
\is{attributive nominalization|(}
\paragraph*{Juxtaposition and attributive nominalization in Chuvash}
\label{chuvash synchr}
Similar to all other Turkic languages, Chuvash exhibits juxtaposition as the default and general adjective attribution marking device (\ref{chuvash juxt}). Besides juxtaposition, an attributive nominalizer is used in \isi{contrastive focus} constructions (\ref{chuvash attr}).
%%%
\begin{exe}
\ex
{\rm Chuvash \citep{clark1998a}}
\begin{xlist}
\ex
\label{chuvash juxt}
{\rm Juxtaposition}\\
\gll \textbf{χura} χut\\
black paper\\
\glt ‘black paper’
%%%
\ex
\label{chuvash attr}
{\rm Attributive nominalization}\\
\gll \textbf{χur-i} χut\\
black-\textsc{attr} paper\\
\glt ‘\textsc{black} paper (not of another color)’
\end{xlist}
\end{exe}
%%%
The attributive article \textit{-i} is similar to the possessive suffix 3\textsuperscript{rd} singular. As in other Turkic languages, this article is also obligatorily used in \isi{headless noun phrase}s marked as direct (accusative) objects in Chuvash.
%Contrastive focus, not definiteness (a black one / the black one
%Verschiedene Allomorphieregeln mit Poss3sg
\is{juxtaposition|)}
%%%
\begin{exe}
\ex
\label{chuvash headless acc}
{\rm Attributive nominalization in Chuvash \citep[7]{benzing1993b}}\\
\gll \textbf{χur-i-ne} / \textbf{χĕrl-i-ne} ildem\\
black-\textsc{attr}-\textsc{acc} { } red-\textsc{attr}-\textsc{acc} I\_bought\\
\glt (Which pen did you buy?) ‘I bought a/the black / red one.’
\end{exe}
%%%
Besides \textit{-i}, a second nominalizer \textit{-sker} is attested in Chuvash. Both formatives are used with similar classes of adjectival and other attributes.
%%%
\begin{exe}
\ex
{\rm Attributive nominalization in Chuvash \citep{krueger1961}}
\begin{xlist}
\ex
{\rm Article \#1 \textit{-i} ($\Leftarrow$ \textsc{poss:3sg})}
\begin{xlist}
\ex
{\rm Attributive adjective}\\
\gll lajăχχ-i\\
good-\textsc{attr}\\
\glt ‘which is good / (a/the) good one’
\ex
{\rm Attributive participle}\\
\gll vulan-i\\
read.\textsc{prf}-\textsc{attr}\\
\glt ‘which is read’
\ex
{\rm Attributive noun}\\
\gll vărman-t-i\\
forest-\textsc{loc}-\textsc{attr}\\
\glt ‘which is in the forest’
\end{xlist}
\ex
{\rm Article \#2 \textit{-sker} (<~Mari\il{Mari languages} \textit{ÿsker})}
\begin{xlist}
\ex
{\rm Attributive adjective}\\
\gll lajăχ-sker\\
good-\textsc{attr}\\
\glt ‘which is good / (a/the) good one’
\ex
{\rm Attributive participle}\\
\gll vulană-sker\\
read.\textsc{prf}-\textsc{attr}\\
\glt ‘which is read’
\ex
{\rm Attributive noun}\\
\gll vărman-ta-sker\\
forest-\textsc{loc}-\textsc{attr}\\
\glt ‘which is in the forest’
\end{xlist}
\end{xlist}
\end{exe}
\il{Chuvash|)}
\il{Bulgar Turkic languages|)}
\is{attributive nominalization|)}
\il{Common Turkic languages|(}
\subsection{Common Turkic}
%%%
\il{Oguz languages|(}
\subsubsection{Oguz}
%%%
\is{juxtaposition|(}
\paragraph*{Juxtaposition in \ili{Azerbaijani}}
Similar to all other Turkic languages, attributive adjectives are simply juxtaposed to the modified noun in Azerbaijani.
%%%
\begin{exe}
\settowidth\jamwidth{[\textbf{high} mountain-\textsc{pl}-\textsc{loc}]}
\ex
\label{azerb juxt}
{\rm Azerbaijani \citep[59–60]{siraliev-etal1971}}
\begin{xlist}
\ex \textbf{uča} daɣ {\rm ‘high mountain’} \jambox{{\rm [\textbf{high} mountain(\textsc{nom})]}}
\ex \textbf{uča} daɣ-ɨn \jambox{{\rm [\textbf{high} mountain-\textsc{gen}]}}
\ex \textbf{uča} daɣ-da \jambox{{\rm [\textbf{high} mountain-\textsc{loc}]}}
\ex \textbf{uča} daɣ-lar \jambox{{\rm [\textbf{high} mountain-\textsc{pl}]}}
\ex \textbf{uča} daɣ-lar-da \jambox{{\rm [\textbf{high} mountain-\textsc{pl}-\textsc{loc}]}}
\ex \dots
\end{xlist}
\end{exe}
\is{juxtaposition|)}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in \ili{Turkish}}
\label{turkish synchr}
Similar to other Turkic languages, the attributive nominalization device is used obligatorily in \isi{headless noun phrase}s marked as direct (accusative) objects in Turkish.
%%%
\begin{exe}
\ex
\label{turkish headless acc}
{\rm Attributive nominalization in Turkish \citep[7]{benzing1993b}}\\
\gll \textbf{kara-sını} / \textbf{kızıl-ını} aldım\\
black-\textsc{attr:acc} { } red-\textsc{attr:acc} I\_bought\\
\glt (Which pen did you buy?) ‘I bought a/the black / red one.’
\end{exe}
\il{Oguz languages|)}
\il{Karluk languages|(}
\subsubsection{Karluk}
%%%
The default and general adjective attribution marking device in the languages of the Karluk subbranch of Common Turkic is \isi{juxtaposition} and is similar to example (\ref{azerb juxt}) from Azerbaijani.\il{Azerbaijani} Besides juxtaposition, attributive nominalization is also attested.
\paragraph*{Attributive nominalization in \ili{Uigur}}
The possessive suffix 3\textsuperscript{rd} person singular occurs as an attributive nominalizer in \isi{contrastive focus} constructions in Uigur. This construction is thus similar to example (\ref{chuvash attr}) from \ili{Chuvash} from the Bulgar branch of Turkic.
%%%
\begin{exe}
\ex
{\rm Uigur \citep[17–18, Footnote 58]{benzing1993b}}\\
\gll \textbf{uluy-ï} qatun\\
biggest-\textsc{attr} woman\\
\glt ‘the \textsc{first} wife’
\end{exe}
\paragraph*{Attributive nominalization in \ili{Uzbek}}
Similar to other Turkic languages, the article is also used obligatorily in \isi{headless noun phrase}s marked as direct (accusative) objects in Uzbek.
%%%
\begin{exe}
\ex
\label{uzbek headless acc}
{\rm Attributive nominalization in Uzbek \citep[371]{boeschoten1998}}\\
\gll {(mėŋȧ qaysisi yarašadi,)} \textbf{qizilim-i}, \textbf{åqim-i}?\\
{ } red-\textsc{attr:acc} white-\textsc{attr:acc}\\
\glt ‘(Which one suits me,) the red one, or the white one?’
\end{exe}
\il{Karluk languages|)}
\is{attributive nominalization|)}
\il{Kipchak languages|(}
\il{Altay Turkic languages|(}
\il{Yenisey Turkic languages|(}
\il{Sayan Turkic languages|(}
\il{Lena Turkic languages|(}
\subsubsection{Kipchak, Altay, Yenisey, Sayan, Lena}
%%%
The default and general adjective attribution marking device in the languages of the Kipchak, Altay, Yenisey (aka Khakas), Sayan and Lena subbranchs of Common Turkic is \textbf{\isi{juxtaposition}} and is similar to example (\ref{azerb juxt}) from Azerbaijani.\il{Azerbaijani}
\il{Kipchak languages|)}
\il{Altay Turkic languages|)}
\il{Yenisey Turkic languages|)}
\il{Sayan Turkic languages|)}
\il{Lena Turkic languages|)}
\il{Common Turkic languages|)}
\il{Turkic languages|)}
\il{Nakh-Daghestanian languages|(}
\section{Nakh-Daghestanian}
%%%
Nakh-Daghestanian is a language family of the Caucasus\is{Caucasus}. It is named after its two main branches: Nakh\il{Nakh languages} and Daghestanian.\il{Daghestanian languages} Whereas Nakh comprises only a few single languages, the Daghestanian branch can be further divided into several subbranches \citep[220, 233]{salminen2007}.
The predominant order of noun phrase constituent in Nakh-Daghestanian languages is adjective-noun. Regarding the morpho-syntactic licensing of adjective attribution, the Nakh-Daghestanian family is characterized by a relatively high diversity of noun phrase types.
The following adjective attribution marking devices are attested:
%%%
\begin{itemize}
\item juxtaposition\is{juxtaposition}
\item head\hyp{}driven agreement marking\is{head\hyp{}driven agreement}
\item anti\hyp{}construct state agreement marking
\item anti\hyp{}construct state marking
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\il{Daghestanian languages|(}
\subsection{Daghestanian}
%%%
\il{Avar-Andi-Tsezic languages|(}
\subsubsection{Avar-Andi-Tsezic}
%%%
The Avar-Andi-Tsezic group of Daghestanian is named after three groups of closely related languages: Andi\il{Andi languages} (comprising the languages Akhvakh,\il{Akhvakh} Andi,\il{Andi} Bagvalal,\il{Bagvalal} Botlikh,\il{Botlikh} Chamalal,\il{Chamalal} Godoberi,\il{Godoberi} Karata\il{Karata} and Tindi),\il{Tindi} Tsezic\il{Tsezic languages} (comprising the languages Tsez\il{Tsez} (aka Dido),\il{Dido|see{Tsez}} \ili{Hinuq}, \ili{Khwarshi}, Inkhokvari,\il{Inkhokvari} Bezhta\il{Bezhta} (aka Kapucha)\il{Kapucha|see{Bezhta}} and \ili{Hunzib}. The single language \ili{Avar} forms the third group of Avar-Andi-Tsezic \citep[220, 233]{salminen2007}.
\is{head\hyp{}driven agreement|(}
The prototype of adjective attribution marking in the Avar-Andi-Tsezic languages seems to be head\hyp{}driven agreement, which occurs in all languages of this group.
\il{Godoberi|(}
\paragraph*{Head\hyp{}driven agreement in Godoberi}
The unmarked constituent order in Godoberi is adjective-noun.\footnote{The reversed order marks \isi{contrastive focus} on the adjective: \textit{hac'a χ°aji} [white dog] ‘white dog’, \textit{χ°aji hac'a} [dog white] ‘that very dog (of several others) which is white’ \citep[149]{kazenin1996a}.} Adjectives agree with the head noun in the features \textsc{gender} (if a position for the class-marker is available) and \textsc{number}.
%%%
\begin{exe}
\ex
\settowidth\jamwidth{[\textsc{n.pl}]}
{\rm Godoberi \citep[25]{tatevosov1996a}}
\begin{xlist}
\ex
{\rm Adjectives taking a gender class prefix}
\begin{xlist}
\ex \textbf{w-oχar} ima {\rm ‘old father’} \jambox{{\rm [\textsc{m}]}}
\ex \textbf{j-aχar} ila {\rm ‘old mother’} \jambox{{\rm [\textsc{f}]}}
\ex \textbf{b-aχar} hamaχi {\rm ‘old donkey’} \jambox{{\rm [\textsc{n}]}}
\ex \textbf{r-aχar} hamaχi-be {\rm ‘old donkeys’} \jambox{{\rm [\textsc{n.pl}]}}
\end{xlist}
\ex
{\rm Adjectives taking a gender class suffix}
\begin{xlist}
\ex \textbf{q'arúma-w} ima {\rm ‘greedy father’} \jambox{{\rm [\textsc{m}]}}
\ex \textbf{q'aruma-j} ila {\rm ‘greedy mother’} \jambox{{\rm [\textsc{f}]}}
\ex \textbf{q'arúma-b} hamaχi {\rm ‘greedy donkey’} \jambox{{\rm [\textsc{n}]}}
\ex \textbf{q'arúma-r} hamaχi-be {\rm ‘greedy donkeys’} \jambox{{\rm [\textsc{n.pl}]}}
\end{xlist}
\end{xlist}
\end{exe}
\il{Godoberi|)}
\is{head\hyp{}driven agreement|)}
\il{Tsez|(}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Tsez}
In Tsez, two lexical classes of adjectives have to be distinguished. The members of the first class take gender agreement prefixes. The (few) members of the second class are simply juxtaposed to the modified noun \citep[126]{alekseev-etal2004}.
There is an additional attributive marker: the attributive nominalizing suffix \textit{-ni} which marks attributive adjectives in \isi{headless noun phrase}s and also “restrictive” forms of the adjective.
%%%
\begin{exe}
\ex
{\rm Tsez \citep{alekseev-etal2004}}
\begin{xlist}
\ex
{\rm Nominalized headless adjective}
\begin{xlist}
\ex
\gll igu\textbf{-n}-a:\\
good-\textsc{attr}-\textsc{erg}\\
\glt ‘a good one’
\ex
\gll igu\textbf{-ni}-r\\
good-\textsc{attr}-\textsc{dat}\\
\glt ‘to a good one’
\end{xlist}
\ex
{\rm “Restrictive” attributive adjective}
\begin{xlist}
\ex
\label{Tsez restr}
\gll (eyda) \textbf{eġe-ni} uži dey esiy yoɬ\\
this little-\textsc{attr} boy \textsc{1:gen} brother:\textsc{nom} be:\textsc{prs}\\
\glt ‘(this) little boy (and not one of the others) is my brother’
\end{xlist}
\end{xlist}
\end{exe}
%%%
The content of the “restrictive” (aka “definite”)\is{species marking!definite} form remains somewhat uncertain. The translation of (\ref{Tsez restr}) in the description of \citet[128]{alekseev-etal2004} clearly resembles \isi{contrastive focus} marking (‘the \textsc{little} boy’).
\il{Tsez|)}
\il{Avar-Andi-Tsezic languages|)}
\is{attributive nominalization|)}
\il{Lak|(}
\subsubsection{Lak}
%%%
The Lak subbranch of Daghestanian is formed by one single language: Lak proper.
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Lak}
Constituent order in Lak is adjective-noun. The language exhibits two adjective attribution marking devices. The unmarked and default attribution marking device is head\hyp{}driven agreement which characterizes adjectives derived by means of the adjectivizer\is{adjective derivation} \mbox{\textit{-ssa}}, as in \REF{lak hdragr}. These derived adjectives only agree in gender class. Other morpho-syntactic marking is not applied.
%%%
\begin{exe}
\ex
\label{lak hdragr}
{\rm Lak \citep[48]{zirkov1955}}
\begin{xlist}
\ex
\gll \textbf{uč-ssa} adimina\\
fat.\textsc{I}-\textsc{adjz} person(\textsc{I})\\
\glt ‘fat man’
\ex
\gll \textbf{b-uč-ssa} nic\\
\textsc{III}-fat-\textsc{adjz} bull\textsc{(III)}\\
\glt ‘fat bull’
\ex
\gll \textbf{b-uč-ssa} nic-ru\\
\textsc{III}-fat-\textsc{adjz} bull\textsc{(III)}-\textsc{pl}\\
\glt ‘fat bulls’
\end{xlist}
\end{exe}
%%%
Note that the suffix \textit{-ssa} is a derivational formative rather than a marker of attribution since it occurs on adjectives in attributive and predicative position alike. Predicative adjectives\is{predicative marking} even show similar gender agreement inflection \citep[45–51]{zirkov1955}.
\is{head\hyp{}driven agreement|)}
\paragraph*{Anti\hyp{}construct state agreement in Lak}
While \isi{head\hyp{}driven agreement} marking, as in \REF{lak hdragr}, constitutes the basic and unmarked adjective attribution marking device in Lak, anti\hyp{}construct state agreement marking is restricted to \isi{contrastive focus} constructions.
%%%
\begin{exe}
\ex
{\rm Lak \citep[45]{zirkov1955}}
\begin{xlist}
\ex
\gll \textbf{uč-ma} adimina\\
fat.\textsc{I}-\textsc{attr:I} person\textsc{(I)}\\
\glt ‘\textsc{fat} man’
\ex
\gll \textbf{b-uč-mur} nic\\
\textsc{III}-fat-\textsc{attr:III} bull\textsc{(III)}\\
\glt ‘\textsc{fat} bull’
\ex
\gll \textbf{buč-mi} nic-ru\\
\textsc{III}-fat-\textsc{attr:pl} bull\textsc{(III)}-\textsc{pl}\\
\glt ‘\textsc{fat} bulls’
\end{xlist}
\end{exe}
%%%
Note that the occurrence of the anti\hyp{}construct state agreement marking suffixes \textit{-ma, -mur, -mi} is restricted to attributive adjectives. Unlike adjectives with the derivational formative \textit{-ssa} with \isi{head\hyp{}driven agreement} marking in number only, adjectives in \isi{contrastive focus} (occurring in the anti\hyp{}construct state agreement noun phrase type) show agreement in number as well \citep[45–51]{zirkov1955}.
\il{Lak|)}
\il{Dargwa|(}
\subsubsection{Dargwa}
%%%
The Dargwa subbranch of Daghestanian has traditionally been described as consisting of one single language (i.e., Dargwa proper) with several sub-varieties \citep[233]{salminen2007}. According to \citet{korjakov2006a}, Dargwa varieties exhibit fairly diverse grammatical structures and can therefore be described as separate languages.
\is{juxtaposition|(}
\paragraph*{Anti\hyp{}construct state agreement and juxtaposition in Dargwa}
In Dargwa, two adjective attribution marking devices occur. Whereas anti\hyp{}construct state (number) agreement marking (\ref{dargwa anti}) is the default type, juxtaposition (\ref{dargwa juxt}) is restricted to “poetic language” \citep[318]{isaev2004}.
\begin{exe}
\ex
{\rm Dargwa \citep[318]{isaev2004}}
\begin{xlist}
\ex
\label{dargwa anti}
{\rm Anti\hyp{}construct state agreement}
\begin{xlist}
\ex
\gll \textbf{aɢ-si} ɢali\\
high-\textsc{attr:sg} house(\textsc{sg})\\
\glt ‘lofty house’
\ex
\gll \textbf{aɢ-ti} ɢulri\\
high-\textsc{attr:pl} house:\textsc{pl}\\
\glt ‘lofty houses’
\end{xlist}
\ex
\label{dargwa juxt}
{\rm Juxtaposition}
\begin{xlist}
\ex
\gll \textbf{aɢ} dubura\\
high mountain\\
\glt ‘high mountain’
\end{xlist}
\end{xlist}
\end{exe}
\il{Dargwa|)}
\is{juxtaposition|)}
\il{Lezgic languages|(}
\subsubsection{Lezgic}
\label{lezgian synchr}
%%%
The Lezgic subbranch of Daghestanian comprises the languages \ili{Agul}, \ili{Archi}, \ili{Badukh}, \ili{Kryz} (aka Kryts),\il{Kryts|see{Kryz}} \ili{Lezgian}, \ili{Rutul}, \ili{Tabasaran}, \ili{Tsakhur} and \ili{Udi}.
\is{juxtaposition|(}
Adjective-noun is the basic constituent order in the noun phrase of all Lezgic languages. Regarding their adjective attribution marking, the Lezgic languages exhibit the highest degree of diversity. All types found in Nakh-Daghestanian are attested: juxtaposition, \isi{head\hyp{}driven agreement} marking, anti\hyp{}construct state agreement marking, anti\hyp{}construct state marking and attributive nominalization.
\il{Udi|(}
\paragraph*{Juxtaposition in Udi}
The default adjective attribution marking device in Udi is juxtaposition, like in the following (incomplete) paradigm.
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{gen}]}
\ex
{\rm Udi \citep[465]{schulze-furhoff1994}}
\begin{xlist}
\ex \textbf{kala} ĝara-Ø {\rm ‘the old son’} \jambox{{\rm [\textsc{abs}]}}
\ex \textbf{kala} ĝara-en \jambox{{\rm [\textsc{erg}]}}
\ex \textbf{kala} ĝara-i \jambox{{\rm [\textsc{gen}]}}
\ex \dots
\end{xlist}
\end{exe}
\is{head\hyp{}driven agreement|(}
\il{Tabasaran|(}
\paragraph*{Juxtaposition and head\hyp{}driven agreement in Tabasaran}
The default adjective attribution marking device in Tabasaran is juxtaposition, as in Udi.\il{Udi} Only a minor lexical subclass of two adjectives in this language deviate in this respect and show gender and number agreement.
\il{Udi|)}
%%%
\begin{exe}
\ex
{\rm Tabasaran \citep[50–51]{kurbanov1986}}
\begin{xlist}
\ex
\gll \textbf{uččvu-r} adaš\\
beautiful-\textsc{I} father\textsc{(I)}\\
\glt ‘beautiful father’
\ex
\gll \textbf{uččvu-b} gjajvan\\
beautiful-\textsc{II} horse\textsc{(II)}\\
\glt ‘beautiful horse’
\ex
\gll \textbf{uččvu-dar} gjunšjir\\
beautiful-\textsc{pl} horse:\textsc{pl}\\
\glt ‘beautiful horses’
\end{xlist}
\end{exe}
\il{Tabasaran|)}
\is{juxtaposition|)}
\il{Archi|(}
\paragraph*{Head\hyp{}driven agreement in Archi}
Attributive adjectives in Archi show agreement in gender and number with the modified noun; see the complete agreement paradigm for the adjective ‘good’.
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{IV sg}]}
\ex
{\rm Archi \citep{kibrik1994a}}
\begin{xlist}
\ex hibàt̄u {\rm ‘good’} \jambox{{\rm [\textsc{I sg}]}}
\ex hibàt̄u-r \jambox{{\rm [\textsc{II sg}]}}
\ex hibàt̄u-b \jambox{{\rm [\textsc{III sg}]}}
\ex hibàt̄u-t \jambox{{\rm [\textsc{IV sg}]}}
\ex hibàt̄-ib \jambox{{\rm [\textsc{pl}]}}
\end{xlist}
\end{exe}
\il{Archi|)}
\is{head\hyp{}driven agreement|)}
\il{Tsakhur|(}
\paragraph*{Anti\hyp{}construct state agreement in Tsakhur}
Adjectives in Tsakhur can be divided into three subclasses according to their choice of attribution marking devices. The first, minor lexical class of adjectives in Tsakhur is characterized by missing inflection. Adjectives belonging to this class are simply juxtaposed to the modified noun \citep[383]{talibov2004}. Members of the two other adjective classes exhibit anti\hyp{}construct state agreement marking.
%%%
\begin{exe}
\ex
{\rm Tsakhur \citep[382]{talibov2004}}
\begin{xlist}
\ex
\label{tsakhur gen}
\begin{xlist}
\ex {\rm Gender class I–III}\\
\gll \textbf{bat'raj-na} jis / dix̌ / balk\textsuperscript{h}an\\
beautiful-\textsc{attr:I–III} girl(\textsc{I}) { } son(\textsc{II}) { } horse(\textsc{III})\\
\glt ‘beautiful girl / son / horse’
%%%
\ex {\rm Gender class IV}\\
\gll \textbf{bat'raj-n} č'alag\\
beautiful-\textsc{attr:IV} forest(\textsc{IV})\\
\glt ‘beautiful forest’
\end{xlist}
%%%
\ex
\label{tsakhur attrgen}
\begin{xlist}
\ex {\rm Gender class I}\\
\gll \textbf{x̌\underline{a}rna} jis\\
big:\textsc{attr:I–III} mother(\textsc{I})\\
\glt ‘old mother (viz.~grandmother)’
%%%
\ex {\rm Gender class IV}\\
\gll \textbf{x̌adɨn} balag\\
big:\textsc{attr:IV} sack(\textsc{IV})\\
\glt ‘big sack’
\end{xlist}
\end{xlist}
\end{exe}
%%%
Whereas anti\hyp{}construct agreement marking of adjectives from the first group (\ref{tsakhur gen}) is formally identical with genitive case marking of nouns, adjectives from the second group (\ref{tsakhur attrgen}) are equipped with a morphologically complex formative including the genitive suffix and a phonological stem alternation \citep[382]{talibov2004}.
%bei \citet{schulze1997} noch sehr interessante Sachen zum Genitiv-Attributive
\il{Tsakhur|)}
\il{Udi|(}
\is{attributive nominalization|(}
\is{headless noun phrase|(}
\paragraph*{Nominalization in headless noun phrases in Udi}
The default adjective attribution marking device in Udi is \isi{head\hyp{}driven agreement}. In headless noun phrases, however, attributive adjectives are obligatorily nominalized by means of the stem augment \textit{-o-} \textsc{abs} / \textit{-t'-} \textsc{obl}.
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{nmlz:obl}-\textsc{pl}-\textsc{erg}]}
\ex {\rm Udi \citep[466]{schulze-furhoff1994}}
\begin{xlist}
\ex kala-o {\rm ‘the big/old one’} \jambox{{\rm [\textsc{nmlz.abs}]}}
\ex kala-o-r \jambox{{\rm [\textsc{nmlz.abs}-\textsc{pl}]}}
\ex kala-t'-in \jambox{{\rm [\textsc{nmlz:obl}-\textsc{erg}]}}
\ex kala-t'-ĝ-on \jambox{{\rm [\textsc{nmlz:obl}-\textsc{pl}-\textsc{erg}]}}
\ex kala-t'-ay \jambox{{\rm [\textsc{nmlz:obl}-\textsc{gen}]}}
\ex \dots
\end{xlist}
\end{exe}
\il{Udi|)}
\il{Lezgian|(}
\paragraph*{Nominalization in headless noun phrases in Lezgian}
Attributive adjectives in headless noun phrases are nominalized in Lezgian as well. The nominalizing suffix exhibits different forms in the absolute singular case (\textit{-di}), in the oblique cases (\textit{-da}) and in plural (\textit{-bur}).
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{attr:pl}-\textsc{erg}]}
\ex {\rm Headless adjectives in Lezgian \citep[110]{haspelmath1993}}
\begin{xlist}
\ex q̃acu-di {\rm ‘green one’} \jambox{{\rm [\textsc{attr:sg}]}}
\ex q̃acu-da \jambox{{\rm [\textsc{attr:erg.sg}]}}
\ex q̃acu-da-n \jambox{{\rm [\textsc{attr}-\textsc{gen}]}}
\ex q̃acu-bur \jambox{{\rm [\textsc{attr:pl}]}}
\ex q̃acu-bur-u \jambox{{\rm [\textsc{attr:pl}-\textsc{erg}]}}
\ex \dots
\end{xlist}
\end{exe}
%%%
\largerpage
Note, that the same attribution marker is also used for the nominalization of noun phrases.
%%%
\begin{exe}
\settowidth\jamwidth{[mother-\textsc{gen}-\textsc{attr}]}
\ex {\rm Nominalized noun phrases in Lezgian \citep[110]{haspelmath1993}}
\begin{xlist}
\ex {\rm Pronoun}
\begin{xlist}
\ex zi {\rm ‘my’} \jambox{{\rm [\textsc{poss:1sg}]}}
\ex zi\textbf{-di} {\rm ‘mine’} \jambox{{\rm [\textsc{poss:1sg}-\textsc{attr}]}}
\end{xlist}
%%%
\ex {\rm Lexical noun}
\begin{xlist}
\ex dide.di-n {\rm ‘mother's’} \jambox{{\rm [mother-\textsc{gen}]}}
\ex dide.di-n\textbf{-di} {\rm ‘mother's’} \jambox{{\rm [mother-\textsc{gen}-\textsc{attr}]}}
\end{xlist}
\end{xlist}
\end{exe}
%%%
Even though adjectives without a lexical head in \ili{Udi} and Lezgian are nominalized there is no evidence that these nominalizations serve as attribution marking devices.
\il{Lezgian|)}
\is{attributive nominalization|)}
\is{headless noun phrase|)}
\il{Rutul|(}
\paragraph*{Anti\hyp{}construct state in Rutul}
In Rutul, attributive and predicative\is{predicative marking} adjectives are differentiated by means of two different derivations. Whereas attributive adjectives take an anti\hyp{}construct suffix \textit{-d \textasciitilde-dɨ},\footnote{The allomorph \textit{-dɨ} occurs after consonants \citep[224]{alekseev1994a}.} predicative adjectives take a suffix \textit{-ɨ \textasciitilde-ɨ}\footnote{The allomorph \textit{-ɨ} occurs after dorsal consonants \citep[224]{alekseev1994a}.} or are not marked at all \citep[224]{alekseev1994a}.
Attributive adjectives do not inflect other than by means of anti\hyp{}construct state marking.
%%%
\begin{exe}
\ex {\rm Rutul \citep[237]{alekseev1994a}}
\begin{xlist}
\ex
\gll \textbf{äkkà-d} dahàr\\
big-\textsc{attr} stone\\
\glt ‘big stone’
\ex
\gll \textbf{äkkà-d} dahàr-bɨr\\
big-\textsc{attr} stone-\textsc{pl}\\
\glt ‘big stones’
\end{xlist}
\end{exe}
%%%
Note that the anti\hyp{}construct state marker \textit{-d \textasciitilde-dɨ} is identical to the genitive case of nouns and thus constitutes a polyfunctional marker \citep{alekseev1994a}.
\il{Rutul|)}
\il{Lezgic languages|)}
\il{Daghestanian languages|)}
\il{Nakh languages|(}
\subsection{Nakh}
%%%
The Nakh branch of Nakh-Daghestanian comprises only three languages: \ili{Bats}, \ili{Ingush} and \ili{Chechen}. The latter two form a common subbranch \citep[220, 233]{salminen2007}.
\is{head\hyp{}driven agreement|(}
The noun phrase structure in all three languages is basically similar. Attributive adjectives precede the modified noun and show head\hyp{}driven agreement. Adjectives in \isi{headless noun phrase}s are additionally marked with an attributive nominalizer.
\il{Chechen-Ingush languages|(}
\subsection{Chechen-Ingush}
\label{ingush synchr}
%%%
\il{Ingush|(}
\paragraph*{Head\hyp{}driven agreement in Ingush}
Attributive adjectives in Ingush agree in case with the modified noun. The adjective agreement paradigm, however, exhibits only a single case distinction of nominative versus oblique.
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{nom}]}
\ex {\rm Case agreement paradigm in Ingush \citep[99]{nichols1994b}}
\label{ingush agr}
\begin{xlist}
\ex \textbf{joqqa} jurt {\rm ‘big village’} \jambox{{\rm [\textsc{nom}]}}
\ex \textbf{joqqa-ča} jurt-a \jambox{{\rm [\textsc{gen}]}}
\ex \textbf{joqqa-ča} jurt-aa \jambox{{\rm [\textsc{dat}]}}
\ex \textbf{joqqa-ča} jurt-uo \jambox{{\rm [\textsc{erg}]}}
\ex \textbf{joqqa-ča} jurt-aca \jambox{{\rm [\textsc{ins}]}}
\ex \dots
\end{xlist}
\end{exe}
%%%
Some adjectives also show agreement in gender; but only very few adjectives additionally agree in number with the modified noun \citep[99]{nichols1994b}.
\il{Ingush|)}
\is{head\hyp{}driven agreement|)}
\is{attributive nominalization|(}
\il{Chechen|(}
\is{headless noun phrase|(}
\paragraph*{Nominalization in headless noun phrases in Chechen}
Next to \isi{head\hyp{}driven agreement}, Chechen (similar to the other Nakh languages) exhibits attributive nominalization as the regular adjective attribution marking device in headless noun phrases. The formative is a thematic stem extension merged with the case inflection.
%%%
\begin{exe}
\ex {\rm Chechen \citep[29]{nichols1994a}}
\begin{xlist}
\ex
\gll leqa kert\\
high fence\\
\glt ‘high fence’
\ex
\gll leqa\textbf{-nig}\\
high-\textsc{attr:nom.sg}\\
\glt ‘the high one’
\end{xlist}
\end{exe}
%%%
Even though adjectives without a lexical head in Chechen are nominalized, there is no evidence that these nominalizations serve as attribution marking devices.
\il{Chechen|)}
\il{Chechen-Ingush languages|)}
\is{headless noun phrase|)}
\il{Bats|(}
\subsection{Bats}
%%%
The noun phrase structure in Bats (aka Tsova-Tush\il{Tsova-Tush|see{Bats}} or Batsbi)\il{Batsbi|see{Bats}} is similar to the structure found in closely related \ili{Chechen} and \ili{Ingush}. Attributive adjectives show \isi{head\hyp{}driven agreement}. Adjectives in \isi{headless noun phrase}s are additionally marked by means of nominalization \citep[172–172]{holisky-etal1994}.
\il{Bats|)}
\il{Nakh languages|)}
\il{Nakh-Daghestanian languages|)}
\is{attributive nominalization|)}
\il{Abkhaz-Adyghe languages|(}
\section{Abkhaz-Adyghe}
%%%
The Abkhaz-Adyghe (aka Northwest Caucasian)\il{Northwest Caucasian|see{Abkhaz-Adyghe languages}} family consists of the two bran\-ches Abkhaz and Circassian,\il{Circassian languages} each of which comprises two languages. A third branch, Ubykh,\il{Ubykh languages} is now extinct \citep[220, 233]{salminen2007}. All languages are spoken in the northwestern \isi{Caucasus} region.
\is{head\hyp{}driven agreement|(}
Whereas the adjective-noun constituent order is similar in all Abkhaz-Adyghe languages, the adjective attribution marking devices
%%%
\begin{itemize}
\item head\hyp{}driven agreement (Abkhaz)
\item incorporation (Circassian)
\end{itemize}
%%%
occurring in the two branches of this family diverge considerably.
\il{Abkhaz languages}
\subsection{Abkhaz}
%%%
The Abkhaz branch of Abkhaz-Adyghe comprises the two very closely related varieties \ili{Abkhaz} proper and \ili{Abaza}. The constituent order inside the noun phrase of both languages is normally noun-adjective. Only adjectives denoting nationality deviate from this rule and precede the modified noun \citep[222]{comrie1981}.
\il{Abkhaz|(}
\paragraph*{Head\hyp{}driven agreement in Abkhaz}
%WO = noun-adjective %aber nationality = A N %A N auch bei einigen anderen möglich
Abkhaz attributive adjectives show agreement in number.\footnote{Noun phrases with an attributive adjective following a non-inflected noun in Abkhaz have alternatively been analyzed as polysynthetic constructions (hence adjective incorporation), e.g., by \citet[123]{rijkhoff2002} and \citet{gil2005}.} Note, however, that a plural noun modified by an adjective may remain unmarked \citep[46]{hewitt1989a}. Even though the plural marker may attach only once at the right phrase edge, it is best analyzed as an agreement marker and not a \isi{clitic}. This is evidenced by the fact that the adjective may take the non-human pluralizer even if it modifies a human noun.\footnote{Note that in the closely related language Abaza, plural marking occurs twice but the non-human pluralizer constitutes the obligatory plural agreement marker on adjectives modifying nouns of any gender class \citep[100]{lomtatidze-etal1989}.}
%%%
\newpage
\begin{exe}
\ex {\rm Abkhaz \citep{hewitt1989a}}
\begin{xlist}
\ex
\gll a-là(-k°à) \textbf{bzə̀ya-k°a}\\
\textsc{def}-dog-\textsc{pl:nonhum} good-\textsc{pl:nonhum}\\
\glt ‘the good dogs’
%%%
\ex
\gll à-ʒġab(-ċ°a) \textbf{bzə̀ya-k°a} / \textbf{bzə̀ya-ċ°a}\\
\textsc{def}-girl-\textsc{pl:hum} good-\textsc{pl:nonhum} {} good-\textsc{pl:hum}\\
\glt ‘the good girls’
\end{xlist}
\end{exe}
\il{Abkhaz|)}
\is{head\hyp{}driven agreement|)}
\il{Circassian languages|(}
\subsection{Circassian}
%%%
The Circassian (aka Adyghe\il{Adyghe (branch)|see{Circassian languages}}) branch of Abkhaz-Adyghe comprises the two languages \ili{Adyghe} and \ili{Karbardian}. Both languages exhibit similar noun phrase structures. The constituent order inside the noun phrase is normally noun\hyp{}adjective. Noun phrases with modifying adjectives in Adyghe and Karbardian are often described as single compound words \citep[222]{comrie1981}.
\il{Karbardian|(}
\paragraph*{Adjective incorporation in Karbardian}
Attributive adjectives in Karbardian (aka Eastern Circassian\il{Eastern Circassian|see{Karbadian}}) occur in a polysynthetic structure to the right of the modified noun. Number and case inflection of the noun phrase is suffixed to the adjective.
%%%
\begin{exe}
\ex {\rm Karbardian \citep[295]{colarusso1989}}
\begin{xlist}
\ex
\gll pṡaaṡa\textbf{-daax̂a}-r\\
girl-beautiful-\textsc{abs}\\
\glt ‘the beautiful girl’
%%%
\ex
\gll pṡaaṡa\textbf{-daax̂a}-ha-r\\
girl-beautiful-\textsc{pl}-\textsc{abs}\\
\glt ‘the beautiful girls’
%%%
\ex
\gll pṡaaṡa\textbf{-daax̂a-c'ək'°}-ər\\
girl-beautiful-little-\textsc{abs}\\
\glt ‘the small beautiful girl’
\end{xlist}
\end{exe}
\il{Karbardian|)}
\il{Circassian languages|)}
\il{Abkhaz-Adyghe languages|)}
\il{Kartvelian languages|(}
\section{Kartvelian}
\label{kartvelian synchr}
%%%
Kartvelian is a language family comprising the four languages \ili{Georgian}, \ili{Svan}, \ili{Laz} and \ili{Mingrelian} (aka Megrelian\il{Megrelian|see{Mingrelian}} or Iverian).\il{Iverian|see{Mingrelian}} The latter two languages constitute the Zan\il{Zan languages} subbranch inside the family \citep[220]{salminen2007}. Kartvelian languages are all spoken in the southern \ili{Caucasus}, mainly in Georgia but also in adjacent countries.
In the modern Kartvelian languages, the unmarked constituent order of adjectival modifiers and head is noun-final, although the opposite order is also possible \citep[56]{harris1991a}.
\is{head\hyp{}driven agreement|(}
\is{juxtaposition|(}
Three adjective attribution marking types are attested:
%%%
\begin{itemize}
\item juxtaposition
\item head\hyp{}driven agreement
\item appositional head\hyp{}driven agreement.
\end{itemize}
%%%
The inherited Common Kartvelian\il{Common Kartvelian} agreement marking, however, is more or less preserved only in the marked (but inherited) head-initial noun phrase type. In the head-final noun phrase type, on the other hand, the modern Kartvelian languages display a strong tendency to lose head\hyp{}driven agreement. Preposed attributive adjectives in \ili{Mingrelian} and \ili{Laz} are juxtaposed to the head noun as a rule. In Modern \ili{Georgian} and \ili{Svan}, the agreement paradigm of preposed attributive adjectives shows a high degree of syncretism.
\is{juxtaposition|)}
\il{Georgian|(}
\subsection{Georgian}
\label{georgian synchr}
%%%
\paragraph*{Head\hyp{}driven agreement in Georgian}
The only agreement feature in Modern Georgian is \textsc{case}. Note, however, that the adjective agreement paradigm exhibits only three differentiated forms.\footnote{In the marked head-initial constituent order of noun and adjective, which is used in archaic style or for emphasis, case agreement is complete \citep[59]{tuite1998}.}
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{nom}]}
\ex {\rm Georgian \citep[236]{aronson1991}}
\label{georgian old}
\begin{xlist}
\ex \textbf{ʒvel-i} c'ign-i {\rm ‘old book’} \jambox{{\rm [\textsc{nom}]}}
\ex \textbf{ʒvel-ma} c'ign-ma \jambox{{\rm [\textsc{erg}]}}
\ex \textbf{ʒvel-Ø} c'ign-s \jambox{{\rm [\textsc{dat}]}}
\ex \textbf{ʒvel-i} c'ign-is \jambox{{\rm [\textsc{gen}]}}
\ex \textbf{ʒvel-i} c'ign-it \jambox{{\rm [\textsc{ins}]}}
\ex \textbf{ʒvel-Ø} c'ign-ad \jambox{{\rm [\textsc{adv}]}}
\ex \dots
\end{xlist}
\end{exe}
\is{head\hyp{}driven agreement|)}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Georgian}
Whereas the so-called consonantal-stem adjectives like ‘old’ in \REF{georgian old} show \isi{head\hyp{}driven agreement}, there is another lexical class of adjectives (characterized by a stem-final vowel, hence “vocalic-stem adjectives”), the members of which are simply juxtaposed to the modified noun.
%%%
\begin{exe}
\settowidth\jamwidth{[\textsc{nom}]}
\ex {\rm Georgian \citep[236]{aronson1991}}
\begin{xlist}
\ex \textbf{parto} gza {\rm ‘wide road’} \jambox{\rm [{\textsc{nom}]}}
\ex \textbf{parto} gza-m \jambox{\rm [{\textsc{erg}]}}
\ex \textbf{parto} gza-s \jambox{\rm [{\textsc{dat}]}}
\ex \textbf{parto} gz-is \jambox{\rm [{\textsc{gen}]}}
\ex \textbf{parto} gz-it \jambox{\rm [{\textsc{ins}]}}
\ex \textbf{parto} gz-ad \jambox{\rm [{\textsc{adv}]}}
\ex \dots
\end{xlist}
\end{exe}
\is{juxtaposition|)}
\is{appositional head\hyp{}driven agreement|(}
\paragraph*{Appositional head\hyp{}driven agreement in Georgian}
Appositional modification seems to occur as a secondary type of adjective attribution marking in Georgian. Attributive adjectives are normally preposed and show only limited agreement (\ref{georgian unmarked}). In postposition (marking emphasis), however, the adjective inflects for the full set of cases and numbers (\ref{georgian marked}). This construction thus resembles an independent (headless) noun phrase\is{headless noun phrase} in apposition to the semantic head \citep[652, 677]{testelec1998}. The construction probably marks \isi{contrastive focus} of the adjective.
%%%
\begin{exe}
\ex {\rm Georgian \citep[652]{testelec1998}}
\begin{xlist}
\ex
\label{georgian unmarked}
\gll am or \textbf{lamaz} kal-s\\
that:\textsc{obl} two nice:\textsc{obl} woman-\textsc{dat}\\
\glt ‘to those two nice women’
%%%
\ex
\label{georgian marked}
\gll kal-eb-s \textbf{lamaz-eb-s}\\
woman-\textsc{pl}-\textsc{dat} nice-\textsc{pl}-\textsc{dat}\\
\glt ‘to the \textsc{nice} women’
\end{xlist}
\end{exe}
\is{appositional head\hyp{}driven agreement|)}
\il{Georgian|)}
\is{head\hyp{}driven agreement|(}
\il{Svan|(}
\subsection{Svan}
%%%
\paragraph*{Head\hyp{}driven agreement in Svan}
Attributive adjectives in Svan show limited agreement in case. The paradigm of the agreement marker exhibits only two members: one for nominative and one for the oblique cases.
%%%
\newpage
\begin{exe}
\ex {\rm Svan \citep[18]{tuite1997}}
\begin{xlist}
\ex
\gll \textbf{luwzer-e} ma:r-e\\
diligent-\textsc{nom} man-\textsc{nom}\\
\glt ‘a diligent man’
%%%
\ex
\gll \textbf{luwzer-a} ma:re:m-i našdabw\\
diligent-\textsc{obl} man-\textsc{gen} work\\
\glt ‘(the work) of a diligent man’
\end{xlist}
\end{exe}
%%%
\citet[499]{schmidt1991}, however, describes the tendency in Svan to abolish agreement completely and use an uninflected variant of the attributive adjective in the oblique cases instead.
\il{Svan|)}
\is{head\hyp{}driven agreement|)}
\is{juxtaposition|(}
\il{Zan languages|(}
\subsection{Zan}
%%%
Zan is a subbranch of Kartvelian formed by the two languages \ili{Mingrelian} and \ili{Laz}. The default type of adjective attribution marking in both languages is juxtaposition which occurs obligatorily in the unmarked head-final noun phrase. In the marked head-initial noun phrase, however, attributive adjectives normally agree in number and case with the head noun.
\is{head\hyp{}driven agreement|(}
\il{Mingrelian|(}
\paragraph*{Juxtaposition and head\hyp{}driven agreement in Mingrelian}
The two adjective attribution marking devices occurring in Zan languages are illustrated with Mingrelian examples.
%%%
\begin{exe}
\ex {\rm Mingrelian \citep[361–364]{harris1991b}}
\begin{xlist}
\ex {\rm Juxtaposition}\\
\label{mingrelian juxt}
\gll \textbf{skvam} cira-en-k\\
beautiful girl-\textsc{pl}-\textsc{nar}\\
\glt ‘beautiful girl’%Bsp ist konstruiert
%%%
\ex {\rm Head\hyp{}driven agreement}\\
\label{mingrelian agr}
\gll cira-en-k \textbf{skvam-en-k}\\
girl-\textsc{pl}-\textsc{nar} beautiful-\textsc{pl}-\textsc{nar}\\
\glt ‘\textsc{beautiful} girl’\footnote{Note that the case marking formative does not obligatorily occur on both constituents in the marked head-initial noun phrase in Mingrelian \citep[363–364]{harris1991b}.}%clitic
\end{xlist}
\end{exe}
\il{Mingrelian|)}
\il{Zan languages|)}
\il{Kartvelian languages|)}
\is{juxtaposition|)}
\is{head\hyp{}driven agreement|)}
\il{Semitic languages|(}
\section{Semitic}
%%%
Semitic languages are only marginally represented in northern Eurasia. The few languages considered here belong either to the Arabic\il{Arabic languages} subbranch of Central Semitic\il{Central Semitic languages} or to Northwest Semitic.\il{Northwest Semitic languages}
\is{head\hyp{}driven agreement|(}
Only one single type of adjective attribution marking is attested in these two branches:
%%%
\begin{itemize}
\item head\hyp{}driven agreement.
\end{itemize}
%%%
\il{Northwest Semitic languages|(}
\il{Neo-Aramaic|(}
\subsection{Northwest Semitic}
%%%
Neo-Aramaic (aka Modern Aramaic) is the only language of the northwestern branch of Semitic considered in the present survey. It is spoken in the Middle-East in north-western Iran, Iraq and south-eastern Turkey, but also in adjacent areas of the Caucasus\is{Caucasus} in Azerbaijan, and therefore falls into the geographic area of investigation.
\paragraph*{Head\hyp{}driven agreement in Neo-Aramaic}
Constituent order inside the noun phrase of Neo-Aramaic is noun-adjective. Attributive adjectives agree with the modified noun in gender and number.
%%%
\il{Neo-Aramaic!Kurdistan}
\begin{exe}
\ex {\rm Neo-Aramaic (Kurdistan) \citep{krotkoff1982}}
\begin{xlist}
\ex ya:la \textbf{zu:ra} {\rm ‘small boy’}
\ex bra:ta \textbf{zurta} {\rm ‘small girl’}
\ex bnu:ne \textbf{zu:re} {\rm ‘small kids’}
\end{xlist}
\end{exe}
\il{Neo-Aramaic|)}
\il{Northwest Semitic languages|)}
\il{Central Semitic languages|(}
\subsection{Central Semitic}
%%%
\il{Arabic languages|(}
\subsubsection{Arabic}
\ili{Cypriot Arabic} (aka Kormakiti)\il{Kormakiti|see{Cypriot Arabic}} and \ili{Maltese} are two Arabic languages of the Central Semitic branch spoken on the Mediterranean islands Cyprus and Malta, and thus belong to \isi{Europe} geographically.
\il{Maltese|(}
\paragraph*{Head\hyp{}driven agreement in Maltese}
The basic and unmarked constituent order in Maltese is noun-adjective. A few adjectives, however, can precede the noun in an emphatic construction \citep[71]{borg-etal1996}.
Adjectives show distinct forms for gender and number in accordance with the morphological features of the modified noun.
%%%
\begin{exe}
\ex {\rm Maltese \citep[328]{aquilina1959}}
\begin{xlist}
\ex
\gll ra:jel \textbf{sabi:ħ}\\
man beautiful:\textsc{m:sg}\\
\glt ‘beautiful man’
%%%
\ex
\gll mara \textbf{sabi:ħa}\\
woman beautiful:\textsc{f:sg}\\
\glt ‘beautiful woman’
%%%
\ex
\gll nies \textbf{sbieħ}\\
people beautiful:\textsc{pl}\\
\glt ‘beautiful people’
\end{xlist}
\end{exe}
%%%
Optionally, the attributive adjective can additionally be marked for definiteness.
%%%
\begin{exe}
\ex {\rm Maltese \citep[330]{aquilina1959}}\\
\gll il-ktieb \textbf{(il-)qadi:m}\\
\textsc{def}-book (\textsc{def-})old\\
\glt ‘the old book’
\end{exe}
%%%
Even though the construction with a repeated definite marker resembles \isi{attributive nominalization}, it is best analyzed as agreement in the \textsc{definite}\is{species marking!definite} value of the feature \textsc{species} \citep[179]{himmelmann1997}. Himmelmann compares the construction in Maltese to Standard \ili{Arabic}, where similar definite (and indefinite) agreement occurs.\is{species marking!indefinite}
%CHECK CECA for interesting similarities between attr. and pred. adjectives
\il{Maltese|)}
\il{Arabic languages|)}
\il{Central Semitic languages|)}
\il{Semitic languages|)}
\is{head\hyp{}driven agreement|)}
\il{Uralic languages|(}
\section{Uralic}
\label{uralic synchr}
%%%
The Uralic language family comprises the branches (roughly from West to East) Hungarian,\il{Hungarian} Saamic,\il{Saamic languages} Finnic,\il{Finnic languages} Permic,\il{Permic languages} Mari,\il{Mari languages} Mordvin,\il{Mordvin languages} Khanty,\il{Khanty languages} Mansi,\il{Mansi languages} and Samoyedic\il{Samoyedic languages} \citep[216–218]{salminen2007}. Except for most languages from the Samoyedic subbranch of the family, Uralic languages are all spoken in \isi{Europe}. Uralic is thus one of the major families on the European linguistic map.
The constituent order inside the noun phrase is strictly adjective-initial in all Uralic languages. Similar to Mongolic,\il{Mongolic languages} Turkic\il{Turkic languages} and many other languages of \isi{North Asia}, the prototypical adjective attribution marking device in Uralic languages is \isi{juxtaposition}. This type occurs as the unmarked construction in most Uralic languages with the exception of the two western branches Saamic\il{Saamic languages} and Finnic\il{Finnic languages} as well as in \ili{Nganasan} from the Samoyedic\il{Samoyedic languages} branch, which have abandoned juxtaposition and developed new types.
Secondary adjective attribution marking devices are also attested in languages of the Permic\il{Permic languages} and Mari\il{Mari languages} (and probably also other) branches of Uralic, even though juxtaposition is used in these languages as the default strategy for adjective attribution marking.
The following five adjective attribution marking devices occur in Uralic:
%%%
\begin{itemize}
\item juxtaposition\is{juxtaposition}
\item head\hyp{}driven agreement\is{head\hyp{}driven agreement}
\item anti\hyp{}construct state marking
\item appositional head\hyp{}driven agreement\is{appositional head\hyp{}driven agreement}
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\il{Samoyedic languages|(}
\subsection{Samoyedic}
%%%
The Samoyedic branch of Uralic can be divided into two subbranches: North Samoyedic and South Samoyedic.\il{South Samoyedic languages}
\il{North Samoyedic languages|(}
\subsubsection{North Samoyedic}
\label{N-Samoyedic-synchr}
%%%
The North Samoyedic branch consists of Nenets\il{Nenets languages} (with the two closely related languages \ili{Forest Nenets}\footnote{Data from Forest Nenets could not be included here because there are no sufficient syntactic descriptions available.} and \ili{Tundra Nenets}), Enets\il{Enets languages} (with the two closely related languages \ili{Forest Enets} and \ili{Tundra Enets}) and \ili{Nganasan}.
\il{Forest Enets|(}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Forest Enets}
In both Enets languages, attributive adjectives are juxtaposed to the modified noun by default.
%%%
\begin{exe}
\ex {\rm Forest Enets \citep[71]{siegl2013a}}
\label{enets juxt}
\begin{xlist}
\ex
\gll \textbf{aga} to\\
big lake(\textsc{nom:sg})\\
\glt ‘a/the big lake’
%%%
\ex
\gll \textbf{aga} to-ʔ\\
big lake\textsc{-nom:pl}\\
\glt ‘big lakes’
%%%
\ex
\gll \textbf{aga} to-xiʔ\\
big lake\textsc{-nom:du}\\
\glt ‘two big lakes’
%%%%
%\ex
%\gll \textbf{aga} to-xun\\
% big lake\textsc{-loc:sg}\\
%\glt ‘in a/the big lake’
%%%%
%\ex
%\gll \textbf{aga} to-xin\\
% big lake\textsc{-loc:pl}\\
%\glt ‘in a/the big lakes’
\end{xlist}
\end{exe}
\il{Forest Enets|)}
\il{Head-driven agreement|(}
\il{Tundra Nenets|(}
\paragraph*{Juxtaposition and head\hyp{}driven agreement in Tundra Nenets}
Attributive adjectives in Tundra Nenets are juxtaposed to the modified noun by default, similar to examples (\ref{enets juxt}) from Forest Enets\il{Forest Enets} and (\ref{hung juxt}) from \ili{Hungarian}. However, it has been noticed in descriptions of Tundra Nenets that optional head\hyp{}driven agreement is possible under certain pragmatic conditions (cf., e.g., \citealt[50, passim]{jalava2013a}; \citealt[151–152, passim]{nikolaeva2014a}; \citealt[544]{salminen1998a}). (\ref{t nenets agr}) is an example where number agreement indicates “some kind of definiteness or concreteness, as opposed to the generic interpretation of the plural NP” \citep[152]{nikolaeva2014a}.
%%%
\begin{exe}
\ex {\rm Tundra Nenets \citep[152]{nikolaeva2014a}}
\label{t nenets agr}
\begin{xlist}
\ex {\rm Juxtaposition}\\
\gll \textbf{ŋarka} yesʹa-q\\
big metal\textsc{-pl}\\
\glt ‘a large sum of money’ (lit. ‘big metals’)
%%%
\ex {\rm Head-driven agreement}\\
\gll \textbf{ŋarka-q} yesʹa-q\\
big\textsc{-pl} metal\textsc{-pl}\\
\glt ‘BIG money’ (lit. ‘big metals’)
\end{xlist}
\end{exe}
%%%
Siegl's note that “under certain pragmatic functions, apparently definiteness, a kind of number agreement (though not in the dual) seems to be possible” \citep[177]{siegl2013a} indicates that \ili{Forest Enets} behaves similar to Tundra Nenets. However, neither Siegl's descriptive grammar or the other sparse descriptions of Forest Enets provide examples for attributive adjectives undergoing head\hyp{}driven agreement.
\is{juxtaposition|)}
\il{Tundra Nenets|)}
\il{Nganasan|(}
\paragraph*{Head-driven agreement in Nganasan}
Among the Samoyedic languages, Nga\-na\-san is exceptional in exhibiting head\hyp{}driven agreement (in \textsc{number} and \textsc{case}) as the default type of adjective attribution marking.
%%%
\begin{exe}
\ex {\rm Nganasan \citep[158]{wagner-nagy2002a}}
\begin{xlist}
\ex
\gll \textbf{ńaаgə-ə} koru-ʔ\\
good\textsc{-nom:sg} house\textsc{-nom.sg}\\
\glt ‘(one) good house’
%%%
\ex
\gll \textbf{ńaagə-gəj} koru-kəj\\
good\textsc{-nom:du} house\textsc{-nom.du}\\
\glt ‘(two) good houses’
%%%
\ex
\gll \textbf{ńaаgə-əʔ} koru-ðәʔ\\
good\textsc{nom:pl} house\textsc{-nom:pl}\\
\glt ‘(several) good houses’
\end{xlist}
\end{exe}
%%%
Whereas agreement is obligatory for all three number values, case agreement is defective.\is{agreement marking!defective agreement paradigm} Only in nominative, genitive and accusative, the corresponding case values are inherited from the head noun. If the noun phrase is marked for one of the other cases, the adjective is inflected in genitive (\citealt[511]{helimski1998a}; \citealt[157]{wagner-nagy2002a}).
\il{Nganasan|)}
\il{Head-driven agreement|)}
\il{North Samoyedic languages|)}
\il{South Samoyedic languages|(}
\il{Selkup languages|(}
\subsubsection{South Samoyedic}
%%%
South Samoyedic has only one subbranch with living languages: Selkup. The second subbranch, Sayan\il{Sayan languages} (comprising the languages \ili{Kamas} and \ili{Mator}), is now extinct \citep[231]{salminen2007} and therefore not considered here.
The Selkup branch consists of the three very closely related languages \ili{Northern Selkup}, \ili{Central Selkup} and \ili{Southern Selkup}. Attributive adjectives in the Selkup languages are juxtaposed to the modified noun by default, similar to examples (\ref{enets juxt}) from Forest Enets\il{Forest Enets} and (\ref{hung juxt}) from \ili{Hungarian}.
\il{Selkup languages|)}
\il{South Samoyedic languages|)}
\il{Samoyedic languages|)}
\il{Hungarian|(}
\subsection{Hungarian}
%%%
The Hungarian branch of Uralic consists only of one language, i.e., Hungarian proper.\footnote{The outlying dialect Csángó Hungarian\il{Hungarian!Csángó} spoken in Romania is not considered as a distinct language here.}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Hungarian}
In Hungarian, attributive adjectives are simply juxtaposed to the modified noun by default.
%%%
\begin{exe}
\ex {\rm Hungarian \citep[41]{hall1938}}
\label{hung juxt}
\begin{xlist}
\ex
\gll a \textbf{fekete} szem\\
\textsc{def} black eye\\
\glt ‘the black eye’
%%%
\ex
\gll a \textbf{fekete} szem-ek\\
\textsc{def} black eye-\textsc{pl}\\
\glt ‘the black eyes’
%%%
\ex
\gll a \textbf{fekete} szem-ek-nek\\
\textsc{def} black eye-\textsc{pl}-\textsc{dat}\\
\glt ‘to the black eyes’
%%%
\ex
\gll a \textbf{fekete} szem-eid\\
\textsc{def} black eye-\textsc{pl:poss:2sg}\\
\glt ‘your black eyes’
\end{xlist}
\end{exe}
\il{Hungarian|)}
\is{juxtaposition|)}
\il{Khanty languages|(}
\il{Mansi languages|(}
\il{Mari languages|(}
\il{Mordvin languages|(}
\subsection{Khanty, Mansi, Mari, Mordvin}
%%%
The two languages \ili{Northern Khanty} and \ili{Eastern Khanty} constitute the Khanty branch of Uralic. A third language, Southern Khanty,\il{Southern Khanty} is extinct \citep[231]{salminen2007}. The Mansi branch of Uralic consists of the two very closely related languages \ili{Northern Mansi} and \ili{Eastern Mansi}. Two other Mansi languages, \ili{Western Mansi} and \ili{Southern Mansi}, are extinct \citep[231]{salminen2007}. The Mari branch of Uralic is formed by Western Mari\il{Western Mari} (aka Hill Mari)\il{Hill Mari|see{Western Mari}} and Eastern Mari\il{Eastern Mari} (aka Meadow Mari)\il{Meadow Mari|see{Eastern Mari}} \citep[231]{salminen2007}. The Mordvin branch of Uralic is formed by the two closely related languages Erzya\il{Erzya Mordvin} and Moksha \il{Moksha Mordvin} \citep[231]{salminen2007}.
Attributive adjectives in all Khanty, Mansi, Mari and Mordvin languages are juxtaposed to the modified noun by default, similar to examples (\ref{enets juxt}) from \ili{Forest Enets} and (\ref{hung juxt}) from \ili{Hungarian}.
\il{Khanty languages|)}
\il{Mansi languages|)}
\il{Mari languages|)}
\il{Mordvin languages|)}
\il{Permic languages|(}
\subsection{Permic}
%%%
All three Permic languages, Komi-Permyak,\il{Komi-Permyak} Komi-Zyrian\il{Komi-Zyrian} and Udmurt\il{Udmurt} exhibit two distinct types of adjective attribution marking. The default type is juxtaposition, which is the inherited Proto\hyp{}Uralic\il{Proto\hyp{}Uralic} type \citep[80–81]{decsy1990}. However, an \isi{attributive nominalization} device is used in \isi{contrastive focus} constructions as a second type.
\il{Komi-Zyrian|(}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Komi-Zyrian}
The unmarked sequence of adjective and noun, i.e., juxtaposition, is illustrated by an example from Komi-Zyrian.
%%%
\newpage
\begin{exe}
\ex {\rm Komi-Zyrian (personal knowledge)}
\begin{xlist}
\ex
\gll \textbf{ɨdžɨd} kar\\
big town\\
\glt ‘big town’
%%%
\ex
\gll \textbf{ɨdžɨd} kar-jas\\
big town-\textsc{pl}\\
\glt ‘big towns’
\end{xlist}
\end{exe}
\il{Komi-Zyrian|)}
\is{juxtaposition|)}
\il{Udmurt|(}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization + appositional head\hyp{}driven agreement in Udmurt}
\label{udmurt synchr}
In Udmurt, an attributive nominalizer homophonous with the 3\textsuperscript{rd} person possessive inflection marker is regularly used as an adjective attribution marking device in \isi{contrastive focus} constructions. Historically, both formatives are similar (see \S\ref{udmurt diachr} in Part~IV Diachrony).
%%%
\begin{exe}
\ex {\rm Udmurt \citep{winkler2001}}
\begin{xlist}
\ex {\rm Juxtaposition (default)}
\begin{xlist}
\ex
\gll \textbf{badǯ́ym} gurt\\
big house\\
\glt ‘big house’
%%%
\ex
\gll \textbf{badǯ́ym} gurt-jos-y\\
big house-\textsc{pl}-\textsc{ill}\\
\glt ‘to big house/s’
\end{xlist}
%%%
\ex {\rm Attributive nominalization (contrastive focus)}
\begin{xlist}
\ex
\gll \textbf{badǯ́ym-ėz} gurt\\
big-\textsc{attr} house\\
\glt ‘\textsc{big} house’
%%%
\ex
\gll \textbf{badǯ́ym-jos-a-z} gurt-jos-y\\
big-\textsc{pl}-\textsc{ill}-\textsc{attr} house-\textsc{pl}-\textsc{ill}\\
\glt ‘to \textsc{big} house/s’
\end{xlist}
\end{xlist}
\end{exe}
%%%
An adjective equipped with the nominalizer is also marked with (agreeing) case and number suffixes indicating that the nominalized adjective occurs in an attributive appositional construction. Note that the nominalizer also serves as the licenser of adjectival (and other) modification\is{modification marking} in \isi{headless noun phrase}s.
%%%
\newpage
\begin{exe}
\ex {\rm Nominalization in Udmurt \citep{winkler2001}}
\begin{xlist}
\ex {\rm Adjective}\\
\gll badǯ́ym\textbf{-ėz}\\
big-\textsc{attr}\\
\glt ‘the big one’
%%%
\ex {\rm Demonstrative}\\
\gll taiz\textbf{-ėz}\\
\textsc{dem:dist}-\textsc{attr}\\
\glt ‘that one over there’
%%%
\ex {\rm Possessor noun phrase}\\
\gll Ivan-len\textbf{-ėz}\\
Ivan-\textsc{gen}-\textsc{attr}\\
\glt ‘that one of Ivan's’
\end{xlist}
%%%
\ex {\rm Contrastive focused attribute}
\begin{xlist}
\ex {\rm Demonstrative}\\
\label{attr demnmlz}
\gll taiz\textbf{-ėz} gurt\\
\textsc{dem:dist}-\textsc{attr} house\\
\glt ‘\textsc{that} (particular) house over there’
%%%
\ex {\rm Possessor noun phrase}\\
\label{attr npnmlz}
\gll Ivan-len\textbf{-ėz} gurt\\
Ivan-\textsc{gen}-\textsc{attr} house\\
\glt ‘\textsc{Ivan's} house (and not someone else's)’
\end{xlist}
\end{exe}
%%%
Examples (\ref{attr demnmlz}–\ref{attr npnmlz}) show that attributive nominalization in Udmurt is a true attribution marking device which is polyfunctional and not restricted to \isi{headless noun phrase}s.
\is{species marking!definite|(}
\is{contrastive focus|(}
Note that the attributive article is normally labeled “determinative suffix” (or in similar terms) in the Udmurt (and Uralic) grammatical tradition. This label probably originates from the formative's function as a quasi-definite marker. But “determinative” inflection is obligatory only in the case of differential object marking with the marked versus the unmarked accusative. Note also that the definite-marked accusative suffix, again, is historically identical with the 3\textsuperscript{rd} person possessive suffix.
%%%
\newpage
\begin{exe}
\ex {\rm Differential object marking in Udmurt \citep[22]{winkler2001}}
\begin{xlist}
\ex
\gll mon kniga lɨdǯ́-i\\
\textsc{1sg} book(\textsc{acc}) read-\textsc{1sg.pst}\\
\glt ‘I have read a book.’
%%%
\ex
\gll mon (ta) kniga\textbf{-jez} lɨdǯ́-i\\
\textsc{1sg} this book-\textsc{acc} read-\textsc{1sg.pst}\\
\glt ‘I have read the (i.e., ‘this certain’) book.’
\end{xlist}
\end{exe}
%%%
Note also that in these and similar examples, the concept of definiteness does not always coincide with the use of the differential “in\slash{}definite accusative” marking. According to \citet[21]{winkler2001}, “the marked accusative is used if the object itself is focused, whereas the unmarked is employed if the action itself bears the logical accent.” Accordingly, even such occurrences of the “determinative suffix” thus resemble focus marking rather than definiteness marking.
Even though contrastive focus inflection of nouns (or noun phrases) would be the result of purely morphological (morpho-semantic) assignment, contrastive focus inflection of adnominal adjectives can only be analyzed as a morpho\hyp{}syntactic feature assigned noun phrase internally. This is evidenced by the agreement pattern: whereas adjectives in non-contrasted (unmarked) constructions are simply juxtaposed to the head noun, contrastive focused adjectives normally show head\hyp{}driven number agreement.\footnote{The different order of morphemes in certain members of contrastive focus inflection paradigms (i.e., number-, case-, and (former) possessive suffix) as compared to the historically similar “regular” possessive inflection \citep[32]{winkler2001} is not of concern here. This phenomenon does, however, provide evidence for the analysis of the contrastive focus marker of adjectives and the possessive marker of nouns as two different formatives from a synchronic point of view.} Agreement marking on the adjective is clearly assigned by syntax, the head noun being the agreement trigger and the attributive adjective (in contrastive focus) being the agreement target.
Attributive marking in contrastive focus constructions in Udmurt (and the other Permic languages) is similar in theory to prototypical anti\hyp{}construct state agreement marking in languages like Russian,\il{Russian} with regard to both synchrony and diachrony. The construction is still analyzed as attributive nominalization because the agreement marking on the nominalized attribute is the indirect result of the attributive appositional construction and the nominalizing and agreement formatives are not fused synchronically.
\is{attributive nominalization|)}
\largerpage
\paragraph*{Appositional head\hyp{}driven agreement in Udmurt}
Note, however, that in Udmurt, number agreement also sometimes occurs without the contrastive focus marker.
%%%
\begin{exe}
\ex {\rm Head\hyp{}driven plural agreement in Udmurt}
\begin{xlist}
\ex
\gll badǯ́ym-eš́ gurt-jos\\
big-\textsc{pl} house-\textsc{pl}\\
\glt ‘\textsc{big} houses’ \citep[40]{winkler2001}
\ex
\gll paśkɨt-eś uram-jos\\
wide-\textsc{pl} street-\textsc{pl}\\
\glt ‘\textsc{wide} streets’ \citep[63]{csucs1990}
\end{xlist}
\end{exe}
%%%
According to \citet[63]{csucs1990}, \isi{head\hyp{}driven agreement} marking in constructions without the “determinative suffix” is the result of analogy. The fact that their use is still restricted to contrastive focus constructions, and is therefore an appositional attribution marking device, is crucial for the analysis as \isi{appositional head\hyp{}driven agreement} (as opposed to true \isi{head\hyp{}driven agreement}).
\is{contrastive focus|)}
\is{species marking!definite|)}
\il{Udmurt|)}
\il{Permic languages|)}
\il{Finnic languages|(}
\subsection{Finnic}
%%%
The Finnic (aka Fennic\il{Fennic languages|see{Finnic languages}} or Baltic Finnic)\il{Baltic Finnic languages|see{Finnic languages}} branch of Uralic comprises the following languages: \ili{Livonian}, \ili{Estonian}, \ili{Votic}, \ili{Finnish}, \ili{Ingrian}, \ili{Karelian}, \ili{Lude} and \ili{Veps}.\footnote{The Võro\il{Estonian!Võro} variety of Estonian, the Meänkieli\il{Finnish!Meänkieli} and Kveeni\il{Finnish!Kveeni} varieties of Finnish, and the Olonets\il{Karelian!Olonets} variety of Karelian are not considered distinct languages here.}
\is{head\hyp{}driven agreement|(}
The Finnic branch is exceptional among Uralic in that all of its member languages regularly exhibit head\hyp{}driven agreement as the regular type of adjective attribution marking.
\il{Finnish|(}
\paragraph*{Head\hyp{}driven agreement in Finnish}
\label{finnish synchr}
The morphological features assigned to the head noun in Finnish are passed on to its adjectival (and other) modifiers. Finnish adjectives thus show a prototypical instance of head\hyp{}driven agreement.
\begin{exe}
\ex {\rm Finnish (personal knowledge)}
\begin{xlist}
\ex
\gll \textbf{iso} talo\\
big house\\
\glt ‘big house’
%%%
\ex
\label{fin num}
\gll \textbf{iso-t} talo-t\\
big-\textsc{pl} house-\textsc{pl}\\
\glt ‘big houses’
%%%
\ex
\label{fin case}
\gll \textbf{iso-i-ssa} talo-i-ssa\\
big-\textsc{pl}-\textsc{iness} house-\textsc{pl}-\textsc{iness}\\
\glt ‘in big houses’
%%%
\ex
\label{fin poss}
\gll \textbf{iso} {(*iso-ni)} talo-ni\\
big big-\textsc{poss:1sg} house-\textsc{poss:1sg}\\
\glt ‘my big house’
\end{xlist}
\end{exe}
%%%
Note, however, that not all morphological features assign their values to the attributive adjective in Finnish. Whereas number (\ref{fin num}) and case marking (\ref{fin case}) are assigned to the adjective, possessive marking (\ref{fin poss}) is not (as noted earlier in \S\ref{head-driven agreement}).
\il{Finnish|)}
\il{Finnic languages|)}
\is{head\hyp{}driven agreement|)}
\il{Saamic languages|(}
\subsection{Saamic}
\label{saami synchr}
%%%
Saamic languages are spoken on the Scandinavian peninsula in north-central Norway and Sweden as well as in northern Finland and on the Kola peninsula in northwesternmost Russia. Saamic branches further into an eastern and a western subgroup.
The Saamic languages are exceptional among Uralic and the languages of most other families of \isi{Europe} in that they exhibit special attributive marking of adjectives, prototypically expressed by an invariable attributive suffix. In \S\ref{dep-marking state} of Part~II (Typology), this noun phrase type was characterized as \textit{dependent\hyp{}marked attributive state}; the corresponding formative is labeled \textit{anti\hyp{}construct state marker}. Note, however that the regular use of this inflectional category of adjectives and the relevant formatives vary considerably across the different Saamic languages.
\il{East Saamic languages|(}
\subsubsection{East Saamic}
%%%
The four living East Saamic languages Ter,\il{Ter Saami} Kildin,\il{Kildin Saami} Skolt\il{Skolt Saami} and Inari Saami\il{Inari Saami} are spoken on the Kola peninsula in northwesternmost Russia and in the adjacent parts of northern Finland.
\il{Skolt Saami|(}
\paragraph*{Anti\hyp{}construct state in Skolt Saami}\hspace{0.4cm}
Prototypically, the anti\hyp{}construct state marking suffix in Saamic languages has the shape \textit{-(V)s \textasciitilde-(V)s'}.\footnote{The palatalized variant occurs in Ter Saami and Kildin Saami.} The suffix is found in all Saamic languages (\citealt{riesler2006b}; see also \S\ref{saamic diachr} where the origin of attributive state marking in Saamic is dealt with in detail).
\is{predicative marking|(}
In Skolt Saami, the prototypical pairs of predicative and attributive adjective forms are equipped with the suffixes \textit{-(V)d} \textsc{pred} and \textit{-(V)s} \textsc{attr} respectively, although other suffix pairs occur as well \citep[173–176]{feist2015a}. Whereas the suffix \textit{-(V)d} in \REF{skolt pred} marks the predicative state of the adjective, the suffix \mbox{\textit{-(V)s}} is an attributive state marker. The examples (\ref{skolt attr}) show that the formative is invariable and does not alter its form in a plural or case marked noun phrase.
%%%
\begin{exe}
\ex {\rm Skolt Saami (personal knowledge)}
\begin{xlist}
\ex
\label{skolt pred}
{\rm Predicative}
\begin{xlist}
\gll tät nijdd lij \textbf{moočč-âd}\\
this girl is beautiful-\textsc{pred}\\
\glt ‘this girl is beautiful’
\end{xlist}
%%%
\ex
\label{skolt attr}
{\rm Attributive}
\begin{xlist}
\ex
\gll tät lij \textbf{mooʹčč-es} nijdd\\
this is beautiful-\textsc{attr} girl\\
\glt ‘this is a beautiful girl’
%%%
\ex
\gll täk liâ \textbf{mooʹčč-es} niõđ\\
this are beautiful-\textsc{attr} girl\textbackslash\textsc{pl}\\
\glt ‘these are beautiful girls’
%%%
\ex
\gll \textbf{mooʹčč-es} niõđ-i põrtt\\
beautiful-\textsc{attr} girl-\textsc{gen.pl} house\\
\glt ‘the house of the beautiful girls’
\end{xlist}
\end{xlist}
\end{exe}
%%%
In all Saamic languages, attributive (and predicative) state marking of adjectives is complex and determined by certain lexically defined classes and subclasses of adjectives. Many adjectives are marked only for attributive state but show the unmarked stem form in the predicative form. Consider for instance \textit{neuʹrr} [\textsc{pred}] versus \textit{neeuʹr-es} [\textsc{attr}] ‘bad’, in Skolt Saami. In addition, in the predicative forms of several adjectives, suffixes other than \textit{-(V)d} also occur. Finally, there are a few adjectives which also use the attributive suffix in their predicative forms \citep[cf.][173–176]{feist2015a}.
In fact, a general tendency is noticeable in all Saamic languages: the differentiated morphological marking of predicative and attributive adjectives is being abolished in favor of using the pure or extended stem forms in both syntactic positions. As a result, attributive state marking seems to be in dissolution \citep{riesler2006b}. Several classes of adjectives, however, do not seem to be as affected by the functional spread of the \isi{juxtaposition}al type. In Skolt Saami, the anti\hyp{}construct state marker is even used productively in several derived adjective classes, such as with the abessive adjectivizer.\is{adjective derivation}
%%%
\newpage
\begin{exe}
\il{Skolt Saami!Notozero}
\ex {\rm Derived adjectives in Skolt Saami (Notozero) \citep[279]{senkevic-g1968}}
\begin{xlist}
\ex {\rm Attributive}\\
\gll \textbf{päärn-tʹem-es} neezzan\\
child-\textsc{abess.adjz-attr} woman\\
\glt ‘(a) woman without children’
%%%
\ex {\rm Predicative}\\
\gll tät neezzan lij \textbf{päärn-tʹem}\\
this woman is child-\textsc{abess.adjz}\\
\glt ‘this woman is without children’
\end{xlist}
\end{exe}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Skolt Saami}
Whereas dependent\hyp{}marked attributive state is the prototypical type of adjective attribution marking in Skolt (as well as in the other Saamic languages), certain adjectives are never inflected in their attributive form, one instance being \textit{nuõrr} ‘young’ \citep[cf.~also][176]{feist2015a}.
%%%
\begin{exe}
\ex {\rm Skolt Saami (personal knowledge)}
\begin{xlist}
\ex {\rm Attributive}
\begin{xlist}
\gll tät lij \textbf{nuõrr} nijdd\\
this is young girl\\
\glt ‘this is a young girl’
%%%
\ex
\gll täk liâ \textbf{nuõrr} niõđ\\
this are young girl\textbackslash\textsc{pl}\\
\glt ‘these are young girls’
\end{xlist}
%%%%%JW: warum zeigst du hier ein PRED-Beispiel? ist das wirklich relevant hier? Außerdem sieht man, dass die PRED-ATTR-Formen unterschiedlich sind (Stufenwechsel)~– das wäre auch morphologische Markierung, nicht nur Juxtaposition.
\ex {\rm Predicative}\\
\gll täk niõđ liâ \textbf{nuõr}\\
this girl is young\textbackslash\textsc{pred.pl}\\
\glt ‘these girls are young’
\end{xlist}
\end{exe}
%%%
The noun phrase type in which ‘young’ and other members of this adjectival class occur must be characterized as {juxtaposition}. Hence, Skolt Saami exhibits a second, minor adjective attribution marking device in addition to attributive state marking.
\is{predicative marking|)}
\il{Skolt Saami|)}
\il{East Saamic languages|)}
\is{juxtaposition|)}
\il{West Saamic languages|(}
\subsubsection{West Saamic}
The five West Saamic languages are Northern,\il{Northern Saami} Lule,\il{Lule Saami} Pite,\il{Pite Saami} Ume\il{Ume Saami} and \ili{Southern Saami}. They are spoken in northern Norway and Sweden and in the adjacent parts of northern Finland.
\il{Northern Saami|(}
\il{Pite Saami|(}
\is{predicative marking|(}
The default adjective attribution marking device in all West Saamic languages is anti\hyp{}construct state marking, just as in East Saamic.\il{East Saamic languages} Only the few members of a marginal subclass of adjectives are attributed by means of other devices. In general, West Saamic languages are similar to East Saamic in their high degree of irregularity in the morphological marking of attributive adjectives, although grammars of \ili{Northern Saami}, usually taking a rather normative-descriptive approach (e.g., \citealt{nickel1990,sammallahti1998b,svonni2009a}), stress the systemic character of attributive versus predicative marking with the suffix \textit{-(V)s} being the prototypical formative for attributive morphology.
For another West Saamic language, Pite Saami, and using exclusively corpus data \citet[128–129]{wilbur2014a} argues that the formative \textit{-(V)s} is used much too irregularly to be considered a productive attributive suffix. Because of the considerable inconsistencies in morphological patterns between corresponding attributive and predicative adjectives, \citet[134]{wilbur2014a} generally prefers to analyze these two sets of adjectives simply as semantically and etymologically related, rather than morphologically derivable adjectives. However, even if a large part of these adjectives consists of suppletive pairs, the morpho-syntax of adjectives in Pite Saami shares one important characteristic with the other Saamic languages: whereas attributive adjectives never show morphological agreement, predicative adjectives agree (in \textsc{number}) with the subject noun phrase.
\is{predicative marking|)}
\il{Pite Saami|)}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Northern Saami}
For Northern Saami, the default attribution device is anti\hyp{}construct state marking, like in all Saamic languages. A few adjectives, however, regularly show agreement with the head noun in number and case. In Northern Saami, the adjective ‘good’ and sometimes also the adjective ‘bad’ follow this type.
%%%
\begin{exe}
\settowidth\jamwidth{[good-\textsc{gen:pl}(\textasciitilde \textsc{com:pl}) knife-\textsc{com:pl}]}
\ex {\rm Northern Saami \citep[83]{nickel1990}}
\begin{xlist}
\ex buorre niibi {\rm ‘good knife’} \jambox{{\rm [good(\textsc{nom:sg}) knife(\textsc{nom:sg})]}}
\ex buori niibbi \jambox{{\rm [good\textbackslash\textsc{gen:sg} knife\textbackslash\textsc{gen:sg}]}}
\ex buori niibá-i \jambox{{\rm [good\textbackslash\textsc{gen:sg} knife-\textsc{ill:sg}]}}
\ex buori niibi-s \jambox{{\rm [good\textbackslash\textsc{gen:sg} knife-\textsc{loc:sg}]}}
\ex buri-in niibbi-in \jambox{{\rm [good-\textsc{com:sg} knife-\textsc{com:sg}]}}
\ex buori-t niibbi-t \jambox{{\rm [good-\textsc{nom:pl} knife-\textsc{nom:pl}]}}
\ex buori-id niibbi-id \jambox{{\rm [good-\textsc{gen:pl} knife-\textsc{gen:pl}]}}
\ex buori-id(\textasciitilde ide) niibbi-ide \jambox{{\rm [good-\textsc{gen:pl}(\textasciitilde \textsc{ill:pl}) knife-\textsc{ill:pl}]}}
\ex buri-in niibbiin \jambox{{\rm [good\textbackslash\textsc{loc:pl} knife-\textsc{loc:pl}]}}
\ex buori-id(\textasciitilde iguin) niibbi-iguin \jambox{{\rm [good-\textsc{gen:pl}(\textasciitilde \textsc{com:pl}) knife-\textsc{com:pl}]}}
\ex buorri-n niibi-n \jambox{{\rm [good-\textsc{ess} knife-\textsc{ess}]}}
\end{xlist}
\end{exe}
%%%
Note that the agreement inflection of the adjective can be characterized as defective because it does not distinguish all single case forms in the paradigm.\is{agreement marking!defective agreement paradigm}
\il{Northern Saami|)}
\il{West Saamic languages|)}
\il{Saamic languages|)}
\il{Uralic languages|)}
\is{head\hyp{}driven agreement|)}
\il{Indo-European languages|(}
\section{Indo-European}
%%%
Indo-European is among the world's language families with the greatest geographic distribution. Most of the European languages belong to this family. But Indo-European languages are spoken as far East as on the \isi{South Asia}n subcontinent. The family can be divided into nine branches \citep[218]{salminen2007}, all of which are represented in the present investigation.
The prototypical adjective attribution marking type in Indo-European is \isi{head\hyp{}driven agreement}. This type is also reconstructed for the \ili{Proto\hyp{}Indo-European} language \citep{decsy1991,watkins1998}. Due to the development of certain secondary types of adjective attribution marking devices, however, divergence is relatively high inside the Indo-European family. Furthermore, in several branches of Indo-European, \isi{head\hyp{}driven agreement} has been lost in favor of various other types of attribution marking (as will be shown in Part~IV Diachrony).
Among the languages of northern Eurasia, the Indo-European family exhibits the highest diversity with regard to the number of possible adjective attribution marking devices. The following types are attested in different Indo-European languages:
%%%
\begin{itemize}
\item juxtaposition\is{juxtaposition}
\item head\hyp{}driven agreement\is{head\hyp{}driven agreement}
\item construct-state marking
\item anti\hyp{}construct state marking
\item anti\hyp{}construct state agreement marking
\item attributive nominalization\is{attributive nominalization}
\item incorporation.
\end{itemize}
%%%
\il{Albanian languages|(}
\subsection{Albanian}
\label{albanian synchr}
%%%
The Albanian branch of Indo-European is represented by the two languages Standard \ili{Albanian} and \ili{Arvanitika}.
\il{Albanian|(}
\is{attributive nominalization|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Attributive nominalization + head\hyp{}driven agreement in Albanian}
In both Albanian languages, adjectives normally follow the head noun and are marked with an article which links its host to the modified noun. Additionally, adjectives are equipped with agreement inflection suffixes co-referencing the \textsc{number}-, \textsc{gender}-, \textsc{case}- and \textsc{species}\is{species marking} values of the head noun. The language thus exhibits an attributive marking device which is a combination of a phonologically free article (historically an attributive nominalizer) and agreement suffixes.
%%%
\begin{exe}
\ex {\rm Standard Albanian \citep[examples from][166–167]{himmelmann1997}}
\label{albanian ex}
\begin{xlist}
\ex
\gll një shok \textbf{i} \textbf{mirë}\\
one:\textsc{m} friend:\textsc{indef:m} \textsc{attr:nom.sg.m} good:\textsc{nom.sg.m}\\
\glt ‘one good friend’
%%%
\ex
\gll shok=u \textbf{i} \textbf{mirë}\\
friend=\textsc{def:nom.sg.m} \textsc{attr:nom.sg.m} good:\textsc{nom.sg.m}\\
\glt ‘the good friend’
%%%
\ex
\gll shok=un \textbf{e} \textbf{mirë}\\
friend=\textsc{def:acc.sg.m} \textsc{attr:acc.sg.m} good:\textsc{acc.sg.m}\\
\glt ‘the good friend (acc.)’
\end{xlist}
\end{exe}
%%%
Note that the circum-positioned agreement marker also occurs with predicative adjectives.\is{predicative marking}
%%%
\begin{exe}
\ex {\rm Standard Albanian \citep{demiraj1998}}\\
%\begin{xlist}
%\ex Predicative agreement of “article adjectives”
\gll shok=u është \textbf{i} \textbf{bukur}\\
friend-\textsc{def:nom.sg.m} be\textsc{.3sg.prs} \textsc{attr:nom.sg.m} pretty:\textsc{nom.sg.m}\\
\glt ‘the friend is pretty’
%\ex Predicative agreement of “simple” adjectives
%\gll shok=u është \textbf{besnik}\\
% friend-\textsc{def:nom.sg.m} be\textsc{.3sg.prs} true:\textsc{nom.sg.m}\\
%\glt ‘the friend is faithful’
%\end{xlist}
\end{exe}
%%%
\is{predicative marking|(}
Since adjectives in attributive and predicative position are both equipped with the circumfixed agreement marker the language seems to belong simply to the head\hyp{}driven agreement type. However, true predicative adjectives are not found in Albanian. Instead, attributive adjectives in \isi{headless noun phrase}s are used in predicative position. This is evidenced by case agreement of predicates.
%%%
\newpage
\begin{exe}
\ex {\rm Standard Albanian \citep{demiraj1998}}
\begin{xlist}
\ex
\gll Agimi {u kthye} \textbf{i} \textbf{dëshpëruar}\\
Agimi(\textsc{nom.sg.m}) returned \textsc{attr:nom.sg.m} sorrowful:\textsc{nom.sg.m}\\
\glt ‘Agim returned sorrowfully’
%%%
\ex
\gll Agimi(\textsc{acc.sg.m}) e pashtë \textbf{të} \textbf{dëshpëruar}\\
Agimi I saw \textsc{attr:acc.sg.m} sorrowful:\textsc{acc.sg.m}\\
\glt ‘I saw Agimi sorrowful’
\end{xlist}
\end{exe}
%%%
On the other hand, the similar agreement behavior of attributive and predicative adjectives seems to indicate the absence of specific attributive morpho-syntactic marking. However, the attributive article is polyfunctional and can also link other adnominal attributes in addition to adjectives to the modified noun. The analysis of adjective attribution marking in Albanian as belonging to the attributive nominalization type (in combination with head\hyp{}driven agreement) thus seems justified.
%%%
\begin{exe}
\ex {\rm Standard Albanian \citep{demiraj1998}}
\begin{xlist}
\ex
\gll roman-i \textbf{i} tretë\\
novel-\textsc{def:nom.sg.m} \textsc{attr:nom.sg.m} third\\
\glt ‘the third novel’
%%%
\ex
\gll libr-i \textbf{i} nxënës-it\\
book(\textsc{m})-\textsc{def:nom.sg.m} \textsc{attr:nom.sg.m} pupil-\textsc{def:gen/dat.sg}\\
\glt ‘the pupil's book’
\end{xlist}
\end{exe}
\is{attributive nominalization|)}
\paragraph*{Head\hyp{}driven agreement in Albanian}
Note, however, that the occurrence of the attributive article is restricted to a lexically defined subclass of adjectives in Albanian: only the so-called “article adjectives” are regularly marked with the article. Other adjectives are marked with head\hyp{}driven agreement affixes alone.
%%%
\begin{exe}
\ex {\rm Standard Albanian \citep[examples from][167]{himmelmann1997}}
\begin{xlist}
\ex
\gll shok=u \textbf{besnik}\\
friend-\textsc{def:nom.sg.m} true:\textsc{nom.sg.m}\\
\glt ‘the faithful friend’
%%%
\ex
\gll një shok \textbf{besnik}\\
one:\textsc{m} friend:\textsc{indef:m} true:\textsc{nom.sg.m}\\
\glt ‘one faithful friend’
\end{xlist}
\end{exe}
%%%
Again, predicative adjectives behave similar to attributive adjectives.
%%%
\begin{exe}
\ex {\rm Standard Albanian \citep{demiraj1998}}\\
\begin{xlist}
\ex {\rm Predicative agreement of “article adjectives”}\\
\gll shok=u është \textbf{i} \textbf{bukur}\\
friend-\textsc{def:nom.sg.m} be\textsc{.3sg.prs} \textsc{attr:nom.sg.m} pretty:\textsc{nom.sg.m}\\
\glt ‘the friend is pretty’
%%%
\ex {\rm Predicative agreement of “simple” adjectives}\\
\gll shok=u është \textbf{besnik}\\
friend-\textsc{def:nom.sg.m} be\textsc{.3sg.prs} true:\textsc{nom.sg.m}\\
\glt ‘the friend is faithful’
\end{xlist}
\end{exe}
\il{Albanian|)}
\is{predicative marking|)}
\is{head\hyp{}driven agreement|)}
\il{Arvanitika|(}
\is{attributive nominalization|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Attributive nominalization + head\hyp{}driven agreement in Arvanitika}
Adjective attribution marking in Arvanitika is very similar to Standard \ili{Albanian}. One adjective class shows head\hyp{}driven agreement marking by means of suffixes. The second adjective class is cognate with the so-called “article adjectives” in Albanian and exhibits attributive nominalization.
%%%
\begin{exe}
\ex {\rm Arvanitika \citep[303]{sasse1991}}
\begin{xlist}
\ex
\gll ɲə́ djáʎə \textbf{i-mírə}\\
one:\textsc{m} boy:\textsc{indef.m} \textsc{m}-good:\textsc{m}\\
\glt ‘one good boy’
%%%
\ex
\gll djáʎi \textbf{i-mírə}\\
boy:\textsc{def.m} \textsc{m}-good:\textsc{m}\\
\glt ‘the good boy’
\end{xlist}
\end{exe}
%%%
Unlike in Standard Albanian,\il{Albanian} however, the preposed attributive nominalizer in Arvanitika is a phonologically bound formative. This is evidenced by its phonological behavior in adjective compounds, where the marker remains in its position bound to the adjective stem.
%%%
\begin{exe}
\ex {\rm Arvanitika \citep[304]{sasse1991}}
\label{alb noclitic}
\begin{xlist}
\ex[]{
\gll \textbf{miso-i-}ngrə́nə / \textbf{miso-tə-}ngrə́nə\\
half-\textsc{m}-mounted:\textsc{m} { } half-\textsc{acc.m}-mounted:\textsc{m}\\
\glt ‘half-mounted’
}
%%%
\ex[*]{i-miso-ngrə́nə / tə-miso-ngrə́nə}
\end{xlist}
\end{exe}
%%%
Example (\ref{alb noclitic}) shows that the compound degree word \textit{miso-} does not move between the adjective stem and the attributive nominalizer. Consequently, the nominalizer can be characterized as a \isi{clitic} (because it is phonologically bound but morpho-syntactically free) which always attaches on a fixed position, i.e., on the left of the adjective stem.\footnote{Note, however, that the agreement categories \textsc{case/number/gender} are merged into several differentiated morphemes in the suffixed part of the circumfix \citep[124–128]{sasse1991}.}
\il{Arvanitika|)}
\il{Albanian languages|)}
\is{attributive nominalization|)}
\is{head\hyp{}driven agreement|)}
\il{Armenian languages|(}
\il{Eastern Armenian|(}
\subsection{Armenian}
\label{armenian-synch}
%%%
Armenian is a branch consisting only of two closely related varieties, of which only the Eastern Armenian standard language is considered here.
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Eastern Armenian}
In the unmarked construction, attributive adjectives are unmarked and precede the modified noun.
%%%
\begin{exe}
\ex {\rm Eastern Armenian \citep{ajello1998}}
\begin{xlist}
\ex
\gll \textbf{bari} gorc\\
good work(\textsc{nom.sg})\\
\glt ‘good work’
%%%
\ex
\gll \textbf{bari} gorc-s\\
good work-\textsc{acc.pl}\\
\glt ‘good work (acc.)’
\end{xlist}
\end{exe}
\is{juxtaposition|)}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Armenian}
A few monosyllabic adjectives show head\hyp{}driven agreement marking in Armenian.
In theory, however, all adjectives in an emphatic construction can occur in a noun phrase with reversed constituent order. In “emphatic position” \citep[224]{ajello1998}, i.e., in \isi{contrastive focus} attributive adjectives show agreement in case and number as a rule.
%%%
\begin{exe}
\ex {\rm Eastern Armenian \citep[224]{ajello1998}}\\
\gll bazum gorc-s \textbf{bari-s}\\
much work-\textsc{acc.pl} good-\textsc{acc.pl}\\
\glt ‘much \textsc{good} work (acc.)’
\end{exe}
\il{Eastern Armenian|)}
\il{Armenian languages|)}
\is{head\hyp{}driven agreement|)}
\il{Indo-Iranian languages|(}
\subsection{Indo-Iranian}
%%%
Indo-Iranian (aka Aryan)\il{Aryan|see{Indo-Iranian languages}} is a major branch within Indo-European. But only a few Indo-Iranian languages belonging to the Iranian\il{Iranian languages} and Indo-Aryan\il{Indo-Aryan languages} subbranches are spoken in northern Eurasia and thus considered here. Most other Indo-Iranian languages are spoken in the \isi{Middle East} and in \isi{South Asia} and hence outside the investigated geographic area.
\il{Indo-Aryan languages|(}
\il{Romani languages|(}
\subsubsection{Indo-Aryan}
%%%
Indo-Aryan (aka Indic)\il{Indic|see{Indo-Aryan languages}} is a large subbranch of Indo-Iranian, most member languages of which are spoken on the \isi{South Asia}n subcontinent. Outlier languages, spoken in northern Eurasia include \ili{Parya}, a language which was recently discovered in Tajikistan in \isi{Inner Asia} \citep[22]{masica1991}, and the group of Romani languages. Several varieties of Romani are spoken all over \isi{Europe}. Some of them are not mutually intelligible. Rather than being one single language, Romani is thus a group of languages which comprise at least the four subbranches Vlax Romani,\il{Vlax Romani languages} Balkan Romani,\il{Balkan Romani languages} Central Romani\il{Central Romani languages} and North Romani\il{North Romani languages} with several sub-varieties in each of them \citep[2–3]{halwachs-etal2002}.
The default type of adjective attribution marking in Indo-Aryan languages is \isi{head\hyp{}driven agreement} in noun phrases with head-final constituent order \citep[369]{masica1991}. Agreement features in the Romani languages are \textsc{gender} and \textsc{number}, and in most varieties also \textsc{case}. The unmarked constituent order in all varieties of Romani is adjective-noun.
\il{Burgenland Romani|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Burgenland Romani}
\label{romani synchr}
In the Burgenland variety of Romani, adjectives normally show agreement in gender, number and also case with the head noun. Case agreement, however, can be characterized as defective, since all attributive adjectives preceding oblique cases have one similar oblique form.\is{agreement marking!defective agreement paradigm}
%%%
\begin{exe}
\ex {\rm Burgenland Romani \citep[22–23]{halwachs-etal2002}}
\begin{xlist}
\ex
\gll \textbf{bar-o} phral\\
big-\textsc{nom:m.sg} brother(\textsc{m})\\
\glt ‘big brother’
%%%
\ex
\gll \textbf{bar-i} phen\\
big-\textsc{nom:f.sg} sister(\textsc{f})\\
\glt ‘big sister’
\end{xlist}
\end{exe}
\is{head\hyp{}driven agreement|)}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Burgenland Romani}
A minor lexically defined subclass of adjectives in Burgenland Romani is indeclinable and juxtaposed to the head noun.
%%%
\begin{exe}
\ex {\rm Burgenland Romani \citep[22–23]{halwachs-etal2002}}
\begin{xlist}
\ex
\gll \textbf{schukar} phral\\
beautiful brother(\textsc{m})\\
\glt ‘beautiful brother’
%%%
\ex
\gll \textbf{schukar} phen\\
beautiful sister(\textsc{f})\\
\glt ‘beautiful sister’
\end{xlist}
\end{exe}
\il{Burgenland Romani|)}
\is{juxtaposition|)}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Vlax Romani}
\citet{hancock1995} describes the use of a “repeated definite article”\is{species marking!definite} in \isi{contrastive focus} constructions in Vlax Romani.
%%%
\begin{exe}
\ex {\rm Vlax Romani \citep[30]{hancock1995}}
\begin{xlist}
\ex {\rm Head\hyp{}driven agreement (unmarked construction)}\is{head\hyp{}driven agreement}\\
\gll o \textbf{baro} raklo\\
\textsc{def} big boy\\
\glt ‘the big boy’
%%%
\ex {\rm Attributive nominalization (emphatic construction)}\\
\gll o raklo \textbf{o} \textbf{baro}\\
\textsc{def} {boy} \textsc{attr} big\\
\glt ‘the \textsc{big} boy’
\end{xlist}
\end{exe}
\il{Romani languages|)}
\il{Indo-Aryan languages|)}
\is{attributive nominalization|)}
\il{Iranian languages|(}
\subsubsection{Iranian}
\label{iranian synchr}
The second subbranch of Indo-Iranian is formed by Iranian languages, only a few of which are spoken in northern Eurasia.
\is{construct state|(}
A well-known characteristic of noun phrase structure in Iranian languages is the occurrence of the Ezafe construct marking which licenses the attribution of adjectives (and other syntactic classes of modifiers). The Iranian languages surveyed in the present investigation, however, exhibit some diversity in this respect. Attributive construct state marking occurs regularly only in the western Iranian languages Northern Kurdish\il{Northern Kurdish} (aka Kurmanji,\il{Kurmanji|see{Northern Kurdish}} Kirmancî)\il{Kirmancî|see{Northern Kurdish}} and \ili{Tajik}.
\il{Tajik|(}
\paragraph*{Attributive construct state in Tajik}
Tajik follows the Iranian prototype and exhibits a head-marking construct state marking suffix.
%%%
\begin{exe}
\ex {\rm Tajik \citep{rastorgueva1963}}
\begin{xlist}
\ex
\gll duxtar\textbf{-i} \textbf{xušrūj}\\
girl-\textsc{attr} beautiful\\
\glt ‘a pretty girl’
%%%
\ex
\gll duxtar-on\textbf{-i} \textbf{xušrūj}\\
girl-\textsc{pl}-\textsc{attr} beautiful\\
\glt ‘pretty girls’
\end{xlist}
\end{exe}
\il{Tajik|)}
\is{construct state|)}
\il{Northern Talysh|(}
\paragraph*{Anti\hyp{}construct in Northern Talysh}
\label{talysh synchr}
The constituent order in noun phrases in Northern Talysh is adjective-noun. The language is exceptional among the Iranian (and Indo-European) languages considered here in exhibiting dependent\hyp{}marking anti\hyp{}construct state instead of head-marking \isi{construct state} as the default type of adjective attribution marking.
%%%
\begin{exe}
\ex {\rm Northern Talysh \citep[27]{schulze2000}}%CHECK PAGES
\begin{xlist}
\ex
\gll \textbf{āğəlmānd-a} odam-on\\
clever-\textsc{attr} man-\textsc{pl}\\
\glt ‘clever people’
%%%
\ex
\gll \textbf{yol-a} di\\
big-\textsc{attr} tree\\
\glt ‘(a) big tree’
\end{xlist}
\end{exe}
\il{Northern Talysh|)}
\il{Ossetic|(}
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Ossetic}
Ossetic is another exceptional language among Iranian, because the language exhibits juxtaposition as the default type of adjective attribution marking.
%%%
\begin{exe}
\ex {\rm Ossetic \citep[12]{abaev1964}}
\label{ossetic attrcomp}
\begin{xlist}
\ex {\rm Simple noun}\\
\gll færǽt / fǽræt\\
ax { } ax\textbackslash\textsc{def}\\
\glt ‘axe’ / ‘the axe’
%%%
\ex {\rm Noun phrase with adjectival modifier}\\
\gll \textbf{cyrg'-}fǽræt / \textbf{cýrg'-}færæt\\
sharp-axe { } sharp-ax\textbackslash\textsc{def}\\
\glt ‘sharp axe’ / ‘the sharp axe’
\end{xlist}
\end{exe}
%%%
Stress patterns provide evidence for the analysis of Ossetic noun phrase structure as phonological compounds. According to \citet[10]{abaev1964}, “syntactically connected word groups” (such as noun phrases) are marked by single stress. Note that stress, moving from the second to the first syllable marks definiteness\is{species marking!definite} in Ossetic \citep[12]{abaev1964}. There is, however, no evidence that the compounded adjectives are syntactically incorporated.
\is{juxtaposition|)}
Note that attributive \isi{construct state} marking which is cognate with the Ezafe in other Iranian languages occurs in Ossetic as well, but its use is restricted to certain “emphatic”, i.e., \isi{contrastive focus} constructions \citep[467]{thodarson1989}.
\il{Ossetic|)}
\il{Iranian languages|)}
\il{Indo-Iranian languages|)}
\il{Baltic languages|(}
\subsection{Baltic}
\label{baltic synchr}
%%%
\il{East Baltic languages|(}
\subsubsection{East Baltic}
%%%
The Baltic languages form a small branch among Indo-European and are represented in the present survey only by the two languages Lithuanian\il{Lithuanian} and Latvian.\il{Latvian} Both belong to the eastern subbranch of Baltic. All languages from the former western branch\il{West Baltic languages} of Baltic are extinct.
\is{species marking!definite|(}
\is{head\hyp{}driven agreement|(}
Two types of adjective attribution marking occur in modern Baltic languages: head\hyp{}driven agreement and anti\hyp{}construct state agreement. In the descriptive literature on Baltic languages, however, these two noun phrase types are normally not ascribed to syntax, but are described as different agreement declension types determined by the definite or indefinite semantics of the noun phrase.
In \S\ref{anti-constr agr} of Part~II (Typology) I have already argued extensively in favor of a syntactic differentiation of these two agreement marking devices in Baltic (as well as in various Slavic)\il{Slavic languages} languages. Consequently and for the sake of completeness, examples of head\hyp{}driven agreement marking (the so-called indefinite declension) and anti\hyp{}construct state agreement marking (the so-called definite declension) in Latvian\il{Latvian} and Lithuanian\il{Lithuanian} will be repeated in the following paragraphs.
\il{Latvian|(}\il{Lithuanian|(}
\paragraph*{Head\hyp{}driven agreement in Latvian and Lithuanian}
Adjectives modifying indefinite nouns show head\hyp{}driven agreement in Latvian and Lithuanian.
%%%
\begin{exe}
\ex
\begin{xlist}
\ex {\rm Latvian \citep[example from][122]{dahl2015a}}\\
\gll \textbf{liel-a} māja\\
big-\textsc{f.nom.sg} house(\textsc{f})\\
\glt ‘a big house’
%%%
\ex {\rm Lithuanian \citep[13]{bechert1993}}\\
\gll \textbf{gẽr-as} profèsorius\\
good-\textsc{nom.sg.m} professor(\textsc{m})\\
\glt ‘a good professor’
\end{xlist}
\end{exe}
\is{head\hyp{}driven agreement|)}
\paragraph*{Anti\hyp{}construct state agreement in Latvian and Lithuanian}
Adjectives modifying definite nouns show anti\hyp{}construct state agreement marking in Latvian and Lithuanian.
%%%
\begin{exe}
\ex
\begin{xlist}
\ex {\rm Latvian \citep[example from][122]{dahl2015a}}\\
\gll \textbf{liel-ā} māja\\
big-\textsc{attr:f.nom.sg} house(\textsc{f})\\
\glt ‘the big house’
%%%
\ex {\rm Lithuanian \citep[13]{bechert1993}}\\
\gll \textbf{ger-àsis} profèsorius\\
good-\textsc{attr:nom.sg.m} professor(\textsc{m})\\
\glt ‘the good professor’
\end{xlist}
\end{exe}
\il{Latvian|)}\il{Lithuanian|)}
\is{species marking!definite|)}
\il{East Baltic languages|)}
\il{Baltic languages|)}
\is{head\hyp{}driven agreement|(}
\il{Celtic languages|(}
\subsection{Celtic}
%%%
The modern Celtic languages belong to two main branches: Gaelic\il{Gaelic languages} and Brittonic.\il{Brittonic languages} By and large, all Celtic languages have preserved the Proto\hyp{}Celtic\il{Proto\hyp{}Celtic} noun phrase structure, including head\hyp{}driven agreement marking on attributive adjectives and noun-adjective constituent order.
\il{Gaelic languages|(}
\subsubsection{Gaelic}
%%%
\il{Scots Gaelic|(}
\paragraph*{Head\hyp{}driven agreement in Scots Gaelic}
Attributive adjectives (as well as other adnominal modifiers) in Scots Gaelic (aka Scottish Gaelic)\il{Scottish Gaelic|see{Scots Gaelic}} show agreement in \textsc{gender, number}, and \textsc{case}.
%%%
\begin{exe}
\ex {\rm Scots Gaelic \citep[201]{macauley1992}}
\begin{xlist}
\ex
\gll an cù \textbf{dubh}\\
\textsc{def:m} dog(\textsc{m}) black\textbackslash\textsc{m}\\
\glt ‘the black dog’
%%%
\ex
\gll a' chaora \textbf{dhubh}\\
\textsc{def:f} sheep(\textsc{f}) black\textbackslash\textsc{f}\\
\glt ‘the black sheep’
\end{xlist}
\end{exe}
%%%
Similar agreement patterns as in Scots Gaelic, with non-linear marking by means of word-initial permutation, are found in Irish \citep[73, 97]{odochartaigh1992}. In the third Gaelic language \ili{Manx}, however, most adjectives are used in an invariable form. Only a certain subclass of monosyllabic adjectives have preserved number agreement in Manx \citep[127]{thomsen1992}.
\il{Scots Gaelic|)}
\il{Gaelic languages|)}
\il{Brittonic languages|(}
\subsubsection{Brittonic}
%%%
The tendency towards a loss of agreement inflection of adjectives is also noticeable in the languages of the Brittonic branch of Celtic. Adjective inflection seems to be most intact in Welsh\il{Welsh} with preserved gender and number agreement \citep[298–299]{thomas1992a}. Breton\il{Breton} and Cornish\il{Cornish} exhibit only agreement in gender (\citealt[405]{ternes1992}; \citealt[355]{thomas1992b}).
\il{Brittonic languages|)}
\il{Celtic languages|)}
\is{head\hyp{}driven agreement|)}
\il{Germanic languages|(}
\subsection{Germanic}
%%%
The modern Germanic languages belong to two branches: North\il{North Germanic languages} and West Germanic.\il{West Germanic languages} The third Germanic subbranch, East Germanic,\il{East Germanic languages} is extinct and is not considered here.
The constituent order of adjective and noun is relatively strictly head-final in all modern Germanic languages.\footnote{The exclusive adjective-initial constituent order in modern Germanic languages is clearly innovative. In documents of all \ili{Old Germanic languages}, the order of adjective and noun was still relatively free \citep[cf.][]{heinrichs1954}.} Most Germanic languages have also preserved the inherited agreement marking on attributive adjectives. But several secondary attributive marking devices have evolved at different stages in the history of Germanic.
The following noun phrase types occur inside the Germanic branch of Indo-European:
\begin{itemize}
%%%
\item{Anti\hyp{}construct state agreement}
\item{Anti\hyp{}construct state agreement + head\hyp{}driven agreement}
\item{Attributive article + \isi{head\hyp{}driven agreement}}
\item{Head\hyp{}driven agreement}
\item{Incorporation.}
\end{itemize}
%%%
Whereas \isi{head\hyp{}driven agreement} and \isi{attributive nominalization} are attested for the earliest stages of Germanic, adjective incorporation is a rather recent innovation (see \S\ref{germanic diachr}).
\il{West Germanic languages|(}
\subsubsection{West Germanic}
\label{w-germanic synchr}
The most common type of adjective attribution marking in West Germanic languages is \isi{head\hyp{}driven agreement}. In most languages of this group, this is the only existing type.
\il{German|(}
\paragraph*{Anti\hyp{}construct state agreement in German}
Attributive adjectives in German show \isi{head\hyp{}driven agreement} according to the features \textsc{gender, number, case} and \textsc{species}.\is{species marking} The complete agreement paradigm was illustrated in Part~II (Typology) (Figure~\ref{german agr} on page~\pageref{german agr}). Note that the adjective agreement paradigm of German exhibits a high degree of syncretism due to merger of originally differentiated formatives. The whole paradigm distinguishes only the four suffixes \textit{-e, -em, -en, -er, -es}.
%%%
\begin{exe}
\ex {\rm Attributive adjectives in German (personal knowledge)}
\begin{xlist}
\ex
\gll ein \textbf{hoh-es} Haus\\
\textsc{indef} high-\textsc{indef.n} house(\textsc{n})\\
\glt ‘a high house’
%%%
\ex
\gll das \textbf{hoh-e} Haus\\
\textsc{def} high-\textsc{def.n} house(\textsc{n})\\
\glt ‘the high house’
%%%
\ex
\gll \textbf{hoh-e} Häus-er\\
high-\textsc{pl} house-\textsc{pl}\\
\glt ‘high houses’
%%%
\ex
\gll der \textbf{hoh-en} Häus-er\\
\textsc{def:pl.gen} high-\textsc{def.pl.gen} house-\textsc{pl.gen}\\
\glt ‘of the high houses’
\end{xlist}
\end{exe}
%%%
\is{predicative marking|(}
Attributive and predicative adjectives are morpho-syntactically differentiated in German (and the other West Germanic languages, except \ili{English}): whereas attributive adjectives show \isi{head\hyp{}driven agreement}, predicative adjectives are used in an invariable form. Given the definition of dependent\hyp{}marking attributive state which is applied here (see Chapter~\ref{syntax-morphology-interface}), German thus exhibits anti\hyp{}construct state agreement marking of attributive adjectives.
%%%
\begin{exe}
\ex {\rm Predicative adjectives in German (personal knowledge)}
\begin{xlist}
\ex
\gll das / ein Haus is \textbf{hoch}\\
\textsc{def} {} \textsc{indef} house(\textsc{n}) is high\\
\glt ‘a / the house is high’
%%%
\ex
\gll (die) Häus-er sind \textbf{hoch}\\
\textsc{def} house-\textsc{pl} are high\\
\glt ‘(the) houses are high’
\end{xlist}
\end{exe}
\il{German|)}
\is{predicative marking|)}
\il{Yiddish|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Attributive nominalization + head\hyp{}driven agreement in Yiddish}
\label{yiddish synchr}
The default noun phrase structure in Yiddish is similar to the other West Germanic languages. Head\hyp{}driven agreement occurs as the default type of attribution marking of adjectives. In contrastive focus constructionс, however, adjectives and other modifiers follow the modified noun in an \isi{attributive nominalization} construction.
%%%
\il{Yiddish!Eastern}
\begin{exe}
\ex {\rm Yiddish (Eastern) \citep[96]{jacobs-etal1994}}
\begin{xlist}
\ex {\rm Head\hyp{}driven agreement (unmarked)}
\begin{xlist}
\ex
\gll a \textbf{sheyn} meydl\\
\textsc{indef:f} pretty:\textsc{indef.f} girl\textsc{(f)}\\
\glt ‘a pretty girl’
%%%
\ex
\gll di \textbf{grine} oygn\\
\textsc{def:pl} green:\textsc{def.pl} eye:\textsc{pl}\\
\glt ‘the green eyes’
\end{xlist}
%%%
\ex {\rm Attributive nominalization (contrastive focus)}
\begin{xlist}
\ex
\gll a meydl \textbf{a} \textbf{sheyne}\\
\textsc{indef:f} girl\textsc{(f)} \textsc{attr:indef.f} pretty:\textsc{attr:indef.f}\\
%andere Endung, was ist es
\glt ‘a \textsc{pretty} girl’
%%%
\ex
\gll di oygn \textbf{di} \textbf{grine}\\
\textsc{def:pl} eye:\textsc{pl} \textsc{attr:def.pl} green:\textsc{def.pl} \\
\glt ‘the \textsc{green} eyes’
\end{xlist}
\end{xlist}
\end{exe}
%umgekehrte Wortfolge deshalb kein normales agreement
\il{Yiddish|)}
\is{head\hyp{}driven agreement|)}
\il{English|(}
\paragraph*{Incorporation in English}
English is the only West Germanic language where \isi{head\hyp{}driven agreement} is missing completely because the original Germanic agreement inflection on adjectives was lost.
%%%
\newpage
\begin{exe}
\ex {\rm English (personal knowledge)}
\begin{xlist}
\ex
\gll a \textbf{pretty} girl\\
\textsc{indef} pretty girl\\
%%%
\ex
\gll the \textbf{pretty} girl\\
\textsc{def} pretty girl\\
%%%
\ex
\gll \textbf{pretty} girl-s\\
pretty girl-\textsc{pl}\\
\end{xlist}
\end{exe}
%%%
Attributive adjectives cannot, however, occur in \isi{headless noun phrase}s in English but are obligatorily marked with an article used as dummy head.
%%%
\begin{exe}
\ex {\rm English (personal knowledge)}
\begin{xlist}
\ex
\gll a / the \textbf{smart} \textbf{one}\\
\textsc{indef} {} \textsc{def} smart \textsc{art}\\
%%%
\ex
\gll \textbf{smart} \textbf{one-s}\\
smart \textsc{art}-\textsc{pl}\\
\end{xlist}
\end{exe}
%%%
The marker \textit{one} in English (originating from the homophonous numeral\is{adnominal modifier!numeral} \textit{one}) is a prototypical instance of an article: it constitutes a phonologically free grammatical word which is the target of agreement.
Given that attributive adjectives cannot occur other than syntactically bound to a head noun, the regular noun phrase type in English is best analyzed as incorporation. Note that the article is not an attribution marking device in the proper sense. Even though the marker projects a noun phrase by syntactic nominalization, this noun phrase does not modify a higher noun. The nominalization strategy can only be used in noun phrases with an empty lexical head.
%%%
\begin{exe}
\ex {\rm English (personal knowledge)}
\begin{xlist}
\ex[]{
\gll {} a smart girl\\
{{\upshape [}\textsubscript{NP}} \textsc{indef} \textsubscript{A}smart \textsubscript{N}girl {\upshape ]}\\
}
%%%
\ex[]{
\gll {} a smart \textbf{one}\\
{{\upshape [}\textsubscript{NP}} \textsc{indef} \textsubscript{A}smart \textsubscript{HEAD} {\upshape ]}\\
}
%%%
\ex[*]{
\gll {} a smart \textbf{one} {} girl\\
{{\upshape [}\textsubscript{NP} {\upshape [}\textsubscript{NP}} \textsc{indef} {\textsubscript{A}smart} \textsubscript{HEAD} {\upshape ]} \textsubscript{N}girl {\upshape ]]}\\
}
\end{xlist}
\end{exe}
%%%
Because attributive adjectives in English are obligatorily bound to a syntactic head and because the nominalizer (“dummy head”) cannot occur in noun phrases modifying a higher head, English exhibits neither true \isi{juxtaposition} nor \isi{attributive nominalization}.
\il{English|)}
\il{West Germanic languages|)}
\il{North Germanic languages|(}
\subsubsection{North Germanic}
\label{n-germanic synchr}
%%%
With regard to existing attribution marking devices, the North Germanic languages exhibit even a higher degree of diversity than West Germanic. This is especially true if major sub-varieties are considered as well. Practically all types attested in West Germanic occur here as well, including adjective incorporation which is otherwise scarcely attested in the languages of northern Eurasia.
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in North Germanic}
Even though in North Germanic, head\hyp{}driven agreement marking constitutes the prototypical adjective attribution marking device, the adjective agreement paradigms across different languages inside this branch reflect the ongoing decline in differentiated categories.
\il{Icelandic|(}
In \textbf{Icelandic}, adjectives inflect for the agreement features \textsc{gender}, \textsc{number}, \textsc{case} and \textsc{species}.\is{species marking} The adjective agreement paradigm of Modern Icelandic (Table~\ref{icelandic agr} in \S\ref{head-driven agreement}) is thus relatively similar to \ili{Old Icelandic} even though the different case endings are already merged in the definite paradigm.
\il{Icelandic|)}
\il{Danish|(}
In \textbf{Danish},\label{danish synchr} there is no agreement feature \textsc{case}, while \textsc{gender} is marked on the attributive adjective only in indefinite noun phrases. In definite\is{species marking!definite} noun phrases, the attributive adjective is marked with an invariable definite agreement suffix (Table~\ref{danish agr paradigm}).
%%%
\begin{table}
\begin{tabular}{l l l l}
\lsptoprule
& \textsc{utr.sg} &\textsc{n.sg} &\textsc{pl}\\
\midrule
\textsc{indef} &gul &gul-t &gul-e\\
\textsc{def} &gul-e &gul-e &gul-e\\
\lspbottomrule
\end{tabular}
\caption[Adjective paradigm for Danish]{Agreement paradigm for the adjective ‘yellow’ in Danish (personal knowledge)}
\label{danish agr paradigm}
\end{table}
%%%
\il{Danish!W-Jutlandic|(}
The \textbf{Western Jutlandic} dialect of Danish is most innovative with regard to the decline of agreement features because it has almost completely lost its agreement features and thus resembles \ili{English} (Table~\ref{jutl agr paradigm}).
%%%
\begin{table}
\begin{tabular}{l l l}
\lsptoprule & \textsc{sg} &\textsc{pl}\\
\midrule
\textsc{indef} & gulʔ &gul\\
\textsc{def} &gul &gul\\
\lspbottomrule
\end{tabular}
\caption[Adjective paradigm for W-Jutlandic]{Agreement paradigm for the adjective ‘yellow’ in Western Jutlandic (in phonemic transcription) \citep{ringgaard1960}}
\label{jutl agr paradigm}
\end{table}
%%%
\il{Danish!W-Jutlandic|)}
\il{Danish|)}
\il{Swedish|(}
\paragraph*{Anti\hyp{}construct state + head\hyp{}driven agreement in Swedish}
\label{swedish synchr}
Swedish, \ili{Norwegian},\footnote{The two Norwegian standard languages Dano-Norwegian (Norwegian \textit{bokmål}) and New Norwegian (Norwegian \textit{nynorsk}) do not differ in their marking of adjective attribution and they will simply be referred to as Norwegian} and \ili{Faroese} exhibit two adjective attribution marking morphemes simultaneously: an inflectional suffix expressing the agreement features \textsc{gender}, \textsc{number} and \textsc{species}\is{species marking} (but the indefinite utrum gender form of the adjective is always unmarked) plus an article (which again is not found in the indefinite plural form).
\is{species marking!definite|(}
In the (North-)Germanic and typological linguistic tradition, the definite noun phrases with adjectives have most often been characterized as “double definite” (cf.~\citealt{kotcheva1996a}; \citealt{borjars1994}; \citealt{julien2003}; \citealt[354–355]{plank2003}). This makes sense from a historical perspective because the articles (Swedish \textit{den, det, de}) are cognate with the Old Germanic\il{Old Germanic languages} demonstratives which developed into definite markers (cf.~German\il{German} \textit{der, die, das} or English\il{English} \textit{the}). Synchronically, however, the articles in the North Germanic languages with so-called double definiteness (Swedish, both Norwegian\il{Norwegian} languages, Faroese)\il{Faroese} are not definiteness markers. Unlike in West Germanic,\il{West Germanic languages} definiteness is exclusively expressed by an inflectional suffix (Swedish \textit{-(e)n} \textsc{utr}, \textit{-(e)t} \textsc{n}, \textit{-n} \textsc{pl}.)
%"exclusively expressed"?\\if the NP is indef den/det is not used, so den/det has two functions: expressing def and marking attr
Unlike in West Germanic\il{West Germanic languages} languages, where the definite markers are noun phrase markers always attach at the left edge of the phrase, the presence or absence of the cognate articles \textit{den} \textsc{utr}, \textit{det} \textsc{n}, \textit{de(m)} \textsc{pl} in Swedish is determined by the availability of an adjective and not the referential status of the noun phrase.
%%%
\begin{exe}
\ex {\rm Swedish (personal knowledge)}
\label{swedish np}
\begin{xlist}
\ex
\gll {(*det)} hus\textbf{-et}\\
\textsc{attr:def.n} house-\textsc{def:n}\\
\glt ‘the house’
%%%
\ex
\gll {*(\textbf{det})} \textbf{hög-a} hus-et\\
\textsc{attr:def.n} high-\textsc{def.n} house-\textsc{def.n}\\
\glt ‘the high house’
%%%
\ex
\label{art0}
\gll {*(\textbf{det})} \textbf{hög-a}\\
\textsc{attr:def.n} high-\textsc{def.n}\\
\glt ‘the high one’ (about a house)
\end{xlist}
\end{exe}
%%%
\newpage
Example (\ref{swedish np}) shows how the article can neither attach to a noun nor can an adjectival modifier in a definite noun phrase occur without being marked by the article.\footnote{The expression \textit{det hus} is grammatical only with the homophonous demonstrative \textit{det}, similarly (but restricted to certain regiolects) \textit{det hus-et}. Even the expressions \textit{höga hus-et} is possible for some expression similar to English \textit{White house}. Note also that possessive pronouns\is{adnominal modifier!pronoun} replace the article: \textit{min hög-a hus} [\textsc{poss:1sg} high-\textsc{def.n} house(\textsc{n}] 'my high house’.} Since the definite value of the feature \textsc{species} is always marked by the respective definite inflectional noun suffixes %in \isi{headless noun phrase}s, the definite inflection is absent
and since the article only attaches to adjectives, the latter cannot be analyzed as anything but a morpho-syntactic device, i.e., as an adjective attribution marker.
In definite noun phrases, Swedish thus exhibits a circumfixed adjective attribution marking device combined by head\hyp{}driven agreement inflection plus the article. It is plausible that the article developed from an attributive nominalizer. Its use with adjectives in \isi{headless noun phrase}s, as in \REF{art0} resembles attributive nominalization. There is, however, no evidence that the adjective marked by the article is part of a complex constituent (i.e., a \isi{headless noun phrase}) modifying a noun. According to the definition of \isi{attributive nominalization} presented in \S\ref{attr nmlz} of Part~II (Typology), the article in Swedish is thus not a syntactic nominalizer. Its function is the licensing of the attributive state of the adjective along with marking of head\hyp{}driven agreement. Since head\hyp{}driven agreement is additionally marked by inflectional suffixes, the Swedish noun phrase exhibits circum-positioned (i.e., phonologically free and phonologically bound) agreement marking.
\is{species marking!definite|)}
\is{predicative marking|(}
Note that the circum-positioned agreement marker only occurs with attributive adjectives. Predicative adjectives, on the other hand, exhibit “pure” gender and number agreement (\ref{swed pred}). The analysis of adjective attribution marking in Swedish as belonging to anti\hyp{}construct state agreement marking is thus justified.
%%%
\begin{exe}
\ex {\rm Predicative adjectives in Swedish (personal knowledge)}
\label{swed pred}
\begin{xlist}
\ex[]{
\textit{kåken är \textbf{hög}} \jambox{{\rm ‘the (bad) house is high’} [\textsc{utr}]}
}
\ex[*]{
\textit{kåken är \textbf{en hög / den hög-a}}
}
\ex[]{
\textit{huset är \textbf{hög-t}} \jambox{{\rm ‘the house is high’} [\textsc{n}]}
}
\ex[*]{
\textit{huset är \textbf{ett hög-t / det hög-a}}
}
\ex[]{
\textit{husen är \textbf{hög-a}} \jambox{{\rm ‘the houses are high’} [\textsc{pl}]}
}
\ex[*]{
\textit{husen är \textbf{de hög-a}}
}
\end{xlist}
\end{exe}
%%%
\begin{table}
\begin{tabular}{l l l l l l l}
\lsptoprule
&\multicolumn{3}{l}{\textsc{indef}} &\multicolumn{3}{l}{\textsc{def}}\\
\midrule
\textsc{utr.sg} &en &\textbf{h{ö}g-Ø}&stuga &\textbf{den}&\textbf{h{ö}g-a}&stuga-n\\
\textsc{n.sg} &ett &\textbf{h{ö}g-t}&hus &\textbf{det}&\textbf{h{ö}g-a}&hus-et\\
\textsc{pl} & &\textbf{h{ö}g-a}&stug-or &\textbf{de}&\textbf{h{ö}g-a}&stug-or:na\\
\lspbottomrule
\end{tabular}
\caption[Adjective paradigm for Swedish]{Agreement paradigm for the adjective \textit{hög} ‘high’ in Swedish (personal knowledge); \textit{stuga} (\textsc{utr}) ‘cabin’, \textit{hus} (\textsc{n}) ‘house’
}
\end{table}
\il{Swedish|)}
\is{predicative marking|)}
\is{head\hyp{}driven agreement|)}
\il{Swedish!Västerbotten|(}
\paragraph*{Adjective incorporation in Västerbotten Swedish}
\label{bondska synchr}
The dialect spoken in the Västerbotten province in northern Sweden exhibits adjective incorporation as a regular type of adjective attribution marking.
%%%
\begin{exe}
\ex {\rm Västerbotten Swedish \citep[91–92]{holmberg-etal2003}}
\begin{xlist}
\ex
\gll \textbf{grann-}kweinn-a\\
pretty-woman-\textsc{def}\\
\glt ‘the pretty woman’
%%%
\ex
\gll en \textbf{grann-}kweinn\\
\textsc{indef} pretty-woman\\
\glt ‘a pretty woman’
\end{xlist}
\end{exe}
%%%
Adjective incorporation also occurs in several other northern North Germanic dialects of Sweden, Finland and Norway. Whereas adjective incorporation is the default type in Västerbotten Swedish,\footnote{In indefinite noun phrases, however, adjective incorporation is often restricted to monosyllabic adjective stems: \textit{en \textbf{grann-}kweinn} but *\textit{en \textbf{vacker-}kweinn} ‘a \textbf{pretty} woman’. Furthermore, a certain semantic relation between noun and adjective seem to be obligatory: (incorporation) \textit{n \textbf{ny-}bil} ‘a \textbf{new} car (straight from the factory)’, \textit{n \textbf{ny} bil} ‘a \textbf{new} car (new for me)’, (incorporation) *\textit{n \textbf{ny-}hunn} ‘a \textbf{new} dog’, \textit{n \textbf{ny} hunn} ‘a \textbf{new} dog (new for me)’ \citep[91–92]{holmberg-etal2003}.} its occurrence is restricted to definite noun phrases in most other dialects where this type it attested.\is{species marking!definite}
Attributive adjectives cannot occur in indefinite\is{species marking!indefinite} \isi{headless noun phrase}s in this language but are obligatorily bound to an article used as dummy head.
%%%
\begin{exe}
\ex {\rm Västerbotten Swedish \citep{holmberg-etal2003,delsing1996b}}
\begin{xlist}
\ex
\gll en stor en\\
\textsc{indef:m} big(\textsc{m}) \textsc{art:indef:m.sg}\\
%%%
\ex
\gll ett stor-t ett\\
\textsc{indef:n} big:\textsc{n} \textsc{art:indef:n.sg}\\
\glt ‘a big one’
\end{xlist}
\end{exe}
\il{Swedish!Västerbotten|)}
\il{North Germanic languages|)}
\il{Germanic languages|)}
\il{Hellenic languages|(}
\il{Greek|(}
\subsection{Hellenic}
\label{greek synchr}
%%%
The Hellenic branch of Indo-European is represented by a single language: Modern Greek.
\is{attributive nominalization|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement and attributive nominalization + head\hyp{}driven agreement in Greek}
Attributive adjectives in Greek show agreement in \textsc{gender, number} and \textsc{case}.\footnote{A minor class of loan adjectives in Greek belong to a different noun phrase type, \isi{juxtaposition}, because they do not inflect at all \citep{ruge1986}.}
\is{contrastive focus|(}
The unmarked constituent order in Greek is adjective-noun, as in \REF{greek afocus}. The reverse constituent order (noun-adjective), however, is commonly used as well and marks contrastive focus on the attribute, as in \REF{greek afocus}.
%%%
\begin{exe}
\ex {\rm Greek \citep{ruge1986}}
\begin{xlist}
\ex {\rm Head\hyp{}driven agreement}
\label{greek agr}
\begin{xlist}
\ex
\gll to \textbf{kokino} aftokinito\\
\textsc{def:m} red:\textsc{m} car(\textsc{m})\\
\glt ‘the red car’
\end{xlist}
%%%
\ex {\rm Attributive nominalization}
\label{greek attr}
\begin{xlist}
\ex {\rm Contrastive focus on the attribute}\\
\label{greek afocus}
\gll to aftokinito \textbf{to} \textbf{kokino}\\
\textsc{def:m} car(\textsc{m}) \textsc{attr:m} red:\textsc{m}\\
\glt ‘the \textsc{red} car (not the blue one)’
%%%
\ex {\rm Contrastive focus on the noun}\\
\label{greek nfocus}
\gll \textbf{to} \textbf{kokino} to aftokinito\\
\textsc{attr:m} red:\textsc{m} \textsc{def:m} car(\textsc{m})\\
\glt ‘the red \textsc{car} (not the buss)’
\end{xlist}
\end{xlist}
\end{exe}
%%%
Note that the noun can move to the contrastive focus position as well, as in \REF{greek nfocus}.
Example (\ref{greek attr}) illustrates the use of the article \textit{to} in two different syntactic functions: whereas \textit{to} \textsc{def} is a determiner marking the noun phrase as definite,\is{species marking!definite} \textit{to} \textsc{attr} is an attributive marker (i.e., a true article) attaching to the adjective noun phrase internally. Attribution of the adjective (in contrastive focus) in \REF{greek afocus} is marked by means of attributive nominalization. The article marks the adjective as phrasal constituent, i.e., as a syntactic complement to the noun.
\is{contrastive focus|)}
\il{Greek|)}
\il{Hellenic languages|)}
\is{attributive nominalization|)}
\is{head\hyp{}driven agreement|)}
\il{Romance languages|(}
\subsection{Romance}
%%%
All Romance languages exhibit \isi{head\hyp{}driven agreement} marking as the main and default adjective attribution marking device. The prototypical agreement features characteristic of most modern Romance languages are \textsc{number} and \textsc{gender}. A third agreement feature, \textsc{case}, was present in earlier stages of Romance but has disappeared in the modern languages.
Three noun phrase types have existed in the Romance branch from its earliest stages:\footnote{A minor class of adjectives belong to a different noun phrase type,
\isi{juxtaposition}, because they do not inflect at all.}
%%%
\begin{itemize}
\item head\hyp{}driven agreement
\subitem noun-adjective order
\subitem adjective-noun order
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
\is{contrastive focus|(}
\il{Romanian|(}
The unmarked and prototypical noun phrase type in Romance is \isi{head\hyp{}driven agreement} with the adjective following the noun. Besides the basic head-initial constituent order, most Romance languages exhibit a small subgroup of very common adjectives, such as ‘good–bad, young–old, small–large’, which normally precede the head noun (\citealt[146–147]{posner1996}, cf.~also \citealt[340]{silvestri1998}). However, most other adjectives can also precede the noun in the modern Romance languages. This reversed constituent order is regularly determined by semantics-pragmatics in Romanian and is used to give these adjectives a certain emphasis or contrastive focus, as in the following examples from Romanian (\ref{romanian wo}) and Italian (\ref{italian wo}).
%%%
\begin{exe}
\ex
\begin{xlist}
\ex {\rm Romanian \citep{beyer-etal1987}}\\
\label{romanian wo}
\begin{xlist}
\ex
\gll băiat=ul \textbf{bun}\\
boy=\textsc{def} good\\
\glt ‘the good boy’
%%%
\ex
\gll \textbf{bun}=ul băiat\\
good=\textsc{def} boy\\
\glt ‘the \textsc{good} (i.e., different) boy’
\end{xlist}
%%%
\il{Italian|(}
\ex {\rm Italian \citep[146]{posner1996}}
\label{italian wo}
\begin{xlist}
\ex
\gll un vestito \textbf{nuovo}\\
\textsc{indef} dress new\\
\glt ‘a (brand-)new dress’
%%%
\ex
\gll un \textbf{nuovo} vestito\\
\textsc{indef} new dress\\
\glt ‘a new (i.e., different) dress’
\end{xlist}
\end{xlist}
\end{exe}
%%%
Note that the definite\is{species marking!definite} marker in Romanian is not connected with attribution marking on adjectives. Even though the marker can occur on the attributive adjective which precedes the noun in contrastive use (\ref{romanian wo}), definiteness is a purely morpho-semantic feature in Romanian and is not assigned by syntax (see also Chapter~\ref{syntax-morphology-interface} of Part~I Preliminaries).
\il{Romanian|)}
The common distinction between an “emphatic” adjective preceding a noun and a “descriptive” adjective following a noun goes probably back to the earliest stages of Romance, although it is first attested in Classical Latin\il{Latin!Classical} \citep[146]{posner1996}.
\is{contrastive focus|)}
\is{head\hyp{}driven agreement|(}
\paragraph*{Head\hyp{}driven agreement in Italian}
In Italian, as well as in the other Romance languages, the agreement features \textsc{gender} and \textsc{number} are marked on adjectives and on other modifiers within the noun phrase.
%%%
\begin{exe}
\ex {\rm Italian (personal knowledge)}
\begin{xlist}
\ex
\gll la casa \textbf{alt-a}\\
\textsc{def:f} house(\textsc{f}) high-\textsc{f}\\
\glt ‘the high house’
%%%
\ex
\gll le cas-e \textbf{alt-e}\\
\textsc{def:pl} house-\textsc{pl} high-\textsc{pl}\\
\glt ‘the high houses’
\end{xlist}
\end{exe}
\il{Italian|)}
\is{head\hyp{}driven agreement|)}
\il{Romanian|(}
\is{attributive nominalization|(}
\paragraph*{Attributive nominalization in Romanian}
\label{romanian synchr}
In addition to the default type of \isi{head\hyp{}driven agreement} (with either noun-adjective or adjective-noun constituent order), Standard Romanian (aka Daco-Romanian)\il{Daco-Romanian|see{Romanian}} exhibits attributive nominalization as a differentiated third type of adjective attribution marking. The agreement paradigm of the attributive nominalizer (which grammatical descriptions of Romanian traditionally label “adjective article”) is shown in Table~\ref{romanian art}.
%%%
\begin{table}[b]
\begin{tabular}{r c c c}
\lsptoprule
&\textsc{f} &\textsc{n} &\textsc{m}\\
\midrule
\textsc{sg} &cea &\multicolumn{2}{|c}{cel}\\
\midrule
\textsc{pl} &\multicolumn{2}{c|}{cele} &cei\\
\lspbottomrule
\end{tabular}
\caption[Article paradigm for Romanian]{Agreement paradigm of the attributive article in Romanian \citep[94]{beyer-etal1987}.
}
\label{romanian art}
\end{table}
%%%
\is{species marking!definite|(}
The use of the non-obligatory attributive marker emphasizes the adjective following a noun (\citealt[94]{beyer-etal1987}; \citealt[148]{posner1996}). But it is also regularly used to mark definite \isi{headless noun phrase}s, as in the following example.
%%%
\begin{exe}
\ex {\rm Romanian \citep[94]{beyer-etal1987}}\\
\gll Punct-e=le \textbf{cele} \textbf{negr-e} se disting mai bine decât \textbf{cele} \textbf{cenuşi-i}.\\
dot-\textsc{pl}=\textsc{def.m.pl} \textsc{att:m.pl} black-\textsc{pl} \textsc{refl.3sg} distinguish \textsc{compar} well than \textsc{att:m.pl} grey-\textsc{pl}\\
\glt ‘The black dots distinguish themselves better than the grey ones.’
\end{exe}
%%%
The content of this marker, besides licensing of the attributive relation, is not clearly defined in descriptions of Romanian. The article seems to regularly mark definite headless adjectives\is{headless noun phrase} and superlative adjectives. \citet[141]{kramsky1972} compares the function of the article with that of the definite marker and describes the function of the attributive article in Romanian as a “deictic reactualizer” because it has a referential function but can co-occur with the definite marker (\ref{rum def comp}). Note, however, that the definite marker is absent in a noun phrase with reversed constituent order marking \isi{contrastive focus} (\ref{rum def sup}).
\is{species marking!definite|)}
%%%
\begin{exe}
\ex {\rm Romanian \citep[93–94]{beyer-etal1987}}
\begin{xlist}
\ex
\label{rum def comp}
\gll poet=ul \textbf{cel} \textbf{mai} \textbf{mare}\\
poet(\textsc{m})=\textsc{def.m} \textsc{att:m.sg} \textsc{super} great\\
\glt ‘the greatest poet’
%%%
\ex
\label{rum def sup}
\gll \textbf{cel} \textbf{mai} \textbf{mare} poet\\
\textsc{att:m.sg} \textsc{super} great poet(\textsc{m})\\
\glt ‘the \textsc{greatest} poet’
\end{xlist}
\end{exe}
\il{Romanian|)}
\il{Romance languages|)}
\is{attributive nominalization|)}
\il{Slavic languages|(}
\subsection{Slavic}
\label{slavic synchr}
Slavic (aka Slavonic)\il{Slavonic|see{Slavic languages}} forms a branch inside the Indo-European family. All Slavic languages are spoken in \isi{Europe}, except Russian, which is also spoken in \isi{North Asia}.
The prototypical type of adjective attribution marking is \isi{head\hyp{}driven agreement}. The prototypical agreement features characteristic of Slavic languages are \textsc{number}, \textsc{gender} and \textsc{case}. In the closely related South Slavic languages \ili{Bulgarian} and \ili{Macedonian} however, case inflection of nouns and adjectives has been lost.
Beside \isi{head\hyp{}driven agreement}, anti\hyp{}construct state agreement arose in Slavic languages as a secondary type of adjective attribution marking. The opposition between head\hyp{}driven and anti\hyp{}construct state agreement can be traced back to all Old Slavic\il{Old Slavic languages} languages and already existed in the oldest Slavic manuscripts, the best documented of which are from \ili{Old Bulgarian} (aka Old Church Slavonic).\il{Old Church Slavonic|see{Old Bulgarian}} To a certain extent, this state of development is still reflected in South Slavic.\il{South Slavic languages} In most other modern Slavic languages, however the opposition between the two types was lost by abolishing one or the other type.
Basically, the modern Slavic languages belong to three types and exhibit the following three attribution marking devices:
%%%
\begin{itemize}
\item exclusively \isi{head\hyp{}driven agreement}
\item exclusively anti\hyp{}construct state agreement
\item simultaneously \isi{head\hyp{}driven agreement} and anti\hyp{}construct state agreement
\item attributive nominalization.\is{attributive nominalization}
\end{itemize}
%%%
Constituent order in Slavic can be described as basically adjective-noun, although there is much variation across the single languages. The reversed order of constituents is often possible but in some languages it is restricted to “emphasized” constructions or poetic language.
\il{West Slavic languages|(}
\is{head\hyp{}driven agreement|(}
\subsubsection{West Slavic}
%%%
All West Slavic languages exhibit head\hyp{}driven agreement as the exclusive type of adjective attribution marking.
\il{Lower Sorbian|(}
\paragraph*{Head\hyp{}driven agreement in Lower Sorbian}
Lower Sorbian exemplifies a Slavic language with head\hyp{}driven agreement as the exclusive type of adjective attribution marking. Attributive adjectives in Lower Sorbian show agreement in gender, number and case.
%%%
\begin{exe}
\ex {\rm Lower Sorbian \citep{janas1976}}
\begin{xlist}
\ex
\gll \textbf{dobr-y} cłowjek\\
good-\textsc{nom.sg.m} person(\textsc{m})\\
\glt ‘good person’
%%%
\ex
\gll k \textbf{dobr-emu} cłowjek-oju\\
to good-\textsc{dat.sg.m} person-\textsc{dat:sg.m}\\
\glt ‘to a/the good person’
\ex
\gll \textbf{dobr-e} cłowjek-y\\
good-\textsc{nom.pl} person-\textsc{nom:pl}\\
\glt ‘good people’
\end{xlist}
\end{exe}
\il{Lower Sorbian|)}
\il{West Slavic languages|)}
\is{head\hyp{}driven agreement|)}
\il{East Slavic languages|(}
\subsubsection{East Slavic}
\is{predicative marking|(}
All three East Slavic languages (Belorussian,\il{Belorussian} Russian\il{Russian} and Ukrainian\il{Ukrainian}) exhibit anti\hyp{}construct state agreement marking. There is, however, a tendency to merge the attributive (“long”) and predicative (“short”) adjective agreement declension classes, yielding pure \isi{head\hyp{}driven agreement} as in West Slavic.\il{West Slavic languages}
\il{Russian|(}
\paragraph*{Anti\hyp{}construct state agreement in Russian}
\label{russian synchr}
In Russian, attributive as well as predicative adjectives show agreement in \textsc{gender} and \textsc{number}. Attributive adjectives agree additionally in \textsc{case}. The agreement suffixes of the attributive and predicative paradigms, however, have different forms.\footnote{This is true for the stylistically marked “short form adjectives”, see in more detail \S\ref{anti-constr agr}.}
%%%
\newpage
\begin{exe}
\ex {\rm Russian (personal knowledge)}
\label{ru agr}
\begin{xlist}
\ex {\rm Attribution}
\label{ru attr}
\begin{xlist}
\ex
\gll \textbf{krasiv-yj} mal'čik\\
beautiful-\textsc{attr:m.nom} boy(\textsc{f})\\
\glt ‘a handsome boy’
%%%
\ex
\gll \textbf{krasiv-ogo} mal'čik-a\\
beautiful-\textsc{attr:m.gen} boy-\textsc{m.gen}\\
\glt ‘of a handsome boy’
%%%
\ex
\gll \textbf{krasiv-aja} devuška\\
beautiful-\textsc{attr:f.nom} girl(\textsc{f})\\
\glt ‘a pretty girl’
\end{xlist}
%%%
\ex {\rm Predication}
\begin{xlist}
\ex
\gll Etot mal'čik \textbf{krasiv}\\
\textsc{dem:m} boy(\textsc{m}) beautiful:\textsc{m}\\
\glt ‘this boy is handsome’
%%%
\ex
\gll Eta devuška \textbf{krasiv-a}\\
\textsc{dem:f} tower(\textsc{f}) high-\textsc{f}\\
\glt ‘this girl is pretty’
\end{xlist}
\end{xlist}
\end{exe}
%%%
The agreement suffixes of attributive and predicative adjectives clearly belong to different paradigms (cf.~Table~\ref{Russian adj agr paradigm}). The so-called long agreement suffixes (\ref{ru attr}) mark the values of the morphological agreement features. Simultaneously, they license the (morpho-syntactic) attributive relation inside the noun phrase (cf.~also the discussion in \S\ref{anti-constr agr}).
%%%
\begin{table}[h]
\begin{tabular}{l c c c c}
\lsptoprule
&\textsc{m} &\textsc{f} &\textsc{n} &\textsc{pl}\\
\midrule
\textsc{attr} &–yj/–ój &–aja/–ája &–oje/–óje &–yje/–\'yje\\
\textsc{pred} &{Ø} &–a &–o &–y/–i\\
\lspbottomrule
\end{tabular}
\caption[Adjective paradigm for Russian]{Attributive and predicative adjective declension in Russian (personal knowledge) for nominative case}
\label{Russian adj agr paradigm}
\end{table}
\is{predicative marking|)}
\il{Russian|)}
\il{East Slavic languages|)}
\il{South Slavic languages|(}
\is{head\hyp{}driven agreement|(}
\subsubsection{South Slavic}
\label{s-slavic synchr}
%%%
All South Slavic languages exhibit head\hyp{}driven agreement marking as the default type of adjective attribution marking. In Serbo-Croatian\il{Serbo-Croatian} (aka Bosnian-Croatian-Montenegrin-Serbian\il{Bosnian-Croatian-Montenegrin-Serbian|see{Serbo-Croatian}}) and Slovenian,\il{Slovenian} anti\hyp{}construct state agreement marking occurs as a secondary type. Even \isi{attributive nominalization} is attested in Slovenian.
\il{Bulgarian|(}
\paragraph*{Head\hyp{}driven agreement in Bulgarian}
Attributive adjectives in Bulgarian show agreement in the features \textsc{gender} and \textsc{number}.
%%%
\begin{exe}
\ex {\rm Bulgarian (personal knowledge)}\footnote{The stem allomorph with inserted -\textit{ă}- in \textsc{m.sg} is the result of a phonological process. The stem allomorph with the extension -\textit{ij}- is morpho-phonological and triggered by the definite marker. Note that -\textit{ij}- is a reflex of the \ili{Old Bulgarian} anti\hyp{}construct state agreement marker.}
%%%
\begin{xlist}
\ex {\rm Indefinite noun phrase}
\begin{xlist}
\ex
\gll \textbf{dobăr} i \textbf{vesel} măž\\
good:\textsc{m} and cheerful.\textsc{m} man(\textsc{m})\\
\glt ‘good and cheerful man’
%%%
\ex
\gll \textbf{dobr-a} i \textbf{vesel-a} žena\\
good-\textsc{f} and cheerful-\textsc{f} woman(\textsc{f})\\
\glt ‘good and cheerful woman’
%%%
\ex
\gll \textbf{dobr-i} i \textbf{vesel-i} žen-i\\
good-\textsc{pl} and cheerful-\textsc{pl} woman-\textsc{f.pl}\\
\glt ‘good and cheerful women’
\end{xlist}
%%%
\ex {\rm Definite noun phrase}\is{species marking!definite}
\begin{xlist}
\ex
\gll \textbf{dobr-ij}=ăt i \textbf{vesel-ij}=ăt măž\\
good:\textsc{m}=\textsc{def.m} and cheerful:\textsc{m}=\textsc{def.m} man(\textsc{m})\\
\glt ‘the good and cheerful man’
%%%
\ex
\gll \textbf{dobr-a}=ta i \textbf{vesel-a}=ta žena\\
good-\textsc{f}=\textsc{def.f} and cheerful-\textsc{f}=\textsc{def.f} woman(\textsc{f})\\
\glt ‘the good and cheerful woman’
%%%
\ex
\gll \textbf{dobr-i}=te i \textbf{vesel-i}=te žen-i\\
good-\textsc{pl}=\textsc{def.pl} and cheerful-\textsc{pl}=\textsc{def.pl} woman-\textsc{pl}\\
\glt ‘the good and cheerful women’
\end{xlist}
\end{xlist}
\end{exe}
\il{Bulgarian|)}
\is{head\hyp{}driven agreement|)}
\il{Serbo-Croatian|(}
\paragraph*{Anti\hyp{}construct state agreement in Serbo-Croatian}
\label{serbian synchr}
Serbian (and the other varieties of Serbo-Croatian) exemplifies a Slavic language which exhibits both \isi{head\hyp{}driven agreement} and anti\hyp{}construct state agreement in different functions. \isi{head\hyp{}driven agreement} constitutes the basic type of adjective attribution marking in Serbian. Most adjectives, however, have “double forms” \citep[179–180]{kramsky1972}. Consider the following example.
%%%
\begin{exe}
\ex {\rm Serbian \citep[59]{zlatic1997}}
\begin{xlist}
\ex {\rm Indefinite noun phrase (“pure” \isi{head\hyp{}driven agreement})}\\
\gll \textbf{dobar}, \textbf{veseo} čovek\\
good:\textsc{m} cheerful:\textsc{m} person(\textsc{m})\\
\glt ‘a good, cheerful person’
%%%
\ex {\rm Definite noun phrase (anti\hyp{}construct state agreement)}\\
\gll \textbf{dobr-i}, \textbf{vesel-i} čovek\\
good-\textsc{attr:m} cheerful-\textsc{attr:m} man(\textsc{m})\\
\glt ‘the \textsc{good}, \textsc{cheerful} person’
\end{xlist}
\end{exe}
%%%
\is{species marking!definite|(}
\is{species marking!indefinite|(}
Anti\hyp{}construct state agreement marking (“long form agreement”) in Serbo\hyp{}Croatian is sometimes described as a definite marker on the adjective (e.g., by \citealt[18–19]{kordic1997}). However, the short-form adjective can also be used in a noun phrase marked as definite, for instance by a demonstrative pronoun (\ref{serbian short-def}). And the “long form” adjective can also be used in a noun phrase marked as indefinite, for instance by the indefinite article (\ref{serbian indef}).
%%%
\begin{exe}
\ex {\rm Serbian \citep{marusic-etal2007}}
\begin{xlist}
\ex {\rm Definite noun phrase with “pure” \isi{head\hyp{}driven agreement}}\\
\label{serbian short-def}
\gll ovaj \textbf{dobar}, \textbf{veseo} \v{c}ovek\\
\textsc{dem:m} good:\textsc{m} cheerful:\textsc{m} person(\textsc{m})\\
\glt ‘this good, cheerful man’
%%%
\ex {\rm Indefinite noun phrase with anti\hyp{}construct state agreement}\\
\label{serbian indef}
\gll Treba mi \textbf{jedan} \textbf{crven-i} kaput.\\
need.\textsc{3sg} \textsc{1sg.dat} \textsc{indef:m} red-\textsc{attr:m} coat(\textsc{m})\\
\glt (in a store with red coats on display)\\‘I need a \textsc{red} coat (viz.~one of those red coats).’
\end{xlist}
\end{exe}
%%%
\is{species marking!indefinite|)}
The examples with “short form” adjectives in definite contexts and “long form” adjectives in indefinite contexts provides the best evidence against the analyses of the two different adjective agreement suffixes as markers of the category \textsc{species} of the head noun.
\largerpage[2]
Rather than as a definite marker, the long-form adjective agreement suffixes in Serbian are best analyzed as anti\hyp{}construct state agreement markers used in special contrastive focus constructions.\footnote{Note even that school grammars of Serbian sometimes explain the rules for the use of the two adjective declensions with the help of the the questions “what sort?” (requires the “short form”) and “which one?” (requires the “long form”) \citep[327]{browne1993}.}
\is{species marking!definite|)}
\il{Serbo-Croatian|)}
\il{Slovenian|(}
\paragraph*{Anti\hyp{}construct state agreement in Slovenian}
\label{slovenian synchr}
Slovenian (aka Slovene)\il{Slovene|see{Slovenian}} is identical to \ili{Serbo-Croatian} in theory. Both languages exhibit \isi{head\hyp{}driven agreement} marking and anti\hyp{}construct state agreement marking as two separate devices for adjective attribution.
%%%
\is{contrastive focus|(}
\begin{exe}
\ex {\rm Slovenian \citep[410]{priestly1993}}
\label{slov longshort}
\begin{xlist}
\ex {\rm “Short form” adjective (\isi{head\hyp{}driven agreement})}
\begin{xlist}
\ex
\gll \textbf{nȍv} pə̏s\\
new:\textsc{nom.m.sg} dog\textsc{(m)}\\
\glt ‘new dog’
%%%
\ex
\gll en \textbf{nȍv} pə̏s\\
\textsc{indef:m.sg} new:\textsc{nom.m.sg} dog\textsc{(m)}\\
\glt ‘a new dog’
\end{xlist}
%%%
\ex {\rm “Long form” adjective (anti\hyp{}construct state agreement)}
\begin{xlist}
\ex
\gll \textbf{nóvi} pə̏s\\
new:\textsc{attr:nom.m.sg} dog\textsc{(m)}\\
\glt ‘\textsc{new} dog’
%%%
\ex
\gll {ta} \textbf{nóvi} pə̏s\\
{\textsc{attr}} new:\textsc{attr:nom.m.sg} dog\textsc{(m)}\\
\glt ‘the \textsc{new} dog’
\end{xlist}
\end{xlist}
\end{exe}
%%%
%According to its morphological type, the non-concatenative anti\hyp{}construct state agreement marking device in Slovenian seems to be exceptional among northern Eurasian languages because it constitutes a tonal distinction between short high tone (\textit{nȍv}) and long low tone \textit{nóvi}. %\footnote{The historical explanation, however, is straightforward and looks much less exotic...}
Note, however, that the use of morphologically differentiated adjectives for \isi{head\hyp{}driven agreement} versus anti\hyp{}construct state agreement in Slovenian is very restricted and is found more or less only with masculine adjectives in nominative singular \citep[410–411]{priestly1993}.
\largerpage
\is{species marking!definite|(}
Similar to Serbo-Croatian,\il{Serbo-Croatian} anti\hyp{}construct state agreement marking in Slovenian is sometimes described as a definite marker on the adjective (e.g., by \citealt[411]{priestly1993}). Semantic definiteness in Slovenian, however, is not marked obligatorily (cf.~example \ref{slov longshort}). Furthermore, the analysis of the anti\hyp{}construct state agreement as a definite marker can be rejected completely because examples are found in which this marker also occurs in overtly marked indefinite noun phrases.
%%%
\ea
{\rm Slovenian \citep{marusic-etal2007}}\\
\gll rabi mi \textbf{en} \textbf{rde\v{c}i} pla\v{s}\v{c}\\
need.\textsc{3sg} \textsc{1sg.dat} \textsc{indef:m} red:\textsc{attr:m} coat(\textsc{m})\\
\glt (in a store with red coats on display)\\‘I need a \textsc{red} coat (viz.~one of those red coats).’\footnote{Cf.~the similar construction with concatenative anti\hyp{}construct state agreement marking in Serbian\il{Serbo-Croatian!Serbian} in \REF{serbian indef}.}
\z
%%%
Anti\hyp{}construct agreement marking are thus analyzed as attribution marking device with the additional content of contrastive focus rather than as a detached definite marker.
\is{species marking!definite|)}
\is{attributive nominalization|(}
\is{head\hyp{}driven agreement|(}
\paragraph*{Attributive nominalization + head\hyp{}driven agreement in Slovenian}
Besides head\hyp{}driven agreement and anti\hyp{}construct state agreement, adjectives in (colloquial) Slovenian can also be marked by means of an attributive article.
%%%
\begin{exe}
\ex {\rm Slovenian \citep{marusic-etal2007}}
\label{slovenian art}
\begin{xlist}
\ex {\rm Indefinite noun phrase}\\
\gll Lihkar je mim prdirkal en \textbf{ta} \textbf{hiter} avto.\\
just\_now \textsc{aux} by sped \textsc{indef:n} \textsc{attr} fast:n car(\textsc{n})\\
\glt ‘Some \textsc{fast} car has just sped by (viz.~one of the fast type of cars has just sped by).’
%%%
\ex {\rm Definite noun phrase}\\
\label{slovenian def}
\gll ta \textbf{ta} \textbf{zelen} \textbf{ta} \textbf{debel} svin\v{c}nik\\
\textsc{dem} \textsc{attr} green\textsc{:m} \textsc{attr} thick\textsc{:m} pencil\\
\glt ‘this \textsc{green}, \textsc{thick} pencil’
\end{xlist}
\end{exe}
%%%
The attributive article \textit{ta} in Slovenian is homophonous with the demonstrative determiner (from which it originates historically), but \REF{slovenian def} with the double use of \textit{ta} on stacked adjectives and after the determiner clearly shows that these markers serve two different functions: whereas \textit{ta} \textsc{dem} is a determiner marking the noun phrase for special local deictic species \textit{ta} \textsc{attr} is an attributive marker (i.e., a true article) attaching to the adnominal adjective. Attribution of the adjective in contrastive focus in \REF{slovenian art} is marked by means of attributive nominalization (in combination with head\hyp{}driven agreement).
According to \citet{marusic-etal2007,marusic-etal2007b}, the article \textit{ta} gives the adjective a classifying reading and the construction \textit{ta}+A:\textsc{attr} can be compared to a “reduced relative clause”,\is{adnominal modifier!relative clause} hence a syntactic complement to the noun.
\is{contrastive focus|)}
\il{Slovenian|)}
\il{South Slavic languages|)}
\il{Slavic languages|)}
\il{Indo-European languages|)}
\is{attributive nominalization|)}
\is{head\hyp{}driven agreement|)}
\il{Basque|(}
\section{Basque}
%%%
Basque is a language isolate spoken in the Basque country in northeastern Spain and in adjacent parts of France in southwestern \isi{Europe}.
\is{juxtaposition|(}
\paragraph*{Juxtaposition in Basque}
Attributive adjectives are juxtaposed to the right of the noun they modify.
%%%
\ea
\label{basque juxtap}
{\rm Basque \citep[81]{saltarelli1988}}\\
\gll gona \textbf{gorri} \textbf{estu}-ak\\
skirt red tight-\textsc{def.pl.abs}\\
\glt ‘the tight red skirts’
\z
%%%
Note that the features \textsc{species},\is{species marking} \textsc{number}, and \textsc{case} in \REF{basque juxtap} are not assigned to the adjective through agreement. The corresponding portmanteau suffixes marking the values of these morphological features always attach to right edge of the phrase in Basque. Consequently, they always attach to the attributive adjective if one is present \citep[171]{hualde-etal2003}
\is{juxtaposition|)}
\il{Basque|)}
| {
"alphanum_fraction": 0.7527568846,
"avg_line_length": 49.1081081081,
"ext": "tex",
"hexsha": "1312519093406cd622895954a1337cc70a8863f0",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ca113bd66d56345895af9a6d5bd9adbcde69fc22",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "langsci/sidl",
"max_forks_repo_path": "inprep/Riessler/chapters/chap-lg-nea.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "ca113bd66d56345895af9a6d5bd9adbcde69fc22",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "langsci/sidl",
"max_issues_repo_path": "inprep/Riessler/chapters/chap-lg-nea.tex",
"max_line_length": 1184,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "ca113bd66d56345895af9a6d5bd9adbcde69fc22",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "langsci/sidl",
"max_stars_repo_path": "inprep/Riessler/chapters/chap-lg-nea.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 61688,
"size": 196236
} |
\documentclass[12pt]{article}
% \usepackage[frenchb]{babel}
% \usepackage[utf-8]{inputenc} %%latin1
\usepackage{fullpage}
\usepackage{graphicx} %% to insert pics
\usepackage{listings}
\usepackage{color}
\usepackage{hyperref}
\usepackage{biblatex}
\usepackage{subfiles}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{subcaption}
%%%%%%%%%%%question block
\usepackage[tikz]{bclogo}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The setting for the examples style %
% Source: https://tex.stackexchange.com/questions/295589/how-to-enumerate-a-problem-set-in-a-book-accordingly-with-the-chapter-number %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{enumitem}
\newlist{examples}{enumerate}{1}
\setlist[examples]{label={\thechapter.\arabic*}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% design the code listing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\usepackage{color}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\title{The Comprehensive Coding
Interview Guide\footnote{Temporary book series name.}\\ \normalsize Python + Data Structures + Algorithms + LeetCode Problems \footnote{Explains what is in the book.}}
\author{Li Yin \footnote{Currently, the only author.}}
\definecolor{mygreen}{rgb}{0,0.6,0}
\definecolor{mygray}{rgb}{0.5,0.5,0.5}
\definecolor{mymauve}{rgb}{0.58,0,0.82}
\lstset{ %
backgroundcolor=\color{white}, % choose the background color
basicstyle=\footnotesize, % size of fonts used for the code
breaklines=true, % automatic line breaking only at whitespace
captionpos=b, % sets the caption-position to bottom
commentstyle=\color{mygreen}, % comment style
escapeinside={\%*}{*)}, % if you want to add LaTeX within your code
keywordstyle=\color{blue}, % keyword style
stringstyle=\color{mymauve}, % string literal style
}
\begin{document}
\maketitle
\tableofcontents
%%%%%%%%%%%%%%%%%%%Book Summary%%%%%%%%%%%%%%%
\section{About the Book Series}
\paragraph{Book Series Design} Due to the large number of pages (currently 540), this work is designed to be a book series, with the working title \textit{The Comprehensive Coding Interview Guide} (we can also merge the two parts into one book if needed). This book series uses Python 3 as its programming language due to its popularity and easiness to implement in real coding interview. One of the unique characteristics of this book series is that it uses LeetCode problems as examples and exercises. This series is composed of two parts in total. The first part builds up the knowledge base that the audience needs for tackling coding interviews by teaching fundamental data structures and algorithm design and analysis. Leetcode problems are used as examples throughout this part. The second part builds upon the knowledge in book 1 by applying it to more advanced topics such as dynamic programming and string matching. It features categorized problems to enable the reader to identify types of questions so they can quickly find the proper algorithms in order to solve them in an interview. The subtitle of each book is:
\begin{enumerate}
\item \textbf{Learning Data Structures and Algorithms with LeetCode:} build up the knowledge base.
\item \textbf{Mastering the LeetCode Problem Catalog:} learn the problem-solving patterns by heart and apply them to similar problems.
\end{enumerate}
\paragraph{Purpose of the Series} My goal is to offer any person who is interested in learning about algorithms and coding a practical and in-depth manual to prepare them for an interview. By using real interview problems from LeetCode and teaching audience both standard algorithms/data structures and practical techniques (which are generally not included in any existing textbook) this book can better prepare the reader. We not only teach the readers how an algorithm works but also also be deferential and explain ``why'' and ``when'' it works-- without getting as theoretical as the \textit{Introduction to Algorithms}).
In the following two subsections (\ref{subsec_learning} and \ref{subsec_cracking}), I give more details on each part.
\subsection{Part One: Learning Data Structures and Algorithms with LeetCode }
\label{subsec_learning}
\paragraph{Outline} This first part of the series includes:
\begin{itemize}
\item \textbf{Part \RN{1}: Introduction:} Introduction to the coding interview process, resources, and data structures \& algorithms.
\item \textbf{Part \RN{2}: Fundamental Algorithm Design and Analysis:} Iteration and recursion, divide and conquer, complexity analysis.
\item \textbf{Part \RN{3}: Data Structures:} Covers data structures in such a way that audiences can implement them with basic Python data types, but also has information about more advanced Python built-in data types/modules.
\item \textbf{Part \RN{4}: Complete Search:} Searching on linear data structures as well as on graphs and trees.
\item \textbf{Part \RN{5}: Advanced Algorithm Design:} Dynamic programming and greedy algorithms.
\item \textbf{Part \RN{6}: Math and Bit Manipulation:} Sorting and selection algorithms, bit manipulation, math and probability.
\end{itemize}
\subsection{Part Two: Mastering the LeetCode Problem Catalog}
\label{subsec_cracking}
\paragraph{Outline} The Second part of the series focuses on analyzing the problem patterns, categorizing them and teaching users to solve them type by type. This part includes:
\begin{itemize}
\item \textbf{Part \RN{1}: Special Topics}
\begin{enumerate}
\item \textbf{Dynamic Programming(15\%):} Single sequence $O(n)$ mainly with subarray problem, single sequence $O(n^2)$) with subsequence and splitting type of problems. single sequence $O(n^3)$ that covers interval type of dp, coordinate type, double sequence type, knapsack type.
\item \textbf{String Pattern Matching:} This chapter will teach advanced string pattern matching algorithm, such as KMP, Suffix Array/Tree, and so on.
\item \textbf{Backtracking:} This chapter will include more problems that can be solved with backtracking.
\end{enumerate}
\item \textbf{Part \RN{2}: Questions by Data Structures }
\begin{enumerate}
\item \textbf{Array Questions (15\%):} Subarray, subsequence, subsets, merge and partition, intervals, intersections, miscellaneous types.
\item \textbf{ Linked List, Stack, Queue, and Heap Questions (12\%)}
\item \textbf{String Questions (15\%):} Ad hoc single string type, advanced single string (incudes palindrome, calculator, and others). Exact pattern matching, anagram matching, and others.
\item \textbf{Tree Questions (10\%):} Binary tree and binary search tree.
\item \textbf{Graph Questions (15\%):} Basic DFS/DFS, islands and bridges, np-hard type.
\end{enumerate}
\end{itemize}
\textit{The percentage denotes the portion of all LeetCode problems that fit the category.}
\subsection{Audience and Market}
\paragraph{Audience} The target audience are mainly students and employees in computer science. The required background is high school mathematics and some basic programming.
%This book series can help guide them through real-life coding interviews.
It not only helps with the interview, but also improves their understanding of data structures, algorithms, Python coding, and real problem solving skills.
\paragraph{Market} Due to the large potential audience worldwide, the market is potentially huge. There are competitors; but as far as I know, this book series is unique and can stand out in its own way.
\paragraph{Competition} Here, I list some potential competitive books and for each I explain how our series is different.
\begin{enumerate}
\item \textit{Cracking the Coding Interview} (ISBN-13: 978-0984782802, ISBN-10: 9780984782802, by Gayle Laakmann McDowell). This book is written in Java, and the theoretical knowledge it covers is basic. In my experience, as a beginner before to read and learn from this book can not make me pass the coding interviews of top companies such as Google, Facebook and so on. The problems it offers are real coding interview problems, but it does not support an online judge system nor does it offer the audience a community to practice and share. However, this is the most popular book in this list, and while it is good enough to get the audience started with the preparation, it can not prepare them fully.
\item \textit{Algorithm Design Manual} (ISBN-13: 978-1849967204, ISBN-10: 1849967202, by Steven S Skiena) This is a good book that covers a wide range of algorithms and lists resources and implementations. However, (1) it does not cover real code, (2) is not tuned for coding interviews, and (3) algorithms are explained in snippets, not systematically as in our book series.
\item \textit{The Big Book of Coding Interviews in Python, 3rd Edition: answers to the best programming interview questions on data structures and algorithms} (ISBN-10: 1983861189, ISBN-13: 978-1983861185). This book uses Python and, as the title suggests, it mainly focuses on giving answers to the best programming interview questions. It does not categorize the problems nor does it include the theoretical fundamentals as intended in our book series.
\item \textit{Elements of Programming Interviews} (ISBN-10: 9781479274833, ISBN-13: 978-1479274833, by Adnan Aziz , Tsung-Hsien Lee , Amit Prakash)
\item \textbf{
Handbook of Data Structures and Applications}. \url{https://www.amazon.com/Handbook-Structures-Applications-Computer-Information/dp/1584884355/}
\end{enumerate}
\paragraph{Our Advantages} I summarize the characreristics that set this book apart from all other books on the market.
\begin{enumerate}
\item Use of the online judge system LeetCode - users can easily practice online and have fun.
\item Data structures and algorithms are taught in conjunction with the Python language's built-in data types/modules/functions. Therefore, readers can improve in their understanding of both the data structures, algorithms and the Python language.
\item We cover a wider range of algorithms and data structures. These selected algorithms are tuned for interviews. There, readers have limited time to code and therefore our selected algorithms should be reasonable to implement in the given time limit. For example, monotone stack, binary search on the result space, two-pointer techniques, segment tree, and bit manipulation. These contents are extremely useful for solving problems on LeetCode, but are rarely covered and explained in other books.
\item Our problem catalogue is unique: it includes special topics like dynamic programming and backtracking to help us master these two algorithm design methods. After naming these different categories, we can break down the nearly 1000 problems on LeetCode into these different types and we master a few from each type instead.
\end{enumerate}
% \paragraph{Pros} This book series uses Python 3 as programming language, and LeetCode Problems as examples. The advantages of doing so are obvious:
% \begin{enumerate}
% \item Python is becoming the most popular language in the age of AI, and there are not many interview guide books using Python.
% \item Using LeetCode Problems because first they are real coding interview questions; second, with the online judge system, it is easier for learners to practice online and with the support of the community, it makes the learning process more fun.
% \end{enumerate}
% This section describes what the book is good for--its topic, audience, purpose, and potential issues.
% \subsection{Topic}
% \subsection{Audience}
% \subsection{Purpose}
\subsection{Potential Issues}
It seems useful to use LeetCode's name in the book. However, a potential issue is whether LeetCode allows it and, if they allow it, whether this would require us to cooperate with LeetCode. This matter is beyond my current knowledge and should be discussed if my proposal is accepted.
% %%%%%%%%%%%%%%%%%%%Technology Summary%%%%%%%%%%%%%%%
% \section{Technology Summary}
\section{My Qualifications}
I, Li Yin, am currently the only author for this book. Li Yin. I am a PhD student (fourth year) in Computer Science with 8 years of experience in coding and algorithms, and 5 years in Python. I have two years working experience as a software engineer.
I had many real coding interviews in the past three years with many top companies in the San Francisco Bay Area. At the beginning, with little preparation, I struggled a lot with the coding interviews myself and failed the coding interviews of companies like Google and Facebook. But, in the process I learned a lot by reading other people's books (competitive programming), blogs, videos. This helped me eventually get myself to the point where I passed through coding interviews of multiple top companies in the last two months trying to get myself full-time/intern offer. These companies include Facebook. Intel, Nvidia, Amazon, Apple, Magic Leap so on. I am going to intern with Facebook at Menlo Park office this summer. This book is all based on real experience, I also solved 300 out of 900 problems on LeetCode till now for the sake of this book. I wish this book series can help others who are struggling.
\paragraph{Know More About Me} Here I list more of my websites so that you can know a little bit more about me.
\begin{enumerate}
\item Personal Website: \url{http://liyinscience.com/}.
\item LinkedIn: \url{https://www.linkedin.com/in/li-yin-00b0456b/}.
\item Blog: \url{https://medium.com/@lisulimowicz} (My blog was for the purpose of taking useful notes for myself before, will be more serious in the future about writing).
\item Github: \url{https://github.com/liyin2015}.
\end{enumerate}
Also, I will follow up with a resume in expression of my seriousness to the book series proposal.
\section{Tentative Writing Schedule}
The content of the book series has been completed to approximately 70\% except the need of editing and graphs. There is more work to better explain each algorithm, data structure, and working on improve the problem catalog.
I would say, given 3-4 more months, the book series can be ready for publication. Since I am starting an internship soon, I will have nearly two hours reserved for writing during work days and 8 hours more on each weekend.
\section{Writing Sample 1: Two-pointer Search}
% To complete this document, I include a sample section from the book. And also, the whole
\subfile{chapters/learning/search/sliding_window}
% \chapter{Writing Sample 2: Heap and Priority Queue}
% \subfile{chapters/chapter_8_heap_priority_queue}
% \begin{thebibliography}{2}
% \bibitem{Icescrum}
% Claude Aubry, Vincent Barrier.
% \textit{Les rôles, les équipes et les projets}.
% Droit d' auteur 2011 - 2017 Kagilum SAS
% \\\texttt{https://www.icescrum.com/documentation/roles-teams-projects/}
% \end{thebibliography}
\end{document} | {
"alphanum_fraction": 0.7485685522,
"avg_line_length": 71.9140271493,
"ext": "tex",
"hexsha": "bf069230d9695ae4d0fd5a15d49d65c2fe0a29bb",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "131199fea0b082d92c0f272a495c7a56a3242b71",
"max_forks_repo_licenses": [
"Apache-2.0"
],
"max_forks_repo_name": "stungkit/Algorithms-and-Coding-Interviews",
"max_forks_repo_path": "Easy-Book/proposal.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "131199fea0b082d92c0f272a495c7a56a3242b71",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Apache-2.0"
],
"max_issues_repo_name": "stungkit/Algorithms-and-Coding-Interviews",
"max_issues_repo_path": "Easy-Book/proposal.tex",
"max_line_length": 1128,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "131199fea0b082d92c0f272a495c7a56a3242b71",
"max_stars_repo_licenses": [
"Apache-2.0"
],
"max_stars_repo_name": "stungkit/Algorithms-and-Coding-Interviews",
"max_stars_repo_path": "Easy-Book/proposal.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3687,
"size": 15893
} |
\documentclass[journal,hidelinks]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[
pdftitle={Assignment \#2},
pdfauthor={Andrei Purcarus},
pdfsubject={ECSE-526 -- Artificial Intelligence}
]{hyperref}
\usepackage{graphicx}
\usepackage[all]{hypcap}
\usepackage{cleveref}
\usepackage{indentfirst}
\usepackage[per-mode=symbol]{siunitx}
\title{ECSE-526 \\ Artificial Intelligence \\ Assignment \#2}
\author{Andrei~Purcarus,~260631911,~\IEEEmembership{McGill~University}}
\begin{document}
\sloppy
\maketitle
\begin{abstract}
An agent capable of classifying songs into 10 genres (classical, country, edm dance, jazz, kids, latin, metal, pop, rnb, and rock) was created and tested using cross-validation. Several methods of classification were tried, such as a Gaussian classifier, a k-nearest neighbours (kNN) classifier, and a random decision forest classifier. Cross-validation showed that the kNN classifier with $k = 1$ was the best classifier for the given task of music classification.
\end{abstract}
\section{Introduction}
\IEEEPARstart{T}{his} report describes the creation of an agent capable of classifying songs into one of 10 genres (classical, country, edm dance, jazz, kids, latin, metal, pop, rnb, and rock).
To achieve this goal, we were provided with data in the form of a set of 12-dimensional floating point feature vectors for each song. In addition, we were provided with labels classifying each song with the correct genre.
The goal was therefore to use this data to train an agent that can classify the songs in a test set as accurately as possible.
We first describe the creation of a Gaussian classifier and present an analysis of its expected performance. We also look at the underlying assumptions we make when we model the data using a Gaussian normal distribution.
Then, we describe a k-nearest neighbours (kNN) classifier and look at the values of k for which this classifier works best.
Next, we describe the other types of classifiers that we implemented.
Finally, we compare the performance of each classifier using cross-validation to find the one best suited to the task of music classification.
\section{Gaussian Classifier}
\label{sec:gauss}
First, we implemented a Gaussian classifier. In this classifier, training consists of grouping all the training data by genre and computing the average vector and covariance matrix for each set. Then, to classify new feature vectors, we use the unnormalized log likelihood to compute a measure of how closely the feature vector fits into each genre's normal distribution. Given an average vector $\mu$ and a covariance matrix $\Sigma$, we thus find the genre $i$ with the minimum value of
\[ UNLL_{i} = (x - \mu_{i})^T \Sigma_{i}^{-1} (x - \mu_{i}) \]
We implemented two versions of this model. The first one, which we call the Gaussian classifier, takes the set of averages of each song's features as the training set. When it has to classify a new song, it computes the average feature vector for said song and compares it to the normal distributions of the averages of other songs. The second model, which we call the Total Gaussian classifier, uses the raw feature vectors to compute the normal distribution for each genre and then classifies new songs by first classifying all their feature vectors and then taking the plurality vote among the results.
In using this model, we make several assumptions about the data. We assume that the feature vectors for each genre are produced by a single statistical model. In addition, we assume that this model is one in which features are normally distributed around a mean value. Essentially, this means that we assume each genre has a "true" value, with Gaussian noise spreading the data around that point. In addition, we assume that the data points are independent. This last assumption, combined with the fact that feature vectors within a song might be correlated, helps explain why the Gaussian classifier performs so much better than the Total Gaussian classifier during cross-validation (\Cref{tab:results}): By taking the average feature vector for each song, it better satisfies the third assumption of independence.
With these three assumptions in mind, we can see where we might expect the Gaussian classifier to perform well and where it might fall short. In situations such as classifying factory parts into different types, where the parts can be modeled as ideal parts with manufacturing error that is normally distributed, a Gaussian classifier can be expected to perform very well. However, there are many situations where the model can perform poorly. One such situation is where the data for a class actually consists of many local clusters of data points at different locations. Then, the average will have nothing to do with the actual distribution of the data, and a nearest neighbour approach will likely outperform it since it uses a more local classification method. Another example where the Gaussian fails is when two classes have the same averages. Then, the UNLL will depend only on the covariance matrix. Thus, a class with a strictly greater covariance matrix will always be chosen over one with a smaller one.
\section{K-Nearest Neighbours Classifier}
\label{sec:knn}
Next, we implemented two types of kNN classifiers. One is the standard kNN classifier that selects the prediction based on a plurality vote of the k nearest neighbours. The other is a weighed kNN classifier that assigns to each nearest neighbour a weight $w = 1 / d^2$, where $d$ is the distance between the feature vector to be classified and the neighbour. It then normalizes these weights for each feature vector and averages them over all feature vectors in a song to make a prediction.
In order to speed up predictions, we used two different implementations of a KD tree. One is a standard KD tree that splits the data into two equal sets at each node such that one set has lower values than a threshold for a given feature and the other has higher values. Search can then be sped up by eliminating subtrees that cannot contain nearest neighbours. The other is an implementation of a best bin first KD tree that uses a priority queue to keep track of which nodes to visit next. This approach visits closer nodes sooner, and thus it lends itself to early cutoff with much better results \cite{beis_shape_1997}.
As shown in \Cref{tab:results}, the best value of $k$ found during experimentation was $k = 1$ for both the standard and weighed implementations. For standard kNN, the performance experiences a peak at $k = 1$, then drops drastically and starts climbing back up slowly as $k$ increases. A possible explanation of this phenomenon is that the nearest neighbours are evenly distributed among genres. When a single neighbour is used, it will always be the nearest one that classifies a feature vector. With $k = 3$, if the three neighbours disagree the prediction will choose a random classification among the three. As $k$ increases, the presence of more neighbours allows the predictions to reach an actual plurality and improves the accuracy. With weighted selection, we can see that the results are more normalized since more distant neighbours contribute less to the prediction.
\section{Other Classifiers}
We also implemented a classifier called the random decision forest classifier. In this type of classifier, $N$ decision trees are each trained on a subset of the data and a subset of the features. These subsets are randomly chosen with replacement. In our implementation, we used sizes of $2 * D / 3$ and $2 \sqrt{F}$, respectively, where $D$ is the total number of training examples and $F$ is the total number of features. The forest then selects the best prediction based on a plurality vote of the trees. The trees themselves were built by splitting the data at each node into two subsets based on whether they lie above or below a threshold value for a given feature. All such splits are tried for each randomly selected feature and the one that minimizes entropy is selected.
\section{Results}
To evaluate the different classifiers, we used a cross-validation method where the training data was randomly split into 10 subsets of equal size. Then, the classifiers were allowed to train on 9 of these subsets and tested against the 10th. This process was repeated for each possible 9-1 split and the results were averaged to give a final performance metric. The results are plotted in \Cref{fig:results}, with the corresponding data shown in \Cref{tab:results}. Note that to speed up the search, a best bin first KD tree was used for both kNN and weighed kNN with a cutoff set at $400 * k$ leaf nodes.
\begin{figure}[!htb]
\centering
\includegraphics[width=\columnwidth]{cross_validation.eps}
\caption{Cross-validation results for the implemented music classifiers.}
\label{fig:results}
\end{figure}
\begin{table}[!htb]
\centering
\caption{Cross-validation results for the implemented music classifiers.}
\label{tab:results}
\resizebox{0.8\columnwidth}{!}{\begin{tabular}{l|l}
\textbf{Classifier} & \textbf{Performance (\%)} \\ \hline
Gaussian & 50.8 \\
Total Gaussian & 27.8 \\
1NN & 59.6 \\
3NN & 46.4 \\
5NN & 51.2 \\
7NN & 51.2 \\
Weighed 1NN & 60.2 \\
Weighed 3NN & 60.0 \\
Weighed 5NN & 59.3 \\
Weighed 7NN & 59.5 \\
Decision Forest (3) & 53.9 \\
Decision Forest (5) & 55.8 \\
Decision Forest (10) & 57.2 \\
\end{tabular}}
\end{table}
From these figures, it is clear that the kNN and weighed kNN classifiers are the best at classifying music genres, followed closely by the random decision forest, then the Gaussian, and finally the Total Gaussian.
The fact that the nearest neighbour approach is the best classifier for this data set can be seen as an indicator that feature vectors for a genre tend to cluster together such that they are close to other members of the same genre. We looked at the best values of $k$ back in \Cref{sec:knn}.
The next best performer, the random decision forest, can be viewed as similar to the nearest neighbour classifiers, since a decision tree cuts up the N-dimensional space into local subspaces and assigns each subspace a genre. It is therefore more coarse than kNN since it lumps together groups in the same subspace. In fact, we can see from \Cref{fig:results} that the decision forest performance increases with the number of trees. Therefore, we might reasonably expect that with sufficient trees, its performance might exceed that of the kNN. One additional thing to keep in mind is that the trees were not pruned. Given pruning, the forest might perform even better by reducing the extent of overfitting for individual trees.
As mentioned in \Cref{sec:gauss}, the poor performance of the Total Gaussian classifier can be explained by the correlation present between feature vectors in the same song, which violates our assumptions in modeling the data as a Gaussian distribution. Indeed, we can see that when we average the feature vectors for each song, we get almost twice the performance out of a Gaussian classifier. Even so, the kNN outclasses the Gaussian classifier, indicating that the data is better represented by local clusters than a global normal distribution.
\section{Conclusions}
In conclusion, we created an agent capable of classifying songs into 10 genres and tested it using cross-validation. We tried several classification methods including the Gaussian classifier, the kNN classifier, and the random decision forest classifier. We then found that the kNN classifier with $k = 1$ is the best classifier for the given task of music classification.
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,references}
\end{document}
| {
"alphanum_fraction": 0.7901245096,
"avg_line_length": 104.6964285714,
"ext": "tex",
"hexsha": "00797f48a62dae86a5b6e9061729b99a66cf2860",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "72ca5e347b07b7f8db20fbf2d1f72a4f4f159f5c",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Gripnook/music-classifier",
"max_forks_repo_path": "report/main.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "72ca5e347b07b7f8db20fbf2d1f72a4f4f159f5c",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Gripnook/music-classifier",
"max_issues_repo_path": "report/main.tex",
"max_line_length": 1015,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "72ca5e347b07b7f8db20fbf2d1f72a4f4f159f5c",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Gripnook/music-classifier",
"max_stars_repo_path": "report/main.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 2610,
"size": 11726
} |
\label{ch:pert}
\section{Predicting interface states}
The \maestro\ hyperbolic equations come in two forms: advective and
conservative. The procedure for predicting interface states differs
slightly depending on which form we are dealing with.
\subsection{Advective form}
Most of the time, we are dealing with equations in advective form.
Here, a scalar, $\phi$, obeys:
\begin{equation}
\frac{\partial \phi}{\partial t} = -\Ub \cdot \nabla \phi + f
\end{equation}
where $f$ is the force. This is the form that the perturbation
equations take, as well as the equation for $X_k$ itself.
A piecewise linear prediction of $\phi$ to the interface
would appear as:
\begin{eqnarray}
\phi_{i+1/2,j}^{n+1/2} &=& \phi_{i,j}^n
+ \left . \frac{\Delta x}{2} \frac{\partial \phi}{\partial x} \right |_{i,j}
+ \left . \frac{\Delta t}{2} \frac{\partial \phi}{\partial t} \right |_{i,j} \\
&=& \phi_{i,j}^n
+ \left . \frac{\Delta x}{2} \frac{\partial \phi}{\partial x} \right |_{i,j}
+ \frac{\Delta t}{2} \left ( -u \frac{\partial \phi}{\partial x}
-v \frac{\partial \phi}{\partial y} + f \right ) \\
&=& \phi_{i,j}^n + \frac{\Delta x}{2} \left ( 1 - \frac{\Delta t}{\Delta x} u \right )
\frac{\partial \phi}{\partial x}
\underbrace{- \frac{\Delta t}{2} v \frac{\partial \phi}{\partial y}}_{\text{``transverse~term''}} + \frac{\Delta t}{2} f
\end{eqnarray}
(see the Godunov notes section for more details). Here, the
``transverse term'' is accounted for in {\tt make\_edge\_scal}. Any
additional forces should be added to $f$. For the perturbation form
of equations, we add additional advection-like terms to $f$ by calling
{\tt modify\_scal\_force}. This will be noted below.
\subsection{Conservative form}
A conservative equation takes the form:
\begin{equation}
\frac{\partial \phi}{\partial t} = -\nabla \cdot ( \phi \Ub) + f
\end{equation}
%
Now a piecewise linear prediction of $\phi$ to the interface is
\begin{eqnarray}
\phi_{i+1/2,j}^{n+1/2} &=& \phi_{i,j}^n
+ \left . \frac{\Delta x}{2} \frac{\partial \phi}{\partial x} \right |_{i,j}
+ \left . \frac{\Delta t}{2} \frac{\partial \phi}{\partial t} \right |_{i,j} \\
&=& \phi_{i,j}^n
+ \left . \frac{\Delta x}{2} \frac{\partial \phi}{\partial x} \right |_{i,j}
+ \frac{\Delta t}{2} \left ( -\frac{\partial (\phi u)}{\partial x}
-\frac{\partial (\phi v)}{\partial y} + f \right ) \\
&=& \phi_{i,j}^n + \frac{\Delta x}{2} \left ( 1 - \frac{\Delta t}{\Delta x} u \right )
\frac{\partial \phi}{\partial x}
\underbrace{- \frac{\Delta t}{2} \phi \frac{\partial u}{\partial x} }_{\text{``non-advective~term''}}
\underbrace{- \frac{\Delta t}{2} \frac{\partial (\phi v)}{\partial y}}_{\text{``transverse~term''}} + \frac{\Delta t}{2} f
\end{eqnarray}
Here the ``transverse term'' is now in conservative form, and an additional
term, the non-advective portion of the
$x$-flux (for the $x$-prediction) appears. Both of the underbraced terms are
accounted for in {\tt make\_edge\_scal} automatically when we call it
with {\tt is\_conservative = .true.}.
%-----------------------------------------------------------------------------
% density
%-----------------------------------------------------------------------------
\section{Density Evolution}
\label{sec:pred:density}
\subsection{Basic equations}
The full density evolution equation is
\begin{eqnarray}
\frac{\partial\rho}{\partial t} &=& -\nabla\cdot(\rho\Ub) \nonumber \\
&=& -\Ub\cdot\nabla\rho - \rho\nabla\cdot\Ub \, . \label{rho equation}
\end{eqnarray}
The species are evolved according to
\begin{eqnarray}
\frac{\partial(\rho X_k)}{\partial t} &=& -\nabla\cdot(\rho\Ub X_k) + \rho \omegadot_k \nonumber \\
&=& -\Ub\cdot\nabla(\rho X_k) - \rho X_k \nabla\cdot\Ub + \rho \omegadot_k \, . \label{species equation}
\end{eqnarray}
In practice, only the species evolution equation is evolved, and the
total density is set as
\begin{equation}
\rho = \sum_k (\rho X_k)
\end{equation}
To advance $(\rho X_k)$ to the next timestep, we need to predict a
time-centered, interface state. Algebraically, there are multiple
paths to get this interface state---we can predict $(\rho X)$ to the
edges as a single quantity, or predict $\rho$ and $X$ separately
(either in full or perturbation form). In the notes below, we use the
subscript `{\tt edge}' to indicate what quantity was {\em predicted} to the
edges. In \maestro, the different methods of computing $(\rho X)$ on
edges are controlled by the \runparam{species\_pred\_type} parameter. The
quantities predicted to edges and the
resulting edge state are shown in the table~\ref{table:pred:species}
\begin{table}[h]
\centering
\caption{Summary of species edge state construction}
\label{table:pred:species}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{l|c|c}
\hline
\hline
{\tt species\_pred\_type} & {quantities predicted} & {$(\rho X_k)$ edge state} \\[-5pt]
& {in {\tt make\_edge\_scal}} & \\
\hline
1 / {\tt predict\_rhoprime\_and\_X} &
$\rho'_\mathrm{edge}$, $(X_k)_\mathrm{edge}$ &
$\left(\rho_0^{n+\myhalf,{\rm avg}}
+ \rho'_\mathrm{edge} \right)(X_k)_\mathrm{edge}$ \\
2 / {\tt predict\_rhoX} &
$\sum(\rho X_k)_\mathrm{edge}$, $(\rho X_k)_\mathrm{edge}$ &
$(\rho X_k)_\mathrm{edge}$ \\
3 / {\tt predict\_rho\_and\_X} &
$\rho_\mathrm{edge}$, $(X_k)_\mathrm{edge}$ &
$\rho_\mathrm{edge} (X_k)_\mathrm{edge}$ \\
\hline
\end{tabular}
\end{table}
We note the labels {\tt predict\_rhoprime\_and\_X}, {\tt predict\_rhoX}, and
{\tt predict\_rho\_and\_X} are provided by the {\tt pred\_parameters}
module.
\subsection{Method 1: {\tt species\_pred\_type} = {\tt predict\_rhoprime\_and\_X}}
Here we wish to construct $(\rho_0^{n+\myhalf,{\rm avg}}
+ \rho'_\mathrm{edge})(X_k)_\mathrm{edge}$.
We predict both $\rho'$ and $\rho_0$ to edges separately and later use them to
reconstruct $\rho$ at edges. The base state density evolution equation is
\begin{equation}
\frac{\partial\rho_0}{\partial t} = -\nabla\cdot(\rho_0 w_0 \eb_r) =
-w_0\frac{\partial\rho_0}{\partial r}
\underbrace{-\rho_0\frac{\partial w_0}{\partial r}}_{``\rho_0 ~ \text{force"}}.
\label{rho0 equation}
\end{equation}
Subtract (\ref{rho0 equation}) from (\ref{rho equation}) and rearrange
terms, noting that $\Ub = \Ubt + w_o\eb_r$, to obtain the
perturbational density equation,
\begin{equation}
\frac{\partial\rho'}{\partial t} = -\Ub\cdot\nabla\rho' \underbrace{- \rho'\nabla\cdot\Ub
- \nabla\cdot(\rho_0\Ubt)}_{\rho' ~ \text{force}} \, .
\label{rhoprime equation}
\end{equation}
We also need $X_k$ at the edges. Here, we subtract $X_k \times$
Eq.~\ref{rho equation} from Eq.~\ref{species equation} to obtain
\begin{equation}
\frac{\partial X_k}{\partial t} = -\Ub \cdot \nabla X_k + \omegadot_k
\end{equation}
When using Strang-splitting, we ignore the $\omegadot_k$ source terms, and
then the species equation is a pure advection equation with no force.
\subsubsection{Predicting $\rho'$ at edges}
We define $\rho' = \rho^{(1)} - \rho_0^n$. Then we predict $\rho'$ to
edges using {\tt make\_edge\_scal} in {\tt density\_advance} and the
underbraced term in Eq.~\ref{rhoprime equation} as the forcing. This
force is computed in {\tt modify\_scal\_force}. This prediction is
done in advective form.
\subsubsection{Predicting $\rho_0$ at edges}\label{Predicting rho0 at edges}
There are two ways to predict $\rho_0$ at edges.
\begin{enumerate}
\item We call {\tt make\_edge\_state\_1d} using the underbraced term
in (\ref{rho0 equation}) as the forcing. This gives us
$\rho_0^{n+\myhalf,{\rm pred}}$. This term is used to advect $\rho_0$
in {\bf Advect Base Density}. In plane-parallel geometries, we also use
$\rho_0^{n+\myhalf,{\rm pred}}$ to compute $\etarho$, which will be used
to compute $\psi$.
\item We define $\rho_0^{n+\myhalf,{\rm avg}} = (\rho_0^n +
\rho_0^{(2)})/2$. We compute $\rho_0^{(2)}$ from $\rho_0^n$ using
{\bf Advect Base Density}, which advances equation (\ref{rho0 equation})
through $\Delta t$ in time. The $(2)$ in the superscript indicates
that we have not called {\bf Correct Base} yet, which computes
$\rho_0^{n+1}$ from $\rho_0^{(2)}$. We use $\rho_0^{(2)}$ rather than
$\rho_0^{n+1}$ to construct $\rho_0^{n+\myhalf,{\rm avg}}$ since $\rho_0^{n+1}$
is not available yet. $\rho_0^{n+\myhalf,{\rm avg}}$ is used to construct
$\rho$ at edges from $\rho'$ at edges, and
this $\rho$ at edges is used to compute fluxes for $\rho X_k$.
\end{enumerate}
We note that in essence these choices reflect a hyperbolic (1)
vs.\ elliptic (2) approach. In \maestro, if we setup a problem with
$\rho = \rho_0$ initially, and enforce a constraint $\nabla \cdot
(\rho_0 \Ub) = 0$ (i.e.\ the anelastic constraint), then analytically,
we should never generate a $\rho'$. To realize this behavior
numerically, we use $\rho_0^{n+\myhalf,{\rm avg}}$ in the prediction
of $(\rho X_k)$ on the edges to be consistent with the use of the
average of $\rho$ to the interfaces in the projection step at the end
of the algorithm.
\subsubsection{Computing $\rho$ at edges}\label{Computing rho at edges}
For the non-radial edges, we directly add $\rho_0^{n+\myhalf,{\rm avg}}$
to $\rho'$ since $\rho_0^{n+\myhalf,{\rm avg}}$ is a cell-centered
quantity. For the radial edges, we interpolate to obtain
$\rho_0^{n+\myhalf,{\rm avg}}$ at radial edges before adding it to
$\rho'$.
\subsubsection{Predicting $X_k$ at edges}
\label{sec:pert:predict_X}
Predicting $X_k$ is straightforward. We convert the cell-centered
$(\rho X_k)$ to $X_k$ by dividing by $\rho$ in each zone and then we
just call {\tt make\_edge\_scal} in {\tt density\_advance} on $X_k$.
The force seen by {\tt make\_edge\_scal} is 0. The prediction is
done in advective form.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 2: {\tt species\_pred\_type} = {\tt predict\_rhoX}}
Here we wish to construct $(\rho X_k)_\mathrm{edge}$ by predicting
$(\rho X_k)$ to the edges as a single quantity. We recall
Eq.~\ref{species equation}:
\begin{equation}
\frac{\partial(\rho X_k)}{\partial t} =
-\nabla \cdot (\rho \Ub X_k) + \rho \omegadot_k \, . \nonumber
\end{equation}
The edge state is created by calling {\tt make\_edge\_scal} in {\tt
density\_advance} with {\tt is\_conservative = .true.}.
We do not consider the $\rho \omegadot_k$ term in the forcing when
Strang-splitting.
We note that even though it is not needed here, we still compute
$\rho_\mathrm{edge}=\sum(\rho X_k)_\mathrm{edge}$ at the edges since certain
enthalpy formulations need it.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 3: {\tt species\_pred\_type} = {\tt predict\_rho\_and\_X}}
Here we wish to construct $\rho_\mathrm{edge} (X_k)_\mathrm{edge}$
by predicting $\rho$ and $X_k$ to the edges separately.
Predicting $X_k$ to the edges proceeds exactly as described in
\S~\ref{sec:pert:predict_X}.
Predicting the full $\rho$ begins with Eq.~\ref{rho equation}:
\begin{equation}
\frac{\partial\rho}{\partial t}
= -\Ub\cdot\nabla\rho \, \underbrace{- \rho\nabla\cdot\Ub}_{``\rho~\text{force''}} \, . \label{rho equation labeled}
\end{equation}
Using this, $\rho$ is predicted to the edges using {\tt
make\_edge\_scal} in {\tt density\_advance}, with the underbraced
force computed in {\tt modify\_scal\_force} with {\tt fullform =
.true.}. \MarginPar{we need to switch this over to doing the conservative prediction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Advancing $\rho X_k$}\label{Advancing rhoX_k}
The evolution equation for $\rho X_k$, ignoring the reaction terms
that were already accounted for in {\tt react\_state}, and the
associated discretization is \\
\noindent {\tt species\_pred\_type = predict\_rhoprime\_and\_X}:
\begin{equation}
\frac{\partial\rho X_k}{\partial t} =
-\nabla\cdot\left\{\left[\left({\rho_0}^{n+\myhalf,{\rm avg}}
+ \rho'_\mathrm{edge} \right)(X_k)_\mathrm{edge} \right](\Ubt+w_0\eb_r)\right\}.
\end{equation} \\
\noindent {\tt species\_pred\_type = predict\_rhoX}:
\begin{equation}
\frac{\partial\rho X_k}{\partial t} =
-\nabla\cdot\left\{\left[\left(\rho X_k \right)_\mathrm{edge} \right](\Ubt+w_0\eb_r)\right\}.
\end{equation} \\
\noindent {\tt species\_pred\_type = predict\_rho\_and\_X}:
\begin{equation}
\frac{\partial\rho X_k}{\partial t} =
-\nabla\cdot\left\{\left[\rho_\mathrm{edge} (X_k)_\mathrm{edge} \right](\Ubt+w_0\eb_r)\right\}.
\end{equation}
%-----------------------------------------------------------------------------
% energy
%-----------------------------------------------------------------------------
\section{Energy Evolution}
\label{sec:pred:enthalpy}
\subsection{Basic equations}
\maestro\ solves an enthalpy equation.
The full enthalpy equation is
\begin{eqnarray}
\frac{\partial(\rho h)}{\partial t} &=& -\nabla\cdot(\rho h \Ub) + \frac{Dp_0}{Dt}
+ \nabla\cdot \kth \nabla T + \rho H_{\rm nuc} + \rho H_{\rm ext} \nonumber \\
&=& \underbrace{-\Ub\cdot\nabla(\rho h) - \rho h\nabla\cdot\Ub}_{-\nabla\cdot(\rho h\Ub)}
+ \underbrace{\psi + (\Ubt \cdot \er) \frac{\partial p_0}{\partial r}}_{\frac{Dp_0}{Dt}}
+ \nabla\cdot\kth\nabla T + \rho H_{\rm nuc} + \rho H_{\rm ext}.
\end{eqnarray}
%The full temperature equation is
%\begin{equation}
%\frac{\partial T}{\partial t} = -\Ub\cdot\nabla T
%+ \frac{1}{\rho c_p}\left\{(1-\rho h_p)\left[\psi
%+ (\Ubt \cdot \er )\frac{\partial p_0}{\partial r}\right] - \sum_k\rho\xi_k\dot\omega_k
%+ \rho H_{\rm nuc} + \rho H_{\rm ext}\right\}.
%\end{equation}
Due to Strang-splitting of the reactions, the call to {\tt
react\_state} has already been made. Hence, the goal is to compute
an edge state enthalpy starting from $(\rho h)^{(1)}$ using an
enthalpy equation that does not include the $\rho H_{\rm nuc}$ and
$\rho H_{\rm ext}$ terms, where were already accounted for in {\tt
react\_state}, so our equation becomes
\begin{equation}
\frac{\partial(\rho h)}{\partial t} = -\Ub\cdot\nabla(\rho h) - \rho h\nabla\cdot\Ub
+ \underbrace{\psi + (\Ubt \cdot \er) \frac{\partial p_0}{\partial r} + \nabla\cdot\kth\nabla T}_{``(\rho h) ~ \text{force}"} \label{rhoh equation}
\end{equation}
We define the base state enthalpy evolution equation as
\begin{eqnarray}
\frac{\partial(\rho h)_0}{\partial t} &=& -\nabla\cdot[(\rho h)_0 w_0\eb_r]
+ \frac{D_0p_0}{Dt} \nonumber \\
&=& -w_0\frac{\partial(\rho h)_0}{\partial r}
- \underbrace{(\rho h)_0\frac{\partial w_0}{\partial r}+ \psi}_{``(\rho h)_0 ~ \text{force}"}
\enskip .\label{rhoh0 equation}
\end{eqnarray}
\subsubsection{Perturbational enthalpy formulation}
Subtracting (\ref{rhoh0 equation}) from (\ref{rhoh equation}) and
rearranging terms gives the perturbational enthalpy equation
\begin{eqnarray}
\frac{\partial(\rho h)'}{\partial t} &=& -\nabla\cdot[(\rho h)'\Ub]
- \nabla\cdot[(\rho h)_0\Ubt] + (\Ubt \cdot \er)\frac{\partial p_0}{\partial r}
+ \nabla\cdot\kth\nabla T\nonumber \\
&=& -\Ub\cdot\nabla(\rho h)' \underbrace{- (\rho h)'\nabla\cdot\Ub
- \nabla\cdot[(\rho h)_0\Ubt] + (\Ubt \cdot \er)\frac{\partial p_0}{\partial r}
+ \nabla\cdot\kth\nabla T}_{``(\rho h)' ~ \text{force}"}, \label{rhohprime equation}
\end{eqnarray}
\subsubsection{Temperature formulation}
Alternately, we can consider an temperature evolution equation, derived
from enthalpy, as:
\begin{equation}
\frac{\partial T}{\partial t} = -\Ub\cdot\nabla T
+ \frac{1}{\rho c_p}\left\{(1-\rho h_p)\left[\psi
+ (\Ubt \cdot \er )\frac{\partial p_0}{\partial r}\right]
+ \nabla \cdot \kth \nabla T
- \sum_k\rho\xi_k\omegadot_k
+ \rho H_{\rm nuc} + \rho H_{\rm ext}\right\}.
\end{equation}
Again, we neglect the reaction terms, since that will be handled during
the reaction step, so we can write this as:
\begin{equation}
\frac{\partial T}{\partial t} = -\Ub\cdot\nabla T
\underbrace{
+ \frac{1}{\rho c_p}\left\{(1-\rho h_p)\left[\psi
+ (\Ubt \cdot \er )\frac{\partial p_0}{\partial r}\right]
+ \nabla \cdot \kth \nabla T \right \} }_{``T~\text{force''}} \, .
\label{T equation labeled}
\end{equation}
\subsubsection{Pure enthalpy formulation}
A final alternative is to consider an evolution equation for $h$
alone. This can be derived by expanding the derivative of $(\rho h)$
in Eq.~\ref{rhoh equation} and subtracting off $h \times$ the
continuity equation (Eq.~\ref{rho equation}):
\begin{equation}
\frac{\partial h}{\partial t} = -\Ub \cdot \nabla h
\underbrace{+ \frac{1}{\rho}
\left \{ \psi + (\Ubt \cdot \er )\frac{\partial p_0}{\partial r}
+ \nabla \cdot \kth \nabla T \right \} }_{``h~\text{force''}} \, .
\label{h equation labeled}
\end{equation}
\subsubsection{Prediction requirements}
To update the enthalpy, we need to compute an interface state for
$(\rho h)$. As with the species evolution, there are multiple
quantities we can predict to the interfaces to form this state,
controlled by \runparam{enthalpy\_pred\_type}. A complexity of the
enthalpy evolution is that the formation of this edge state will
depend on \runparam{species\_pred\_type}.
The general procedure for making the $(\rho h)$ edge state is as follows:
\begin{enumerate}
\item predict $(rho h)$, $(\rho h)'$, $h$, or $T$ to the edges (depending on {\tt
enthalpy\_pred\_type} ) using {\tt make\_edge\_scal} and the forces
identified in the appropriate evolution equation
(Eqs.~\ref{rhohprime equation}, \ref{T equation labeled}, or \ref{h
equation labeled} respectively).
The appropriate forces are summaried in table~\ref{table:pred:hforce}.
\item if we predicted $T$, convert this predicted
edge state to an intermediate ``enthalpy'' state (the quotes
indicate that it may be perturbational or full enthalpy) by calling
the EOS.
\item construct the final enthalpy edge state in {\tt mkflux}. The
precise construction depends on what species and enthalpy quantities
are input to {\tt mkflux}.
\end{enumerate}
Finally, when \maestro\ is run with \runparam{use\_tfromp} {\tt = T}, the
temperature is derived from the density, basestate pressure ($p_0$),
and $X_k$. When run with reactions or external heating, {\tt
react\_state} updates the temperature after the reaction/heating
term is computed. In {\tt use\_tfromp = T} mode, the temperature will
not see the heat release, since the enthalpy does not feed in. Only
after the hydro update does the temperature gain the effects of the
heat release due to the adjustment of the density (which in turn sees
it through the velocity field and $S$). As a result, the {\tt
enthalpy\_pred\_type}s that predict temperature to the interface
({\tt predict\_T\_then\_rhoprime} and {\tt predict\_T\_then\_h}) will
not work. \maestro\ will abort if the code is run with this
combination of parameters.
Table~\ref{table:pred:hoverview}
gives a summary
of the {\tt enthalpy\_pred\_type} behavior.
\begin{table*}[h]
\centering
\caption{Forcing term into {\tt make\_edge\_scal}}
\label{table:pred:hforce}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{l|c}
\hline
\hline
{\tt enthalpy\_pred\_type} & {advective force} \\
\hline
0 / {\tt predict\_rhoh} $(\rho h)$ & $ \left [\psi + (\Ubt \cdot \er)
\frac{\partial p_0}{\partial r} + \nabla \cdot \kth \nabla T \right ]$ \\
1 / {\tt predict\_rhohprime} $((\rho h)^\prime)$ &
$-(\rho h)^\prime \; \nabla \cdot (\Ubt+w_0 \er) -
\nabla \cdot (\Ubt (\rho h)_0) + (\Ubt \cdot \er) \frac{\partial p_0}{\partial r} + \nabla \cdot \kth \nabla T$ \\
2 / {\tt predict\_h} $(h)$ & $\frac{1}{\rho} \left [\psi + (\Ubt \cdot \er)
\frac{\partial p_0}{\partial r} + \nabla \cdot \kth \nabla T \right ]$ \\
3 / {\tt predict\_T\_then\_rhohprime} $(T)$ & $\frac{1}{\rho c_p} \left \{ (1 - \rho h_p)
\left [\psi + (\Ubt \cdot \er) \frac{\partial p_0}{\partial r} \right ] + \nabla \cdot \kth \nabla T \right \}$ \\
4 / {\tt predict\_T\_then\_h} $(T)$ & $\frac{1}{\rho c_p} \left\{ (1 - \rho h_p) \left [\psi + (\Ubt \cdot \er)
\frac{\partial p_0}{\partial r}\right ] + \nabla \cdot \kth \nabla T \right\}$ \\
\hline
\end{tabular}
\end{table*}
\begin{landscape}
\begin{table}[t]
\caption{Summary of enthalpy edge state construction}
\label{table:pred:hoverview}
\renewcommand{\arraystretch}{1.5}
{\small
\centering
\begin{tabular}{l|l|c|c|c|c}
\hline
\hline
{\tt species\_pred\_type} &
{\tt enthalpy\_pred\_type} &
{cell-centered} &
{intermediate} &
{species quantity} &
{final $(\rho h)$} \\[-5pt]
&
&
{quantity predicted} &
{``enthalpy''} &
{available in} &
{edge state} \\[-5pt]
&
&
{in {\tt make\_edge\_scal}} &
{edge state} &
{\tt mkflux} &
\\
\hline
1 / {\tt predict\_rhoprime\_and\_X} & 0 / {\tt predict\_rhoh} &
$(\rho h)$ & $(\rho h)_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho'_\mathrm{edge}$ &
$(\rho h)_\mathrm{edge}$ \\
1 / {\tt predict\_rhoprime\_and\_X} & 1 / {\tt predict\_rhohprime} &
$(\rho h)'$ & $(\rho h)'_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho'_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
1 / {\tt predict\_rhoprime\_and\_X} & 2 / {\tt predict\_h} &
$h$ & $h_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho'_\mathrm{edge}$ &
$\left ( \rho_0^{n+\myhalf,{\rm avg}} + \rho'_\mathrm{edge} \right ) h_\mathrm{edge}$ \\
1 / {\tt predict\_rhoprime\_and\_X} & 3 / {\tt predict\_T\_then\_rhohprime} &
$T$ & $(\rho h)'_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho'_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
1 / {\tt predict\_rhoprime\_and\_X} & 4 / {\tt predict\_T\_then\_h} &
$T$ & $h_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho'_\mathrm{edge}$ &
$\left ( \rho_0^{n+\myhalf,{\rm avg}} + \rho'_\mathrm{edge} \right ) h_\mathrm{edge}$ \\
\hline
\hline
2 / {\tt predict\_rhoX} & 0 / {\tt predict\_rhoh} &
$(\rho h)$ & $(\rho h)_\mathrm{edge}$ &
$(\rho X)_\mathrm{edge}$, $\sum(\rho X)_\mathrm{edge}$ &
$(\rho h)_\mathrm{edge}$ \\
2 / {\tt predict\_rhoX} & 1 / {\tt predict\_rhohprime} &
$(\rho h)'$ & $(\rho h)'_\mathrm{edge}$ &
$(\rho X)_\mathrm{edge}$, $\sum(\rho X)_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
2 / {\tt predict\_rhoX} & 2 / {\tt predict\_h} &
$h$ & $h_\mathrm{edge}$ &
$(\rho X)_\mathrm{edge}$, $\sum(\rho X)_\mathrm{edge}$ &
$\sum(\rho X)_\mathrm{edge} h_\mathrm{edge}$ \\
2 / {\tt predict\_rhoX} & 3 / {\tt predict\_T\_then\_rhohprime} &
$T$ & $(\rho h)'_\mathrm{edge}$ &
$(\rho X)_\mathrm{edge}$, $\sum(\rho X)_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
2 / {\tt predict\_rhoX} & 4 / {\tt predict\_T\_then\_h} &
$T$ & $h_\mathrm{edge}$ &
$(\rho X)_\mathrm{edge}$, $\sum(\rho X)_\mathrm{edge}$ &
$\sum(\rho X)_\mathrm{edge} h_\mathrm{edge}$ \\
\hline
\hline
3 / {\tt predict\_rho\_and\_X} & 0 / {\tt predict\_rhoh} &
$(\rho h)$ & $(\rho h)_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho_\mathrm{edge}$ &
$(\rho h)_\mathrm{edge}$ \\
3 / {\tt predict\_rho\_and\_X} & 1 / {\tt predict\_rhohprime} &
$(\rho h)'$ & $(\rho h)'_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
3 / {\tt predict\_rho\_and\_X} & 2 / {\tt predict\_h} &
$h$ & $h_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho_\mathrm{edge}$ &
$\rho_\mathrm{edge} h_\mathrm{edge}$ \\
3 / {\tt predict\_rho\_and\_X} & 3 / {\tt predict\_T\_then\_rhohprime} &
$T$ & $(\rho h)'_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho_\mathrm{edge}$ &
$\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho h)'_\mathrm{edge} \right ]$ \\
3 / {\tt predict\_rho\_and\_X} & 4 / {\tt predict\_T\_then\_h} &
$T$ & $h_\mathrm{edge}$ &
$X_\mathrm{edge}$, $\rho_\mathrm{edge}$ &
$\rho_\mathrm{edge} h_\mathrm{edge}$ \\
\hline
\end{tabular}
} % end \small
\end{table}
\end{landscape}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 0: {\tt enthalpy\_pred\_type} = {\tt predict\_rhoh}}
Here we wish to construct $(\rho h)_\mathrm{edge}$ by predicting
$(\rho h)$ to the edges directly. We use {\tt make\_edge\_scal} with
{\tt is\_conservative = .true.} on $(\rho h)$, with the underbraced term
in Eq.~\ref{rhoh equation} as the force (computed in {\tt mkrhohforce}).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 1: {\tt enthalpy\_pred\_type} = {\tt predict\_rhohprime}}
Here we wish to construct $\left [ (\rho h)_0^{n+\myhalf,{\rm avg}} + (\rho
h)'_\mathrm{edge} \right ]$ by predicting $(\rho h)'$ to the edges.
\subsubsection{Predicting $(\rho h)'$ at edges}\label{Predicting rhohprime at edges}
We define $(\rho h)' = (\rho h)^{(1)} - (\rho h)_0^n$. Then we predict
$(\rho h)'$ to edges using {\tt make\_edge\_scal} in {\tt enthalpy\_advance}
and the underbraced term in (\ref{rhohprime equation}) as the forcing (see
also table~\ref{table:pred:hforce} for the forcing term).
The first two terms in $(\rho h)'$ force are computed in
{\tt modify\_scal\_force}, and the last two terms are accounted for in
{\tt mkrhohforce}. For spherical problems, we have found that a different
representation of the pressure term in the $(\rho h)'$ force gives better
results, namely:
\begin{equation}
(\Ubt \cdot \er)\frac{\partial p_0}{\partial r} \equiv \Ubt\cdot\nabla p_0 =
\nabla\cdot(\Ubt p_0) - p_0\nabla\cdot\Ubt.
\end{equation}
\subsubsection{Predicting $(\rho h)_0$ at edges}
We use an analogous procedure described in Section \ref{Predicting
rho0 at edges} for computing $\rho_0^{n+\myhalf,\rm{avg}}$ to obtain
$(\rho h)_0^{n+\myhalf,\rm{avg}}$, i.e.,
$(\rho h)_0^{n+\myhalf,{\rm avg}} = [(\rho h)_0^{n} + (\rho h)_0^{n+1}]/2$.
For spherical, however, instead of computing $(\rho h)_0$ on edges
directly, we compute $\rho_0$ and $h_0$ separately at the edges, and
multiply to get $(\rho h)_0$.
\subsubsection{Computing $\rho h$ at edges}
We use an analogous procedure described in Section \ref{Computing rho
at edges} for computing $\rho$ at edges to compute $\rho h$ at
edges.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 2: {\tt enthalpy\_pred\_type} = {\tt predict\_h}}
Here, the construction of the interface state depends on what species
quantities are present. In all cases, the enthalpy state is found
by predicting $h$ to the edges.
For {\tt species\_pred\_types}: {\tt predict\_rhoprime\_and\_X}, we wish to construct
$(\rho_0 + \rho'_\mathrm{edge} ) h_\mathrm{edge}$.
For {\tt species\_pred\_types}: {\tt predict\_rho\_and\_X} or
{\tt predict\_rhoX}, we wish to construct $\rho_\mathrm{edge} h_\mathrm{edge}$.
\subsubsection{Predicting $h$ at edges}
We define $h = (\rho h)^{(1)}/\rho^{(1)}$. Then we predict $h$ to edges
using {\tt make\_edge\_scal} in {\tt enthalpy\_advance} and the
underbraced term in Eq.~\ref{h equation labeled} as the forcing (see
also table~\ref{table:pred:hforce}). This force is computed by
{\tt mkrhohforce} and then divided by $\rho$. Note: {\tt mkrhoforce}
knows about the different {\tt enthalpy\_pred\_type}s and computes
the correct force for this type.
\subsubsection{Computing $\rho h$ at edges}
{\tt species\_pred\_types}: {\tt predict\_rhoprime\_and\_X}:\\[1mm]
%
We use the same procedure described in Section \ref{Computing rho at
edges} for computing $\rho_\mathrm{edge}$ from $\rho_0$ and
$\rho'_\mathrm{edge}$ and then multiply by $h_\mathrm{edge}$.
\ \\
{\tt species\_pred\_types}: {\tt predict\_rhoX}:\\[1mm]
%
We already have $\sum(\rho X_k)_\mathrm{edge}$ and simply multiply by
$h_\mathrm{edge}$.
\ \\
{\tt species\_pred\_types}: {\tt predict\_rho\_and\_X}:\\[1mm]
%
We already have $\rho_\mathrm{edge}$ and simply multiply by
$h_\mathrm{edge}$.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 3: {\tt enthalpy\_pred\_type} = {\tt predict\_T\_then\_rhohprime}}
Here we wish to construct $\left [ (\rho h)_0 + (\rho
h)'_\mathrm{edge} \right ]$ by predicting $T$ to the edges and then
converting this to $(\rho h)'_\mathrm{edge}$ via the EOS.
\subsubsection{Predicting $T$ at edges}
We predict $T$ to edges using {\tt make\_edge\_scal} in {\tt
enthalpy\_advance} and the underbraced term in Eq.~\ref{T equation
labeled} as the forcing (see also table~\ref{table:pred:hforce}).
This force is computed by {\tt mktempforce}.
\subsubsection{Converting $T_\mathrm{edge}$ to $(\rho h)'_\mathrm{edge}$}
We call the EOS in {\tt makeHfromRhoT\_edge} (called from {\tt
enthalpy\_advance}) to convert from $T_\mathrm{edge}$ to $(\rho
h)'_\mathrm{edge}$. For the EOS call, we need $X_\mathrm{edge}$ and
$\rho_\mathrm{edge}$. This construction depends on {\tt
species\_pred\_type}, since the species edge states may differ
between the various prediction types (see the ``species quantity''
column in table~\ref{table:pred:hoverview}). The EOS inputs are
constructed as:
\begin{table*}[h]
\centering
\caption{EOS states in {\tt makeHfromRhoT\_edge}}
\label{table:pred:EOSinputs}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{l|c|c}
\hline
\hline
{\tt species\_pred\_type} & {$\rho$ edge state} & {$X_k$ edge state} \\
\hline
{\tt predict\_rhoprime\_and\_X} &
$\rho_0^{n+\myhalf,\rm{avg}} + \rho'_\mathrm{edge}$ &
$(X_k)_\mathrm{edge}$ \\
{\tt predict\_rhoX} &
$\sum_k (\rho X_k)_\mathrm{edge}$ &
$(\rho X_k)_\mathrm{edge}/\sum_k (\rho X_k)_\mathrm{edge}$ \\
{\tt predict\_rho\_and\_X} &
$\rho_\mathrm{edge}$ &
$(X_k)_\mathrm{edge}$ \\
\hline
\end{tabular}
\end{table*}
After calling the EOS, the output of {\tt makeHfromRhoT\_edge} is
$(\rho h)'_\mathrm{edge}$.
\subsubsection{Computing $\rho h$ at edges}
The computation of the final $(\rho h)$ edge state is done identically
as the {\tt predict\_rhohprime} version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Method 4: {\tt enthalpy\_pred\_type} = {\tt predict\_T\_then\_h}}
Here, the construction of the interface state depends on what species
quantities are present. In all cases, the enthalpy state is found by
predicting $T$ to the edges and then converting this to
$h_\mathrm{edge}$ via the EOS.
For {\tt species\_pred\_types}: {\tt predict\_rhoprime\_and\_X}, we wish to
construct $(\rho_0 + \rho'_\mathrm{edge} ) h_\mathrm{edge}$.
For {\tt species\_pred\_types}: {\tt predict\_rhoX}, we wish to
construct $\sum(\rho X_k)_\mathrm{edge} h_\mathrm{edge}$.
For {\tt species\_pred\_types}: {\tt predict\_rho\_and\_X}, we wish to
construct $\rho_\mathrm{edge} h_\mathrm{edge}$.
\subsubsection{Predicting $T$ at edges}
The prediction of $T$ to the edges is done identically as the
{\tt predict\_T\_then\_rhohprime} version.
\subsubsection{Converting $T_\mathrm{edge}$ to $h_\mathrm{edge}$}
This is identical to the {\tt predict\_T\_then\_rhohprime} version,
except that on output, we compute $h_\mathrm{edge}$.
\subsubsection{Computing $\rho h$ at edges}
The computation of the final $(\rho h)$ edge state is done identically
as the {\tt predict\_h} version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Advancing $\rho h$}
We update the enthalpy analogously to the species update in
Section \ref{Advancing rhoX_k}. The forcing term does not include reaction
source terms accounted for in {\bf React State}, and is the same
for all {\tt enthalpy\_pred\_type}s.
\begin{equation}
\frac{\partial(\rho h)}{\partial t} =
-\nabla\cdot\left\{\left \langle (\rho h) \right \rangle_\mathrm{edge}
\left(\Ubt + w_0\eb_r\right)\right\} + (\Ubt \cdot \er)\frac{\partial p_0}{\partial r} + \psi \enskip .
\end{equation}
where $\left \langle (\rho h) \right \rangle_\mathrm{edge}$ is the
edge state for $(\rho h)$ computed as listed in the final column of
table~\ref{table:pred:hoverview} for the given {\tt enthalpy\_pred\_type}
and {\tt species\_pred\_type}.
%-----------------------------------------------------------------------------
% toy_convect
%-----------------------------------------------------------------------------
\section{Experience from {\tt toy\_convect}}
\label{sec:toyconvect}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Why is {\tt toy\_convect} Interesting?}
The {\tt toy\_convect} problem consists of a carbon-oxygen white dwarf with
an accreted layer of solar composition. There is a steep composition
gradient between the white dwarf and the accreted layer. The convection
that begins as a result of the accretion is extremely sensitive to the
amount of mixing.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Initial Observations}
With {\tt use\_tfromp = T} and {\tt cflfac = 0.7} there is a large difference
between \runparam{species\_pred\_type} {\tt = 1} and {\tt species\_pred\_type = 2,3} as
seen in Figure \ref{fig:spec1_vs_23}. {\tt species\_pred\_type = 1} shows
quick heating (peak T vs. t) and there is ok agreement between {\tt tfromh}
and {\tt tfromp}. {\tt species\_pred\_type = 2,3} show cooling (peak T vs. t)
and {\tt tfromh} looks completely unphysical (see Figure
\ref{fig:tfromh_unphysical}). There are also strange filament type features in
the momentum plots shown in Figure \ref{fig:mom_filaments}.
% compare spec 1 with spec 2,3
%-----------------------------------------
\begin{figure}[!h]
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/spec1_vs_23}
\caption{Compare {\tt species\_pred\_type = 1,2,3} with {\tt use\_tfromp =
T, enthalpy\_pred\_type = 1, cflfac = 0.7}}
\label{fig:spec1_vs_23}
\end{figure}
% tfromh is unphysical
%-----------------------------------------
\begin{figure}[!h]
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/tfromh_unphysical}
\caption{{\tt tfromh} is unphysical when using {\tt species\_pred\_type =
2,3, enthalpy\_pred\_type = 1, cflfac = 0.7, use\_tfromp = T}. Shown above
is {\tt species\_pred\_type = 2}}
\label{fig:tfromh_unphysical}
\end{minipage}
\hspace{0.5cm}
% momentum filaments
%-----------------------------------------
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/mom_filaments}
\caption{There are strange filament type features at the bottom of the
domain. {\tt species\_pred\_type = 2, enthalpy\_pred\_type = 1, cflfac = 0.7,
use\_tfromp = T}}
\label{fig:mom_filaments}
\end{minipage}
\end{figure}
Using {\tt use\_tfromp = F} and \runparam{dpdt\_factor} {\tt $>$ 0} results in many runs
crashing very quickly and gives unphyiscal temperature profiles as seen in
Figure \ref{fig:tfrompF_unphys}.
% unphysical temp profiles with use_tfromp = F dpdt > 0
%-----------------------------------------
\begin{figure}[!h]
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/tfrompF_unphys}
\caption{Unphysical temperature profile with {\tt use\_tfromp = F} and
{\tt dpdt\_factor = 0.1}. {\tt dpdt\_factor = 0.2,0.3} lead to the code
crashing.}
\label{fig:tfrompF_unphys}
\end{minipage}
\hspace{0.5cm}
% temp vs time of castro ppm 0,1 and maestro spec = 2
%----------------------------------------------
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/tfrompF_cfl_1vs7}
\caption{Compare {\tt cflfac = 0.1} with {\tt cflfac = 0.7} for
{\tt use\_tfromp = F, dpdt\_factor = 0.0, species\_pred\_type = 2,
enthalpy\_pred\_type = 4}}
\label{fig:tfrompF_cfl_1vs7}
\end{minipage}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Change {\tt cflfac} and {\tt enthalpy\_pred\_type}}
With {\tt species\_pred\_type = 1} and {\tt cflfac = 0.1},
there is much less heating (peak T vs. t) than the {\tt cflfac = 0.7}
(default). There is also a lower overall Mach number (see Figure
\ref{fig:spec1_cfl_1vs7}) with the \runparam{cflfac} {\tt = 0.1} and excellent agreement
between {\tt tfromh} and {\tt tfromp}.
{\tt use\_tfromp = F, dpdt\_factor = 0.0, enthalpy\_pred\_type = 3,4 and
species\_pred\_type = 2,3} shows cooling (as seen in {\tt use\_tfromp = T})
with a comparable rate of cooling (see Figure \ref{fig:compare_tfromp})
to the {\tt use\_tfromp = T} case. The
largest difference between the two runs is that the {\tt use\_tfromp = F}
case shows excellent agreement between {\tt tfromh} and {\tt tfromp} with
{\tt cflfac = 0.7}. The filaments in the momentum plot of Figure
\ref{fig:mom_filaments} are still present.
% Mach number of cfl 0.1 vs cfl 0.7
%-----------------------------------------
\begin{figure}[!h]
\begin{minipage}[!b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/spec1_cfl_1vs7}
\caption{Comparing the Mach number of {\tt cflfac = 0.1} and
{\tt cflfac = 0.7}. {\tt species\_pred\_type = 1, enthalpy\_pred\_type = 1}}
\label{fig:spec1_cfl_1vs7}
\end{minipage}
\hspace{0.5cm}
% comparable cooling rates between tfromp = T and tfromp = F
%-----------------------------------------
\begin{minipage}[!b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/compare_tfromp}
\caption{Illustrate the comparable cooling rates between
{\tt use\_tfromp = T} and {\tt use\_tfromp = F with dpdt\_factor = 0.0}
using {\tt species\_pred\_type = 2, enthalpy\_pred\_type = 3,1}}
\label{fig:compare_tfromp}
\end{minipage}
\end{figure}
For a given {\tt enthalpy\_pred\_type} and {\tt use\_tfromp = F},
{\tt species\_pred\_type = 2} has a lower Mach number (vs. t) compared to
{\tt species\_pred\_type = 3}.
Any {\tt species\_pred\_type} with {\tt use\_tfromp = F, dpdt\_factor = 0.0}
and {\tt enthalpy\_pred\_type = 1} shows significant heating, although
the onset of the heating is delayed in {\tt species\_pred\_type = 2,3} (see
Figure \ref{fig:compare_tF_d0_h1_s123}). Only
{\tt species\_pred\_type = 1} gives good agreement between {\tt tfromh} and
{\tt tfromp}.
Comparing {\tt cflfac = 0.7} and {\tt cflfac = 0.1} with
{\tt use\_tfromp = F, dpdt\_factor = 0.0, species\_pred\_type = 2} and
{\tt enthalpy\_pred\_type = 4} shows good agreement overall (see Figure
\ref{fig:tfrompF_cfl_1vs7}).
% compare tfromp=F%, dpdt=0, h=1, spec=1,2,3
%-----------------------------------------
\begin{figure}[!h]
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/compare_tF_d0_h1_s123}
\caption{Compare various {\tt species\_pred\_type} with {\tt use\_tfromp = F,
dpdt\_factor = 0.0, enthalpy\_pred\_type = 1}}
\label{fig:compare_tF_d0_h1_s123}
\end{minipage}
\hspace{0.5cm}
% compare tfromp=F,dpdt=0,spec=2,h=4, cfl=0.1,0.7
%-----------------------------------------
\begin{minipage}[b]{0.5\linewidth}
\vspace{0pt}
\centering
\includegraphics[height=0.3\textheight]{\pertfigpath/compare_castro}
\caption{Compare the {\tt castro.ppm\_type CASTRO} runs with the
{\tt species\_pred\_type MAESTRO} runs.}
\label{fig:compare_castro}
\end{minipage}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Additional Runs}
\subsubsection{{\tt bds\_type = 1}}
Using \runparam{bds\_type} {\tt = 1, use\_tfromp = F, dpdt\_factor = 0.0,
species\_pred\_type = 2, enthalpy\_pred\_type = 4} and
{\tt cflfac = 0.7} seems to cool off faster, perhaps due to less mixing.
There is also no momentum filaments in the bottom of the domain.
\subsubsection{{\tt evolve\_base\_state = F}}
Using \runparam{evolve\_base\_state} {\tt = F, use\_tfromp = F, dpdt\_factor = 0.0,
species\_pred\_type = 2} and {\tt enthalpy\_pred\_type = 4} seems to agree
well with the normal {\tt evolve\_base\_state = T} run.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{{\tt toy\_convect} in {\tt CASTRO}}
{\tt toy\_convect} was also run using {\tt CASTRO} with
{\tt castro.ppm\_type = 0,1}. These runs show temperatures that cool
off rather than increase (see Figure \ref{fig:compare_castro}) which
suggests using {\tt species\_pred\_type = 2,3} instead of
{\tt species\_pred\_type = 1}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Recommendations}
All of these runs suggest that running under {\tt species\_pred\_type =
2 or 3, enthalpy\_pred\_type = 3 or 4} with either {{\tt use\_tfromp = F} and
{\tt dpdt\_factor = 0.0}} or {\tt use\_tfromp = T} gives the most
consistent results.
| {
"alphanum_fraction": 0.6500664664,
"avg_line_length": 41.366598778,
"ext": "tex",
"hexsha": "c6fb313a15cfda9836411c31fd2bca6c7da629a0",
"lang": "TeX",
"max_forks_count": 14,
"max_forks_repo_forks_event_max_datetime": "2021-05-04T07:16:09.000Z",
"max_forks_repo_forks_event_min_datetime": "2017-06-14T14:52:09.000Z",
"max_forks_repo_head_hexsha": "f957d148d2028324a2a1076be244f73dad63fd67",
"max_forks_repo_licenses": [
"BSD-3-Clause-LBNL"
],
"max_forks_repo_name": "sailoridy/MAESTRO",
"max_forks_repo_path": "Docs/pert_notes/pert.tex",
"max_issues_count": 17,
"max_issues_repo_head_hexsha": "f957d148d2028324a2a1076be244f73dad63fd67",
"max_issues_repo_issues_event_max_datetime": "2018-11-28T16:40:42.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-06-14T23:05:00.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause-LBNL"
],
"max_issues_repo_name": "sailoridy/MAESTRO",
"max_issues_repo_path": "Docs/pert_notes/pert.tex",
"max_line_length": 147,
"max_stars_count": 17,
"max_stars_repo_head_hexsha": "f957d148d2028324a2a1076be244f73dad63fd67",
"max_stars_repo_licenses": [
"BSD-3-Clause-LBNL"
],
"max_stars_repo_name": "sailoridy/MAESTRO",
"max_stars_repo_path": "Docs/pert_notes/pert.tex",
"max_stars_repo_stars_event_max_datetime": "2021-07-09T08:13:32.000Z",
"max_stars_repo_stars_event_min_datetime": "2017-05-15T15:28:56.000Z",
"num_tokens": 13441,
"size": 40622
} |
\chapter{Good behaviour inside math mode}
\section{Using the right commands and symbols}
\subsection{General symbols}
\index{symbols}
Use the correct symbols.
\Cref{wrong symbol list} shows some popular sources of this problem.
\begin{table}[tb]
\begin{center}
\begin{tabular}{@{}lllll@{}}
\toprule
\theading{symbol}
&
\multicolumn{2}{c}{\theading{right commands}}
&
\multicolumn{2}{c}{\theading{wrong commands}}
\\
\midrule
element relation
&
\comname{in}%
\massindex{in}[\comname]
&
$\in$
&
\comname{epsilon}%
\massindex{epsilon}[\comname]
&
$\epsilon$
\\
{}
&
{}
&
{}
&
\comname{varepsilon}%
\massindex{varepsilon}[\comname]
&
$\varepsilon$
\\
{}
&
\comname{ni}%
\massindex{ni}[\comname]
&
$\ni$
&
\comname{backepsilon}%
\massindex{backepsilon}[\comname]
&
$\backepsilon$
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
empty set
&
\comname{emptyset}%
\massindex{emptyset}[\comname]
&
$\emptyset$
&
\comname{phi}%
\massindex{phi}[\comname]
&
$\phi$
\\
{}
&
\comname{varnothing}%
\massindex{varnothing}[\comname]
&
$\varnothing$
&
{}
&
{}
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
set difference
&
\inlinecode{A {\tbs}setminus B}%
\massindex{setminus}[\comname]
&
$A \setminus B$
&
\inlinecode{A {\tbs}backslash B}%
\massindex{backslash}[\comname]
&
$A \backslash B$
\\
{}
&
\inlinecode{A {\tbs}smallsetminus B}%
\massindex{smallsetminus}[\comname]
&
$A \smallsetminus B$
&
{}
&
{}
\\
{}
&
\inlinecode{A - B}\index{minus sign}
&
$A - B$
&
{}
&
{}
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
implication
&
\comname{implies}%
\massindex{implies}[\comname]
&
$\implies$
&
\comname{Rightarrow}%
\massindex[arrows]{Rightarrow}[\comname]
&
$\Rightarrow$
\\
{}
&
{}
&
{}
&
\inlinecode{=>}
&
$=>$
\\
{}
&
\comname{impliedby}%
\massindex{impliedby}[\comname]
&
$\impliedby$
&
\comname{Leftarrow}%
\massindex[arrows]{Leftarrow}[\comname]
&
$\Leftarrow$
\\
{}
&
{}
&
{}
&
\inlinecode{<=}
&
$<=$
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
equivalence
&
\comname{iff}%
\massindex{iff}[\comname]
&
$\iff$
&
\comname{Leftrightarrow}%
\massindex[arrows]{Leftrightarrow}[\comname]
&
$\Leftrightarrow$
\\
{}
&
{}
&
{}
&
\inlinecode{<=>}
&
<=>
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
definition
&
\comname{coloneqq}%
\massindex{coloneqq}[\comname]
&
$\coloneqq$
&
\inlinecode{:=}
&
$:=$
\\
{}
&
\comname{eqqcolon}%
\massindex{eqqcolon}[\comname]
&
$\eqqcolon$
&
\inlinecode{=:}
&
$=:$
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
norm
&
\inlinecode{{\tbs}| x {\tbs}|}%
\massindex[delimiters]{\indexline}[\comname]
&
$\| x \|$
&
\inlinecode{|| x ||}
&
$|| x ||$
\\
{}
&
\inlinecode{{\tbs}lVert x {\tbs}rVert}%
\massindex[delimiters]{lVert}[\comname]%
\massindex[delimiters]{rVert}[\comname]
&
{}
&
{}
&
{}
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
pointy brackets
&
\inlinecode{{\tbs}langle x {\tbs}rangle}%
\massindex[delimiters]{langle}[\comname]%
\massindex[delimiters]{rangle}[\comname]
&
$\langle x \rangle$
&
\inlinecode{< x >}
&
$< x >$
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
infinity
&
\comname{infty}%
\massindex{infty}[\comname]
&
$\infty$
&
\inlinecode{oo}
&
$oo$
\\
\cmidrule(lr){2-3} \cmidrule(l){4-5}
function colon
&
\inlinecode{f {\tbs}colon X {\tbs}to Y}%
\massindex{colon}[\comname]%
\massindex{ni}[\comname]
&
$f \colon X \to Y$
&
\inlinecode{f : X {\tbs}to Y}
&
$f : X \to Y$
\\
\bottomrule
\end{tabular}
\end{center}
\caption{Right symbols and wrong symbols.}
\label{wrong symbol list}
\end{table}
Note that the commands~\comname{rightarrow}\massindex[arrows]{rightarrow}[\comname] and~\comname{to}\massindex[arrows]{to}[\comname] give the same arrow.
So use whichever is more appropriate in the given situation.
\subsection{Operations}
Many mathematical operations have both a binary version and an operator version, where the operation can range over some index set.
One should not confuse the two of them.
\Cref{binary vs operator} shows some popular binary operations and their operator counterpart.
\begin{table}[tb]
\begin{center}
\begingroup
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{@{}llclc@{}}
\toprule
\theading{operation}
&
\multicolumn{2}{c}{\theading{binary}}
&
\multicolumn{2}{c}{\theading{generalized}}
\\
\cmidrule(lr){2-3}
\cmidrule(l){4-5}
sum
&
\inlinecode{+}
&
$a + b$
&
\comname{sum}
&
$\sum_i x_i$
\\
multiplication
&
\comname{cdot}
&
$a \cdot b$
&
\comname{prod}
&
$\prod_i x_i$
\\
direct sum
&
\comname{oplus}
&
$A \oplus B$
&
\comname{bigoplus}
&
$\bigoplus_i X_i$
\\
tensor product
&
\comname{otimes}
&
$A \otimes B$
&
\comname{bigotimes}
&
$\bigotimes_i X_i$
\\
wedge
&
\comname{wedge}
&
$a \wedge b$
&
\comname{bigwedge}
&
$\bigwedge_i X_i$
\\
union
&
\comname{cup}
&
$A \cup B$
&
\comname{bigcup}
&
$\bigcup_i X_i$
\\
intersection
&
\comname{cap}
&
$A \cap B$
&
\comname{bigcap}
&
$\bigcap_i X_i$
\\
product
&
\comname{times}
&
$A \times B$
&
\comname{prod}
&
$\prod_i X_i$
\\
{}
&
\comname{sqcap}
&
$A \sqcap B$
&
\comname{bigsqcap}
&
$\bigsqcap_i X_i$
\\
coproduct
&
\comname{amalg}
&
$A \amalg B$
&
\comname{coprod}
&
$\coprod_i X_i$
\\
{}
&
\comname{sqcup}
&
$A \sqcup B$
&
\comname{bigsqcup}
&
$\bigsqcup_i X_i$
\\
\bottomrule
\end{tabular}
\endgroup
\end{center}
\caption{Binary operation and operator version.}
\label{binary vs operator}
\end{table}
The command \comname{bigsqcap} requires the package \packname{stmaryrd}.
\subsection{Negations}
For some mathematical symbols there also exists a negated version, which is formed by diagonal line through the symbol.
A general way of introducing such a line is the command \comname{not}\massindex[negation]{not}[\comname].
\begin{showlatex}*{Using \comname{not}}
It follows that $A \not\ni x$.
\end{showlatex}
But in practice this command should seldom be used, as it often produces very bad looking output.
Consider the following example:
\begin{showlatex}{Why not to use \comname{not}}
Hence $A \not\implies B$.
\end{showlatex}
There are two solutions to this problem:
Many symbols already have a predefined lined-out version available.
A few of them are collected in~\cref{negation list}.
\begin{table}[tb]
\begin{center}
\begin{tabular}{@{}lclc@{}}
\toprule
\multicolumn{2}{c}{\theading{right}}
&
\multicolumn{2}{c}{\theading{wrong}}
\\
\cmidrule(r){1-2} \cmidrule(l){3-4}
\comname{notin}%
\massindex[negation]{notin}[\comname]
&
$\notin$
&
\inlinecode{{\tbs}not{\tbs}in}
&
$\not\in$
\\
\comname{nexists}%
\massindex[negation]{nexists}[\comname]
&
$\nexists$
&
\inlinecode{{\tbs}not{\tbs}exists}
&
$\not\exists$
\\
\comname{neq}%
\massindex[negation]{neq}[\comname]
&
$\neq$
&
\inlinecode{{\tbs}not =}
&
$\not =$
\\
\comname{nleq}%
\massindex[negation]{nleq}[\comname]
&
$\nleq$
&
\inlinecode{{\tbs}not{\tbs}leq}
&
$\not\leq$
\\
\comname{nrightarrow}%
\massindex[negation,arrows]{notrightarrow}[\comname]
&
$\nrightarrow$
&
\inlinecode{{\tbs}not{\tbs}rightarrow}
&
$\not\rightarrow$
\\
\bottomrule
\end{tabular}
\end{center}
\caption{Negated versions of popular symbols.}
\label{negation list}
\end{table}
If the required symbol is not predefined then the command~\comname{centernot}\massindex[negation]{centernot}[\comname] from the package~\packname{centernot}\massindex[packages]{centernot}[\packname] often produces better looking output than~\comname{not}:
\begin{showlatex}{Using the command~\comname{centernot}}
Consider
\[
A \centernot\ni x
\quad\text{versus}\quad
\quad
A \not\ni x \,.
\]
Consider also
\[
A \centernot\implies B
\quad\text{versus}\quad
A \not\implies B \,.
\]
\end{showlatex}
\subsection{Don’t use \comtitle{limits}}
People seem to think that they have to put \comname{limits}\massindex[limits]{limits}[\comname] after a command to add limits to it:
\begin{showlatex}*{Using~\comname{limits}}
\[
\sum\limits_{k=1}^n k
=
\frac{n(n+1)}{2}
\]
\end{showlatex}
But this is not only unnecessary, but also dangerous.
It is unnecessary because (most of) the commands in questions already have this functionality built in:
\begin{showlatex}*{Using built-in limits}
\[
\sum_{k=1}^n k
=
\frac{n(n+1)}{2}
\]
\end{showlatex}
These built-in limits have the advantage that they can distinguish between inline math and display math:
\begin{showlatex}*{Inline math vs.\ display math with built-in limits}
The sum $\sum_{k=0}^n 2^k = 2^{n+1} - 1$ is inline while the sum
\[
\sum_{k=0}^n 3^k
\neq
3^{n+1} - 1
\]
is in display mode.
\end{showlatex}
We can see that the inline version does not only use the smaller summation sign but also sets the limits to the right of the summation sign.
This is a feature which \comname{limits} version is missing:
\begin{showlatex}*{Inline math with~\comname{limits}}
So here is some text which will generate some lines.
The text itself isn’t important, but we really want it to fill some lines.
The important thing is the sum $\sum\limits_{k=0}^n k$.
Well, not really the sum itself, but the use of \texttt{{\textbackslash}limits} for typesetting it.
\end{showlatex}
The limits are still placed above the top and below the summation sign.
This has its price:
The line in which the sum resides breaks the usual vertical space between lines, which gives the text an inconsistent and unorganized look.
Compare this to the version without \comname{limits}:
\begin{showlatex}*{Inline with built-in limits}
So here is some text which will generate some lines.
The text itself isn’t important, but we really want it to fill some lines.
The important thing is the sum $\sum_{k=0}^n k$.
Well, not really the sum itself, but use of built-in limits for typesetting it.
\end{showlatex}
Here the line distance is nicely consistent and pleasing to the eye.
The usual predefined commands on which one would expect limits already have them defined, e.g.\ \comname{sum}, \comname{prod} or \comname{lim}, as the following example shows:
\begin{showlatex}{Inline vs.\ display for different commands with built-in limits}
Compare the inline versions $\sum_{k=0}^n k$ and $\prod_{k=1}^n k$ and $\lim_{n \to \infty} a_n$ with the display versions
\[
\sum_{k=0}^n k \,,
\quad
\prod_{k=1}^n k \,,
\quad
\lim_{n \to \infty} a_n \,.
\]
\end{showlatex}
If a new commands are defined with~\comname{DeclareMathOperator}\massindex[defining commands]{DeclareMathOperator}[\comname] or~\comname{operatorname}\massindex[defining commands]{operatorname}[\comname] then one can make them support limits by using \comname{DeclareMathOperator*}\massindex[defining commands, limits]{DeclareMathOperator*}[\comname] and \comname{operatorname*}\massindex[defining commands, limits]{operatorname*}[\comname] instead.
Suppose for example that we have made in the preamble the following definition:
\begin{showcode}{Using \comname{DeclareMathOperator*} to define~\comname{colim}}
\DeclareMathOperator*{\colim}{colim}
\end{showcode}
We can then do the following:
\begin{showlatex}{Using~\comname{colim}}
Inline we have $\colim_{X' \leq X} F(X')$ and in display mode we get
\[
\colim_{X' \leq X} F(X') \,.
\]
\end{showlatex}
The command~\comname{operatorname*} was named~\comname{operatornamewithlimits} in the past, but this name is deprecated.
% If for some extremly strange reason one \emph{really} needs the limits to be in display style, then one should commit to it by using \comname{displaystyle}.
% Consider the following example:
% \begin{showlatex}{Forcing displaystyle with \comname{displaystyle}}
% \[
% \begin{pmatrix}
% \frac{n^2+1}{n^2 + 2}
% &
% \frac{n^2+2}{n^2 + 3}
% \\
% \frac{n^2+2}{n^2 + 3}
% &
% \frac{n^2+3}{n^2 + 4}
% \end{pmatrix}
% =
% \begin{pmatrix}
% \displaystyle
% \frac{n^2+1}{n^2 + 2}
% &
% \displaystyle
% \frac{n^2+2}{n^2 + 3}
% \\[1.5em]
% \displaystyle
% \frac{n^2+2}{n^2 + 3}
% &
% \displaystyle
% \frac{n^2+3}{n^2 + 4}
% \end{pmatrix}
% \]
% \end{showlatex}
% In the above example we have put~\comname{displaystyle} before every matrix entry to ensure that it has the usual style of display mathematics.
% We have also put replaced the basic line break~\comname{\tbs} by~\inlinecode{{\tbs}{\tbs}[1.5em]} for some additional spacing between the two rows of the resulting matrix.
% (Otherwise the fractions are far too close.)
\subsection{Use extensible arrows instead of \comtitle{overset} and \comtitle{underset}}
\label{extensible arrows}
Some people put text above or under arrows by wrongly using the commands~\comname{overset}\massindex{overset}[\comname] or \comname{underset}\massindex{underset}[\comname]:
\begin{showlatex}{Using~\comname{overset} and~\comname{underset} to put text above or below an arrow}
\[
X
\overset{f}{\longrightarrow}
Y
\underset{g \circ h \circ k}{\longrightarrow}
Z
\]
\end{showlatex}
We can see above that the length of the arrow does not adjust to the size of the text above it or below it.
The proper way to put text on top of an arrow or bellow an arrow of the form~\enquote{$\to$} is therefore the command~\comname{xrightarrow}\massindex[arrows]{xrightarrow}[\comname]:
\begin{showlatex}{Using~\comname{xrightarrow} to put text above or below an arrow}
\[
X
\xrightarrow{f}
Y
\xrightarrow[g \circ h \circ k]{}
Z \,.
\]
\end{showlatex}
The package~\packname{amsmath}\massindex[packages]{amsmath}[\packname] defines only the two most basic extensible arrows\index{extensible arrows}\index{arrows!extensible}.
Many more kinds of extensible arrows are provided by the package~\packname{mathtools}\massindex[packages]{mathtools}[\packname] and some more are contained in the package~\packname{extarrows}\massindex[packages]{extarrows}[\packname].
An overview of the various kinds of extensible arrows can be found in \cref{extensible arrow table}.
\begin{table}[tb]
\begin{center}
\begingroup
\renewcommand{\arraystretch}{0.9}
\begin{tabular}{@{}lccc@{}}
\toprule
\packname{amsmath}
&
\begin{tabular}{@{}c@{}}
$A \xrightarrow{f} B$
\\
\comname{xrightarrow}%
\massindex[arrows]{xrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xleftarrow{f} B$
\\
\comname{xleftarrow}%
\massindex[arrows]{xleftarrow}[\comname]
\end{tabular}
&
{}
\\[1.5em]
% \midrule
\packname{mathtools}
&
\begin{tabular}{@{}c@{}}
$A \xmapsto{f} B$
\\
\comname{xmapsto}%
\massindex[arrows]{xmapsto}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xleftrightarrow{f} B$
\\
\comname{xleftrightarrow}%
\massindex[arrows]{xleftrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xRightarrow{f} B$
\\
\comname{xRightarrow}%
\massindex[arrows]{xRightarrow}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xLeftarrow{f} B$
\\
\comname{xLeftarrow}%
\massindex[arrows]{xLeftarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xLeftrightarrow{f} B$
\\
\comname{xLeftrightarrow}%
\massindex[arrows]{xLeftrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xhookleftarrow{f} B$
\\
\comname{xhookleftarrow}%
\massindex[arrows]{xhookleftarrow}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xhookrightarrow{f} B$
\\
\comname{xhookrightarrow}%
\massindex[arrows]{xhookrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xrightharpoondown{f} B$
\\
\comname{xrightharpoondown}%
\massindex[arrows]{xrightharpoondown}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xrightharpoonup{f} B$
\\
\comname{xrightharpoonup}%
\massindex[arrows]{xrightharpoonup}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xrightleftharpoons{f} B$
\\
\comname{xrightleftharpoons}%
\massindex[arrows]{xrightleftharpoons}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xleftharpoondown{f} B$
\\
\comname{xleftharpoondown}%
\massindex[arrows]{xleftharpoondown}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xleftharpoonup{f} B$
\\
\comname{xleftharpoonup}%
\massindex[arrows]{xleftharpoonup}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xleftrightharpoons{f} B$
\\
\comname{xleftrightharpoons}%
\massindex[arrows]{xleftrightharpoons}[\comname]
\end{tabular}
&
{}
&
{}
\\[1.5em]
% \midrule
\packname{extarrows}
&
\begin{tabular}{@{}c@{}}
$A \xlongequal{f} B$
\\
\comname{xlongequal}%
\massindex[arrows]{xlongequal}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xleftrightarrow{f} B$
\\
\comname{xleftrightarrow}%
\massindex[arrows]{xleftrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xLeftrightarrow{f} B$
\\
\comname{xLeftrightarrow}%
\massindex[arrows]{xLeftrightarrow}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xlongleftarrow{f} B$
\\
\comname{xlongleftarrow}%
\massindex[arrows]{xlongleftarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xlongrightarrow{f} B$
\\
\comname{xlongrightarrow}%
\massindex[arrows]{xlongrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xlongleftrightarrow{f} B$
\\
\comname{xlongleftrightarrow}%
\massindex[arrows]{xlongleftrightarrow}[\comname]
\end{tabular}
\\[1.5em]
{}
&
\begin{tabular}{@{}c@{}}
$A \xLongleftarrow{f} B$
\\
\comname{xLongleftarrow}%
\massindex[arrows]{xLongleftarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xLongrightarrow{f} B$
\\
\comname{xLongrightarrow}%
\massindex[arrows]{xLongrightarrow}[\comname]
\end{tabular}
&
\begin{tabular}{@{}c@{}}
$A \xLongleftrightarrow{f} B$
\\
\comname{xLongleftrightarrow}%
\massindex[arrows]{xLongrightarrow}[\comname]
\end{tabular}
\\
\bottomrule
\end{tabular}
\endgroup
\end{center}
\caption{Extensible arrows in \packname{amsmath}, \packname{mathtools} and \packname{extarrows}.}
\label{extensible arrow table}
\end{table}
The author recommends to define custom commands as shortcuts for the most used arrows.
\begin{showlatex}{Defining arrow commands as shortcuts}
\newcommand{\xto}{\xrightarrow}
\newcommand{\xlongto}[1]{\xlongrightarrow{\;#1\;}}
The function $A \xto{f} B$ is the same as
\[
A \xlongto{f} B \,.
\]
\end{showlatex}
% TODO: Defining new kind of stretchable arrows
\subsection{Know your ellipses}
\index{dots!zzzz@\igobble |see {ellipsis}}
\index{ellipses|(}
An ellipsis\index{ellipses} should \emph{never} by written as~\inlinecode{...} (three single dots).
{\LaTeX} instead provides different kinds of ellipses to use in math mode, namely
\begin{center}
\comname{dotsb},
\quad
\comname{dotsc},
\quad
\comname{dotsm},
\quad
\comname{dotsi},
\quad
\comname{dotso},
\\
\comname{cdots},
\quad
\comname{ddots},
\quad
\comname{vdots},
\quad
\comname{ldots}.
\end{center}
Each of these have they own role and (mostly) distinct look and feel.
There are two groups of ellipses.
The first group consists of \comname{dotsb}, \comname{dotsc}, \comname{dotsm}, \comname{dotsi},\comname{dotso}, whereas the second group consists of \comname{cdots}, \comname{ddots}, \comname{vdots}, \comname{ldots}.
The ellipses in the first group are named after their function, see \cref{ellipses with function}.
\begin{table}[tb]
\begin{center}
\begingroup
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{@{}lll@{}}
\toprule
%
\theading{command}
&
\theading{where to use}
&
\theading{example}
\\
\midrule
%
\comname{dotsb}%
\massindex[ellipses]{dotsb}[\comname]
&
between binary relations
&
$x_1 \leq \dotsb \leq x_n$
\\
{}
&
and binary operations
&
$x_1 + \dotsb + x_n$
\\
\comname{dotsc}%
\massindex[ellipses]{dotsc}[\comname]
&
between commas
&
$x_1, \dotsc, x_n$
\\
\comname{dotsm}%
\massindex[ellipses]{dotsm}[\comname]
&
abbreviating multiplication
&
$x_1 \dotsm x_n$
\\
\comname{dotsi}%
\massindex[ellipses]{dotsi}[\comname]
&
iterated integrals\index{integral}
&
$\int_{X_1} \dotsi \int_{X_n}$
\\
\comname{dotso}%
\massindex[ellipses]{dotso}[\comname]
&
others
&
{}
\\
\bottomrule
\end{tabular}
\endgroup
\end{center}
\caption{Ellipses with a specific functions.}
\label{ellipses with function}
\end{table}
Note that the members of this group all have names of the form \comname{dots*}, where \optname{*} is a letter that specifies the semantic use of the ellipsis.
The ellipses in the second group are not named after their function but after their orientation, see \cref{ellipses with orientation}
\begin{table}[tb]
\begin{center}
\begingroup
\renewcommand{\arraystretch}{1.3}
\begin{tabular}{@{}llc@{}}
\toprule
%
\theading{command}
&
\theading{description}
&
\theading{look}
\\
\midrule
%
\comname{cdots}%
\massindex[ellipses]{cdots}[\comname]
&
Horizontal dots, vertically centered.
&
$\cdots$
\\
\comname{ddots}%
\massindex[ellipses]{ddots}[\comname]
&
Diagonal dots.
&
$\ddots$
\\
\comname{vdots}%
\massindex[ellipses]{vdots}[\comname]
&
Vertical dots, horizontally centered.
&
$\vdots$
\\
\comname{ldots}%
\massindex[ellipses]{ldots}[\comname]
&
Lowered dots.
&
$\ldots$
% making this line as high as the others
\vphantom{$\vdots$}
\\
\bottomrule
\end{tabular}
\endgroup
\end{center}
\caption{Ellipses with a specific orientation.}
\label{ellipses with orientation}
\end{table}
The ellipses~\comname{cdots},~\comname{ddots} and~\comname{vdots} are typically used in matrices.
\begin{showlatex}{Typical usage of the ellipses~\comname{cdots},~\comname{vdots},~\comname{ddots}}
\[
\begin{pmatrix}
a_{11} & \cdots & a_{1n} \\
\vdots & \ddots & \vdots \\
a_{n1} & \cdots & a_{nn}
\end{pmatrix}
\]
\end{showlatex}
The command~\comname{ldots} may be used to denote left out digits or symbols.
\begin{showlatex}{Using the ellipsis~\comname{ldots}}
We find that
\[
x = 0.1234567891011\ldots
\]
Consider the word $w = a_1 \ldots a_n$ where $a_1, \dotsc, a_n$ are letters in an alphabet $\Sigma$.
\end{showlatex}
Note that the members of this second group of dots all have names of the form~\comname{*dots}, where~\optname{*} is a letter that specified the positioning of these dots.
% The following should \emph{never} be used to denote a product:
% \begin{showcode}{Wrong way of abbreviating multiplication~I}
% x_1 \cdot {any kind of dots} \cdot x_n
% \end{showcode}
% So all of the following are \emph{wrong}, and some of them look even worse then the other ones.
% \begin{showlatex}*{Wrong way of abbreviating multiplication~II}
% \begin{gather*}
% x_1 \cdot \dotsb \cdot x_n \\
% x_1 \cdot \dotsc \cdot x_n \\
% x_1 \cdot \dotsm \cdot x_n \\
% x_1 \cdot \dotsi \cdot x_n \\
% x_1 \cdot \cdots \cdot x_n \\
% x_1 \cdot \ldots \cdot x_n
% \end{gather*}
% \end{showlatex}
% (The author hopes that nobody is stupid enough to even trying using \comname{ddots} or \comname{vdots} in this situation.)
So overall one should use the ellipses~\comname{cdots}, \comname{ddots} and \comname{vdots} for matrices, and otherwise the ellipses~\comname{dotsb}, \comname{dotsc}, \comname{dotsm}, \comname{dotsi} and occasionally \comname{dotso}.
There also exists the generic command~\comname{dots}\massindex[ellipses]{dots}[\comname] which tries to automagically use the right kind of positioning and spacing.
But the author recommends not using this command as it can lead to inconsistent results:
\begin{showlatex}{Inconsistent results with \comname{dots}}
The ellipses in $x_1 \leq x_2 \leq \dots \leq x_n$ and $y_1 \leq y_2 \leq \dots$ should look the same.
\end{showlatex}
\index{ellipses|)}
\subsection{Know your matrices}
\index{matrices|(}
The package~\packname{amsmath}\massindex[packages]{amsmath}[\packname] provides various environments for matrices, the most basic of which is the environment~\envname{matrix}\massindex[matrices!normal sized]{matrix}[\envname].
\begin{showlatex}*{The basic matrix environment~\envname{matrix}}
\[
\begin{matrix}
a & b \\
c & d
\end{matrix}
\]
\end{showlatex}
There are five more variants of this basic matrix environment, that put different delimiters around the matrix.
The package~\packname{mathtools}\massindex[packages]{mathtools}[\packname] also provides small versions of all six kinds of matrices.
See \cref{table of matrices} for a table of all these kinds of matrices.
\begin{table}
\begin{center}
\begin{tabular}{@{}lccc@{}}
\toprule
%
\theading{size}
&
\multicolumn{3}{c}{\theading{matrices}}
\\
\midrule
%
normal
&
\begin{tabular}{c}
$\begin{matrix} a & b \\ c & d \end{matrix}$ \\
\envname{matrix}%
\massindex[matrices!normal sized]{matrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ \\
\envname{pmatrix}%
\massindex[matrices!normal sized]{pmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$ \\
\envname{bmatrix}%
\massindex[matrices!normal sized]{bmatrix}[\envname]
\end{tabular}
\\[2.5em]
{}
&
\begin{tabular}{c}
$\begin{Bmatrix} a & b \\ c & d \end{Bmatrix}$ \\
\envname{Bmatrix}%
\massindex[matrices!normal sized]{Bmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{vmatrix} a & b \\ c & d \end{vmatrix}$ \\
\envname{vmatrix}%
\massindex[matrices!normal sized]{vmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{Vmatrix} a & b \\ c & d \end{Vmatrix}$ \\
\envname{Vmatrix}%
\massindex[matrices!normal sized]{Vmatrix}[\envname]
\end{tabular}
\\[2.5em]
small
&
\begin{tabular}{c}
$\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}$ \\
\envname{smallmatrix}%
\massindex[matrices!small sized]{smallmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{psmallmatrix} a & b \\ c & d \end{psmallmatrix}$ \\
\envname{psmallmatrix}%
\massindex[matrices!small sized]{psmallmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{bsmallmatrix} a & b \\ c & d \end{bsmallmatrix}$ \\
\envname{bsmallmatrix}%
\massindex[matrices!small sized]{bsmallmatrix}[\envname]
\end{tabular}
\\[2.5em]
{}
&
\begin{tabular}{c}
$\begin{Bsmallmatrix} a & b \\ c & d \end{Bsmallmatrix}$ \\
\envname{Bsmallmatrix}%
\massindex[matrices!small sized]{Bsmallmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{vsmallmatrix} a & b \\ c & d \end{vsmallmatrix}$ \\
\envname{vsmallmatrix}%
\massindex[matrices!small sized]{vsmallmatrix}[\envname]
\end{tabular}
&
\begin{tabular}{c}
$\begin{Vsmallmatrix} a & b \\ c & d \end{Vsmallmatrix}$ \\
\envname{Vsmallmatrix}%
\massindex[matrices!small sized]{Vsmallmatrix}[\envname]
\end{tabular}
\\
\bottomrule
\end{tabular}
\end{center}
\caption{Different kinds of matrices.}
\label{table of matrices}
\end{table}
The package~\packname{mathtools}\massindex[packages]{mathtools}[\packname] also provides starred versions of the matrices.
These starred versions allow to specify as an optional argument the alignment of the columns, see \cref{table of matrices}.
The three possible arguments are~\optname{l}\massindex{l}[\optname] for left-alignment,~\optname{c}\massindex{c}[\optname] for centered alignment and~\optname{r}\massindex{r}[\optname] for right-alignment.
The standard alignment is~\optname{c}.
\begin{showlatex}{Aligning matrix entries}
\[
\begin{bmatrix*}[l]
a & -b \\
-c & d
\end{bmatrix*}
\qquad
\begin{bmatrix*}[c]
a & -b \\
-c & d
\end{bmatrix*}
\qquad
\begin{bmatrix*}[r]
a & -b \\
-c & d
\end{bmatrix*}
\qquad
\begin{bmatrix}
a & -b \\
-c & d
\end{bmatrix}
\]
\end{showlatex}
One should choose the kind of matrix, its size and alignment dependent on convention, usage and the matrix entries.
\begin{showlatex}*{Using the right kind of matrix}
We consider the morphism
\[
X \oplus Y
\xrightarrow{\,
\begin{bsmallmatrix*}[r]
f & -d \\
0 & g
\end{bsmallmatrix*}
\,
}
X' \oplus Y' \,.
\]
\end{showlatex}
\index{matrices|)}
\section{Avoid bad notation}
\subsection{Don’t use \comtitle{subset}}
Some people use~$\subset$~(\comname{subset}\massindex{subset}[\comname]) to denote inclusion and~$\subsetneq$~(\comname{subsetneq}\massindex{subsetneq}[\comname]) to denote proper inclusion, while some other people use~$\subseteq$~(\comname{subseteq}\massindex{subseteq}[\comname]) to denote inclusion and~$\subset$ to denote proper inclusion.
The second convention has the advantage of making sense and being consistent with the usual use of~$\leq$ and~$<$, whereas the first convention has the non-advantage of existing.
The problem is that both conventions are wide-spread while using the symbol~$\subset$ is different ways.
The conflict between the above two conventions has abused the symbol~$\subset$ to a point that it should \emph{never} be used.
Instead one should always use~$\subseteq$ for inclusion, $\subsetneq$ for proper inclusion and~$\nsubseteq$~(\comname{nsubseteq}\massindex{nsubseteq}[\comname]) for non-inclusion.
Some people prefer the symbols~$\subseteqq$~(\comname{subseteqq}\massindex{subseteqq}[\comname]) and~$\subsetneqq$~(\comname{subsetneqq}\massindex{subsetneqq}[\comname]) instead.
The author thinks that these symbols are unnecessary large and recommends not to use them.
(But they do at least leave poor old~$\subset$ alone.)
\subsection{Don’t underline}
\index{underlining}
Underlining works well on the blackboard, in handwriting, and was useful in the in the (dark) age of typewriters.
Don’t do it in {\LaTeX}.
\subsection{Use \texorpdfstring{$\mathrm{d}x$}{dx} instead of \texorpdfstring{$dx$}{dx}}
A differential\index{differential} is written as \inlinecode{{\tbs}mathrm\{d\}x}, not as \inlinecode{dx}.
When it occurs at the end of an integral\index{integral} then a slight spacing~\comname{,}\index{spacing!in math mode} is also introduced in front of it.
So don’t do the following:
\begin{showlatex}*{Wrong kind of differentials}
\[
\int_a^b f(x) dx
\]
\end{showlatex}
Instead do the following:
\begin{showlatex}*{Right kind of differential}
\[
\int_a^b f(x) \,\mathrm{d}x
\]
\end{showlatex}
\subsection{Don’t force fancy fractions}
\index{fractions|(}
When fractions are placed inline, are part of an exponent or part of an index, then they should be of the form $a/b$.
The notation
\[
\frac{a}{b}
\]
is reserved for display style.
So don’t do the following:
\begin{showlatex}{Full fractions in exponent, index and inline}
Consider $e^{\frac{1}{x}}$ and $x_{\frac{1}{n}}$ and $\frac{2}{3}$.
\end{showlatex}
Do the following instead:
\begin{showlatex}{Flat fractions in exponent, index and inline}
Consider $e^{1/x}$ and $x_{1/n}$ and $2/3$.
\end{showlatex}
Don’t use funky fractions like $\faktor{a}{b}$. They’ll make you go blind and burn down your house.
% TODO: Finding out the proper term for flat fractions. See Chicago Manual?
\index{fractions|)}
\section{Defining new commands}
Many mathematical operators have predefined commands, which should be used when needed.
\begin{showlatex}{Using commands vs.\ not using them}
Use $\sin(x)$ instead of $sin x$, use $\dim V$ instead of $dim V$ and use $\lim_{n \to \infty} a_n$ instead of $lim_{n \to \infty} a_n$.
\end{showlatex}
New commands can be defined in various ways:
\subsection{\comtitle{DeclareMathOperator}}
Commands of the form~\comname{WordCommand}, that are supposed to print~\enquote{$\mathrm{WordOutupt}$}, can easily be defined using the command~\comname{DeclareMathOperator}\massindex[defining commands]{DeclareMathOperator}[\comname].
\begin{showcode}{Syntax of~\comname{DeclareMathOperator}}
\DeclareMathOperator{\WordCommand}{WordOutput}
\end{showcode}
The command \comname{DeclareMathOperator} can only be used in the preamble.
To define the command~\comname{End} we use the following text in the preamble:
\begin{showcode}{Declaring a mathematical operator with~\comname{DeclareMathOperator}}
% in the preamble:
\DeclareMathOperator{\End}{End}
\end{showcode}
The command \comname{End} can then be used in the usual way:
\begin{showlatex}{Using a declared mathematical operator}
Thus $\End(V) = \End_k(V)$ becomes a vector space.
\end{showlatex}
If a command~\comname{WordCommand} is defined with \comname{DeclareMathOperator} then {\LaTeX} will automatically insert some space around\index{spacing!in math mode} \comname{WordCommand} when needed:
\begin{showlatex}*{Automatic spacing of~\comname{DeclareMathOperator}}
\begin{align*}
&x \End V
\\
&x \End(V)
\\
&x \End {(V)}
\end{align*}
\end{showlatex}
Note that in the first expression {\LaTeX} inserts some spacing both to the left and to the right of $\End$.
In the second expression {\LaTeX} observes that the used math operator is follows by a parenthesis and thus inserts no additional spacing.
For the third expression we prevent {\LaTeX} from making such an observation by using a pair of curly brackets.
This behavior leads to a bad looking output when \comname{DeclareMathoperator} is abused.
Suppose that we want a command \comname{Complex} that inserts the code \comname{mathbb\{C\}}.
\begin{showcode}{Wrong way of using \comname{DeclareMathOperator}}
% in the preamble:
\DeclareMathOperator{\Complex}{\mathbb{C}}
\end{showcode}
This will lead to the following problem:
\begin{showlatex}{Wrong output when \comname{DeclareMathOperator} is abused}
The span of $x_1, \dotsc, x_n \in \Complex^m$ equals $\Complex x_1 + \dotsb + \Complex x_n$.
\end{showlatex}
We expect the output $\mathbb{C} x_1 + \dotsb + \mathbb{C} x_n$ but get some unwanted spacing instead.
\subsection{\comtitle{operatorname}}
The command~\comname{operatorname}\massindex[defining commands]{operatorname}[\comname] can be used to give the formatting of a mathemical operator without defining a new command.
\begin{showlatex}{Using \comname{operatorname}}
Thus $\operatorname{Hom}(V,W) = \operatorname{Hom}_k(V,W)$ becomes a vector space.
\end{showlatex}
If the same command is used multiple times then one should use \comname{DeclareMathOperator} instead of \comname{operatorname}, to keep the code clean.
\subsection{Don’t abuse \comtitle{mathrm}}
The commands~\comname{mathrm}\massindex{mathrm}[\comname] and \comname{operatorname} do not give the same formatting.
With \comname{operatorname} we get the necessary spacing\index{spacing!in math mode} when not using parentheses
We don’t get this from \comname{mathrm}.
\begin{showlatex}{Missing spacing after~\comname{mathrm}}
Compare $\operatorname{End} V$ to $\mathrm{End} V$, and also~$2 \operatorname{Fr}(x)$ to~$\mathrm{Fr}(x)$.
\end{showlatex}
\subsection{\comtitle{newcommand}}
A very general way of defining new commands is given by \comname{newcommand}\massindex[defining commands]{newcommand}[\comname].
Its syntax is as follows:
\begin{showcode}{Syntax of \comname{newcommand}}
\newcommand{\name}[number of arguments n]{ definition including #1, ..., #n }
\end{showcode}
Consider the following example:
\begin{showlatex}{Using the command~\comname{newcommand}}
\newcommand{\bimodule}[2]{#1-#2-bimodule}
Let $M$ be an \bimodule{$A$}{$B$}.
\end{showlatex}
One may think about \comname{DeclareMathOperator} as a combination of \comname{newcommand} and \comname{operatorname}:
\begin{showlatex}{\comname{DeclareMathOperator} = \comname{newcommand} plus \comname{operatorname}}
\newcommand{\Ouv}{\operatorname{Ouv}}
$\Ouv X$
\end{showlatex}
Trying to define an already existing command with \comname{newcommand} will lead to an error.
To overwrite an already existing command one can use \comname{renewcommand}\massindex[defining commands]{renewcommand}[\comname] instead.
But this shouldn’t really be done (unless you really, \emph{really} know what you’re doing).
Even if you don’t like a particular command it may happen that some of the packages which you’re using rely on it:
overwriting the command can then easily lead to some unexpected new problems.
\subsection{\comtitle{DeclarePairedDelimiter}}
\index{delimiters!zzzz@\igobble |seealso {\comname{DeclarePairedDelimiter}}}
Mathematical operations like the absolute value~$\lvert \,\cdot\, \rvert$ and a norm~$\lVert \,\cdot\, \rVert$ are denoted by putting certain delimiters around the argument.
To define a corresponding {\LaTeX} command like~\comname{abs} or \comname{norm} one should use the command~\comname{DeclarePairedDelimiter}\massindex[defining commands]{DeclarePairedDelimiter}[\comname] (which is provided by the package~\packname{mathtools}).
\begin{showcode}{Syntax of \comname{DeclarePairedDelimiter}}
\DeclarePairedDelimiter{\name}{left delimiter}{right delimiter}
\end{showcode}
As an example we use \comname{DeclarePairedDelimiter} to define a command~\comname{abs} for absolute value:
\begin{showcode}{Defining the command~\comname{abs} with \comname{DeclarePairedDelimiter}}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\end{showcode}
The defined command can now be used as expected:
\begin{showlatex}{Using a declared delimiter}
\[
\abs{-5} = 5
\]
\end{showlatex}
Declaring a command via~\comname{DeclarePairedDelimiter} will automatically also define a starred version that scales the surrounding delimiters according to the given content between them.
One can also specify a scaling size like \comname{big}\massindex[scaling]{big}[\comname], \comname{bigg}\massindex[scaling]{bigg}[\comname], etc.\ to scale the delimiters.
\begin{showlatex}{Scaling of declared delimiters}
\begin{align*}
\abs{-\frac{1}{2}}
&=
\frac{1}{2} \,,
\\
\abs*{-\frac{1}{2}}
&=
\frac{1}{2} \,,
\\
\abs[\bigg]{-\frac{1}{2}}
&=
\frac{1}{2}
\end{align*}
\end{showlatex}
The variant~\comname{DeclarePairedDelimiterX}\massindex[defining commands]{DeclarePairedDelimiterX}[\comname] allows building more sophisticated commands:
\begin{showcode}{Syntax of \comname{DeclarePairedDelimiterX}}
\DeclarePairedDelimiterX{\name}
[number of arguments n]
{left delimiter}{right delimiter}
{expression build from #1, #2, ..., #n}
\end{showcode}
If the built up expression contains a delimiter, then by prefixing this delimiter with the command~\comname{delimsize}\massindex[scaling]{delimsize}[\comname] will ensure that the delimiter scales in the same way as the two surrounding delimiters.
As an example we define a command~\comname{inner} for inner product.
\begin{showcode}{Using \comname{DeclarePairedDelimiterX} for more advanced delimiters}
\DeclarePairedDelimiterX{\inner}[2]{\langle}{\rangle}{#1 \,\delimsize\vert\, #2}
\end{showcode}
The defined command~\comname{inner} takes two arguments and inserts a line~(\comname{vert}) with some surrounding space~(\comname{,}) between them.
\begin{showlatex}{Using more advanced delimiters}
\[
\inner{\psi_1}{\psi_2}
\quad
\inner*{\frac{f}{g}}{\frac{h}{k}}
\]
\end{showlatex}
There is also the variant~\comname{DeclarePairedDelimiterXPP}\massindex[defining commands]{DeclarePairedDelimiterXPP}[\comname] that is even more flexible than \comname{DeclarePairedDelimiterX}.
We refer to \cite{mathtools} for more details on these commands.
\subsection{The package~\packtitle{xparse}}
A useful way for defining commands -- in particular more involved ones -- is provided by the package~\packname{xparse}\massindex[packages]{xparse}[\packname].
This package provides the command~\comname{NewDocumentCommand}\massindex[defining commands]{NewDocumentCommand}[\comname].
\begin{showcode}{Syntax of \comname{NewDocumentCommand}}
\NewDocumentCommand{\name}{arguments}{definition}
\end{showcode}
The field~\inlinecode{arguments} specifies what kinds of arguments the command~\comname{name} will take:
\subsubsection{Mandatory arguments}
Mandatory arguments can be declared with the option~\optname{m}\expandafter\index\expandafter{\ciname{NewDocumentCommand}!mandatory argument}:
\begin{showlatex}{Mandatory arguments with \comname{NewDocumentCommand}~II}
% in the preamble
\NewDocumentCommand{\double}{m}{#1 #1}
% in the main text
\double{sometext}
\end{showlatex}
One can also specify multiple arguments:
\begin{showlatex}{Mandatory arguments with \comname{NewDocumentCommand}~II}
% in the preamble
\NewDocumentCommand{\swap}{m m}{#2 #1}
% in the main text
\swap{first}{second}
\end{showlatex}
\subsubsection{Optional arguments without default value}
Optional arguments can be declared with the option~\optname{o}\massindex{o}[\optname]\expandafter\index\expandafter{\ciname{NewDocumentCommand}!optional argument!without default value}.
It needs to be checked with the command~\comname{IfNoValueTF} if this optional argument was assigned a value.
\begin{showcode}[label = {syntax of ifvaluetf}]{Syntax of \comname{IfValueTF}}
\IfValueTF{#number of argument}
{if the argument has been set}
{if the argument has not been set}
\end{showcode}
One can similarly use~\comname{IfNoValueTF} instead of~\comname{IfNoValueTF}.
This has the same effect as switching the cases in \cref{syntax of ifvaluetf}.
Let’s look at a specific example:
\begin{showlatex}{Optional arguments with \comname{NewDocumentCommand},~I}
% in the preamble
\NewDocumentCommand
{\module}
{m o}
{\IfNoValueTF{#2}{#1-module}{#1-#2-bimodule}}
% in the main text
Let $M$ be an \module{$R$} and let $N$ be an \module{$R$}[$S$].
\end{showlatex}
It is useful to properly indent the source code.
But we have to be careful here:
It can easily happen that this indentation introduces some unwanted whitespace.
Let’s consider the naive code first:
\begin{showlatex}{Optional arguments with \comname{NewDocumentCommand},~I}
% in the preamble
\NewDocumentCommand
{\module}
{m o}
{
\IfNoValueTF{#2}
{#1-module}
{#1-#2-bimodule}
}
% in the main text
Let $M$ be an \module{$R$} and let $N$ be an \module{$R$}[$S$].
\end{showlatex}
Now let’s \enquote{comment out} the additional whitespace.
\begin{showlatex}{Optional arguments with \comname{NewDocumentCommand},~I}
% in the preamble
\NewDocumentCommand
{\module}
{m o}
{%
\IfNoValueTF{#2}
{#1-module}
{#1-#2-bimodule}%
}
% in the main text
Let $M$ be an \module{$R$} and let $N$ be an \module{$R$}[$S$].
\end{showlatex}
\subsubsection{Optional arguments with default value}
One can use \optname{O\{default value\}}\massindex{O\{ \}}[\optname]\expandafter\index\expandafter{\ciname{NewDocumentCommand}!optional argument!with default value} instead of \optname{o} to declare an optional argument that has a default value.
Let’s start with an example where this default value is empty:
\begin{showlatex}{Optional arguments with \comname{NewDocumentCommand},~II}
% in the preamble
\NewDocumentCommand{\restrict}{m m O{}}{#1|_{#2}^{#3}}
% in the main text
Let $f = \restrict{g}{X}$ and $f' = \restrict{g'}{X}[Y]$
\end{showlatex}
Now let’s do an example which has a standard value:
\begin{showlatex}{Optional arguments with \comname{NewDocumentCommand},~III}
% in the preamble
\NewDocumentCommand{\favorite}{O{colour} m}{My favorite #1 is #2.}
% in the main text
\favorite{blue}
\favorite[food]{spam}
\end{showlatex}
\subsubsection{Starred versions}
One can use the argument~\optname{*} together with the command~\comname{IfBooleanTF}\massindex[\ciname{NewDocumentCommand}]{IfBooleanTF}[\comname] to check for the occurrence of a star.
This can be used to also define a starred version of a command.
\begin{showlatex}{Starred versions with \comname{NewDocumentCommand}}
% in the preamble
\NewDocumentCommand{\choice}{s m m}{\IfBooleanTF{#1}{#3}{#2}}
% in the main text
Don’t confuse \choice{first}{second} with \choice*{first}{second}.
\end{showlatex}
\section{Stretch your arrows}
If some expression occurs atop or below an arrow, then this arrow must be stretched suffciently long to accommodate this expression.
The extensible arrows introduced in \cref{extensible arrows} automatically do so.
\subsection{Stretching columns}
If an arrow in a commutative diagram isn’t long enough then this arrow must also be stretched:
\begin{showlatex}{Commutative diagram with an arrow too short}
\[
\begin{tikzcd}
X \arrow{r}{f \circ g - g \circ f} \arrow{d}
&
Y \arrow{r}{k} \arrow{d}
&
Z \arrow[equal]{d}
\\
X' \arrow[dashed]{r}{h'}
&
Y' \arrow{r}{k'}
&
Z'
\end{tikzcd}
\]
\end{showlatex}
The column distance of a commutative diagram is governed by the option~\optname{column~sep}\massindex[\piname{tikz-cd}]{column sep}[\optname].
The value of \optname{column~sep} is expected to be a distance, e.g.~\optname{4em}.
Some standard distances are predefined, see \cref{column sep settings}.
\begin{table}[tb]
\begin{center}
\begin{tabular}{@{}lcccccc@{}}
\toprule
\theading{name}
&
\optname{tiny}\massindex[\piname{tikz-cd}!\optname{column sep}]{tiny}[\optname]
&
\optname{small}\massindex[\piname{tikz-cd}!\optname{column sep}]{small}[\optname]
&
\optname{scriptsize}\massindex[\piname{tikz-cd}!\optname{column sep}]{scriptsize}[\optname]
&
\optname{normal}\massindex[\piname{tikz-cd}!\optname{column sep}]{normal}[\optname]
&
\optname{large}\massindex[\piname{tikz-cd}!\optname{column sep}]{large}[\optname]
&
\optname{huge}\massindex[\piname{tikz-cd}!\optname{column sep}]{huge}[\optname]
\\
\theading{distance}
&
\optname{0.6em}
&
\optname{1.2em}
&
\optname{1.8em}
&
\optname{2.4em}
&
\optname{3.6em}
&
\optname{4.8em}
\\
\bottomrule
\end{tabular}
\end{center}
\caption{Standard distances for~\optname{column sep}.}
\label{column sep settings}
\end{table}
With~\optname{column~sep} one can fix the above diagram.
\begin{showlatex}{Using~\optname{column sep}}
\[
\begin{tikzcd}[column sep = huge]
X \arrow{r}{f \circ g - g \circ f} \arrow{d}
&
Y \arrow{r}{k} \arrow{d}
&
Z \arrow[equal]{d}
\\
X' \arrow[dashed]{r}{h'}
&
Y' \arrow{r}{k'}
&
Z'
\end{tikzcd}
\]
\end{showlatex}
One can also increase the width of a specific column by specifying the additional width at the correct~\&\nbd-symbol in the first row.
(In the above examples, the difference between \optname{normal} and \optname{huge} is~\optname{2.4em}.)
\begin{showlatex}{Explicit column spacing}
\[
\begin{tikzcd}
X \arrow{r}{f \circ g - g \circ f} \arrow{d}
&[2.4em]
Y \arrow{r}{k} \arrow{d}
&
Z \arrow[equal]{d}
\\
X' \arrow[dashed]{r}{h'}
&
Y' \arrow{r}{k'}
&
Z'
\end{tikzcd}
\]
\end{showlatex}
\subsection{Stretch rows}
One can similarly use the option~\optname{row~sep} to change the distance of the rows.
Some predefined distances can be found in \cref{row sep settings}.
\begin{table}[tb]
\begin{center}
\begin{tabular}{@{}lcccccc@{}}
\toprule
\theading{name}
&
\optname{tiny}\massindex[\piname{tikz-cd}!\optname{row sep}]{tiny}[\optname]
&
\optname{small}\massindex[\piname{tikz-cd}!\optname{row sep}]{small}[\optname]
&
\optname{scriptsize}\massindex[\piname{tikz-cd}!\optname{row sep}]{scriptsize}[\optname]
&
\optname{normal}\massindex[\piname{tikz-cd}!\optname{row sep}]{normal}[\optname]
&
\optname{large}\massindex[\piname{tikz-cd}!\optname{row sep}]{large}[\optname]
&
\optname{huge}\massindex[\piname{tikz-cd}!\optname{row sep}]{huge}[\optname]
\\
\theading{distance}
&
\inlinecode{0.45em}
&
\inlinecode{0.9em}
&
\inlinecode{1.35em}
&
\inlinecode{1.8em}
&
\inlinecode{2.7em}
&
\inlinecode{3.6em}
\\
\bottomrule
\end{tabular}
\end{center}
\caption{Standard distances for~\optname{row sep}.}
\label{row sep settings}
\end{table}
They are the same as for~\optname{column~sep} but scaled down by a factor of~$0.75$.
One can also explicitely specify an additional space between two rows after the correct~\comname{\tbs}.
\begin{showlatex}{Using~\optname{row sep} and explicit row spacing}
\[
\begin{tikzcd}[row sep = huge]
A \arrow{r} \arrow{d}
&
B \arrow{d}
\\
C \arrow{r} \arrow{d}
&
D \arrow{d}
\\
E \arrow{r}
&
F
\end{tikzcd}
\qquad
\begin{tikzcd}
A \arrow{r} \arrow{d}
&
B \arrow{d}
\\[1.8em]
C \arrow{r} \arrow{d}
&
D \arrow{d}
\\
E \arrow{r}
&
F
\end{tikzcd}
\]
\end{showlatex}
\section{Beware of spacings}
\index{spacing!in math mode|(}
{\LaTeX} classifies symbols and expressions into certain groups and then adds spacing around these symbols, which depends on the group they belong to.
Three of these groups are \enquote{operators}, \enquote{relation symbols} and \enquote{binary operations}.
The symbols~\inlinecode{=} and~\inlinecode{<} are for example treated as relations symbols, and the symbols~\inlinecode{+} and~\comname{cdot} as binary operations.
We can see in the following example how some space is automatically added around these symbols:
\begin{showlatex}{Standard spacing around relation symbols and binary operators}
\[
a = b \qquad a < b \qquad a + b \qquad a \cdot b
\]
\end{showlatex}
To compare this to a version without spacing we can surround the symbols by a pair of curly brackets.
This circumvents {\LaTeX} from taking the surrounding code into consideration.
\begin{showlatex}{Disabling the standard spacing around a symbol}
\[
a {=} b \qquad a {<} b \qquad a {+} b \qquad a {\cdot} b
\]
\end{showlatex}
The automatic spacing can become a problem, as the following examples illustrate:
\begin{showlatex}*{Clashing spacings around symbols}
\[
X/\sim
\quad
R/\operatorname{J}(R)
\quad
\operatorname{id} \otimes h
\]
\end{showlatex}
These problems can be fixed by surrounding the respective symbols with curly brackets.
\begin{showlatex}*{Preventing a clash of spacings}
\[
X/{\sim}
\quad
R/{\operatorname{J}(R)}
\quad
{\operatorname{id}} \otimes h
\]
\end{showlatex}
One can also tell {\LaTeX} a symbol should be treated.
\begin{showlatex}*{Specifying the role (and thus spacing) of a symbol}
\[
a | b
\quad
a \mathop{|} b
\quad
a \mathrel{|} b
\quad
a \mathbin{|} b
\]
\end{showlatex}
We can thus define a command~\comname{divides}, which expresses that a number~$n$ divides a number~$m$, as follows:
\begin{showlatex}*{Defining and using \comname{divides}}
\newcommand{\divides}{\mathrel{|}}
\[
n \divides m
\]
\end{showlatex}
For more on this topic we refer to \cite{tex_binrel}.
\index{spacing!in math mode|)}
| {
"alphanum_fraction": 0.6549856229,
"avg_line_length": 29.216802168,
"ext": "tex",
"hexsha": "afb531874ee5d3bcfd0487990b9500f0b1688575",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "39c7fb189f39f60865886278d5c23a0a310cdb18",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "cionx/thoughts-about-writing-latex",
"max_forks_repo_path": "chapters/math_mode.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "39c7fb189f39f60865886278d5c23a0a310cdb18",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "cionx/thoughts-about-writing-latex",
"max_issues_repo_path": "chapters/math_mode.tex",
"max_line_length": 449,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "39c7fb189f39f60865886278d5c23a0a310cdb18",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "cionx/thoughts-about-writing-latex",
"max_stars_repo_path": "chapters/math_mode.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 17003,
"size": 53905
} |
\section{Introduction}
This is a simple template for a brief report in a seminar. If you have
used \LaTeX{} before, you should have no trouble accustoming yourself to
it. You may use UTF-8 characters in the document, provided your font supports
them:
%
\begin{quote}
Allein der Vortrag macht des Redners Glück
\end{quote}
%
The default font in this document supports~(at least) German, French,
and English characters. You should hence have no problem typesetting
complicated names such as \emph{Henri Poincaré} or \emph{Cédric
Villani}. In the following, this document discusses how to typeset
certain things.
\subsection{Typesetting tables}
Tables should be wrapped in a \verb|table| environment and have a proper
caption and label for references. Moreover, typographically correct
lines~(also known as \emph{rules}) should be used. The following example
demonstrates this:
%
\begin{center}
\begin{verbatim}
\begin{table}
\centering
\begin{tabular}{lSS}
\toprule
[...]
\midrule
Mount Everest & 8848 & 8848\\
[...]
\bottomrule
\end{tabular}
\end{table}
\caption{%
[...]
}
\label{tab:Mountains}
\end{verbatim}
\end{center}
%
\autoref{tab:Mountains} on \autopageref{tab:Mountains} shows how this
looks in practice.
%
Notice that the \verb|S| column requires additional curly brackets in
order to detect a column heading correctly. If these brackets are
omitted, the heading may not be parsed correctly.
\begin{table}[tb]
\centering
\begin{tabular}{lSS}
\toprule
\textbf{Mountain} & \textbf{Height in \si{\meter}} & \textbf{Prominence in \si{\meter}}\\
\midrule
Mount Everest & 8848 & 8848\\
K2 & 8611 & 4020\\
Kangchenjunga & 8586 & 3922\\
Lhotse & 8516 & 610 \\
\bottomrule
\end{tabular}
\caption{
The highest mountains along with their prominence values.
%
This example also demonstrates the use of the \texttt{S} column,
which permits automatically aligning numbers, as well as the
\texttt{siunitx} package for typesetting units correctly.
}
\label{tab:Mountains}
\end{table}
\subsection{Typesetting figures}
Use the standard \verb|\includegraphics| syntax to include figures. By
default, figures may be specified with their full~(relative) path. You
may also omit a leading \verb|Figures/| folder because \LaTeX{} is going
to automatically look for files in this directory.
%
Notice that specifying the file extension should be unnecessary.
%
\begin{verbatim}
\begin{figure}[b]
\centering
\includegraphics[width=\textwidth]{Koenigsberg}
\caption{%
A map of Königsberg from about 1813. Modified from an engraving by
Joachim Bering from 1613. For annotations, you could use
\texttt{TikZ} or the \texttt{overpic} package.
}
\label{fig:Koenigsberg}
\end{figure}
\end{verbatim}
%
Figure~\autoref{fig:Koenigsberg} on~\pageref{fig:Koenigsberg} depicts an
example.
%
Please ensure that figures are referenced properly and give credit to
the original author if you use a figure from a publication.
%
You should also check that the resolution of the figure is sufficient.
%
If in doubt, recreate the figure yourself, using \verb|TikZ|\footnote{\url{http://www.texample.net/tikz}}, \verb|pgfplots|\footnote{\url{http://pgfplots.sourceforge.net}}, or any vector graphics application such as \verb|Inkscape|\footnote{\url{https://inkscape.org/en}}.
\begin{figure}[t]
\centering
\includegraphics[width=\textwidth]{Koenigsberg}
\caption{%
A map of Königsberg from about 1813. Modified from an engraving by
Joachim Bering from 1613. For annotations, you could use
\texttt{TikZ} or the \texttt{overpic} package.
}
\label{fig:Koenigsberg}
\end{figure}
If you want to add multiple subordinate figures under a larger figure,
use the \verb|subcaption| package that is included by default. It is
good practice to use the \verb|\subcaptionbox| command for wrapping
figures. The first parameter to this command is the caption of the
figure. It may remain empty or contain only a \verb|\label| command for
subsequent references. It is possible to refer to the complete
sub-figure using the usual reference commands. If you want to refer to
an individual sub-figure only, use the \verb|\subref| command.
%
\begin{verbatim}
\begin{figure}
\centering
\subcaptionbox{Label\label{sfig:Label}}{%
\begin{tikzpicture}
...
\end{tikzpicture}
}
\end{figure}
\end{verbatim}
%
\autoref{fig:Anscombe's quartet} depicts numerous sub-figures in order
to show all members of Anscombe's quartet. \autoref{sfig:Anscombe's
quartet A} is the first one of these. This figure is also denoted
by~\subref{sfig:Anscombe's quartet A}, although you should use such
a reference only within a caption because it may be confusing to
readers---and by extension, it may also confuse the people who grade
your report.
Please refer to the source code for more information. It also
demonstrates the use of the \verb|pgfplots| package for high-quality
typesetting of statistical graphics. An introduction would go beyond the
scope of this document, though, but this package is highly recommend if
you want your graphics to have a consistent look-and-feel.
\begin{figure}
\centering
\pgfplotsset{%
Anscombe/.style={%
axis x line = bottom,
axis y line = left,
%
only marks,
%
enlargelimits = false,
xmin = 3.5,
xmax = 20.0,
ymin = 4.0,
ymax = 13.0,
%
width = 0.5\linewidth,
height = 4cm,
}
}
\subcaptionbox{\label{sfig:Anscombe's quartet A}}{%
\begin{tikzpicture}
\begin{axis}[Anscombe]
\addplot[black, mark=*] table {Data/Anscombe_1.txt};
\addplot[sharp plot, domain={\pgfplotsxmin:\pgfplotsxmax}] { 3 + 0.5*x };
\end{axis}
\end{tikzpicture}
}
\subcaptionbox{}{%
\begin{tikzpicture}
\begin{axis}[Anscombe]
\addplot[black, mark=*] table {Data/Anscombe_2.txt};
\addplot[sharp plot, domain={\pgfplotsxmin:\pgfplotsxmax}] { 3 + 0.5*x };
\end{axis}
\end{tikzpicture}
}\\
\subcaptionbox{}{%
\begin{tikzpicture}
\begin{axis}[Anscombe]
\addplot[black, mark=*] table {Data/Anscombe_3.txt};
\addplot[sharp plot, domain={\pgfplotsxmin:\pgfplotsxmax}] { 3 + 0.5*x };
\end{axis}
\end{tikzpicture}
}
\subcaptionbox{}{%
\begin{tikzpicture}
\begin{axis}[Anscombe]
\addplot[black, mark=*] table {Data/Anscombe_4.txt};
\addplot[sharp plot, domain={\pgfplotsxmin:\pgfplotsxmax}] { 3 + 0.5*x };
\end{axis}
\end{tikzpicture}
}
\caption{%
Multiple figures are best shown using the \texttt{subcaption}
package. Individual figures may be referenced using the
\texttt{\textbackslash{}subref} command.
%
\subref{sfig:Anscombe's quartet A} depicts the first member of Anscombe's
quartet, a classical data set in statistics.
}
\label{fig:Anscombe's quartet}
\end{figure}
\subsection{Typesetting mathematics}
This template uses \verb|amsmath| and \verb|amssymb|, which are the
de-facto standard for typesetting mathematics. Use numbered equations
using the \verb|equation| environment.
%
If you want to show multiple equations and align them, use the
\verb|align| environment:
%
\begin{align}
V &:= \{ 1, 2, \dots \}\\
E &:= \big\{ \left(u,v\right) \mid \dist\left(p_u, p_v\right) \leq \epsilon \big\}
\end{align}
%
Define new mathematical operators using \verb|\DeclareMathOperator|. See
the template for some examples. Else, your operator will be typeset
incorrectly. Observe the difference between the incorrect~(left) and
correct~(right) usage:
%
\begin{equation}
cos x \neq \cos x
\end{equation}
%
Moreover, this template contains a correct differential operator. Use \verb|\d| to typeset the differential of integrals:
%
\begin{equation}
f(u) := \int_{v \in \mathds{D}}\dist(u,v)\d{v}
\end{equation}
%
Take a look at the source for more examples. If in doubt, ask the
organizers for help.
The documentation of the \verb|amsmath|
package\footnote{\url{http://mirrors.ctan.org/macros/latex/required/amsmath/amsmath.pdf}}
is also extremely useful.
%
Likewise, the guide by Mark
Tomforde\footnote{\url{https://www.math.uh.edu/~tomforde/MathWriting.pdf}}
contains a variety of useful tips and tricks.
%
Remember that typesetting complicated things takes some time, but is
usually worth the effort because \emph{you} understand it better, and so
the reader might understand it better as well.
\subsection{Typesetting algorithms}
This template suggests using the \verb|algorithmi| package for
typesetting an algorithm.
%
It is customizable and offers sufficient flexibility to cover most usage scenarios. Feel free to use another package, though, or refer to the extensive documentation\footnote{\url{http://mirror.unl.edu/ctan/macros/latex/contrib/algorithmicx/algorithmicx.pdf}}.
%
There's no standard for pseudo-code, so feel free to use any format that
seems acceptable to you. Always use a caption and a label for your algorithm, so that you may refer to it correctly, e.g.\ \autoref{alg:Persistent homology}.
Notice that for most reports, adding specific algorithms should not be
necessary. However, you are free to go the extra mile if you consider
this to improve the report, in particular if you reference the algorithm
numerous times or if the implementation is a large part of the
contribution.
\begin{algorithm}[t]
\caption{0-dimensional persistent homology calculation}
\label{alg:Persistent homology}
%
\begin{algorithmic}[1]
\newcommand{\UF}{\texttt{UF}}
\newcommand{\diagram}{\mathcal{D}}
\newcommand{\graph} {\mathcal{G}}
\newcommand{\weight} {\mathrm{w}}
%
\Require A weighted graph $\graph$
\State $\UF \gets \emptyset$\Comment{Initialize an empty Union--Find structure}
\State $\diagram \gets \emptyset$\Comment{Initialize an empty persistence diagram}
\For{every edge $(u,v)\in\graph$ in ascending order of its weight}
\State $c \gets$ $\UF$\texttt{.Find}($u$)
\State $c' \gets$ $\UF$\texttt{.Find}($v$)
\If{$\weight(c) < \weight(c')$}\Comment{$c$ is the older component; merge $c'$ into it}
\State $\UF$\texttt{.Union}($c'$, $c$)
\State $\diagram\gets\diagram\cup\big(\weight(c'), \weight(u,v)\big)$
\Else\Comment{$c'$ is the older component; merge $c$ into it}
\State $\UF$\texttt{.Union}($c$, $c'$)
\State $\diagram\gets\diagram\cup\big(\weight(c) , \weight(u,v)\big)$
\EndIf
\EndFor
\State\Return$\diagram$
\end{algorithmic}
\end{algorithm}
| {
"alphanum_fraction": 0.7034142711,
"avg_line_length": 35.83,
"ext": "tex",
"hexsha": "f93f92b4bf8d086cb55c60100e4cdd5b2947f3b3",
"lang": "TeX",
"max_forks_count": 3,
"max_forks_repo_forks_event_max_datetime": "2021-01-05T11:57:37.000Z",
"max_forks_repo_forks_event_min_datetime": "2019-10-22T18:44:23.000Z",
"max_forks_repo_head_hexsha": "580249c0ac3a4193a783c5cb31fea7d813be2065",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "Pseudomanifold/latex-mimore",
"max_forks_repo_path": "Sources/Introduction.tex",
"max_issues_count": 2,
"max_issues_repo_head_hexsha": "580249c0ac3a4193a783c5cb31fea7d813be2065",
"max_issues_repo_issues_event_max_datetime": "2017-05-17T09:48:43.000Z",
"max_issues_repo_issues_event_min_datetime": "2017-05-17T09:48:19.000Z",
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "Pseudomanifold/latex-mimore",
"max_issues_repo_path": "Sources/Introduction.tex",
"max_line_length": 271,
"max_stars_count": 19,
"max_stars_repo_head_hexsha": "580249c0ac3a4193a783c5cb31fea7d813be2065",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "Pseudomanifold/latex-mimore",
"max_stars_repo_path": "Sources/Introduction.tex",
"max_stars_repo_stars_event_max_datetime": "2022-02-04T17:28:55.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-04-14T14:40:36.000Z",
"num_tokens": 3086,
"size": 10749
} |
\chapter{Discussion}\label{chap:discussion}
\input{sections/Finishing texts/our_collab.tex}
\input{sections/Finishing texts/knox_collab.tex} | {
"alphanum_fraction": 0.8357142857,
"avg_line_length": 46.6666666667,
"ext": "tex",
"hexsha": "451de8a80370a68b044be9f53c8b43fac787b055",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "ea51a218806e552691538e33c16f9cf067be52d4",
"max_forks_repo_licenses": [
"BSD-3-Clause"
],
"max_forks_repo_name": "chhoumann/p5",
"max_forks_repo_path": "sections/Finishing texts/discussion.tex",
"max_issues_count": 5,
"max_issues_repo_head_hexsha": "ea51a218806e552691538e33c16f9cf067be52d4",
"max_issues_repo_issues_event_max_datetime": "2021-12-09T07:47:18.000Z",
"max_issues_repo_issues_event_min_datetime": "2021-11-10T09:54:41.000Z",
"max_issues_repo_licenses": [
"BSD-3-Clause"
],
"max_issues_repo_name": "chhoumann/p5",
"max_issues_repo_path": "sections/Finishing texts/discussion.tex",
"max_line_length": 48,
"max_stars_count": 2,
"max_stars_repo_head_hexsha": "ea51a218806e552691538e33c16f9cf067be52d4",
"max_stars_repo_licenses": [
"BSD-3-Clause"
],
"max_stars_repo_name": "chhoumann/p5",
"max_stars_repo_path": "sections/Finishing texts/discussion.tex",
"max_stars_repo_stars_event_max_datetime": "2021-11-16T12:25:11.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-09-14T05:43:04.000Z",
"num_tokens": 39,
"size": 140
} |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% ZEBRA User Guide -- LaTeX Source %
% %
% ZEBRA master driving LaTeX source file %
% %
% This document needs the following external EPS files: %
% See the respective source files which are included %
% %
% Editor: Michel Goossens / AS-MI %
% Last Mod.: 8 Dec. 1990 mg %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\documentstyle[11pt,times]{book}
\documentstyle[11pt,epsf]{book}
\newfont{\ttsc}{cmtcsc10 scaled 1095}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Set the page size parameters %
% A4 size 210mm by 297 mm %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% width of text
%
\setlength{\textwidth}{170mm}
\setlength{\hoffset}{-15mm}
% vertical space
\setlength{\voffset}{-45mm}
\setlength{\topmargin}{2cm}
\setlength{\headheight}{5mm}
\setlength{\headsep}{5mm}
\setlength{\footheight}{5mm}
\setlength{\footskip}{5mm}
%
% margins
%
\setlength{\evensidemargin}{20mm}
\setlength{\oddsidemargin}{20mm}
\setlength{\marginparsep}{5mm}
\setlength{\marginparpush}{20mm}
\setlength{\marginparwidth}{15mm}
%
% number of lines of text and interline space
%
\setlength{\baselineskip}{13pt}
\setlength{\textheight}{54\baselineskip}
%%%%%%%%%%%% Simple commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Routine index:
% Put text in tt boldface and enter routine name in index
\newcommand{\Rind}[1]{{\ttsc #1}\protect\index{Routine #1}}
\newcommand{\Iind}[1]{\protect\index{Routine HIDOPT}
\protect\index{Option #1}\protect\index{#1 option}}
\newcommand{\ttbf}[1]{{\ttsc #1}}% tt font boldface
\newcommand{\action}{\par{\bf Action: }}% Action of routine
\newcommand{\remark}{\par{\bf Remark:}\par}% Remark for routine
\newcommand{\Pdesc}{\par{\bf Parameter Description:}}%
\newcommand{\Idesc}{\par{\bf Input Parameter Description:}}%
\newcommand{\Odesc}{\par{\bf Output Parameter Description:}}%
%%%%%%%%%%%% Command \Func %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\Func}[1]{\par\vspace*{3mm}\framebox[.98\textwidth]
{\rule[-3mm]{0mm}{7mm}\ttsc#1}\par\vspace*{3mm}%
\def\cut##1= ##2 ##3 {\gdef\subnam{##2}}
\setbox77\hbox{\cut#1 A }%Placeholder for case without argument
\protect\label{SR_\subnam}% mark the Function definition
\protect\index{Function \subnam}% Enter Function definition in index
}% ***** end of \newcommand{\Func}
%%%%%%%%%%%% Command \Subr %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\Subr}[1]{\par\vspace*{3mm}\framebox[.98\textwidth]
{\rule[-3mm]{0mm}{7mm}\ttsc#1}\par\vspace*{3mm}%
\def\cut##1 ##2 ##3 {\gdef\subnam{##2}}
\setbox77\hbox{\cut#1 A }%Placeholder for case without argument
\protect\label{SR_\subnam}% mark the subroutine definition
\protect\index{Routine \subnam}% Enter subroutine def in index
}% ***** end of \newcommand{\Subr}
%%%%%%%%%%%% Environment DL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{DL}[1]{% The parameter is the width of the term
\begin{list}{\phantom{#1}}
{\settowidth{\labelwidth}{\bf #1}% define global width
\setlength{\leftmargin}{\labelwidth}% set global width
\setlength{\labelsep}{0pt}% horizontal separation term-item
\setlength{\itemsep}{0pt}% vertical separation between two items
\setlength{\parsep}{0pt}% vertical separation paragraphs in item
\setlength{\topsep}{0pt}% vertical separation text/list
\renewcommand{\makelabel}[1]{\ttsc ##1\hfill}}}% from item
{\end{list}}% ***** end of environment{DL}
%%%%%%%%%%%% Environment Listing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{Listing}% Verbatim in small type
{\bgroup\scriptsize}% \begin{Listing}
{\egroup}% \end{Listing}
%%%%%%%%%%%% Environment OL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{cOL}
\newenvironment{OL}{%
\begin{list}{\hfill{\bf\arabic{cOL}}\hskip6pt}%
{\setlength{\labelsep}{0pt}% horizontal separation term-item
\setlength{\itemsep}{0pt}% vertical separation between items
\setlength{\parsep}{0pt}% vertical separation paragraphs in item
\setlength{\topsep}{0pt}% vertical separation text/list
\usecounter{cOL}}}{\end{list}}
%%%%%%%%%%%% Environment UL %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{UL}{%
\begin{list}{}
{\setlength{\labelsep}{0pt}% horizontal separation term-item
\setlength{\itemsep}{0pt}% vertical separation between items
\setlength{\parsep}{0pt}% vertical separation paragraphs in item
\setlength{\topsep}{0pt}% vertical separation text/list
\renewcommand{\makelabel}{\hfill$\bullet$\hskip6pt}}}%
{\end{list}}
%%%%%%%%%%%% Other options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeindex
\parindent=0pt
\begin{document}
\begin{titlepage}
\begin{center}CERN Program Library Entry Q100\\[5cm]
{\Huge ZEBRA User Guide}\\[1cm]
{\LARGE Data Structure Management System}\\[1cm]
{\LARGE Version 3.xx (January 1991)}\\[4cm]
Ren\'e Brun and Julius Zoll\\[4cm]
CERN Geneva, Switzerland
\end{center}\end{titlepage}
\thispagestyle{empty}
\framebox[\textwidth][t]{\hfill\begin{minipage}{0.92\textwidth}%
\vspace*{3mm}\begin{center}Copyright Notice\end{center}
\parskip\baselineskip
{\bf ZEBRA - Data Structure Management System}
CERN Program Library entry {\bf Q100}
Copyright CERN, Geneva 1991
Copyright and any other appropriate legal protection of these
computer programs and associated documentation reserved in all
countries of the world.
These programs or documentation may not be reproduced by any
method without prior written consent of the Director-General
of CERN or his delegate.
Permission for the usage of any programs described herein is
granted apriori to those scientific institutes associated with
the CERN experimental program or with whom CERN has concluded
a scientific collaboration agreement.
Requests for information should be addressed to:
\begin{center}\begin{tabular}{l}
{\tt CERN Program Library Office}\\
{\tt CERN-CN Division }\\
{\tt CH-1211 Geneva 23 }\\
{\tt Switzerland }\\
{\tt Tel. +41 22 767 4951 }\\
{\tt Fax. +41 22 767 7155 }\\
{\tt Bitnet: CERNLIB@CERNVM }\\
{\tt DECnet: VXCERN::CERNLIB (node 22.190) }\\
{\tt Internet: [email protected]}
\end{tabular}\end{center}\vspace*{2mm}
\end{minipage}\hfill}%end of minipage in framebox
\newpage
\section*{About this guide}
\par This user guide contains a description of the basic
ZEBRA routines. The
calling sequences which an ``average user'
will need in most of his work are treated in
detail. Programmers who are
responsible for the layout of the basic software in their experiment
and those who
have to know more about the internal conventions used by ZEBRA
will want to consult the ZEBRA reference manual.
The latter explains the
philosophy behind each ZEBRA construct, discusses each user routine
giving its full calling sequence with
a list of possible error return codes and detailed examples.
It discusses exception handling and provides a description
of the layout of the system tables and banks.
\section*{Acknowledgements}
\par The authors would like to thank all their colleagues, who by their
continuous interest and encouragement, have given them the
necessary input to provide a modern system which, they hope, will allow
an easy development of the basic software
in high energy physics and related fields.
\par In particular
M.Goossens acted as editor of the present guide and he wrote the code
of the DZ package, while
M.Metcalf reviewed the entire document and
is the main author of the introductory chapter.
\section*{Related Publications}
\par This User Guide should be complemented by the following
{\bf ZEBRA Reference Manual} set available from the
Program Library:
\begin{DL}{MMM}
\item[DIA]Error Diagnostics
\item[FZ]Sequential I/O
\item[MZ]Memory Management
\end{DL}
\tableofcontents
\listoffigures
% ==================== Body of text ===========================
% Introductory chapter
\include{zebintro}
% MZ chapter
\include{zebramz}
% Utilities chapter
\include{zebutils}
% FZ chapter
\include{zebrafz}
% RZ chapter
\include{zebrarz}
% DZ chapter
\include{zebradz}
% ==================== Appendixes =============================
\appendix
\include{zebappen}
% With examples
%\include{zebexam}
% ==================== Backmaterial ===========================
\input{zebrmain.ind}
%\input{hbook.biblio}
\end{document}
| {
"alphanum_fraction": 0.617464539,
"avg_line_length": 41.3944954128,
"ext": "tex",
"hexsha": "05db2285e04bb98ee13d8fd723694c87f30a7193",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_forks_repo_licenses": [
"CC-BY-4.0"
],
"max_forks_repo_name": "berghaus/cernlib-docs",
"max_forks_repo_path": "zebra/zebrmain.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC-BY-4.0"
],
"max_issues_repo_name": "berghaus/cernlib-docs",
"max_issues_repo_path": "zebra/zebrmain.tex",
"max_line_length": 71,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "76048db0ca60708a16661e8494e1fcaa76a83db7",
"max_stars_repo_licenses": [
"CC-BY-4.0"
],
"max_stars_repo_name": "berghaus/cernlib-docs",
"max_stars_repo_path": "zebra/zebrmain.tex",
"max_stars_repo_stars_event_max_datetime": "2019-07-24T12:30:01.000Z",
"max_stars_repo_stars_event_min_datetime": "2019-07-24T12:30:01.000Z",
"num_tokens": 2322,
"size": 9024
} |
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{inputenc}
\usepackage{geometry}
\usepackage{cancel}
\geometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}
\begin{document}
\title{MITx 15.455x Mathematical Methods for Quantitative Finance
\\
\begin{large}
Recitation 5
\end{large} }
\maketitle
\section*{Module 2: Expectations from Browninan integrals}
Let's look at more expectations involving
our stochastic processes.
We know that $dB$ is a Gaussian random variable
with a mean $0$ and variance $dt$.
$$ dB \sim N(0,dt) $$
We also know that if we integrate $\int_{0}^{t} dB$ , and for convenience, I can write this as:
$$ \int_{0}^{t} dB = B_t - B_0 \sim N(0,t ) $$
Let's agree that $B_0=0$.
So since that is the case, we have an easy way that we can write things.
We know that the expectation of $B$ is going to be 0.
We know that its variance is going to be $t$.
So let's just replace the random variable $B_t-B_0$ by $\sqrt{t}z$ where $z \sim N(0,1)$
Where $z$ doesn't have any time dependence. So that's just simplifying things and putting everything
in an even more standard form. But it also makes explicit the time dependent.
And it's the scaling with time that's going to be important for a lot of financial applications, and for risk management.
So, what that means is that any time
where we see a $B_t$, or a $B_t$ minus $B_0$,
we can replace it by that function.
So if we want to compute the expectation of some function, we can just write: $$E[f(B_t-B_0)] = E[f(\sqrt{t} z)]$$ and compute that.
And remember, these are our Gaussian intervals. So we just need to do an integral. That's all it is. So this is equal:
$$E[f(B_t-B_0)] = E[f(\sqrt{t} z)] = \frac{1}{\sqrt{2\pi}} \int e^{-z^2/2}f(\sqrt{t}z) dz$$
Easy.
So for example, suppose we wanted to compute the expectation of the fourth power.
$$ f(x) = x^4$$
So we'd like to compute:
$$E[f(B_t-B_0)] = E[(B_t-B_0)^4] = E[(\sqrt{t} z)^4] = t^2 E[z^4] = 3t^2 $$
We can pull out $\sqrt{t}$,which is nonstochastic to get $t^2 E[z^4]$
, $E[z^4]$ is a well-known Gaussian integal that we use in the kurtosis.
It's just equal to 3.
All right.
So this way of standardizing things and writing things
in terms of $z$ when we work in the integral form,
when we integrate our processes, is very convenient.
Let's do an example, and I want to review
a very useful trick with you.
So let's take a look.
\subsection*{Example}
Suppose we wanted to compute
$$ E[e^{6X}] \text{ where } dX = \mu dt + \sigma dB $$
where $dX$, let's just say it's ordinary Brownian motion.
OK, because it's on this form, you can integrate as:
$$ \text{integrate:} X_t-X_0 = \mu t + \sigma \sqrt{t} z $$
So if we go to compute the expectation :
$$ E[e^{6(\mu t + \sigma \sqrt{t} z)}] = e^{6\mu t} E[e^{6 \sigma \sqrt{t} z}] $$
\subsubsection*{Useful Formula}
Suppose that we have $E[e^{\alpha z + \beta}]$. And this shows up a lot in particular in asset
pricing formulas.
So this is clearly equal to
$$ $$
\begin{equation*}
\begin{split}
E[e^{\alpha z + \beta}] & = e^{\beta} E[e^{\alpha z }] \\
& = \frac{e^{\beta}}{\sqrt{2 \pi}} \int e^{-z^2/2}e^{\alpha z} dz \\
& = \frac{e^{\beta}}{\sqrt{2 \pi}} \int e^{-z^2/2 + \alpha z - \alpha^2/2 + \alpha^2/2 } dz \\
& = \frac{e^{\beta}}{\sqrt{2 \pi}} \int e^{-(z^2 - 2 \alpha z + \alpha^2)/2 + \alpha^2/2 } dz \\
& = \frac{e^{\beta}}{\sqrt{2 \pi}} \int e^{-(z-\alpha)^2/2 + \alpha^2/2} dz \\
& = e^{\beta+ \alpha^2/2} \Big[\frac{1}{\sqrt{2 \pi}} \int e^{-(z-\alpha)^2/2 } dz \Big]
\end{split}
\end{equation*}
We do the Gaussian integral, with the trick of completing the square in the exponent.
And because the integral goes from minus infinity to infinity, the difference in the exponential between $z$
and $z-\alpha$ makes no difference at all.
If you'd like, you can shift the variable of integration.
The integral inside the square brackets
with $\frac{1}{\sqrt{2 \pi}}$ in front is equal to 1.
So our final result, our final useful formula, is that:
$$ E[e^{\alpha z + \beta}] = e^{\beta+ \alpha^2/2}$$
Now, let's apply that to our example.
$$ E[e^{6X}] = E[e^{ 6\mu t + 6 \sigma \sqrt{t} z}] $$
with $\alpha=6 \sigma \sqrt{t}$ and $\beta = 6 \mu t$ , we apply $ E[e^{\alpha z + \beta}] = e^{\beta+ \alpha^2/2}$
\begin{equation*}
\begin{split}
E[e^{6X}] &= e^{6 \mu t + (6 \sigma \sqrt{t})^2/2} \\
&= e^{6 \mu t + 18 \sigma^2 t}
\end{split}
\end{equation*}
So there's our answer for finding this expectation.
And this works, generally, for a larger class
of functions that show up for different kinds of Ito
processes.
\section*{Module 3: Solutions to the diffusion equation}
Let's take a closer look at the diffusion equation. So the general diffusion equation is given right here.
So we say that we have a function $p(z,t)$,
$$ p(z,t) = \int p_0(z-w,t)f(w)dw $$
and they need to satisfy this differential equation.
$$ \frac{\partial p}{\partial t} - \frac{1}{2} \frac{\partial ^2 p}{\partial z^2} = 0 $$
And we've seen that there's a very special solution, $p_0$, that satisfies that equation, which
we can find by plugging it in and taking some derivatives. So here's our $p_0$.
$$ p_0 = \frac{1}{\sqrt{2 \pi t}} e^{-\frac{z^2}{2t}} $$
Now, I claimed that if we construct this integral on top,
that this is the solution to the equation.
So what I'd like to do is, let's check that,
and then let's apply it.
So the first thing to do is to check it.
And the way we do it is we take derivatives.
And what we find is that if we take that integral expression,
and we stick it into the differential equation, what
we'll do is, we'll move the differential operators inside.
So for example,
$$ \frac{\partial}{\partial t} p(z,t) = \int \frac{\partial}{\partial t} \Big[ p_0(z-w,t)f(w)dw \Big] $$
But where is the $t$ dependence?
The $t$ dependence is only in one place.
It's in $p_0$.
And similarly,
$$ \Big( \frac{\partial}{\partial t} -\frac{1}{2} \frac{\partial^2}{\partial z^2} \Big)p(z,t) = \int \Big[ \frac{\partial}{\partial t} -\frac{1}{2} \frac{\partial^2}{\partial z^2} \Big] p_0(z-w,t)f(w)dw $$
\subsection*{Exercise}
Suppose that
$$ f(z) = z^2 $$
$$ p(z,0) = z^2 $$
$$ \text{find } p(z,t) $$
So what we need to do is, we've got a formula.
Let's just plug and chug.
\begin{equation*}
\begin{split}
p(z,t) &= \int p_0(z-w,t)f(w)dw \\
&= \int \frac{1}{\sqrt{2 \pi t}} e^{-\frac{(z-w)^2}{2t}} w^2 dw
\end{split}
\end{equation*}
Remember, it's a Gaussian where the variance is $t$.
So it's not completely standardized.
So there is $t$ dependence in this.
How do we do this integral?
Well, let's change variables. So what we'd like to do is, let's simplify the exponent
and pick a new variable.
$$ \text{let } u=\frac{w-z}{\sqrt{t}} \implies du=\frac{dw}{\sqrt{t}} $$
$$ \implies w=u \sqrt{t} + z $$
So let's make those substitutions.
\begin{equation*}
\begin{split}
p(z,t) &= \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} e^{-\frac{u^2}{2}} (u \sqrt{t} + z)^2 du
\end{split}
\end{equation*}
Because now we almost have things in standardized form
for a Gaussian interval, let's just expand that out.
\begin{equation*}
\begin{split}
p(z,t) &= \frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} e^{-\frac{u^2}{2}} (u^2t + 2u \sqrt{t}z + z^2) du \\
&= t \Big[\frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} e^{-\frac{u^2}{2}} u^2 \Big] + 0 +
z^2 \cancelto{1}{\Big[\frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} e^{-\frac{u^2}{2}} u^2 \Big]}
\end{split}
\end{equation*}
Let's look at each of these terms.
The first term, is going to be $u^2t$.
Remember, $t$ is a constant with respect
to the variable of integration.
The second term, $ 2u \sqrt{t}z$, is going to vanish.
Because it's linear in $u$, this is an odd function in $u$.
We're going from minus infinity to infinity.
And odd functions are going to have varnishing integrals.
It's just a plus sign to the minus sign
are going to cancel each other out.
And then, the last term, $z^2$, that's just going to be multiplied by a constant a constant equal to 1.
Because $\frac{1}{\sqrt{2 \pi}} \int_{-\infty}^{\infty} e^{-\frac{u^2}{2}} u^2$ is just the variance
of the standardized Gaussian distribution.
So we do the integrals. And what we're left with is :
$$ p(z,t) = z^2+t $$
And we can check that it satisfies our differential
equation.
$$ \frac{\partial p}{\partial t} = 1 \text{ , } \frac{1}{2} \frac{\partial ^2 p}{\partial z} = 1 $$
And if we subtract the two of them, we get 0.
So we're done.
So this is the answer.
Let's do one more exercise.
\subsection*{Exercise}
Slightly different version of the one that we did in lecture.
But now, don't refer back to the lecture.
Just take a look at what we've done for the integrals.
And do this one yourself.
So what I'd like to do is introduce the Gaussian
cumulative distribution function,
which is going to be useful and show up in a few places.
I will call this $\Phi(x)$.
It's going to be defined as:
$$ \Phi(x) = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{x} e^{-z^2/2} dz = Prob(Z<x) $$
So I compute the left side of the integral
of the bell curve for the Gaussian distribution
up to some point $x$.
So in terms of Gaussian probabilities,
this is the same thing as the probability
that a Gaussian random variable $Z$ is less
than some particular value $x$.
Now, from the fundamental theorem of calculus of course,
I know that :
$$ \frac{d}{dx}\Phi(x) = \frac{1}{\sqrt{2 \pi}} e^{-x^2/2} $$
So I can differentiate or I can integrate.
I can go back and forth.
But this basic idea that it's an incomplete integral.
So I integrate from minus infinity
up to a particular value $x$ that's defined out here.
It's going to be useful, and we'll
see that it shows up in a bunch of places.
Here's a really simple example.
\begin{equation*}
f(w) =
\begin{cases}
1 & \text{if $w<\kappa$ }\\
0 & \text{if $w>\kappa$}
\end{cases}
\end{equation*}
$ f(w) = p(w,0)$ find $p(z,t)$
So the question is, find $p(z,t)$,
So at time 0, it's a step function.
It's either 0 or 1 depending on the value of its argument.
So what we'd like to do is, we want to find $p(z,t)$
for the general case.
So take a moment, see if you can work it out
from our general definition.
Remember that our definition is, we integrate $p_0$
against $p_0$ evaluated at $z-2$ against the function $f(w)$.
And we integrate that over $w$ in an explicit expression
in terms of $z$.
Go take a moment to do that.
And then, we'll take a look at this together.
OK?
Let's go.
Let's just work from the definition.
The reason why this is particularly nice
is the integrand is either 1 or 0.
So there's an interesting generalization
that's important for the Black-Scholes case, where
we might-- instead of 1 or 0, we might
like to let it be 0 in the lower case, but $\kappa-w$
in the upper case.
So after you've done this one, I'd
suggest trying that one as an extension.
But this one's fairly straightforward.
So let's do this one together just
to make sure we've got the concepts and our definitions
of the integral.
So this is going to be:
$$ p(z,t) = \int_{-\infty}^{\kappa} \frac{1}{\sqrt{2 \pi t}} e^{-\frac{(z-w)^2}{2t}} dw $$
$$ \text{let } u = \frac{w-z}{\sqrt{t}} \implies du = \frac{dw}{\sqrt{t}}$$
In addition, our upper limit of integration is $w=\kappa$.
And that's going to translate into an upper limit of
$$u* = \frac{\kappa-z}{\sqrt{t}} $$
So, now we have:
\begin{equation*}
\begin{split}
p(z,t) &= \int_{-\infty}^{\frac{\kappa-z}{\sqrt{t}}} \frac{1}{\sqrt{2 \pi }} e^{-\frac{u^2}{2}} du \\
&= \Phi \Big(\frac{\kappa-z}{\sqrt{t}} \Big)
\end{split}
\end{equation*}
Which is a very well behaved function
for positive values of $t$.
And it would be interesting to take a look
and plot this as t goes to 0.
But right now, we have the result that we saw it.
And we can check this, again, by differentiating and putting it
into the differential equation, and verifying that it satisfies
the equation, and verifying that it
satisfies the initial conditions a $t$ equals 0.
Which as I said, it requires taking a limit,
because we can't immediately set $t$ equals 0
in this case in the way we did previously.
\end{document} | {
"alphanum_fraction": 0.6590489937,
"avg_line_length": 31.4924242424,
"ext": "tex",
"hexsha": "e8468305a2e9910489b031cfbea6b9ff21d73301",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "22f7a84879c04d44de40467ddcc0f6e551b812c7",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "j053g/cheatsheets",
"max_forks_repo_path": "15.455x/recitation_05.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "22f7a84879c04d44de40467ddcc0f6e551b812c7",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "j053g/cheatsheets",
"max_issues_repo_path": "15.455x/recitation_05.tex",
"max_line_length": 209,
"max_stars_count": 6,
"max_stars_repo_head_hexsha": "22f7a84879c04d44de40467ddcc0f6e551b812c7",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "j053g/cheatsheets",
"max_stars_repo_path": "15.455x/recitation_05.tex",
"max_stars_repo_stars_event_max_datetime": "2022-01-07T17:26:15.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-12-14T08:49:07.000Z",
"num_tokens": 4073,
"size": 12471
} |
%!TEX root = ../thesis.tex
\section{Conclusions}
% Based on https://www.scribbr.com/dissertation/write-conclusion/
In this work I developed a distributed system which automates simulation-based testing of \glspl{av}.
Therefore it presents a formalization of test cases and explains all relevant strategies to generate simulations, handle simulator instances, evaluate test criteria during simulation executions, distribute simulation executions over a cluster and implement the communication between the components of \drivebuild{} and clients.
Its evaluation works with students as users of \drivebuild{} and utilizes their implementations of test generators and \glspl{ai}.
It showed that \drivebuild{} is able to cope with all these various approaches.
Further \drivebuild{} provides all metrics that either the implementations require to operate or the evaluation requires to analyze them.
Since the number of available test generators and \glspl{ai} is low and the quality of some of them is not as good as expected the metrics to analyze them yielded not as much interesting information as they could.
So future evaluation should consider even more test generators and \glspl{ai} (\eg{} \gls{dave}~\cite{dave}).
The evaluation also illustrates that \drivebuild{} is able to distribute test executions among a cluster and handle simulations and \glspl{av} in parallel.
Further it reveals that the performance when running \glspl{simnode} in \glspl{vm} on a shared cluster is very bad.
Research on the causes that affect the performance issues requires much more test executions and dedicated hardware resources.
Based on the experience which the evaluation yields possible causes may be low reliability of the low level socket communication or the fact that the hardware is virtualized.\\
However, there are already seminar courses at the university of Passau which use \drivebuild{} to test \glspl{ai}.
Further there is an ongoing discussion with researchers at the \enquote{Université du Québec à Chicoutimi, Canada} about integrating their event stream processing into \drivebuild{} to implement runtime verification and real-time monitoring.
Also at the \gls{zhaw} there is a thesis about testing \glspl{av} which utilizes \drivebuild{}.
| {
"alphanum_fraction": 0.8104138852,
"avg_line_length": 124.8333333333,
"ext": "tex",
"hexsha": "a4e1734df3d3ae206ec57396188ff158478661ea",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "TrackerSB/MasterThesis",
"max_forks_repo_path": "thesis/sections/conclusions.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "TrackerSB/MasterThesis",
"max_issues_repo_path": "thesis/sections/conclusions.tex",
"max_line_length": 327,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "2792203d28d6c7b62f54545344ee6772d2ec5b64",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "TrackerSB/MasterThesis",
"max_stars_repo_path": "thesis/sections/conclusions.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 469,
"size": 2247
} |
\documentclass[]{article}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}
\setlength\parindent{0pt}
\usepackage{physics}
% \usepackage{amsmath}
\usepackage{listings}
\usepackage{enumitem}
\renewcommand{\theenumi}{\alph{enumi}}
%opening
\title{MATH 5301 Elementary Analysis - Homework 1}
\author{Jonas Wagner}
\date{2021, September 01}
\begin{document}
\maketitle
\section{Problem 1}
\textbf{Problem:}
Prove the following tautologies by writing the true-false table.
Also translate each of these statements into human language.
\begin{enumerate}
\item $A \lor \sim A$
\item $(A \lor B) \Rightarrow A$
\item $(A \land B) \Rightarrow A$
\item $(A \Rightarrow B) \iff (\sim B \Rightarrow \sim A)$
\item $\sim (A \lor B) \iff (\sim A \land \sim B)$
\item $((A \Rightarrow B) \Rightarrow A) \Rightarrow A$
\item $(A \Rightarrow (B \Rightarrow C)) \Rightarrow ((A \Rightarrow B) \Rightarrow (A \Rightarrow C))$
\end{enumerate}
\textbf{Solution:}\\
\begin{figure}[h]
\centering
\includegraphics*[width=0.7\textwidth]{fig/pblm1.png}
\end{figure}
\begin{enumerate}
\item A or not A
\item A or B implies A
\item A and B implies A
\item A implying B implies not B implying not A
\item Neither A nor B occurs if and only if not A and not B
\item A implying B implies A which implies A
\item A implying B implies C implies that A implying B implies A implying C
\end{enumerate}
\newpage
\section{Problem 2}
\textbf{Problem:}
Prove the following identities for the set operations.
\begin{enumerate}
\item $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$
\item $(A \backslash B) \cup C = ((A \cup C) \backslash B) \cup (B \cap C)$
\end{enumerate}
\textbf{Solution:}
\begin{figure}[h]
\centering
\includegraphics*[width = \textwidth]{fig/pblm2a.png}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics*[width = \textwidth]{fig/pblm2b.png}
\end{figure}
\newpage
\section{Problem 3}
\textbf{Problem:}
Write the following statements using quantifiers.
\begin{enumerate}
\item Even elements of the sequence $\{a_n\}$ may be arbitrarly large.
\item The sequence $\{a_n\}$ contains arbitary large even elements.
\item The sequence $\{a_n\}$ contains infinitely many even elements.
\end{enumerate}
\textbf{Solution:}
\begin{enumerate}
\item $\forall n \in \mathbf{N} : a_n \ \vdots \ 2 \Rightarrow \exists a \in \mathbf{N} : a_n \geq a$
\item $\exists n \in \mathbf{N} : a_n \ \vdots \ 2 \Rightarrow \forall a \in \mathbf{N} : a_n > a$
\item $\forall n \in \mathbf{N} : a_n \ \vdots \ 2 : \exists m \in \mathbf{N} : m > n : a_m \ \vdots \ 2$
\end{enumerate}
\newpage
\section{Problem 4}
\textbf{Problem:}
Show that:
\begin{enumerate}
\item $\exists_x : (p(x) \lor q(x)) \iff (\exists_x : p(x)) \lor (\exists_x : q(x))$
\item $(\forall_x p(x) \lor \forall_x q(x)) \Rightarrow \forall_x (p(x) \lor q(x))$
\item Why is there no left arror implication on the previous line?
\end{enumerate}
\textbf{Solution:}\\
Part a)
\begin{figure}[h]
\centering
\includegraphics[width = \textwidth]{fig/pblm4a.png}
\end{figure}
Part b)
\begin{figure}[h]
\centering
\includegraphics[width = \textwidth]{fig/pblm4b.png}
\end{figure}
Part c)\\
This is becouse there are cases when $p(x)$ and $q(x)$ themselves are not
satisfied $\forall x$, but together at least one of them are true $\forall x$.
\newpage
\section{Problem 5}
\textbf{Problem:}
Show that one needs only one logic operation to construct all the 16 binary operations on statements A and B.\\
Define $A \star B$ via the following table:
\includegraphics[width=0.3\textwidth]{fig/pblm5_star_TF_table.png}
Show that one can construct $\sim A, A \lor B, $and$ A \land B$ using only $\star$.
Then show that any other binary operation can be obtained from $\{\sim, \lor, \land\}$.\\
\textbf{Solution:}
\begin{figure}[h]
\centering
\includegraphics[width=0.7\textwidth]{fig/pblm5_star2op_soln.png}
\includegraphics[width=0.9\textwidth]{fig/pblm5_star2op_table.png}
\end{figure}
\newpage
(using the notation learned in digital circuits)\\
\includegraphics[width=\textwidth]{fig/pblm5_op2all_soln.png}
\newpage
\section{Problem 6}
\textbf{Problem:}
How many subsets does the set $A = \{a,p,p,l,e\}$ have?
\textbf{Solution:}
On the surface this problem can be solved simply by considering the selection of
each letter to be a part of a subset as a binary diget of T/F for inclusion,
resulting in $2^n = 2^5 = 32$.
However, due to the repeaterd element, $p$, this is not as simple but a similar
combinatorics proccess can be used to account for this.\\
\textbf{General Solution:}\\
Let the following be defined:\\
$n :=$ number of elements within $A$\\
$m :=$ number of unique elements within $A$\\
${a_i} :=$ sequence of the unique elements within $A$ ordered from
the most occuring to the least occuring\\
${n_i} :=$ sequence of the number of unique elements, $a_i$, within $A$.\\
${(a_i,n_i)} := $ set of ordered pairs of unique elements of a unique
element, $a_i$, within $A$ paired with the number of $a_i$ elements contained
within $A$, $n_i$.\\
The calculation can split into the sum of all the possible subsets of lengths, $l$,
from 0 to n.\\
For $l=0$ the only possible subset is $\emptyset$,
so $$N_0 = \mqty(n \\ 0) = 1.$$
Similarily, for $l=n$ the only possible subset of $A$ is $A$,
so $$N_n = \mqty(n \\ n) = 1.$$
For $l=1$ there exists $m$ unique sets consisting of the elements in $\{a_i\}$.
Alternativly, this can be calculated as
$$N_1 = \mqty(n\\1) - \sum_{i=1}^m (n_i - 1)$$.
For $l=2$ (and all $l>1$) the computation becomes more complicated.\\
The collection of subsets with repeated elements for $l=2$ would be all possible
combinations of the elements of $A$ with $l=2$ elements, $\qty(N_{l=2}^{(all)} = \mqty(n\\2))$.\\
The number of duplicated elements can be done by constructing the ordered pairs
$\{(b_i,n_i-1)\}: b_i = a_i \forall i : n_i > 1$. $B$ can then be defined as the collection
of $n_i - 1$ copies of $b_i$. \footnote{How do you do this with quantifiers?}\\
The number of elements in $B$, $n^{(l=2)}$ can then be used to determine the number of duplicated
subsets included in $N_{l=2}^{(all)}$, $N_{l=2}^{(duplicates)} = n^{(l=2)} * N_{l=1}$. Therefore,
$$N_{l=2} = N_{l=2}^{(all)} - N_{l=2}^{(duplicates)}
= \mqty(n\\2) - n^{(l=2)} * N_{l=1}
= \mqty(n\\2) - n^{(l=2)} * \qty(\mqty(n\\1) - \sum_{i=1}^m (n_i - 1))$$
This proccess can be repeated for $l > 2$ until the newly constructed set (labeled $B$ for $l=2$) is empty,
in which case $N_{l} = \mqty(n\\l)$.\\
For the given finite case of $A = \{a,p,p,l,e\}$ the result is calculated as:
\begin{align*}
N_0 &= 1\\
N_1 &= 4\\
N_2 &= 13\\
N_3 &= 6\\
N_4 &= 4\\
N_5 &= 1\\
\intertext{Therefore,}
N &= 29
\end{align*}
% One solution is to define the ordered pairs
% $\{(b_i,n_i-1)\}: b_i = a_i \forall i : n_i > 1$.
% The new sequence, $\{b_i\}$ can then be used to add the nessicary
% extra repeated element subsets.
% Additionally, let the number of elements within sequence $\{b_i\}$
% be defined as $m_2$.
% The collection of subsets with $l=2$ would be all possible combinations of
% $a_i$, $\qty(N_{l=2}^{(all)} = \mqty(n\\2))$, minus the number of repeated
% subsets constructed with ${b_i,a_j} \forall i \in \{1,2,\cdots,m_2\},
% j \in \{1,2,\cdots,m_2\}$, $\qty(N_{l=2}^{(duplicates)} = m_2 * m)$. Therefore,
% $$N_2 = \mqty(m\\2) - m_2.$$
% Next, this proccess can be repeated for $2 < l < n$, such that a new set of
% ordered pairs is defined, $\{c_i, n + (l-1)\} : c_i = a_i \forall n > (l-1)$,
% and then the number of subsets with $l$ elements is calculated as
% the sum of all possible combinations of the elements of $A$ of length $l$,
% $\qty(N_{l}^{(all)} = \mqty(n\\2))$, minus the number of repeated subsets
% constructed with ${c_i,\cdots,b_j,a_k} \forall i \in \{1,2,\cdots,m_l\},
% \cdots, j \in \{1,2,\cdots,m_2\}, k \in \{1,2,\cdots,m\}$,
% $\qty(N_l)^{(duplicates)} = m_l * \cdots * m_2 * m$. Therefore,
% $$N_l = \mqty(n\\l) - m_l * \cdots * m_2 * m.$$
% The total number of possible subsets can then be calculated as the sum
% $$N = \sum_{l=1}^{n} N_l = \sum_{l=1}^n \mqty(n\\l) - \prod_{1}^{l} m_l$$
% Note: I am not overly confident of how well this scales when it grows
% larger then I actually tested it at...
\end{document}
| {
"alphanum_fraction": 0.6737083535,
"avg_line_length": 33.9508196721,
"ext": "tex",
"hexsha": "f2b4db9dc8f1bf5cf820a7f423b140b2577c539e",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "40de090ba1a936b406aa8d4c4383be2cf1418f29",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "jonaswagner2826/MATH5301",
"max_forks_repo_path": "Homework/HW1/MATH5301-HW1.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "40de090ba1a936b406aa8d4c4383be2cf1418f29",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "jonaswagner2826/MATH5301",
"max_issues_repo_path": "Homework/HW1/MATH5301-HW1.tex",
"max_line_length": 111,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "40de090ba1a936b406aa8d4c4383be2cf1418f29",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "jonaswagner2826/MATH5301",
"max_stars_repo_path": "Homework/HW1/MATH5301-HW1.tex",
"max_stars_repo_stars_event_max_datetime": "2021-10-01T05:26:53.000Z",
"max_stars_repo_stars_event_min_datetime": "2021-10-01T05:26:53.000Z",
"num_tokens": 2859,
"size": 8284
} |
% Template for ISBI paper; to be used with:
% spconf.sty - ICASSP/ICIP LaTeX style file, and
% IEEEbib.bst - IEEE bibliography style file.
% --------------------------------------------------------------------------
\documentclass{article}
\usepackage{spconf,amsmath,graphicx, booktabs, xcolor}
\usepackage{amsmath,amssymb}
\usepackage{upgreek}
% Example definitions.
% --------------------
\def\x{{\mathbf x}}
\def\L{{\cal L}}
\newcommand{\tr}[1]{{#1}^\top}
\renewcommand{\vec}[1]{\mathbf{#1}}
\newcommand{\mr}[1]{\mathrm{#1}}
\newcommand{\tx}[1]{\textrm{#1}}
\newcommand{\yy}{\vec{y}}
\newcommand{\xx}{\vec{x}}
\newcommand{\zz}{\vec{z}}
\newcommand{\sss}{\vec{s}}
\newcommand{\xnorm}{\widehat{\vec{x}}}
%\DeclareMathOperator*{\Expect}{\mathbb{E}}
\newcommand{\expect}{\mathbb{E}}
\newcommand{\XX}{\mathcal{X}}
\newcommand{\YY}{\mathcal{Y}}
\newcommand{\data}{\mathcal{D}}
\newcommand{\real}{\mathbb{R}}
\newcommand{\loss}{\mathcal{L}}
\newcommand{\lossSeg}{\loss_{\mr{seg}}}
\newcommand{\lossDis}{\loss_{\mr{dis}}}
\newcommand{\img}{\Upomega}
\newcommand{\params}{\uptheta}
\usepackage{todonotes}
\newcommand{\pierreluc}[1]{\todo[fancyline,backgroundcolor=green!25,bordercolor=green]{Pierre-Luc says: #1}}
\newcommand{\herve}[1]{\todo[fancyline,backgroundcolor=red!25,bordercolor=red]{Herv\'{e} says: #1}}
\newcommand{\chris}[1]{\todo[fancyline,backgroundcolor=blue!25,bordercolor=blue]{Chris says: #1}}
\newcommand{\karthik}[1]{\todo[fancyline,backgroundcolor=black!25,bordercolor=black]{Kart says: #1}}
\newcommand*{\textred}{\textcolor{red}}
\newcommand*{\textblue}{\textcolor{blue}}
\newcommand*{\textgreen}{\textcolor{green}}
\renewcommand{\baselinestretch}{0.96}
% Title.
% ------
\title{ADVERSARIAL NORMALIZATION FOR MULTI DOMAIN IMAGE SEGMENTATION}
%
% Single address.
% ---------------
% \name{Pierre-Luc Delisle, Benoit Anctil-Robitaille, Christian Desrosiers, Herve Lombaert
% \thanks{Thanks to NSERC for funding.}}
% \address{Ecole de technologie sup\'{e}rieure, Montreal, Canada}
\name{Pierre-Luc Delisle, Benoit Anctil-Robitaille, Christian Desrosiers, Herve Lombaert}
\address{ETS Montreal, Canada}
%
% For example:
% ------------
%\address{School\\
% Department\\
% Address}
%
% Two addresses (uncomment and modify for two-address case).
% ----------------------------------------------------------
%\twoauthors
% {A. Author-one, B. Author-two\sthanks{Thanks to XYZ agency for funding.}}
% {School A-B\\
% Department A-B\\
% Address A-B}
% {C. Author-three, D. Author-four\sthanks{The fourth author performed the work
% while at ...}}
% {School C-D\\
% Department C-D\\
% Address C-D}
%
% More than two addresses
% -----------------------
% \name{Author Name$^{\star \dagger}$ \qquad Author Name$^{\star}$ \qquad Author Name$^{\dagger}$}
%
% \address{$^{\star}$ Affiliation Number One \\
% $^{\dagger}$}Affiliation Number Two
%
\begin{document}
\maketitle
\begin{abstract}
Image normalization is a critical step in medical imaging. This step is often done on a per-dataset basis, preventing current segmentation algorithms from the full potential of exploiting jointly normalized information across multiple datasets.
To solve this problem, we propose an adversarial normalization approach for image segmentation which learns common normalizing functions across multiple datasets while retaining image realism. The adversarial training provides an optimal normalizer that improves both the segmentation accuracy and the discrimination of unrealistic normalizing functions. Our contribution therefore leverages common imaging information from multiple domains. The optimality of our common normalizer is evaluated by combining brain images from both infants and adults. Results on the challenging iSEG and MRBrainS datasets reveal the potential of our adversarial normalization approach for segmentation, with Dice improvements of up to 59.6\% over the baseline.
\end{abstract}
%
\begin{keywords}
Task-driven intensity normalization, brain segmentation.
\end{keywords}
\section{Introduction}
\label{sec:intro}
In medical imaging applications, datasets with annotated images are rare and often composed of few samples. This causes an accessibility problem for developing supervised learning algorithms such as those based on deep learning. Although these algorithms have helped in automating image segmentation, notably in the medical field \cite{Kamnitsas2017,Dolz2019}, they need a massive number of training samples to obtain accurate segmentation masks that generalize well across different sites. One possible approach to alleviate this problem would be to use data acquired from multiple sites to increase the generalization performance of the learning algorithm. However, medical images from different datasets or sites can be acquired using various protocols. This leads to a high variance in image intensities and resolution, increasing the sensitivity of segmentation algorithms to raw images and thus impairing their performance.
\begin{figure}[h]
%\includegraphics[width=\linewidth]{graphics/gen_seg_3.pdf}
\includegraphics[width=\linewidth]{graphics/gen_seg_4.pdf}
\caption{Mixed iSEG and MRBrainS inputs (\textbf{left}) and images generated with two pipelined FCNs without constraint on realism using only Dice loss (\textbf{right}). Images generated with only Dice loss preserve the structure required for segmentation but lack realism.}
\label{fig1}
\end{figure}
\begin{figure*}[h]
\begin{center}
\includegraphics[width=\linewidth, height=5.50cm, keepaspectratio]{graphics/Figure_a-8.pdf}
\caption{Proposed architecture. A first FCN generator network (G) takes a non-normalized patch and generates a normalized patch. The normalized patch is input to a second FCN segmentation network (S) for proper segmentation. Discriminator (D) network apply the constraint of realism on the normalized output. The algorithm learns the optimal normalizing function based on the observed differences between input datasets.}
\end{center}
\end{figure*}
Recently, the problems of image normalization and learned pre-processing of medical images have generated a growing interest. In \cite{RN23}, it was shown that two consecutive fully-convolutional deep neural networks (FCN) can normalize an input prior to segmentation. However, the intermediary synthetic images produced by forward pass on the first fully-convolutional network lack interpretability as there is no constrain on the realism of produced images (see Fig. \ref{fig1}). Also, a limitation of this previous work is the separate processing of 2-D slices of volumetric data, which does not take into account the valuable 3-D context of this data. The study in \cite{Onofrey2019} analyzed multi-site training of deep learning algorithms and compared various traditional normalization techniques such as histogram matching \cite{Shapira2013MultipleHM} or Gaussian standardization across different datasets. However, these standard normalization techniques are not learned for a specific task, certainly leading to suboptimal results compared to a task-driven normalization approach. Gradient reversal layer based domain adaptation and layer-wise domain-adversarial networks are used in \cite{Ciga2019} but this method is limited to two domains.
This paper extends medical image normalization so that the normalized images remain realistic and interpretable by clinicians. Our method also leverages information from multiple datasets by learning a joint normalizing transformation accounting for large image variability. We propose a task-and-data-driven adversarial normalization technique that constrains the normalized image to be realistic and optimal for the image segmentation task. Our approach exploits two fully-convolutional 3-D deep neural networks \cite{RN10}. The first acts as a normalized image generator, while the second serves as segmentation network. This paper also includes a 3-D discriminator \cite{RN12} network that constrains the generator to produce interpretable images. Standard generative adversarial networks (GANs) \cite{Goodfellow2014} aim at classifying generated images as fake or real. Our discriminator rather acts as a domain classifier by distinguishing images between all input domains (i.e. a dataset which has been sampled with a specific protocol at a specific location) including an additional ``generated'' one. Hence, produced images are both realistic and domain invariant. The parameters of all three networks are learned end-to-end.
Our contributions can be summarized as follows: 1) an adversarially-constrained 3-D pre-processing and segmentation technique using fully-convolutional neural networks which can train on more than one dataset, 2) a learned normalization network for medical images which produces images that are realistic and interpretable by clinicians. The proposed method yields a significant improvement in segmentation performance over using a conventional segmentation model trained and tested on two different data distributions which haven't been normalized by a learning approach. To the best of our knowledge this is the first work using purely task-and-data driven medical image normalization while keeping the intermediary image medically usable.
\begin{table*}[t!]
\centering
\begin{small}
\begin{tabular}{r*{6}{c}}
\toprule
& & & & \multicolumn{3}{c}{Dice} \\
\cmidrule(lr){5-7}
Exp. \# & Method & Train dataset & Test dataset & CSF & GM & WM \\
\midrule
1 & No adaptation & iSEG & iSEG & 0.906 & 0.868 & 0.863 \\
2 & No adaptation & MRBrainS & MRBrainS & 0.813 & 0.789 & 0.839 \\
3 & No adaptation, Cross-testing & iSEG & MRBrainS & 0.401 & 0.354 & 0.519 \\
4 & No adaptation, Cross-testing & MRBrainS & iSEG & 0.293 & 0.082 & 0.563 \\
\midrule
5 & Standardized & iSEG + MRBrainS & iSEG + MRBrainS & 0.849 & 0.808 & 0.809 \\
& & Standardized & Standardized & & & \\
6 & Without constraint & iSEG + MRBrainS & iSEG + MRBrainS & 0.834 & 0.859 & 0.885 \\
7 & {\textbf{Adversarially normalized (ours)}} & iSEG + MRBrainS & iSEG + MRBrainS & \textbf{0.919} & \textbf{0.902} & \textbf{0.905} \\
\bottomrule
\end{tabular}
\end{small}
\caption{Dice score in function of the model architecture and data. The proposed method yielded a significant performance improvement over training and testing on single-domain or on standardized inputs.}\label{tlc}
\end{table*}
\section{Method}
Let $\xx \in \real^{|\img|}$ be a 3-D image, where $\img$ is the set of voxels, and $\yy \in \{0,1\}^{|\img| \times C}$ be its segmentation ground truth with pixel labels in $\{1, \ldots, C\}$. The training set $\data = \{(\xx_i, \yy_i, z_i) \, | \, i = 1, \ldots, M\}$ contains $M$ examples, each composed of an image $\xx_i$, a manual expert segmentation $\yy_i$ and an image domain label $z_i \in \{1, \ldots, K\}$. As shown in Fig. 2, the proposed model is composed of three networks. The first network $G$ is a fully-convolutional network. A 3-D U-Net architecture, without loss of generality, has been chosen for its simplicity. This network transforms an input image $\xx$ into a cross-domain normalized image $\xnorm = G(\xx)$. The second network $S$, which is also a 3-D FCN, receives the normalized image as input and outputs the segmentation map $S(\xnorm)$. The third network $D$ is the discriminator which receives both raw images and normalized images as input and predicts their domain. Network $D$ learns a $(K\!+\!1)$-class classification problem, with one class for each raw image domain and a $(K\!+\!1)$-th class for generated images of any domain. As mentioned before, the discriminator is used to ensure that images produced by $G$ are both realistic and domain invariant.
The three networks of our model are trained together in an adversarial manner by optimizing the following loss function:
\begin{align}\label{eq:total_loss}
& \min_{G,S} \max_{D} \ \loss(G, S, D) \ = \ \sum_{i=1}^{M} \lossSeg \big(S(G(\xx_i)), \yy_i\big) \\[-1mm]
& \quad - \ \lambda\left[\sum_{i=1}^{M} \left( \lossDis\big(D(\xx_i), z_i\big) \, + \, \lossDis\big(D(G(\xx_i)), \mr{fake}\big)\right )\right]\nonumber. % adding a comma
\end{align}
For training the segmentation network, we use the weighted Dice loss defined as
\begin{equation}
\lossSeg(\sss,\yy) \ = \ 1 \, - \, \frac{\epsilon \, + \, 2 \sum_{c} w_c \sum_{v \in \img} s_{v,c} \cdot y_{v,c}}{\epsilon \, + \, \sum_{c} w_c \sum_{v \in \img} (s_{v,c} + y_{v,c})}
\end{equation}
where $s_{v,c} \in [0, 1]$ is the softmax output of $S$ for voxel $v$ and class $c$, and $\epsilon$ is a small constant to avoid zero-division. For the discriminator classification loss, we employ the standard log loss. Let $p_D$ be the output class distribution of $D$ following the softmax. For raw (unnormalized) images, the loss is given by
\begin{equation}
\lossDis\big(D(\xx), z\big) \ = \ - \log \, p_D(Z = z \, | \, \xx).
\end{equation}
On the other hand, in the case of generated (normalized) images, the loss becomes
\begin{align}
\lossDis\big(D(G(\xx)), \mr{fake}\big) & \ = \
- \log \, p_D(Z = \mr{fake} \, | \, G(\xx)) \\
& \ = \ - \log \big[1 - p_D(Z \leq K \, | \, G(\xx))\big]\nonumber
\end{align}
As in standard adversarial learning methods, we train our model in two alternating steps, first updating the parameters of $G$ and $S$, and then updating the parameters of $D$.
\section{Experiments and results}
\label{sec:pagestyle}
\subsection{Data}
To evaluate the performance of our method, two databases have been carefully retained for their drastic difference in intensity profile and nature. The first one, iSEG \cite{Wang2019}, is a set of 10 T1 MRI images of infant. The ground truth is the segmentation of the three main structures of the brain: white matter (WM), gray matter (GM) and cerebrospinal fluids (CSF), all three being critical for detecting abnormalities in brain development. Images are sampled into an isotropic 1.0 mm$^3$ resolution.
%
The second dataset is MRBrainS \cite{Mendrik2015} which contains 5 adult subjects with T1 modality. The dataset also contains the same classes as ground truth. Images were acquired following a voxel size of 0.958\,mm $\times$ 0.958\,mm $\times$ 3.0\,mm.
While both datasets have been acquired with a 3 Tesla scanner, iSEG is a set of images acquired on 6-8 month-old infants while MRBrainS is a set of adult images. This implies strong structural differences. Moreover, iSEG is particularly challenging because the images have been acquired during subject's isointense phase in which the white matter and gray matter voxel intensities greatly overlap, thus leading to a lower tissue contrast. This lower contrast is known to misleads common classifiers.
\subsection{Pre-processing and implementation details}
Only T1 images were used in our experiments. Since images in MRBrainS dataset are a full head scan, skull stripping was performed using the segmentation map. Resampling to isotropic 1.0\,mm$^3$ as been done to match iSEG sampling. Overlapping patches of $32^3$ voxels centered on foreground were extracted from full volumes with stride of $8^3$ which yielded 27,647 3-D patches in total for all training images. Each training took 8 hours using distributed stochastic gradient descent on two NVIDIA RTX 2080 Ti GPUs.
\begin{table}[ht!]
\centering
\begin{small}
\begin{tabular}{r*{6}{c}}
\toprule
& & Input data & Normalized images \\
\midrule
& JSD & 3.509 & 3.504 \\
\bottomrule
\end{tabular}
\end{small}
\caption{Jensen-Shannon divergence (JSD) of input and normalized images from the generator. A lower value corresponds to more similar distributions.}\label{tlc}
\end{table}
\begin{figure}[ht!]
\includegraphics[width=\linewidth]{graphics/norm_3_crop.pdf}
\caption{Mixed iSEG and MRBRainS inputs (\textbf{left}) and the generated images with adversarial normalization with $\lambda\!=\!1.0$ (\textbf{right}). Notice the the improved homogeneity of intensities in the normalized images, making their analysis easier.}\label{normalized}
\end{figure}
\begin{figure*}[ht!]
%\includegraphics[width=\linewidth]{graphics/Histograms-3.pdf}
\begin{footnotesize}
\shortstack{\includegraphics[width=.33\linewidth]{graphics/gm.png} \\ GM}
\shortstack{\includegraphics[width=.33\linewidth]{graphics/wm.png} \\ WM}
\shortstack{\includegraphics[width=.33\linewidth]{graphics/csf.png} \\ CSF}
\end{footnotesize}
\caption{Histograms of generator outputs (blue) and unnormalized inputs (red). The intensity range of the generated images for grey matter (GM), white matter (WM) and CSF is more compact, showing a reduced variance in voxel intensities.}\label{histograms}
\end{figure*}
\subsection{Experiment setup}
We split 60\% of the patches for training, while the other 40\% are split in half for validation and testing. Split is done following a stratified shuffle split strategy based on center voxel class. Seven different experimental settings were tested. Baselines for segmentation performance on respectively training and testing on each dataset are done (Exp. 1-2 in Table 1). Cross-domain testing is then done for both dataset (Exp. 3-4). For comparison purpose, we trained a segmentation network with both datasets on which we applied Gaussian standardization (Exp. 5). We also trained two pipelined FCN networks with both datasets at the same time (Exp. 6). We then trained using our method with both datasets (Exp. 7). For each experiment involving the generator network, a Mean-Square Error (MSE) loss is used to initialize weights and produce an output close to real input. Optimum is reached after three epochs. Segmentation Dice loss and discriminator's cross-entropy loss is then added at the beginning of the fourth epoch. Each experiment has been trained with a Stochastic Gradient Descent optimizer with momentum of 0.9 and weight decay of 0.1. All networks have been initialized using Kaiming initialization \cite{He2015}. Generator uses a learning rate of $0.00001$ while segmentation and discriminator networks use $0.0001$. A learning rate scheduler with patience of 3 epochs on validation losses reduces the learning rate of all optimizers by a factor of 10. No data augmentation was applied.
\subsection{Normalization performance}
To evaluate the normalization performance, we used the Jensen-Shannon divergence (JSD) between intensity histograms of images in the validation set. JSD measures the mean KL divergence between a distribution (i.e., histogram) and the average of distributions. Table \ref{tlc} gives the JSD between input images and between images normalized by the generator. We see a decrease in JSD for normalized images showing that the intensity profiles of generated images are more similar to each other. The normalization effect of our method can be better appreciated in Fig. \ref{histograms}. This figure shows a narrower distribution that is more centered around a single mode therefore reducing the intra-class variance and increasing segmentation accuracy. Another benefit of our method is the contrast enhancement it provides to the generated images (Fig. \ref{normalized}). This is mainly brought by our task-driven approach, where minimizing the segmentation loss helps at increasing the contrast along region boundaries.
\subsection{Segmentation performance}
Our method relies on the segmentation task while performing online normalization. Since the Dice loss is being used, structural elements are kept when generating the intermediate image, while cross-entropy aims at keeping the global features of the image while reducing the differences across domains. The main advantage of our method is the ability to train on drastically different datasets regarding to structures and intensity distributions while still maintaining a good segmentation performance. We are effectively performing segmentation of structures on both adults and infant brains at the same time while still achieving 90.8\% of mean Dice score across all classes. This demonstrates the relevance of adding adversarial normalization, increasing the Dice score of up to 59.6\% up in mean segmentation performance over all classes against training on a single dataset and testing on the other one. As seen in Fig. 3, our method is also able to normalize the images while maximizing the segmentation and keeping the image interpretable and realistic. This is achieved by the discriminator's loss which aims at minimizing the cross-entropy between real inputs and generated input up to the point it cannot differentiate anymore from which domain (real iSEG input, real MRBrainS input or generated input) the generator's output comes from.
\section{Conclusion}
We proposed a novel task-and-data-driven normalization technique to improve a segmentation task using two datasets. Our method drastically improves performance on test sets by finding the optimal intermediate representation using the structural elements of the image brought by Dice loss and global features brought by cross-entropy. We believe this work is an important contribution to biomedical imaging as it would unlock the training of deep learning models with data from multiple sites, thus reducing the strain on data accessibility. This increase in data availability will help computing models with higher generalization performance. We also demonstrated that it is still possible with our method to train with different datasets while one of these is particularly difficult because of the lower image contrasts. Future work will aim at using a better model to act as a discriminator or using other training methods such as Wasserstein GAN \cite{Arjovsky2017} or CycleGAN \cite{Zhu2017} to compare performance difference on the image normalization. Our method is also theoretically capable of handling more than two datasets, finding automatically a common intermediate representation between all input domains and adapting voxel intensities to maximize the segmentation performance. Further work will also demonstrate the architecture's performance on new datasets and on the gain this task-driven normalization can provide in case of segmentation tasks with greatly imbalanced data such as brain lesion segmentation.
\medskip
\noindent
\textbf{Acknowledgment} -- This work was supported financially by the Research Council of Canada (NSERC), the Fonds de Recherche du Quebec (FQRNT), ETS Montreal, and NVIDIA with the donation of a GPU.
% \section{TYPE-STYLE AND FONTS}
% \label{sec:typestyle}
% To achieve the best rendering both in the proceedings and from the CD-ROM, we
% strongly encourage you to use Times-Roman font. In addition, this will give
% the proceedings a more uniform look. Use a font that is no smaller than nine
% point type throughout the paper, including figure captions.
% In nine point type font, capital letters are 2 mm high. If you use the
% smallest point size, there should be no more than 3.2 lines/cm (8 lines/inch)
% vertically. This is a minimum spacing; 2.75 lines/cm (7 lines/inch) will make
% the paper much more readable. Larger type sizes require correspondingly larger
% vertical spacing. Please do not double-space your paper. True-Type 1 fonts
% are preferred.
% The first paragraph in each section should not be indented, but all the
% following paragraphs within the section should be indented as these paragraphs
% demonstrate.
% \section{MAJOR HEADINGS}
% \label{sec:majhead}
% Major headings, for example, "1. Introduction", should appear in all capital
% letters, bold face if possible, centered in the column, with one blank line
% before, and one blank line after. Use a period (".") after the heading number,
% not a colon.
% \subsection{Subheadings}
% \label{ssec:subhead}
% Subheadings should appear in lower case (initial word capitalized) in
% boldface. They should start at the left margin on a separate line.
% \subsubsection{Sub-subheadings}
% \label{sssec:subsubhead}
% Sub-subheadings, as in this paragraph, are discouraged. However, if you
% must use them, they should appear in lower case (initial word
% capitalized) and start at the left margin on a separate line, with paragraph
% text beginning on the following line. They should be in italics.
% \section{PRINTING YOUR PAPER}
% \label{sec:print}
% Print your properly formatted text on high-quality, 8.5 x 11-inch white printer
% paper. A4 paper is also acceptable, but please leave the extra 0.5 inch (12 mm)
% empty at the BOTTOM of the page and follow the top and left margins as
% specified. If the last page of your paper is only partially filled, arrange
% the columns so that they are evenly balanced if possible, rather than having
% one long column.
% In \LaTeX, to start a new column (but not a new page) and help balance the
% last-page column lengths, you can use the command ``$\backslash$pagebreak'' as
% demonstrated on this page (see the \LaTeX\ source below).
% \section{PAGE NUMBERING}
% \label{sec:page}
% Please do {\bf not} paginate your paper. Page numbers, session numbers, and
% conference identification will be inserted when the paper is included in the
% proceedings.
% \section{ILLUSTRATIONS, GRAPHS, AND PHOTOGRAPHS}
% \label{sec:illust}
% Illustrations must appear within the designated margins. They may span the two
% columns. If possible, position illustrations at the top of columns, rather
% than in the middle or at the bottom. Caption and number every illustration.
% All halftone illustrations must be clear black and white prints. If you use
% color, make sure that the color figures are clear when printed on a black-only
% printer.
% Since there are many ways, often incompatible, of including images (e.g., with
% experimental results) in a \LaTeX\ document, below is an example of how to do
% this \cite{Lamp86}.
% Below is an example of how to insert images. Delete the ``\vspace'' line,
% uncomment the preceding line ``\centerline...'' and replace ``imageX.ps''
% with a suitable PostScript file name.
% -------------------------------------------------------------------------
% To start a new column (but not a new page) and help balance the last-page
% column length use \vfill\pagebreak.
% -------------------------------------------------------------------------
\vfill
\pagebreak
% References should be produced using the bibtex program from suitable
% BiBTeX files (here: strings, refs, manuals). The IEEEbib.bst bibliography
% style file from IEEE produces unsorted bibliography list.
% -------------------------------------------------------------------------
\bibliographystyle{IEEEbib}
\bibliography{refs}
\end{document}
| {
"alphanum_fraction": 0.7556004338,
"avg_line_length": 78.4134897361,
"ext": "tex",
"hexsha": "2c4502f44ae84e32a54134c1644f757bd2d0d0f4",
"lang": "TeX",
"max_forks_count": 1,
"max_forks_repo_forks_event_max_datetime": "2020-05-21T20:52:54.000Z",
"max_forks_repo_forks_event_min_datetime": "2020-05-21T20:52:54.000Z",
"max_forks_repo_head_hexsha": "5ed53280d98a201d45bb9973e79736136273eaea",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "sami-ets/DeepNormalize",
"max_forks_repo_path": "ISBI.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "5ed53280d98a201d45bb9973e79736136273eaea",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "sami-ets/DeepNormalize",
"max_issues_repo_path": "ISBI.tex",
"max_line_length": 1527,
"max_stars_count": 1,
"max_stars_repo_head_hexsha": "5ed53280d98a201d45bb9973e79736136273eaea",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "sami-ets/DeepNormalize",
"max_stars_repo_path": "ISBI.tex",
"max_stars_repo_stars_event_max_datetime": "2020-05-21T20:52:48.000Z",
"max_stars_repo_stars_event_min_datetime": "2020-05-21T20:52:48.000Z",
"num_tokens": 6464,
"size": 26739
} |
\hypertarget{section}{%
\section{1}\label{section}}
\bibleverse{1} Paul, a servant of God, and an apostle of Jesus Christ,
according to the faith of God's elect, and the acknowledging of the
truth which is after godliness; \bibleverse{2} In hope of eternal life,
which God, that cannot lie, promised before the world began;
\bibleverse{3} But hath in due times manifested his word through
preaching, which is committed unto me according to the commandment of
God our Saviour; \bibleverse{4} To Titus, mine own son after the common
faith: Grace, mercy, and peace, from God the Father and the Lord Jesus
Christ our Saviour.
\bibleverse{5} For this cause left I thee in Crete, that thou shouldest
set in order the things that are wanting, and ordain elders in every
city, as I had appointed thee: \bibleverse{6} If any be blameless, the
husband of one wife, having faithful children not accused of riot or
unruly. \bibleverse{7} For a bishop must be blameless, as the steward of
God; not selfwilled, not soon angry, not given to wine, no striker, not
given to filthy lucre; \bibleverse{8} But a lover of hospitality, a
lover of good men, sober, just, holy, temperate; \bibleverse{9} Holding
fast the faithful word as he hath been taught, that he may be able by
sound doctrine both to exhort and to convince the gainsayers.
\bibleverse{10} For there are many unruly and vain talkers and
deceivers, specially they of the circumcision: \bibleverse{11} Whose
mouths must be stopped, who subvert whole houses, teaching things which
they ought not, for filthy lucre's sake. \bibleverse{12} One of
themselves, even a prophet of their own, said, The Cretians are alway
liars, evil beasts, slow bellies. \bibleverse{13} This witness is true.
Wherefore rebuke them sharply, that they may be sound in the faith;
\bibleverse{14} Not giving heed to Jewish fables, and commandments of
men, that turn from the truth. \bibleverse{15} Unto the pure all things
are pure: but unto them that are defiled and unbelieving is nothing
pure; but even their mind and conscience is defiled. \bibleverse{16}
They profess that they know God; but in works they deny him, being
abominable, and disobedient, and unto every good work reprobate.
\hypertarget{section-1}{%
\section{2}\label{section-1}}
\bibleverse{1} But speak thou the things which become sound doctrine:
\bibleverse{2} That the aged men be sober, grave, temperate, sound in
faith, in charity, in patience. \bibleverse{3} The aged women likewise,
that they be in behaviour as becometh holiness, not false accusers, not
given to much wine, teachers of good things; \bibleverse{4} That they
may teach the young women to be sober, to love their husbands, to love
their children, \bibleverse{5} To be discreet, chaste, keepers at home,
good, obedient to their own husbands, that the word of God be not
blasphemed. \bibleverse{6} Young men likewise exhort to be sober minded.
\bibleverse{7} In all things shewing thyself a pattern of good works: in
doctrine shewing uncorruptness, gravity, sincerity, \bibleverse{8} Sound
speech, that cannot be condemned; that he that is of the contrary part
may be ashamed, having no evil thing to say of you. \bibleverse{9}
Exhort servants to be obedient unto their own masters, and to please
them well in all things; not answering again; \bibleverse{10} Not
purloining, but shewing all good fidelity; that they may adorn the
doctrine of God our Saviour in all things. \bibleverse{11} For the grace
of God that bringeth salvation hath appeared to all men, \bibleverse{12}
Teaching us that, denying ungodliness and worldly lusts, we should live
soberly, righteously, and godly, in this present world; \bibleverse{13}
Looking for that blessed hope, and the glorious appearing of the great
God and our Saviour Jesus Christ; \bibleverse{14} Who gave himself for
us, that he might redeem us from all iniquity, and purify unto himself a
peculiar people, zealous of good works. \bibleverse{15} These things
speak, and exhort, and rebuke with all authority. Let no man despise
thee.
\hypertarget{section-2}{%
\section{3}\label{section-2}}
\bibleverse{1} Put them in mind to be subject to principalities and
powers, to obey magistrates, to be ready to every good work,
\bibleverse{2} To speak evil of no man, to be no brawlers, but gentle,
shewing all meekness unto all men. \bibleverse{3} For we ourselves also
were sometimes foolish, disobedient, deceived, serving divers lusts and
pleasures, living in malice and envy, hateful, and hating one another.
\bibleverse{4} But after that the kindness and love of God our Saviour
toward man appeared, \bibleverse{5} Not by works of righteousness which
we have done, but according to his mercy he saved us, by the washing of
regeneration, and renewing of the Holy Ghost; \bibleverse{6} Which he
shed on us abundantly through Jesus Christ our Saviour; \bibleverse{7}
That being justified by his grace, we should be made heirs according to
the hope of eternal life. \bibleverse{8} This is a faithful saying, and
these things I will that thou affirm constantly, that they which have
believed in God might be careful to maintain good works. These things
are good and profitable unto men. \bibleverse{9} But avoid foolish
questions, and genealogies, and contentions, and strivings about the
law; for they are unprofitable and vain. \bibleverse{10} A man that is
an heretick after the first and second admonition reject;
\bibleverse{11} Knowing that he that is such is subverted, and sinneth,
being condemned of himself.
\bibleverse{12} When I shall send Artemas unto thee, or Tychicus, be
diligent to come unto me to Nicopolis: for I have determined there to
winter. \bibleverse{13} Bring Zenas the lawyer and Apollos on their
journey diligently, that nothing be wanting unto them. \bibleverse{14}
And let ours also learn to maintain good works for necessary uses, that
they be not unfruitful. \bibleverse{15} All that are with me salute
thee. Greet them that love us in the faith. Grace be with you all. Amen.
\#\# It was written to Titus, ordained the first bishop of the church of
the Cretians, from Nicopolis of Macedonia.
| {
"alphanum_fraction": 0.7833823049,
"avg_line_length": 60.0588235294,
"ext": "tex",
"hexsha": "ca3864b7139a3fc012f88f2704335f2699746452",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_forks_repo_licenses": [
"CC0-1.0"
],
"max_forks_repo_name": "bibliadelpueblo/BibliaLibre",
"max_forks_repo_path": "Bibles/English.KingJames/out/tex/56-Titus.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"CC0-1.0"
],
"max_issues_repo_name": "bibliadelpueblo/BibliaLibre",
"max_issues_repo_path": "Bibles/English.KingJames/out/tex/56-Titus.tex",
"max_line_length": 72,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "039ab9b18364ecade1d56695cb77c40ee62b1317",
"max_stars_repo_licenses": [
"CC0-1.0"
],
"max_stars_repo_name": "bibliadelpueblo/BibliaLibre",
"max_stars_repo_path": "Bibles/English.KingJames/out/tex/56-Titus.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 1661,
"size": 6126
} |
In this chapter, we will introduce some basic property of approximation theory and analyze the approximation property for some activation functions.
The adaptive FEM we have studied before is indeed using linear
subspaces. For a given and fixed basis, select the best n term to
approximate a function. The non-linear approximation theory (by
DeVore) is to relax the smoothness of function to achieve the optimal
rate $n^{-1/d}$ but won't improve the rate.
\input{6DL/Fourier}
\input{6DL/PolyWeierstrass}
\input{6DL/DNN_Qualitative0}
%\input{6DL/DNN_Qualitative} % this is actually for
%quantitative/asymptotic analysis
\section{Asymptotic approximation properties}
\input{6DL/SampleLemma}
\input{6DL/Representations}
\input{6DL/Barron-L2}
%\input{6DL/Barron-Hk}
\chapter{Optimal approximation estimates for minimally smooth functions}
\input{6DL/Entropy}
\chapter{High order approximation rates for cosine and ReLU$^k$ networks}
The presentation in this section follows the paper \cite{siegel2020high}.
\input{6DL/CosineApprox}
\input{6DL/ReLUkApprox}
\input{6DL/CosineLower}
| {
"alphanum_fraction": 0.7994480221,
"avg_line_length": 38.8214285714,
"ext": "tex",
"hexsha": "6471b9f6443f9615040655a0739080f845c759b0",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "635b6ce53cb792e316abf4f47396f2e4f0686815",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "liuzhengqi1996/math452",
"max_forks_repo_path": "6DL/DNN-Approx.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "635b6ce53cb792e316abf4f47396f2e4f0686815",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "liuzhengqi1996/math452",
"max_issues_repo_path": "6DL/DNN-Approx.tex",
"max_line_length": 148,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "635b6ce53cb792e316abf4f47396f2e4f0686815",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "liuzhengqi1996/math452",
"max_stars_repo_path": "6DL/DNN-Approx.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 296,
"size": 1087
} |
\documentclass[letterpaper]{article}
\usepackage{fullpage}
\usepackage{nopageno}
\usepackage{amsmath}
\usepackage{amssymb}
\allowdisplaybreaks
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\begin{document}
\title{Homework 1}
\date{September 12, 2014}
\author{Jon Allen}
\maketitle
2.4 a(d), b, d, f, g*
2.5 c,d,i*
\renewcommand{\labelenumi}{2.\arabic{enumi}}
\renewcommand{\labelenumii}{\Alph{enumii}.}
\renewcommand{\labelenumiii}{(\alph{enumiii})}
\begin{enumerate}
\setcounter{enumi}{3}
\item
\begin{enumerate}
%2.4A
\item
In each of the following, compute the limit. Then, using $\varepsilon=10^{-6}$, find an integer $N$ that satisfies the limit definition.
\begin{enumerate}
\setcounter{enumiii}{3}
\item
$\displaystyle \lim_{n\to\infty}\frac{n^2+2n+1}{2n^2-n+2}$
\begin{align*}
\lim_{n\to\infty}\frac{n^2+2n+1}{2n^2-n+2}&=\lim_{n\to\infty}\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-\frac{1}{2}n+1}\\
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-\frac{1}{2}n+1+\frac{5}{2}n}&\le
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-\frac{1}{2}n+1}\le
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-\frac{1}{2}n+1-\frac{3}{2}n}\\
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2+2n+1}&\le
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-\frac{1}{2}n+1}\le
\frac{1}{2}\cdot\frac{n^2+2n+1}{n^2-2n+1}\\
\frac{1}{2}&\le
\frac{n^2+2n+1}{2n^2-n+2}\le
\frac{1}{2}\cdot\frac{(n+1)^2}{(n-1)^2}\\
\left\lvert\frac{1}{2}\cdot\frac{(n+1)^2}{(n-1)^2}-\frac{1}{2}\right\rvert&=\frac{1}{2}\cdot\frac{(n+1)^2-(n-1)^2}{(n-1)^2}\\
\left\lvert\frac{1}{2}\cdot\frac{(n+1)^2}{(n-1)^2}-\frac{1}{2}\right\rvert&=\frac{1}{2}\cdot\frac{(n+1)^2-(n-1)^2}{(n-1)^2}\\
&=\frac{1}{2}\cdot\frac{n^2+2n+1-(n^2-2n+1)}{(n-1)^2}\\
&=\frac{1}{2}\cdot\frac{4n}{(n-1)^2}=\frac{1}{2}\cdot\frac{4n}{n^2-2n+1}\\
&=\frac{1}{2}\cdot\frac{1}{\frac{n}{4}-\frac{1}{2}+\frac{1}{4n}}=\frac{1}{\frac{n}{2}-1+\frac{1}{2n}}\\
1&<\frac{n}{2}-1+\frac{1}{2n}\quad\forall n\ge 4\\
\frac{N}{2}-1+\frac{1}{2N}&>\frac{1}{2}\cdot10^k\\
N-2+\frac{1}{N}&>10^k\\
(10^k+2)-2+\frac{1}{10^k+2}&>10^k\\
\intertext{We choose $N=10^k+2$ and $\varepsilon=2\cdot10^-k$}
\left\lvert\frac{1}{2}\cdot\frac{(n+1)^2}{(n-1)^2}-\frac{1}{2}\right\rvert&\le\frac{1}{\frac{10^k+2}{2}-1+\frac{1}{2(10^k+2)}}<2\cdot10^-k\\
\lim_{n\to\infty}\frac{(n+1)^2}{2(n-1)^2}&=\frac{1}{2}
\end{align*}
Using the squeeze theorem we can conclude that $\displaystyle \lim_{n\to\infty}\frac{n^2+2n+1}{2n^2-n+2}=\frac{1}{2}$
Now we find an appropriate value of $N$ for $\varepsilon=10^{-6}$
\begin{align*}
\left\lvert\frac{n^2+2n+1}{2n^2-n+2}-\frac{1}{2}\right\rvert&=
\left\lvert\frac{n^2+2n+1}{2(n^2-\frac{1}{2}n+1)}-\frac{n^2-\frac{1}{2}n+1}{2(n^2-\frac{1}{2}n+1)}\right\rvert\\
&=\left\lvert\frac{\frac{3}{2}n}{2(n^2-\frac{1}{2}n+1)}\right\rvert=\frac{3n}{4[n(n-\frac{1}{2})+1]}\\
\frac{3}{4}\cdot\frac{1}{n-\frac{1}{2}+\frac{1}{n}}&<\frac{1}{10^6}\\
n-\frac{1}{2}+\frac{1}{n}>\frac{3}{4}10^6\\
(\frac{3}{4}10^6+1)-\frac{1}{2}+\frac{1}{\frac{3}{4}10^6+1}>\frac{3}{4}10^6
\end{align*}
Looks like a good value for $N$ is $\frac{3}{4}10^6+1$ or 750001.
\end{enumerate}
%2.4B
\item
Show that $\displaystyle \lim_{n\to\infty}\sin\frac{n\pi}{2}$ does not exist using the definition of limit.
Note:
\begin{gather*}
\sin\frac{(n+4)\pi}{2}=\sin\left(\frac{n\pi}{2}+2\pi\right)=\sin\frac{n\pi}{2}\cos 2\pi+\cos\frac{n\pi}{2}\sin 2\pi=\sin\frac{n\pi}{2}\\
\sin\frac{(4k+a)\pi}{2}=\sin\left(2\pi k+\frac{a\pi}{2}\right)=\sin(2\pi k)\cos\frac{a\pi}{2}+\cos(2\pi k)\sin\frac{a\pi}{2}=\sin\frac{a\pi}{2}
\end{gather*}
We only need to look at four cases: $n=0, n=1, n=2, n=3$. I forget whether we defined $\mathbb{N}$ to include zero on that first day, but lets just include it here today. So the four values that $\left\lvert\sin\frac{n\pi}{2}-\sin\frac{(n+1)\pi}{2}\right\rvert$ can be are:
\begin{align*}
n=0&\to
\left\lvert\sin 0-\sin\frac{\pi}{2}\right\rvert=1\\
n=1&\to
\left\lvert\sin\frac{\pi}{2}-\sin \pi\right\rvert=1\\
n=2&\to
\left\lvert\sin\pi-\sin\frac{3\pi}{2}\right\rvert=1\\
n=3&\to
\left\lvert\sin\frac{3\pi}{2}-\sin2\pi\right\rvert=1\\
\end{align*}
Now we notice that
\[\left\lvert a_n-L\right\rvert+\left\lvert a_{n+1}-L\right\rvert\ge \left\lvert(a_n-L)-(a_{n+1}-L)\right\rvert=\left\lvert a_n-a_{n+1}\right\rvert=1\]
Lets choose $\varepsilon=\frac{1}{2}$. Then $|a_n-L|<\frac{1}{2}$
\begin{align*}
\left\lvert a_n-L\right\rvert+\left\lvert a_{n+1}-L\right\rvert&<\frac{1}{2}+\left\lvert a_{n+1}-L\right\rvert\\
\left\lvert a_n-a_{n+1}\right\rvert&<\frac{1}{2}+\left\lvert a_{n+1}-L\right\rvert\\
1&<\frac{1}{2}+\left\lvert a_{n+1}-L\right\rvert\\
\frac{1}{2}&<\left\lvert a_{n+1}-L\right\rvert\\
\end{align*}
Which is a problem because if $|a_n-L|<\frac{1}{2}$ then since $n+1>n\ge N$ we should have $|a_{n+1}-L|<\frac{1}{2}$ not the other way around. We must not have a limit. $\Box$
\setcounter{enumii}{3}
%2.4D
\item
Prove that if $\displaystyle L=\lim_{n\to\infty}a_n$, then $\displaystyle L=\lim_{n\to\infty}a_{2n}$ and $\displaystyle L=\lim_{n\to\infty}a_{n^2}$.
\begin{align*}
\left\lvert a_n-L\right\rvert&<\varepsilon\quad\forall n\ge N
\end{align*}
because $2n\ge n\quad\forall n\in\mathbb{N}$ we have $2n\ge n\ge N$ and therefore $\left\lvert a_{2n}-L\right\rvert<\varepsilon$. The argument is exactly the same for $n^2$ because $n^2\ge n\ge N$
\setcounter{enumii}{5}
%2.4F
\item
Define a sequence $\left(a_n\right)_{n=1}^\infty$ such that $\displaystyle \lim_{n\to\infty}a_{n^2}$ exists but $\displaystyle \lim_{n\to\infty}a_n$ does not exist.
\[a_n=\left\lfloor\frac{\lfloor\sqrt{n}\rfloor}{\sqrt{n}}\right\rfloor\]
%2.4G
\item
Suppose that $\displaystyle \lim_{n\to\infty}a_n=L$ and $L\ne0$. Prove there is some $N$ such that $a_n\ne0$ for all $n\ge N$.
\subsubsection*{proof}
We know that there is some $N$ such that $|a_n-L|<\varepsilon$ for all $0<\varepsilon, n\ge N$. This is equivalent to $L-\varepsilon<a_n<L+\varepsilon$.
We have two cases. $L>0$ and $L<0$. If $L>0$ then we choose $\varepsilon=L$ and $0=L-L<a_n<L+L$. Because $0<a_n$ it is safe to say $a_n\ne0$ I think. If $L<0$ then we choos $\varepsilon=-L$ which leads to $L+L<a_n<L-L=0$. Now again, because $a_n<0$ we can say $a_n\ne0$. $\Box$
\end{enumerate}
\item
\begin{enumerate}
\setcounter{enumii}{2}
%2.5C
\item
If $\displaystyle \lim_{n\to\infty}a_n=L>0$, prove that $\displaystyle \lim_{n\to\infty}\sqrt{a_n}=\sqrt{L}$. Be sure to discuss the issue of when $\sqrt{a_n}$ makes sense. HINT: Express $|\sqrt{a_n}-\sqrt{L}|$ in terms of $|a_n-L|$
\subsubsection*{proof}
We must specify that $a_n\ge0$. This is after all \emph{real} analysis.
\begin{align*}
\left\lvert a_n-L\right\rvert&<\varepsilon\\
\left\lvert\sqrt{a_n}^2-\sqrt{L}^2\right\rvert&<\varepsilon\\
\left\lvert(\sqrt{a_n}+\sqrt{L})(\sqrt{a_n}-\sqrt{L)}\right\rvert&<\varepsilon\\
\sqrt{a_n}+\sqrt{L}>\sqrt{L}&>0\\
(\sqrt{L})\left\lvert(\sqrt{a_n}-\sqrt{L)}\right\rvert<(\sqrt{a_n}+\sqrt{L})\left\lvert(\sqrt{a_n}-\sqrt{L)}\right\rvert&<\varepsilon\\
\left\lvert(\sqrt{a_n}-\sqrt{L)}\right\rvert&<\frac{\varepsilon}{\sqrt{L}}\\
\end{align*}
Now we can write an arbitrary $\gamma>0,\gamma\in\mathbb{R}$ as $\frac{\varepsilon}{\sqrt{L}}$ where $\epsilon>0,\epsilon\in\mathbb{R}$ and so we have the inequality $\left\lvert(\sqrt{a_n}-\sqrt{L)}\right\rvert<\gamma$ which fits the definition of a limit and proves that $\displaystyle \lim_{n\to\infty}\sqrt{a_n}=\sqrt{L}$. $\Box$
%2.5D
\item
Let $(a_n)_{n=1}^\infty$ and $(b_n)_{n=1}^\infty$ be two sequences of real numbers such that $|a_n-b_n|<\frac{1}{n}$. Suppose that $\displaystyle L=\lim_{n\to\infty}a_n$ exists. Show that $(b_n)_{n=1}^\infty$ converges to $L$ also.
\begin{align*}
b_n-\frac{1}{n}&<a_n<b_n+\frac{1}{n}\\
-\frac{1}{n}-a_n&<-b_n<\frac{1}{n}-a_n\\
\frac{1}{n}+a_n&>b_n>a_n-\frac{1}{n}\\
\lim_{n\to\infty}\left(\frac{1}{n}+a_n\right)&=0+L\\
\lim_{n\to\infty}\left(a_n-\frac{1}{n}\right)&=L-0\\
\lim_{n\to\infty}b_n&=L
\end{align*}
Using theorem 2.5.2 and the squeeze theorem. $\Box$
\setcounter{enumii}{8}
%2.5I
\item
Suppose that $\displaystyle \lim_{n\to\infty} a_n=L$. Show that $\displaystyle \lim_{n\to\infty}\frac{a_1+a_2+\dots+a_n}{n}=L$.
\subsubsection*{proof}
\end{enumerate}
\end{enumerate}
\end{document}
| {
"alphanum_fraction": 0.6129523363,
"avg_line_length": 53.0372670807,
"ext": "tex",
"hexsha": "ff42ebf844f9c8ed367213e267ab12ca8e33804a",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "66d433f2090b6396c8dd2a53a733c25dbe7bc90f",
"max_forks_repo_licenses": [
"Unlicense"
],
"max_forks_repo_name": "ylixir/school",
"max_forks_repo_path": "real analysis/analysis-hw-2014-09-12.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "66d433f2090b6396c8dd2a53a733c25dbe7bc90f",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"Unlicense"
],
"max_issues_repo_name": "ylixir/school",
"max_issues_repo_path": "real analysis/analysis-hw-2014-09-12.tex",
"max_line_length": 335,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "66d433f2090b6396c8dd2a53a733c25dbe7bc90f",
"max_stars_repo_licenses": [
"Unlicense"
],
"max_stars_repo_name": "ylixir/school",
"max_stars_repo_path": "real analysis/analysis-hw-2014-09-12.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3886,
"size": 8539
} |
% title Udacity Path Planning Project
% author(s) Devendra Rai
% date Now.
%% Thanks: https://www.soimort.org/notes/161117/
\documentclass{article}
\usepackage{fancyhdr}
\usepackage{extramarks}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage[plain]{algorithm}
\usepackage{algpseudocode}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{array}
% Settings
\linespread{1.1}
\pagestyle{fancy}
% Macros
\providecommand{\tabularnewline}{\\}
\title{Udacity Path Planning Project}
% Suppress date
\date{\vspace{-5ex}}
%\date{} % Toggle commenting to test
\begin{document}
\maketitle
% Pandoc does not seem to render title string in the markdown.
% Repeat title string so that pandoc can put it in the markdown.
%\section{Udacity Path Planning Project}
\section{Context}
This project implements the “Path Planning” project required in Semester 3 of the Udacity’s \href{https://de.udacity.com/course/self-driving-car-engineer-nanodegree--nd013}{“Self Driving Car NanoDegree Program”}
\section{Tools and Scripts}
\subsection{uWebSocketIO}
\textit{Ad-verbatim from Udacity's Instructions:}
\textbf{uWebSocketIO Starter Guide}
All of the projects in Term 2 and some in Term 3 involve using an open source package called uWebSocketIO. This package facilitates the same connection between the simulator and code that was used in the Term 1 Behavioral Cloning Project, but now with C++. The package does this by setting up a web socket server connection from the C++ program to the simulator, which acts as the host. In the project repository there are two scripts for installing uWebSocketIO - one for Linux and the other for macOS.
Note: Only uWebSocketIO branch e94b6e1, which the scripts reference, is compatible with the package installation. Linux Installation:
From the project repository directory run the script: install-ubuntu.sh
\subsection{Term2 Simulator}
Download from \href{https://github.com/udacity/CarND-Path-Planning-Project}{Term3 Simulator}.
\subsection{Building This Project}
Execute the following in the \texttt{\$root} directory of this project:
\texttt{\\ \noindent
mkdir build \\
cd build \\
cmake .. \\
make \\
}
\subsection{Running This Project}
Execute the following in the \texttt{\$root} directory of this project:
\texttt{\\ \noindent
cd build \\
./path\_planning
}
Thereafter, start the Term3 simulator, and choose the "Project 1: Path Planning"
\section{Problem Statement}
\textbf{Given:}
\begin{enumerate}
\item A simulated Ego Vehicle;
\item A simulated test track, with three lanes in each direction, and simulated traffic on all lanes, and in each direction;
\item A fixed number of waypoints along the test track:
\item A trajectory control logic built into the ego vehicle
\end{enumerate}
\noindent\textbf{Compute:}
\indent The path to be travelled by the ego vehicle along the track
\vspace*{1em}
\noindent\textbf{Assume:}
\indent Perfect trajectory control in the ego vehicle.
\vspace*{1em}
\noindent\textbf{Constraints:}
\begin{enumerate}
\item No collision with any other vehicle;
\item Maintain a minimum average speed of 40 km/hr. This constraint is enforced by the simulator.
\item The ego vehicle must change lanes at least once during the entire journey along the track.
\item go vehicle must travel according to right-hand-drive traffic rules (e.g., those in Germany) and obey all traffic laws.
\begin{enumerate}
\item Ego vehicle must not take too long to cross lanes (contraint enforced by the simulator)
\end{enumerate}
\end{enumerate}
\section{Solution Overview}
The approach involves the following main steps:
\begin{enumerate}
\item \texttt{updateNonEgoVehicleData}: Updating the positions of all Non-Ego vehicles sensed by the Ego vehicle at the current time-step;
\item \texttt{updateEgoVehicleData}: Update the position, orientation, and velocity of the Ego vehicle to the current time-step;
\item \texttt{provideTrajectory}: Based on the predicted positions of the Non-Ego vehicles over the planning horizon, compute a new trajectory of the Ego vehicle subject to the constraints listed in the problem description;
\item \texttt{getCoordinatePairs}: Compute a sequence of waypoints that the Ego vehicle must follow based on the computed trajectory.
\end{enumerate}
All steps are available as method \texttt{PathPlanner C++} class.
The \texttt{main.cpp} creates an instance \texttt{pathPlanner} of the class \texttt{PathPlanner} and invokes the methods appropriately to solve the path planning problem:
\vspace*{1em}
%\noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
{\lstset{language=C++,
basicstyle=\ttfamily,
keywordstyle=\color{blue}\ttfamily,
stringstyle=\color{red}\ttfamily,
commentstyle=\color{white!40!black}\ttfamily,
%frame=single,
morecomment=[l][\color{magenta}]{\#}
}
\begin{lstlisting}[language=C++]
pathPlanner.updateNonEgoVehicleData(sensor_fusion);
// update ego-vehicle data
pathPlanner.updateEgoVehicleData(EgoVehicleData, false);
// choose an appropriate trajectory
optimalTrajectory = pathPlanner.provideTrajectory();
// extract the vector of coordinates
coordinatePairs = optimalTrajectory.getCoordinatePairs();
\end{lstlisting}
}
\section{Solution Details}
The \texttt{updateNonEgoVehicleData} and \texttt{updateEgoVehicleData} methods are relatively straightforward.
The method \texttt{updateNonEgoVehicleData} reads the information from \texttt{sensor\_fusion} function provided by the simulator, and updates the position, velocity, and orientation of each non-ego vehicle reported by \texttt{sensor\_fusion}.
The method \texttt{updateEgoVehicleData} updates the internal knowledge of the position, velocity, and orientation of the ego vehicle based on sensor data.
The method \texttt{provideTrajectory} is composed of two private methods:
\begin{enumerate}
\item \texttt{getLaneChangeSuggestion()}: Provides an overall cost of execution a change of lanes based on the costs associated to (a) staying in lane, (b) changing to the left lane, and (c) changing to the right lane.
\end{enumerate}
\section{Assumptions}
For the methods described below, the following information is assumed given:
The cost $ c $ of a lane-change maneuver is a number in the range [0, 1]. That is:
\begin{equation}
0 \leq c \leq 1 (highest \,cost)
\end{equation}
Furthermore, it is given that the track has $ n \geq 1$ lanes in the intended direction of travel, with lane $ n = 1 $ being the left-most lane.
The final $ n = k $ lane which the ego vehicle must be in at the end of the track is also provided.
The track is assumed to be $ l $ meters long.
A distance \texttt{returnToLaneBuffer} is used to force the ego vehicle to move into lane $ l = k $ after travelling a maximum total distance $ l - \texttt{returnToLaneBuffer}$.
\subsection{Method \texttt{costOfLaneChangeLeft}}
Assuming
The decision to change the lane to the left is based on the following criteria:
\begin{enumerate}
\item The cost is set to $ c = 1 $ if the ego is already traveling in the left most lane, i.e., $ n = 1 $
\item The cost is set to $ c = 1 $ during during the last \texttt{returnToLaneBuffer} meters from the end of the track, provided the ego vehicle is already in the intended final lane.
\item For all other cases, the feasibility of staying in lane $ n' = n - 1 $ is calculated using the method \texttt{costForLaneChange}. If this step yields the lowest cost, then the change to lane $ n' = n - 1 $ is completed. It is assumed that if it is feasible to stay in the lane $ n' = n -1 $ then the change of lanes $ n \rightarrow n' $ is also always feasible. However, this assumption may not hold for realistic driving scenarios.
\end{enumerate}
All costs are computed by a common private method \texttt{costForLaneChange}which operates are follows:
\subsection{Method \texttt{costForLaneChange}}
First, the planning horizon in computed: a window of time starting at the current instant, and the duration is set to the length of time into the future for which trajectories are to be generated. Longer horizons are not recommended since these reduce the agility of the ego vehicle to respond to changes in the environment (e.g., new traffic pattern). On the other hand, very short planning horizons are also not computationally efficient (e.g., would need to plan multiple times to execute one lane change)
\begin{figure*}[!h]
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}}>{\raggedleft}p{0.35\textwidth}>{\raggedright}p{0.65\textwidth}}
Symbol & Semantic\tabularnewline
$J$ & Maximum Jerk limit, provided at design time. \\[1em]\tabularnewline
$A$ & Maximum Acceleration limit, provided at design time. \\[1em]\tabularnewline
$t$ & Time at the beginning of the planning phase\\[1em]\tabularnewline
$\triangle t$ & Length of the planning horizon\\[1em]\tabularnewline
$v^{\text{ego}}(t)$ & Speed of the Ego vehicle at the beginning of the planning phase\\[1em]\tabularnewline
$\left|{\triangle v}^{\text{ego}}\right|$ & Maximum change in the velocity of the ego vehicle by the end of the current planning phase \\[1em]\tabularnewline
$v^{\text{ego}}_{\text{max}}( t+\triangle t )$ & Maximum possible speed of the ego vehicle at the end of the current planning phase subject to performance restrictions, and traffic conditions \\[1em]\tabularnewline
$v^{\text{ego}}_{\text{min}}( t+\triangle t )$ & Minimum possible speed of the ego vehicle at the end of the current planning phase subject to performance restrictions, and traffic conditions \\[1em]\tabularnewline
& \tabularnewline
\end{tabular*}
\caption{Symbols Used In the Text}
\end{figure*}
Second, based on provided jerk and acceleration limits, the maximum change of velocity $ {\triangle v}^{\text{ego}} $ of the ego vehicle within the time-horizon $ \triangle t $ being considered is computed. That is:
\begin{equation}
\left| v^{\text{ego}} ( t+\triangle t ) - v^{\text{ego}}(t) \right| \leq \left| {\triangle v}^{\text{ego}} \right|
\end{equation}
where:
\begin{equation}
\left| {\triangle v}^{\text{ego}} \right| = \text{min}\left\{ \intop\intop_{t=0}^{\triangle t}Jdt.dt,\intop_{t=0}^{\triangle t}Adt\right\}
\end{equation}
where $ t $ is the time instant at the beginning of the planning phase.
In case there is no in-lane leading traffic in front of the ego vehicle, the planner computes a trajectory which requires the ego vehicle to speed up, upto the maximum allowed speed. In case, a leading in-lane vehicle is detected, a maximum ego velocity $ v^{\text{ego}}_{\text{max}}( t+\triangle t ) $ necessary to avoid rear-ending the leading vehicle is computed. with:
\begin{equation}
v^{\text{ego}}_{\text{max}}( t+\triangle t ) \leq v^{\text{ego}}(t) + \left| {\triangle v}^{\text{ego}} \right|
\end{equation}
In case there a trailing in-lane non-ego vehicle, a minimum ego velocity $ v^{\text{ego}}_{\text{min}}( t+\triangle t ) $ in order to avoid being rear-ended by the trailing vehicle is computed, where:
\begin{equation}
v^{\text{ego}}_{\text{min}}( t+\triangle t ) \geq v^{\text{ego}}(t) - \left| {\triangle v}^{\text{ego}} \right|
\end{equation}
Obviously:
\begin{equation}
v^{\text{ego}}_{\text{min}}( t+\triangle t ) > v^{\text{ego}}_{\text{max}}( t+\triangle t ) \implies \text{Change Lane}
\end{equation}
Under the condition $ v^{\text{ego}}_{\text{min}}( t+\triangle t ) > v^{\text{ego}}_{\text{max}}( t+\triangle t ) $, the velocity associated with the planned trajectory over the planning horizon is computed as:
\begin{equation}
v^{\text{ego}}( t+\triangle t ) = \frac{v^{\text{ego}}_{\text{min}}( t+\triangle t ) + v^{\text{ego}}_{\text{max}}( t+\triangle t )}{2}
\end{equation}
The $ v^{\text{ego}} $ will be followed in case a change of lanes is also not possible.
In case that $ v^{\text{ego}}_{\text{min}}( t+\triangle t ) \leq v^{\text{ego}}_{\text{max}}( t+\triangle t ) $, the ego velocity is:
\begin{equation}
v^{\text{ego}}( t+\triangle t ) = v^{\text{ego}}_{\text{max}}( t+\triangle t ), \text{if } v^{\text{ego}}_{\text{min}}( t+\triangle t ) \leq v^{\text{ego}}_{\text{max}}( t+\triangle t )
\end{equation}
\end{document}
| {
"alphanum_fraction": 0.7372853903,
"avg_line_length": 46.9505703422,
"ext": "tex",
"hexsha": "41839481c288728e5c244ad0870bab2407ec7457",
"lang": "TeX",
"max_forks_count": null,
"max_forks_repo_forks_event_max_datetime": null,
"max_forks_repo_forks_event_min_datetime": null,
"max_forks_repo_head_hexsha": "8cc3e42afc3e27c82c2651561f5cb561b4cf4079",
"max_forks_repo_licenses": [
"MIT"
],
"max_forks_repo_name": "RomanoViolet/Udacity-Path-Planning",
"max_forks_repo_path": "ReadMe.tex",
"max_issues_count": null,
"max_issues_repo_head_hexsha": "8cc3e42afc3e27c82c2651561f5cb561b4cf4079",
"max_issues_repo_issues_event_max_datetime": null,
"max_issues_repo_issues_event_min_datetime": null,
"max_issues_repo_licenses": [
"MIT"
],
"max_issues_repo_name": "RomanoViolet/Udacity-Path-Planning",
"max_issues_repo_path": "ReadMe.tex",
"max_line_length": 508,
"max_stars_count": null,
"max_stars_repo_head_hexsha": "8cc3e42afc3e27c82c2651561f5cb561b4cf4079",
"max_stars_repo_licenses": [
"MIT"
],
"max_stars_repo_name": "RomanoViolet/Udacity-Path-Planning",
"max_stars_repo_path": "ReadMe.tex",
"max_stars_repo_stars_event_max_datetime": null,
"max_stars_repo_stars_event_min_datetime": null,
"num_tokens": 3321,
"size": 12348
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.