CS109 LaTeX Cheat Sheet, Study Guides, Projects, Research of Calculus

CS109 LaTeX Cheat Sheet. Created by Derek Chong for CS109 during Spring 2020. This cheat sheet assumes you have done an introductory tutorial and have a ...

Typology: Study Guides, Projects, Research

2021/2022

Uploaded on 07/05/2022

gavin_99
gavin_99 🇦🇺

4.3

(73)

998 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS109 LaTeX Cheat Sheet
Created by Derek Chong for CS109 during Spring 2020.
This cheat sheet assumes you have done an introductory tutorial and have a basic level of
general knowledge. It focuses on giving you a quick reference for language features you will
encounter in CS109, in order to make your life easier when working on problem sets.
Frequently-Used Markup
Building Blocks
\geq
\leq
\neq
\approx
\sim
\Rightarrow
\sqrt{42}
\infty
\lambda
\mu, \sigma
\Phi(0)
\Sigma
\theta
\bar{X}, \hat{X}
A,B,\dots,Z
1,2,\cdots,n
\verb|my_function()
|
\frac{42 \textrm{
units} \times 42
\textrm{ units}}{42
\textrm{ units}
\times 42 \textrm{
units}}
\sum_{i=0}^{n}
\frac{a}{b}
\prod_{i=0}^{n}
\frac{a}{b}
Probability
P(A \cap B)
P(A \cup B)
\binom{n}{k}
P(A_1|B^C)
pf3
pf4
pf5

Partial preview of the text

Download CS109 LaTeX Cheat Sheet and more Study Guides, Projects, Research Calculus in PDF only on Docsity!

CS109 LaTeX Cheat Sheet

Created by Derek Chong for CS109 during Spring 2020.

This cheat sheet assumes you have done an introductory tutorial and have a basic level of

general knowledge. It focuses on giving you a quick reference for language features you will

encounter in CS109, in order to make your life easier when working on problem sets.

Frequently-Used Markup

Building Blocks

\geq \leq \neq \approx \sim \Rightarrow \sqrt{42} \infty \lambda \mu, \sigma \Phi(0) \Sigma \theta \bar{X}, \hat{X} A,B,\dots,Z 1,2,\cdots,n \verb|my_function() | \frac{42 \textrm{ units} \times 42 \textrm{ units}}{ \textrm{ units} \times 42 \textrm{ units}} \sum_{i=0}^{n} \frac{a}{b} \prod_{i=0}^{n} \frac{a}{b}

Probability

P(A \cap B) P(A \cup B) \binom{n}{k} P(A_1|B^C)

P(\textrm{text } | \textrm{ text}) P(\textrm{cond} \leq 5.0) \frac{P(\textrm{a } | \textrm{ b}) \times P(\textrm{b})}{P(\t extrm{a})} \frac{P(\textrm{a } | \textrm{ b}) \times P(\textrm{b})}{P(\t extrm{a } | \textrm{ b})P(\textrm{b}) + P(\textrm{a } | \textrm{ b}^C)P(\textrm{b}^C )}

Random Variables

X \sim \textrm{Ber}(p) X \sim \textrm{Bin}(n,p) X \sim \textrm{Poi}(\lambd a=0) X \sim \textrm{Exp}(\lambd a=0) X \sim \mathcal{N}(\mu = 0, \sigma^2 = 1) \theta \sim \textrm{Beta}(a,b)

Calculus

\int_{-1}^{1} x^2 - 2x + 1 dx \left[ x - \frac{1}{2}x^ \right]{-1}^ \iint{0<y<x<1} \frac{x}{y} dy dx \left. \frac{2}{3}y

  • \frac{3}{4}y^ \right|_{-1}^{x}

Variance and Covariance

\textrm{Var}(X) \textrm{Cov}(X,Y) \begin{bmatrix} a & b \ c & d \end{bmatrix} \rho

Useful Structures Groups of Equations

\begin{align*} chunks can be used to organise multiple lines of equations.

\begin{align} P(X=x|Y=1,W=P_1) &= \frac{P(X=x,Y=1 | W=P_1)}{P(Y=1|W=P_1)} \ &= P(X=x|W=P_1) \ &= \binom{5}{x}(0.1)^x(0.9)^{5-x} \ P(X=x|Y=1,W=P_2) &= \frac{P(X=x,Y=1 | W=P_2)}{P(Y=1|W=P_2)} \ &= P(X=x|W=P_2) \ &= \binom{5}{x}(0.1)^x(0.9)^{5-x} \end{align} Venn Diagrams You may have to install the venndiagram package (and include \usepackage{venndiagram}) \begin{venndiagram3sets}[labelA={Foo},labelB={Bar},labelC ={Baz}, labelOnlyA={1},labelOnlyB={2},labelOnlyC={3}, labelOnlyAB={4},labelOnlyAC={5},labelOnlyBC={6},labelABC= {7}, labelNotABC={8}] \begin{center} \begin{venndiagram3sets}[labelA={Foo},labelB={Bar},labelC ={Baz}, labelOnlyA={1},labelOnlyB={2},labelOnlyC={3}, labelOnlyAB={4},labelOnlyAC={5},labelOnlyBC={6},labelABC= {7},labelNotABC={8},shade={yellow}] \fillOnlyB\end{venndiagram3sets} \end{center}

\begin{center} \begin{venndiagram2sets}[labelA={Foo},labelB={Bar}, labelOnlyA={$x$},labelOnlyB={$z$}, labelAB={$y$}, shade={white}] \fillAll \end{venndiagram2sets} \end{center} Full package documentation is available here: https://ctan.math.illinois.edu/macros/latex/contrib/venndiagram/venndiagram.pdf Plotting Graphs \begin{tikzpicture} \begin{axis}[ axis lines = center, xlabel = {$p$}, ] \addplot [domain=-0.05:1.5, samples=100, color=blue]{x}; \addlegendentry{$p$} \addplot [domain=-0.05:1.5, samples=100, color=red]{x*x}; \addlegendentry{$q = p^2$} \end{axis} \end{tikzpicture} Probability Trees \tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3cm] \tikzstyle{level 2}=[level distance=3.5cm, sibling distance=3.3cm] \tikzstyle{bag} = [text width=4em, text centered] \tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt] \begin{tikzpicture}[grow=right] \node[bag] {Foo} child { node[bag] {Bar} child { node[end, label=right:{Baz}] {} edge from parent node[above] {$X$} node[below] {$x$} } child { node[end, label=right:{Xyzzy}] {} edge from parent node[above] {$X$} node[below] {$x$} }

General Tips

● Local LaTeX : Running LaTeX locally can help you learn faster than Overleaf - a shorter

feedback loop is really helpful!

● Wolfram Alpha : You can paste LaTeX snippets directly into Wolfram Alpha and most of

the time it'll understand them correctly and do something useful.

○ You can even add Wolfram Alpha as a custom search engine in Chrome. This

lets you type "w [your LaTeX equation]" into your location bar, and it'll take you

straight to the answer in Wolfram. Just go to this link, and add this as an entry.

● Half-LaTeX environments : Using a half-LaTeX environment like MS Word, Powerpoint,

or Google Docs with the Auto-LaTeX Equations Addon is super useful while you’re doing

your rough work.

○ Save up snippets for typesetting and test them in Wolfram Alpha as you go!

○ Auto-LaTeX may throw an error if you’re signed into >1 Google Account at once

○ MS Office LaTeX support was added in 2016, is not yet available on macOS

● Keyboard shortcuts :

○ On TeXShop, you can type \bali and press Esc twice, and it'll set up a

\begin{align*} block. Or \b[xyz] for any \begin{xyz} block.

○ It can be nice to define custom shortcuts for things you find yourself typing

frequently, such as \textrm{} or Bayes’ Theorem.

● Expectations : You don’t have to use any of the above structures if you don’t want to!

The teaching team will accept and grade PSets in any format you submit.

● Motivation : Strong LaTeX skills will make you more effective in all future courses. Goals