This note is a template for the notes system. Copy this file as a starting point for any new note. Math is rendered at build time with KaTeX, so pages ship as plain HTML — no client-side math JavaScript.

A note on math delimiters: prefer \(...\) for inline and \[...\] for display, since Markdown's _ and * can collide with subscripts/multiplication inside $...$. Both work, but the backslash forms are safer. Display math must be surrounded by blank lines — a \[ opened mid-paragraph will not render.

1. Inline and Display Math

Inline: the Gaussian distribution is p(x)=12πσ2e(xμ)22σ2p(x) = \frac{1}{\sqrt{2\pi\sigma^2}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}. Custom macros work too: the norm v\norm{v} and the inner product u,v\inner{u}{v}.

Display mode centers the equation:

L(θ)=i=1Nlogpθ(xi) \mathcal{L}(\theta) = -\sum_{i=1}^{N} \log p_\theta(x_i)

2. Numbered Equations

KaTeX does not auto-number equations; use \tag{...} to number the ones you want to reference:

p(θx)=p(xθ)p(θ)p(x)(1) p(\theta \mid x) = \frac{p(x \mid \theta)\, p(\theta)}{p(x)} \tag{1}

Bayes' theorem (1) is the foundation of probabilistic inference.

3. Aligned Systems

Wrap aligned inside display math:

θL=i=1Nθlogpθ(xi)=i=1Nθpθ(xi)pθ(xi)=NExpθ ⁣[θlogpθ(x)]. \begin{aligned} \nabla_\theta \mathcal{L} &= -\sum_{i=1}^{N} \nabla_\theta \log p_\theta(x_i) \\ &= -\sum_{i=1}^{N} \frac{\nabla_\theta p_\theta(x_i)}{p_\theta(x_i)} \\ &= -N\, \E_{x \sim p_\theta}\!\left[\nabla_\theta \log p_\theta(x)\right]. \end{aligned}

4. Matrices

A=(a11a12a21a22),det(A)=a11a22a12a21. A = \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}, \qquad \det(A) = a_{11}a_{22} - a_{12}a_{21}.

5. Callout Boxes

Callouts are plain HTML — Markdown lets you mix raw HTML freely. Leave a blank line after the opening <div> and before the closing </div> so the content inside is still processed as Markdown (including math):

Definition

A function f:RnRf: \R^n \to \R is convex if for all x,yRnx, y \in \R^n and λ[0,1]\lambda \in [0,1],

f(λx+(1λ)y)λf(x)+(1λ)f(y). f(\lambda x + (1-\lambda)y) \leq \lambda f(x) + (1-\lambda)f(y).
Theorem (Jensen's Inequality)

If ff is convex and XX is a random variable, then f(E[X])E[f(X)]f(\E[X]) \leq \E[f(X)].

Remark

Equality holds iff XX is constant a.s. or ff is affine.

Warning

Do not confuse the empirical risk L^N\hat{\mathcal{L}}_N with the population risk L\mathcal{L}; the gap matters when NN is small.

6. Code Blocks

Fenced code blocks are highlighted at build time (PrismJS via Eleventy — no client-side JS):

import numpy as np

def gradient_descent(f_grad, x0, lr=1e-3, steps=1000):
    """Vanilla gradient descent."""
    x = x0.copy()
    for _ in range(steps):
        x -= lr * f_grad(x)
    return x
mu = np.zeros(2)
Sigma = np.array([[1.0, 0.8],
                  [0.8, 1.0]])
samples = np.random.multivariate_normal(mu, Sigma, size=1000)

7. Lists and Inline Code

Available macros (defined in .eleventy.js):

  • \RR\R (reals)
  • \EE\E (expectation)
  • \norm{v}v\norm{v}
  • \abs{x}x\abs{x}
  • \inner{u}{v}u,v\inner{u}{v}

To add a new note: drop a .md file into src/notes/ with frontmatter (layout, title, date, displayDate, tags, description), then run npm run build. The notes index updates automatically. Add draft: true to keep a note off the index while you write it.