FunctionCoefficients

Built-in functions available in mathematical expressions

abs(x)

$$|x|$$

Returns the absolute value of the argument $x$.

asin(x)

$$\arcsin(x)$$

Computes arc in radians whose sine is equal to the argument $x$.

acos(x)

$$\arccos(x)$$

Computes arc in radians whose cosine is equal to the argument $x$.

A NaN error is raised if $|x|>1$.

atan(x)

$$\arctan(x)$$

Computes, in radians, the arc tangent of the argument $x$.

If instead of only one argument, two are given, it then behaves as atan2.

atan2(y,x)

$$\arctan(y/x) \in [-\pi,\pi]$$

Computes, in radians, the arc tangent of quotient $y/x$, using the signs of the two arguments

to determine the quadrant of the result, which is in the range $[-\pi,\pi]$.

ceil(x)

$$\lceil x \rceil$$

Returns the smallest integral value not less than the argument $x$.

clock([f])

Returns the value of a certain clock in seconds measured from a certain (but specific) milestone.

The kind of clock and the initial milestone depend on the optional integer argument\ $f$,

which corresponds to the clk_id parameter of the system call clock_getttime().

It defaults to zero (CLOCK_REALTIME), meaning wall time since the UNIX Epoch.

The list and the meanings of the other available values for\ $f$ can be checked

in the clock_gettime (2) system call manual page.

cos(x)

$$\cos(x)$$

Computes the cosine of the argument $x$, where $x$ is in radians.

A cosine wave can be generated by passing as the argument $x$

a linear function of time such as $\omega t+\phi$, where $\omega$ controls the frequency of the wave

and $\phi$ controls its phase.

cosh(x)

$$\cosh(x)$$

Computes the hyperbolic cosine of the argument $x$, where $x$ is in radians.

equal(a, b, [eps])

$$\begin{cases} 1 & \text{if $a = b$} \ 0 & \text{if $a \neq b$} \end{cases}$$

Checks if the two first expressions $a$ and $b$ are equal, up to the tolerance

given by the third optional argument $\epsilon$. Mathematically, the

absolute value of their difference is compared against $\epsilon$. This function

returns \textsl{exactly} zero if the arguments are not equal and one otherwise.

Default $\epsilon = 10^{-9}$.

exp(x)

$$e^x$$

Computes the exponential function the argument $x$, i.e. the base of the

natural logarithms raised to the $x$-th power.

floor(x)

$$\lfloor x \rfloor$$

Returns the largest integral value not greater than the argument $x$.

heaviside(x, [delta])

$$\begin{cases} 0 & \text{if $x < 0$} \ x / \delta & \text{if $0 < x < \delta$} \ 1 & \text{if $x > \delta$} \end{cases}$$

Computes the zero-centered Heaviside step function of the argument $x$.

If the optional second argument $\delta$ is provided, the discontinuous

step at $x=0$ is replaced by a ramp starting at $x=0$ and finishing at $x=\delta$.

if(a, [b], [c], [eps])

$$\begin{cases} b & \text{if $a \neq 0$} \ c & \text{if $a = b$} \end{cases}$$

Performs a conditional testing of the first argument $a$, and returns either the

second optional argument $b$ if $a$ is different from zero or the third optional argument $c$

if $a$ evaluates to zero. The comparison of the condition $a$ with zero is performed

within the precision given by the optional fourth argument $\epsilon$.

If the second argument $c$ is not given and $a$ is not zero, the function returns one.

If the third argument $c$ is not given and $a$ is zero, the function returns zero.

The default precision is $\epsilon = 10^{-9}$.

Even though if is a logical operation, all the arguments and the returned value

are double-precision floating point numbers.

gauss1d(x, mu, sigma)

One-dimensional Gaussian distribution of mean mu and variance sigma.

gauss2d(x, y, mu_x, mu_y, sigma_x, sigma_y, cov_xy)

Two-dimensional Gaussian distribution of with means mu_x and mu_y.

Covariance matrix is given by diagonal elements sigma_x and sigma_y

and off-diagonal element cov_xy.

gauss3d(x, y, z, mu_x, mu_y, mu_z, sigma_x, sigma_y, sigma_z, cov_xy, cov_yz, cov_zx)

Three-dimensional Gaussian distribution of with means mu_x, mu_y and mu_z.

Covariance matrix is given by diagonal elements sigma_x and sigma_y

and off-diagonal element cov_xy.

limit(x, a, b)

$$\begin{cases} a & \text{if $x < a$} \ x & \text{if $a \leq x \leq b$} \ b & \text{if $x > b$} \end{cases}$$

Limits the first argument $x$ to the interval $[a,b]$. The second argument $a$ should

be less than the third argument $b$.

log(x)

$$\ln(x)$$

Computes the natural logarithm of the argument $x$. If $x$ is zero or negative,

a NaN error is issued.

max(x1, x2, [...], [x10])

$$\max \Big (x_1, x_2, \dots, x_{10} \Big)$$

Returns the maximum of the arguments $x_i$ provided.

Currently only a maximum of ten arguments can be given.

min(x1, x2, [...], [x10])

$$\min \Big (x_1, x_2, \dots, x_{10} \Big)$$

Returns the minimum of the $n$ arguments $x_i$ provided.

Currently only a maximum of ten arguments can be given.

mod(a, b)

$$\displaystyle y = a - \left\lfloor \frac{a}{b} \right\rfloor \cdot b$$

Returns the remainder of the division between the first argument $a$ and the

second $b$. Both arguments may be non-integral.

not(x, [eps])

$$\begin{cases}0 &\text{if $|x| < \epsilon$} \ 1 &\text{otherwise} \end{cases}$$

Returns one if the first argument\ $x$ is zero, and zero otherwise.

The second optional argument $\epsilon$ gives the precision of the "zero"

evaluation. If not given, default is $\epsilon = 10^{-9}$.

random(a, b, [s])

$$a + r \cdot (b-a) \quad \quad 0 \leq r < 1$$

Returns a random real number uniformly distributed between the first

real argument $a$ and the second one $b$.

If the third integer argument $s$ is given, it is used as the seed and thus

repetitive sequences can be obtained. If no seed is provided, the current time

(in seconds) is used. Therefore,

two successive calls to the function without seed (hopefully) do not give the same result.

round(x)

$$\begin{cases} \lceil x \rceil & \text{if $\lceil x \rceil - x < 0.5$} \ \lceil x \rceil & \text{if $\lceil x \rceil - x = 0.5 \wedge x > 0$} \ \lfloor x \rfloor & \text{if $x-\lfloor x \rfloor < 0.5$} \ \lfloor x \rfloor & \text{if $x-\lfloor x \rfloor = 0.5 \wedge x < 0$} \end{cases}$$

Rounds the argument $x$ to the nearest integer. Halfway cases are rounded away from zero.

sawtooth_wave(x)

$$x - \lfloor x \rfloor$$

Computes a sawtooth wave betwen zero and one with a period equal to one.

As with the sine wave, a sawtooh wave can be generated by passing as the argument $x$

a linear function of time such as $\omega t+\phi$, where $\omega$ controls the frequency of the wave

and $\phi$ controls its phase.

sgn(x, [eps])

$$\begin{cases}-1 &\text{if $x \le -\epsilon$} \ 0 &\text{if $|x| < \epsilon$} \ +1 &\text{if $x \ge +\epsilon$} \end{cases}$$

Returns minus one, zero or plus one depending on the sign of the first argument $x$.

The second optional argument $\epsilon$ gives the precision of the "zero"

evaluation. If not given, default is $\epsilon = 10^{-9}$.

sin(x)

$$\sin(x)$$

Computes the sine of the argument $x$, where $x$ is in radians.

A sine wave can be generated by passing as the argument $x$

a linear function of time such as $\omega t+\phi$, where $\omega$ controls the frequency of the wave

and $\phi$ controls its phase.

sinh(x)

$$\sinh(x)$$

Computes the hyperbolic sine of the argument $x$, where $x$ is in radians.

sqrt(x)

$$\sqrt{x}$$

Computes the positive square root of the argument $x$.

If $x$ is negative, a NaN error is issued.

square_wave(x)

$$\begin{cases} 1 & \text{if $x - \lfloor x \rfloor < 0.5$} \ 0 & \text{otherwise} \end{cases}$$

Computes a square function betwen zero and one with a period equal to one.

The output is one for $0 < x < 1/2$ and goes to zero for $1/2 < x < 1$.

As with the sine wave, a square wave can be generated by passing as the argument $x$

a linear function of time such as $\omega t+\phi$, where $\omega$ controls the frequency of the wave

and $\phi$ controls its phase.

triangular_wave(x)

$$\begin{cases} 2 (x - \lfloor x \rfloor) & \text{if $x - \lfloor x \rfloor < 0.5$} \ 2 [1-(x - \lfloor x \rfloor)] & \text{otherwise} \end{cases}$$

Computes a triangular wave betwen zero and one with a period equal to one.

As with the sine wave, a triangular wave can be generated by passing as the argument $x$

a linear function of time such as $\omega t+\phi$, where $\omega $ controls the frequency of the wave

and $\phi$ controls its phase.

tan(x)

$$\tan(x)$$

Computes the tangent of the argument $x$, where $x$ is in radians.

tanh(x)

$$\tanh(x)$$

Computes the hyperbolic tangent of the argument $x$, where $x$ is in radians.

Definition of function coefficients (also compatible with functions with multi-dimensional domains).

Fields

  • coefficients: Vector of Float, default = []