Math#

Unicode Characters vs LaTeX Commands#

Use UTF-8 unicode characters in narrative text, but LaTeX commands in math environments:

In Narrative Text#

Use UTF-8 unicode characters (α, β, γ, etc.) in all narrative text except when inside LaTeX environments:

The parameter α controls the utility function, and β represents the discount factor.
In economic models, we often see parameters like σ, θ, and ρ.

In LaTeX Math Environments#

Use LaTeX commands (\alpha, \beta, etc.) inside LaTeX environments such as $, $$, and :math::

The utility function is $u(c) = \frac{c^{1-\alpha}}{1-\alpha}$ where $\alpha > 0$.

$$
\max \mathbb{E} \sum_{t=0}^{\infty} \beta^t u(c_t)
$$

The discount factor is {math}`\beta \in (0,1)`.

In Code#

Use UTF-8 unicode characters in variable names and code (see Code Style Guide):

def utility_function(c, α=0.5, β=0.95):
    return (c**(1-α) - 1) / (1-α) * β

Note

This approach ensures proper LaTeX rendering in math environments while maintaining readability in narrative text and code.

Notation#

Use \top(e.g., \(A^\top\)) to represent the transpose of a vector or matrix.

Use \mathbb{1}(\(\mathbb{1}\)) to represent a vector or matrix of ones and explain it in the lecture (e.g., “Let \(\mathbb{1}\) be an \(n \times 1\) vector of ones…”).

Matrices always use square brackets and \begin{bmatrix} ... \end{bmatrix} should be used.

Do not use bold face for either matrices or vectors

Sequences use curly brackets, such as \{ x_t \}_{t=0}^{\infty}

Probability, expectation, and variance#

Use \mathbb{P} for probability, with braces \{...\} for events and parentheses (...) for sets:

$\mathbb{P}\{X = 5\}$, $\mathbb{P}\{X \leq x\}$, $\mathbb{P}(B)$

Use \mathbb{E} for expectation and \mathbb{V} for variance:

$\mathbb{E}[X]$, $\mathbb{V}[X]$

Distribution names#

Use plain letters for named distributions — not \mathcal or \mathbb. For multi-letter distribution names use \mathrm:

$X \sim N(\mu, \sigma^2)$, $\theta \sim \mathrm{Beta}(\alpha, \beta)$

Density and mass functions#

Use lowercase letters (e.g., \(f\), \(g\), \(p\)) for density and mass functions, uppercase for CDFs:

$f(x)$ for the density, $F(x)$ for the CDF

Multiplication in equations#

Use \cdot or juxtaposition for multiplication in LaTeX — never use *.

IID#

Write “IID” in text (not “i.i.d.” or “iid”).

The use of align environments can be done using the \begin{aligned} ... \end{aligned} when inside a math environment such as $$

Tip

PDF:

Using aligned when inside a math environment (such as $$) is important for building pdf output

$$
\begin{aligned}

\end{aligned}
$$

This is because the $$ is already a math environment and causes the LaTeX build to fail when using align due to the issue of multiple math environments.

The LaTeX aligned environment is purpose built for using within math environments.

It is also important to not use \tag in equations for manual equation numbering and instead make use of the in-built equation numbering such as

$$
x_y = 2
$$ (label)

which can be referenced using the role

and here is the reference to {eq}`label`