Skip to content

Math

Math can be written directly in MDX. Use it near the prose and executable cells that depend on the notation so readers do not have to jump between pages.

Inline math uses single dollar signs. In the logistic map, the state is xn[0,1]x_n \in [0, 1] and the parameter is r[0,4]r \in [0, 4].

Subscripts and superscripts also work together: xn+x2x_n + x^2.

Block math uses double dollar signs:

xn+1=rxn(1xn)x_{n+1} = r x_n (1 - x_n) xn+x2x_n + x^2 A=[123456789]A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} f(x)=x2+2x+1=(x+1)2\begin{aligned} f(x) &= x^2 + 2x + 1 \\ &= (x + 1)^2 \end{aligned}

Use an executable cell when readers should verify or vary a formula.

Python + Pyodide

Calculate a quadratic with Python

Cell actions
Cell inputs
y = x**2 + 2*x + 1
print(f"f({x}) = {y}")

Run the cell to show its output.