# Math

Prior to v 1.18, Math was supported in core of MediaWiki via the <math> tag. Now, it's been extracted into the Extension:Math extension.

Furthermore, if you want to run a production wiki that uses math formulas, it is recommended that you setup your own **mw:Mathoid** nodejs service which in turn relies on a **mw:RESTBase** service.

## Notes about setting it up / History / Status[edit | edit source]

- https://phabricator.wikimedia.org/T136812
- https://phabricator.wikimedia.org/T154394
- https://www.mediawiki.org/wiki/Extension:Math/advancedSettings
- https://www.mediawiki.org/wiki/Manual:Math

## SimpleMathJax[edit | edit source]

In QualityBox, we use Extension:SimpleMathJax which does rendering client-side instead of the more complicated server-side Math extension.^{[1]}
Both extensions use MathJax, and the server-side option would be more suitable in high volume environments.

Compare:

SimpleMathJax provides MediaWiki with MathJax

Other Example Renderings

## na-mic[edit | edit source]

Example from https://www.na-mic.org/wiki/Projects:GroupwiseRegistration

For the nonrigid deformation model, we define a combined transformation consisting of a global and a local component

- [math] T(\mathbf{x}) = T_{local}({T_{global}(\mathbf{x})}) [/math]
where [math]T_{global}[/math] is a twelve parameter affine transform and [math]T_{local}[/math] is a deformation model based on B-splines.

The free form deformation can be written as the 3-D tensor product of 1-D cubic B-splines.

- [math] T_{local}(\mathbf{x}) = \mathbf{x} + \sum_{l=0}^3\sum_{m=0}^3\sum_{n=0}^3 B_l(u)B_m(v)B_n(w) \Phi_{i+l,j+m,k+n} [/math]

where [math]B_l[/math] is [math]l[/math]'th cubic B-spline basis function. [math](u,v,w)[/math] is the distance to [math](x,y,z)[/math] from the control point [math]\Phi_{i,j,k}[/math] as shown in Figure 2.

The deformation of a given point can be found using only the control points in the neighborhood of the given point. Therefore, optimization of the objective function can be implemented efficiently.

## slicer.org[edit | edit source]

example from https://www.slicer.org/wiki/Coordinate_systems

However different medical applications use different definitions of this 3D basis. Most common are the following bases:

- LPS (Left, Posterior, Superior) is used in DICOM images and by the ITK toolkit
[math] LPS = \begin{Bmatrix} \text{from right towards left} \\ \text{from anterior towards posterior} \\ \text{from inferior towards superior} \end{Bmatrix} [/math]

- RAS (Right, Anterior, Superior) is similar to LPS with the first two axes flipped and used by 3D Slicer
[math] RAS = \begin{Bmatrix} \text{from left towards right} \\ \text{from posterior towards anterior} \\ \text{from inferior towards superior} \end{Bmatrix} [/math]

Both bases are equally useful and logical. It is just necessary to know to which basis an image is referenced.

## References[edit | edit source]

- ↑ This SO thread summarizes some of the history of the Math and SimpleMathJax extensions https://stackoverflow.com/questions/29387372/how-to-embed-maths-in-mediawiki