Examples
(sfrac 0.555)
diff --git a/docs/fastmath.easings.html b/docs/fastmath.easings.html
index 905ba259..d26c49ea 100755
--- a/docs/fastmath.easings.html
+++ b/docs/fastmath.easings.html
@@ -1,6 +1,6 @@
-fastmath.easings documentation fastmath.easings Easing functions.
+
fastmath.easings documentation fastmath.easings Code snippets Save incanter graph
(defn save-graph
[f params & opts]
(let [fname (str "images/e/" (first opts) ".png")]
diff --git a/docs/fastmath.fields.html b/docs/fastmath.fields.html
index cec48b67..716dc5fa 100755
--- a/docs/fastmath.fields.html
+++ b/docs/fastmath.fields.html
@@ -1,6 +1,6 @@
-fastmath.fields documentation fastmath.fields Vector field functions.
+
fastmath.fields documentation fastmath.fields Vector field functions.
Vector fields are functions R^2->R^2.
Names are taken from fractal flames world where such fields are call variations
. Most implementations are taken from JWildfire software.
Creation
@@ -70,7 +70,7 @@
Combinations
:angles
- vector field from angles
See random-configuration for example.
Examples Create random combination
(let [f (combine)] (f (v/vec2 -0.5 0.5)))
-;;=> #vec2 [-1.0582525085584098, -0.6653935508251817]
Create combination for given configuration
(let [conf {:type :operation,
+;;=> #vec2 [0.04272272840444622, 0.12590519239639839]
Create combination for given configuration
(let [conf {:type :operation,
:name :comp,
:var1 {:type :variation,
:name :blocky,
@@ -99,22 +99,22 @@ Combinations
;;=> 1.5302948024685854
field multimethod
Return vector field for given name and options: amount (scaling factor) and parametrization.
Default scaling factor is 1.0, default parametrization is random.
Resulting function operates on Vec2 type.
Examples Get vector field by name
(field :sinusoidal)
-;;=> fastmath.fields$make_sinusoidal$fn__30681@457a8955
+;;=> fastmath.fields$make_sinusoidal$fn__30694@4fb4bccf
((field :sinusoidal) (v/vec2 m/HALF_PI m/HALF_PI))
;;=> #vec2 [1.0, 1.0]
Get vector field by name and scale
(field :sinusoidal 0.5)
-;;=> fastmath.fields$make_sinusoidal$fn__30681@35a40528
+;;=> fastmath.fields$make_sinusoidal$fn__30694@2a22e0f3
((field :sinusoidal 0.5) (v/vec2 m/HALF_PI m/HALF_PI))
;;=> #vec2 [0.5, 0.5]
Apply parametrization
(let [params (parametrization :cpow3)
f (field :cpow3 1.0 params)]
{:parametrization params, :value (f (v/vec2 -1.0 1.0))})
-;;=> {:parametrization {:a 0.2390632902006118,
-;;=> :discrete-spread 0.3409036761239128,
-;;=> :divisor -1.242769534325375,
-;;=> :offset2 1.1598996423386776,
-;;=> :r -1.0267461419631134,
-;;=> :spread 1.4761457093452472,
-;;=> :spread2 1.2783981375938427},
-;;=> :value #vec2 [1.1173761044548094, -0.28228041337605625]}
fields-list
Examples List of all vector field names.
(sort fields-list)
+;;=> {:parametrization {:a 1.2936893322653744,
+;;=> :discrete-spread -0.2536334691752896,
+;;=> :divisor -1.9948892988173217,
+;;=> :offset2 1.2125436091635144,
+;;=> :r 0.6709936008753878,
+;;=> :spread -0.7578949299360351,
+;;=> :spread2 -0.6251667925228239},
+;;=> :value #vec2 [1.1168973437573764, 0.011149383419789733]}
fields-list
Examples List of all vector field names.
(sort fields-list)
;;=> (:arch
;;=> :asteria
;;=> :atan :auger
@@ -277,68 +277,54 @@ Combinations
Optinally you can pass part of the parametrization. In this case function will add remaining keys with randomly generated values.
If field doesn’t have parametrization, empty map will be returned.
See field .
Examples Get random parametrization for given field
(parametrization :auger)
-;;=> {:freq 0.996038265527873,
-;;=> :scale 1.5614922602882713,
-;;=> :sym -1.7897302163543403,
-;;=> :weight 0.4304604009686175}
Add lacking fields
(parametrization :auger {:scale 1.0, :freq 1.0})
+;;=> {:freq 3.8333914573980934,
+;;=> :scale -1.6793051288069232,
+;;=> :sym -0.6076386109834693,
+;;=> :weight -0.42212616248182844}
Add lacking fields
(parametrization :auger {:scale 1.0, :freq 1.0})
;;=> {:freq 1.0,
;;=> :scale 1.0,
-;;=> :sym 1.1604085298676936,
-;;=> :weight 0.764946365382402}
Returns empty map when field doesn’t have parametrization
(parametrization :sinusoidal)
+;;=> :sym 1.5928500334721458,
+;;=> :weight -0.9713306336457626}
Returns empty map when field doesn’t have parametrization
(parametrization :sinusoidal)
;;=> {}
random-configuration (random-configuration)
(random-configuration depth)
(random-configuration depth f)
Create random configuration for combine function. Optionally with depth (0 = only root is created).
See combine for structure.
Bind *skip-random-fields*
to true to exclude fields which are random.
Examples Generate random configuration
(random-configuration)
+;;=> {:amount 1.0, :config {}, :name :spherical, :type :variation}
One node configuration
(random-configuration 0)
;;=> {:amount 1.0,
-;;=> :name :comp,
-;;=> :type :operation,
-;;=> :var1
-;;=> {:amount 1.0,
-;;=> :name :comp,
-;;=> :type :operation,
-;;=> :var1
-;;=> {:amount 1.0,
-;;=> :name :comp,
-;;=> :type :operation,
-;;=> :var1 {:amount 1.0, :config {}, :name :besselj, :type :variation},
-;;=> :var2 {:amount 1.0, :config {}, :name :horseshoe, :type :variation}},
-;;=> :var2 {:amount 1.0, :config {}, :name :swirl, :type :variation}},
-;;=> :var2 {:amount 1.0,
-;;=> :config {:d1 -0.40134533717371834,
-;;=> :d2 -1.0350466082057443,
-;;=> :r1 2.634209728882775,
-;;=> :r2 0.7207839073777886},
-;;=> :name :trade,
-;;=> :type :variation}}
One node configuration
(random-configuration 0)
-;;=> {:amount 1.0, :config {}, :name :hemisphere, :type :variation}
Configuration with depth 2
(random-configuration 2)
+;;=> :config {:distance 0.054860550963109045, :radius 1.0872224802992538},
+;;=> :name :emod,
+;;=> :type :variation}
Configuration with depth 2
(random-configuration 2)
;;=> {:amount 1.0,
;;=> :name :comp,
;;=> :type :operation,
;;=> :var1 {:amount 1.0,
-;;=> :name :comp,
+;;=> :name :add,
;;=> :type :operation,
-;;=> :var1 {:amount 1.0,
-;;=> :config {:coeff10 -0.721136725623662,
-;;=> :coeff11 0.7386087825101102,
-;;=> :coeff20 -0.9275878473253583,
-;;=> :coeff21 1.9624814538837034},
-;;=> :name :waves,
+;;=> :var1 {:amount -0.6560355477941067,
+;;=> :config {:x 1.2532694475908999, :y 0.7377233371677647},
+;;=> :name :splits,
;;=> :type :variation},
-;;=> :var2
-;;=> {:amount 1.0, :config {}, :name :petal, :type :variation}},
-;;=> :var2 {:amount 1.0, :config {}, :name :rays2, :type :variation}}
randomize-configuration (randomize-configuration f)
Randomize values for given configuration. Keeps structure untouched.
Examples Usage
(let [conf {:type :variation,
+;;=> :var2 {:amount -0.03833751806087493,
+;;=> :config {},
+;;=> :name :miller,
+;;=> :type :variation}},
+;;=> :var2 {:amount 1.0,
+;;=> :config {:xsplit 6.077283447119191, :ysplit -2.160096812677849},
+;;=> :name :split,
+;;=> :type :variation}}
randomize-configuration (randomize-configuration f)
Randomize values for given configuration. Keeps structure untouched.
Examples Usage
(let [conf {:type :variation,
:name :blocky,
:amount 1.0,
:config {:x -1.4, :y 0.9, :mp 2.6}}]
[(randomize-configuration conf) (randomize-configuration conf)])
;;=> [{:amount 1.0,
-;;=> :config {:mp -3.7827726391591416,
-;;=> :x 1.0026445070840058,
-;;=> :y -1.080065811133916},
+;;=> :config {:mp 3.688168859670335,
+;;=> :x -1.3078135229931176,
+;;=> :y -1.0747112047699148},
;;=> :name :blocky,
;;=> :type :variation}
;;=> {:amount 1.0,
-;;=> :config
-;;=> {:mp 5.082081761267338, :x 1.051189594802358, :y -0.5150452243610762},
+;;=> :config {:mp 0.25906353384380704,
+;;=> :x 0.569510187094301,
+;;=> :y 1.0059823939966894},
;;=> :name :blocky,
;;=> :type :variation}]
scalar->vector-field (scalar->vector-field scalar f)
(scalar->vector-field scalar f1 f2)
Returns vector field build from scalar fields of the input vector and result of the vector field.
Examples Usage
(let [f (scalar->vector-field v/heading (field :sinusoidal))]
(v/applyf (f (v/vec2 m/HALF_PI m/HALF_PI)) m/degrees))
diff --git a/docs/fastmath.interpolation.html b/docs/fastmath.interpolation.html
index 674afd8a..3b72bb07 100755
--- a/docs/fastmath.interpolation.html
+++ b/docs/fastmath.interpolation.html
@@ -1,6 +1,6 @@
-fastmath.interpolation documentation fastmath.interpolation 1d, 2d interpolation functions.
+
fastmath.interpolation documentation fastmath.interpolation 1d, 2d interpolation functions.
See more:
Apache Commons Math
diff --git a/docs/fastmath.random.html b/docs/fastmath.random.html
index 68c8d6e6..eb0681e8 100755
--- a/docs/fastmath.random.html
+++ b/docs/fastmath.random.html
@@ -1,6 +1,6 @@
-fastmath.random documentation fastmath.random Various random and noise functions.
+
fastmath.random documentation fastmath.random Various random and noise functions.
Namespace defines various random number generators (RNGs), different types of random functions, sequence generators and noise functions.
RNGs
You can use a selection of various RNGs defined in Apache Commons Math library.
@@ -78,16 +78,16 @@
Distribution
;;=> false
(brand 0.1)
;;=> false
Count number of true
values with probability 0.15
(count (filter true? (repeatedly 100000 (fn* [] (brand 0.15)))))
-;;=> 14969
default-rng
Examples Usage
(set-seed! default-rng 111)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@6fc06ec4
+;;=> 14698
default-rng
Examples Usage
(set-seed! default-rng 111)
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@41614251
(irandom default-rng)
;;=> -1641157356
(set-seed! default-rng 999)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@6fc06ec4
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@41614251
(irandom default-rng)
;;=> -421961713
(set-seed! default-rng 111)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@6fc06ec4
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@41614251
(irandom default-rng)
;;=> -1641157356
discrete-noise macro (discrete-noise X Y)
(discrete-noise X)
Discrete noise. Parameters:
@@ -139,9 +139,9 @@ Integer di
:uniform-int
- :lower
(default: 0) and :upper
(default: Integer/MAX_VALUE
)
:zipf
- :number-of-elements
(default: 100) and :exponent
(default: 3.0)
Examples Usage
(distribution :beta)
-;;=> org.apache.commons.math3.distribution.BetaDistribution@5deb1292
+;;=> org.apache.commons.math3.distribution.BetaDistribution@6ea1a97b
(distribution :beta {:alpha 1.0, :beta 1.0})
-;;=> org.apache.commons.math3.distribution.BetaDistribution@45ef593f
PDFs of beta
PDFs of binomial
PDFs of cauchy
PDFs of chi-squared
PDFs of empirical
PDFs of enumerated-int
PDFs of enumerated-real
PDFs of exponential
PDFs of f
PDFs of gamma
PDFs of geometric
PDFs of gumbel
PDFs of hypergeometric
PDFs of laplace
PDFs of levy
PDFs of log-normal
PDFs of logistic
PDFs of nakagami
PDFs of normal
PDFs of pareto
PDFs of pascal
PDFs of poisson
PDFs of t
PDFs of triangular
PDFs of uniform-int
PDFs of uniform-real
PDFs of weibull
PDFs of zipf
DistributionProto protocol
Get information from distributions.
members cdf (cdf d v)
(cdf d v1 v2)
Examples Usage
(cdf (distribution :gamma) 1)
+;;=> org.apache.commons.math3.distribution.BetaDistribution@3c3b70b7
PDFs of beta
PDFs of binomial
PDFs of cauchy
PDFs of chi-squared
PDFs of empirical
PDFs of enumerated-int
PDFs of enumerated-real
PDFs of exponential
PDFs of f
PDFs of gamma
PDFs of geometric
PDFs of gumbel
PDFs of hypergeometric
PDFs of laplace
PDFs of levy
PDFs of log-normal
PDFs of logistic
PDFs of nakagami
PDFs of normal
PDFs of pareto
PDFs of pascal
PDFs of poisson
PDFs of t
PDFs of triangular
PDFs of uniform-int
PDFs of uniform-real
PDFs of weibull
PDFs of zipf
DistributionProto protocol
Get information from distributions.
members cdf (cdf d v)
(cdf d v1 v2)
Examples Usage
(cdf (distribution :gamma) 1)
;;=> 0.09020401043104985
(cdf (distribution :gamma) 1 4)
;;=> 0.5037901398591113
icdf (icdf d p)
Inversed cumulative probability
Examples Usage
(icdf (distribution :gamma) 0.5)
@@ -191,11 +191,11 @@ Integer di
(lrand 10 20)
;;=> 18
noise (noise x)
(noise x y)
(noise x y z)
Create improved Perlin Noise.
6 octaves, quintic interpolation.
Examples Usage
(noise 3.3)
-;;=> 0.40129980952380967
+;;=> 0.7685663492063489
(noise 3.3 1.1)
-;;=> 0.5933656291555558
+;;=> 0.6151081093282538
(noise 3.3 0.0 -0.1)
-;;=> 0.42132102590984155
2d noise
noise-types
List of possible noise types as a map of names and values.
Examples List of names (keys)
(keys noise-types)
+;;=> 0.47516700281904745
2d noise
noise-types
List of possible noise types as a map of names and values.
Examples List of names (keys)
(keys noise-types)
;;=> (:value :gradient :simplex)
random-noise-cfg (random-noise-cfg)
Create random noise configuration.
Examples Random configuration
(random-noise-cfg)
;;=> {:gain 0.4616632689024004,
;;=> :interpolation :hermite,
@@ -204,9 +204,9 @@ Integer di
;;=> :normalize? true,
;;=> :octaves 5,
;;=> :seed -1927726348}
Create function
(random-noise-fn)
-;;=> fastmath.random$ridgedmulti_noise$fn__9831@467e6dc2
+;;=> fastmath.random$fbm_noise$fn__9836@cfdfc94
(random-noise-fn (random-noise-cfg))
-;;=> fastmath.random$ridgedmulti_noise$fn__9831@3041795b
One
Two
Three
random-noise-fn (random-noise-fn cfg)
(random-noise-fn)
Create random noise function from all possible options.
+;;=> fastmath.random$billow_noise$fn__9840@3b38c606
One
Two
Three
random-noise-fn (random-noise-fn cfg)
(random-noise-fn)
Create random noise function from all possible options.
Optionally provide own configuration cfg
. In this case one of 4 different blending methods will be selected.
randval macro (randval v1 v2)
(randval prob v1 v2)
Retrun value with given probability (default 0.5)
Examples Usage
(randval :val-one :val-two)
;;=> :val-two
(randval 0.001 :low-probability :high-probability)
@@ -217,9 +217,9 @@ Integer di
{:octaves 3, :lacunarity 2.1, :gain 0.7, :noise-type :simplex})]
(n 0.5 1.1 -1.3))
;;=> 0.5497357888943046
2d noise
rng multimethod
Create RNG for given name (as keyword) and optional seed. Return object enhanced with RNGProto . See: rngs-list for names.
Examples Creating
(rng :mersenne)
-;;=> org.apache.commons.math3.random.MersenneTwister@62c3b8ca
+;;=> org.apache.commons.math3.random.MersenneTwister@5ada7af1
(rng :isaac 1234)
-;;=> org.apache.commons.math3.random.ISAACRandom@73cae081
Using
(irandom (rng :mersenne 999) 15 25)
+;;=> org.apache.commons.math3.random.ISAACRandom@728a778c
Using
(irandom (rng :mersenne 999) 15 25)
;;=> 17
RNGProto protocol
Defines set of random functions for different RNGs or distributions returning primitive values.
members ->seq (->seq t)
(->seq t n)
Returns sequence of random samples limited to optional n
values.
Examples Sequence of random values from distribution
(->seq (distribution :gamma) 5)
;;=> (1.3985071121468868
;;=> 1.9713574080234095
@@ -227,28 +227,28 @@ Integer di
;;=> 1.5751629265513674
;;=> 3.0898296399038285)
brandom (brandom t)
(brandom t thr)
Boolean random. Returns true or false with equal probability. You can set probability for true
setting thr
(from [0-1]
range).
See brand .
Examples boolean
(rngproto-snippet brandom ...)
-;;=> true
drandom (drandom t)
(drandom t mx)
(drandom t mn mx)
Random double.
+;;=> false
drandom (drandom t)
(drandom t mx)
(drandom t mn mx)
Random double.
For RNGs: As default returns random double from [0,1)
range. When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
See drand .
For distributions, just returns random double (call without parameters).
Examples double
(rngproto-snippet drandom ...)
-;;=> 0.49840740941644635
Double random value from distribution
(drandom (distribution :gamma))
+;;=> 0.5552654729108655
Double random value from distribution
(drandom (distribution :gamma))
;;=> 1.7209575348841526
frandom (frandom t)
(frandom t mx)
(frandom t mn mx)
Random float.
For RNGs: As default returns random float from [0,1)
range. When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
See frand .
For distributions, just returns random float (call without parameters).
Examples float
(rngproto-snippet frandom ...)
-;;=> 0.7009547
Float random value from distribution (sample cast to float
)
(frandom (distribution :gamma))
+;;=> 0.5646241
Float random value from distribution (sample cast to float
)
(frandom (distribution :gamma))
;;=> 3.6556783
grandom (grandom t)
(grandom t std)
(grandom t mean std)
Random double from gaussian distribution. As default returns random double from N(0,1)
. When std
is passed, N(0,std)
is used. When mean
is passed, distribution is set to N(mean, std)
.
See grand .
Examples gaussian double
(rngproto-snippet grandom ...)
-;;=> -0.10977607811588186
irandom (irandom t)
(irandom t mx)
(irandom t mn mx)
Random integer.
+;;=> 0.009325068798035673
irandom (irandom t)
(irandom t mx)
(irandom t mn mx)
Random integer.
For RNGs: As default returns random integer from full integer range. When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
See irand .
For distributions, just returns random integer (call without parameters).
Examples integer
(rngproto-snippet irandom ...)
-;;=> -1808761782
Integer random value from distribution (sample cast to int
)
(irandom (distribution :gamma))
+;;=> 797977753
Integer random value from distribution (sample cast to int
)
(irandom (distribution :gamma))
;;=> 4
lrandom (lrandom t)
(lrandom t mx)
(lrandom t mn mx)
Random long.
For RNGs: As default returns random long from full long range. When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
See lrand .
For distributions, just returns random long (call without parameters).
Examples long
(rngproto-snippet lrandom ...)
-;;=> -1928603142821632953
Long random value from distribution (sample cast to long
)
(lrandom (distribution :gamma))
+;;=> 1852764628919625667
Long random value from distribution (sample cast to long
)
(lrandom (distribution :gamma))
;;=> 0
set-seed! (set-seed! t v)
Sets seed. Returns RNG or distribution itself.
Examples Set seed for the RNG object
(let [rng (rng :isaac)]
(set-seed! rng 1234)
(irandom rng 10 15))
@@ -272,15 +272,15 @@ Integer di
;;=> #vec2 [0.125, 0.8888888888888888])
Usage (1d)
(let [gen (sequence-generator :sobol 1)] (take 5 (gen)))
;;=> (0.0 0.5 0.75 0.25 0.375)
Halton plot (1000 samples)
Sobol plot (1000 samples)
Sphere plot (1000 samples)
Gaussian plot (1000 samples)
Default plot (1000 samples)
sequence-generators-list
Examples Generator names.
(sort sequence-generators-list)
;;=> (:default :gaussian :halton :sobol :sphere)
simplex (simplex x)
(simplex x y)
(simplex x y z)
Create Simplex noise. 6 octaves.
Examples Usage
(simplex 3.3)
-;;=> 0.6254018086666667
+;;=> 0.5705071665447622
(simplex 3.3 1.1)
-;;=> 0.37981939206247883
+;;=> 0.3876737663781137
(simplex 3.3 0.0 -0.1)
-;;=> 0.5911461793716118
2d noise
single-noise
Examples Usage
(let [n (single-noise {:interpolation :linear})] (n 0.5 1.1 -1.3))
+;;=> 0.37839408321902135
2d noise
single-noise
Examples Usage
(let [n (single-noise {:interpolation :linear})] (n 0.5 1.1 -1.3))
;;=> 0.627
2d noise
vnoise (vnoise x)
(vnoise x y)
(vnoise x y z)
Value Noise.
6 octaves, Hermite interpolation (cubic, h01).
Examples Usage
(vnoise 3.3)
-;;=> 0.34614236374728513
+;;=> 0.5946757283025378
(vnoise 3.3 1.1)
-;;=> 0.3861433885179107
+;;=> 0.7503525937304953
(vnoise 3.3 0.0 -0.1)
-;;=> 0.4768238162791867
2d noise
\ No newline at end of file
+;;=> 0.5069293808908999
2d noise
\ No newline at end of file
diff --git a/docs/fastmath.rbf.html b/docs/fastmath.rbf.html
index be405e81..881895d8 100755
--- a/docs/fastmath.rbf.html
+++ b/docs/fastmath.rbf.html
@@ -1,6 +1,6 @@
-
fastmath.rbf documentation fastmath.rbf Radial Basis Function
+
fastmath.rbf documentation fastmath.rbf Radial Basis Function
Create with multifunction rbf .
All of them accept scaling factor scale
. Only polyharmonic is defined with integer exponent k
. See rbfs-list for all names.
rbf-obj returns SMILE library object for defined function.
Code snippets Save graph
(defn save-graph
diff --git a/docs/fastmath.stats.html b/docs/fastmath.stats.html
index 626b4edb..0defb9a2 100755
--- a/docs/fastmath.stats.html
+++ b/docs/fastmath.stats.html
@@ -1,6 +1,6 @@
-fastmath.stats documentation fastmath.stats Statistics functions.
+
fastmath.stats documentation fastmath.stats Statistics functions.
Descriptive statistics for sequence.
Correlation / covariance of two sequences.
@@ -47,7 +47,7 @@ Other
Normalize samples to have mean=0 and standard deviation = 1 with standardize .
-histogram to count samples in evenly spaced ranges.
adjacent-values (adjacent-values vs)
(adjacent-values vs estimation-strategy)
(adjacent-values vs q1 q3)
Lower and upper adjacent values (LAV and UAV).
+
histogram to count samples in evenly spaced ranges.
adjacent-values (adjacent-values vs)
(adjacent-values vs estimation-strategy)
(adjacent-values vs q1 q3)
Lower and upper adjacent values (LAV and UAV).
Let Q1 is 25-percentile and Q3 is 75-percentile. IQR is (- Q3 Q1)
.
LAV is smallest value which is greater or equal to the LIF = (- Q1 (* 1.5 IQR))
.
@@ -55,13 +55,25 @@ Other
Optional estimation-strategy
argument can be set to change quantile calculations estimation type. See estimation-strategies .
Examples [LAV, UAV]
(adjacent-values [1 2 3 -1 -1 2 -1 11 111])
;;=> [-1.0 11.0]
Gaussian distribution [LAV, UAV]
(adjacent-values (repeatedly 1000000 r/grand))
-;;=> [-2.7000857687493234 2.6996610841795916]
correlation (correlation vs1 vs2)
Correlation of two sequences.
Examples Correlation of uniform and gaussian distribution samples.
(correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
+;;=> [-2.7000857687493234 2.6996610841795916]
correlation (correlation vs1 vs2)
Correlation of two sequences.
Examples Correlation of uniform and gaussian distribution samples.
(correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
(repeatedly 100000 (partial r/drand -10.0 -5.0)))
-;;=> 0.00678949591847233
covariance (covariance vs1 vs2)
Covariance of two sequences.
Examples Covariance of uniform and gaussian distribution samples.
(covariance (repeatedly 100000 (partial r/grand 1.0 10.0))
+;;=> 0.00678949591847233
covariance (covariance vs1 vs2)
Covariance of two sequences.
Examples Covariance of uniform and gaussian distribution samples.
(covariance (repeatedly 100000 (partial r/grand 1.0 10.0))
(repeatedly 100000 (partial r/drand -10.0 -5.0)))
-;;=> -0.0019254850635683056
estimation-strategies-list
Examples List of estimation strategies for percentile
(keys estimation-strategies-list)
-;;=> (:r7 :r6 :r8 :r2 :r9 :r3 :r1 :legacy :r4 :r5)
extent (extent vs)
Return extent (min, max) values from sequence
Examples min/max from gaussian distribution
(extent (repeatedly 100000 r/grand))
-;;=> [-4.284832010490651 4.5215900810413405]
histogram (histogram vs bins)
(histogram vs bins [mn mx])
Calculate histogram.
+;;=> -0.0019254850635683056
estimate-bins (estimate-bins vs)
(estimate-bins vs method)
Estimate number of bins for histogram.
+
Possible methods are: :sqrt
:sturges
:rice
:doane
:scott
:freedman-diaconis
(default).
Examples Estimate number of bins for various methods. vs
contains 1000 random samples from Log-Normal distribution.
(estimate-bins vs :sqrt)
+;;=> 31
+(estimate-bins vs :sturges)
+;;=> 11
+(estimate-bins vs :rice)
+;;=> 20
+(estimate-bins vs :doane)
+;;=> 17
+(estimate-bins vs :scott)
+;;=> 53
+(estimate-bins vs :freedman-diaconis)
+;;=> 170
estimation-strategies-list
Examples List of estimation strategies for percentile
(sort (keys estimation-strategies-list))
+;;=> (:legacy :r1 :r2 :r3 :r4 :r5 :r6 :r7 :r8 :r9)
extent (extent vs)
Return extent (min, max) values from sequence
Examples min/max from gaussian distribution
(extent (repeatedly 100000 r/grand))
+;;=> [-4.284832010490651 4.5215900810413405]
histogram (histogram vs)
(histogram vs bins-or-estimate-method)
(histogram vs bins [mn mx])
Calculate histogram.
Returns map with keys:
:size
- number of bins
@@ -70,54 +82,79 @@ Other
:min
- min value
:max
- max value
:samples
- number of used samples
- Examples 3 bins from uniform distribution.
(histogram (repeatedly 1000 rand) 3)
-;;=> {:bins ([6.63270885468914E-4 366 0.366]
-;;=> [0.33351091479992095 311 0.311]
-;;=> [0.666358558714373 323 0.323]),
-;;=> :max 0.999206202628825,
-;;=> :min 6.63270885468914E-4,
+
+For estimation methods check estimate-bins .
Examples 3 bins from uniform distribution.
(histogram (repeatedly 1000 rand) 3)
+;;=> {:bins ([0.0011006204362501437 329 0.329]
+;;=> [0.33367985012268747 316 0.316]
+;;=> [0.6662590798091248 355 0.355]),
+;;=> :max 0.9988383094955621,
+;;=> :min 0.0011006204362501437,
;;=> :samples 1000,
;;=> :size 3,
-;;=> :step 0.33284764391445204}
3 bins from uniform distribution for given range.
(histogram (repeatedly 10000 rand) 3 [0.1 0.5])
-;;=> {:bins ([0.1 1310 0.3315616299670969]
-;;=> [0.23333333333333334 1333 0.337382941027588]
-;;=> [0.3666666666666667 1308 0.3310554290053151]),
+;;=> :step 0.3325792296864373}
3 bins from uniform distribution for given range.
(histogram (repeatedly 10000 rand) 3 [0.1 0.5])
+;;=> {:bins ([0.1 1360 0.33308841538084744]
+;;=> [0.23333333333333334 1335 0.32696546656869946]
+;;=> [0.3666666666666667 1388 0.3399461180504531]),
;;=> :max 0.5,
;;=> :min 0.1,
-;;=> :samples 3951,
+;;=> :samples 4083,
;;=> :size 3,
;;=> :step 0.13333333333333333}
5 bins from normal distribution.
(histogram (repeatedly 10000 r/grand) 5)
-;;=> {:bins ([-3.8255442971705595 104 0.0104]
-;;=> [-2.3194795153248613 1970 0.197]
-;;=> [-0.8134147334791635 5407 0.5407]
-;;=> [0.6926500483665348 2369 0.2369]
-;;=> [2.1987148302122326 150 0.015]),
+;;=> {:bins ([-3.8255442971705595 103 0.0103]
+;;=> [-2.3194795153248613 1973 0.1973]
+;;=> [-0.8134147334791635 5453 0.5453]
+;;=> [0.6926500483665348 2325 0.2325]
+;;=> [2.1987148302122326 146 0.0146]),
;;=> :max 3.7047796120579304,
;;=> :min -3.8255442971705595,
;;=> :samples 10000,
;;=> :size 5,
-;;=> :step 1.506064781845698}
jensen-shannon-divergence (jensen-shannon-divergence vs1 vs2)
Jensen-Shannon divergence of two sequences.
Examples Jensen-Shannon divergence
(jensen-shannon-divergence (repeatedly 100 (fn* [] (r/irand 100)))
+;;=> :step 1.506064781845698}
Estimate number of bins
(:size (histogram (repeatedly 10000 r/grand)))
+;;=> 60
Estimate number of bins, Rice rule
(:size (histogram (repeatedly 10000 r/grand) :rice))
+;;=> 44
iqr (iqr vs)
(iqr vs estimation-strategy)
Examples IQR
(iqr (repeatedly 100000 r/grand))
+;;=> 1.3507989631201418
jensen-shannon-divergence (jensen-shannon-divergence vs1 vs2)
Jensen-Shannon divergence of two sequences.
Examples Jensen-Shannon divergence
(jensen-shannon-divergence (repeatedly 100 (fn* [] (r/irand 100)))
(repeatedly 100 (fn* [] (r/irand 100))))
-;;=> 498.62287946302877
kendall-correlation (kendall-correlation vs1 vs2)
Kendall’s correlation of two sequences.
Examples Kendall’s correlation of uniform and gaussian distribution samples.
(kendall-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
+;;=> 507.81767699492116
kendall-correlation (kendall-correlation vs1 vs2)
Kendall’s correlation of two sequences.
Examples Kendall’s correlation of uniform and gaussian distribution samples.
(kendall-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
(repeatedly 100000 (partial r/drand -10.0 -5.0)))
-;;=> 8.147273472734727E-4
kullback-leibler-divergence (kullback-leibler-divergence vs1 vs2)
Kullback-Leibler divergence of two sequences.
Examples Kullback-Leibler divergence.
(kullback-leibler-divergence (repeatedly 100 (fn* [] (r/irand 100)))
+;;=> -7.405886058860589E-4
kernel-density (kernel-density vs h)
(kernel-density vs)
Creates kernel density function for given series vs
and optional bandwidth h
.
Examples Usage
(let [kd (kernel-density [0 10 10 10 10 10 10 10 10 0 0 0 0 1 1 1] 1)]
+ (map (comp m/approx kd) (range -5 15)))
+;;=> (0.0
+;;=> 0.0
+;;=> 0.0
+;;=> 0.02
+;;=> 0.09
+;;=> 0.17
+;;=> 0.15
+;;=> 0.06
+;;=> 0.01
+;;=> 0.0
+;;=> 0.0
+;;=> 0.0
+;;=> 0.0
+;;=> 0.03
+;;=> 0.12
+;;=> 0.2
+;;=> 0.12
+;;=> 0.03
+;;=> 0.0
+;;=> 0.0)
kullback-leibler-divergence (kullback-leibler-divergence vs1 vs2)
Kullback-Leibler divergence of two sequences.
Examples Kullback-Leibler divergence.
(kullback-leibler-divergence (repeatedly 100 (fn* [] (r/irand 100)))
(repeatedly 100 (fn* [] (r/irand 100))))
-;;=> 2025.8557601936284
kurtosis (kurtosis vs)
Calculate kurtosis from sequence.
Examples Kurtosis
(kurtosis [1 2 3 -1 -1 2 -1 11 111])
-;;=> 8.732515263272099
maximum (maximum vs)
Maximum value from sequence.
Examples Maximum value
(maximum [1 2 3 -1 -1 2 -1 11 111])
-;;=> 111.0
mean (mean vs)
Examples Mean (average value)
(mean [1 2 3 -1 -1 2 -1 11 111])
-;;=> 14.111111111111109
kurtosis (kurtosis vs)
Calculate kurtosis from sequence.
Examples Kurtosis
(kurtosis [1 2 3 -1 -1 2 -1 11 111])
+;;=> 8.732515263272099
maximum (maximum vs)
Maximum value from sequence.
Examples Maximum value
(maximum [1 2 3 -1 -1 2 -1 11 111])
+;;=> 111.0
mean (mean vs)
Examples Mean (average value)
(mean [1 2 3 -1 -1 2 -1 11 111])
+;;=> 14.111111111111109
minimum (minimum vs)
Minimum value from sequence.
Examples Minimum value
(minimum [1 2 3 -1 -1 2 -1 11 111])
-;;=> -1.0
mode (mode vs)
Find the value that appears most often in a dataset vs
.
+;;=> 4.0
minimum (minimum vs)
Minimum value from sequence.
Examples Minimum value
(minimum [1 2 3 -1 -1 2 -1 11 111])
+;;=> -1.0
mode (mode vs)
Find the value that appears most often in a dataset vs
.
See also modes .
Examples Example
(mode [1 2 3 -1 -1 2 -1 11 111])
;;=> -1.0
Returns lowest value when every element appears equally.
(mode [5 1 2 3 4])
-;;=> 1.0
modes (modes vs)
Find the values that appears most often in a dataset vs
.
+;;=> 1.0
modes (modes vs)
Find the values that appears most often in a dataset vs
.
Returns sequence with all most appearing values in increasing order.
See also mode .
Examples Example
(modes [1 2 3 -1 -1 2 -1 11 111])
;;=> (-1.0)
Returns lowest value when every element appears equally.
(modes [5 5 1 1 2 3 4 4])
-;;=> (1.0 4.0 5.0)
outliers (outliers vs)
(outliers vs estimation-strategy)
(outliers vs q1 q3)
Find outliers defined as values outside outer fences.
+;;=> (1.0 4.0 5.0)
outliers (outliers vs)
(outliers vs estimation-strategy)
(outliers vs q1 q3)
Find outliers defined as values outside outer fences.
Let Q1 is 25-percentile and Q3 is 75-percentile. IQR is (- Q3 Q1)
.
LOF (Lower Outer Fence) equals (- Q1 (* 3.0 IQR))
.
@@ -134,9 +171,9 @@ Other
;;=> 4.747383207352102
;;=> 4.769288560936935
;;=> 4.909931823383421
-;;=> 5.043073126955698) pearson-correlation (pearson-correlation vs1 vs2)
Pearson’s correlation of two sequences.
Examples Pearson’s correlation of uniform and gaussian distribution samples.
(pearson-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
+;;=> 5.043073126955698)
pearson-correlation (pearson-correlation vs1 vs2)
Pearson’s correlation of two sequences.
Examples Pearson’s correlation of uniform and gaussian distribution samples.
(pearson-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
(repeatedly 100000 (partial r/drand -10.0 -5.0)))
-;;=> -0.005570841963401116
percentile (percentile vs p)
(percentile vs p estimation-strategy)
Calculate percentile of a vs
.
+;;=> 0.007076444050676723
percentile (percentile vs p)
(percentile vs p estimation-strategy)
Calculate percentile of a vs
.
Percentile p
is from range 0-100.
See docs .
Optionally you can provide estimation-strategy
to change interpolation methods for selecting values. Default is :legacy
. See more here
@@ -163,11 +200,11 @@
Other
(percentile [1 2 3 -1 -1 2 -1 11 111] 85.0 :r8)
;;=> 37.66666666666675
(percentile [1 2 3 -1 -1 2 -1 11 111] 85.0 :r9)
-;;=> 34.75000000000007
population-stddev (population-stddev vs)
(population-stddev vs u)
Calculate population standard deviation of vs
.
+;;=> 34.75000000000007
population-stddev (population-stddev vs)
(population-stddev vs u)
Calculate population standard deviation of vs
.
See stddev .
Examples Population standard deviation.
(population-stddev [1 2 3 -1 -1 2 -1 11 111])
-;;=> 34.4333315406403
population-variance (population-variance vs)
(population-variance vs u)
Calculate population variance of vs
.
+;;=> 34.4333315406403
population-variance (population-variance vs)
(population-variance vs u)
Calculate population variance of vs
.
See variance .
Examples Population variance
(population-variance [1 2 3 -1 -1 2 -1 11 111])
-;;=> 1185.6543209876543
quantile (quantile vs p)
(quantile vs p estimation-strategy)
Calculate quantile of a vs
.
+;;=> 1185.6543209876543
quantile (quantile vs p)
(quantile vs p estimation-strategy)
Calculate quantile of a vs
.
Percentile p
is from range 0.0-1.0.
See docs for interpolation strategy.
Optionally you can provide estimation-strategy
to change interpolation methods for selecting values. Default is :legacy
. See more here
@@ -194,12 +231,12 @@
Other
(quantile [1 11 111 1111] 0.7 :r8)
;;=> 477.66666666666623
(quantile [1 11 111 1111] 0.7 :r9)
-;;=> 460.99999999999966
second-moment (second-moment vs)
Calculate second moment from sequence.
+;;=> 460.99999999999966
second-moment (second-moment vs)
Calculate second moment from sequence.
It’s a sum of squared deviations from the sample mean
Examples Second Moment
(second-moment [1 2 3 -1 -1 2 -1 11 111])
-;;=> 10670.888888888889
skewness (skewness vs)
Calculate kurtosis from sequence.
Examples Skewness
(skewness [1 2 3 -1 -1 2 -1 11 111])
-;;=> 2.94268445417954
spearman-correlation (spearman-correlation vs1 vs2)
Spearman’s correlation of two sequences.
Examples Spearsman’s correlation of uniform and gaussian distribution samples.
(spearman-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
+;;=> 10670.888888888889
skewness (skewness vs)
Calculate kurtosis from sequence.
Examples Skewness
(skewness [1 2 3 -1 -1 2 -1 11 111])
+;;=> 2.94268445417954
spearman-correlation (spearman-correlation vs1 vs2)
Spearman’s correlation of two sequences.
Examples Spearsman’s correlation of uniform and gaussian distribution samples.
(spearman-correlation (repeatedly 100000 (partial r/grand 1.0 10.0))
(repeatedly 100000 (partial r/drand -10.0 -5.0)))
-;;=> -0.002944189590700948
standardize (standardize vs)
Normalize samples to have mean = 0 and stddev = 1.
Examples Standardize
(standardize [1 2 3 -1 -1 2 -1 11 111])
+;;=> 6.338276569602102E-4
standardize (standardize vs)
Normalize samples to have mean = 0 and stddev = 1.
Examples Standardize
(standardize [1 2 3 -1 -1 2 -1 11 111])
;;=> (-0.3589915220998317
;;=> -0.33161081278713267
;;=> -0.30423010347443363
@@ -208,11 +245,11 @@ Other
;;=> -0.33161081278713267
;;=> -0.4137529407252298
;;=> -0.08518442897284138
-;;=> 2.652886502297062)
stats-map (stats-map vs)
(stats-map vs estimation-strategy)
Calculate several statistics of vs
and return as map.
+;;=> 2.652886502297062)
stats-map (stats-map vs)
(stats-map vs estimation-strategy)
Calculate several statistics of vs
and return as map.
Optional estimation-strategy
argument can be set to change quantile calculations estimation type. See estimation-strategies .
Examples Stats
(stats-map [1 2 3 -1 -1 2 -1 11 111])
;;=> {:IQR 8.0,
-;;=> :Kurtosis 8.732515263272099,
-;;=> :LAV -1.0,
+;;=> :Kurtosis 8.846742084858873,
+;;=> :LAV 0.0,
;;=> :LIF -13.0,
;;=> :LOF -25.0,
;;=> :MAD 3.0,
@@ -220,21 +257,21 @@ Other
;;=> :Mean 14.11111111111111,
;;=> :Median 2.0,
;;=> :Min -1.0,
-;;=> :Mode -1.0,
+;;=> :Mode 3.0,
;;=> :Outliers 1,
;;=> :Q1 -1.0,
;;=> :Q3 7.0,
;;=> :SD 34.4333315406403,
;;=> :SEM 11.477777180213435,
-;;=> :SecMoment 10670.888888888889,
+;;=> :SecMoment 10142.0,
;;=> :Size 9,
-;;=> :Skewness 2.94268445417954,
+;;=> :Skewness 2.9666775258488958,
;;=> :Total 127.0,
-;;=> :UAV 11.0,
+;;=> :UAV 9.0,
;;=> :UIF 19.0,
-;;=> :UOF 31.0}
stddev (stddev vs)
(stddev vs u)
Calculate standard deviation of vs
.
+;;=> :UOF 31.0}
stddev (stddev vs)
(stddev vs u)
Examples Standard deviation.
(stddev [1 2 3 -1 -1 2 -1 11 111])
-;;=> 36.522063346847084
sum (sum vs)
Examples Sum
(sum [1 2 3 -1 -1 2 -1 11 111])
-;;=> 127.0
variance (variance vs)
(variance vs u)
Calculate variance of vs
.
+;;=> 36.522063346847084
sum (sum vs)
Examples Sum
(sum [1 2 3 -1 -1 2 -1 11 111])
+;;=> 127.0
variance (variance vs)
(variance vs u)
Examples Variance.
(variance [1 2 3 -1 -1 2 -1 11 111])
-;;=> 1333.861111111111
\ No newline at end of file
+;;=> 1333.861111111111
\ No newline at end of file
diff --git a/docs/fastmath.transform.html b/docs/fastmath.transform.html
index 6fcaa7f7..31a83983 100755
--- a/docs/fastmath.transform.html
+++ b/docs/fastmath.transform.html
@@ -1,6 +1,6 @@
-fastmath.transform documentation fastmath.transform Transforms.
+
fastmath.transform documentation fastmath.transform Transforms.
See transformer and TransformProto for details.
Wavelet
Based on JWave library.
@@ -47,7 +47,7 @@
Fourier
:standard
:dft
- 1d Discrete Fourier Transform - returns double-array where even elements are real part, odd elements are imaginary part.
Examples Usage
(transformer :packet :discrete-mayer)
-;;=> jwave.transforms.WaveletPacketTransform@3bdefdf