Implements all mathematical basics functions compatible both with clj and cljs compiler and aiming at return the same results.
Implements all mathematical basics functions compatible both with clj and cljs compiler and aiming at return the same results.
(abs-double x)
Absolute value of x
, optimized for x∊ℝ
.
Absolute value of `x`, optimized for `x∊ℝ`.
(abs-int x)
Absolute value of x
, optimized for x∊ℕ
.
Absolute value of `x`, optimized for `x∊ℕ`.
(approx= e x y)
Returns true for an approximate numerical equality.
Returns true for an approximate numerical equality.
(atan x)
Returns the arctangeant of x
, where x
as a multiple of PI
.
Returns the arctangeant of `x`, where `x` as a multiple of `PI`.
(ceil x)
Returns the ceiling of x
(the upper rounded value).
Returns the ceiling of `x` (the upper rounded value).
(clamp lower upper x)
Returns the clamped value between lower
and upper
.
Returns the clamped value between `lower` and `upper`.
(clamp-double lower upper x)
Returns the clamped value between lower
and upper
, where x∊ℝ
.
Returns the clamped value between `lower` and `upper`, where `x∊ℝ`.
(clamp-integer lower upper x)
Returns the clamped value between lower
and upper
, where (x,n)∊ℕ²
.
Returns the clamped value between `lower` and `upper`, where `(x,n)∊ℕ²`.
(cos x)
Returns the cosinus of x
, where x
is a multiple of PI
.
Returns the cosinus of `x`, where `x` is a multiple of `PI`.
(exp x)
Returns the exponential of x
, where x∊ℝ
.
Returns the exponential of `x`, where `x∊ℝ`.
(floor x)
Returns the floor of x
(the lower rounded value).
Returns the floor of `x` (the lower rounded value).
(infinite? x)
Returns true if x
is infinite.
Returns true if `x` is infinite.
(interval-affine-fn a b x1 x2 x)
Returns an affine function with coefficient a
and b
, defined in [x1; x2[
.
If
x1
if not a number (typically nil), is interprated like an interval starting at -infinitex2
if not a number (typically nil), is interprated like a non ending interval (infinite)Returns an affine function with coefficient `a` and `b`, defined in `[x1; x2[`. If * `x1` if not a number (typically nil), is interprated like an interval starting at -infinite * `x2` if not a number (typically nil), is interprated like a non ending interval (infinite)
(log x)
Returns the neperian logarithm of x
, where x∊ℝ
.
Returns the neperian logarithm of `x`, where `x∊ℝ`.
(log1p x)
Returns (ln 1+x)
the natural logarithm of 1+x
, where x∊ℝ
.
Returns `(ln 1+x)` the natural logarithm of `1+x`, where `x∊ℝ`.
(long->unit-double l)
Returns a unit float (a floating number between 0 and 1), based on the value of l
.
Returns a unit float (a floating number between 0 and 1), based on the value of `l`.
Like clojure.core/max, but transducer and nil-friendly.
Like clojure.core/max, but transducer and nil-friendly.
Like clojure.core/max,
but transducer and nil-friendly.
Like `clojure.core/max,` but transducer and nil-friendly.
Like clojure.core/max, but transducer and nil-friendly.
Like clojure.core/max, but transducer and nil-friendly.
Like clojure.core/min,
but transducer and nil-friendly.
Like `clojure.core/min,` but transducer and nil-friendly.
Like clojure.core/min,
but transducer and nil-friendly.
Like `clojure.core/min,` but transducer and nil-friendly.
Like clojure.core/min, but transducer and nil-friendly.
Like clojure.core/min, but transducer and nil-friendly.
Returns minus infinite for reals.
Returns minus infinite for reals.
Returns minus infinite for integer.
Returns minus infinite for integer.
Returns minus infinite for integer.
Returns minus infinite for integer.
Value of PI based on platform constant value
According to maths.com, the first values are: 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989
Value of PI based on platform constant value According to [maths.com](http://www.math.com/tables/constants/pi.htm), the first values are: 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989
(polynomial-value x coefficients)
Evaluates a polynomial at the given value x
, for the coefficients
given in descending order (so the last element of coefficients is the constant term).
Evaluates a polynomial at the given value `x`, for the `coefficients` given in descending order (so the last element of coefficients is the constant term).
(proportion f coll)
Calculates the proportion of inputs for which pred
returns true.
Calculates the proportion of inputs for which `pred` returns true.
(root x n)
Return the n
root of x
, where (x,n)∊ℝ²
.
Return the `n` root of `x`, where `(x,n)∊ℝ²`.
(signum x)
Returns the sign of x
for double
and float
numbers.
Returns the sign of `x` for `double` and `float` numbers.
(sin x)
Returns the sinus of x
, where x
as a multiple of PI
.
Returns the sinus of `x`, where `x` as a multiple of `PI`.
(sqrt x)
Square root of x
, where x∊[0;+∞[
.
Square root of `x`, where `x∊[0;+∞[`.
(square-double x)
Square of x
, optimized for x
as a double.
Square of `x`, optimized for `x` as a double.
(square-int x)
Square of x
, optimized for x
as an integer.
Square of `x`, optimized for `x` as an integer.
(tan x)
Returns the tangeant of x
, where x
as a multiple of PI
.
Returns the tangeant of `x`, where `x` as a multiple of `PI`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close