Chapter 43. Mathematical Functions

A number of primitive mathematical functions is provided by the platform. In this chapter we will describe their basic form and usage.

43.1. Introduction

In addition to standard arithmetic operators such as addition, subtraction, and so on, we also provide a number of more specialized primitive operations for numerical computing. One large group of such functions are defined on (univariate) random variables with various distributions. In addition, we also provide several miscellaneous mathematical functions (such as the gamma function, error function, and so on).

43.2. Mathematical Functions

43.2.1. Statistical Distribution Functions

LogiQL implements a number of primitive operations that operate on statistical distributions (i.e., on random variables that have those distributions). Each statistical distribution has a set of parameters that define it. For example the normal distribution is defined in terms of the mean and standard deviation (2 parameters), while the Poisson distribution is defined in terms of a rate (1 parameter). In addition to distribution, a number of functions are defined over particular distribution. For example, the probability density function (pdf), describes the relative likelihood for a given random variable (described in terms of a distribution and particular values of its parameters), to take on a given value. For example, for a normal distribution with mean 0, and standard deviation of 1, the likelyhood of the value 0.5 is 0.352. Similarly,the likelyhood of the value 0.0 (mean) is around 0.398.

In LogiQL, both creating a distribution and applying one of the predefined functionson it is embodied in a single primitive function. For example, the rule below returns the probability density function for a normal distribution, parametereized by the mean 0.0, standard deviation 1.0f, for the value 0.6f:

The signatures of some functions are specified using the following form:

lb:stat:distName:funName[p1, ...,pn,x0, ...,xm] = val -> type_p1(p1), type_pn(pn) ,..., type_x0(x1), type_xm(xm) ,..., typev(val)

The function funName takes m arguments, and returns a value. The types of these arguments are type_x0,..., type_xm. The function funName itself acts on a random variable that has a distribution parameterized by a set of parameters [p1, ...,pn of type type_p1,..., type_pn. The type of the function's value is typev.

Concretely, computing the probability density function (pdf) of 0.5, with normal variable with mean 0 and standard deviation 1 would look as follows:

    _[]=v  <- lb:stat:normal:pdf[0.0f, 1.0f, 0.5f]=v.

If we wanted to tabulate the values of the cumulative density function (cdf) for the standard normal distribution, we could write something like the following:

    lb exec ws '_[x]=v <-lb:stat:normal:cdf[0.0f, 1.0f,x]=v, float:range(-1.0f, 1.0f, 0.1f, x).' --print

-1.0                 0.15865525393145705
-0.9                 0.1840601253467595
-0.8                 0.21185539858339666
-0.7                 0.24196365222307306
-0.6                 0.2742531177500736
-0.5                 0.3085375387259869
-0.3999999999999999  0.3445782583896759
-0.29999999999999993 0.3820885778110474
-0.19999999999999996 0.420740290560897
-0.09999999999999998 0.460172162722971
0.0                  0.5
0.10000000000000009  0.539827837277029
0.20000000000000018  0.5792597094391031
0.30000000000000004  0.6179114221889527
0.40000000000000013  0.6554217416103242
0.5                  0.6914624612740131
0.6000000000000001   0.7257468822499265
0.7000000000000002   0.758036347776927
0.8                  0.7881446014166034
0.9000000000000001   0.8159398746532406
1.0                  0.8413447460685429

In the rest of this section, we will give types of predefined functions, and the distributions on which they are defined. Each distribution section will list the names and types of its parameters, as well as some invariants that must hold on it. For example, for a normal distributions with parameters mu and sigma, sigma must be strictly greater than 0 if the distribution is to be defined.

Distribution bernoulli

Bernoulli distribution is the probability distribution of a random variable which takes the value 1 with success probability of p and the value 0 with failure probability of q=1-p. It can be used to represent a coin toss where 1 and 0 would represent "head" and "tail" (or vice versa), respectively. In particular, unfair coins would have p != 0.5.

The distribution has the following parameters:

Parameter Name Notes
p  

Notes . 0 < p < 1

Defined Functions

The following functions are defined for this distribution

lb:stat:bernoulli:cdf

lb:stat:bernoulli:cdf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:bernoulli:chf

lb:stat:bernoulli:chf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:bernoulli:mean

lb:stat:bernoulli:mean[p] = v1 -> float(p), float(v1).
lb:stat:bernoulli:median

lb:stat:bernoulli:median[p] = v1 -> float(p), float(v1).
lb:stat:bernoulli:pdf

lb:stat:bernoulli:pdf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:bernoulli:quantile

lb:stat:bernoulli:quantile[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:bernoulli:range

lb:stat:bernoulli:range(p ; v1,v2) -> float(p), float(v1), float(v2).
lb:stat:bernoulli:std_dev

lb:stat:bernoulli:std_dev[p] = v1 -> float(p), float(v1).

Distribution beta

The beta distribution is a family of continuous probability distributions defined on the interval [0, 1] parametrized by two positive shape parameters, denoted by α and β, that appear as exponents of the random variable and control the shape of the distribution. There are two real-valued parameters.

The distribution has the following parameters:

Parameter Name Notes
alpha  
beta  

Notes . alpha > 0, beta > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:beta:cdf

lb:stat:beta:cdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:beta:chf

lb:stat:beta:chf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:beta:mean

lb:stat:beta:mean[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:beta:median

lb:stat:beta:median[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:beta:pdf

lb:stat:beta:pdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:beta:quantile

lb:stat:beta:quantile[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:beta:range

lb:stat:beta:range(alpha,beta ; v1,v2) -> float(alpha),
  float(beta),
  float(v1),
  float(v2).
lb:stat:beta:std_dev

lb:stat:beta:std_dev[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).

Distribution binomial

The binomial distributionIn probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent yes/no experiments, each of which yields success with probability p. A success/failure experiment is also called a Bernoulli experiment or Bernoulli trial; when n = 1, the binomial distribution is a Bernoulli distribution. The binomial distribution is the basis for the popular binomial test of statistical significance..

The distribution has the following parameters:

Parameter Name Notes
n  
p  

Notes . n (integer) number of trials > 0, 0 <= p <= 1

Defined Functions

The following functions are defined for this distribution

lb:stat:binomial:cdf

lb:stat:binomial:cdf[n,p,x2] = v1 -> float(n),
  float(p),
  float(x2),
  float(v1).
lb:stat:binomial:chf

lb:stat:binomial:chf[n,p,x2] = v1 -> float(n),
  float(p),
  float(x2),
  float(v1).
lb:stat:binomial:mean

lb:stat:binomial:mean[n,p] = v1 -> float(n), float(p), float(v1).
lb:stat:binomial:median

lb:stat:binomial:median[n,p] = v1 -> float(n), float(p), float(v1).
lb:stat:binomial:pdf

lb:stat:binomial:pdf[n,p,x2] = v1 -> float(n),
  float(p),
  float(x2),
  float(v1).
lb:stat:binomial:quantile

lb:stat:binomial:quantile[n,p,x2] = v1 -> float(n),
  float(p),
  float(x2),
  float(v1).
lb:stat:binomial:range

lb:stat:binomial:range(n,p ; v1,v2) -> float(n),
  float(p),
  float(v1),
  float(v2).
lb:stat:binomial:std_dev

lb:stat:binomial:std_dev[n,p] = v1 -> float(n), float(p), float(v1).

Distribution cauchy

The Cauchy distribution is a continuous probability distribution with two parameters (location and scale). The location parameter x0 is the location of the peak of the distribution (the mode of the distribution), while the scale parameter Y specifies half the width of the PDF at half the maximum height. If the location is zero, and the scale 1, then the result is a standard Cauchy distribution.

The distribution has the following parameters:

Parameter Name Notes
x0  
Y  

Notes . Y > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:cauchy:cdf

lb:stat:cauchy:cdf[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:chf

lb:stat:cauchy:chf[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:find_location

lb:stat:cauchy:find_location[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:find_scale

lb:stat:cauchy:find_scale[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:mean

lb:stat:cauchy:mean[x0,Y] = v1 -> float(x0), float(Y), float(v1).
lb:stat:cauchy:median

lb:stat:cauchy:median[x0,Y] = v1 -> float(x0), float(Y), float(v1).
lb:stat:cauchy:pdf

lb:stat:cauchy:pdf[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:quantile

lb:stat:cauchy:quantile[x0,Y,x2] = v1 -> float(x0),
  float(Y),
  float(x2),
  float(v1).
lb:stat:cauchy:range

lb:stat:cauchy:range(x0,Y ; v1,v2) -> float(x0),
  float(Y),
  float(v1),
  float(v2).
lb:stat:cauchy:std_dev

lb:stat:cauchy:std_dev[x0,Y] = v1 -> float(x0), float(Y), float(v1).

Distribution chi_squared

The chi-squared distribution (also chi-square or χ²-distribution) with k degrees of freedom is the distribution of a sum of the squares of k independent standard normal random variables. It is a special case of the gamma distribution and is one of the most widely used probability distributions in inferential statistics, e.g., in hypothesis testing or in construction of confidence intervals.

The distribution has the following parameters:

Parameter Name Notes
k  

Notes . k integeral (degrees of freedom), k > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:chi_squared:cdf

lb:stat:chi_squared:cdf[k,x1] = v1 -> float(k), float(x1), float(v1).
lb:stat:chi_squared:chf

lb:stat:chi_squared:chf[k,x1] = v1 -> float(k), float(x1), float(v1).
lb:stat:chi_squared:mean

lb:stat:chi_squared:mean[k] = v1 -> float(k), float(v1).
lb:stat:chi_squared:median

lb:stat:chi_squared:median[k] = v1 -> float(k), float(v1).
lb:stat:chi_squared:pdf

lb:stat:chi_squared:pdf[k,x1] = v1 -> float(k), float(x1), float(v1).
lb:stat:chi_squared:quantile

lb:stat:chi_squared:quantile[k,x1] = v1 -> float(k),
  float(x1),
  float(v1).
lb:stat:chi_squared:range

lb:stat:chi_squared:range(k ; v1,v2) -> float(k), float(v1), float(v2).
lb:stat:chi_squared:std_dev

lb:stat:chi_squared:std_dev[k] = v1 -> float(k), float(v1).

Distribution erlang_distribution

The distribution has the following parameters:

Parameter Name Notes
k  
lambda  

Notes . k integral, lambda > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:erlang_distribution:cdf

lb:stat:erlang_distribution:cdf[k,lambda,x2] = v1 -> float(k),
  float(lambda),
  float(x2),
  float(v1).
lb:stat:erlang_distribution:chf

lb:stat:erlang_distribution:chf[k,lambda,x2] = v1 -> float(k),
  float(lambda),
  float(x2),
  float(v1).
lb:stat:erlang_distribution:mean

lb:stat:erlang_distribution:mean[k,lambda] = v1 -> float(k),
  float(lambda),
  float(v1).
lb:stat:erlang_distribution:median

lb:stat:erlang_distribution:median[k,lambda] = v1 -> float(k),
  float(lambda),
  float(v1).
lb:stat:erlang_distribution:pdf

lb:stat:erlang_distribution:pdf[k,lambda,x2] = v1 -> float(k),
  float(lambda),
  float(x2),
  float(v1).
lb:stat:erlang_distribution:quantile

lb:stat:erlang_distribution:quantile[k,lambda,x2] = v1 -> float(k),
  float(lambda),
  float(x2),
  float(v1).
lb:stat:erlang_distribution:range

lb:stat:erlang_distribution:range(k,lambda ; v1,v2) -> float(k),
  float(lambda),
  float(v1),
  float(v2).
lb:stat:erlang_distribution:std_dev

lb:stat:erlang_distribution:std_dev[k,lambda] = v1 -> float(k),
  float(lambda),
  float(v1).

Distribution extreme_value

There are various extreme value distributions : this implementation represents the maximum case, and is variously known as a Fisher-Tippett distribution, a log-Weibull distribution or a Gumbel distribution. It has two parameters: location and scale.

The distribution has the following parameters:

Parameter Name Notes
location  
scale  

Notes . scale>0

Defined Functions

The following functions are defined for this distribution

lb:stat:extreme_value:cdf

lb:stat:extreme_value:cdf[location,scale,x2] = v1 -> float(location),
  float(scale),
  float(x2),
  float(v1).
lb:stat:extreme_value:chf

lb:stat:extreme_value:chf[location,scale,x2] = v1 -> float(location),
  float(scale),
  float(x2),
  float(v1).
lb:stat:extreme_value:mean

lb:stat:extreme_value:mean[location,scale] = v1 -> float(location),
  float(scale),
  float(v1).
lb:stat:extreme_value:median

lb:stat:extreme_value:median[location,scale] = v1 -> float(location),
  float(scale),
  float(v1).
lb:stat:extreme_value:pdf

lb:stat:extreme_value:pdf[location,scale,x2] = v1 -> float(location),
  float(scale),
  float(x2),
  float(v1).
lb:stat:extreme_value:quantile

lb:stat:extreme_value:quantile[location,scale,x2] = v1 -> float(location),
  float(scale),
  float(x2),
  float(v1).
lb:stat:extreme_value:range

lb:stat:extreme_value:range(location,scale ; v1,v2) -> float(location),
  float(scale),
  float(v1),
  float(v2).
lb:stat:extreme_value:std_dev

lb:stat:extreme_value:std_dev[location,scale] = v1 -> float(location),
  float(scale),
  float(v1).

Distribution fisher_f

The F distribution is a continuous distribution that arises when testing whether two samples have the same variance.

The distribution has the following parameters:

Parameter Name Notes
m  
n  

Notes . m >0, n>0, m and n degrees of freedom

Defined Functions

The following functions are defined for this distribution

lb:stat:fisher_f:cdf

lb:stat:fisher_f:cdf[m,n,x2] = v1 -> float(m),
  float(n),
  float(x2),
  float(v1).
lb:stat:fisher_f:chf

lb:stat:fisher_f:chf[m,n,x2] = v1 -> float(m),
  float(n),
  float(x2),
  float(v1).
lb:stat:fisher_f:mean

lb:stat:fisher_f:mean[m,n] = v1 -> float(m), float(n), float(v1).
lb:stat:fisher_f:median

lb:stat:fisher_f:median[m,n] = v1 -> float(m), float(n), float(v1).
lb:stat:fisher_f:pdf

lb:stat:fisher_f:pdf[m,n,x2] = v1 -> float(m),
  float(n),
  float(x2),
  float(v1).
lb:stat:fisher_f:quantile

lb:stat:fisher_f:quantile[m,n,x2] = v1 -> float(m),
  float(n),
  float(x2),
  float(v1).
lb:stat:fisher_f:range

lb:stat:fisher_f:range(m,n ; v1,v2) -> float(m),
  float(n),
  float(v1),
  float(v2).
lb:stat:fisher_f:std_dev

lb:stat:fisher_f:std_dev[m,n] = v1 -> float(m), float(n), float(v1).

Distribution gamma

The gamma distribution is a continuous probability distribution. When the shape parameter is an integer then it is known as the Erlang Distribution. It is also closely related to the Poisson and Chi Squared Distributions.

The distribution has the following parameters:

Parameter Name Notes
alpha  
beta  

Notes . alpha > 0, beta > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:gamma:cdf

lb:stat:gamma:cdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:gamma:chf

lb:stat:gamma:chf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:gamma:mean

lb:stat:gamma:mean[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:gamma:median

lb:stat:gamma:median[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:gamma:pdf

lb:stat:gamma:pdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:gamma:quantile

lb:stat:gamma:quantile[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:gamma:range

lb:stat:gamma:range(alpha,beta ; v1,v2) -> float(alpha),
  float(beta),
  float(v1),
  float(v2).
lb:stat:gamma:std_dev

lb:stat:gamma:std_dev[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).

Distribution geometric

The distribution has the following parameters:

Parameter Name Notes
p  

Notes . 0 <= p <= 1

Defined Functions

The following functions are defined for this distribution

lb:stat:geometric:cdf

lb:stat:geometric:cdf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:geometric:chf

lb:stat:geometric:chf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:geometric:mean

lb:stat:geometric:mean[p] = v1 -> float(p), float(v1).
lb:stat:geometric:median

lb:stat:geometric:median[p] = v1 -> float(p), float(v1).
lb:stat:geometric:pdf

lb:stat:geometric:pdf[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:geometric:quantile

lb:stat:geometric:quantile[p,x1] = v1 -> float(p), float(x1), float(v1).
lb:stat:geometric:range

lb:stat:geometric:range(p ; v1,v2) -> float(p), float(v1), float(v2).
lb:stat:geometric:std_dev

lb:stat:geometric:std_dev[p] = v1 -> float(p), float(v1).

Distribution hypergeometric

The hypergeometric distribution describes the number of "events" k from a sample n drawn from a total population N without replacement. Imagine we have a sample of N objects of which r are "defective" and N-r are "not defective" (the terms "success/failure" or "red/blue" are also used). If we sample n items without replacement then what is the probability that exactly k items in the sample are defective? The answer is given by the pdf of the hypergeometric distribution f(k; r, n, N), whilst the probability of k defectives or fewer is given by F(k; r, n, N), where F(k) is the CDF of the hypergeometric distribution. The domain of the random variable is the unsigned integers in the range [max(0, n + r - N), min(n, r)].

The distribution has the following parameters:

Parameter Name Notes
r  
n  
N  

Notes . all parameters of integer type; n >= 0, N >= 0, r >= 0

Defined Functions

The following functions are defined for this distribution

lb:stat:hypergeometric:cdf

lb:stat:hypergeometric:cdf[r,n,N,x3] = v1 -> int(r),
  int(n),
  int(N),
  float(x3),
  float(v1).
lb:stat:hypergeometric:chf

lb:stat:hypergeometric:chf[r,n,N,x3] = v1 -> int(r),
  int(n),
  int(N),
  float(x3),
  float(v1).
lb:stat:hypergeometric:mean

lb:stat:hypergeometric:mean[r,n,N] = v1 -> int(r),
  int(n),
  int(N),
  float(v1).
lb:stat:hypergeometric:median

lb:stat:hypergeometric:median[r,n,N] = v1 -> int(r),
  int(n),
  int(N),
  float(v1).
lb:stat:hypergeometric:pdf

lb:stat:hypergeometric:pdf[r,n,N,x3] = v1 -> int(r),
  int(n),
  int(N),
  float(x3),
  float(v1).
lb:stat:hypergeometric:quantile

lb:stat:hypergeometric:quantile[r,n,N,x3] = v1 -> int(r),
  int(n),
  int(N),
  float(x3),
  float(v1).
lb:stat:hypergeometric:range

lb:stat:hypergeometric:range(r,n,N ; v1,v2) -> int(r),
  int(n),
  int(N),
  float(v1),
  float(v2).
lb:stat:hypergeometric:std_dev

lb:stat:hypergeometric:std_dev[r,n,N] = v1 -> int(r),
  int(n),
  int(N),
  float(v1).

Distribution inverse_gaussian

Defined Functions

The following functions are defined for this distribution

lb:stat:inverse_gaussian:cdf

lb:stat:inverse_gaussian:cdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:inverse_gaussian:chf

lb:stat:inverse_gaussian:chf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:inverse_gaussian:mean

lb:stat:inverse_gaussian:mean[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).
lb:stat:inverse_gaussian:median

lb:stat:inverse_gaussian:median[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).
lb:stat:inverse_gaussian:pdf

lb:stat:inverse_gaussian:pdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:inverse_gaussian:quantile

lb:stat:inverse_gaussian:quantile[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:inverse_gaussian:range

lb:stat:inverse_gaussian:range(x1,x2 ; v1,v2) -> float(x1),
  float(x2),
  float(v1),
  float(v2).
lb:stat:inverse_gaussian:std_dev

lb:stat:inverse_gaussian:std_dev[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).

Distribution laplace

Laplace distribution is the distribution of differences between two independent variates with identical exponential distributions (Abramowitz and Stegun 1972, p. 930). It is also called the double exponential distribution. The location and scale parameters are equivalent to the mean and standard deviation of the normal or Gaussian distribution.

The distribution has the following parameters:

Parameter Name Notes
mu  
sigma  

Notes . sigma>0

Defined Functions

The following functions are defined for this distribution

lb:stat:laplace:cdf

lb:stat:laplace:cdf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:laplace:chf

lb:stat:laplace:chf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:laplace:mean

lb:stat:laplace:mean[mu,sigma] = v1 -> float(mu),
  float(sigma),
  float(v1).
lb:stat:laplace:median

lb:stat:laplace:median[mu,sigma] = v1 -> float(mu),
  float(sigma),
  float(v1).
lb:stat:laplace:pdf

lb:stat:laplace:pdf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:laplace:quantile

lb:stat:laplace:quantile[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:laplace:range

lb:stat:laplace:range(mu,sigma ; v1,v2) -> float(mu),
  float(sigma),
  float(v1),
  float(v2).
lb:stat:laplace:std_dev

lb:stat:laplace:std_dev[mu,sigma] = v1 -> float(mu),
  float(sigma),
  float(v1).

Distribution logistic

The logistic distribution is a continous probability distribution. It has two parameters - location and scale. The cumulative distribution function of the logistic distribution appears in logistic regression and feedforward neural networks.

The distribution has the following parameters:

Parameter Name Notes
mu  
s  

Notes . s > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:logistic:cdf

lb:stat:logistic:cdf[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:chf

lb:stat:logistic:chf[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:find_location

lb:stat:logistic:find_location[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:find_scale

lb:stat:logistic:find_scale[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:mean

lb:stat:logistic:mean[mu,s] = v1 -> float(mu), float(s), float(v1).
lb:stat:logistic:median

lb:stat:logistic:median[mu,s] = v1 -> float(mu), float(s), float(v1).
lb:stat:logistic:pdf

lb:stat:logistic:pdf[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:quantile

lb:stat:logistic:quantile[mu,s,x2] = v1 -> float(mu),
  float(s),
  float(x2),
  float(v1).
lb:stat:logistic:range

lb:stat:logistic:range(mu,s ; v1,v2) -> float(mu),
  float(s),
  float(v1),
  float(v2).
lb:stat:logistic:std_dev

lb:stat:logistic:std_dev[mu,s] = v1 -> float(mu), float(s), float(v1).

Distribution lognormal

Defined Functions

The following functions are defined for this distribution

lb:stat:lognormal:cdf

lb:stat:lognormal:cdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:chf

lb:stat:lognormal:chf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:find_location

lb:stat:lognormal:find_location[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:find_scale

lb:stat:lognormal:find_scale[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:mean

lb:stat:lognormal:mean[x1,x2] = v1 -> float(x1), float(x2), float(v1).
lb:stat:lognormal:median

lb:stat:lognormal:median[x1,x2] = v1 -> float(x1), float(x2), float(v1).
lb:stat:lognormal:pdf

lb:stat:lognormal:pdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:quantile

lb:stat:lognormal:quantile[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:lognormal:range

lb:stat:lognormal:range(x1,x2 ; v1,v2) -> float(x1),
  float(x2),
  float(v1),
  float(v2).
lb:stat:lognormal:std_dev

lb:stat:lognormal:std_dev[x1,x2] = v1 -> float(x1), float(x2), float(v1).

Distribution negative_binomial

Defined Functions

The following functions are defined for this distribution

lb:stat:negative_binomial:cdf

lb:stat:negative_binomial:cdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:negative_binomial:chf

lb:stat:negative_binomial:chf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:negative_binomial:mean

lb:stat:negative_binomial:mean[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).
lb:stat:negative_binomial:median

lb:stat:negative_binomial:median[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).
lb:stat:negative_binomial:pdf

lb:stat:negative_binomial:pdf[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:negative_binomial:quantile

lb:stat:negative_binomial:quantile[x1,x2,x3] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(v1).
lb:stat:negative_binomial:range

lb:stat:negative_binomial:range(x1,x2 ; v1,v2) -> float(x1),
  float(x2),
  float(v1),
  float(v2).
lb:stat:negative_binomial:std_dev

lb:stat:negative_binomial:std_dev[x1,x2] = v1 -> float(x1),
  float(x2),
  float(v1).

Distribution normal

The normal distribution is probably the most well known statistical distribution: it is also known as the Gaussian Distribution. A normal distribution with mean zero and standard deviation one is known as the Standard Normal Distribution.

The distribution has the following parameters:

Parameter Name Notes
mu  
sigma  

Notes . sigma > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:normal:cdf

lb:stat:normal:cdf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:chf

lb:stat:normal:chf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:find_location

lb:stat:normal:find_location[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:find_scale

lb:stat:normal:find_scale[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:mean

lb:stat:normal:mean[mu,sigma] = v1 -> float(mu), float(sigma), float(v1).
lb:stat:normal:median

lb:stat:normal:median[mu,sigma] = v1 -> float(mu),
  float(sigma),
  float(v1).
lb:stat:normal:pdf

lb:stat:normal:pdf[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:quantile

lb:stat:normal:quantile[mu,sigma,x2] = v1 -> float(mu),
  float(sigma),
  float(x2),
  float(v1).
lb:stat:normal:range

lb:stat:normal:range(mu,sigma ; v1,v2) -> float(mu),
  float(sigma),
  float(v1),
  float(v2).
lb:stat:normal:std_dev

lb:stat:normal:std_dev[mu,sigma] = v1 -> float(mu),
  float(sigma),
  float(v1).

Distribution pareto

The Pareto distribution is a continuous distribution with the probability density function (pdf):f(x; α, β) = αβα / xα+ 1. For shape parameter α > 0, and scale parameter β > 0. If x < β , the pdf is zero. The Pareto distribution often describes the larger compared to the smaller. A classic example is that 80% of the wealth is owned by 20% of the population.

The distribution has the following parameters:

Parameter Name Notes
scale  
shape  

Notes . scape>0, shape>0

Defined Functions

The following functions are defined for this distribution

lb:stat:pareto:cdf

lb:stat:pareto:cdf[scale,shape,x2] = v1 -> float(scale),
  float(shape),
  float(x2),
  float(v1).
lb:stat:pareto:chf

lb:stat:pareto:chf[scale,shape,x2] = v1 -> float(scale),
  float(shape),
  float(x2),
  float(v1).
lb:stat:pareto:mean

lb:stat:pareto:mean[scale,shape] = v1 -> float(scale),
  float(shape),
  float(v1).
lb:stat:pareto:median

lb:stat:pareto:median[scale,shape] = v1 -> float(scale),
  float(shape),
  float(v1).
lb:stat:pareto:pdf

lb:stat:pareto:pdf[scale,shape,x2] = v1 -> float(scale),
  float(shape),
  float(x2),
  float(v1).
lb:stat:pareto:quantile

lb:stat:pareto:quantile[scale,shape,x2] = v1 -> float(scale),
  float(shape),
  float(x2),
  float(v1).
lb:stat:pareto:range

lb:stat:pareto:range(scale,shape ; v1,v2) -> float(scale),
  float(shape),
  float(v1),
  float(v2).
lb:stat:pareto:std_dev

lb:stat:pareto:std_dev[scale,shape] = v1 -> float(scale),
  float(shape),
  float(v1).

Distribution poisson

The Poisson distribution is a well-known statistical discrete distribution. It expresses the probability of a number of events (or failures, arrivals, occurrences ...) occurring in a fixed period of time, provided these events occur with a known mean rate λ (events/time), and are independent of the time since the last event. The distribution was discovered by Siméon-Denis Poisson (1781 to 1840).

The distribution has the following parameters:

Parameter Name Notes
lambda  

Notes . lambda > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:poisson:cdf

lb:stat:poisson:cdf[lambda,x1] = v1 -> float(lambda),
  float(x1),
  float(v1).
lb:stat:poisson:chf

lb:stat:poisson:chf[lambda,x1] = v1 -> float(lambda),
  float(x1),
  float(v1).
lb:stat:poisson:mean

lb:stat:poisson:mean[lambda] = v1 -> float(lambda), float(v1).
lb:stat:poisson:median

lb:stat:poisson:median[lambda] = v1 -> float(lambda), float(v1).
lb:stat:poisson:pdf

lb:stat:poisson:pdf[lambda,x1] = v1 -> float(lambda),
  float(x1),
  float(v1).
lb:stat:poisson:quantile

lb:stat:poisson:quantile[lambda,x1] = v1 -> float(lambda),
  float(x1),
  float(v1).
lb:stat:poisson:range

lb:stat:poisson:range(lambda ; v1,v2) -> float(lambda),
  float(v1),
  float(v2).
lb:stat:poisson:std_dev

lb:stat:poisson:std_dev[lambda] = v1 -> float(lambda), float(v1).

Distribution rayleigh

The Rayleigh distribution is a continuous distribution with the probability density function: f(x; sigma) = x * exp(-x2/2 σ2) / σ2, for sigma parameter σ > 0, and x > 0. The Rayleigh distribution is often used where two orthogonal components have an absolute value, for example, wind velocity and direction may be combined to yield a wind speed, or real and imaginary components may have absolute values that are Rayleigh distributed.

The distribution has the following parameters:

Parameter Name Notes
sigma  

Notes . sigma>0

Defined Functions

The following functions are defined for this distribution

lb:stat:rayleigh:cdf

lb:stat:rayleigh:cdf[sigma,x1] = v1 -> float(sigma),
  float(x1),
  float(v1).
lb:stat:rayleigh:chf

lb:stat:rayleigh:chf[sigma,x1] = v1 -> float(sigma),
  float(x1),
  float(v1).
lb:stat:rayleigh:mean

lb:stat:rayleigh:mean[sigma] = v1 -> float(sigma), float(v1).
lb:stat:rayleigh:median

lb:stat:rayleigh:median[sigma] = v1 -> float(sigma), float(v1).
lb:stat:rayleigh:pdf

lb:stat:rayleigh:pdf[sigma,x1] = v1 -> float(sigma),
  float(x1),
  float(v1).
lb:stat:rayleigh:quantile

lb:stat:rayleigh:quantile[sigma,x1] = v1 -> float(sigma),
  float(x1),
  float(v1).
lb:stat:rayleigh:range

lb:stat:rayleigh:range(sigma ; v1,v2) -> float(sigma),
  float(v1),
  float(v2).
lb:stat:rayleigh:std_dev

lb:stat:rayleigh:std_dev[sigma] = v1 -> float(sigma), float(v1).

Distribution skew_normal

The distribution has the following parameters:

Parameter Name Notes
location  
scale  
shape  

Notes . scale > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:skew_normal:cdf

lb:stat:skew_normal:cdf[location,scale,shape,x3] = v1 -> float(location),
  float(scale),
  float(shape),
  float(x3),
  float(v1).
lb:stat:skew_normal:chf

lb:stat:skew_normal:chf[location,scale,shape,x3] = v1 -> float(location),
  float(scale),
  float(shape),
  float(x3),
  float(v1).
lb:stat:skew_normal:mean

lb:stat:skew_normal:mean[location,scale,shape] = v1 -> float(location),
  float(scale),
  float(shape),
  float(v1).
lb:stat:skew_normal:median

lb:stat:skew_normal:median[location,scale,shape] = v1 -> float(location),
  float(scale),
  float(shape),
  float(v1).
lb:stat:skew_normal:pdf

lb:stat:skew_normal:pdf[location,scale,shape,x3] = v1 -> float(location),
  float(scale),
  float(shape),
  float(x3),
  float(v1).
lb:stat:skew_normal:quantile

lb:stat:skew_normal:quantile[location,scale,shape,x3] = v1 ->
float(location), float(scale), float(shape), float(x3), float(v1).
lb:stat:skew_normal:range

lb:stat:skew_normal:range(location,scale,shape ; v1,v2) ->
float(location), float(scale), float(shape), float(v1), float(v2).
lb:stat:skew_normal:std_dev

lb:stat:skew_normal:std_dev[location,scale,shape] = v1 -> float(location),
  float(scale),
  float(shape),
  float(v1).

Distribution triangular

The triangular distribution is a continuous probability distribution with a lower limit a, mode c, and upper limit b. The triangular distribution is often used where the distribution is only vaguely known, but, like the uniform distribution, upper and limits are 'known', but a 'best guess', the mode or center point, is also added. It has been recommended as a proxy for the beta distribution. The distribution is used in business decision making and project planning. Parameter a (lower) can be any finite value. Parameter b (upper) can be any finite value > a (lower). Parameter c (mode) a <= c <= b. This is the most probable value. The random variate x must also be finite, and is supported lower <= x <= upper. The triangular distribution may be appropriate when an assumption of a normal distribution is unjustified because uncertainty is caused by rounding and quantization from analog to digital conversion. Upper and lower limits are known, and the most probable value lies midway. The distribution simplifies when the 'best guess' is either the lower or upper limit - a 90 degree angle triangle. The default chosen is the 0,0,1 triangular distribution which expresses an estimate that the lowest value is the most likely; for example, you believe that the next-day quoted delivery date is most likely (knowing that a quicker delivery is impossible - the postman only comes once a day), and that longer delays are decreasingly likely, and delivery is assumed to never take more than your upper limit.

The distribution has the following parameters:

Parameter Name Notes
a  
b  
c  

Notes . a < b, a < c < b

Defined Functions

The following functions are defined for this distribution

lb:stat:triangular:cdf

lb:stat:triangular:cdf[a,b,c,x3] = v1 -> float(a),
  float(b),
  float(c),
  float(x3),
  float(v1).
lb:stat:triangular:chf

lb:stat:triangular:chf[a,b,c,x3] = v1 -> float(a),
  float(b),
  float(c),
  float(x3),
  float(v1).
lb:stat:triangular:mean

lb:stat:triangular:mean[a,b,c] = v1 -> float(a),
  float(b),
  float(c),
  float(v1).
lb:stat:triangular:median

lb:stat:triangular:median[a,b,c] = v1 -> float(a),
  float(b),
  float(c),
  float(v1).
lb:stat:triangular:pdf

lb:stat:triangular:pdf[a,b,c,x3] = v1 -> float(a),
  float(b),
  float(c),
  float(x3),
  float(v1).
lb:stat:triangular:quantile

lb:stat:triangular:quantile[a,b,c,x3] = v1 -> float(a),
  float(b),
  float(c),
  float(x3),
  float(v1).
lb:stat:triangular:range

lb:stat:triangular:range(a,b,c ; v1,v2) -> float(a),
  float(b),
  float(c),
  float(v1),
  float(v2).
lb:stat:triangular:std_dev

lb:stat:triangular:std_dev[a,b,c] = v1 -> float(a),
  float(b),
  float(c),
  float(v1).

Distribution weibull

The Weibull distribution is a continuous distribution with the probability density function: f(x; α, β) = (α/β) * (x / β)α - 1 * e-(x/β)α, For shape parameter α > 0, and scale parameter β > 0, and x > 0.

The distribution has the following parameters:

Parameter Name Notes
alpha  
beta  

Notes . alpha > 0, beta > 0

Defined Functions

The following functions are defined for this distribution

lb:stat:weibull:cdf

lb:stat:weibull:cdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:weibull:chf

lb:stat:weibull:chf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:weibull:mean

lb:stat:weibull:mean[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:weibull:median

lb:stat:weibull:median[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).
lb:stat:weibull:pdf

lb:stat:weibull:pdf[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:weibull:quantile

lb:stat:weibull:quantile[alpha,beta,x2] = v1 -> float(alpha),
  float(beta),
  float(x2),
  float(v1).
lb:stat:weibull:range

lb:stat:weibull:range(alpha,beta ; v1,v2) -> float(alpha),
  float(beta),
  float(v1),
  float(v2).
lb:stat:weibull:std_dev

lb:stat:weibull:std_dev[alpha,beta] = v1 -> float(alpha),
  float(beta),
  float(v1).

43.2.2. Miscellanous Mathematical Functions

float:lgamma

Implements logarithm of the gamma function.

float:lgamma[x1] = v1 -> float(x1), float(v1). 

float:logistic

Implements the logistic function. f(x0,L,k)

where

x0 = the x-value of the sigmoid's midpoint

L = the curve's maximum value

and k = the steepness of the curve.

float:logistic[x1,x2,x3,x4] = v1 -> float(x1),
  float(x2),
  float(x3),
  float(x4),
  float(v1). 

float:erf_inv

Implements the inverse of the error function

float:erf_inv[x1] = v1 -> float(x1), float(v1). 

float:sgn

float:sgn[x1] = v1 -> float(x1), float(v1). 

int:prime

Returns nth prime number where n < 10000

int:prime[x1] = v1 -> int(x1), int(v1). 

float:beta

float:beta[x1,x2] = v1 -> float(x1), float(x2), float(v1). 

float:tgamma

float:tgamma[x1] = v1 -> float(x1), float(v1). 

float:ramp

float:ramp[x1] = v1 -> float(x1), float(v1). 

float:sigmoid

float:sigmoid[x1] = v1 -> float(x1), float(v1). 

float:hermite_next

float:hermite_next[x1,x2,x3,x4] = v1 -> int(x1),
  float(x2),
  float(x3),
  float(x4),
  float(v1). 

float:hermite

float:hermite[x1,x2] = v1 -> int(x1), float(x2), float(v1). 

float:erf

Implements the error function

float:erf[x1] = v1 -> float(x1), float(v1).