# Mathematics

Docutils supports inline math with the prefix or postfix `:math:` role specificator, \(n! + \sin(x_n^2)\) and \(A_\text{c} = \frac{\pi}{4} d^2\), as well as displayed math via the math directive:

\begin{equation*} f(\epsilon) = \frac{1}{1 + \exp\left(\frac{\varepsilon}{k_\text{B}T}\right)} \end{equation*}

Content may start on the first line of the directive, e.g.

\begin{equation*} N = \frac{\text{number of apples}}{7} \end{equation*}

Equations can be labeled with a reference name using the `:name:` option. See eq:M and eq:schrödinger below.

The determinant of the matrix

\begin{equation*} \mathbf{M} = \left(\begin{matrix}a&b\\c&d\end{matrix}\right) \end{equation*}

is \(|\mathbf{M}| = ad - bc\).

More than one display math block can be put in one math directive. For example, the following sum and integral with limits:

\begin{equation*} \int_0^1 x^n dx = \frac{1}{n + 1} \end{equation*}
\begin{equation*} \sum_{n=1}^m n = \frac{m(m+1)}{2} \end{equation*}

LaTeX-supported Unicode math symbols can be used in math roles and directives:

The Schrödinger equation

\begin{equation*} i\hbar \frac{\partial }{\partial t}\Psi = \hat{H}\Psi , \end{equation*}

with the wave function \(\Psi \), describes how the quantum state of a physical system changes in time.

Math-Accents:

  \(\acute{a}\) `\acute{a}` | \(\dot{t}\) `\dot{t}` | \(\hat{\gamma}\) `\hat{\gamma}`
  \(\grave{a}\) `\grave{a}` | \(\ddot{t}\) `\ddot{t}` | \(\tilde{\alpha}\) `\tilde{\alpha}`
  \(\breve{x}\) `\breve{x}` | \(\dddot{t}\) `\dddot{t}` | \(\vec{\imath}\) `\vec{\imath}`
  \(\check{a}\) `\check{a}` | \(\bar{a}\) `\bar{a}` | \(\vec{R}\) `\vec{R}`

Modulation Transfer Function:

\begin{equation*} \text{MTF} = \left|\frac{\mathcal{F}\{s(x)\}} {\mathcal{F}\{ s(x)\} |_{\omega _{x}=0}}\right| = \mathrm{abs}\left(\frac {\int _{-\infty }^{\infty }s(x) \mathrm{e}^{\mathrm{i}\omega _{x}x}\mathrm{d}{x}} {\int _{-\infty }^{\infty }s(x)\mathrm{d}{x}} \right). \end{equation*}

Math split over two lines: If a double backslash is detected outside a `\begin{...} \end{...}` pair, the math code is wrapped in an AMSmath `align` environment:

\begin{align*} s_{\mathrm{out}}(x) & = s_{\mathrm{in}}(x') * s_\delta (x-x') \\ & = \int s_{\mathrm{in}}(x')s_\delta (x-x')\mathrm{d}x' \end{align*}

Cases ("manually", with `matrix` environment):

\begin{equation*} \mathrm{sgn}(x) = \left\{\begin{matrix} -1 & x<0\\ 1 & x>0 \end{matrix}\right. \end{equation*}

Cases with the AMSmath `cases` environment (not (yet) supported by HTML writers with `--math-output=MathML`):

\begin{equation*} \mathrm{sgn}(x) = \begin{cases} -1 & x<0\\ 1 & x>0 \end{cases} \end{equation*}