Skip to main content

Math Typesetting

5 mins·
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

Examples
#

Inline math: $\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…$

Block math:

$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$

More complex equations:

$$ F(\omega) = \int_{-\infty}^{\infty} f(t)e^{-i\omega t}dt $$

And the inverse transform is:

$$f(t) = \frac{1}{2\pi}\int_{-\infty}^{\infty} F(\omega)e^{i\omega t}d\omega$$

One powerful property is that differentiation in the time domain corresponds to multiplication by $i\omega$ in the frequency domain:

$$\mathcal{F}\left{\frac{df}{dt}\right} = i\omega F(\omega)$$

The Heat Equation
#

The heat equation in one dimension is:

$$\frac{\partial u}{\partial t} = \alpha \frac{\partial^2 u}{\partial x^2}$$

where $u(x,t)$ is the temperature at position $x$ and time $t$, and $\alpha$ is the thermal diffusivity.

The general solution can be written using Fourier series:

$$u(x,t) = \sum_{n=1}^{\infty} B_n e^{-\alpha n^2 \pi^2 t} \sin(n\pi x)$$

where $B_n$ are constants determined by the initial conditions.

I hope this post helps you test whether your site can properly render both inline math like $E = mc^2$ and block equations like:

$$\oint_C \vec{F} \cdot d\vec{r} = \iint_S (\nabla \times \vec{F}) \cdot d\vec{S}$$

This mix of inline and block mathematics should give you a good test case for your website’s LaTeX rendering capabilities!

Claude Math Rendering Test Document
#

This document contains various mathematical expressions in different formats to test the rendering capabilities of your markdown editor or website.

Inline Math
#

Inline math is typically written between single dollar signs $...$ in markdown.

The quadratic formula states that if $ax^2 + bx + c = 0$, then $x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$.

The area of a circle is $A = \pi r^2$ where $r$ is the radius.

Einstein’s famous equation $E = mc^2$ relates energy and mass.

Display Math
#

Display math (equations on their own line) typically uses double dollar signs $$...$$ or other delimiters.

The Pythagorean theorem:

$$a^2 + b^2 = c^2$$

The Gaussian integral:

$$\int_{-\infty}^{\infty} e^{-x^2} , dx = \sqrt{\pi}$$

Maxwell’s equations in differential form:

$$\begin{align} \nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \ \nabla \cdot \vec{B} &= 0 \ \nabla \times \vec{E} &= -\frac{\partial \vec{B}}{\partial t} \ \nabla \times \vec{B} &= \mu_0 \vec{J} + \mu_0 \varepsilon_0 \frac{\partial \vec{E}}{\partial t} \end{align}$$

Advanced Math Formatting
#

Matrices
#

A 2×2 matrix:

$$\begin{pmatrix} a & b \ c & d \end{pmatrix}$$

A 3×3 matrix:

$$\begin{bmatrix} 1 & 2 & 3 \ 4 & 5 & 6 \ 7 & 8 & 9 \end{bmatrix}$$

Fractions and Binomials
#

Nested fractions:

$$\frac{1}{\frac{1}{a} + \frac{1}{b}} = \frac{ab}{a+b}$$

Binomial coefficient:

$$\binom{n}{k} = \frac{n!}{k!(n-k)!}$$

Limits, Sums, and Integrals
#

Limit:

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

Sum:

$$\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$$

Double integral:

$$\iint_D f(x,y) , dx , dy = \int_a^b \int_c^d f(x,y) , dy , dx$$

Greek Letters and Special Symbols
#

Greek letters:

$$\alpha, \beta, \gamma, \delta, \epsilon, \zeta, \eta, \theta, \iota, \kappa, \lambda, \mu, \nu, \xi, \pi, \rho, \sigma, \tau, \upsilon, \phi, \chi, \psi, \omega$$

$$\Gamma, \Delta, \Theta, \Lambda, \Xi, \Pi, \Sigma, \Upsilon, \Phi, \Psi, \Omega$$

Special symbols:

$$\infty, \nabla, \partial, \exists, \forall, \in, \subset, \supset, \cup, \cap, \emptyset, \therefore, \because$$

Equations with Alignments
#

Aligned equations:

$$\begin{align} (a+b)^2 &= (a+b)(a+b) \ &= a^2 + ab + ba + b^2 \ &= a^2 + 2ab + b^2 \end{align}$$

Chemical Equations
#

Chemical reaction:

$$\ce{C6H12O6 + 6O2 -> 6CO2 + 6H2O}$$

Alternative Math Syntaxes
#

Some markdown processors support alternative syntaxes. Here are examples:

LaTeX-style Delimiters
#

Inline math with \(...\):

The derivative of position is velocity: (v = \frac{dx}{dt})

Display math with \[...\]:

[\vec{F} = m\vec{a}]

MathML (if supported)
#

x = b ± b 2 4 a c 2 a

Complex Mathematical Content
#

A Proof
#

Theorem: For any positive integer $n$, the sum of the first $n$ positive integers is $\frac{n(n+1)}{2}$.

Proof: We proceed by induction.

Base case: For $n = 1$, we have $\sum_{i=1}^{1} i = 1 = \frac{1(1+1)}{2} = 1$. ✓

Inductive step: Assume that for some positive integer $k$, we have $\sum_{i=1}^{k} i = \frac{k(k+1)}{2}$.

Then for $n = k+1$:

$$\begin{align} \sum_{i=1}^{k+1} i &= \sum_{i=1}^{k} i + (k+1) \ &= \frac{k(k+1)}{2} + (k+1) \ &= \frac{k(k+1)}{2} + \frac{2(k+1)}{2} \ &= \frac{k(k+1) + 2(k+1)}{2} \ &= \frac{(k+1)(k+2)}{2} \ &= \frac{(k+1)((k+1)+1)}{2} \end{align}$$

This completes the induction step, proving that $\sum_{i=1}^{n} i = \frac{n(n+1)}{2}$ for all positive integers $n$. ■

A Statistical Formula
#

The probability density function of a normal distribution:

$$f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$

Where $\mu$ is the mean and $\sigma$ is the standard deviation.

A Physics Equation
#

The Schrödinger equation in quantum mechanics:

$$i\hbar \frac{\partial}{\partial t} \Psi(\mathbf{r},t) = \hat{H} \Psi(\mathbf{r},t)$$

Where $\Psi$ is the wave function, $\hat{H}$ is the Hamiltonian operator, and $\hbar$ is the reduced Planck constant.

Testing Edge Cases
#

Very long equation:

$$\begin{align} \frac{d}{dx}\left( \int_{a(x)}^{b(x)} f(x,t) , dt \right) = f(x,b(x)) \cdot \frac{d}{dx}b(x) - f(x,a(x)) \cdot \frac{d}{dx}a(x) + \int_{a(x)}^{b(x)} \frac{\partial}{\partial x}f(x,t) , dt \end{align}$$

Nested subscripts and superscripts:

$$S_{i_{j_{k_{l}}}} = x^{y^{z^{w}}}$$

Multi-line equation with cases:

$$f(x) = \begin{cases} x^2, & \text{if } x \geq 0 \ -x^2, & \text{if } x < 0 \end{cases}$$

Conclusion
#

If your markdown editor or website correctly renders all or most of these mathematical expressions, it should be well-equipped to handle math content generated by LLMs. Different markdown processors support different subsets of LaTeX math syntax, so it’s normal if some of the more complex examples don’t render perfectly.

Related

Emoji Support
1 min
Emoji