- Inline math
- Theorem
- Characters
- Multi-line equations
- Rotational Symmetry of the Laplacian
- The Laplacian in Polar Coordinates
- Basic tests to check interference with markdown.
- Sub and super scripts.
- Smileys
- Checking if * and _ mess up math
- MathJAX equation reference test
- Custom macro tests
- Inequalities
- Limits
- Topics
Testing math content rendering with MathJax. Test cases are originally copy from Gautam Iyer's test cases, and then gradually modified and suplemented.
Inline math
This is an equation: $E = m c2$.
Theorem
Theorem (Mean Value Property). Let $\Omega \subset \mathbb{R}^3$ be a domain, and $u$ is harmonic in $\Omega$ (i.e. $u = 0$ in $\Omega$). Suppose $B$ is a ball of radius $R$ and center $x_0$ that is completely contained in $\Omega$. Then $$ u(x_0) = \frac{1}{4 \pi R2} \int_{\partial B} u \, dS $$
Characters
Subscripts
Subscripts: ${{a} {1}}^{{b} {1}}$
Curly braces
The curly brace is a special character in LaTeX. Therefore, to
display it, it needs to be escaped by a backslash. The backslash
that is not part of the original LaTeX keyword such as
\right
needs to be escaped. So, at the end you need
\\}
to display a closing curly brace:
\left \\{X_1, X_2, \cdots, X_N \right \\}
displays
as $\left \{X_1, X_2, \cdots, X_N \right \}$.
Multi-line equations
$$ \begin{equation} \label{eq1} \begin{split} A & = \frac{\pi r2}{2} \\ & = \frac{1}{2} \pi r2 \end{split} \end{equation} $$
$$ \begin{align} 2x - 5y &= 8 \\ 3x + 9y &= -12 \end{align} $$
$$ \begin{align} x&=y & w &=z & a&=b+c\\ 2x&=-y & 3w&=\frac{1}{2}z & a&=b\\ -4 + 5x&=2+y & w+2&=-1+w & ab&=cb \end{align} $$
Rotational Symmetry of the Laplacian
Let $T:\Real2 \to \Real2$ be a rotation, and $u$ be any function. Then $$ \Laplace (u \circ T) = (\Laplace u) \circ T $$ This is also true in higher dimensions.
Given that the Laplacian has this rotational symmetry, one might expect a nice cancellation / compact formula for the Laplacian in polar coordinates. We try this next.
The Laplacian in Polar Coordinates
Let $\hat x$, $\hat y$ be the unit vectors in the $x$ and $y$ direction respectively, and let $\hat r$ and $\hat \theta$ be the unit vectors in the $r$ and $\theta$ direction respectively. Explicitly, $$ \hat x = \begin{pmatrix}1\cr 0\end{pmatrix},\quad \hat y = \begin{pmatrix}0\cr1\end{pmatrix},\quad \hat r = \frac{1}{r}\begin{pmatrix}x\cr y\end{pmatrix},\quad \hat \theta = \frac{1}{r}\begin{pmatrix}-y\cr x\end{pmatrix}. $$
First we compute that $$ \Grad u = \partial_x u \hat x + \partial_y u \hat y = \partial_r u \hat r + \frac{1}{r} \partial\theta u \hat \theta. $$ Now we compute $$ \Laplace u = \Div \Grad u = (\Grad \partial_r u) \cdot \hat r + \partial_r u (\Div \hat r) + (\Grad \frac{1}{r} \partial\theta u) \cdot \hat \theta + 0 = \partial_r2 u + \partial_r u (\Div \hat r) + \frac{1}{r2} \partial_\theta2 u. $$
To finish the calculation, we only need to compute $\Div \hat r$. We do this as follows $$ \Div \hat r = \Div \left( \frac{1}{r} \begin{pmatrix} x \cr y \end{pmatrix} \right) = \frac{2}{r} + \Grad\left( \frac{1}{r} \right) \cdot \begin{pmatrix} x \cr y \end{pmatrix} = \frac{2}{r} - \frac{1}{r} = \frac{1}{r}. $$ Substituting back gives $$ \Laplace u = \partial_r2 u + \frac{1}{r} \partial_r u + \frac{1}{r2} \partial_\theta2 u. $$
Basic tests to check interference with markdown.
Sub and super scripts.
Here's a superscript without math: ab, a_b. Here they are with math:
-
One backslash: ( ab, a_b ).
-
Two backslashes: \( ab, a_b \).
-
Three backslashes: \( ab, a_b \).
Smileys
{x}
produces in normal mode. In math mode it will mess
things up! However, smileys need whitespace before and
after to be recognized. So while $ {x} $
will mess
things up, ${x}$
will be OK and produce ${x}$.
Checking if * and _ mess up math
The code
$$
a * b + b * c \qquad
a_b + b_c, \qquad
a^{b + c}
$$
produces $$ a * b + b * c \qquad a_b + b_c, \qquad a^{b + c} $$
MathJAX equation reference test
Here is a labeled equation: \begin{equation}x+1\over\sqrt{1-x2}\label{ref1}\end{equation} with a reference to ref1: \ref{ref1}, and another numbered one with no label: $$x+1\over\sqrt{1-x2}$$ This one uses \nonumber: \begin{equation}x+1\over\sqrt{1-x2}\nonumber\end{equation}
Here's one using the equation environment: \begin{equation} x+1\over\sqrt{1-x2} \end{equation} and one with equation environment: \begin{equation} x+1\over\sqrt{1-x2} \end{equation*}
This is a forward reference [\ref{ref2}] and another \eqref{ref2} for the following equation: \begin{equation}x+1\over\sqrt{1-x2}\label{ref2}\end{equation} More math: $$x+1\over\sqrt{1-x2}$$ Here is a ref inside math: (\ref{ref2}+1) and text after it.
\begin{align} x& = y_1-y_2+y_3-y_5+y_8-\dots && \text{by \eqref{ref1}}\cr & = y'\circ y^* && \text{(by \eqref{ref3})}\cr & = y(0) y' && \text {by Axiom 1.} \end{align}
Here's a bad ref [\ref{ref4}] to a nonexistent label.
An alignment: \begin{align} a&=b\label{ref3}\cr &=c+d \end{align} and a starred one: \begin{align} a&=b\cr &=c+d \end{align}
Custom macro tests
This tests some of my predefined macros.
Inequalities
$$ a < b, \quad a \leq b \quad a \geq b \quad a > b. $$
Limits
Inline limits: $\displaystyle \lim {x \to a} \frac{1}{x}$, $\displaystyle \max {0, 1}$.
Displayed \displaystyle {\operatorname{ess} \sup} _{x \in
\Real}
produces $$ \displaystyle {\operatorname{ess} \sup}
_{x \in \Real} $$
Topics
Subscript _{xxx}
needs to be escaped
\_{xxx}
Since pairs of _
denotes emphasis in Markdown
syntax, it needs to be escaped:
$$
\begin{align}
\hat\sigma^2\_\mathrm{N}
&= \frac{1}{N} \sum\_{i=1}^N \left( X\_i - \bar{X}\_N \right)^2 \\\\
&= \frac{1}{N} \sum\_{i=1}^N \left( X\_i^2 - \bar{X}\_N^2 \right)~,
\end{align}
$$
$$ \begin{align} \hat\sigma2_\mathrm{N} &= \frac{1}{N} \sum_{i=1}^N \left( X_i - \bar{X}_N \right)2 \\ &= \frac{1}{N} \sum_{i=1}^N \left( X_i2 - \bar{X}_N2 \right)~, \end{align} $$
Or, use a white space in front of _
:
$$
\begin{align}
\hat\sigma^2\_\mathrm{N}
&= \frac{1}{N} \sum\_{i=1}^N \left( X\_i - \bar{X}\_N \right)^2 \\\\
&= \frac{1}{N} \sum\_{i=1}^N \left( X\_i^2 - \bar{X}\_N^2 \right)~,
\end{align}
$$
$$ \begin{align} \hat\sigma2 \mathrm{N} &= \frac{1}{N} \sum {i=1}^N \left( X i - \bar{X} N \right)2 \\ &= \frac{1}{N} \sum {i=1}^N \left( X i2 - \bar{X} _N2 \right)~, \end{align} $$