math
library
Constants
-
e
→ const double
-
Euler's number,
denoted by the symbol 'e',
is a mathematical constant approximately equal to 2.71828.
-
phi
→ const double
-
The golden ratio (symbol is the Greek letter "phi")
is a special number approximately equal to 1.618.
-
pi
→ const double
-
The number π (PI) is a mathematical constant,
approximately equal to 3.14159,
that is the ratio of a circle's circumference to its diameter.
Functions
-
exp(num x)
→ double
-
Converts
x
to a double and returns the natural exponent, e,
to the power x
.
-
ln(num x)
→ double
-
Renaming of dart's
log
function to it's more accurate mathematical
name of ln
.
-
log(num x)
→ double
-
Unlike dart's
log
function this one
converts x
to a double and returns the common logarithm
of the value.
-
log2(num x)
→ double
-
Converts
x
to a double and returns the base-2 logarithm of the value.
-
logB(num base, num x)
→ double
-
Converts
x
to a double and returns the natural logarithm of the value.
-
max<T extends num>(T a, T b)
→ T
-
Returns the larger of two numbers.
-
min<T extends num>(T a, T b)
→ T
-
Returns the lesser of two numbers.
-
nthRoot(num nth, num x)
→ double
-
Converts
x
to a double and returns the positive nth
root of the
value.
-
numberCast<T extends num>(dynamic obj)
→ T
-
Cast
obj
to a numeric type.
-
pow(num x, num exponent)
→ num
-
Returns
x
to the power of exponent
.
-
round(double value, {int decimals = 6, RoundMode mode = RoundMode.halfUp})
→ double
-
Returns the number closest to
value
.
-
sigmoidCurve(num input, {double centerX = 1, double centerY = 0.8, double zeroY = 0.02})
→ double
-
-
sqrt(num x)
→ double
-
Converts
x
to a double and returns the positive square root of the
value.
-
stepwiseGrowth(num input, {double speed = 4.0, double length = 4.0, double factor = 0.5})
→ int
-
Takes
input
and gives back an integer increment.