Extension:Math/MathJax testing

From MediaWiki.org
Jump to: navigation, search
When you click a MathJax formula, you get an instantly zoomed version of it for improved readability. MathJax formulas can also copied and pasted, and scaled without loss of quality for printing, higher resolution displays, or better readability.

MathJax is a JavaScript display engine for mathematics. It's an alternative to PNG rendering for Wikimedia sites. MathJax is slower to render, but more scalable (infinite zoom) and manipulable than PNG.

MathJax is currently enabled on this wiki (mediawiki.org), but you have to explicitly enable it in your user preferences (under Appearance -> Math). Otherwise you'll still see the old-school PNG images.

How to test:

Examples and tests[edit]

{{\gamma}_{\text{S}}}={{\rho}_{\text{S}}}\cdot \text{g}\quad[\text{kN}/\text{m}^\text{3} ]

Following examples copied from English Wikipedia math help page.

Quadratic polynomial[edit]

ax^2 + bx + c = 0

{{\gamma}_{\text{S}}}={{\rho}_{\text{S}}}\cdot \text{g}\quad[\text{kN}/\text{m}^\text{3}

<math>ax^2 + bx + c = 0</math>

Quadratic polynomial (force PNG rendering)[edit]

ax^2 + bx + c = 0\,\!
<math>ax^2 + bx + c = 0\,\!</math>

Quadratic formula[edit]

x={-b\pm\sqrt{b^2-4ac} \over 2a}
<mth>x={-b\pm\sqrt{b^2-4ac} \over 2a}</math>

Tall parentheses and fractions[edit]

2 = \left( \frac{\left(3-x\right) \times 2}{3-x} \right)
<math>2 = \left(
 \frac{\left(3-x\right) \times 2}{3-x}
 \right)</math>
S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}
 <math>S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}</math>
 
x=\frac{a \times b}{c}\text{full month's benefits}\times\frac{(\text{number of days in month}+1-\text{date of application})}{\text{number of days in month}} =\text{allotment}

Integrals[edit]

\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy
<math>\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds
 = \int_a^x f(y)(x-y)\,dy</math>

Summation[edit]

\sum_{i=0}^{n-1} i
<math>\sum_{i=0}^{n-1} i</math>
\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)}
<math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}
 {3^m\left(m\,3^n+n\,3^m\right)}</math>

Differential equation[edit]

u'' + p(x)u' + q(x)u=f(x),\quad x>a
<math>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>

Complex numbers[edit]

|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)
<math>|\bar{z}| = |z|,
 |(\bar{z})^n| = |z|^n,
 \arg(z^n) = n \arg(z)</math>

Limits[edit]

\lim_{z\rightarrow z_0} f(z)=f(z_0)
<math>\lim_{z\rightarrow z_0} f(z)=f(z_0)</math>

Integral equation[edit]

\phi_n(\kappa)
 = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R} \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR
<math>\phi_n(\kappa) =
 \frac{1}{4\pi^2\kappa^2} \int_0^\infty
 \frac{\sin(\kappa R)}{\kappa R}
 \frac{\partial}{\partial R}
 \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR</math>

Example[edit]

\phi_n(\kappa) = 0.033C_n^2\kappa^{-11/3},\quad \frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}
<math>\phi_n(\kappa) = 
 0.033C_n^2\kappa^{-11/3},\quad
 \frac{1}{L_0}\ll\kappa\ll\frac{1}{l_0}</math>

Continuation and cases[edit]

f(x) = \begin{cases}1 & -1 \le x < 0 \\
 \frac{1}{2} & x = 0 \\ 1 - x^2 & \text{otherwise}\end{cases}
<math>
 f(x) =
 \begin{cases}
 1 & -1 \le x < 0 \\
 \frac{1}{2} & x = 0 \\
 1 - x^2 & \text{otherwise}
 \end{cases}
 </math>

Prefixed subscript[edit]

{}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z) = \sum_{n=0}^\infty \frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}\frac{z^n}{n!}
<math>{}_pF_q(a_1,\dots,a_p;c_1,\dots,c_q;z)
 = \sum_{n=0}^\infty
 \frac{(a_1)_n\cdots(a_p)_n}{(c_1)_n\cdots(c_q)_n}
 \frac{z^n}{n!}</math>

Fraction and small fraction[edit]

\frac{a}{b}\ \tfrac{a}{b}
<math>\frac{a}{b}\ \tfrac{a}{b}</math>

Area of a quadrilateral[edit]

S=dD\,\sin\alpha\!
<math>S=dD\,\sin\alpha\!</math>

Volume of a sphere-stand[edit]

V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]
<math>V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]</math>

Multiple equations[edit]

\begin{align}
  u & = \tfrac{1}{\sqrt{2}}(x+y) \qquad & x &= \tfrac{1}{\sqrt{2}}(u+v)\\
  v & = \tfrac{1}{\sqrt{2}}(x-y) \qquad & y &= \tfrac{1}{\sqrt{2}}(u-v)
 \end{align}
 
<math>{\begin{aligned}q_{1}&=\cos 
\left({\frac {\phi -\psi }{2}}\right)\sin \left({\frac {\theta 
}{2}}\right)\\q_{2}&=\sin \left({\frac {\phi -\psi }{2}}\right)\sin 
 \left({\frac {\theta }{2}}\right)\\q_{3}&=\sin \left({\frac {\phi 
+\psi }{2}}\right)\cos \left({\frac {\theta 
}{2}}\right)\\q_{4}&=\cos \left({\frac {\phi +\psi }{2}}\right)\cos 
 \left({\frac {\theta }{2}}\right)\end{aligned}}</math>

task T38059[edit]

1 < 2 \& 3 > 4
\begin{align} 1 < 2 & 3 > 4 \end{align}

Failed to parse (unknown function "\upgamma"): {{\upgamma}_{\text{S}}}={{\uprho}_{\text{S}}}\cdot \text{g}\quad[\text{kN}/\text{m}^\text{3}

Equation references[edit]

Failed to parse (unknown function "\begin"): \begin{equation}\label{eq1} x = \sin(y) \end{equation}

The above has label Failed to parse (unknown function "\ref"): \ref{eq1}

<math>\begin{equation}\label{eq1}
 x = \sin(y)
 \end{equation}</math>
The above has label <math>\ref{eq1}</math>

CJK[edit]

Failed to parse (lexing error): 中文
\text{中文}(<math>\text{中文}</math> displays nothing)
Failed to parse (lexing error): 中\text{文}

Textstyles[edit]

\textbf{bold text}
\textit{itallic text}
\textrm{roman text}
\texttt{teletype text} should render as Failed to parse (unknown function "\tt"): {\tt teletype\ text}
\textsf{sanserif text} should render as Failed to parse (unknown function "\sf"): {\sf sanserif\ text}
\emph{emphasized text}

Also in Latex 2e

Failed to parse (unknown function "\textmd"): \textmd{midsize text} should render as Failed to parse (unknown function "\md"): {\md midsize\ text}
Failed to parse (unknown function "\textup"): \textup{upper case text} should render as Failed to parse (unknown function "\up"): {\up upper\ case\ text}
Failed to parse (unknown function "\textsl"): \textsl{slanted text} should render as Failed to parse (unknown function "\sl"): {\sl slanted\ text}
Failed to parse (unknown function "\textsc"): \textsc{small cap text} should render as Failed to parse (unknown function "\sc"): {\sc small\ cap\ text}

Nesting

\textit{\textbf{Nested bold and itallic}}
\textbf{\textit{Nested itallic and bold}}
Failed to parse (unknown function "\upgamma"): \textbf{\upgamma{Mathroman}}

Math font styles

\mathbf{bold\ text}
\mathit{itallic\ text}
\mathrm{roman\ text}
\mathtt{teletype\ text}
\mathsf{sanserif\ text}
Failed to parse (unknown function "\mathnormal"): \mathnormal{normal\ text}
\mathcal{CAL\ LETTERS}
\mathrm{\gamma}


Sizes

Failed to parse (unknown function "\tiny"): \tiny tiny
Failed to parse (unknown function "\scriptsize"): \scriptsize scriptsize
Failed to parse (unknown function "\footnotesize"): \footnotesize footnotesize
Failed to parse (unknown function "\small"): \small small
Failed to parse (unknown function "\normalsize"): \normalsize normalsize
Failed to parse (unknown function "\large"): \large large
Failed to parse (unknown function "\Large"): \Large Large
Failed to parse (unknown function "\LARGE"): \LARGE LARGE
Failed to parse (unknown function "\huge"): \huge huge
Failed to parse (unknown function "\Huge"): \Huge Huge