org.candelbio.multitool.math

coefficent-of-variation

(coefficent-of-variation seq)

Return coefficent of variation of the elements of seq

covariance

(covariance seq1 seq2)

Return the covariance between seq1 and seq2, which should be of equal size

d2r

(d2r d)

Convert degrees to radians

divides?

(divides? a b)

euclidean-distance

(euclidean-distance x0 y0 x1 y1)(euclidean-distance p0 p1)

Euclidean distance between points. Either 2D points supplied as separate arguments, or between 2 n-dimensional points with vector coordinates

extrapolate

(extrapolate v)

Extrapolate a vector of numbers by one element, using method of finite differences

factorials

geometric-mean

(geometric-mean seq)

Return the geometric mean of the elements of seq

iles

(iles seq n)

Return the boundaries of deciles (n-iles) of seq

interpolate

(interpolate a b s)

Return a number between a and b, s is in interval [0, 1]

interpolated

(interpolated a b n)

Return a sequence of n equally-spaced numbers between a and b

manhattan-distance

(manhattan-distance x0 y0 x1 y1)(manhattan-distance p0 p1)

Manhattan distance between points. Either 2D points supplied as separate arguments, or between 2 n-dimensional points with vector coordinates

mean

(mean seq)

Return the arithmetic mean of the elements of seq

median

(median seq)

Return the median of the elements of seq

outliers-by

(outliers-by scorefn seq factor)

Return elements of seq on whom scorefn is more than factor standard-deviations away from the mean.

pearson-correlation-coefficient

(pearson-correlation-coefficient seq1 seq2)

Return the correlation coefficient between seq1 and seq2, which should be of equal size. Value is in range [-1, 1].

prime-factors

(prime-factors n)

Prime factors of n

prime?

(prime? n)

primes

r2d

(r2d r)

Convert radians to degrees

rescale

(rescale val from-lower from-upper to-lower to-upper)

Val is a number from interval [from-lower, from-upper], scale it to [to-lower, to-upper]

score-b

(score-b keyfn seq)

Return a list of [elt score] pairs, in descending score order.

standard-deviation

(standard-deviation seq)

Return standard deviation of the elements of seq

standard-deviation-sample

(standard-deviation-sample seq)

Return standard deviation with Bessel correction of the elements of seq