Janet 1.38.0-73334f3 Documentation
(Other Versions: 1.37.1 1.36.0 1.35.0 1.34.0 1.31.0 1.29.1 1.28.0 1.27.0 1.26.0 1.25.1 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.1 1.17.1 1.16.1 1.15.0 1.13.1 1.12.2 1.11.1 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

Math extended

Index

math/add math/add-to-mean math/approx-eq math/bernoulli-distribution math/binominal-coeficient math/binominal-distribution math/check-probability math/chi-squared-distribution-table math/cols math/copy math/cumulative-std-normal-probability math/det math/dot math/dot-fast math/epsilon math/expand-m math/extent math/factor math/factorial math/fliplr math/flipud math/geometric-mean math/get-only-el math/harmonic-mean math/ident math/interquartile-range math/invmod math/jacobi math/join-cols math/join-rows math/linear-regression math/linear-regression-line math/m-approx= math/matmul math/median math/median-absolute-deviation math/minor math/mode math/mop math/mul math/mulmod math/next-prime math/normalize-v math/outer math/perm math/permutation-test math/permutations math/poisson-distribution math/powmod math/prime? math/primes math/qr math/qr1 math/quantile math/quantile-rank math/quantile-rank-sorted math/quantile-sorted math/quickselect math/relative-err math/root-mean-square math/row->col math/rows math/sample-correlation math/sample-covariance math/sample-skewness math/sample-standard-deviation math/sample-variance math/scalar math/scale math/shuffle-in-place math/sign math/size math/slice-m math/sop math/squeeze math/standard-deviation math/standard-normal-table math/subtract math/sum-compensated math/sum-nth-power-deviations math/svd math/swap math/t-test math/t-test-2 math/trans math/unit-e math/variance math/z-score math/zero


math/add function source

(add m a)

Add a to matrix m where it can be matrix or scalar. Matrix m is mutated.


math/add-to-mean function source

(add-to-mean m n v)

Adds new value v to mean m from n values.


math/approx-eq function source

(approx-eq a e &opt t)

Approximate equality between actual number a and expected number e. Default tolerance t is epsilon.


math/bernoulli-distribution function source

(bernoulli-distribution p)

Creates Bernoulli distribution from probability p in the tuple.


math/binominal-coeficient function source

(binominal-coeficient n k)

Computes binominal coefficient from set of size n and sample size k.


math/binominal-distribution function source

(binominal-distribution t p)

Creates binominal distribution from trials t and probability p in the tuple.


math/check-probability function source

(check-probability p)

Asserts that probability is in the [0 1] range.


math/chi-squared-distribution-table struct source

Chi Squared distribution table.


math/cols function source

(cols m)

Returns number of columns of matrix m.


math/copy function source

(copy xs)

Deep copy an array or view xs.


math/cumulative-std-normal-probability function source

(cumulative-std-normal-probability z)

Computes standard normal probability for y.


math/det function source

(det m)

Computes determinant of matrix m.


math/dot function source

(dot v1 v2)

Dot product between two row vectors.


math/dot-fast function source

(dot-fast v1 v2)

Fast dot product between two row vectors of equal size.


math/epsilon number source

Epsilon constant


math/expand-m function source

(expand-m n m)

Embeds a matrix m inside an identity matrix of size n.


math/extent function source

(extent xs)

Returns the minimum & maximum number in an xs as tuple.


math/factor function source

(factor n)

Returns an array containing the prime factors of n.


math/factorial function source

(factorial n)

Returns factorial of n.


math/fliplr function source

(fliplr m)

Flip a matrix leftside-right.


math/flipud function source

(flipud m)

Flip a matrix upside-down.


math/geometric-mean function source

(geometric-mean xs)

Gets the geometric mean from xs.


math/get-only-el macro source

(get-only-el m)

Convenience macro for geting first element from first row of the two dimensional array m.


math/harmonic-mean function source

(harmonic-mean xs)

Gets the harmonic mean from xs.


math/ident function source

(ident c)

Creates identity matrix with c x c size.


math/interquartile-range function source

(interquartile-range xs)

Gets the interquartile range from xs.


math/invmod cfunction source

(math/invmod a m)

Modular multiplicative inverse of a mod m. Both arguments must be integer. The return value has the same type as m. If no inverse exists, returns math/nan instead.


math/jacobi cfunction source

(math/jacobi a m)

Computes the Jacobi Symbol (a|m).


math/join-cols function source

(join-cols m1 m2)

Stack horizontally columns of two matrices.


math/join-rows function source

(join-rows m1 m2)

Stack vertically rows of two matrices.


math/linear-regression function source

(linear-regression coords)

Computes the slope :m and y-intercept :b of the function in the struct from set of coordinates.


math/linear-regression-line function source

(linear-regression-line {:b b :m m})

Constructs function from struct returned by linear regression.


math/m-approx= function source

(m-approx= m1 m2 &opt tolerance)

Compares two matrices of equal size for equivalence within epsilon.


math/matmul function source

(matmul ma mb)

Matrix multiplication between matrices ma and mb. Does not mutate.


math/median function source

(median xs)

Gets the median value from xs


math/median-absolute-deviation function source

(median-absolute-deviation xs)

Gets median absolute deviation from xs.


math/minor function source

(minor m x y)

Computes minor matrix of matrix m and x, y.


math/mode function source

(mode xs)

Gets the mode value from xs.


math/mop function source

(mop m op a)

Mutates every cell of the matrix m with op and corresponding cell from matrix arg a.


math/mul function source

(mul m a)

Multiply matrix m with a which can be matrix or a list. Mutates m. A list a will be converted to column vector then multiplifed from the right as x * a.


math/mulmod cfunction source

(math/mulmod a b m)

Modular multiplication of a and b mod m. All arguments must be integer. The return value has the same type as m.


math/next-prime function source

(next-prime n)

Returns the next prime number strictly larger than n.


math/normalize-v function source

(normalize-v xs)

Returns normalized vector of xs by Euclidian (L2) norm.


math/outer function source

(outer v1 v2)

Outer product of vectors v1 and v2.


math/perm function source

(perm m)

Computes permanent of the matrix m.


math/permutation-test function source

(permutation-test xs ys &opt a k)

Conducts a permutation test to determine if two data sets xs and ys are *significantly* different from each other. You can use alternative hypothesis a, which defaults to :two-side, with :greater and :lesser being the other two options. The last optional argument is k number of values in permutation distribution


math/permutations function source

(permutations s &opt k)

Returns permutations of length k from members of s


math/poisson-distribution function source

(poisson-distribution lambda)

Creates Poisson distribution from lambda in tuple.


math/powmod cfunction source

(math/powmod a b m)

Modular exponentiation of a to the power of b mod m. All arguments must be integer. The return value has the same type as m.


math/prime? function source

(prime? n)

A primality test, deterministic for all n less than 2^63.


math/primes function source

(primes)

A boundless prime number generator.


math/qr function source

(qr m)

Stable and robust QR decomposition of a matrix. Decompose a matrix using Householder transformations. O(n^3).


math/qr1 function source

(qr1 m)

Transform using Householder reflections by one step.


math/quantile function source

(quantile xs p)

Gets the quantile value from xs at p from unsorted population.


math/quantile-rank function source

(quantile-rank xs p)

Gets the quantile rank of value v from unsorted xs.


math/quantile-rank-sorted function source

(quantile-rank-sorted xs v)

Gets the quantile rank of value v from sorted xs.


math/quantile-sorted function source

(quantile-sorted xs p)

Gets the quantile value from xs at p from sorted population.


math/quickselect function source

(quickselect arr k &opt left right)

Rearrange items in arr so that all items in [left, k] range are the smallest. The k-th element will have the (k - left + 1)-th smallest value in [left, right]. Mutates arr.


math/relative-err function source

(relative-err a e)

Gets the relative err between actual number a and expected number e.


math/root-mean-square function source

(root-mean-square xs)

Gets the root mean square from xs.


math/row->col function source

(row->col xs)

Transposes a row vector xs to col vector. Returns xs if it has higher dimensions.


math/rows function source

(rows m)

Returns number of rows of matrix m.


math/sample-correlation function source

(sample-correlation xs ys)

Gets the sample correlation between xs and ys.


math/sample-covariance function source

(sample-covariance xs ys)

Gets the sample covariance between xs and ys.


math/sample-skewness function source

(sample-skewness xs)

Gets the sample skeweness from the xs.


math/sample-standard-deviation function source

(sample-standard-deviation xs)

Gets sample standard deviation from xs.


math/sample-variance function source

(sample-variance xs)

Get the sample variance from xs.


math/scalar function source

(scalar c s)

Creates scalar s matrix with c x c size.


math/scale function source

(scale v k)

Scale a vector v by a number k.


math/shuffle-in-place function source

(shuffle-in-place xs)

Generate random permutation of the array xs which is shuffled in place.


math/sign function source

(sign x)

Sign function.


math/size function source

(size m)

Returns tuple with the matrix m size [rows cols].


math/slice-m function source

(slice-m m rslice cslice)

Slice a matrix m by rows and columns.


math/sop function source

(sop m op & a)

Mutates every cell of the matrix m with op and variadic args a.


math/squeeze function source

(squeeze m)

Concatenate a list of rows into a single row. Does not mutate m.


math/standard-deviation function source

(standard-deviation xs)

Gets the standard deviation from ds.


math/standard-normal-table tuple source

Computed standard normal table.


math/subtract function source

(subtract v1 v2)

Elementwise subtract vector v2 from v1.


math/sum-compensated function source

(sum-compensated xs)

Returns sum of the members of xs with Kahan-Babushka algorithm.


math/sum-nth-power-deviations function source

(sum-nth-power-deviations xs n)

Get the sum of deviations to the n power.


math/svd function source

(svd m &opt n-iter)

Simple Singular-Value-Decomposition based on repeated QR decomposition. The algorithm converges at O(n^3).


math/swap function source

(swap arr i j)

Swaps members with indices i and j of arr. Noop when i equals j.


math/t-test function source

(t-test xs expv)

Computes one sample t-test comparing the mean of xs to known value expv.


math/t-test-2 function source

(t-test-2 xs ys &opt d)

Computes two sample t-test of two samples xs and ys with difference optional d which defaults to 0.


math/trans function source

(trans m)

Tansposes a list of row vectors.


math/unit-e function source

(unit-e n k)

Unit vector of n dimensions along dimension k.


math/variance function source

(variance xs)

Get the variance from the xs.


math/z-score function source

(z-score x m d)

Gets the standard score for number x from mean m and standard deviation d.


math/zero function source

(zero c &opt r)

Creates vector of length c, or matrix if r is provided, and fills it with zeros.