Liking cljdoc? Tell your friends :D

std.math


absclj

(abs x)

returns the absolute value of x

(abs -7) => 7 (abs 7) => 7

returns the absolute value of `x`

(abs -7) => 7
(abs 7) => 7
raw docstring

aggregatesclj

(aggregates arr)
(aggregates arr ks)
(aggregates arr ks m)

finds the aggregates of the array

(aggregates [1 2 3 3 4 5]) => (contains {:min 1, :mean 3.0, :stdev 1.4142135623730951, :skew 0.0, :mode [3], :variance 2, :median 3, :max 5, :random number?, :middle 3, :first 1, :last 5, :sum 18, :range 4})

(aggregates [1 2 3 3 4 5] [:sum] {:product #(apply * %)}) => {:sum 18, :product 360}

finds the aggregates of the array

(aggregates [1 2 3 3 4 5])
=> (contains
    {:min 1, :mean 3.0, :stdev 1.4142135623730951,
     :skew 0.0, :mode [3], :variance 2, :median 3, :max 5,
     :random number?, :middle 3, :first 1, :last 5, :sum 18, :range 4})

(aggregates [1 2 3 3 4 5] [:sum]
            {:product #(apply * %)})
=> {:sum 18, :product 360}
raw docstring

ceilclj

(ceil x)

finds the ceiling of a number

(ceil 0.1) => 1

finds the ceiling of a number

(ceil 0.1)
=> 1
raw docstring

combinatorialclj

(combinatorial n i)

calculates the result of n choose i

(combinatorial 4 2) => 6

(combinatorial 4 3) => 4

calculates the result of `n` choose `i`

(combinatorial 4 2) => 6

(combinatorial 4 3) => 4
raw docstring

factorialclj

(factorial n)

calculates the factorial of n

(factorial 4) => 24

(factorial 10) => 3628800

calculates the factorial of `n`

(factorial 4) => 24

(factorial 10) => 3628800
raw docstring

floorclj

(floor x)

finds the floor of a number

(floor 0.1) => 0

finds the floor of a number

(floor 0.1)
=> 0
raw docstring

histogramclj

(histogram xs)
(histogram xs n)

creates a histogram of values

(histogram [1 2 3 3 5 5 7 7 8 8 9] 4) => [4 2 2 3]

creates a histogram of values

(histogram [1 2 3 3 5 5 7 7 8 8 9] 4)
=> [4 2 2 3]
raw docstring

kurtosisclj

(kurtosis xs)
(kurtosis xs stdev)

calculates the kurtosis of the data

(kurtosis [4 5 2 9 5 7 4 5 4]) => (approx 2.4722)

calculates the kurtosis of the data

(kurtosis [4 5 2 9 5 7 4 5 4])
=> (approx 2.4722)
raw docstring

logclj

(log b x)

calculates the logarithm base b of x

(log 2 2) => 1.0

(log 4 16) => 2.0

calculates the logarithm base `b` of `x`

(log 2 2) => 1.0

(log 4 16) => 2.0
raw docstring

log10clj

(log10 x)

calculates the log base 10 of x

(log10 2) => 0.3010299956639812

(log10 10) => 1.0

calculates the log base 10 of `x`

(log10 2) => 0.3010299956639812

(log10 10) => 1.0
raw docstring

logeclj

(loge x)

calculates the natural log of x

(loge 2) => 0.6931471805599453

(loge 10) => 2.302585092994046

calculates the natural log of `x`

(loge 2) => 0.6931471805599453

(loge 10) => 2.302585092994046
raw docstring

meanclj

(mean xs)

calculates the average value of a set of data

(mean [1 2 3 4 5]) => 3

(mean [1 1.6 7.4 10]) => 5.0

calculates the average value of a set of data

(mean [1 2 3 4 5])
=> 3

(mean [1 1.6 7.4 10])
=> 5.0
raw docstring

medianclj

(median xs)

calculates the middle value of a set of data

(median [5 2 4 1 3]) => 3

(median [7 0 2 3]) => 5/2

calculates the middle value of a set of data

(median [5 2 4 1 3])
=> 3

(median [7 0 2 3])
=> 5/2
raw docstring

modeclj

(mode xs)

calculates the most frequent value of a set of data

(mode [:alan :bob :alan :greg]) => [:alan]

(mode [:smith :carpenter :doe :smith :doe]) => [:smith :doe]

calculates the most frequent value of a set of data

(mode [:alan :bob :alan :greg])
=> [:alan]

(mode [:smith :carpenter :doe :smith :doe])
=> [:smith :doe]
raw docstring

randclj

(rand)
(rand rng)

returns a random double between 0 and 1

(rand) ;;0.19755427425784822 => number?

(rand (rand-gen)) ;;0.8479218396605446 => number?

returns a random double between 0 and 1

(rand)
;;0.19755427425784822
=> number?

(rand (rand-gen))
;;0.8479218396605446
=> number?
raw docstring

rand-digitsclj

(rand-digits n)

constructs a n digit string

(rand-digits 10) ;; "9417985847" => string?

constructs a n digit string

(rand-digits 10)
;; "9417985847"
=> string?
raw docstring

rand-intclj

(rand-int n)
(rand-int n rng)

returns a random integer less than n

(rand-int 100) ;; 16 => integer?

returns a random integer less than `n`

(rand-int 100)
;; 16
=> integer?
raw docstring

rand-nthclj

(rand-nth coll)
(rand-nth coll rng)

returns a random element in an array

(rand-nth [:a :b :c]) => #{:a :b :c}

returns a random element in an array

(rand-nth [:a :b :c])
=> #{:a :b :c}
raw docstring

rand-sampleclj

(rand-sample coll proportions)

takes from the collection given specified proportions

(rand-sample [:a :b :c] [1 2 3]) => keyword?

takes from the collection given specified proportions

(rand-sample [:a :b :c] [1 2 3])
=> keyword?
raw docstring

rand-seed!clj

(rand-seed! seed)
(rand-seed! rng seed)

sets the seed of a given random number generator

(-> (rand-gen) (rand-seed! 10) (rand)) => (any 0.77132064549269 0.5711645232847797)

sets the seed of a given random number generator

(-> (rand-gen)
    (rand-seed! 10)
    (rand))
=> (any 0.77132064549269
        0.5711645232847797)
raw docstring

skewclj

(skew xs)
(skew xs stdev)

calculates the skewedness of the data

(skew [4 5 2 9 5 7 4 5 4]) => (approx 0.5833)

calculates the skewedness of the data

(skew [4 5 2 9 5 7 4 5 4])
=> (approx 0.5833)
raw docstring

stdevclj

(stdev xs)

calculates the standard deviation for a set of data

(stdev [4 5 2 9 5 7 4 5 4]) => 2.0

calculates the standard deviation for a set of data

(stdev [4 5 2 9 5 7 4 5 4])
=> 2.0
raw docstring

varianceclj

(variance xs)

calculates the average of the squared differences from the mean

(variance [4 5 2 9 5 7 4 5 4]) => 4

calculates the average of the squared differences from the mean

(variance [4 5 2 9 5 7 4 5 4])
=> 4
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close