From 27637d7e6368cb2dbdc38dc815aa7384f147911d Mon Sep 17 00:00:00 2001 From: Mark Date: Sat, 21 Oct 2023 19:51:40 -0700 Subject: [PATCH 1/8] Fixed minor error --- Advanced/Origami/main.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Advanced/Origami/main.tex b/Advanced/Origami/main.tex index 90d1423..8d96790 100755 --- a/Advanced/Origami/main.tex +++ b/Advanced/Origami/main.tex @@ -370,7 +370,7 @@ \note{Proposed by Sunny} Using a compass and ruler, find two circles tangent to a point D and lines AB and AC. (Problem of Appolonius, PLL case) \par \hint{ - All circles tangent to $AB$ and $AC$ are homothetic with centre at $A$. What does this mean? \par + All circles tangent to $AB$ and $AC$ are homothetic with centre at $A$. What does this mean? \\ Also, the angle bisector may help. } From e4706d41e752274662eb0e393e68e0dbcc617a61 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 22 Oct 2023 20:19:24 -0700 Subject: [PATCH 2/8] Fixed a few errors --- Advanced/Lambda Calculus/parts/00 intro.tex | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Advanced/Lambda Calculus/parts/00 intro.tex b/Advanced/Lambda Calculus/parts/00 intro.tex index 5d028dc..101a96e 100755 --- a/Advanced/Lambda Calculus/parts/00 intro.tex +++ b/Advanced/Lambda Calculus/parts/00 intro.tex @@ -178,7 +178,6 @@ Reduce the following expressions. \par \textbf{Solution for $(I~I)$:}\par Recall that $I = \lm x.x$. First, we rewrite the left $I$ to get $(\lm x . x )~I$. \par Applying this function by replacing $x$ with $I$, we get $I$: - $$ I ~ I = (\lm x . \tzm{b}x )~\tzm{a}I = @@ -193,11 +192,7 @@ Reduce the following expressions. \par \draw[->,gray,shorten >=5pt,shorten <=3pt] (a.center) to (b.east); \end{tikzpicture} - $$ - \vspace{0.5mm} - - So, $I~I$ reduces to itself. This makes sense, since the identity - function doesn't change its input! + $$\null \end{examplesolution} @@ -214,11 +209,20 @@ Rewrite the following expressions with as few parentheses as possible, without c Remember that lambda calculus is left-associative. \vspace{2mm} \begin{itemize}[itemsep=2mm] - \item $(\lm x. (\lm y. \lm (z. ((xz)(yz)))))$ + \item $(\lm x. (\lm y. \lm z. ((xz)(yz))))$ \item $((ab)(cd))((ef)(gh))$ \item $(\lm x. ((\lm y.(yx))(\lm v.v)z)u) (\lm w.w)$ \end{itemize} +\begin{solution} + $(\lm x. ((\lm y.(yx))(\lm v.v)z)u) (\lm w.w) \implies (\lm x. (\lm y.yx) (\lm v.v)~z~u) \lm w.w$ + + \vspace{2mm} + + It's important that a function's output (everything after the dot) will continue until we hit a close-paren. + This is why we need the parentheses in the above example. +\end{solution} + \vfill \pagebreak @@ -317,17 +321,18 @@ We've already seen this on the previous page: $K$ takes an input $x$ and uses it You can think of $K$ as a \say{factory} that constructs functions using the input we provide. \problem{} -Let $C = \lm f. \Bigl[\lm g. \Bigl( \lm x. [~ g(f(x)) ~] \Bigr)\Bigr]$. For now, we'll call it the \say{composer.} +Let $C = \lm f. \Bigl[\lm g. \Bigl( \lm x. [~ f(g(x)) ~] \Bigr)\Bigr]$. For now, we'll call it the \say{composer.} \par +\note[Note]{We could also call $C$ the \say{right-associator.} Why?} \vspace{1mm} -Note that $C$ has three \say{layers} of curry: it makes a function ($\lm g$) that makes another function ($\lm x$). \par +$C$ has three \say{layers} of curry: it makes a function ($\lm g$) that makes another function ($\lm x$). \par If we look closely, we'll find that $C$ pretends to take three arguments. \vspace{1mm} What does $C$ do? Evaluate $(C~a~b~x)$ for arbitary expressions $a, b,$ and $x$. \par -\hint{Place parentheses first. Remember, function application is left-associative.} +\hint{Evaluate $(C~a)$ first. Remember, function application is left-associative.} \vfill From 20b0bf3e7d92849a6f1377ddb62744cb60053d5f Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 22 Oct 2023 20:55:21 -0700 Subject: [PATCH 3/8] Minor fix --- Advanced/Lambda Calculus/parts/00 intro.tex | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Advanced/Lambda Calculus/parts/00 intro.tex b/Advanced/Lambda Calculus/parts/00 intro.tex index 101a96e..4c7c00f 100755 --- a/Advanced/Lambda Calculus/parts/00 intro.tex +++ b/Advanced/Lambda Calculus/parts/00 intro.tex @@ -321,10 +321,11 @@ We've already seen this on the previous page: $K$ takes an input $x$ and uses it You can think of $K$ as a \say{factory} that constructs functions using the input we provide. \problem{} +\vspace{1mm} % Slight gap for big paren Let $C = \lm f. \Bigl[\lm g. \Bigl( \lm x. [~ f(g(x)) ~] \Bigr)\Bigr]$. For now, we'll call it the \say{composer.} \par \note[Note]{We could also call $C$ the \say{right-associator.} Why?} -\vspace{1mm} +\vspace{3mm} $C$ has three \say{layers} of curry: it makes a function ($\lm g$) that makes another function ($\lm x$). \par If we look closely, we'll find that $C$ pretends to take three arguments. From 279b4711cb6a96a841f19b2e645d9d83c014b1ab Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 22 Oct 2023 21:14:24 -0700 Subject: [PATCH 4/8] Minor title cleanup --- resources/ormc_handout.cls | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/resources/ormc_handout.cls b/resources/ormc_handout.cls index 0036559..8158156 100755 --- a/resources/ormc_handout.cls +++ b/resources/ormc_handout.cls @@ -427,19 +427,15 @@ \centering % Left and right headers (uptitle) - \def\uptitle{% - \if\@uptitlel\relax\else\textsc{\@uptitlel}\fi \hfill~% - \if\@uptitler\relax\else\textsc{\@uptitler}\fi \par - } - \if\@uptitlel\relax % If neither header is defined, - \if\@uptitlel\relax % don't insert an upper title. - \def\@uptitle{\relax} - \fi\fi\uptitle{} + \if\@uptitlel\relax\else\textsc{\@uptitlel}\fi \hfill\null% + \if\@uptitler\relax\else\textsc{\@uptitler}\fi \par % Main title \rule{\linewidth}{0.2mm} \par - \huge \@title \par \normalsize - \vspace{1ex} \@subtitle \par + \vspace{4mm} + {\huge \@title} \par + \vspace{2mm} \@subtitle \par + \vspace{1mm} \rule{\linewidth}{0.2mm} \par % Solution warning From d79e6bbb9d2d153a58531803d2d74bbb61b04510 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 22 Oct 2023 21:33:42 -0700 Subject: [PATCH 5/8] Added historical note --- Advanced/Lambda Calculus/main.tex | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/Advanced/Lambda Calculus/main.tex b/Advanced/Lambda Calculus/main.tex index 6b8a200..0c979f4 100755 --- a/Advanced/Lambda Calculus/main.tex +++ b/Advanced/Lambda Calculus/main.tex @@ -58,6 +58,48 @@ \vspace{4mm} + \makeatletter + \if@solutions + \begin{instructornote} + \textbf{Context \& Computability:} (or, why do we need lambda calculus?)\par + \note{From Peter Selinger's \textit{Lecture Notes on Lambda Calculus}} + + \vspace{2mm} + + In the 1930s, several people were interested in the question: what does it mean for + a function $f : \mathbb{N} \mapsto \mathbb{N}$ to be computable? An informal definition of computability + is that there should be a pencil-and-paper method allowing a trained person to + calculate $f(n)$, for any given $n$. The concept of a pencil-and-paper method is not + so easy to formalize. Three different researchers attempted to do so, resulting in + the following definitions of computability: + + \begin{itemize} + \item Turing defined an idealized computer we now call a Turing machine, and + postulated that a function is \say{computable} if and only + if it can be computed by such a machine. + + \item G\"odel defined the class of general recursive functions as the smallest set of + functions containing all the constant functions, the successor function, and + closed under certain operations (such as compositions and recursion). He + postulated that a function is \say{computable} if and only + if it is general recursive. + + \item Church defined an idealized programming language called the lambda calculus, + and postulated that a function is \say{computable} if and only if it can be written as a lambda term. + \end{itemize} + + It was proved by Church, Kleene, Rosser, and Turing that all three computational + models were equivalent to each other --- each model defines the same class + of computable functions. Whether or not they are equivalent to the \say{intuitive} + notion of computability is a question that cannot be answered, because there is no + formal definition of \say{intuitive computability.} The assertion that they are in fact + equivalent to intuitive computility is known as the Church-Turing thesis. + \end{instructornote} + \vfill + \pagebreak + \fi + \makeatother + \input{parts/00 intro} \input{parts/01 combinators} \input{parts/02 boolean} From 7db600d714fa9c76e27e224be260c20a56de6fa8 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 23 Oct 2023 10:58:48 -0700 Subject: [PATCH 6/8] Added tectonic args variable --- build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index c3b813e..cd2730c 100755 --- a/build.sh +++ b/build.sh @@ -36,12 +36,16 @@ function build() { echo "|> Building ${job_name}..." cd "${doc_dir}" + tectonic_args=( + --chatter minimal + ) + # Build handout echo "\\def\\argNoSolutions{1}\\input{${main_file}}" | \ tectonic \ + "${tectonic_args[@]}" \ --outfmt pdf \ - --chatter minimal \ - stat=$? @@ -60,8 +64,8 @@ function build() { # Build solutions echo "\\def\\argYesSolutions{1}\\input{${main_file}}" | \ tectonic \ + "${tectonic_args[@]}" \ --outfmt pdf \ - --chatter minimal \ - stat=$? From 1f237f6b2ac8e3a15bf63a278ac6690b8c93e36b Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 23 Oct 2023 19:27:08 -0700 Subject: [PATCH 7/8] Added custom bundle to tectonic --- build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sh b/build.sh index cd2730c..a23f233 100755 --- a/build.sh +++ b/build.sh @@ -38,6 +38,7 @@ function build() { tectonic_args=( --chatter minimal + --web-bundle "https://static.betalupi.com/tectonic/texlive2023-nopatch.tar" ) From ea3ef136fa52ae83e6aa2f211369b365757dfecf Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 24 Oct 2023 10:21:56 -0700 Subject: [PATCH 8/8] Added first section of option handout --- Advanced/Options in Finance/main.tex | 90 ++++++++++++++ Advanced/Options in Finance/parts/0 intro.tex | 5 + Advanced/Options in Finance/parts/1 call.tex | 116 ++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100755 Advanced/Options in Finance/main.tex create mode 100644 Advanced/Options in Finance/parts/0 intro.tex create mode 100644 Advanced/Options in Finance/parts/1 call.tex diff --git a/Advanced/Options in Finance/main.tex b/Advanced/Options in Finance/main.tex new file mode 100755 index 0000000..e460da8 --- /dev/null +++ b/Advanced/Options in Finance/main.tex @@ -0,0 +1,90 @@ +% use [nosolutions] flag to hide solutions. +% use [solutions] flag to show solutions. +\documentclass[ + solutions +]{../../resources/ormc_handout} +\usepackage{../../resources/macros} + +\usepackage{mdframed} +\usepackage{pgf} + +% Ruble symbol with tweaks +\DeclareRobustCommand*{\Rub}{% + \begingroup + \dimendef\H=0 % + \settoheight\H{P}% + \begin{pgfpicture}% + \pgfsetlinewidth{.1\H}% + \pgfsetrectcap + \pgfsetmiterjoin + \pgfmoveto{\pgfpoint{0pt}{0.07\H}}% Move to bottom of main line + \pgflineto{\pgfpoint{0pt}{.90\H}}% P main line + \pgflineto{\pgfpoint{.3\H}{.90\H}}% P top line + \pgfpatharc{90}{-90}{.21\H}% P circle + \pgflineto{\pgfpoint{-.08\H}{.48\H}}% P bottom line + \pgfmoveto{\pgfpoint{-.08\H}{.31\H}}% Bonus line move + \pgflineto{\pgfpoint{.34\H}{.31\H}}% Bonus line draw + \pgfusepath{stroke}% + \pgfmoveto{\pgfpoint{-.23\H}{0pt}}% Before space + \pgfmoveto{\pgfpoint{0.55\H}{0pt}}% After space + \end{pgfpicture}% + \endgroup +} + +% Ruble symbol, per official Kremlin specification +% +%\DeclareRobustCommand*{\Rub}{% +% \begingroup +% \dimendef\H=0 % +% \settoheight\H{P}% +% \begin{pgfpicture}% +% \pgfsetlinewidth{.1\H}% +% \pgfsetrectcap +% \pgfsetmiterjoin +% \pgfmoveto{\pgfpoint{0pt}{0.05\H}}% +% \pgflineto{\pgfpoint{0pt}{.95\H}}% +% \pgflineto{\pgfpoint{.35\H}{.95\H}}% +% \pgfpatharc{90}{-90}{.225\H}% +% \pgflineto{\pgfpoint{-.05\H}{.5\H}}% +% \pgfmoveto{\pgfpoint{-.05\H}{.34\H}}% +% \pgflineto{\pgfpoint{.38\H}{.34\H}}% +% \pgfusepath{stroke}% +% \pgfmoveto{\pgfpoint{-.175\H}{0pt}}% +% \pgfmoveto{\pgfpoint{.7\H}{0pt}}% +% \end{pgfpicture}% +% \endgroup +%} + +\newmdenv[ + topline=false, + bottomline=false, + rightline=true, + leftline=true, + linewidth=0.3mm, + frametitle={Contract:}, + frametitlefont={\textsc}, + % + skipabove=1mm, + skipbelow=1mm, + % + innerleftmargin=2mm, + innerrightmargin=4mm, + leftmargin=2mm, + rightmargin=2mm, +]{contract} + +\uptitlel{Advanced 2} +\uptitler{Fall 2023} +\title{Options in Finance} +\subtitle{ + Prepared by \githref{Mark} on \today{} +} + +\begin{document} + + \maketitle + + \input{parts/0 intro} + \input{parts/1 call} + +\end{document} \ No newline at end of file diff --git a/Advanced/Options in Finance/parts/0 intro.tex b/Advanced/Options in Finance/parts/0 intro.tex new file mode 100644 index 0000000..62ff2e5 --- /dev/null +++ b/Advanced/Options in Finance/parts/0 intro.tex @@ -0,0 +1,5 @@ +\section{Introduction} + + +\vfill +\pagebreak \ No newline at end of file diff --git a/Advanced/Options in Finance/parts/1 call.tex b/Advanced/Options in Finance/parts/1 call.tex new file mode 100644 index 0000000..406b3a3 --- /dev/null +++ b/Advanced/Options in Finance/parts/1 call.tex @@ -0,0 +1,116 @@ +\section{Call Options} + +\definition{} +A \textit{call option} is an agreement between a buyer (B) and a seller (S): \par + +\begin{contract}[frametitle={Contract: Call Option}] + B pays S a premium $p$. \par + In return, S agrees to sell B a certain commodity $\mathbb{X}$ for a fixed price $k$ at a future time $t$. +\end{contract} + + + + +\problem{} +B has ten call options for $\mathbb{X}$ at $23\Rub$. The current price of $\mathbb{X}$ is $20\Rub$. \par +How much profit can B make if these contracts expire when $\mathbb{X}$ is $30\Rub$? \par +\hint{When the contract expires, B can buy 10 shares of $\mathbb{X}$ at the price the contract set.} + +\begin{solution} + B has the right to buy 10 shares of $\mathbb{X}$ at $23\Rub$. \par + If B immediately sells them, his profit is $-230 + 300 = 70\Rub$ +\end{solution} + + +\vfill + + + +\problem{} +If B paid $10\Rub$ for the call options in \ref{firstcall}, how much money did he really make? + +\begin{solution} + $-10 + (-230 + 300) = 60\Rub$ +\end{solution} + + +\vfill + + + + +\problem{} +Now, suppose that B bought and sold $\mathbb{X}$ directly instead of using a call option. \par +How much profit would B have made? + +\begin{solution} + Buy for $200\Rub$, sell for $300\Rub$.\par + $-200 + 300 = 100\Rub$ +\end{solution} + + + +\vfill + +Given the results of the previous problems, why would anybody buy a call option? +\pagebreak + + +\problem{} +Suppose $\mathbb{X}$ is worth $x_0$ right now. \par +Call options to buy $\mathbb{X}$ at $k$ are sold for $p$. + +\begin{itemize} + \item What is the set of B's possible profit if.. + \begin{itemize} + \item B buys a call option? + \item B buys $\mathbb{X}$ directly? + \end{itemize} + \hint{That is, what amounts of money can he make (or lose)?} + + \item Are call options priced above or below the price of their stock? Why? + \item Why would anybody buy a call option? + +\end{itemize} + + +\begin{solution} + \textbf{Call Option:} $[p, \infty)$ \par + If the price of $\mathbb{X}$ rises, there is no limit to how much money B can make. \par + If the price falls, $B$ can choose to let his contract expire, losing only $p$. + + \vspace{2mm} + + \textbf{Direct:} $[x_0, \infty)$\par + If the price of $\mathbb{X}$ rises, there is again no limit to how much money B can make. \par + If the price falls, $B$ will lose everything he paid for his shares of $\mathbb{X}$. + + \vspace{2mm} + + Of course, call options are priced below their stock. There wouldn't be a reason to buy then + if they were priced above! +\end{solution} + + +\vfill + +\problem{} +Suppose $\mathbb{X}$ is worth $x_0$ right now. \par +Call options to buy $\mathbb{X}$ at $k$ are sold for $p$. \par + +\vspace{2mm} +Assume that S owns no stock---if B executes his contracts, she will buy stock and re-sell it to him. \par +What are S's possible profits if she sells B a call option? + +\begin{solution} + $(-\infty, ~p]$ + + If the price of $\mathbb{X}$ rises, S will have to re-sell shares to B at a loss. \par + If the price falls, B could choose to buy shares from S at a loss, but he won't. \par + In this case, S only keeps the premium B paid for the contract. +\end{solution} + + +\vfill + +\pagebreak \ No newline at end of file