%--------------------------------------------------
% CPSC 202: Mathematical Tools for Computer Science
% Yale University
%
% Template for Homework Assignments
% by Yiding Hao
%--------------------------------------------------
\documentclass{cpsc202}
% Please put your information here.
\myname{Your Name}
\myfriends{Your Collaborators, Including TAs}
\mysources{Your Sources}
\hwnumber{0}
% \singlesided % Uncomment to print single-sided.
% Start typing your solution here.
\begin{document}
Please type your answer to Problem 1 here.
a. If there are multiple parts\dots
b. \dots please answer all of them.
To start a new paragraph, type two blank lines.\\To start a new line without starting a new paragraph, type \verb!\\!.
Here are some other useful commands.
\begin{itemize}
\item \verb!\textit! allows you to type in \textit{italics}.
\item \verb!\textbf! allows you to type in \textbf{bold face}.
\item \verb!\textsc! allows you to type in \textsc{Small Caps}.
\item \verb!\textsf! allows you to type in a \textsf{sans-serif font}.
\item \verb!\texttt! allows you to type in a \texttt{fixed-width font}.
\end{itemize}
For additional help on basic commands, check out the Overleaf tutorial at \url{https://www.overleaf.com/learn/latex/Paragraphs_and_new_lines}. (Try clicking on the URL!)
When you're finished with Problem 1, please type \verb!\nextproblem!, as shown in the source code below.
\nextproblem
Now, please answer Problem 2. Again,
a. if there are multiple parts,
b. please answer all of them.
Let's learn how to typeset mathematics. You can write a math equation using \verb!\[! \dots\ \verb!\]! like this:
\[
f(a) = \frac{1}{2\pi i} \oint_\gamma \frac{f(z)}{z - a} \, dz.
\]
The equation is centered and gets its own line. This is known as \textit{display style}. You can also write equations within the text using \verb!$! \dots\ \verb!$! like this: $f(a) = \frac{1}{2\pi i} \oint_\gamma \frac{f(z)}{z - a} \, dz$. This is known as \textit{inline style}. Notice that inline style is a bit squished. To type a multi-line equation, you can use \verb!\begin{align*}! \dots\ \verb!\end{align*}!:
\begin{align*}
x &= 0.999\dots \\
10x &= 9.999\dots \\
9x &= 10x - x \\
&= 9.999\mathalpha{\dots} - 0.999\dots \\
&= 9 \\
\implies x &= 1.
\end{align*}
In the \verb!align*! environment, the positions marked by the \verb!&! symbol will all be aligned in the middle.
When you type inside \verb!$! \dots\ \verb!$!, \verb!\[! \dots\ \verb!\]!, or \verb!\begin{align*}! \dots\ \verb!\end{align*}!, you are writing in \textit{math mode}. All your math should be inside math mode. If you need to write text inside math mode, you can use \verb!\text!:
\[
|x| = \begin{cases}
x, & x \geq 0 \\
-x, & \text{otherwise.}
\end{cases}
\]
To type a single-letter variable like $x$ or $y$, just type the name of the variable inside math mode. There are commands like \verb!\pi! ($\pi$) and \verb!\Sigma! ($\Sigma$) for Greek letters that don't look like Roman letters. Notice that $strings$ in math mode are $really, really ugly$! If you need to use a multi-letter variable, you can use \verb!\mathrm!, \verb!\mathit!, or \verb!\mathbf!:
\[
(\forall x)(\mathbf{cat}(x) \to (\exists y)(\mathbf{dog}(y) \land \mathbf{saw}(x, y))).
\]
Some useful math symbols for this course are: $\land$, $\lor$, $\lnot$, $\leftarrow$, $\rightarrow$, $\leftrightarrow$, $\forall$, $\exists$, $+$, $-$, $\cdot$, $\times$, $=$, $\neq$, $<$, $>$, $\leq$, $\geq$, $\nleq$, $\ngeq$, $\dots$, $x^2$, $x^{y + z}$, $\sqrt{2}$, $\log$, $\log_2$, $\ln$, $\mathbb{N}$, $\mathbb{R}$, $\mathcal{P}$.
You can use the following types of parentheses and brackets: $($, $)$, $[$, $]$, $\langle$, $\rangle$, $\lbrace$, $\rbrace$. If you are writing in display style, sometimes you might notice that the stuff inside the brackets is taller than the brackets.
\[
A = \lbrace x | x \leq \frac{1}{2} \rbrace
\]
To make the brackets bigger, you can use \verb!\left!, \verb!\middle!, and \verb!\right!.
\[
A = \left\lbrace x \middle| x \leq \frac{1}{2} \right\rbrace
\]
For more help with writing mathematics, please check out \url{https://www.overleaf.com/learn/latex/Mathematical_expressions}.
\nextproblem
If you are enrolled in this course (or any other CPSC course), then you can log in to \hyperlink{https://zoo.cs.yale.edu/newzoo/}{Zoo}, the computer lab on the third floor of Arthur K. Watson hall, with your netID and password. You can print your completed homework solutions for free using the Zoo computers.
Remember that you need to turn in each problem separately. After you print your completed homework, please separate out each problem and staple it. If you are planning to print single-sided instead of double-sided, please uncomment out the code \verb!% \singlesided! on line 16.
\end{document}