math

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

Mathematical tools.

License:
  • Apache-2.0
Source:

Methods

(inner) add(a, b)

Add two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a+b

(inner) average(arr) → {Number}

Compute mathematical average of array of numbers.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) clamp(low, high, n) → {Number}

Fit n in a [low, high] range (inclusive of low and high).

Source:
Parameters:
Name Type Description
low Number
high Nunmer
n Number
Returns:
Type:
Number

(inner) dec(n)

Decrement given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n-1

(inner) degrees(radians) → {Number}

Convert radians to degrees.

Source:
Parameters:
Name Type Description
radians Number
Returns:
Type:
Number

(inner) div(a, b)

Divide first value by the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a/b

(inner) inc(n)

Increment given value by one.

Source:
Parameters:
Name Type Description
n
Returns:

n+1

(inner) interpolate(low, high, val) → {Number}

Linear interpolation.

Source:
Parameters:
Name Type Description
low Number

lower output bound

high Number

higher output bound

val Number

value in range [0,1] (extrapolation done beyond that range)

Returns:
Type:
Number

(inner) inv(n)

Invert a given value.

Source:
Parameters:
Name Type Description
n
Returns:

1/n

(inner) log10(x)

Base 10 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log10(x)

(inner) log2(x)

Base 2 logarithm.

Source:
Parameters:
Name Type Description
x
Returns:

log2(x)

(inner) mod(a, b)

Modulo - reversed arguments for curried version usage convenience.

mod(a, b) === mod(a) (b) === b `mod` a
let mod10 = mod(10);
mod10(-3) === 7
Source:
Parameters:
Name Type Description
a
b
Returns:

b mod a

(inner) mul(a, b)

Multiply two values.

Source:
Parameters:
Name Type Description
a
b
Returns:

a*b

(inner) neg(n)

Negate a given value.

Source:
Parameters:
Name Type Description
n
Returns:

-n

(inner) pow(a, b)

Raise one value to the power of the second value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a**b

(inner) product(arr) → {Number}

Compute product of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number

(inner) radians(degrees) → {Number}

Convert degrees to radians.

Source:
Parameters:
Name Type Description
degrees Number
Returns:
Type:
Number

(inner) randomInt() → {Number}

Generate a random positive integer. NOT CRYPTOGRAPHICALLY SECURE.

Source:
Returns:
Type:
Number

(inner) remainder(a, b)

Remainder - % operator - reversed arguments. See mod.

Source:
Parameters:
Name Type Description
a
b
Returns:

b%a

(inner) roundIfClose(x, precisionopt)

Round to the nearest integer if the given value is within epsilon range of that integer. Default epsilon is 1e-9, which can be changed through precision parameter.

Source:
Parameters:
Name Type Attributes Default Description
x
precision <optional>
9
Returns:

rounded number

(inner) sub(a, b)

Subtract second value from the first value.

Source:
Parameters:
Name Type Description
a
b
Returns:

a-b

(inner) sum(arr) → {Number}

Compute sum of numbers in a passed array.

Source:
Parameters:
Name Type Description
arr Array.<Number>
Returns:
Type:
Number