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 81b02189..ec18206c 100755
--- a/docs/fastmath.fields.html
+++ b/docs/fastmath.fields.html
@@ -1,13 +1,13 @@
-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
+
Creation
To create vector field call field multimethod with name of the field as keyword.
Some of the vector fields require additional configuration as a map of parameters as keywords and values. Call parametrization to create random one or to merge with provided.
Additionally you can provide amount
parameter which is scaling factor for vector field (default: 1.0
).
-
Derived fields
+
Derived fields
You can use several method to derive new vector field from the other one(s). Possible options are:
-
Scalar fields
+
Scalar fields
You can derive scalar fields from given vector field(s):
jacobian - determinant of jacobian matrix
@@ -25,7 +25,7 @@ Scalar fields
dot - dot product
angle-between - angle between vectors from fields.
-
Combinations
+
Combinations
The other option is to create vector field using some of the above possibilities. Combination is a tree of field operations with parametrizations. Functions:
combine - create vector field randomly of from given parametrization.
@@ -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 [0.5290833818481148, -1.1001869390540726]
Create combination for given configuration
(let [conf {:type :operation,
+;;=> #vec2 [-0.11529403328101333, -0.08097036071848729]
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__10993@c790b46
+;;=> fastmath.fields$make_sinusoidal$fn__30674@376aeed
((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__10993@4e10067d
+;;=> fastmath.fields$make_sinusoidal$fn__30674@b48be28
((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 -1.027883317179492,
-;;=> :discrete-spread 0.7910279968110224,
-;;=> :divisor 0.28827117514856804,
-;;=> :offset2 -1.855418094213078,
-;;=> :r 1.3910205700392493,
-;;=> :spread -0.6958560972015344,
-;;=> :spread2 -1.6226069692931797},
-;;=> :value #vec2 [-83948.09092212954, -95296.9692904463]}
fields-list
Examples List of all vector field names.
(sort fields-list)
+;;=> {:parametrization {:a 1.9970530148378383,
+;;=> :discrete-spread 1.4597411339770134,
+;;=> :divisor 0.6960262227580584,
+;;=> :offset2 1.2960719259024356,
+;;=> :r 1.8665653821917503,
+;;=> :spread 1.3312992716874263,
+;;=> :spread2 -1.0345115562258163},
+;;=> :value #vec2 [0.40325016867201424, 0.1353507183943091]}
fields-list
Examples List of all vector field names.
(sort fields-list)
;;=> (:arch
;;=> :asteria
;;=> :atan :auger
@@ -277,55 +277,86 @@ 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 -3.0859586681349525,
-;;=> :scale -0.9587085563264008,
-;;=> :sym 1.834501264037586,
-;;=> :weight -0.005060306756689448}
Add lacking fields
(parametrization :auger {:scale 1.0, :freq 1.0})
+;;=> {:freq 3.2229094212774427,
+;;=> :scale 1.4291359982941958,
+;;=> :sym 0.8620662941401442,
+;;=> :weight 0.5438593560884912}
Add lacking fields
(parametrization :auger {:scale 1.0, :freq 1.0})
;;=> {:freq 1.0,
;;=> :scale 1.0,
-;;=> :sym -0.0010320305160465004,
-;;=> :weight 0.3690021900469187}
Returns empty map when field doesn’t have parametrization
(parametrization :sinusoidal)
+;;=> :sym -0.5118174623638403,
+;;=> :weight -0.24666666442573715}
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 :cylinder, :type :variation}
One node configuration
(random-configuration 0)
-;;=> {:amount 1.0, :config {}, :name :foucaut, :type :variation}
Configuration with depth 2
(random-configuration 2)
-;;=> {:amount 1.0,
-;;=> :name :comp,
+;;=> {:amount 0.7412632758103176,
+;;=> :name :add,
;;=> :type :operation,
-;;=> :var1 {:amount 1.0,
+;;=> :var1 {:amount 0.05603520263329731,
;;=> :name :add,
;;=> :type :operation,
-;;=> :var1 {:amount -0.38896511052921534,
-;;=> :config {},
-;;=> :name :loonie,
+;;=> :var1 {:amount -0.5099973215388385,
+;;=> :name :comp,
+;;=> :type :operation,
+;;=> :var1 {:amount 1.0,
+;;=> :config {:distort -0.568695763777221,
+;;=> :multiplier 0.5651337111380562},
+;;=> :name :stwin,
+;;=> :type :variation},
+;;=> :var2 {:amount 1.0,
+;;=> :config {},
+;;=> :name :hemisphere,
+;;=> :type :variation}},
+;;=> :var2 {:amount -1.5355275407147722,
+;;=> :config {:distance 0.9437575560105342,
+;;=> :radius 1.705237632727735},
+;;=> :name :bmod,
+;;=> :type :variation}},
+;;=> :var2 {:amount 1.2930131485167613,
+;;=> :config {:Dens1 0.07882714218202802,
+;;=> :Dens2 0.5868500132153693,
+;;=> :K -1.7997295389810266,
+;;=> :Reverse -0.9695878806367173,
+;;=> :Sc 0.4300620755940313,
+;;=> :Seed 689712544,
+;;=> :X 18.951169603712987,
+;;=> :Y 2.5662719327495},
+;;=> :name :circlelinear,
+;;=> :type :variation}}
One node configuration
(random-configuration 0)
+;;=> {:amount 1.0, :config {}, :name :erf, :type :variation}
Configuration with depth 2
(random-configuration 2)
+;;=> {:amount 0.3654909885423369,
+;;=> :name :add,
+;;=> :type :operation,
+;;=> :var1 {:amount 0.9785045015332838,
+;;=> :name :add,
+;;=> :type :operation,
+;;=> :var1 {:amount 1.031199463268642,
+;;=> :config {:high 1.2140517032656555,
+;;=> :low -0.25398734004904844,
+;;=> :waves 1.382558839998536},
+;;=> :name :blob,
;;=> :type :variation},
-;;=> :var2 {:amount -1.978326319628585,
+;;=> :var2 {:amount 0.6854382080226196,
;;=> :config {},
-;;=> :name :noise,
+;;=> :name :cross,
;;=> :type :variation}},
-;;=> :var2 {:amount 1.0,
-;;=> :config {:correctd -0.10570874404742536,
-;;=> :correctn -1.49107210788639,
-;;=> :denominator -16.870277795143114,
-;;=> :numerator 3.1738725224288515,
-;;=> :root -3.790084551225446},
-;;=> :name :powblock,
+;;=> :var2 {:amount -1.7575410682582797,
+;;=> :config {},
+;;=> :name :sinusoidal,
;;=> :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 -5.319779837039107,
-;;=> :x 1.192112272968585,
-;;=> :y -0.5659895082838441},
+;;=> :config {:mp -4.368966809437412,
+;;=> :x 0.6704656447146687,
+;;=> :y -0.7977613495062006},
;;=> :name :blocky,
;;=> :type :variation}
;;=> {:amount 1.0,
-;;=> :config {:mp -3.1133839905285705,
-;;=> :x 0.781652073973997,
-;;=> :y 1.2051764264026015},
+;;=> :config {:mp -5.283987859033081,
+;;=> :x 1.2840517487451941,
+;;=> :y 1.1404939211797904},
;;=> :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 c73a274a..1d35e8ed 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 1850788f..1326245e 100755
--- a/docs/fastmath.random.html
+++ b/docs/fastmath.random.html
@@ -1,8 +1,8 @@
-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
+
RNGs
You can use a selection of various RNGs defined in Apache Commons Math library.
Currently supported RNGs:
@@ -26,7 +26,7 @@ RNGs
b - boolean
Check individual function for parameters description.
-
Random Vector Sequences
+
Random Vector Sequences
Couple of functions to generate sequences of numbers or vectors. You can generate sequence of double
, Vec2 , Vec3 or Vec4 types. Just pass the size to creator function.
To create generator call sequence-generator with generator name and vector size [1,4]. Following generators are available:
@@ -37,7 +37,7 @@ Random
:default
- uniformly random; range:[0,1]
After creation you get function equivalent to repeatedly
.
-
Noise
+
Noise
List of continuous noise functions (1d, 2d and 3d):
:value
- value noise
@@ -68,26 +68,26 @@ Noise
vnoise - Value Noise (as in Processing, 6 octaves, hermite interpolation)
simplex - Simpled Noise (6 octaves)
-
Discrete Noise
+
Discrete Noise
discrete-noise is a 1d or 2d hash function for given integers. Returns double from [0,1]
range.
-
Distribution
+
Distribution
Various real and integer distributions. See DistributionProto and RNGProto for functions.
To create distribution call distribution multimethod with name as a keyword and map as parameters.
billow-noise
Examples Usage
(let [n (billow-noise {:seed 12345, :interpolation :none})]
(n 0.5 1.1 -1.3))
;;=> 0.16031746031746036
2d noise
brand
Random boolean with Mersenne Twister RNG.
Examples Usage
(brand)
-;;=> false
+;;=> true
(brand 0.1)
;;=> false
Count number of true
values with probability 0.15
(count (filter true? (repeatedly 100000 (fn* [] (brand 0.15)))))
-;;=> 14789
default-rng
Examples Usage
(set-seed! default-rng 111)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@1d694d9a
+;;=> 15104
default-rng
Examples Usage
(set-seed! default-rng 111)
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@4df7e8b
(irandom default-rng)
;;=> -1641157356
(set-seed! default-rng 999)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@1d694d9a
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@4df7e8b
(irandom default-rng)
;;=> -421961713
(set-seed! default-rng 111)
-;;=> org.apache.commons.math3.random.JDKRandomGenerator@1d694d9a
+;;=> org.apache.commons.math3.random.JDKRandomGenerator@4df7e8b
(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@315d19f1
+;;=> org.apache.commons.math3.distribution.BetaDistribution@528db627
(distribution :beta {:alpha 1.0, :beta 1.0})
-;;=> org.apache.commons.math3.distribution.BetaDistribution@4a5b9e6b
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@2dd9a1db
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.4835205079365082
+;;=> 0.6271405714285713
(noise 3.3 1.1)
-;;=> 0.47710401682285736
+;;=> 0.4493624573561905
(noise 3.3 0.0 -0.1)
-;;=> 0.6260293888000001
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.5424420112253968
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__8955@4b2b9e36
+;;=> fastmath.random$ridgedmulti_noise$fn__9824@3ceeea4a
(random-noise-fn (random-noise-cfg))
-;;=> fastmath.random$fbm_noise$fn__8947@3c066b66
One
Two
Three
random-noise-fn (random-noise-fn cfg)
(random-noise-fn)
Create random noise function from all possible options.
+;;=> fastmath.random$single_noise$fn__9812@3e42ead4
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@18f67db4
+;;=> org.apache.commons.math3.random.MersenneTwister@1f09259f
(rng :isaac 1234)
-;;=> org.apache.commons.math3.random.ISAACRandom@5b63eae
Using
(irandom (rng :mersenne 999) 15 25)
+;;=> org.apache.commons.math3.random.ISAACRandom@37e3802a
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 ...)
-;;=> false
drandom (drandom t)
(drandom t mx)
(drandom t mn mx)
Random double.
+;;=> true
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.3485525632755664
Double random value from distribution
(drandom (distribution :gamma))
+;;=> 0.12280377553069832
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.31610963
Float random value from distribution (sample cast to float
)
(frandom (distribution :gamma))
+;;=> 0.8633272
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 ...)
-;;=> 1.071352745701417
irandom (irandom t)
(irandom t mx)
(irandom t mn mx)
Random integer.
+;;=> 1.9672689953905065
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 ...)
-;;=> -1779834783
Integer random value from distribution (sample cast to int
)
(irandom (distribution :gamma))
+;;=> 814805834
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 ...)
-;;=> -2415189781520483255
Long random value from distribution (sample cast to long
)
(lrandom (distribution :gamma))
+;;=> -5797707407805087982
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.5096442877980952
+;;=> 0.43967244782476217
(simplex 3.3 1.1)
-;;=> 0.5751061746072044
+;;=> 0.5700423801993916
(simplex 3.3 0.0 -0.1)
-;;=> 0.6730292363968908
2d noise
single-noise
Examples Usage
(let [n (single-noise {:interpolation :linear})] (n 0.5 1.1 -1.3))
+;;=> 0.40732770657782974
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.27846446202769165
+;;=> 0.6987089983668293
(vnoise 3.3 1.1)
-;;=> 0.6497716338792594
+;;=> 0.3744086136400674
(vnoise 3.3 0.0 -0.1)
-;;=> 0.6150280086062385
2d noise
\ No newline at end of file
+;;=> 0.5490152343472502
2d noise
\ No newline at end of file
diff --git a/docs/fastmath.rbf.html b/docs/fastmath.rbf.html
index bffa0b58..3f519315 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 486e6094..8f6e1e03 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))
.
@@ -68,13 +68,13 @@ Other
:step
- distance between bins
:bins
- list of pairs of range lower value and number of hits
Examples 3 bins from uniform distribution.
(histogram (repeatedly 1000 rand) 3)
-;;=> {:bins ([9.993947203562614E-4 330]
-;;=> [0.33322076626006886 323]
-;;=> [0.6654421377997815 347]),
+;;=> {:bins ([8.212692395922483E-4 303]
+;;=> [0.3331197753070451 362]
+;;=> [0.665418281374498 335]),
;;=> :size 3,
-;;=> :step 0.3322213715397126}
3 bins from uniform distribution for given range.
(histogram (repeatedly 10000 rand) 3 [0.1 0.5])
+;;=> :step 0.33229850606745287}
3 bins from uniform distribution for given range.
(histogram (repeatedly 10000 rand) 3 [0.1 0.5])
;;=> {:bins
-;;=> ([0.1 1315] [0.23333333333333334 1370] [0.3666666666666667 1325]),
+;;=> ([0.1 1331] [0.23333333333333334 1301] [0.3666666666666667 1323]),
;;=> :size 3,
;;=> :step 0.13333333333333333}
5 bins from normal distribution.
(histogram (repeatedly 10000 r/grand) 5)
;;=> {:bins ([-3.8255442971705595 104]
@@ -85,15 +85,14 @@ Other
;;=> :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)))
(repeatedly 100 (fn* [] (r/irand 100))))
-;;=> 498.62287946302877
k-means (k-means k vs)
Examples Reduce to 4 values.
(k-means 4 [1 2 3 -1 -1 2 -1 11 111])
-;;=> (-1.0 2.0 11.0 111.0)
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))
+;;=> 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))
(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)))
(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
mean (mean vs)
Examples Mean (average value)
(mean [1 2 3 -1 -1 2 -1 11 111])
+;;=> 14.111111111111109
population-stddev (population-stddev vs)
(population-stddev vs u)
Calculate population standard deviation of a list.
+;;=> 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 a list.
+;;=> 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
.
Percentile p
is from range 0.0-1.0.
@@ -196,7 +195,7 @@
Other
;;=> -0.33161081278713267
;;=> -0.4137529407252298
;;=> -0.08518442897284138
-;;=> 2.652886502297062)
stats-map (stats-map vs)
(stats-map vs estimation-strategy)
Calculate several statistics from the list 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,
@@ -220,9 +219,9 @@ Other
;;=> :Total 127.0,
;;=> :UAV 11.0,
;;=> :UIF 19.0,
-;;=> :UOF 31.0}
stddev (stddev vs)
(stddev vs u)
Calculate population standard deviation of a list.
+;;=> :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 a list.
+;;=> 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
diff --git a/docs/fastmath.transform.html b/docs/fastmath.transform.html
index 838c7396..3fa43975 100755
--- a/docs/fastmath.transform.html
+++ b/docs/fastmath.transform.html
@@ -1,13 +1,13 @@
-
fastmath.transform documentation fastmath.transform Transforms.
+
fastmath.transform documentation fastmath.transform Transforms.
See transformer and TransformProto for details.
-
Wavelet
+
Wavelet
Based on JWave library.
Be aware that some of the wavelet types doesn’t work properly. :battle-23
, :cdf-53
, :cdf-97
.
-
Cos/Sin/Hadamard
+
Cos/Sin/Hadamard
Orthogonal or standard fast sine/cosine/hadamard 1d transforms.
-
Fourier
+
Fourier
DFT.
compress (compress mag xs)
Compress transformed signal xs
with given magnitude mag
.
Examples Compress 1d
(let [t (transformer :fast :symlet-5)]
(->> [1 2 3 4]
(forward-1d t)
@@ -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@1b4f6b6d