Difference between revisions of "Help:Create a mathematical formula"

From Heureka Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
If you have ''some'' experience in mathematical expressions or programming, it will be a quick learn. It's all ablut grouping and marking up symbols.
 
If you have ''some'' experience in mathematical expressions or programming, it will be a quick learn. It's all ablut grouping and marking up symbols.
  
You can also look at the examples below for some nice examples.
+
The examples below gives a hint of what is possible to display.
  
== Examples (from mediawiki) ==
+
=== Parentheses and grouping ===
 +
 
 +
Worth mentioning is how you group sub-forumlas in a mathematical expression. You can not use just parenthenses, but rather  [http://en.wikipedia.org/wiki/Curly_bracket#Curly_brackets_or_braces_.7B_.7D curly brackets: '''{}''']. This is because a parenthesis has no syntactic meaning in LaTeX and will be treated as just another character.
 +
 
 +
The sub-groups will be displayed together when LaTeX renders the formula.
 +
 
 +
For intsance: if you need to superscript more than a character you need to group those characters within curly brackets. If not, only the first letter will be superscriped.
 +
 
 +
{| border=1 cellpadding=5
 +
|-
 +
! Code
 +
! Display
 +
! Comment
 +
 
 +
|-
 +
|
 +
<nowiki><math>\alpha^</nowiki>'''2-z'''<nowiki></math></nowiki>
 +
|<center><math>\alpha^2-z</math></center>
 +
|''No curly brackets - only one character is superscriped.''
 +
 
 +
|-
 +
|
 +
<nowiki><math>\alpha^</nowiki>'''{2-z}'''<nowiki></math></nowiki>
 +
|<center><math>\alpha^{2-z}</math></center>
 +
|''Curly brackets - the whole expression is grouped (and superscriped).''
 +
 
 +
|-
 +
|
 +
<nowiki><math>\alpha^</nowiki>'''(2-z)'''<nowiki></math></nowiki>
 +
|<center><math>\alpha^(2-z)</math></center>
 +
|''Regular parentheses are treated as any single character, with no grouping effect.''
 +
 
 +
|-
 +
|
 +
<nowiki><math>\alpha^</nowiki>'''{(2-z)}'''<nowiki></math></nowiki>
 +
|<center><math>\alpha^{(2-z)}</math></center>
 +
|''Combine curly brackets with regular parentheses for syntactic and visual grouping.''
 +
|}
 +
 
 +
== Examples  ==
  
 
  <nowiki><math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}
 
  <nowiki><math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}
Line 79: Line 118:
 
=== How does it work? ===
 
=== How does it work? ===
  
MediaWiki produces images for each formula you type. If and when you change the formula, a new image is created, and the page referres to the new image.
+
MediaWiki produces images for each formula you type. If you change the formula, a new image is created, and the page referres to the new image.
 +
 
 +
The image is identified by a (system) unique filename, calculated by a [http://en.wikipedia.org/wiki/MD5 hash function (MD5)] based on the formula text. This enables a quick translation between the formula-text and the filename.
  
 
=== Will the server be cluttered with images? ===
 
=== Will the server be cluttered with images? ===
  
Yes and no. There will infact be lots of images, but these images lies in a dedicated folder and are relatively small - ranging between <1k to 10k.
+
Yes and no. There will indeed be lots of images, but these images lies in a dedicated folder and are relatively small - ranging between <1k to 10k.
  
 
=== Isn't there any nice graphical interface to LaTeX? ===
 
=== Isn't there any nice graphical interface to LaTeX? ===
  
 
Some GUI-based programs does exist, but for now you will have to find them yourself. I would suggest you start at http://en.wikipedia.org/wiki/LaTeX#External_links
 
Some GUI-based programs does exist, but for now you will have to find them yourself. I would suggest you start at http://en.wikipedia.org/wiki/LaTeX#External_links

Latest revision as of 14:26, 4 August 2008

General info

Folmulas are created by using the markup-language LaTeX, a powerful commonly used language in scientific documents.

As a user, the only thing you need to do is wrap your LaTeX formula within a <math>(formula)</math> tag.

For example:

<math>f(x) = \fract{1}{\alpha^2}</math>

Produces the following formula:

How do I use LaTeX

There is really no need to write a long list of commands in this (local) wiki - mediawiki.org has a nice reference manual.

If you have some experience in mathematical expressions or programming, it will be a quick learn. It's all ablut grouping and marking up symbols.

The examples below gives a hint of what is possible to display.

Parentheses and grouping

Worth mentioning is how you group sub-forumlas in a mathematical expression. You can not use just parenthenses, but rather curly brackets: {}. This is because a parenthesis has no syntactic meaning in LaTeX and will be treated as just another character.

The sub-groups will be displayed together when LaTeX renders the formula.

For intsance: if you need to superscript more than a character you need to group those characters within curly brackets. If not, only the first letter will be superscriped.

Code Display Comment
<math>\alpha^2-z</math>
No curly brackets - only one character is superscriped.
<math>\alpha^{2-z}</math>
Curly brackets - the whole expression is grouped (and superscriped).
<math>\alpha^(2-z)</math>
Regular parentheses are treated as any single character, with no grouping effect.
<math>\alpha^{(2-z)}</math>
Combine curly brackets with regular parentheses for syntactic and visual grouping.

Examples

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

Gives


<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>

gives


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

Gives:


FAQ

How does it work?

MediaWiki produces images for each formula you type. If you change the formula, a new image is created, and the page referres to the new image.

The image is identified by a (system) unique filename, calculated by a hash function (MD5) based on the formula text. This enables a quick translation between the formula-text and the filename.

Will the server be cluttered with images?

Yes and no. There will indeed be lots of images, but these images lies in a dedicated folder and are relatively small - ranging between <1k to 10k.

Isn't there any nice graphical interface to LaTeX?

Some GUI-based programs does exist, but for now you will have to find them yourself. I would suggest you start at http://en.wikipedia.org/wiki/LaTeX#External_links