Help:Math formulas in the wiki

From Bogleheads
Jump to: navigation, search

This page explains how to create math formulas in the wiki, and to capture examples of potentially useful math formulas.

Math formulas are supported by MediaWiki's Extension:Math, which will render mathematical formulas in more user-friendly format. This is the same software used by Wikipedia.

As an additional example, some links are implemented as interwiki links.

Using math formulas

The formulas are entered using the math codes defined in Help:Displaying a formula. When the page is previewed (or saved), the wiki will convert those codes into a graphic image or MathML (if your browser supports it).[note 1]

To purge a page with math formulas (refresh the server's cache), append ?action=purge&mathpurge=true to the URL.

Formula examples

This section provides examples of formulas that may be close to a formula you want to include in your wiki article. If you find one that is close, click Edit next to the section title, copy the formula, then paste it into your wiki article and make the necessary edits.

Inline formulas

Inline fractions

Fractions can be displayed inline using tfrac (text fraction) as here , instead using frac which displays them like this . Note also that this example illustrates that braces are not required around simple arguments to frac. The dfrac (display frac) version of frac forces normal display size: , which in this case generates the same result as frac.

Multiline formulas

The use of text and equation alignment are shown.

The font size may sometimes be too large to fit in the overall context. This was not used in Net worth.

Expected value

These examples are from Expected Value on Wikipedia.

Discrete random variable, finite case

Suppose random variable X can take value x1 with probability p1, value x2 with probability p2, and so on, up to value xk with probability pk. Then the expectation of this random variable X is defined as

Since all probabilities pi add up to one: p1 + p2 + ... + pk = 1, the expected value can be viewed as the weighted average, with pi’s being the weights:

Discrete random variable, countable case

Let X be a discrete random variable taking values x1, x2, ... with probabilities p1, p2, ... respectively. Then the expected value of this random variable is the infinite sum

Variance

This is used in our wiki Risk and Return article. It applies to historical returns, or a set of returns with each return having equal probability:


The following examples are from Variance on Wikipedia.

Expected value of throwing a six-sided die:

Its expected absolute deviation—the mean of the equally likely absolute deviations from the mean—is

But its expected squared deviation—its variance (the mean of the equally likely squared deviations)—is

If a random variable X has the expected value (mean) = μ = E[X], then the variance of X is given by:

If the random variable X is discrete with probability mass function

x1 ↦ p1, ..., xn ↦ pn, then

where is the expected value, i.e.

.

Standard deviation

These examples are from Standard deviation on Wikipedia.

Consider a population consisting of the following eight values:

These eight data points have the mean (average) of 5:

To calculate the population standard deviation, first compute the difference of each data point from the mean, and square the result of each:

Next compute the average of these values, and take the square root:

In the case where X takes random values from a finite data set x1, x2, …, xN, with each value having the same probability, the standard deviation is

or, using summation notation,

If, instead of having equal probabilities, the values have different probabilities, let x1 have probability p1, x2 have probability p2, ..., xN have probability pN. In this case, the standard deviation will be

Correlation coefficient

If there are two random variables with means and standard deviations , then their correlation coefficient is

If there is a linear relation , the correlation coefficient is 1 (or -1 if is negative). If it is close to 1 or -1, the correlation is very strong.

Complementary error function

Demonstrates use of the integral and series summation, from Wikipedia's Error function:

Math symbols (special characters)

Many math symbols are in the editing toolbar under Special characters --> Symbols (or Greek). However, it may be easier to copy and paste the displayed character directly from the table below.

From Help:Displaying a formula: The codes on the left produce the symbols on the right, but the latter can also be put directly in the wikitext, except for ‘=’.

Syntax Rendering
α β γ δ ε ζ
η θ ι κ λ μ ν
ξ ο π ρ σ ς
τ υ φ χ ψ ω
Γ Δ Θ Λ Ξ Π
Σ Φ Ψ Ω
α β γ δ ε ζ
η θ ι κ λ μ ν
ξ ο π ρ σ ς
τ υ φ χ ψ ω
Γ Δ Θ Λ Ξ Π
Σ Φ Ψ Ω
∫ ∑ ∏ √ − ± ∞
≈ ∝ {{=}} ≡ ≠ ≤ ≥ 
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ 
∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀ 
⇒ ⇔ → ↔ ↑ 
ℵ - – — 
∫ ∑ ∏ √ − ± ∞
≈ ∝ = ≡ ≠ ≤ ≥
× · ÷ ∂ ′ ″
∇ ‰ ° ∴ Ø ø
∈ ∉ ∩ ∪ ⊂ ⊃ ⊆ ⊇
¬ ∧ ∨ ∃ ∀
⇒ ⇔ → ↔ ↑
ℵ - – —

Notes

  1. Firefox is the only major browser to support MathML directly, meaning that the math formulas will appear as text on the web page.
    Other browsers, such as Chrome and Internet Explorer, do not support MathML. In this case, the math formulas will be converted to a Scalable Vector Graphics (SVG) image file.

External links