NicomDoc Math

Updated: 2-Mar-2009
John Niclasen, NicomSoft
Email: docs at niclasen dot name

Contents:

1. Introduction
1.1 Semantic versus Presentation
1.2 Structure
1.3 The <backslash> character
1.4 Spaces
1.5 Non-Breaking SPace
1.6 The <tab> character
2. Simple parts of formulas
2.1 Sets
2.2 Greek letters
2.3 Miscellaneous ordinary math symbols
2.4 Binary operations
2.5 Relations
2.6 Left and right delimiters
2.7 Arrows
2.8 Named mathematical functions
2.9 Large operators
2.10 Punctuation
3. Superscripts and subscripts
4. Compound symbols
4.1 Math accents
4.2 Fractions and other stacking operations
4.3 Dots
4.4 Delimiters
4.5 Matrices
4.6 Roots
5. Examples
5.1 Einstein's Equation
5.2 Euler's Formula
5.3 Pythagorean Theorem
5.4 Solutions to 2nd Grade Polynomials
5.5 Taylor Polynomial
5.6 Bézier Curves
5.7 Leibniz Integral Rule
5.8 Maxwell's Equations
5.9 Schrödinger's Equation

1. Introduction

This math dialect is build on the TEX commands for producing math formulas, but with minimal syntax, so people familar with TEX should feel right at home.

I've produced synonyms for many commands, where I feel, the clarification and user flow would benefit.

1.1 Semantic versus Presentation

This dialect doesn't focus on semantic but on presentation, just like TEX.

1.2 Structure

It's been my goal, that when producing a formula, the user should write it in a way, that feel most natural. A formula is composed by combining symbols, numbers, operators and commands listed below.

A formula can be composed in two ways:

  • On it's own line all by itself, and
  • As inline math.

1.2.1 On a line all by itself

The command =math [ ... ] is used to produce a formula on a line. The formula is put in between square brackets, and it can go over more than one line of source. Putting newlines in will result in output continuing over more than one line.

Example:

=math [
a^2 + b^2 = c^2
<=> c=sqrt(a^2 + b^2)
]

produces:

\displaylines{a^2+b^2=c^2\cr \Leftrightarrow \quad c=\sqrt {a^2+b^2}\cr }

1.2.2 Inline math

Inline math is produced with the start command [m] and ending it with the command [/m]. ([m] and [/m] are synonyms for [math] and [/math], which can also be used.)

Example:

A formula: [m]a^2 + b^2 = c^2[/m]

produces:

A formula: a^2+b^2=c^2

1.2.3 Grouping parts of a formula

Where parts of a formula needs to be grouped together, often paranthesis are used. Sometimes the paranthesis will be shown in the output, sometimes not. It's a goal, that the output should look as nice and clear as possible. Sometimes { and } can be used with benefit to group part of an equations. A typical example of that is a fraction:

=math [{n-1 over n+1}]

produces:

\displaylines{{n-1\over n+1}}

1.3 The <backslash> character

A backslash '\' can be used to escape a character. The character after the backslash will be shown in the output. It can be used to produce e.g. '{', '}', '[', ']' and other special characters in the output. If a backslash is needed in the output (see setminus under "Binary operations"), two backslashes should be written.

1.4 Spaces

It's allowed to use any number of spaces between any part of a formula. Those spaces will be reduced to a minimal space.

1.5 Non-Breaking SPace

The NBSP character will produce a little space. The character has hex-value 0xA0 and is produced on the Mac keyboard with <alt>-<space>.

1.6 The <tab> character

Inserting one or more tabs will produce some space in the equation. The command quad does the same as a <tab> character.

2. Simple parts of formulas

2.1 Sets

Set

Command

\mathbb{N}

Nset

\mathbb{Z}

Zset

\mathbb{Q}

Qset

\mathbb{R}

Rset

\mathbb{C}

Cset

2.2 Greek letters

Letter

Command

Letter

Command

Letter

Command

\alpha

alpha

\mu

mu

\sigma

sigma

\beta

beta

\nu

nu

\varsigma

varsigma

\chi

chi

\omega

omega

\Sigma

Sigma

\delta

delta

\Omega

Omega

\tau

tau

\Delta

Delta

\phi

phi

\theta

theta

\epsilon

epsilon

\varphi

varphi

\vartheta

vartheta

\varepsilon

varepsilon

\Phi

Phi

\Theta

Theta

\eta

eta

\pi

pi

\upsilon

upsilon

\gamma

gamma

\varpi

varpi

\Upsilon

Upsilon

\Gamma

Gamma

\Pi

Pi

\xi

xi

\iota

iota

\psi

psi

\Xi

Xi

\kappa

kappa

\Psi

Psi

\zeta

zeta

\lambda

lambda

\rho

rho

\Lambda

Lambda

\varrho

varrho

2.3 Miscellaneous ordinary math symbols

Symbol

Command

Synonym for

\Vert

||

Vert

\emptyset

Ř

emptyset

\nabla

del

nabla

\partial

partiel

partial

Symbol

Command

Symbol

Command

Symbol

Command

\infty

infty

\exists

exists

\partial

partial

\Re

Re

\forall

forall

\surd

surd

\Im

Im

\hbar

hbar

\wp

wp

\angle

angle

\ell

ell

\flat

flat

\triangle

triangle

\aleph

aleph

\sharp

sharp

\backslash

backslash

\imath

imath

\natural

natural

\,\vert\,

vert

\jmath

jmath

\clubsuit

clubsuit

\,\vert\,

|

\nabla

nabla

\diamondsuit

diamondsuit

\Vert

Vert

\neg

neg

\heartsuit

heartsuit

\emptyset

emptyset

\lnot

lnot

\spadesuit

spadesuit

\bot

bot

'

' (apostrophe)

{\top }

top

\prime

prime

2.4 Binary operations

Op

Command

Synonym for

{\land }

and

land

{\lor }

or

lor

{\cdot }

*

cdot

{\pm }

+-

pm

{\mp }

-+

mp

{\setminus }

\\

setminus

Op

Command

Op

Command

Op

Command

{\vee }

vee

{\cdot }

cdot

{\triangleleft }

triangleleft

{\wedge }

wedge

{\diamond }

diamond

{\triangleright }

triangleright

{\amalg }

amalg

{\bullet }

bullet

{\bigtriangledown }

bigtriangledown

{\cap }

cap

{\circ }

circ

{\bigtriangleup }

bigtriangleup

{\cup }

cup

{\bigcirc }

bigcirc

{\ast }

ast

{\uplus }

uplus

{\odot }

odot

{\star }

star

{\sqcap }

sqcap

{{\ominus }}

ominus

{\times }

times

{\sqcup }

sqcup

{\oplus }

oplus

{\div }

div

{\dagger }

dagger

{\oslash }

oslash

{\setminus }

setminus

{{\ddagger }}

ddagger

{{\otimes }}

otimes

{\wr }

wr

{\land }

land

{\pm }

pm

{\lor }

lor

{\mp }

mp

2.5 Relations

Negated relations can be produces by putting the word not in front of the relation.

Example: not asymp gives {\not \asymp }

Also {\not =} can be produced with not= or ne.

Symbol

Command

Synonym for

{\cong }

~=

cong

{\equiv }

==

equiv

{\ge }

>=

ge

{\le }

=<

le

{\gg }

>>

gg

{\ll }

<<

ll

{\approx }

~~

approx

{\simeq }

~-

simeq

Symbol

Command

Symbol

Command

Symbol

Command

{\asymp }

asymp

{\gg }

gg

{\bowtie }

bowtie

{\cong }

cong

{\ll }

ll

{\propto }

propto

{\dashv }

dashv

{\models }

models

{\approx }

approx

{\vdash }

vdash

{\ne }

ne

{\sim }

sim

{\perp }

perp

{\neq }

neq

{\simeq }

simeq

{\mid }

mid

{\notin }

notin

{\frown }

frown

{\parallel }

parallel

{\in }

in

{\smile }

smile

{\doteq }

doteq

{\ni }

ni

{\subset }

subset

{\equiv }

equiv

{\owns }

owns

{\subseteq }

subseteq

{\ge }

ge

{\prec }

prec

{\supset }

supset

{\geq }

geq

{\preceq }

preceq

{\supseteq }

supseteq

{\le }

le

{\succ }

succ

{\sqsubseteq }

sqsubseteq

{\leq }

leq

{\succeq }

succeq

{\sqsupseteq }

sqsupseteq

2.6 Left and right delimiters

Symbol

Command

Synonym for

\lbrack

\[

lbrack

\rbrack

\]

rbrack

Symbol

Command

Symbol

Command

Symbol

Command

\lbrace

lbrace

\lbrack

lbrack

\lceil

lceil

\lbrace

\{

\rbrack

rbrack

\rceil

rceil

\rbrace

rbrace

\langle

langle

\lfloor

lfloor

\rbrace

\}

\rangle

rangle

\rfloor

rfloor

2.7 Arrows

Symbol

Command

Synonym for

{\gets }

<-

gets

{\Leftarrow }

<=

Leftarrow

{\to }

->

to

{\Rightarrow }

=>

Rightarrow

{\leftrightarrow }

<->

leftrightarrow

{\Leftrightarrow }

<=>

Leftrightarrow

Symbol

Command

Symbol

Command

{\leftarrow }

leftarrow

{\leftharpoondown }

leftharpoondown

{\gets }

gets

{\rightharpoondown }

rightharpoondown

{\Leftarrow }

Leftarrow

{\leftharpoonup }

leftharpoonup

{\rightarrow }

rightarrow

{\rightharpoonup }

rightharpoonup

{\to }

to

{\rightleftharpoons }

rightleftharpoons

{\Rightarrow }

Rightarrow

{\mapsto }

mapsto

{\leftrightarrow }

leftrightarrow

{\longmapsto }

longmapsto

{\Leftrightarrow }

Leftrightarrow

{\downarrow }

downarrow

{\longleftarrow }

longleftarrow

{\Downarrow }

Downarrow

{\Longleftarrow }

Longleftarrow

{\uparrow }

uparrow

{\longrightarrow }

longrightarrow

{\Uparrow }

Uparrow

{\Longrightarrow }

Longrightarrow

{\updownarrow }

updownarrow

{\longleftrightarrow }

longleftrightarrow

{\Updownarrow }

Updownarrow

{\Longleftrightarrow }

Longleftrightarrow

{\nearrow }

nearrow

{\iff }

iff

{\searrow }

searrow

{\hookleftarrow }

hookleftarrow

{\nwarrow }

nwarrow

{\hookrightarrow }

hookrightarrow

{\swarrow }

swarrow

2.8 Named mathematical functions

Function

Command

Function

Command

Function

Command

{\cos }

cos

{{\sinh }}

sinh

{\hom }

hom

{{\sin }}

sin

{\tanh }

tanh

{\ker }

ker

{\tan }

tan

{\det }

det

{\inf }

inf

{\cot }

cot

{\dim }

dim

{\sup }

sup

{\csc }

csc

{\exp }

exp

{\lim }

lim

{\sec }

sec

{\ln }

ln

{\liminf }

liminf

{\arccos }

arccos

{\log }

log

{\limsup }

limsup

{\arcsin }

arcsin

{\lg }

lg

{\max }

max

{\arctan }

arctan

{\arg }

arg

{{\min }}

min

{\cosh }

cosh

{\deg }

deg

{\Pr }

Pr

{\coth }

coth

{\gcd }

gcd

2.9 Large operators

Op

Command

Synonym for

Op

Command

Synonym for

\bigcap {}

Cap

bigcap

\bigsqcup {}

Sqcup

bigsqcup

\bigcup {}

Cup

bigcup

\biguplus {}

Uplus

biguplus

\bigodot {}

Odot

bigodot

\bigvee {}

Vee

bigvee

\bigoplus {}

Oplus

bigoplus

\bigwedge {}

Wedge

bigwedge

\bigotimes {}

Otimes

bigotimes

Op

Command

Op

Command

Op

Command

{\bigcap }

bigcap

{\bigsqcup }

bigsqcup

{\smallint }

smallint

{\bigcup }

bigcup

{\biguplus }

biguplus

{\int }

int

{\bigodot }

bigodot

{\bigvee }

bigvee

{{\oint }}

oint

{\bigoplus }

bigoplus

{\bigwedge }

bigwedge

{\prod }

prod

{\bigotimes }

bigotimes

{\coprod }

coprod

{\sum }

sum

2.10 Punctuation

Symbol

Command

Synonym for

{\colon }

:

colon

Symbol

Command

{\cdotp }

cdotp

{\ldotp }

ldotp

{\colon }

colon


These commands put no extra space in front of them but a little extra space after them.

Example:

=math [x cdotp y quad x ldotp y quad x cdot y quad f colon t quad f : t]

produces:

\displaylines{x\cdotp y\quad x\ldotp y\quad x\cdot y\quad f\colon t\quad f:t}

And this is the same as writing:

Example:

=math [x cdotp y <tab> x ldotp y <tab> x*y <tab> f: t <tab> f : t]

(<tab> means the <tab> character)

produces:

\displaylines{x\cdotp y\quad x\ldotp y\quad x\cdot y\quad f\colon t\quad f:t}

So it makes a difference, where the colon is placed.

3. Superscripts and subscripts

_ (argument)
or
sb (argument)
gives subscripts.

^ (argument)
or
sp (argument)
gives superscripts.

Example:

=math [sum_(n=0)^m a_n x^n]
=math [sum_(n=0)^ma_nx^n]
=math [sum sb (n=0) sp m a sb n x sp n]
=math [sum sb(n=0)spma sbnx spn]

all produce:

\displaylines{\sum _{n=0}^ma_nx^n}

4. Compound symbols

4.1 Math accents

Command

Example

Produces

Synonym for

´(argument)

´x

\acute x

acute (argument)

¨(argument)

¨x

\ddot x

ddot (argument)

`(argument)

`x

\grave x

grave (argument)

~(argument)

~x

\widetilde x

widetilde (argument)

Command

Example

Produces

acute (argument)

acute x

\acute x

bar (argument)

bar x

\bar x

breve (argument)

breve x

\breve x

check (argument)

check x

\check x

ddot (argument)

ddot x

\ddot x

dot (argument)

dot x

\dot x

grave (argument)

grave x

\grave x

hat (argument)

hat x

\hat x

widehat (argument)

widehat {x + y}

\widehat {x+y}

tilde (argument)

tilde x

\tilde x

widetilde (argument)

widetilde {z + a}

\widetilde {z+a}

vec (argument)

vec x

\vec x

4.2 Fractions and other stacking operations

Command

Example

Produces

over

{n+1 over n-1}

{n+1\over n-1}

atop

{n+1 atop n-1}

{n+1\atop n-1}

above (dimen)

{n+1 above 2 n-1}

{n+1\above 2pt n-1}

choose

{n+1 choose n-1}

{n+1\choose n-1}

brace

{n+1 brace n-1}

{n+1\brace n-1}

brack

{n+1 brack n-1}

{n+1\brack n-1}

overwithdelims (delim1) (delim2)

{m overwithdelims () n}

{m\overwithdelims () n}

atopwithdelims (delim1) (delim2)

{m atopwithdelims \|\| n}

{m\atopwithdelims || n}

abovewithdelims (delim1) (delim2) (dimen)

{m abovewithdelims \{\} 2 n}

{m\abovewithdelims \{\} 2pt n}



Command

cases{(math) <tab> (text)<newline>
(math) <tab> (text)<newline>
... <newline>

}

Example

g(x,y)=cases{f(x,y), <tab> x<y
f(y,x), <tab> x>y
0, <tab> otherwise.
}

Produces

g(x,y)=\cases{f(x,y),&x<y\cr f(y,x),&x>y\cr 0,&otherwise.\cr }

Command

Example

Produces

underbrace (argument)

underbrace {x circ y}

\underbrace {x\circ y}

overbrace (argument)

overbrace {x circ y}

\overbrace {x\circ y}

underline (argument)

underline {x circ y}

\underline {x\circ y}

overline (argument)

overline {x circ y}

\overline {x\circ y}

overleftarrow (argument)

overleftarrow {x circ y}

\overleftarrow {x\circ y}

overrightarrow (argument)

overrightarrow {x circ y}

\overrightarrow {x\circ y}

4.3 Dots

The command in the following table is three dots (also known as full stop or period).

Symbol

Command

Synonym for

\ldots

...

ldots

Symbol

Command

\ldots

ldots

\cdots

cdots

\vdots

vdots

\ddots

ddots

4.4 Delimiters

Command

Example

Produces

left(delim1)(subformula)right(delim2)

left ( q_1 atop q_2 right )

\left (q_1\atop q_2\right )


left and right have the important property, that they define a group, i.e., the act like left and right braces. This grouping property is particularly useful, when you put over or a related stacking command between left and right, since you don't need to put braces around the fraction constructed by over.

The following delimiters can be used as (delim1) and (delim2):

Symbol

Command

Synonym for

\langle

<

langle

\rangle

>

rangle

Delimiter

Explanation

Delimiter

Explanation

(

left parenthesis

/

slash

)

right parenthesis

\\

backslash

[

left bracket

backslash

backslash

]

right bracket

langle

left angle bracket

{

left brace

rangle

right angle bracket

}

right brace

uparrow

up arrow

|

vertical line

downarrow

downarrow

vert

vertical line

updownarrow

up/down arrow

||

double vertical line

.

no delimiter

Vert

double vertical line

4.5 Matrices

4.5.1 A matrix without delimiters

matrix { (line) <newline>
...
(line) <newline>

}

4.5.2 A matrix surrounded by brackets

bmatrix { (line) <newline>
...
(line) <newline>

}

4.5.3 A matrix surrounded by parentheses

pmatrix { (line) <newline>
...
(line) <newline>

}

Example:

=math [
matrix {t_(11) <tab> t_(12) <tab> t_(13)
t_(21) <tab> t_(22) <tab> t_(23)
t_(31) <tab> t_(32) <tab> t_(33)
} <tab> <tab> bmatrix {t_(11) <tab> t_(12) <tab> t_(13)
t_(21) <tab> t_(22) <tab> t_(23)
t_(31) <tab> t_(32) <tab> t_(33)
}
pmatrix {t_(11) <tab> t_(12) <tab> t_(13)
t_(21) <tab> t_(22) <tab> t_(23)
t_(31) <tab> t_(32) <tab> t_(33)
} <tab> <tab> left | matrix {t_(11) <tab> t_(12) <tab> t_(13)
t_(21) <tab> t_(22) <tab> t_(23)
t_(31) <tab> t_(32) <tab> t_(33)
} right |
]

produces:

\displaylines{\matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr }\quad \quad \left[\matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr }\right]\cr \pmatrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr }\quad \quad \left |\matrix{t_{11}&t_{12}&t_{13}\cr t_{21}&t_{22}&t_{23}\cr t_{31}&t_{32}&t_{33}\cr }\right |\cr }

(<tab> is the <tab> character)

4.6 Roots

Command

Example

Produces

sqrt (argument)

{-b +- sqrt(b^2 - 4ac) over 2a}

{-b\pm \sqrt {b^2-4ac}\over 2a}

root (argument1) (argument2)

root alpha (r cos theta)

\root {\alpha } \of {r\cos \theta }

5. Examples

5.1 Einstein's Equation

=math [E=mc^2]

produces:

\displaylines{E=mc^2}

5.2 Euler's Formula

=math [e^(i pi) = -1]

produces:

\displaylines{e^{i\pi }=-1}

5.3 Pythagorean Theorem

=math [
a^2 + b^2 = c^2
<=> c = sqrt(a^2 + b^2)
]

produces:

\displaylines{a^2+b^2=c^2\cr \Leftrightarrow \quad c=\sqrt {a^2+b^2}\cr }

5.4 Solutions to 2nd Grade Polynomials

=math [{-b +- sqrt(b^2 - 4ac) over 2a}]

produces:

\displaylines{{-b\pm \sqrt {b^2-4ac}\over 2a}}

5.5 Taylor Polynomial

=math [T_nf(x) = sum_(k=0)^n {f^((k))(a) over k!} (x-a)^k]

produces:

\displaylines{T_nf(x)=\sum _{k=0}^n{f^{(k)}(a)\over k!}(x-a)^k}

5.6 Bézier Curves

A planar [i]Bézier curve[/i] is constructed from a set of points [m]P_i in R
set^2[/m] for [m]0 =< i =< n[/m], called [i]control points[/i], by

=math [X(t) = sum_(i=0)^n {n atopwithdelims () i} t^i (1-t)^(n-i) P_i = sum_(
i=0)^n B_i(t) P_i , t in [0;1]]

where

=math [{n atopwithdelims () i} = {n! over i!(n-i)!}]

produces:

A planar Bézier curve is constructed from a set of points P_i\in \mathbb{R} ^2 for 0\le i\le n, called control points, by

\displaylines{X(t)=\sum _{i=0}^n{n\atopwithdelims () i}t^i(1-t)^{n-i}P_i=\sum _{i=0}^nB_i(t)P_i\quad ,\quad t\in \lbrack 0;1\rbrack }

where

\displaylines{{n\atopwithdelims () i}={n!\over i!(n-i)!}}

5.7 Leibniz Integral Rule

=math [{partial over partial z} int_(a(z))^(b(z)) f(x,z)dx = int_(a(z))^(b(z
)) {partial f over partial z}dx + f(b(z), z) {partial b over partial z}
- f(a(z), z) {partial a over partial z}]

produces:

\displaylines{{\partial \over \partial z}\int _{a(z)}^{b(z)}f(x,z)dx=\int _{a(z)}^{b(z)}{\partial f\over \partial z}dx+f(b(z),z){\partial b\over \partial z}-f(a(z),z){\partial a\over \partial z}}

5.8 Maxwell's Equations

=math [
nabla * bar E = {1 over epsilon_0} rho
nabla times bar E = -{partial bar B over partial t}
nabla * bar B = 0
nabla times bar B = mu_0 bar J + mu_0 epsilon_0 {partial bar E over partial t
}
]

produces:

\displaylines{\nabla \cdot \bar E={1\over \epsilon _0}\rho \cr \nabla \times \bar E=-{\partial \bar B\over \partial t}\cr \nabla \cdot \bar B=0\cr \nabla \times \bar B=\mu _0\bar J+\mu _0\epsilon _0{\partial \bar E\over \partial t}\cr }

5.9 Schrödinger's Equation

=math [i hbar {partial Psi(bar r, t) over partial t} = -{hbar^2 over 2m} nab
la^2 Psi(bar r,t) + V(bar r) Psi(bar r,t) == ~H Psi(bar r,t)]

produces:

\displaylines{i\hbar {\partial \Psi (\bar r,t)\over \partial t}=-{\hbar ^2\over 2m}\nabla ^2\Psi (\bar r,t)+V(\bar r)\Psi (\bar r,t)\equiv \widetilde H\Psi (\bar r,t)}

NicomDoc - 5-Mar-2009 - niclasen@fys.ku.dk