Expressions

Several nodes in the Composer allow for writing mathematical expressions. This page outlines the allowed expressions.

Note: spaces are ignored in expressions, so they can be placed whereever.

Functions for nodes taking x as input

• infinite(a,b) = $\infty$ for $x < a$ & $x < b$, $0$ for $a < x < b$
• finite(a,b) = $1$ for $x < a$ & $x > b$, $0$ for $a < x < b$
• box(a,b) = $0$ for $x < a$ & $x > b$, $1$ for $a < x < b$
• step(a) = $0$ for $x < a$, $1$ for $x > a$

Numerical simulations tend to dislike hard bounds. Below are soft versions of the above steps and boxes. Higher values of hardness (h) gets close to completely hard steps.

• sbox(a,b,h) = sstep(a,h)-sstep(b,h)
• sstep(a,h) = $\frac{1}{1+exp(-h*(x-a))}$

You are free to write any arbitary potential or wavefunction, e.g.

• the harmonic potential is written as:  0.5*a*x^2
• the gaussian free particle is written as:  sqrt(sqrt(a/pi))*exp(-0.5*a*x^2)

where a is set by a scalar node.

Constants

pi = 3.14159265358979323846

i = 0+1i

e = exp(1)

Arithmetic operator precedence

operators with lower precedence are calculated before those with higher precedence

1: ^

2: unary +, unary -

3: *, /

4: +, -

Basic functions

• pow(a,b) = $a^b$
• sqrt(a) = $\sqrt{a}$
• abs(a) = $|a|$
• exp(a) = $e^a$
• exp2(a) = $2^a$
• log(a) = $\log (a)$
• log2(a) = $\log_2(a)$
• log10(a) = $\log_{10}(a)$
• sin(a)
• cos(a)
• tan(a)
• asin(a) = $\sin^{-1}(a)$
• acos(a) = $\cos^{-1}(a)$
• atan(a) = $\tan^{-1}(a)$
• sinh(a)
• cosh(a)
• tanh(a)
• asinh(a) = $\sinh^{-1}(a)$
• acosh(a) = $\cosh^{-1}(a)$
• atanh(a) = $\tanh^{-1}(a)$