Skip to content

Commit 311e43f

Browse files
committed
Update latex rendering in md, emph * or _ to only *
1 parent 9542945 commit 311e43f

9 files changed

Lines changed: 113 additions & 40 deletions

File tree

notes/courses/MATH-UA-333/04-05-drv.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ No independence required.
3737

3838
**Counting-by-indicators trick**
3939
If $X=\sum_{i=1}^n \mathbf{1}_{A_i}$ counts how many events $A_i$ occur, then
40+
4041
$$
4142
\E[X] = \sum_{i=1}^n \Pr(A_i).
4243
$$
@@ -62,7 +63,8 @@ $$
6263

6364
## Inclusion–Exclusion via indicators
6465

65-
Using $\mathbf{1}_{A^c}=1-\mathbf{1}_A$ and expanding $\mathbf{1}_{\cup_i E_i}=1-\prod_{i=1}^n(1-\mathbf{1}_{E_i})$, then taking expectations yields
66+
Using $\mathbf{1}\_{A^c}=1-\mathbf{1}\_A$ and expanding $\mathbf{1}\_{\cup\_i E\_i}=1-\prod\_{i=1}^n(1-\mathbf{1}\_{E\_i})$, then taking expectations yields
67+
6668
$$
6769
\Pr \Big(\bigcup_{i=1}^n E_i\Big)
6870
=\sum_{k=1}^n (-1)^{k-1} \sum_{1\le i_1<\cdots<i_k\le n} \Pr(E_{i_1}\cap\cdots\cap E_{i_k}).
@@ -104,14 +106,22 @@ so $\Var{X}=\E[X^2]-(\E X)^2=np(1-p)$.
104106
2) **Factorial moment**
105107
$\E[X(X-1)]=n(n-1)p^2$, hence $\E[X^2]=n(n-1)p^2+np$ and $\Var{X}=np(1-p)$.
106108

107-
> Examples
108-
> - Three fair flips: $Y\sim\mathrm{Bin}(3,\tfrac12)$.
109+
> Examples
110+
>
111+
> - Three fair flips: $Y\sim\mathrm{Bin}(3,\tfrac12)$.
109112
> - Ten dice, number of sixes: $X\sim\mathrm{Bin}(10,\tfrac16)$.
110113
> - If you win \$5 per six, $Z=5X$ (not binomial). Then
114+
>
115+
> $$
116+
> \Pr(Z=10)=\Pr(X=2)=\binom{10}{2} \left(\tfrac16\right)^2 \left(\tfrac56\right)^8
117+
> $$
118+
>
119+
> $$
120+
> \E[Z]=5\,\E[X]=\tfrac{25}{3}
121+
> $$
122+
>
111123
> $$
112-
> \Pr(Z=10)=\Pr(X=2)=\binom{10}{2} \left(\tfrac16\right)^2 \left(\tfrac56\right)^8,\quad
113-
> \E[Z]=5\,\E[X]=\tfrac{25}{3},\quad
114-
> \Var{Z}=25\,\Var{X}=25\cdot 10\cdot\tfrac16\cdot\tfrac56.
124+
> \Var{Z}=25\,\Var{X}=25\cdot 10\cdot\tfrac16\cdot\tfrac56
115125
> $$
116126
117127
---

notes/courses/MATH-UA-333/09-sum-indep-rv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Let $X,Y$ be independent $\mathrm{Unif}(0,1)$, $Z=X+Y$.
7979
Then
8080

8181
$$
82-
f_Z(t) = \int_{-\infty}^{\infty} \mathbf{1}_{[0,1]}(x)\mathbf{1}_{[0,1]}(t-x) dx.
82+
f\_Z(t) = \int\_{-\infty}^{\infty} \mathbf{1}\_{[0,1]}(x)\mathbf{1}\_{[0,1]}(t-x) dx.
8383
$$
8484

8585
The integrand is $1$ exactly when $0 \le x\le1$ and $0 \le t-x\le1$.

notes/courses/MATH-UA-333/10-cond-dist-exp.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,7 @@ $$
9191
Thus
9292
$$
9393
f_{X\mid Y}(x\mid b)=
94-
\begin{cases}
95-
\displaystyle
96-
\frac{1}{2\sqrt{1-b^2}}, & -\sqrt{1-b^2}\le x\le\sqrt{1-b^2},\\[6pt]
97-
0, & \text{otherwise.}
98-
\end{cases}
94+
\frac{1}{2\sqrt{1-b^2}}, \quad \text{for }-\sqrt{1-b^2}\le x\le\sqrt{1-b^2} \quad \text{0 otherwise}
9995
$$
10096

10197
So given $Y=b$, $X$ is uniform on the horizontal chord.

notes/courses/MATH-UA-333/12-mgf.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ $$
1010
\mathbb{E}(X^n).
1111
$$
1212

13-
For a (deterministic) sequence $\{a_n\}_{n\ge 0}$, the **(ordinary) generating function** is
13+
For a (deterministic) sequence $(a_n)_{n\ge 0}$, the **(ordinary) generating function** is
14+
1415
$$
1516
F(z) = \sum_{n=0}^{\infty} a_n z^n.
1617
$$
18+
1719
Within the radius of convergence,
20+
1821
$$
1922
a_n = \frac{1}{n!} \frac{d^n}{dz^n} F(z)\bigg|_{z=0}.
2023
$$
@@ -100,7 +103,7 @@ $$
100103
> $$
101104
> M_X(t) =
102105
> \begin{cases}
103-
> \dfrac{\lambda}{\lambda - t}, & t < \lambda,\\[4pt]
106+
> \dfrac{\lambda}{\lambda - t}, & t < \lambda,\\
104107
> \infty, & t \ge \lambda.
105108
> \end{cases}
106109
> $$
@@ -117,25 +120,29 @@ $$
117120
> M_X(t) = \sum_{k=0}^{n} \binom{n}{k} (p e^t)^k (1-p)^{n-k}
118121
> = (1 - p + p e^t)^n.
119122
> $$
123+
>
120124
> Differentiate:
121125
> $$
122126
> M_X'(t) = n(1 - p + p e^t)^{n-1} \cdot p e^t,
123127
> $$
128+
>
124129
> $$
125130
> M_X''(t)
126-
> = n(n-1)(1 - p + p e^t)^{n-2} (p e^t)^2
127-
> + n(1 - p + p e^t)^{n-1} p e^t.
131+
> = n(n-1)(1 - p + p e^t)^{n-2} (p e^t)^2 + n(1 - p + p e^t)^{n-1} p e^t.
128132
> $$
133+
>
129134
> At $t=0$,
130135
> $$
131136
> \mathbb{E}(X) = M_X'(0)
132137
> = n(1 - p + p)^{n-1} p
133138
> = np,
134139
> $$
140+
>
135141
> $$
136142
> \mathbb{E}(X^2) = M_X''(0)
137143
> = n(n-1)p^2 + np.
138144
> $$
145+
>
139146
> Hence
140147
> $$
141148
> \operatorname{Var}(X)

notes/courses/MATH-UA-333/13-inequalities-exp.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,21 @@ These monotonicity properties are the starting point for Markov’s inequality.
3232
Let $X$ be a random variable with $X \ge 0$ almost surely and let $a>0$.
3333

3434
We have
35+
3536
$$
36-
X \ge X \mathbf{1}_{\{X\ge a\}} \ge a \mathbf{1}_{\{X\ge a\}}.
37+
X \ge X \mathbf{1}\_{\{X \ge a\}} \ge a \mathbf{1}\_{\{X \ge a\}}.
3738
$$
3839

3940
Taking expectations,
41+
4042
$$
41-
\mathbb{E}X \;\ge\; \mathbb{E}\big(X \mathbf{1}_{\{X\ge a\}}\big)
42-
\;\ge\; a\,\mathbb{E}\big(\mathbf{1}_{\{X\ge a\}}\big)
43-
= a\,\mathbb{P}(X\ge a).
43+
\mathbb{E}X \ge \mathbb{E} \big(X \mathbf{1}\_{\{X\ge a\}} \big) \ge a \mathbb{E}\big(\mathbf{1}\_{\{X \ge a\}} \big)
44+
= a \mathbb{P}(X \ge a)
4445
$$
4546

4647
Therefore
4748
$$
48-
\mathbb{P}(X\ge a) \le \frac{\mathbb{E}X}{a}.
49+
\mathbb{P}(X \ge a) \le \frac{\mathbb{E}X}{a}.
4950
$$
5051

5152
If $X$ is not necessarily nonnegative, we can apply Markov to $|X|$:

notes/courses/MATH-UA-333/14-lln.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,22 @@ $$
9292
First compute the mean and variance of $\overline{X}_n$:
9393

9494
- Linearity of expectation:
95-
$$
96-
\mathbb{E}\overline{X}_n
97-
= \mathbb{E}\left(\frac{1}{n}\sum_{k=1}^n X_k\right)
98-
= \frac{1}{n}\sum_{k=1}^n \mathbb{E}X_k
99-
= \mu.
100-
$$
95+
96+
$$
97+
\mathbb{E}\overline{X}\_n
98+
= \mathbb{E} \left(\frac{1}{n}\sum\_{k=1}^n X\_k\right)
99+
= \frac{1}{n}\sum\_{k=1}^n \mathbb{E}X\_k
100+
= \mu
101+
$$
102+
101103
- Independence and identical distribution give
102-
$$
103-
\operatorname{Var}(\overline{X}_n)
104-
= \operatorname{Var}\left(\frac{1}{n}\sum_{k=1}^n X_k\right)
105-
= \frac{1}{n^2} \sum_{k=1}^n \operatorname{Var}(X_k)
106-
= \frac{\sigma^2}{n}.
107-
$$
104+
105+
$$
106+
\operatorname{Var}(\overline{X}_n)
107+
= \operatorname{Var}\left(\frac{1}{n}\sum\_{k=1}^n X\_k\right)
108+
= \frac{1}{n^2} \sum\_{k=1}^n \operatorname{Var}(X\_k)
109+
= \frac{\sigma^2}{n}.
110+
$$
108111

109112
Now for any $\varepsilon>0$, Chebyshev’s inequality gives
110113
$$

notes/courses/MATH-UA-333/16-markov-chains.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ where $n$ is usually interpreted as discrete time.
1919
2020
### Markov property
2121

22-
We say a process $(X_n)_{n\ge 0}$ with values in $\mathcal{S}$ has the **Markov property** if for every $n\ge 0$ and all states
22+
We say a process $(X\_n)\_{n\ge 0}$ with values in $\mathcal{S}$ has the **Markov property** if for every $n\ge 0$ and all states
2323
$$
2424
i_0, i_1, \dots, i_{n-1}, i, j \in \mathcal{S},
2525
$$
@@ -76,13 +76,15 @@ Properties:
7676
7777
> **Example (Gambler’s dice game).**
7878
> You start with $6$ dollars. At each step:
79+
>
7980
> - Pay $1$ dollar to play.
8081
> - Roll a fair die:
8182
> - If you roll a $6$, you win $6$ dollars.
8283
> - Otherwise, you win nothing.
8384
> - You must stop once your money hits $0$.
8485
>
85-
> Let $X_n$ be the amount of money you have after the $n$-th play. Then $(X_n)_{n\ge 0}$ is a Markov chain with state space $\{0,1,2,\dots\}$.
86+
> Let $X_n$ be the amount of money you have after the $n$-th play. Then $(X_n)_{n\ge 0}$ is a Markov chain with state space $\{0,1,2,\dots\}$.
87+
>
8688
> - State $0$ is absorbing: once you have $0$, you stay there,
8789
> $$
8890
> p_{00} = 1, \quad p_{0j} = 0 \text{ for } j>0.
@@ -109,10 +111,10 @@ We can compute $v^{(n+1)}$ from $v^{(n)}$ using the transition matrix $P$.
109111

110112
For each state $j$,
111113
$$
112-
\mathbb{P}(X_{n+1} = j)
113-
= \sum_{i=1}^m \mathbb{P}(X_{n+1}=j, X_n = i)
114-
= \sum_{i=1}^m \mathbb{P}(X_{n+1}=j \mid X_n=i)\, \mathbb{P}(X_n=i)
115-
= \sum_{i=1}^m v^{(n)}_i p_{ij}.
114+
\mathbb{P}(X\_{n+1} = j)
115+
= \sum\_{i=1}^m \mathbb{P}(X\_{n+1}=j, X\_n = i)
116+
= \sum\_{i=1}^m \mathbb{P}(X\_{n+1}=j \mid X\_n=i)\, \mathbb{P}(X\_n=i)
117+
= \sum\_{i=1}^m v^{(n)}\_i p\_{ij}.
116118
$$
117119

118120
In matrix form,

notes/js/note.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,30 @@ fetch(`/notes/courses/${course}/${noteSlug}.md`)
190190
console.error(err);
191191
container.innerHTML = "<p>Could not load note.</p>";
192192
});
193+
194+
const tokenizer = {
195+
em(src) {
196+
// Only treat *...* as emphasis, ignore underscores
197+
const match = /^\*([^*]+)\*/.exec(src);
198+
if (!match) return;
199+
return {
200+
type: 'em',
201+
raw: match[0],
202+
text: match[1],
203+
tokens: this.lexer.inlineTokens(match[1])
204+
};
205+
},
206+
strong(src) {
207+
// Only treat **...** as strong emphasis, ignore __
208+
const match = /^\*\*([^*]+)\*\*/.exec(src);
209+
if (!match) return;
210+
return {
211+
type: 'strong',
212+
raw: match[0],
213+
text: match[1],
214+
tokens: this.lexer.inlineTokens(match[1])
215+
};
216+
}
217+
};
218+
219+
marked.use({ tokenizer });

posts/js/post.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,31 @@ fetch(`./posts/entries/${slug}.md`)
137137
.catch(e => {
138138
console.error(e);
139139
content.innerHTML = "<h2>Post not found</h2>";
140-
});
140+
});
141+
142+
const tokenizer = {
143+
em(src) {
144+
// Only treat *...* as emphasis, ignore underscores
145+
const match = /^\*([^*]+)\*/.exec(src);
146+
if (!match) return;
147+
return {
148+
type: 'em',
149+
raw: match[0],
150+
text: match[1],
151+
tokens: this.lexer.inlineTokens(match[1])
152+
};
153+
},
154+
strong(src) {
155+
// Only treat **...** as strong emphasis, ignore __
156+
const match = /^\*\*([^*]+)\*\*/.exec(src);
157+
if (!match) return;
158+
return {
159+
type: 'strong',
160+
raw: match[0],
161+
text: match[1],
162+
tokens: this.lexer.inlineTokens(match[1])
163+
};
164+
}
165+
};
166+
167+
marked.use({ tokenizer });

0 commit comments

Comments
 (0)