Liking cljdoc? Tell your friends :D
Clojure only.

fastmath.core

Collection of fast math functions and plethora of constants known from other math libraries.

Primitive math operators

Based on Primitive Math by Zach Tellman several operators are introduced and replace clojure.core functions. All operators are macros and can't be used as functions. List includes:

Known from Clojure: * + - / > < >= <= == rem quot mod bit-or bit-and bit-xor bit-not bit-shift-left bit-shift-right unsigned-bit-shift-right inc dec zero? neg? pos? min max even? odd? abs

And additionally:

  • bool-and - and working on booleans
  • bool-or - boolean or
  • bool-xor - boolean xor
  • bool-not - boolean not
  • << - bit shift left
  • >> - signed bit shift right
  • >>> - unsigned bit shift right
  • not== - not equal

Warning: All bool- evaluate all parameters.

To turn on primitive math on your namespace call use-primitive-operators. To turn off and revert original versions call unuse-primitive-operators

Fast Math

Almost all math functions are backed by FastMath library. Most of them are macros. Some of them are wrapped in Clojure functions. Almost all operates on primitive double and returns double (with an exception round or qround which returns long).

Other functions

Additionally namespace contains functions which are common in frameworks like OpenFrameworks and Processing.

Collection of fast math functions and plethora of constants known from other math libraries.

### Primitive math operators

Based on [Primitive Math by Zach Tellman](https://github.com/ztellman/primitive-math) several operators are introduced and replace `clojure.core` functions. All operators are macros and can't be used as functions. List includes:

Known from Clojure: `*` `+` `-` `/` `>` `<` `>=` `<=` `==` `rem` `quot` `mod` `bit-or` `bit-and` `bit-xor` `bit-not` `bit-shift-left` `bit-shift-right` `unsigned-bit-shift-right` `inc` `dec` `zero?` `neg?` `pos?` `min` `max` `even?` `odd?` `abs`

And additionally:

* `bool-and` - `and` working on booleans
* `bool-or` - boolean `or`
* `bool-xor` - boolean `xor`
* `bool-not` - boolean `not`
* `<<` - bit shift left
* `>>` - signed bit shift right
* `>>>` - unsigned bit shift right
* `not==` - not equal

Warning: All `bool-` evaluate all parameters.

To turn on primitive math on your namespace call [[use-primitive-operators]].
To turn off and revert original versions call [[unuse-primitive-operators]]

### Fast Math

Almost all math functions are backed by [FastMath](https://github.com/jeffhain/jafama) library. Most of them are macros. Some of them are wrapped in Clojure functions. Almost all operates on primitive `double` and returns `double` (with an exception [[round]] or [[qround]] which returns `long`).

### Other functions

Additionally namespace contains functions which are common in frameworks like OpenFrameworks and Processing.
raw docstring

*cljmacro

(* x)
(* x y)
(* x y & rest)

A primitive math version of *

A primitive math version of `*`
sourceraw docstring

+cljmacro

(+ x)
(+ x y)
(+ x y & rest)

A primitive math version of +

A primitive math version of `+`
sourceraw docstring

-cljmacro

(- x)
(- x y)
(- x y & rest)

A primitive math version of -

A primitive math version of `-`
sourceraw docstring

-Eclj

Value of \(e\)

Value of \\(e\\)
sourceraw docstring

-HALF_PIclj

Value of \(-\frac{\pi}{2}\)

Value of \\(-\frac{\pi}{2}\\)
sourceraw docstring

-PIclj

Value of \(-pi\)

Value of \\(\-pi\\)
sourceraw docstring

-QUARTER_PIclj

Value of \(-\frac{\pi}{4}\)

Value of \\(-\frac{\pi}{4}\\)
sourceraw docstring

-TAUclj

Alias for [[TWO_PI-]]

Alias for [[TWO_PI-]]
sourceraw docstring

-THIRD_PIclj

Value of \(-\frac{\pi}{3}\)

Value of \\(-\frac{\pi}{3}\\)
sourceraw docstring

-TWO_PIclj

Value of \(-2 {\pi}\)

Value of \\(-2 {\pi}\\)
sourceraw docstring

/cljmacro

(/ x)
(/ x y)
(/ x y & rest)

A primitive math version of /

A primitive math version of `/`
sourceraw docstring

<cljmacro

(< x)
(< x y)
(< x y & rest)

A primitive math version of <

A primitive math version of `<`
sourceraw docstring

<<cljmacro

(<< x y)

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.
sourceraw docstring

<=cljmacro

(<= x)
(<= x y)
(<= x y & rest)

A primitive math version of <=

A primitive math version of `<=`
sourceraw docstring

==cljmacro

(== x)
(== x y)
(== x y & rest)

Equality. See also eq for function version.

Equality. See also [[eq]] for function version.
sourceraw docstring

>cljmacro

(> x)
(> x y)
(> x y & rest)

A primitive math version of >

A primitive math version of `>`
sourceraw docstring

>=cljmacro

(>= x)
(>= x y)
(>= x y & rest)

A primitive math version of >=

A primitive math version of `>=`
sourceraw docstring

>>cljmacro

(>> x y)

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.
sourceraw docstring

>>>cljmacro

(>>> x y)

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.
sourceraw docstring

absclj

(abs x)

\(|x|\) - double version. See iabs.

\\(|x|\\) - `double` version. See [[iabs]].
sourceraw docstring

acoscljmacro

(acos x)

net.jafama.FastMath/acos function wrapped in macro.

net.jafama.FastMath/acos function wrapped in macro.
sourceraw docstring

acoshcljmacro

(acosh x)

net.jafama.FastMath/acosh function wrapped in macro.

net.jafama.FastMath/acosh function wrapped in macro.
sourceraw docstring

acotclj

(acot v)

Arccotangent

Arccotangent
sourceraw docstring

acothclj

(acoth v)

Area hyperbolic cotangent

Area hyperbolic cotangent
sourceraw docstring

acscclj

(acsc v)

Arccosecant

Arccosecant
sourceraw docstring

acschclj

(acsch v)

Area hyperbolic cosecant

Area hyperbolic cosecant
sourceraw docstring

approxclj

(approx v)
(approx v digits)

Round v to specified (default: 2) decimal places. Be aware of double number accuracy.

Round `v` to specified (default: 2) decimal places. Be aware of `double` number accuracy.
sourceraw docstring

approx-eqclj

(approx-eq a b)
(approx-eq a b digits)

Checks equality approximately. See approx.

Checks equality approximately. See [[approx]].
sourceraw docstring

approx=clj

Alias for approx-eq

Alias for [[approx-eq]]
sourceraw docstring

asecclj

(asec v)

Arcsecant

Arcsecant
sourceraw docstring

asechclj

(asech v)

Area hyperbolic secant

Area hyperbolic secant
sourceraw docstring

asincljmacro

(asin x)

net.jafama.FastMath/asin function wrapped in macro.

net.jafama.FastMath/asin function wrapped in macro.
sourceraw docstring

asinhcljmacro

(asinh x)

net.jafama.FastMath/asinh function wrapped in macro.

net.jafama.FastMath/asinh function wrapped in macro.
sourceraw docstring

atancljmacro

(atan x)

net.jafama.FastMath/atan function wrapped in macro.

net.jafama.FastMath/atan function wrapped in macro.
sourceraw docstring

atan2cljmacro

(atan2 x y)

net.jafama.FastMath/atan2 function wrapped in macro.

net.jafama.FastMath/atan2 function wrapped in macro.
sourceraw docstring

atanhcljmacro

(atanh x)

net.jafama.FastMath/atanh function wrapped in macro.

net.jafama.FastMath/atanh function wrapped in macro.
sourceraw docstring

bessel-jcljmacro

(bessel-j x y)

Bessel J function value for given order and argument.

Bessel J function value for given order and argument.
sourceraw docstring

between-?clj

(between-? [x y] v)
(between-? x y v)

Check if given number is within the range (x,y].

Check if given number is within the range (x,y].
sourceraw docstring

between?clj

(between? [x y] v)
(between? x y v)

Check if given number is within the range [x,y].

Check if given number is within the range [x,y].
sourceraw docstring

bit-andcljmacro

(bit-and x)
(bit-and x y)
(bit-and x y & rest)

A primitive math version of bit-and

A primitive math version of `bit-and`
sourceraw docstring

bit-notcljmacro

(bit-not x)

fastmath.java.PrimitiveMath/bitNot function wrapped in macro.

fastmath.java.PrimitiveMath/bitNot function wrapped in macro.
sourceraw docstring

bit-orcljmacro

(bit-or x)
(bit-or x y)
(bit-or x y & rest)

A primitive math version of bit-or

A primitive math version of `bit-or`
sourceraw docstring

bit-shift-leftcljmacro

(bit-shift-left x y)

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.

fastmath.java.PrimitiveMath/shiftLeft function wrapped in macro.
sourceraw docstring

bit-shift-rightcljmacro

(bit-shift-right x y)

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/shiftRight function wrapped in macro.
sourceraw docstring

bit-xorcljmacro

(bit-xor x)
(bit-xor x y)
(bit-xor x y & rest)

A primitive math version of bit-xor

A primitive math version of `bit-xor`
sourceraw docstring

bool-andcljmacrodeprecated

(bool-and x)
(bool-and x y)
(bool-and x y & rest)

A primitive math version of bool-and

A primitive math version of `bool-and`
sourceraw docstring

bool-notcljmacro

(bool-not x)

fastmath.java.PrimitiveMath/not function wrapped in macro.

fastmath.java.PrimitiveMath/not function wrapped in macro.
sourceraw docstring

bool-orcljmacrodeprecated

(bool-or x)
(bool-or x y)
(bool-or x y & rest)

A primitive math version of bool-or

A primitive math version of `bool-or`
sourceraw docstring

bool-xorcljmacrodeprecated

(bool-xor x)
(bool-xor x y)
(bool-xor x y & rest)

A primitive math version of bool-xor

A primitive math version of `bool-xor`
sourceraw docstring

cbclj

(cb x)

\(x^3\)

\\(x^3\\)
sourceraw docstring

cbrtcljmacro

(cbrt x)

\(\sqrt[3]{x}\)

\\(\sqrt[3]{x}\\)
sourceraw docstring

ceilclj

(ceil x)
(ceil x scale)

\(\lceil x \rceil\). See: qceil.

Rounding is done to a multiply of scale value (when provided).

\\(\lceil x \rceil\\). See: [[qceil]].

Rounding is done to a multiply of scale value (when provided).
sourceraw docstring

Ciclj

(Ci x)

Integral of cos(t)/t from -x to inf

Integral of cos(t)/t from -x to inf
sourceraw docstring

cnormclj

(cnorm v start stop)
(cnorm v start1 stop1 start2 stop2)

Constrained version of norm. Result of norm is applied to constrain to [0,1] or [start2,stop2] ranges.

Constrained version of norm. Result of [[norm]] is applied to [[constrain]] to `[0,1]` or `[start2,stop2]` ranges.
sourceraw docstring

co-intervalsclj

(co-intervals data)
(co-intervals data number)
(co-intervals data number overlap)

Divide sequence to overlaping intervals containing similar number of values. Same as R's co.intervals()

Divide sequence to overlaping intervals containing similar number of values. Same as R's `co.intervals()`
sourceraw docstring

constraincljmacro

(constrain value mn mx)

Clamp value to the range [mn,mx].

Clamp `value` to the range `[mn,mx]`.
sourceraw docstring

copy-signcljmacro

(copy-sign x y)

Returns a value with a magnitude of first arguemnt and sign of second.

Returns a value with a magnitude of first arguemnt and sign of second.
sourceraw docstring

coscljmacro

(cos x)

net.jafama.FastMath/cos function wrapped in macro.

net.jafama.FastMath/cos function wrapped in macro.
sourceraw docstring

cos-interpolationclj

(cos-interpolation start stop t)

oF interpolateCosine interpolation. See also lerp/mlerp, quad-interpolation or smooth-interpolation.

oF interpolateCosine interpolation. See also [[lerp]]/[[mlerp]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

coshcljmacro

(cosh x)

net.jafama.FastMath/cosh function wrapped in macro.

net.jafama.FastMath/cosh function wrapped in macro.
sourceraw docstring

cotclj

(cot v)

Cotangent

Cotangent
sourceraw docstring

cothclj

(coth v)

Hyperbolic cotangent

Hyperbolic cotangent
sourceraw docstring

cscclj

(csc v)

Cosecant

Cosecant
sourceraw docstring

cschclj

(csch v)

Hyperbolic cosecant

Hyperbolic cosecant
sourceraw docstring

cutclj

(cut data breaks)
(cut x1 x2 breaks)

Cut range or sequence into intervals

Cut range or sequence into intervals
sourceraw docstring

deccljmacro

(dec x)

fastmath.java.PrimitiveMath/dec function wrapped in macro.

fastmath.java.PrimitiveMath/dec function wrapped in macro.
sourceraw docstring

deg-in-radclj

\(\frac{\pi}{180}\)

\\(\frac{\pi}{180}\\)
sourceraw docstring

degreesclj

(degrees rad)

Convert radians into degrees.

Convert radians into degrees.
sourceraw docstring

difference-of-productsclj

(difference-of-products a b c d)
source

digammacljmacro

(digamma x)

Logarithmic derivative of \(\Gamma\).

Logarithmic derivative of \\(\Gamma\\).
sourceraw docstring

distclj

(dist x1 y1 x2 y2)

Euclidean distance between points (x1,y1) and (x2,y2). See fastmath.vector namespace to see other metrics which work on vectors.

Euclidean distance between points `(x1,y1)` and `(x2,y2)`. See [[fastmath.vector]] namespace to see other metrics which work on vectors.
sourceraw docstring

double-array->seqclj

Convert double array into sequence.

Alias for seq.

Convert double array into sequence.

Alias for `seq`.
sourceraw docstring

double-array-typeclj

source

double-double-array->seqclj

(double-double-array->seq res)

Convert double array of double arrays into sequence of sequences.

Convert double array of double arrays into sequence of sequences. 
sourceraw docstring

double-double-array-typeclj

source

double-high-bitsclj

(double-high-bits v)

Returns high word from double as bits

Returns high word from double as bits
sourceraw docstring

double-low-bitsclj

(double-low-bits v)

Returns low word from double as bits

Returns low word from double as bits
sourceraw docstring

double-one-minus-epsilonclj

Value of 0x1.fffffffffffffp-1d = 0.(9)

Value of 0x1.fffffffffffffp-1d = 0.(9)
sourceraw docstring

Eclj

Value of \(e\)

Value of \\(e\\)
sourceraw docstring

EPSILONclj

Very small number \(\varepsilon\)

Very small number \\(\varepsilon\\)
sourceraw docstring

eqclj

(eq _)
(eq a b)
(eq a b c)
(eq a b c d)

Primitive math equality function for doubles. See ==.

Primitive math equality function for doubles. See [[==]].
sourceraw docstring

erfcljmacro

(erf x)
(erf x y)

Error function. For two arguments return difference between (erf x) and (erf y).

Error function. For two arguments return difference between `(erf x)` and `(erf y)`.
sourceraw docstring

erfccljmacro

(erfc x)

Complementary error function.

Complementary error function.
sourceraw docstring

evalpolyclj

(evalpoly x & coeffs)

Evaluate polynomial

Evaluate polynomial
sourceraw docstring

even?cljmacro

(even? x)

fastmath.java.PrimitiveMath/isEven function wrapped in macro.

fastmath.java.PrimitiveMath/isEven function wrapped in macro.
sourceraw docstring

expcljmacro

(exp x)

net.jafama.FastMath/exp function wrapped in macro.

net.jafama.FastMath/exp function wrapped in macro.
sourceraw docstring

expm1cljmacro

(expm1 x)

net.jafama.FastMath/expm1 function wrapped in macro.

net.jafama.FastMath/expm1 function wrapped in macro.
sourceraw docstring

factorial20clj

(factorial20 n)

Factorial table up to 20!

Factorial table up to 20!
sourceraw docstring

fast*clj

(fast* a b)

Primitive * for two arguments as function (not macro).

Primitive `*` for two arguments as function (not macro).
sourceraw docstring

fast+clj

(fast+ a b)

Primitive + for two arguments as function (not macro).

Primitive `+` for two arguments as function (not macro).
sourceraw docstring

fast-clj

(fast- a b)

Primitive - for two arguments as function (not macro).

Primitive `-` for two arguments as function (not macro).
sourceraw docstring

fast-identityclj

(fast-identity a)

Identity on double.

Identity on double.
sourceraw docstring

fast-maxclj

(fast-max a b)

Primitive max for two arguments as function (not macro).

Primitive `max` for two arguments as function (not macro).
sourceraw docstring

fast-minclj

(fast-min a b)

Primitive min for two arguments as function (not macro).

Primitive `min` for two arguments as function (not macro).
sourceraw docstring

floorclj

(floor x)
(floor x scale)

\(\lfloor x \rfloor\). See: qfloor.

Rounding is done to a multiply of scale value (when provided).

\\(\lfloor x \rfloor\\). See: [[qfloor]].

Rounding is done to a multiply of scale value (when provided).
sourceraw docstring

fmacljmacro

(fma x y z)

[x y z] -> (+ z (* x y)) or Math/fma for java 9+

`[x y z]` -> `(+ z (* x y))` or `Math/fma` for java 9+
sourceraw docstring

FOUR_INV_PIclj

Value of \(\frac{4}{\pi}\)

Value of \\(\frac{4}{\pi}\\)
sourceraw docstring

fpowcljmacro

(fpow x y)

Fast version of pow where exponent is integer.

Fast version of pow where exponent is integer.
sourceraw docstring

fracclj

(frac v)

Fractional part, always returns values from 0.0 to 1.0 (exclusive). See sfrac for signed version.

Fractional part, always returns values from 0.0 to 1.0 (exclusive). See [[sfrac]] for signed version.
sourceraw docstring

gammacljmacro

(gamma x)

Gamma function \(\Gamma(x)\)

Gamma function \\(\Gamma(x)\\)
sourceraw docstring

GAMMAclj

Euler-Mascheroni constant

Euler-Mascheroni constant
sourceraw docstring

gcdclj

(gcd a b)

Fast binary greatest common divisor (Stein's algorithm)

Fast binary greatest common divisor (Stein's algorithm)
sourceraw docstring

group-by-intervalsclj

(group-by-intervals coll)
(group-by-intervals intervals coll)

Group sequence of values into given intervals.

If intervals are missing, use co-intervals to find some.

Group sequence of values into given intervals.

If `intervals` are missing, use [[co-intervals]] to find some.
sourceraw docstring

HALF_PIclj

Value of \(\frac{\pi}{2}\)

Value of \\(\frac{\pi}{2}\\)
sourceraw docstring

haversineclj

(haversine v)
(haversine [lat1 lon1] [lat2 lon2])
(haversine lat1 lon1 lat2 lon2)

Haversine formula

Haversine formula
sourceraw docstring

haversine-distclj

(haversine-dist [lat1 lon1] [lat2 lon2])
(haversine-dist lat1 lon1 lat2 lon2)

Haversine distance d for r=1

Haversine distance `d` for `r=1`
sourceraw docstring

high-2-expclj

(high-2-exp v)

Find lowest exponent (power of 2) which is greater or equal x. See low-2-exp.

Find lowest exponent (power of 2) which is greater or equal `x`. See [[low-2-exp]].
sourceraw docstring

high-expclj

(high-exp b x)

Find lowest exponent for base b which is higher or equalx. See also low-exp.

Find lowest exponent for base `b` which is higher or equal`x`. See also [[low-exp]].
sourceraw docstring

hypotclj

(hypot x y)
(hypot x y z)

Hypot. See also hypot-sqrt.

Hypot.
See also [[hypot-sqrt]].
sourceraw docstring

hypot-sqrtclj

(hypot-sqrt x y)
(hypot-sqrt x y z)

Hypot, sqrt version: \(\sqrt{x^2+y^2}\) or \(\sqrt{x^2+y^2+z^2}\). Should be faster than hypot.

Hypot, sqrt version: \\(\sqrt{x^2+y^2}\\) or \\(\sqrt{x^2+y^2+z^2}\\).
Should be faster than [[hypot]].
sourceraw docstring

I0clj

(I0 x)

Modified Bessel function of the first kind, order 0.

Modified Bessel function of the first kind, order 0.
sourceraw docstring

iabsclj

(iabs x)

\(|x|\) - long version. See abs.

\\(|x|\\) - `long` version. See [[abs]].
sourceraw docstring

inccljmacro

(inc x)

fastmath.java.PrimitiveMath/inc function wrapped in macro.

fastmath.java.PrimitiveMath/inc function wrapped in macro.
sourceraw docstring

inf?clj

(inf? v)

Check if number is infinite

Check if number is infinite
sourceraw docstring

inv-erfcljmacro

(inv-erf x)

Inverse erf.

Inverse [[erf]].
sourceraw docstring

inv-erfccljmacro

(inv-erfc x)

Inverse erfc.

Inverse [[erfc]].
sourceraw docstring

inv-gamma-1pm1cljmacro

(inv-gamma-1pm1 x)

\(\frac{1}{\Gamma(1+x)}\).

\\(\frac{1}{\Gamma(1+x)}\\).
sourceraw docstring

INV_LN2clj

\(\frac{1}{\ln{2}}\)

\\(\frac{1}{\ln{2}}\\)
sourceraw docstring

INV_LOG_HALFclj

\(\frac{1}{\ln{0.5}}\)

\\(\frac{1}{\ln{0.5}}\\)
sourceraw docstring

INV_PIclj

Value of \(\frac{1}{\pi}\)

Value of \\(\frac{1}{\pi}\\)
sourceraw docstring

INV_SQRT2PIclj

\(\frac{1}{\sqrt\pi}\)

\\(\frac{1}{\sqrt\pi}\\)
sourceraw docstring

INV_SQRT_2clj

\(\frac{1}{\sqrt{2}}\)

\\(\frac{1}{\sqrt{2}}\\)
sourceraw docstring

INV_TWO_PIclj

Value of \(\frac{1}{2 \pi}\)

Value of \\(\frac{1}{2 \pi}\\)
sourceraw docstring

invalid-double?clj

(invalid-double? v)

Check if number is invalid

Check if number is invalid
sourceraw docstring

itruncclj

(itrunc v)

Truncate fractional part, keep sign. Returns long.

Truncate fractional part, keep sign. Returns `long`.
sourceraw docstring

jincclj

(jinc x)

Besselj1 devided by x

Besselj1 devided by `x`
sourceraw docstring

LANCZOS_Gclj

Lanchos approximation g constant

Lanchos approximation `g` constant
sourceraw docstring

lcmclj

(lcm a b)

Fast binary least common multiplier.

Fast binary least common multiplier.
sourceraw docstring

lerpclj

(lerp start stop t)

Linear interpolation between start and stop for amount t. See also mlerp, cos-interpolation, quad-interpolation or smooth-interpolation.

Linear interpolation between `start` and `stop` for amount `t`. See also [[mlerp]], [[cos-interpolation]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

lncljmacro

(ln x)

net.jafama.FastMath/log function wrapped in macro.

net.jafama.FastMath/log function wrapped in macro.
sourceraw docstring

LN10clj

\(\ln{10}\)

\\(\ln{10}\\)
sourceraw docstring

LN2clj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

LN2_2clj

\(\frac{\ln{2}}{2}\)

\\(\frac{\ln{2}}{2}\\)
sourceraw docstring

logcljmacro

(log x)

net.jafama.FastMath/log function wrapped in macro.

net.jafama.FastMath/log function wrapped in macro.
sourceraw docstring

log-betacljmacro

(log-beta x y)

Logarithm of Beta function.

Logarithm of Beta function.
sourceraw docstring

log-gammacljmacro

(log-gamma x)

Gamma function \(\ln\Gamma(x)\)

Gamma function \\(\ln\Gamma(x)\\)
sourceraw docstring

log-gamma-1pcljmacro

(log-gamma-1p x)

Gamma function \(\ln\Gamma(1+x)\)

Gamma function \\(\ln\Gamma(1+x)\\)
sourceraw docstring

log10cljmacro

(log10 x)

\(\ln_{10}{x}\)

\\(\ln_{10}{x}\\)
sourceraw docstring

LOG10Eclj

\(\log_{10}{e}\)

\\(\log_{10}{e}\\)
sourceraw docstring

log1mexpclj

(log1mexp x)

log(1-exp(x))

log(1-exp(x))
sourceraw docstring

log1pcljmacro

(log1p x)

net.jafama.FastMath/log1p function wrapped in macro.

net.jafama.FastMath/log1p function wrapped in macro.
sourceraw docstring

log1pexpclj

(log1pexp x)

log(1+exp(x))

log(1+exp(x))
sourceraw docstring

log1pmxclj

(log1pmx x)

log(1+x)-x

log(1+x)-x
sourceraw docstring

log1psqclj

(log1psq x)

log(1+x^2))

log(1+x^2))
sourceraw docstring

log2clj

(log2 x)

Logarithm with base 2.

\(\ln_2{x}\)

Logarithm with base 2.

\\(\ln_2{x}\\)
sourceraw docstring

LOG2Eclj

\(\log_{2}{e}\)

\\(\log_{2}{e}\\)
sourceraw docstring

LOG_HALFclj

\(\ln{0.5}\)

\\(\ln{0.5}\\)
sourceraw docstring

LOG_PIclj

\(\ln{\pi}\)

\\(\ln{\pi}\\)
sourceraw docstring

LOG_TWO_PIclj

\(\ln{2 \pi}\)

\\(\ln{2 \pi}\\)
sourceraw docstring

logbclj

(logb b x)

Logarithm with base b.

\(\ln_b{x}\)

Logarithm with base `b`.

\\(\ln_b{x}\\)
sourceraw docstring

logexpm1clj

(logexpm1 x)

log(exp(x)-1))

log(exp(x)-1))
sourceraw docstring

logI0clj

(logI0 x)

Log of I0.

Log of [[I0]].
sourceraw docstring

logisticclj

Alias for sigmoid

Alias for [[sigmoid]]
sourceraw docstring

logitclj

(logit x)

Logit function

Logit function
sourceraw docstring

logmxp1clj

(logmxp1 x)

log(x)-x+1

log(x)-x+1
sourceraw docstring

low-2-expclj

(low-2-exp x)

Find greatest exponent (power of 2) which is lower or equal x. See high-2-exp.

Find greatest exponent (power of 2) which is lower or equal `x`. See [[high-2-exp]].
sourceraw docstring

low-expclj

(low-exp b x)

Find greatest exponent for base b which is lower or equal x. See also high-exp.

Find greatest exponent for base `b` which is lower or equal `x`. See also [[high-exp]].
sourceraw docstring

M_1_PIclj

\(\frac{1}{\pi}\)

\\(\frac{1}{\pi}\\)
sourceraw docstring

M_2_PIclj

\(\frac{2}{\pi}\)

\\(\frac{2}{\pi}\\)
sourceraw docstring

M_2_SQRTPIclj

\(\frac{2}{\sqrt\pi}\)

\\(\frac{2}{\sqrt\pi}\\)
sourceraw docstring

M_3PI_4clj

\(\frac{3\pi}{4}\)

\\(\frac{3\pi}{4}\\)
sourceraw docstring

M_Eclj

\(e\)

\\(e\\)
sourceraw docstring

M_INVLN2clj

\(\frac{1}{\ln{2}}\)

\\(\frac{1}{\ln{2}}\\)
sourceraw docstring

M_IVLN10clj

\(\frac{1}{\ln{10}}\)

\\(\frac{1}{\ln{10}}\\)
sourceraw docstring

M_LN10clj

\(\ln{10}\)

\\(\ln{10}\\)
sourceraw docstring

M_LN2clj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

M_LOG10Eclj

\(\log_{10}{e}\)

\\(\log_{10}{e}\\)
sourceraw docstring

M_LOG2_Eclj

\(\ln{2}\)

\\(\ln{2}\\)
sourceraw docstring

M_LOG2Eclj

\(\log_{2}{e}\)

\\(\log_{2}{e}\\)
sourceraw docstring

M_PIclj

\(\pi\)

\\(\pi\\)
sourceraw docstring

M_PI_2clj

\(\frac{\pi}{2}\)

\\(\frac{\pi}{2}\\)
sourceraw docstring

M_PI_4clj

\(\frac{\pi}{4}\)

\\(\frac{\pi}{4}\\)
sourceraw docstring

M_SQRT1_2clj

\(\frac{1}{\sqrt{2}}\)

\\(\frac{1}{\sqrt{2}}\\)
sourceraw docstring

M_SQRT2clj

\(\sqrt{2}\)

\\(\sqrt{2}\\)
sourceraw docstring

M_SQRT3clj

\(\sqrt{3}\)

\\(\sqrt{3}\\)
sourceraw docstring

M_SQRT_PIclj

\(\sqrt\pi\)

\\(\sqrt\pi\\)
sourceraw docstring

M_TWOPIclj

\(2\pi\)

\\(2\pi\\)
sourceraw docstring

MACHINE-EPSILONclj

Smallest machine number. Value is calculated during evaluation and may differ on different processors.

Smallest machine number. Value is calculated during evaluation and may differ on different processors.
sourceraw docstring

make-normclj

(make-norm start stop)
(make-norm start stop dstart dstop)

Make norm function for given range. Resulting function accepts double value (with optional target [dstart,dstop] range) and returns double.

Make [[norm]] function for given range. Resulting function accepts `double` value (with optional target `[dstart,dstop]` range) and returns `double`.
sourceraw docstring

makepolyclj

(makepoly coeffs)

Create polynomial function for given coefficients

Create polynomial function for given coefficients
sourceraw docstring

maxcljmacro

(max x)
(max x y)
(max x y & rest)

A primitive math version of max

A primitive math version of `max`
sourceraw docstring

mevalpolycljmacro

(mevalpoly x & coeffs)

Evaluate polynomial macro version

Evaluate polynomial macro version
sourceraw docstring

mincljmacro

(min x)
(min x y)
(min x y & rest)

A primitive math version of min

A primitive math version of `min`
sourceraw docstring

minkowskiclj

(minkowski x)

Minkowski's question mark function ?(x)

Minkowski's question mark function ?(x)
sourceraw docstring

mlerpcljmacro

(mlerp start stop t)

lerp as macro. For inline code. See also lerp, cos-interpolation, quad-interpolation or smooth-interpolation.

[[lerp]] as macro. For inline code. See also [[lerp]], [[cos-interpolation]], [[quad-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

mnormcljmacro

(mnorm v start stop)
(mnorm v start1 stop1 start2 stop2)

Macro version of norm.

Macro version of [[norm]].
sourceraw docstring

modcljmacro

(mod x y)

fastmath.java.PrimitiveMath/modulus function wrapped in macro.

fastmath.java.PrimitiveMath/modulus function wrapped in macro.
sourceraw docstring

muladdcljmacro

(muladd x y z)

[x y z] -> (+ z (* x y)) or Math/fma for java 9+

`[x y z]` -> `(+ z (* x y))` or `Math/fma` for java 9+
sourceraw docstring

nan?clj

(nan? v)

Check if number is NaN

Check if number is NaN
sourceraw docstring

neg-inf?clj

(neg-inf? v)

Check if number is negatively infinite

Check if number is negatively infinite
sourceraw docstring

neg?cljmacro

(neg? x)

fastmath.java.PrimitiveMath/isNeg function wrapped in macro.

fastmath.java.PrimitiveMath/isNeg function wrapped in macro.
sourceraw docstring

negmuladdcljmacro

(negmuladd x y z)

[x y z] -> (+ z (* -1.0 x y)

`[x y z]` -> `(+ z (* -1.0 x y)`
sourceraw docstring

next-doubleclj

(next-double v)
(next-double v delta)

Next double value. Optional value delta sets step amount.

Next double value. Optional value `delta` sets step amount.
sourceraw docstring

normclj

(norm v start stop)
(norm v start1 stop1 start2 stop2)

Normalize v from the range [start,stop] to the range [0,1] or map v from the range [start1,stop1] to the range [start2,stop2]. See also make-norm.

Normalize `v` from the range `[start,stop]` to the range `[0,1]` or map `v` from the range `[start1,stop1]` to the range `[start2,stop2]`. See also [[make-norm]].
sourceraw docstring

not==cljmacro

(not== x)
(not== x y)
(not== x y & rest)

A primitive math version of not==

A primitive math version of `not==`
sourceraw docstring

odd?cljmacro

(odd? x)

fastmath.java.PrimitiveMath/isOdd function wrapped in macro.

fastmath.java.PrimitiveMath/isOdd function wrapped in macro.
sourceraw docstring

one?cljmacro

(one? x)

fastmath.java.PrimitiveMath/isOne function wrapped in macro.

fastmath.java.PrimitiveMath/isOne function wrapped in macro.
sourceraw docstring

orderclj

(order vs)
(order vs decreasing?)

Ordering permutation. See R docs

Order uses 0 based indexing.

Ordering permutation. See [R docs](https://www.rdocumentation.org/packages/base/versions/3.6.1/topics/order)

Order uses 0 based indexing.
sourceraw docstring

PHIclj

Golden ratio \(\varphi\)

Golden ratio \\(\varphi\\)
sourceraw docstring

PIclj

Value of \(\pi\)

Value of \\(\pi\\)
sourceraw docstring

pos-inf?clj

(pos-inf? v)

Check if number is positively infinite

Check if number is positively infinite
sourceraw docstring

pos?cljmacro

(pos? x)

fastmath.java.PrimitiveMath/isPos function wrapped in macro.

fastmath.java.PrimitiveMath/isPos function wrapped in macro.
sourceraw docstring

powcljmacro

(pow x y)

net.jafama.FastMath/pow function wrapped in macro.

net.jafama.FastMath/pow function wrapped in macro.
sourceraw docstring

pow2clj

(pow2 x)

Same as sq. \(x^2\)

Same as [[sq]]. \\(x^2\\)
sourceraw docstring

pow3clj

(pow3 x)

\(x^3\)

\\(x^3\\)
sourceraw docstring

prev-doubleclj

(prev-double v)
(prev-double v delta)

Next double value. Optional value delta sets step amount.

Next double value. Optional value `delta` sets step amount.
sourceraw docstring

qceilcljmacro

(qceil x)

Fast version of ceil. Returns long. See: ceil.

Fast version of [[ceil]]. Returns `long`. See: [[ceil]].
sourceraw docstring

qcoscljmacro

(qcos x)

Fast and less accurate cos.

Fast and less accurate [[cos]].
sourceraw docstring

qdistclj

(qdist x1 y1 x2 y2)

Quick version of Euclidean distance between points. qsqrt is used instead of sqrt.

Quick version of Euclidean distance between points. [[qsqrt]] is used instead of [[sqrt]].
sourceraw docstring

qexpcljmacro

(qexp x)

Quick and less accurate version of exp.

Quick and less accurate version of [[exp]].
sourceraw docstring

qfloorcljmacro

(qfloor x)

Fast version of floor. Returns long. See: floor.

Fast version of [[floor]]. Returns `long`. See: [[floor]].
sourceraw docstring

qlogcljmacro

(qlog x)

Fast and less accurate version of log.

Fast and less accurate version of [[log]].
sourceraw docstring

qpowcljmacro

(qpow x y)

Fast and less accurate version of pow.

Fast and less accurate version of [[pow]].
sourceraw docstring

qroundcljmacro

(qround x)

Fast version of round. Returns long. See: rint, round.

Fast version of [[round]]. Returns `long`. See: [[rint]], [[round]].
sourceraw docstring

qsincljmacro

(qsin x)

Fast and less accurate sin.

Fast and less accurate [[sin]].
sourceraw docstring

qsqrtcljmacro

(qsqrt x)

Approximated sqrt using binary operations with error 1.0E-2.

Approximated [[sqrt]] using binary operations with error `1.0E-2`.
sourceraw docstring

quad-interpolationclj

(quad-interpolation start stop t)

Quad interpolation. See also lerp/mlerp, cos-interpolation or smooth-interpolation.

Quad interpolation. See also [[lerp]]/[[mlerp]], [[cos-interpolation]] or [[smooth-interpolation]].
sourceraw docstring

QUARTER_PIclj

Value of \(\frac{\pi}{4}\)

Value of \\(\frac{\pi}{4}\\)
sourceraw docstring

quotcljmacro

(quot x y)

fastmath.java.PrimitiveMath/quotient function wrapped in macro.

fastmath.java.PrimitiveMath/quotient function wrapped in macro.
sourceraw docstring

rad-in-degclj

\(\frac{180}{\pi}\)

\\(\frac{180}{\pi}\\)
sourceraw docstring

radiansclj

(radians deg)

Convert degrees into radians.

Convert degrees into radians.
sourceraw docstring

rankclj

(rank vs)
(rank vs ties)
(rank vs ties desc?)

Sample ranks. See R docs.

Rank uses 0 based indexing.

Possible tie strategies: :average, :first, :last, :random, :min, :max, :dense.

:dense is the same as in data.table::frank from R

Sample ranks. See [R docs](https://www.rdocumentation.org/packages/base/versions/3.6.1/topics/rank).

Rank uses 0 based indexing.

Possible tie strategies: `:average`, `:first`, `:last`, `:random`, `:min`, `:max`, `:dense`.

`:dense` is the same as in `data.table::frank` from R
sourceraw docstring

regularized-betacljmacro

(regularized-beta x y z)

Regularized Beta.

Regularized `Beta`.
sourceraw docstring

regularized-gamma-pcljmacro

(regularized-gamma-p x y)

Regularized gamma P

Regularized `gamma` P
sourceraw docstring

regularized-gamma-qcljmacro

(regularized-gamma-q x y)

Regularized gamma Q

Regularized `gamma` Q
sourceraw docstring

remcljmacro

(rem x y)

fastmath.java.PrimitiveMath/remainder function wrapped in macro.

fastmath.java.PrimitiveMath/remainder function wrapped in macro.
sourceraw docstring

remaindercljmacro

(remainder x y)

From FastMath doc: returns dividend - divisor * n, where n is the mathematical integer closest to dividend/divisor. Returned value in [-|divisor|/2,|divisor|/2]

From `FastMath` doc: returns dividend - divisor * n,
where n is the mathematical integer closest to dividend/divisor. Returned value in `[-|divisor|/2,|divisor|/2]`
sourceraw docstring

rintclj

(rint x)

Round to double. See round, qround.

Round to `double`. See [[round]], [[qround]].
sourceraw docstring

roundclj

(round x)

Round to long. See: rint, qround.

Round to `long`. See: [[rint]], [[qround]].
sourceraw docstring

round-evenclj

(round-even x)

Round evenly (like in round in R), IEEE / IEC rounding

Round evenly (like in round in R), IEEE / IEC rounding
sourceraw docstring

round-up-pow2clj

(round-up-pow2 v)

Round long to the next power of 2

Round long to the next power of 2
sourceraw docstring

rqsqrtcljmacro

(rqsqrt x)

Inversed version of qsqrt. Quick and less accurate.

Inversed version of [[qsqrt]]. Quick and less accurate.
sourceraw docstring

safe-sqrtclj

(safe-sqrt value)

Safe sqrt, for value <= 0 result is 0.

\( \left\{ \begin{array}{lr} 0 & : x \leq 0\\ \sqrt{x} & : x > 0 \end{array} \right. \)

Safe sqrt, for value <= 0 result is 0.

\\(
\left\\{
\begin{array}{lr}
0 & : x \leq 0\\\\
\sqrt{x} & : x > 0
\end{array}
\\right.
\\)
sourceraw docstring

sampleclj

(sample f number-of-values)
(sample f number-of-values domain?)
(sample f range-min range-max number-of-values)
(sample f range-min range-max number-of-values domain?)

Sample function f and return sequence of values.

range-min defaults to 0.0, range-max to 1.0.

Range is inclusive.

When optional domain? is set to true (default: false) function returns pairs [x,(f x)].

Sample function `f` and return sequence of values.

`range-min` defaults to 0.0, `range-max` to 1.0.

Range is inclusive.

When optional `domain?` is set to true (default: false) function returns pairs `[x,(f x)]`.
sourceraw docstring

secclj

(sec v)

Secant

Secant
sourceraw docstring

sechclj

(sech v)

Hyperbolic secant

Hyperbolic secant
sourceraw docstring

seq->double-arrayclj

(seq->double-array vs)

Convert sequence to double array. Returns input if vs is double array already.

Convert sequence to double array. Returns input if `vs` is double array already.
sourceraw docstring

seq->double-double-arrayclj

(seq->double-double-array vss)

Convert sequence to double-array of double-arrays.

If sequence is double-array of double-arrays returns vss

Convert sequence to double-array of double-arrays.

If sequence is double-array of double-arrays returns `vss`
sourceraw docstring

sfracclj

(sfrac v)

Fractional part, always returns values from -1.0 to 1.0 (exclusive). See frac for unsigned version.

Fractional part, always returns values from -1.0 to 1.0 (exclusive). See [[frac]] for unsigned version.
sourceraw docstring

sgnclj

(sgn value)

Return -1 when value is negative, 1 otherwise. See also signum.

\( \left\{ \begin{array}{lr} 1.0 & : x \geq 0\\ -1.0 & : x < 0\\ \end{array} \right. \)

Return -1 when `value` is negative, 1 otherwise. See also [[signum]].

\\(
\left\\{
\begin{array}{lr}
1.0 & : x \geq 0\\\\
-1.0 & : x < 0\\\\
\end{array}
\\right.
\\)
sourceraw docstring

Siclj

(Si x)

Integral of sin(t)/t from 0 to x

Integral of sin(t)/t from 0 to x
sourceraw docstring

sigmoidclj

(sigmoid x)

Sigmoid function

Sigmoid function
sourceraw docstring

signumclj

(signum value)

Return 1 if value is > 0, 0 if it is 0, -1 otherwise. See also sgn.

\( \left\{ \begin{array}{lr} 1.0 & : x > 0\\ -1.0 & : x < 0\\ 0.0 & : x = 0 \end{array} \right. \)

Return 1 if `value` is > 0, 0 if it is 0, -1 otherwise. See also [[sgn]].

\\(
\left\\{
\begin{array}{lr}
1.0 & : x > 0\\\\
-1.0 & : x < 0\\\\
0.0 & : x = 0
\end{array}
\\right.
\\)
sourceraw docstring

sincljmacro

(sin x)

net.jafama.FastMath/sin function wrapped in macro.

net.jafama.FastMath/sin function wrapped in macro.
sourceraw docstring

sincclj

(sinc v)

Sinc function.

Sinc function.
sourceraw docstring

sinhcljmacro

(sinh x)

net.jafama.FastMath/sinh function wrapped in macro.

net.jafama.FastMath/sinh function wrapped in macro.
sourceraw docstring

SIXTHclj

Value of \(\frac{1}{6}\)

Value of \\(\frac{1}{6}\\)
sourceraw docstring

slice-rangeclj

(slice-range cnt)
(slice-range start end cnt)

Slice range to get cnt number of points evenly distanced.

Slice range to get `cnt` number of points evenly distanced.
sourceraw docstring

smooth-interpolationclj

(smooth-interpolation start stop t)

Smoothstep based interpolation. See also lerp/mlerp, quad-interpolation or cos-interpolation.

Smoothstep based interpolation. See also [[lerp]]/[[mlerp]], [[quad-interpolation]] or [[cos-interpolation]].
sourceraw docstring

smoothstepclj

(smoothstep edge0 edge1 x)
GL [smoothstep](https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/smoothstep.xhtml).
sourceraw docstring

sqclj

(sq x)

Same as pow2. \(x^2\)

Same as [[pow2]]. \\(x^2\\)
sourceraw docstring

sqrtcljmacro

(sqrt x)

\(\sqrt{x}\)

\\(\sqrt{x}\\)
sourceraw docstring

SQRT2clj

\(\sqrt{2}\)

\\(\sqrt{2}\\)
sourceraw docstring

SQRT2_2clj

\(\frac{\sqrt{2}}{2}\)

\\(\frac{\sqrt{2}}{2}\\)
sourceraw docstring

SQRT2PIclj

\(\sqrt{2\pi}\)

\\(\sqrt{2\pi}\\)
sourceraw docstring

SQRT3clj

\(\sqrt{3}\)

\\(\sqrt{3}\\)
sourceraw docstring

SQRT3_2clj

\(\frac{\sqrt{3}}{2}\)

\\(\frac{\sqrt{3}}{2}\\)
sourceraw docstring

SQRT3_3clj

\(\frac{\sqrt{3}}{3}\)

\\(\frac{\sqrt{3}}{3}\\)
sourceraw docstring

SQRT3_4clj

\(\frac{\sqrt{3}}{4}\)

\\(\frac{\sqrt{3}}{4}\\)
sourceraw docstring

SQRT5clj

\(\sqrt{5}\)

\\(\sqrt{5}\\)
sourceraw docstring

SQRT_HALFPIclj

\(\sqrt{\frac{1}{2}\pi}\)

\\(\sqrt{\frac{1}{2}\pi}\\)
sourceraw docstring

SQRTPIclj

\(\sqrt{\pi}\)

\\(\sqrt{\pi}\\)
sourceraw docstring

sum-of-productsclj

(sum-of-products a b c d)
source

tancljmacro

(tan x)

net.jafama.FastMath/tan function wrapped in macro.

net.jafama.FastMath/tan function wrapped in macro.
sourceraw docstring

tanhcljmacro

(tanh x)

net.jafama.FastMath/tanh function wrapped in macro.

net.jafama.FastMath/tanh function wrapped in macro.
sourceraw docstring

TAUclj

Alias for TWO_PI

Alias for [[TWO_PI]]
sourceraw docstring

THIRDclj

Value of \(\frac{1}{3}\)

Value of \\(\frac{1}{3}\\)
sourceraw docstring

THIRD_PIclj

Value of \(\frac{\pi}{3}\)

Value of \\(\frac{\pi}{3}\\)
sourceraw docstring

trigammacljmacro

(trigamma x)

Derivative of digamma.

Derivative of [[digamma]].
sourceraw docstring

truncclj

(trunc v)

Truncate fractional part, keep sign. Returns double.

Truncate fractional part, keep sign. Returns `double`.
sourceraw docstring

TWO_INV_PIclj

Value of \(\frac{2}{\pi}\)

Value of \\(\frac{2}{\pi}\\)
sourceraw docstring

TWO_PIclj

Value of \(2 {\pi}\)

Value of \\(2 {\pi}\\)
sourceraw docstring

TWO_THIRDclj

Value of \(\frac{2}{3}\)

Value of \\(\frac{2}{3}\\)
sourceraw docstring

unsigned-bit-shift-rightcljmacro

(unsigned-bit-shift-right x y)

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.

fastmath.java.PrimitiveMath/unsignedShiftRight function wrapped in macro.
sourceraw docstring

unuse-primitive-operatorsclj

(unuse-primitive-operators)

Undoes the work of use-primitive-operators. This is idempotent.

Undoes the work of [[use-primitive-operators]]. This is idempotent.
sourceraw docstring

use-primitive-operatorsclj

(use-primitive-operators)
(use-primitive-operators skip-set)

Replaces Clojure's arithmetic and number coercion functions with primitive equivalents. These are defined as macros, so they cannot be used as higher-order functions. This is an idempotent operation. Undo with unuse-primitive-operators.

Replaces Clojure's arithmetic and number coercion functions with primitive equivalents.  These are
defined as macros, so they cannot be used as higher-order functions. This is an idempotent operation. Undo with [[unuse-primitive-operators]].
sourceraw docstring

valid-double?clj

(valid-double? v)

Check if number is invalid

Check if number is invalid
sourceraw docstring

wrapclj

(wrap start stop value)

Wrap overflowed value into the range, similar to ofWrap.

Wrap overflowed value into the range, similar to [ofWrap](http://openframeworks.cc/documentation/math/ofMath/#!show_ofWrap).
sourceraw docstring

xlogxclj

(xlogx x)

x * log(x)

x * log(x)
sourceraw docstring

zero?cljmacro

(zero? x)

fastmath.java.PrimitiveMath/isZero function wrapped in macro.

fastmath.java.PrimitiveMath/isZero function wrapped in macro.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close