| 1 |
<html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 |
<title>Formulas 5. Mathematical functions</title> |
| 3 |
<style> |
| 4 |
td { padding-left: 5pt; padding-right: 5pt; } |
| 5 |
th { padding-left: 5pt; padding-right: 5pt; } |
| 6 |
code { white-space: pre-wrap; } |
| 7 |
dd { white-space: pre-wrap; } |
| 8 |
</style> |
| 9 |
</head><body bgcolor="#FFFFFF"> |
| 10 |
|
| 11 |
<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Palatino,Times" size=6 color="#999900"><b> |
| 12 |
Formulas 5. Mathematical functions |
| 13 |
</b></font></table></table> |
| 14 |
<dl> |
| 15 |
<dt><b>abs (<i>x</i>)</b> |
| 16 |
<dd>absolute value</dd> |
| 17 |
<dt><b>round (<i>x</i>)</b> |
| 18 |
<dd>nearest integer; round (1.5) = 2</dd> |
| 19 |
<dt><b>floor (<i>x</i>)</b> |
| 20 |
<dd>round down: highest integer value not greater than <i>x</i></dd> |
| 21 |
<dt><b>ceiling (<i>x</i>)</b> |
| 22 |
<dd>round up: lowest integer value not less than <i>x</i></dd> |
| 23 |
<dt><b>sqrt (<i>x</i>)</b> |
| 24 |
<dd>square root: √<i>x</i>, <i>x</i> ≥ 0</dd> |
| 25 |
<dt><b>min (<i>x</i>, ...)</b> |
| 26 |
<dd>the minimum of a series of numbers, e.g. min (7.2, -5, 3) = -5</dd> |
| 27 |
<dt><b>max (<i>x</i>, ...)</b> |
| 28 |
<dd>the maximum of a series of numbers, e.g. max (7.2, -5, 3) = 7.2</dd> |
| 29 |
<dt><b>imin (<i>x</i>, ...)</b> |
| 30 |
<dd>the location of the minimum, e.g. imin (7.2, -5, 3) = 2</dd> |
| 31 |
<dt><b>imax (<i>x</i>, ...)</b> |
| 32 |
<dd>the location of the maximum, e.g. imax (7.2, -5, 3) = 1</dd> |
| 33 |
<dt><b>sin (<i>x</i>)</b> |
| 34 |
<dd>sine</dd> |
| 35 |
<dt><b>cos (<i>x</i>)</b> |
| 36 |
<dd>cosine</dd> |
| 37 |
<dt><b>tan (<i>x</i>)</b> |
| 38 |
<dd>tangent</dd> |
| 39 |
<dt><b>arcsin (<i>x</i>)</b> |
| 40 |
<dd>arcsine, -1 ≤ <i>x</i> ≤ 1</dd> |
| 41 |
<dt><b>arccos (<i>x</i>)</b> |
| 42 |
<dd>arccosine, -1 ≤ <i>x</i> ≤ 1</dd> |
| 43 |
<dt><b>arctan (<i>x</i>)</b> |
| 44 |
<dd>arctangent</dd> |
| 45 |
<dt><b>arctan2 (<i>y</i>, <i>x</i>)</b> |
| 46 |
<dd>argument angle</dd> |
| 47 |
<dt><b>sinc (<i>x</i>)</b> |
| 48 |
<dd>sinus cardinalis: sin (<i>x</i>) / <i>x</i></dd> |
| 49 |
<dt><b>sincpi (<i>x</i>)</b> |
| 50 |
<dd>sinc<sub><i>π</i></sub>: sin (<i>π</i><i>x</i>) / (<i>π</i><i>x</i>)</dd> |
| 51 |
<dt><b>exp (<i>x</i>)</b> |
| 52 |
<dd>exponentiation: <i>e</i><sup><i>x</i></sup>; same as <b>e^<i>x</i></b></dd> |
| 53 |
<dt><b>ln (<i>x</i>)</b> |
| 54 |
<dd>natural logarithm, base <i>e</i></dd> |
| 55 |
<dt><b>log10 (<i>x</i>)</b> |
| 56 |
<dd>logarithm, base 10</dd> |
| 57 |
<dt><b>log2 (<i>x</i>)</b> |
| 58 |
<dd>logarithm, base 2</dd> |
| 59 |
<dt><b>sinh (<i>x</i>)</b> |
| 60 |
<dd>hyperbolic sine: (<i>e</i><sup><i>x</i></sup> - <i>e</i><sup>-<i>x</i></sup>) / 2</dd> |
| 61 |
<dt><b>cosh (<i>x</i>)</b> |
| 62 |
<dd>hyperbolic cosine: (<i>e</i><sup><i>x</i></sup> + <i>e</i><sup>-<i>x</i></sup>) / 2</dd> |
| 63 |
<dt><b>tanh (<i>x</i>)</b> |
| 64 |
<dd>hyperbolic tangent: sinh (<i>x</i>) / cosh (<i>x</i>)</dd> |
| 65 |
<dt><b>arcsinh (<i>x</i>)</b> |
| 66 |
<dd>inverse hyperbolic sine: ln (<i>x</i> + √(1+<i>x</i><sup>2</sup>))</dd> |
| 67 |
<dt><b>arccosh (<i>x</i>)</b> |
| 68 |
<dd>inverse hyperbolic cosine: ln (<i>x</i> + √(<i>x</i><sup>2</sup>−1))</dd> |
| 69 |
<dt><b>arctanh (<i>x</i>)</b> |
| 70 |
<dd>inverse hyperbolic tangent</dd> |
| 71 |
<dt><b>sigmoid (<i>x</i>)</b> |
| 72 |
<dd><b>R</b> → (0,1): 1 / (1 + <i>e</i><sup>−<i>x</i></sup>) or 1 − 1 / (1 + <i>e</i><sup><i>x</i></sup>)</dd> |
| 73 |
<dt><b>invSigmoid (<i>x</i>)</b> |
| 74 |
<dd>(0,1) → <b>R</b>: ln (<i>x</i> / (1 − <i>x</i>))</dd> |
| 75 |
<dt><b>erf (<i>x</i>)</b> |
| 76 |
<dd>the error function: 2/√<i>π</i> <sub>0</sub>∫<sup><i>x</i></sup> exp(-<i>t</i><sup>2</sup>) <i>dt</i></dd> |
| 77 |
<dt><b>erfc (<i>x</i>)</b> |
| 78 |
<dd>the complement of the error function: 1 - erf (<i>x</i>)</dd> |
| 79 |
<dt><b>randomUniform (<i>min</i>, <i>max</i>)</b> |
| 80 |
<dd>a uniform random real number between <i>min</i> (inclusive) and <i>max</i> (exclusive)</dd> |
| 81 |
<dt><b>randomInteger (<i>min</i>, <i>max</i>)</b> |
| 82 |
<dd>a uniform random integer number between <i>min</i> and <i>max</i> (inclusive)</dd> |
| 83 |
<dt><b>randomGauss (<i>μ</i>, <i>σ</i>)</b> |
| 84 |
<dd>a Gaussian random real number with mean <i>μ</i> and standard deviation <i>σ</i></dd> |
| 85 |
<dt><b>randomPoisson (<i>mean</i>)</b> |
| 86 |
<dd>a Poisson random real number</dd> |
| 87 |
<dt><b>randomGamma (<i>shape</i>, <i>rate</i>)</b> |
| 88 |
<dd>a random number drawn from a Gamma distribution with shape parameter <i>α</i> and rate parameter <i>β</i>, which is defined as <i>f</i>(<i>x</i>; <i>α</i>, <i>β</i>) = (1 / Γ (<i>α</i>)) <i>β</i><i></i><sup><i>α</i></sup> <i>x</i><sup><i>α</i>−1</sup> <i>e</i><sup>−<i>β</i> <i>x</i></sup>, for <i>x</i> > 0, <i>α</i> > 0 and <i>β</i> > 0, following the method by <a href="Marsaglia___Tsang__2000_.html">Marsaglia & Tsang (2000)</a></dd> |
| 89 |
<dt><b>random_initializeWithSeedUnsafelyButPredictably (<i>seed</i>)</b> |
| 90 |
<dd>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)</dd> |
| 91 |
<dt><b>random_initializeSafelyAndUnpredictably ()</b> |
| 92 |
<dd>undoes the exceptional situation caused by the previous function</dd> |
| 93 |
<dt><b>lnGamma (<i>x</i>)</b> |
| 94 |
<dd>logarithm of the Γ function</dd> |
| 95 |
<dt><b>gaussP (<i>z</i>)</b> |
| 96 |
<dd>the area under the Gaussian distribution between −∞ and <i>z</i></dd> |
| 97 |
<dt><b>gaussQ (<i>z</i>)</b> |
| 98 |
<dd>the area under the Gaussian distribution between <i>z</i> and +∞: the one-tailed "statistical significance <i>p</i>" of a value that is <i>z</i> standard deviations away from the mean of a Gaussian distribution</dd> |
| 99 |
<dt><b>invGaussQ (<i>q</i>)</b> |
| 100 |
<dd>the value of <i>z</i> for which <code><font size=+1>gaussQ</font></code> (<i>z</i>) = <i>q</i></dd> |
| 101 |
<dt><b>chiSquareP (<i><code><font size=+1>chiSquare</font></code></i>, <i><code><font size=+1>df</font></code></i>)</b> |
| 102 |
<dd>the area under the <i>χ</i><sup>2</sup> distribution between 0 and <i>chiSquare</i>, for <i><code><font size=+1>df</font></code></i> degrees of freedom</dd> |
| 103 |
<dt><b>chiSquareQ (<i><code><font size=+1>chiSquare</font></code></i>, <i><code><font size=+1>df</font></code></i>)</b> |
| 104 |
<dd>the area under the <i>χ</i><sup>2</sup> distribution between <i><code><font size=+1>chiSquare</font></code></i> and +∞, for <i>df</i> degrees of freedom: the "statistical significance <i>p</i>" of the <i>χ</i><sup>2</sup> difference between two distributions in <i>df</i>+1 dimensions</dd> |
| 105 |
<dt><b>invChiSquareQ (<i>q</i>, <i>df</i>)</b> |
| 106 |
<dd>the value of <i>χ</i><sup>2</sup> for which <code><font size=+1>chiSquareQ</font></code> (<i>χ</i><sup>2</sup>, <i>df</i>) = <i>q</i></dd> |
| 107 |
<dt><b>studentP (<i>t</i>, <i>df</i>)</b> |
| 108 |
<dd>the area under the student T-distribution from -∞ to <i>t</i></dd> |
| 109 |
<dt><b>studentQ (<i>t</i>, <i>df</i>)</b> |
| 110 |
<dd>the area under the student T-distribution from <i>t</i> to +∞</dd> |
| 111 |
<dt><b>invStudentQ (<i>q</i>, <i>df</i>)</b> |
| 112 |
<dd>the value of <i>t</i> for which <code><font size=+1>studentQ</font></code> (<i>t</i>, <i>df</i>) = <i>q</i></dd> |
| 113 |
<dt><b>fisherP (<i>f</i>, <i>df1</i>, <i>df2</i>)</b> |
| 114 |
<dd>the area under Fisher's F-distribution from 0 to <i>f</i></dd> |
| 115 |
<dt><b>fisherQ (<i>f</i>, <i>df1</i>, <i>df2</i>)</b> |
| 116 |
<dd>the area under Fisher's F-distribution from <i>f</i> to +∞</dd> |
| 117 |
<dt><b>invFisherQ (<i>q</i>, <i>df1</i>, <i>df2</i>)</b> |
| 118 |
<dd>the value of <i>f</i> for which <code><font size=+1>fisherQ</font></code> (<i>f</i>, <i>df1</i>, <i>df2</i>) = <i>q</i></dd> |
| 119 |
<dt><b>binomialP (<i>p</i>, <i>k</i>, <i>n</i>)</b> |
| 120 |
<dd>the probability that in <i>n</i> experiments, an event with probability <i>p</i> will occur at most <i>k</i> times</dd> |
| 121 |
<dt><a href="_binomialQ_.html"><b><code><font size=+1>binomialQ</font></code></b></a> (<i>p</i>, <i>k</i>, <i>n</i>) |
| 122 |
<dd>the probability that in <i>n</i> experiments, an event with probability <i>p</i> will occur at least <i>k</i> times; equals 1 - <code><font size=+1>binomialP</font></code> (<i>p</i>, <i>k</i> - 1, <i>n</i>)</dd> |
| 123 |
<dt><b>invBinomialP (<i>P</i>, <i>k</i>, <i>n</i>)</b> |
| 124 |
<dd>the value of <i>p</i> for which <code><font size=+1>binomialP</font></code> (<i>p</i>, <i>k</i>, <i>n</i>) = <i>P</i></dd> |
| 125 |
<dt><a href="_invBinomialQ_.html"><b><code><font size=+1>invBinomialQ</font></code></b></a> (<i>Q</i>, <i>k</i>, <i>n</i>) |
| 126 |
<dd>the value of <i>p</i> for which <code><font size=+1>binomialQ</font></code> (<i>p</i>, <i>k</i>, <i>n</i>) = <i>Q</i></dd> |
| 127 |
<dt><b>hertzToBark (<i>x</i>)</b> |
| 128 |
<dd>from acoustic frequency to Bark-rate (perceptual spectral frequency; place on basilar membrane): 7 ln (<i>x</i>/650 + √(1 + (<i>x</i>/650)<sup>2</sup>))</dd> |
| 129 |
<dt><b>barkToHertz (<i>x</i>)</b> |
| 130 |
<dd>650 sinh (<i>x</i> / 7)</dd> |
| 131 |
<dt><b>hertzToMel (<i>x</i>)</b> |
| 132 |
<dd>from acoustic frequency to perceptual pitch: 550 ln (1 + <i>x</i> / 550)</dd> |
| 133 |
<dt><b>melToHertz (<i>x</i>)</b> |
| 134 |
<dd>550 (exp (<i>x</i> / 550) - 1)</dd> |
| 135 |
<dt><b>hertzToSemitones (<i>x</i>)</b> |
| 136 |
<dd>from acoustic frequency to a logarithmic musical scale, relative to 100 Hz: 12 ln (<i>x</i> / 100) / ln 2</dd> |
| 137 |
<dt><b>semitonesToHertz (<i>x</i>)</b> |
| 138 |
<dd>100 exp (<i>x</i> ln 2 / 12)</dd> |
| 139 |
<dt><b>erb (<i>f</i>)</b> |
| 140 |
<dd>the perceptual <i>equivalent rectangular bandwidth</i> (ERB) in hertz, for a specified acoustic frequency (also in hertz): 6.23·10<sup>-6</sup> <i>f</i><sup>2</sup> + 0.09339 <i>f</i> + 28.52</dd> |
| 141 |
<dt><b>hertzToErb (<i>x</i>)</b> |
| 142 |
<dd>from acoustic frequency to ERB-rate: 11.17 ln ((<i>x</i> + 312) / (<i>x</i> + 14680)) + 43</dd> |
| 143 |
<dt><b>erbToHertz (<i>x</i>)</b> |
| 144 |
<dd>(14680 <i>d</i> - 312) / (1 - <i>d</i>) where <i>d</i> = exp ((<i>x</i> - 43) / 11.17)</dd> |
| 145 |
<dt><a href="_phonToDifferenceLimens_.html"><b><code><font size=+1>phonToDifferenceLimens</font></code></b></a> (<i>x</i>) |
| 146 |
<dd>from perceptual loudness (intensity sensation) level in phon, to the number of intensity difference limens above threshold: 30 · ((61/60)<sup> <i>x</i></sup> − 1).</dd> |
| 147 |
<dt><a href="_differenceLimensToPhon_.html"><b><code><font size=+1>differenceLimensToPhon</font></code></b></a> (<i>x</i>) |
| 148 |
<dd>the inverse of the previous: ln (1 + <i>x</i> / 30) / ln (61 / 60).</dd> |
| 149 |
<dt><b>beta (<i>x</i>, <i>y</i>)</b> |
| 150 |
<dt><b>besselI (<i>n</i>, <i>x</i>)</b> |
| 151 |
<dt><b>besselK (<i>n</i>, <i>x</i>)</b> |
| 152 |
</dl> |
| 153 |
<p>For functions with arrays, see <a href="Scripting_5_7__Vectors_and_matrices.html">Scripting 5.7. Vectors and matrices</a>.</p> |
| 154 |
<h3>Links to this page</h3> |
| 155 |
<ul> |
| 156 |
<li><a href="Formulas.html">Formulas</a> |
| 157 |
<li><a href="What_was_new_in_3_7_.html">What was new in 3.7?</a> |
| 158 |
<li><a href="What_was_new_in_3_9_.html">What was new in 3.9?</a> |
| 159 |
</ul> |
| 160 |
<hr> |
| 161 |
<address> |
| 162 |
<p>© ppgb 20200801</p> |
| 163 |
</address> |
| 164 |
</body> |
| 165 |
</html> |