Table of Contents
SciDAVis supports different interpreters for evaluating mathematical expressions and for executing scripts.
The constants _e=e=E and _pi=pi=PI=Pi are defined, as well as the operators and functions listed below. muParser is purely a parser for mathematical expressions and as such does not support executing complex scripts. However, you can make formulas easier to read and modify by assigning subexpressions to variables and inserting comments.
Variable assignments evaluate to the assigned value, so they can be used in the middle of a formula. They can also stand on a line of their own, or separated from other parts of the formula by a semicolon (;). The result of evaluating the last line of a multi-line formula is taken as the result of the whole formula.
Comments start with a hash mark (#) and run till the end of the line.
Table 4.1. Supported Mathematical Operators
Name | Description |
---|---|
+ | Addition |
- | Substraction |
* | Multiplication |
/ | Division |
^ | Exponentiation (raise a to the power of b) |
and | logical and (returns 0 or 1) |
or | logical or (returns 0 or 1) |
xor | logical exclusive or (returns 0 or 1) |
< | less then (returns 0 or 1) |
<= | less then or equal (returns 0 or 1) |
== | equal (returns 0 or 1) |
>= | greater then or equal (returns 0 or 1) |
> | greater then (returns 0 or 1) |
!= | not equal (returns 0 or 1) |
Table 4.2. Mathematical Functions
Name | Description |
---|---|
abs(x) | absolute value of x |
acos(x) | inverse cosinus |
acosh(x) | inverse hyperbolic cosinus |
asin(x) | inverse sinus |
asinh(x) | inverse hyperbolic sinus |
atan(x) | inverse tangent |
atanh(x) | inverse hyperbolic tangent |
avg(x1,x2,x3,...) | average value, this command accept a list of arguments separated by commas |
bessel_j0(x) | Regular cylindrical Bessel function of zeroth order, J_{0}(x). |
bessel_j1(x) | Regular cylindrical Bessel function of first order, J_{1}(x). |
bessel_jn(x,n) | Regular cylindrical Bessel function of n^{th} order, J_{n}(x). |
bessel_jn_zero(n, s) | s^{th} zero of regular cylindrical Bessel function of n^{th} order, J_{n}(bessel_jn_zero(n,s))=0 |
bessel_y0(x) | Irregular cylindrical Bessel function of zeroth order, Y_{0}(x) for x>0. |
bessel_y1(x) | Irregular cylindrical Bessel function of first order, Y_{1}(x) for x>0. |
bessel_yn(x,n) | Irregular cylindrical Bessel function of n^{th} order, Y_{n}(x) for x>0. |
beta (a,b) | Computes the Beta Function, B(a,b) = Gamma(a)*Gamma(b)/Gamma(a+b) for a > 0 and b > 0. |
ceil(x) | ceiling; smallest integer greater or equal to x |
cos(x) | cosinus of x |
cosh(x) | hyperbolic cosinus of x |
erf(x) | error function of x |
erfc(x) | Complementary error function erfc(x) = 1 - erf(x). |
erfz(x) | The Gaussian probability density function Z(x). |
erfq(x) | The upper tail of the Gaussian probability function Q(x). |
exp(x) | Exponential function: e raised to the power of x. |
floor(x) | floor; largest integer less than or equal to x |
gamma(x) | Computes the Gamma function, subject to x not being a negative integer |
gammaln(x) | Computes the logarithm of the Gamma function, subject to x not a being negative integer. For x<0, log(|Gamma(x)|) is returned. |
hazard(x) | Computes the hazard function for the normal distribution h(x) = erfz(x)/erfq(x). |
ln(x) | natural logarythm of x |
log(x) | decimal logarythm of x |
log2(x) | base 2 logarythm of x |
w0(x) | Principal branch of Lambert's W function, W_{0}(x). W_{0} is defined as a solution to the equation W_{0}(x)*exp(W_{0}(x))=x. For x<0, there are tow real-valued branches; this function computes the one where W>-1 for x<0 (compare w1(x)). |
w1(x) | Secondary branch of Lambert's W function, W_{-1}(x). W_{-1} is defined as a solution to the equation W_{-1}(x)*exp(W_{-1}(x))=x. For x<0, there are tow real-valued branches; this function computes the one where W<-1 for x<0 (compare w0(x)). |
min(x1,x2,x3,...) | Minimum of the list of arguments |
max(x1,x2,x3,...) | Maximum of the list of arguments |
mod(x,y) | x modulo y; remainder of integer division x/y |
pow(x,y) | x to the power of y, x^y |
rint(x) | Round to nearest integer. |
sign(x) | Sign function: -1 if x<0; 1 if x>0. |
sin(x) | sinus of x |
sinh(x) | hyperblic sinus of x |
sqrt(x) | square root of x |
tan(x) | tangent of x |
tanh(x) | hyperbolic tangent of x |
Table 4.3. Non-Mathematical Functions
Name | Description |
---|---|
cell(a,b) | In the contex of a matrix, returns the value at row a and column b. In the context of a table, returns the value at column a and row b (remember that tables use column logic). Everywhere else, this function is undefined. In the case of tables, the column is specified as a path string; see the documentation of column() for supported path formats. |
cell_(column, row) | In the context of a table, return the value of a cell specified using 1-based indices. Wherever possible, you should use cell() instead, because inserting/removing/moving columns will break formulas using cell_(). |
col(c) | DEPRECATED; use column() or cell() instead. Note that the user interface still uses col() until a proper language-specific mechanism is implemented. |
column("path") | In a column formula, returns the value in the given column and current row (i). The column path can either be the name of column in the current table, more generally a relative path to a column in another table (e.g. "../otherTable/col") or an absolute path (i.e., relative to the project root; e.g. "/folder/otherTable/col"). Searching for a table anywhere in the project using "otherTable/col" (without leading slash) is supported for backwards-compatibility reasons, but is strongly discouraged - a future release will drop the requirement of project-wide unique table names, at which point this usage will cease to be well-defined. |
column_(index) | In a column formula, returns the value in the column given by 1-based index and current row (i). You should use column() wherever possible, because inserting/ removing/moving columns will break formulas using column_(). |
if(e1,e2,e3) | if e1 is true, e2 is executed else e3 is executed. |
tablecol(t,c) | DEPRECATED; use column() instead. |