Jump to content

Extension:Math/MathJax testing

From mediawiki.org
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]

Most of the following examples were copied from the English Wikipedia math help page.

Quadratic polynomial

[edit]
ax2+bx+c=0
<math>ax^2 + bx + c = 0</math>

Quadratic polynomial (force PNG rendering)

[edit]
ax2+bx+c=0
<math>ax^2 + bx + c = 0\,\!</math>

Quadratic formula

[edit]
x=b±b24ac2a
<math>x={-b\pm\sqrt{b^2-4ac} \over 2a}</math>

Tall parentheses and fractions

[edit]
2=((3x)×23x)
<math>2 = \left(
 \frac{\left(3-x\right) \times 2}{3-x}
 \right)</math>
Snew=Sold(5T)22
 <math>S_{\text{new}} = S_{\text{old}} - \frac{ \left( 5-T \right) ^2} {2}</math>
 
full month's benefits×(number of days in month+1date of application)number of days in month=allotment

Integrals

[edit]
axasf(y)dyds=axf(y)(xy)dy
<math>\int_a^x \!\!\!\int_a^s f(y)\,dy\,ds
 = \int_a^x f(y)(x-y)\,dy</math>

Summation

[edit]
i=0n1i
<math>\sum_{i=0}^{n-1} i</math>
m=1n=1m2n3m(m3n+n3m)
<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),x>a
<math>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>

Complex numbers

[edit]
|z¯|=|z|,|(z¯)n|=|z|n,arg(zn)=narg(z)
<math>|\bar{z}| = |z|,
 |(\bar{z})^n| = |z|^n,
 \arg(z^n) = n \arg(z)</math>

Limits

[edit]
limzz0f(z)=f(z0)
<math>\lim_{z\rightarrow z_0} f(z)=f(z_0)</math>

Integral equation

[edit]
ϕn(κ)=14π2κ20sin(κR)κRR[R2Dn(R)R]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]
ϕn(κ)=0.033Cn2κ11/3,1L0κ1l0
<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)={11x<012x=01x2otherwise
<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]
pFq(a1,,ap;c1,,cq;z)=n=0(a1)n(ap)n(c1)n(cq)nznn!
<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]
abab
<math>\frac{a}{b}\ \tfrac{a}{b}</math>

Area of a quadrilateral

[edit]
S=dDsinα
<math>S=dD\,\sin\alpha\!</math>

Volume of a sphere-stand

[edit]
V=16πh[3(r12+r22)+h2]
<math>V=\tfrac16\pi h\left[3\left(r_1^2+r_2^2\right)+h^2\right]</math>

Multiple equations

[edit]
u=12(x+y)x=12(u+v)v=12(xy)y=12(uv)
 
<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>
1<2&3>4
1<23>4

Failed to parse (unknown function "\upgamma"): {\displaystyle {{\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{equation}"): {\displaystyle \begin{equation}\label{eq1} x = \sin(y) \end{equation}}

The above has label Failed to parse (unknown function "\ref"): {\displaystyle \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 (syntax error): {\displaystyle 中文}
中文(<math>\text{中文}</math> displays nothing)
Failed to parse (syntax error): {\displaystyle 中\text{文}}

Textstyles

[edit]
boldtext
itallictext
romantext
teletypetext should render as Failed to parse (unknown function "\tt"): {\displaystyle {\tt teletype\ text}}
sanseriftext should render as Failed to parse (unknown function "\sf"): {\displaystyle {\sf sanserif\ text}}
emphasizedtext

Also in Latex 2e

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

Nesting

Nestedboldanditallic
Nesteditallicandbold
Failed to parse (unknown function "\upgamma"): {\displaystyle \textbf{\upgamma{Mathroman}}}

Math font styles

boldtext
itallictext
romantext
teletypetext
sanseriftext
Failed to parse (unknown function "\mathnormal"): {\displaystyle \mathnormal{normal\ text}}
𝒞𝒜𝒯𝒯𝒮
γ


Sizes

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