You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
30 KiB

<!DOCTYPE html><meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.math</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Namespace goog.math</h1><a class="source" href="source/lib/goog/math/math.js.src.html#l19">code &raquo;</a></header><section></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="static-functions"><h2>Global Functions</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l185">code &raquo;</a><span class="member"><a name="goog.math.angle">goog.math.angle</a> <span class="args">( x1, y1, x2, y2 )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Computes the angle between two points (x1,y1) and (x2,y2).
Angle zero points in the +X direction, 90 degrees points in the +Y
direction (down) and from there we grow clockwise towards 360 degrees.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>x1: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>x of first point.<dt>y1: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>y of first point.<dt>x2: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>x of second point.<dt>y2: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>y of second point.</dl><tr><th>Returns<tr><td><dl>Standardized angle in degrees of the vector from
x1,y1 to x2,y2.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l205">code &raquo;</a><span class="member"><a name="goog.math.angleDifference">goog.math.angleDifference</a> <span class="args">( startAngle, endAngle )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Computes the difference between startAngle and endAngle (angles in degrees).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>startAngle: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Start angle in degrees.<dt>endAngle: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>End angle in degrees.</dl><tr><th>Returns<tr><td><dl>The number of degrees that when added to
startAngle will result in endAngle. Positive numbers mean that the
direction is clockwise. Negative numbers indicate a counter-clockwise
direction.
The shortest route (clockwise vs counter-clockwise) between the angles
is used.
When the difference is 180 degrees, the function returns 180 (not -180)
angleDifference(30, 40) is 10, and angleDifference(40, 30) is -10.
angleDifference(350, 10) is 20, and angleDifference(10, 350) is -20.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l158">code &raquo;</a><span class="member"><a name="goog.math.angleDx">goog.math.angleDx</a> <span class="args">( degrees, radius )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>For a given angle and radius, finds the X portion of the offset.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>degrees: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in degrees (zero points in +X direction).<dt>radius: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Radius.</dl><tr><th>Returns<tr><td><dl>The x-distance for the angle and radius.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l169">code &raquo;</a><span class="member"><a name="goog.math.angleDy">goog.math.angleDy</a> <span class="args">( degrees, radius )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>For a given angle and radius, finds the Y portion of the offset.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>degrees: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in degrees (zero points in +X direction).<dt>radius: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Radius.</dl><tr><th>Returns<tr><td><dl>The y-distance for the angle and radius.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l321">code &raquo;</a><span class="member"><a name="goog.math.average">goog.math.average</a> <span class="args">( var_args )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the arithmetic mean of the arguments.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Numbers to average.</dl><tr><th>Returns<tr><td><dl>The average of the arguments (<code >NaN</code> if no arguments
were provided or any of the arguments is not a valid number).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l55">code &raquo;</a><span class="member"><a name="goog.math.clamp">goog.math.clamp</a> <span class="args">( value, min, max )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Takes a number and clamps it to within the provided bounds.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>value: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The input number.<dt>min: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The minimum value to return.<dt>max: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The maximum value to return.</dl><tr><th>Returns<tr><td><dl>The input number if it is within bounds, or the nearest
number within the bounds.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l380">code &raquo;</a><span class="member"><a name="goog.math.isFiniteNumber">goog.math.isFiniteNumber</a> <span class="args">( num )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the supplied number is finite and not NaN.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number to test.</dl><tr><th>Returns<tr><td><dl>Whether <code >num</code> is a finite number.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l370">code &raquo;</a><span class="member"><a name="goog.math.isInt">goog.math.isInt</a> <span class="args">( num )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Returns whether the supplied number represents an integer, i.e. that is has
no fractional component. No range-checking is performed on the number.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number to test.</dl><tr><th>Returns<tr><td><dl>Whether <code >num</code> is an integer.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l89">code &raquo;</a><span class="member"><a name="goog.math.lerp">goog.math.lerp</a> <span class="args">( a, b, x )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Performs linear interpolation between values a and b. Returns the value
between a and b proportional to x (when x is between 0 and 1. When x is
outside this range, the return value is a linear extrapolation).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>b: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>x: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The proportion between a and b.</dl><tr><th>Returns<tr><td><dl>The interpolated value between a and b.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l398">code &raquo;</a><span class="member"><a name="goog.math.log10Floor">goog.math.log10Floor</a> <span class="args">( num )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the precise value of floor(log10(num)).
Simpler implementations didn't work because of floating point rounding
errors. For example
<ul>
<li>Math.floor(Math.log(num) / Math.LN10) is off by one for num == 1e+3.
<li>Math.floor(Math.log(num) * Math.LOG10E) is off by one for num == 1e+15.
<li>Math.floor(Math.log10(num)) is off by one for num == 1e+15 - 1.
</ul></summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A floating point number.</dl><tr><th>Returns<tr><td><dl>Its logarithm to base 10 rounded down to the nearest
integer if num > 0. -Infinity if num == 0. NaN if num < 0.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l246">code &raquo;</a><span class="member"><a name="goog.math.longestCommonSubsequence">goog.math.longestCommonSubsequence</a> <span class="args">( array1, array2, opt_compareFn, opt_collectorFn )</span> &rArr; <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>&gt;</code></span></div><p>JavaScript implementation of Longest Common Subsequence problem.
http://en.wikipedia.org/wiki/Longest_common_subsequence
Returns the longest possible array that is subarray of both of given arrays.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>array1: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>&gt;</code><dd>First array of objects.<dt>array2: <code class="type"><a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.&lt;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>&gt;</code><dd>Second array of objects.<dt>opt_compareFn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>=</code><dd>Function that acts as a custom comparator
for the array ojects. Function should return true if objects are equal,
otherwise false.<dt>opt_collectorFn: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function">Function</a>=</code><dd>Function used to decide what to return
as a result subsequence. It accepts 2 arguments: index of common element
in the first array and index in the second. The default function returns
element from the first array.</dl><tr><th>Returns<tr><td><dl>A list of objects that are common to both arrays
such that there is no common subsequence with size greater than the
length of the list.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l73">code &raquo;</a><span class="member"><a name="goog.math.modulo">goog.math.modulo</a> <span class="args">( a, b )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>The % operator in JavaScript returns the remainder of a / b, but differs from
some other languages in that the result will have the same sign as the
dividend. For example, -1 % 8 == -1, whereas in some other languages
(such as Python) the result would be 7. This function emulates the more
correct modulo behavior, which is useful for certain applications such as
calculating an offset index in a circular list.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The dividend.<dt>b: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The divisor.</dl><tr><th>Returns<tr><td><dl>a % b where the result is between 0 and b (either 0 <= x < b
or b < x <= 0, depending on the sign of b).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l103">code &raquo;</a><span class="member"><a name="goog.math.nearlyEquals">goog.math.nearlyEquals</a> <span class="args">( a, b, opt_tolerance )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether the two values are equal to each other, within a certain
tolerance to adjust for floating point errors.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>b: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>opt_tolerance: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>Optional tolerance range. Defaults
to 0.000001. If specified, should be greater than 0.</dl><tr><th>Returns<tr><td><dl>Whether <code >a</code> and <code >b</code> are nearly equal.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l30">code &raquo;</a><span class="member"><a name="goog.math.randomInt">goog.math.randomInt</a> <span class="args">( a )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns a random integer greater than or equal to 0 and less than <code >a</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The upper bound for the random integer (exclusive).</dl><tr><th>Returns<tr><td><dl>A random integer N such that 0 <= N < a.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l432">code &raquo;</a><span class="member"><a name="goog.math.safeCeil">goog.math.safeCeil</a> <span class="args">( num, opt_epsilon )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>A tweaked variant of <code >Math.ceil</code>. See <code >goog.math.safeFloor</code> for
details.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>opt_epsilon: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>An infinitesimally small positive number, the
rounding error to tolerate.</dl><tr><th>Returns<tr><td><dl>The smallest integer greater than or equal to <code >num</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l418">code &raquo;</a><span class="member"><a name="goog.math.safeFloor">goog.math.safeFloor</a> <span class="args">( num, opt_epsilon )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>A tweaked variant of <code >Math.floor</code> which tolerates if the passed number
is infinitesimally smaller than the closest integer. It often happens with
the results of floating point calculations because of the finite precision
of the intermediate results. For example <code >Math.floor(Math.log(1000) /
Math.LN10) == 2</code>, not 3 as one would expect.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>num: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>A number.<dt>opt_epsilon: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a>=</code><dd>An infinitesimally small positive number, the
rounding error to tolerate.</dl><tr><th>Returns<tr><td><dl>The largest integer less than or equal to <code >num</code>.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l334">code &raquo;</a><span class="member"><a name="goog.math.sampleVariance">goog.math.sampleVariance</a> <span class="args">( var_args )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the unbiased sample variance of the arguments. For a definition,
see e.g. http://en.wikipedia.org/wiki/Variance</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Number samples to analyze.</dl><tr><th>Returns<tr><td><dl>The unbiased sample variance of the arguments (0 if fewer
than two samples were provided, or <code >NaN</code> if any of the samples is
not a valid number).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l222">code &raquo;</a><span class="member"><a name="goog.math.sign">goog.math.sign</a> <span class="args">( x )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the sign of a number as per the "sign" or "signum" function.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>x: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The number to take the sign of.</dl><tr><th>Returns<tr><td><dl>-1 when negative, 1 when positive, 0 when 0.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l116">code &raquo;</a><span class="member"><a name="goog.math.standardAngle">goog.math.standardAngle</a> <span class="args">( angle )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Normalizes an angle to be in range [0-360). Angles outside this range will
be normalized to be the equivalent angle with that range.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>angle: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in degrees.</dl><tr><th>Returns<tr><td><dl>Standardized angle.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l127">code &raquo;</a><span class="member"><a name="goog.math.standardAngleInRadians">goog.math.standardAngleInRadians</a> <span class="args">( angle )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Normalizes an angle to be in range [0-2*PI). Angles outside this range will
be normalized to be the equivalent angle with that range.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>angle: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in radians.</dl><tr><th>Returns<tr><td><dl>Standardized angle.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l359">code &raquo;</a><span class="member"><a name="goog.math.standardDeviation">goog.math.standardDeviation</a> <span class="args">( var_args )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the sample standard deviation of the arguments. For a definition of
sample standard deviation, see e.g.
http://en.wikipedia.org/wiki/Standard_deviation</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Number samples to analyze.</dl><tr><th>Returns<tr><td><dl>The sample standard deviation of the arguments (0 if fewer
than two samples were provided, or <code >NaN</code> if any of the samples is
not a valid number).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l307">code &raquo;</a><span class="member"><a name="goog.math.sum">goog.math.sum</a> <span class="args">( var_args )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns the sum of the arguments.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>var_args: <code class="type">...<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Numbers to add.</dl><tr><th>Returns<tr><td><dl>The sum of the arguments (0 if no arguments were provided,
<code >NaN</code> if any of the arguments is not a valid number).</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l147">code &raquo;</a><span class="member"><a name="goog.math.toDegrees">goog.math.toDegrees</a> <span class="args">( angleRadians )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Converts radians to degrees.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>angleRadians: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in radians.</dl><tr><th>Returns<tr><td><dl>Angle in degrees.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l137">code &raquo;</a><span class="member"><a name="goog.math.toRadians">goog.math.toRadians</a> <span class="args">( angleDegrees )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Converts degrees to radians.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>angleDegrees: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>Angle in degrees.</dl><tr><th>Returns<tr><td><dl>Angle in radians.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/math/math.js.src.html#l42">code &raquo;</a><span class="member"><a name="goog.math.uniformRandom">goog.math.uniformRandom</a> <span class="args">( a, b )</span> &rArr; <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div><p>Returns a random number greater than or equal to <code >a</code> and less than
<code >b</code>.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>a: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The lower bound for the random number (inclusive).<dt>b: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code><dd>The upper bound for the random number (exclusive).</dl><tr><th>Returns<tr><td><dl>A random number N such that a <= N < b.</dl></table></div></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>No data</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>No data</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>No data</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>