Help:Formulas

From GMATClub

Jump to: navigation, search


{{#x:sidebar| Help: technical wiki documentation


index - edit this box }}

{{#x:box| Writing <m>\frac{x}{y}</m> on the wiki or [m]\frac{x}{y}[/m] on the forum produces . This page explains the available syntax. }}

You can write mathematical formulas in plain ASCII text and have them displayed as beautifully on the Web (in particular, GMAT Club forum and wiki) or in print. The process is usually called typesetting, and has a long history that started with Donald Knuth's TeX. Typesetting is no rocket science, in fact it is a lot easier and faster than editing the formulas in point-and-click software. After reviewing this page you should be able to typeset most of the formulas you would ever use on GMAT Club.

Contents

Typesetting

Open mimeTeX in parallel to this window and try the following examples.

Basics

Whatever you write in plain text, you can write in TeX.

Code Result
 x
 (a+b)(a-b) = a^2 - b^2
 (a+b)/2 = 0.5a + 0.5b


Su*scripts

To put one formula into a subscript or superscript of another, embed both in curly braces ({..}) and put a "^" or "_" in between. Curly braces can often be omitted when the result is clear.

Code Result
 {(x+y)}^{2} = {x}^{2} + {y}^{2} + 2xy
 (x+y)^3 = x^3 + 3x^2y + 3xy^2 + y^3
 9^{9^9} = 3^{2*3^{18}}


Fractions

To make a fraction, write "\frac", then the numerator in curly braces followed by the denominator, also in curly braces. This time the braces cannot be omitted.


Code Result
 \frac{1}{2} + \frac{2}{3} = 1\frac{1}{6}
 \frac{\frac{x}{y} + \frac{y}{x}}{2}
 x = (x^{\frac{1}{2}})^2
 C_n^k = \frac{n!}{k!(n-k)!}

Roots

In a very similar manner, to draw a square root, put "\sqrt" and then a formula in curly braces. If you need non-square roots, put whatever you need in square braces before the formula.

Code Result
 \sqrt{2} = 2^{\frac{1}{2}} = {\frac{1}{2}}^{-\frac{1}{2}}
 \sqrt[n]{x} = x^{\frac{1}{n}} = {\frac{1}{x}}^{-\frac{1}{n}} 
 \sqrt[\frac{1}{n}]{\sqrt{x}} = {\sqrt{x}}^{n} = x^{\frac{n}{2}}

Inequalities

Inequalities are rendered with by mnemonic commands for greater than (\gt), less than (\lt), greater or equal (\ge), less or equal (\le). Occasionally you also may want to use \infty, and \in.

Code Result
 x^2 \ge 0
 x \in (0, \infty)


Greek letters

To use Greek letters, simply spell them in English and put a "\" in front. If you start from a capital letter, you get a capital letter, and vice versa.

Code Result
 L = 2 \pi R
 S = \pi R^2
 \Gamma \mu \alpha \tau = 800

Sums, systems and miscellany

Here are some examples that show how to write sums, infinity, the tends to sign, how to put nice big braces around tall objects, and finally how to typeset equation systems (if you really want to do that).

Code Result
 e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}
 \left(  \frac{x+\frac{1}{2}}{x+\frac{1}{3}} \right) ^2
 \epsilon \to 0
 \left{ 
 \begin{eqnarray}    
 x+2n &=& 3           \\
 n-1  &=& \frac{x}{3} \\
 \end{eqnarray}

More examples

You can take mimeTeX very far. For a comprehensive tutorial which showcases all the features, please refer to the documentation [1]


Background

TeX was a revolution. Prior to that, mathematical books had to be typeset by hand. The output often looked ugly. In fact, this is how TeX started: Donald Knuth was disgusted with what the publisher had made of his recent book. The very same code is still being used today in professional publishing, as an extremely reliable system.

Many individuals today use LaTeX, with builds upon the plain TeX core by adding convenient packages. LaTeX is very popular in the academia, especially among math, physics, and economics majors who have to typeset a lot of formulas in their papers. Documents are created by editing text files and then running LaTeX on them to produce DVI, Postscript, or PDF output; several graphical systems exist to help automate the process. LaTeX also has the advantage of offering citation packages that allow to keep a citation database and reuse it across papers, with different styles (such as Chicago, APA or MLA). The learning curve for basic LaTeX editing is approachable as it takes about one day to install and learn, making it a worthwhile time investment.

Software

In principle any LaTeX distribution (such as TeX Live) can be used to render formulas on the web. However, LaTeX can do far more than that, and as a result is slower and more dangerous for the task than alternative specialized software.

Wikipedia uses Texvc, a lightweight OCaml program that accepts TeX formulas, validates them, and decides whether to render them in HTML or pass to LaTeX to render as an image. This solution addresses both problems (speed and security), but it still depends on a LaTeX installation.

There is a more lightweight and easy to install program written in C, mimeTeX, that works as a CGI script accepting the formula on the request string and rendering it immediately, without passing to LaTeX. It does not render HTML, but produces acceptable and consistent images.

mimeTeX is what GMAT Club uses presently. The speed limitation of CGI is avoided as the CGI server is running behind a transparent proxy (SQUID), meaning that most requests for formula images are intercepted and served from memory.

There input syntax differences for LaTeX and mimeTeX are minor.


References

  • TeX history on Wikipedia [2]
  • TeX showcase at the TeX Users Group (TUG) [3]
  • The LaTeX Project [4]
  • TeX Live, a popular distribution for UNIX and Windows [5]
  • Texvc - TeX validator and converter [6]
  • John Forkosh' mimeTeX, a CGI math TeX renderer [7]
    • A local copy hosted on GMAT Club [8]
Personal tools
Powered by MediaWiki