#19 Math Formulas & Scientific Notation

Input math formulas in the editor — from basic arithmetic to AI matrix operations, all rendered instantly into beautiful mathematical typography.

Two Ways to Insert

Method 1: π Button

Click the π button in the toolbar to insert a sample formula $E=mc^2$, then edit it to match your content.

Method 2: Direct Input

Wrap your formula in $...$: type $ at the start, enter your formula, then type $ at the end — it auto-renders as a formatted image.

You type Result
$x + y = z$ $x + y = z$
$E=mc^2$ $E=mc^2$
$\pi \approx 3.14159$ $\pi \approx 3.14159$

Edit Formulas

Click a rendered formula → switches to edit mode → make changes and click elsewhere to confirm.


Basic Examples

Fractions & Roots

Syntax Result
$\frac{a}{b}$ $\frac{a}{b}$
$\frac{1}{2} + \frac{1}{3} = \frac{5}{6}$ $\frac{1}{2} + \frac{1}{3} = \frac{5}{6}$
$\sqrt{x}$ $\sqrt{x}$
$\sqrt{a^2 + b^2}$ $\sqrt{a^2 + b^2}$
$\sqrt[3]{x}$ $\sqrt[3]{x}$

Exponents & Logarithms

Syntax Result
$e^{x}$ $e^{x}$
$2^{10} = 1024$ $2^{10} = 1024$
$\log_2 x$ $\log_2 x$
$\ln e = 1$ $\ln e = 1$

Greek Letters

Syntax Result Common Use
$\alpha, \beta, \gamma$ $\alpha, \beta, \gamma$ Angles, coefficients
$\theta$ $\theta$ Parameters, angles
$\sigma$ $\sigma$ Standard deviation, Sigmoid
$\mu$ $\mu$ Mean value
$\lambda$ $\lambda$ Learning rate, regularization
$\nabla$ $\nabla$ Gradient operator
$\partial$ $\partial$ Partial derivative

Intermediate Examples

Summation & Product

$\sum_{i=1}^{n} x_i = x_1 + x_2 + \cdots + x_n$

$\prod_{i=1}^{n} x_i = x_1 \cdot x_2 \cdots x_n$

Limits & Derivatives

$\lim_{x \to 0} \frac{\sin x}{x} = 1$

$\frac{d}{dx} e^x = e^x$

$\frac{d}{dx} \ln x = \frac{1}{x}$

Integration

$\int_0^{\infty} e^{-x}\, dx = 1$

$\int_a^b f(x)\, dx = F(b) - F(a)$


Advanced: AI / ML Matrix Operations

Matrices & Vectors

Define a matrix:

$\mathbf{A} = \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix}$

Matrix multiplication:

$\mathbf{C} = \mathbf{A} \cdot \mathbf{B}, \quad c_{ij} = \sum_{k} a_{ik} b_{kj}$

Transpose: $(\mathbf{A}^T)_{ij} = a_{ji}$

Linear Layer (Forward Pass)

$\mathbf{y} = \mathbf{W} \mathbf{x} + \mathbf{b}$

Where $\mathbf{W} \in \mathbb{R}^{m \times n}$, $\mathbf{x} \in \mathbb{R}^{n}$, $\mathbf{b} \in \mathbb{R}^{m}$.

Loss Functions

Mean Squared Error (MSE):

$L_{MSE} = \frac{1}{N} \sum_{i=1}^{N} (y_i - \hat{y}_i)^2$

Cross-Entropy:

$L_{CE} = -\frac{1}{N} \sum_{i=1}^{N} y_i \log(\hat{y}_i)$

Activation Functions

Sigmoid:

$\sigma(x) = \frac{1}{1 + e^{-x}}$

Softmax:

$\text{softmax}(x_i) = \frac{e^{x_i}}{\sum_{j=1}^{K} e^{x_j}}$

ReLU:

$\text{ReLU}(x) = \max(0, x)$

Gradient Descent

Basic update rule:

$\theta_{t+1} = \theta_t - \eta \nabla_\theta L(\theta_t)$

Adam optimizer update:

$m_t = \beta_1 m_{t-1} + (1 - \beta_1) g_t$

$v_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2$

$\theta_{t+1} = \theta_t - \frac{\eta}{\sqrt{\hat{v}_t} + \epsilon} \hat{m}_t$

Backpropagation

Chain rule:

$\frac{\partial L}{\partial \mathbf{W}} = \frac{\partial L}{\partial \mathbf{y}} \cdot \mathbf{x}^T$

Weight update:

$\mathbf{W} \leftarrow \mathbf{W} - \alpha \frac{\partial L}{\partial \mathbf{W}}$

Attention (Transformer)

$\text{Attention}(\mathbf{Q}, \mathbf{K}, \mathbf{V}) = \text{softmax}\!\left(\frac{\mathbf{Q}\mathbf{K}^T}{\sqrt{d_k}}\right)\mathbf{V}$


KaTeX Cheat Sheet

Effect Syntax
Fraction \frac{numerator}{denominator}
Square root \sqrt{x}
Superscript x^{2}
Subscript x_{i}
Summation \sum_{i=1}^{n}
Integral \int_a^b
Vector \mathbf{v}
Matrix \begin{pmatrix} a & b \\\\ c & d \end{pmatrix}
Partial derivative \frac{\partial f}{\partial x}
Approximately \approx
Element of \in
Real numbers \mathbb{R}

Full syntax reference: KaTeX Supported Functions