Formulas 5. Mathematical functions

abs (x)
  absolute value
round (x)
  nearest integer; round (1.5) = 2
floor (x)
  round down: highest integer value not greater than x
ceiling (x)
  round up: lowest integer value not less than x
sqrt (x)
  square root: √x, x ≥ 0
min (x, ...)
  the minimum of a series of numbers, e.g. min (7.2, -5, 3) = -5
max (x, ...)
  the maximum of a series of numbers, e.g. max (7.2, -5, 3) = 7.2
imin (x, ...)
  the location of the minimum, e.g. imin (7.2, -5, 3) = 2
imax (x, ...)
  the location of the maximum, e.g. imax (7.2, -5, 3) = 1
sin (x)
  sine
cos (x)
  cosine
tan (x)
  tangent
arcsin (x)
  arcsine, -1 ≤ x ≤ 1
arccos (x)
  arccosine, -1 ≤ x ≤ 1
arctan (x)
  arctangent
arctan2 (y, x)
  argument angle
sinc (x)
  sinus cardinalis: sin (x) / x
sincpi (x)
  sincπ: sin (π x) / (π x)
exp (x)
  exponentiation: ex; same as e^x
ln (x)
  natural logarithm, base e
log10 (x)
  logarithm, base 10
log2 (x)
  logarithm, base 2
sinh (x)
  hyperbolic sine: (ex - e-x) / 2
cosh (x)
  hyperbolic cosine: (ex + e-x) / 2
tanh (x)
  hyperbolic tangent: sinh (x) / cosh (x)
arcsinh (x)
  inverse hyperbolic sine: ln (x + √(1+x2))
arccosh (x)
  inverse hyperbolic cosine: ln (x + √(x2−1))
arctanh (x)
  inverse hyperbolic tangent
sigmoid (x)
  R → (0,1): 1 / (1 + e−x) or 1 − 1 / (1 + ex)
invSigmoid (x)
  (0,1) → R: ln (x / (1 − x))
erf (x)
  the error function: 2/√π 0∫x exp(-t2) dt
erfc (x)
  the complement of the error function: 1 - erf (x)
randomUniform (min, max)
  a uniform random real number between min (inclusive) and max (exclusive)
randomInteger (min, max)
  a uniform random integer number between min and max (inclusive)
randomGauss (μ, σ)
  a Gaussian random real number with mean μ and standard deviation σ
randomPoisson (mean)
  a Poisson random real number
randomGamma (shape, rate)
  a random number drawn from a Gamma distribution with shape parameter α and rate parameter β, which is defined as f(x; α, β) = (1 / Γ (α)) β α xα−1 e−β x, for x > 0, α > 0 and β > 0, following the method by Marsaglia & Tsang (2000)
random_initializeWithSeedUnsafelyButPredictably (seed)
  can be used in a script to create a reproducible sequence of random numbers (warning: this exceptional situation will continue to exist throughout Praat until you call the following function)
random_initializeSafelyAndUnpredictably ()
  undoes the exceptional situation caused by the previous function
lnGamma (x)
  logarithm of the Γ function
gaussP (z)
  the area under the Gaussian distribution between −∞ and z
gaussQ (z)
  the area under the Gaussian distribution between z and +∞: the one-tailed "statistical significance p" of a value that is z standard deviations away from the mean of a Gaussian distribution
invGaussQ (q)
  the value of z for which `gaussQ` (z) = q
chiSquareP (`chiSquare`, `df`)
  the area under the χ2 distribution between 0 and chiSquare, for `df` degrees of freedom
chiSquareQ (`chiSquare`, `df`)
  the area under the χ2 distribution between `chiSquare` and +∞, for df degrees of freedom: the "statistical significance p" of the χ2 difference between two distributions in df+1 dimensions
invChiSquareQ (q, df)
  the value of χ2 for which `chiSquareQ` (χ2, df) = q
studentP (t, df)
  the area under the student T-distribution from -∞ to t
studentQ (t, df)
  the area under the student T-distribution from t to +∞
invStudentQ (q, df)
  the value of t for which `studentQ` (t, df) = q
fisherP (f, df1, df2)
  the area under Fisher's F-distribution from 0 to f
fisherQ (f, df1, df2)
  the area under Fisher's F-distribution from f to +∞
invFisherQ (q, df1, df2)
  the value of f for which `fisherQ` (f, df1, df2) = q
binomialP (p, k, n)
  the probability that in n experiments, an event with probability p will occur at most k times
`binomialQ` (p, k, n)
  the probability that in n experiments, an event with probability p will occur at least k times; equals 1 - `binomialP` (p, k - 1, n)
invBinomialP (P, k, n)
  the value of p for which `binomialP` (p, k, n) = P
`invBinomialQ` (Q, k, n)
  the value of p for which `binomialQ` (p, k, n) = Q
hertzToBark (x)
  from acoustic frequency to Bark-rate (perceptual spectral frequency; place on basilar membrane): 7 ln (x/650 + √(1 + (x/650)2))
barkToHertz (x)
  650 sinh (x / 7)
hertzToMel (x)
  from acoustic frequency to perceptual pitch: 550 ln (1 + x / 550)
melToHertz (x)
  550 (exp (x / 550) - 1)
hertzToSemitones (x)
  from acoustic frequency to a logarithmic musical scale, relative to 100 Hz: 12 ln (x / 100) / ln 2
semitonesToHertz (x)
  100 exp (x ln 2 / 12)
erb (f)
  the perceptual equivalent rectangular bandwidth (ERB) in hertz, for a specified acoustic frequency (also in hertz): 6.23·10-6 f2 + 0.09339 f + 28.52
hertzToErb (x)
  from acoustic frequency to ERB-rate: 11.17 ln ((x + 312) / (x + 14680)) + 43
erbToHertz (x)
  (14680 d - 312) / (1 - d) where d = exp ((x - 43) / 11.17)
`phonToDifferenceLimens` (x)
  from perceptual loudness (intensity sensation) level in phon, to the number of intensity difference limens above threshold: 30 · ((61/60) x − 1).
`differenceLimensToPhon` (x)
  the inverse of the previous: ln (1 + x / 30) / ln (61 / 60).
beta (x, y)
besselI (n, x)
besselK (n, x)

For functions with arrays, see Scripting 5.7. Vectors and matrices.

### Links to this page

- Formulas
- What was new in 3.7?
- What was new in 3.9?