Title: | Random Iterated Function System |
---|---|
Description: | Pointwise generation and display of attractors (prefractals) of the random iterated function system (RIFS) for various combinations of probabilistic and geometric parameters of some fixed point sets (protofractals), described by Bukhovets A.G. (2012) <doi:10.1134/S0005117912020154>. |
Authors: | Pavel V. Moskalev, Alexey G. Bukhovets and Tatyana Ya. Biruchinskay |
Maintainer: | Pavel V. Moskalev <[email protected]> |
License: | GPL-3 |
Version: | 0.1.6 |
Built: | 2024-12-08 06:53:57 UTC |
Source: | CRAN |
Pointwise generation and display of attractors (prefractals) of the random iterated function system (RIFS) for various combinations of probabilistic and geometric parameters of some fixed point sets (protofractals), described by Bukhovets A.G. (2012) <doi:10.1134/S0005117912020154>.
Package: | RIFS |
Type: | Package |
Version: | 0.1.6 |
Date: | 2022-05-08 |
License: | GPL-3 |
plotR2pre()
function draws a prefractal set in R^2.preRIFS()
function generates a sample of fractal points (a prefractal points) in R^n with a random iterated function system (RIFS).preRSum0()
function generates a sample of fractal points (a prefractal points) in R^n with a matrix of random sums of a numerical series.R2ngon()
function generates a regular polygonal set in R^2.
Pavel V. Moskalev, Alexey G. Bukhovets and Tatyana Ya. Biruchinskay
plotR2pre()
function draws a prefractal set in R^2.
plotR2pre(l=preRIFS(), s="Prefractal points for 3-gon: k=3; p=1/3; mu=1")
plotR2pre(l=preRIFS(), s="Prefractal points for 3-gon: k=3; p=1/3; mu=1")
l |
a list with prefractal ( |
s |
a string for the main title. |
A regular polygon is a convex polygon in which all edges and all angles are equal.
A protofractal set Z
is a discrete or continuous set, which in the iterative process generates a sample of the fractal set (a prefractal set) X
.
Pavel V. Moskalev and Alexey G. Bukhovets
# Example 1. Sierpinski triangle, 1st order, p=const, mu=var for (m in seq(-4,0)) { plotR2pre(preRIFS(M=2^rnorm(n=3, mean=m, sd=-m/4)), s="Prefractal points for 1st order 3-gon") Sys.sleep(0.1) } ## Not run: # Example 2. Uniform distribution, 1st order, p=const, mu=var for (m in seq(-4,0)) { plotR2pre(preRIFS(Z=R2ngon(4,1), M=2^rnorm(n=4, mean=m, sd=-m/4)), s="Prefractal points for 1st order 4-gon") Sys.sleep(0.1) } # Example 3. Sierpinski triangle, 2nd order, p=const, mu=var for (m in seq(-3,1)) { plotR2pre(preRIFS(Z=R2ngon(3,2), M=2^rnorm(n=6, mean=m, sd=-(m-1)/4)), s="Prefractal points for 2nd order 3-gon") Sys.sleep(0.5) } # Example 4. Sierpinski square, 2nd order, p=const, mu=var for (m in seq(-3,1)) { plotR2pre(preRIFS(Z=R2ngon(4,2), M=2^rnorm(n=8, mean=m, sd=-(m-1)/4)), s="Prefractal points for 2nd order 4-gon") Sys.sleep(0.5) } ## End(Not run)
# Example 1. Sierpinski triangle, 1st order, p=const, mu=var for (m in seq(-4,0)) { plotR2pre(preRIFS(M=2^rnorm(n=3, mean=m, sd=-m/4)), s="Prefractal points for 1st order 3-gon") Sys.sleep(0.1) } ## Not run: # Example 2. Uniform distribution, 1st order, p=const, mu=var for (m in seq(-4,0)) { plotR2pre(preRIFS(Z=R2ngon(4,1), M=2^rnorm(n=4, mean=m, sd=-m/4)), s="Prefractal points for 1st order 4-gon") Sys.sleep(0.1) } # Example 3. Sierpinski triangle, 2nd order, p=const, mu=var for (m in seq(-3,1)) { plotR2pre(preRIFS(Z=R2ngon(3,2), M=2^rnorm(n=6, mean=m, sd=-(m-1)/4)), s="Prefractal points for 2nd order 3-gon") Sys.sleep(0.5) } # Example 4. Sierpinski square, 2nd order, p=const, mu=var for (m in seq(-3,1)) { plotR2pre(preRIFS(Z=R2ngon(4,2), M=2^rnorm(n=8, mean=m, sd=-(m-1)/4)), s="Prefractal points for 2nd order 4-gon") Sys.sleep(0.5) } ## End(Not run)
preRIFS()
function generates a sample of fractal (prefractal) points in R^n with a random iterated function system (RIFS).
preRIFS(n=10000, Z=R2ngon(), P=rep(1/nrow(Z), times=nrow(Z)), M=rep(1, times=nrow(Z)))
preRIFS(n=10000, Z=R2ngon(), P=rep(1/nrow(Z), times=nrow(Z)), M=rep(1, times=nrow(Z)))
n |
a number of prefractal points. |
Z |
a set of protofractal points. |
P |
a probability distribution of protofractal points. |
M |
a partition coefficients distribution of protofractal points. |
A protofractal set Z
is a discrete or continuous set, which in the iterative process generates a prefractal set X
.
A prefractal set X
is a sample of an attractor (fractal) of a random iterated function system:X[i,] <- (X[i-1,] + M[z[i]]*Z[z[i],])/(1 + M[z[i]])
,
where the index i in seq(n)
; the index z
corresponds to a random points sample of a protofractal set Z
.
A list with the prefractal ($pre
) and protofractal points ($proto
); distributions of probabilities & coefficients ($distr
); sample of protofractal indexes ($index
).
Pavel V. Moskalev and Alexey G. Bukhovets
Bukhovets A.G. and Bukhovets E.A. (2012) Modeling of fractal data structures. Automation and Remote Control, Vol.73, No.2, pp.381-385, doi:10.1134/S0005117912020154.
Moskalev P.V. and Bukhovets A.G. (2012) The similarity dimension of the random iterated function system. Computer Research and Modeling, Vol.4, No.4, pp.681-691, doi:10.20537/2076-7633-2012-4-4-681-691.
# Example 1a. Sierpinski triangle, 1st order, p=const, mu=const l <- preRIFS() r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=1/3; mu=1") points(l$pre, pch=46, col=r[l$index]) ## Not run: # Example 1b. Sierpinski triangle, 1st order, p=var, mu=const l <- preRIFS(P=c(2,2,5)/9) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=(2,2,5)/9; mu=1") points(l$pre, pch=46, col=r[l$index]) # Example 1c. Sierpinski triangle, 1st order, p=const, mu=var l <- preRIFS(M=c(4,4,6)/5) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=1/3; mu=(4,4,6)/5") points(l$pre, pch=46, col=r[l$index]) # Example 2a. Sierpinski square, 2nd order, p=const, mu=const l <- preRIFS(Z=R2ngon(4,2), M=rep(2,8)) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 4-gon: k=8, p=1/8, mu=2") points(l$pre, pch=46, col=r[l$index]) # Example 2b. Sierpinski square, 2nd order, p=var, mu=const l <- preRIFS(Z=R2ngon(4,2), P=2^abs(seq(-3,4))/45, M=rep(2,8)) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, col=r, asp=1, main="Prefractal points for 4-gon: k=8, p=2^|-3:4|/45, mu=2") points(l$pre, pch=46, col=r[l$index]) # Example 2c. Sierpinski square, 2nd order, p=const, mu=var l <- preRIFS(Z=R2ngon(4,2), M=1.2^abs(seq(-3,4))+0.5) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, col=r, asp=1, main="Prefractal points for 4-gon: k=8, p=1/8, mu=0.5+1.2^|-3:4|") points(l$pre, pch=46, col=r[l$index]) ## End(Not run)
# Example 1a. Sierpinski triangle, 1st order, p=const, mu=const l <- preRIFS() r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=1/3; mu=1") points(l$pre, pch=46, col=r[l$index]) ## Not run: # Example 1b. Sierpinski triangle, 1st order, p=var, mu=const l <- preRIFS(P=c(2,2,5)/9) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=(2,2,5)/9; mu=1") points(l$pre, pch=46, col=r[l$index]) # Example 1c. Sierpinski triangle, 1st order, p=const, mu=var l <- preRIFS(M=c(4,4,6)/5) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 3-gon: k=3; p=1/3; mu=(4,4,6)/5") points(l$pre, pch=46, col=r[l$index]) # Example 2a. Sierpinski square, 2nd order, p=const, mu=const l <- preRIFS(Z=R2ngon(4,2), M=rep(2,8)) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, asp=1, col=r, main="Prefractal points for 4-gon: k=8, p=1/8, mu=2") points(l$pre, pch=46, col=r[l$index]) # Example 2b. Sierpinski square, 2nd order, p=var, mu=const l <- preRIFS(Z=R2ngon(4,2), P=2^abs(seq(-3,4))/45, M=rep(2,8)) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, col=r, asp=1, main="Prefractal points for 4-gon: k=8, p=2^|-3:4|/45, mu=2") points(l$pre, pch=46, col=r[l$index]) # Example 2c. Sierpinski square, 2nd order, p=const, mu=var l <- preRIFS(Z=R2ngon(4,2), M=1.2^abs(seq(-3,4))+0.5) r <- rainbow(n=nrow(l$proto), v=0.9) plot(l$proto, col=r, asp=1, main="Prefractal points for 4-gon: k=8, p=1/8, mu=0.5+1.2^|-3:4|") points(l$pre, pch=46, col=r[l$index]) ## End(Not run)
preRSum0()
function generates a sample of fractal (prefractal) points in R^n with a matrix of random sums of a numerical series.
preRSum0(n=10000, mu=1, eps=1e-9, Z=R2ngon(), P=rep(1/nrow(Z), times=nrow(Z)))
preRSum0(n=10000, mu=1, eps=1e-9, Z=R2ngon(), P=rep(1/nrow(Z), times=nrow(Z)))
n |
a number of prefractal points. |
mu |
a partition coefficient for iterative segments. |
eps |
an error of a random sum of a numerical series. |
Z |
a set of protofractal points. |
P |
a probability distribution of protofractal points. |
A protofractal set Z
is a discrete or continuous set, which in the iterative process generates a prefractal set X
.
A prefractal set S%*%Z
is a sample of a fractal set generates with a matrix of random sums S
of a numerical series:
S[i,j] <- sum(X[l==j])
,
where i in seq(n)
; j in seq(k)
; k <- nrow(Z)
; X <- mu/(mu+1)^seq(m)
; m <- 1-log(eps*mu)/log(1+mu)
; l <- sample.int(k, size=m, prob=P, replace=TRUE)
.
A list with the prefractal ($pre
) and protofractal points ($proto
); distributions of probabilities & coefficients ($distr
).
Pavel V. Moskalev, Alexey G. Bukhovets and Tatyana Ya. Biruchinskay
Bukhovets A.G. and Bukhovets E.A. (2012) Modeling of fractal data structures. Automation and Remote Control, Vol.73, No.2, pp.381-385, doi:10.1134/S0005117912020154.
Bukhovetc A.G. and Biruchinskay T.Y. (2011) Modelling fractal's properties of system objects. Proceedings of Voronezh State University. Series: Systems Analysis and Information Technologies, No.2 (July-December), pp.22-26; in Russian.
# Example 1a. Sierpinski triangle, 1st order, p=const, mu=const l <- preRSum0() plot(l$proto, asp=1, col="red", main="Prefractal points for 3-gon: k=3; p=1/3; mu=1") points(l$pre, pch=46, col="red") ## Not run: # Example 1b. Sierpinski triangle, 1st order, p=var, mu=const l <- preRSum0(P=c(2,2,5)/9) plot(l$proto, asp=1, col="red", main="Prefractal points for 3-gon: k=3; p=(2,2,5)/9; mu=1") points(l$pre, pch=46, col="red") # Example 2a. Sierpinski square, 2nd order, p=const, mu=const l <- preRSum0(Z=R2ngon(4,2), mu=2) plot(l$proto, asp=1, col="red", main="Prefractal points for 4-gon: k=8, p=1/8, mu=2") points(l$pre, pch=46, col="red") # Example 2b. Sierpinski square, 2nd order, p=var, mu=const l <- preRSum0(Z=R2ngon(4,2), P=2^abs(seq(-3,4))/45, mu=2) plot(l$proto, asp=1, col="red", main="Prefractal points for 4-gon: k=8, p=2^|-3:4|/45, mu=2") points(l$pre, pch=46, col="red") ## End(Not run)
# Example 1a. Sierpinski triangle, 1st order, p=const, mu=const l <- preRSum0() plot(l$proto, asp=1, col="red", main="Prefractal points for 3-gon: k=3; p=1/3; mu=1") points(l$pre, pch=46, col="red") ## Not run: # Example 1b. Sierpinski triangle, 1st order, p=var, mu=const l <- preRSum0(P=c(2,2,5)/9) plot(l$proto, asp=1, col="red", main="Prefractal points for 3-gon: k=3; p=(2,2,5)/9; mu=1") points(l$pre, pch=46, col="red") # Example 2a. Sierpinski square, 2nd order, p=const, mu=const l <- preRSum0(Z=R2ngon(4,2), mu=2) plot(l$proto, asp=1, col="red", main="Prefractal points for 4-gon: k=8, p=1/8, mu=2") points(l$pre, pch=46, col="red") # Example 2b. Sierpinski square, 2nd order, p=var, mu=const l <- preRSum0(Z=R2ngon(4,2), P=2^abs(seq(-3,4))/45, mu=2) plot(l$proto, asp=1, col="red", main="Prefractal points for 4-gon: k=8, p=2^|-3:4|/45, mu=2") points(l$pre, pch=46, col="red") ## End(Not run)
R2ngon()
function generates a regular polygonal protofractal set in R^2.
R2ngon(n1=3, n2=1, r=1, o=c(0,0), cycle=FALSE)
R2ngon(n1=3, n2=1, r=1, o=c(0,0), cycle=FALSE)
n1 |
a number of vertices of a regular polygon. |
n2 |
a number of partition points for the edges of a regular polygon. |
r |
a radius of the circumscribed circle. |
o |
a center of the circumscribed circle. |
cycle |
logical; if |
A regular polygon is a convex polygon in which all edges and all angles are equal.
A protofractal set Z
is a discrete or continuous set, which in the iterative process generates a sample X
of a fractal set.
A matrix of points coordinates of a protofractal set in R^2.
Pavel V. Moskalev
plot(R2ngon(n1=90, cycle=TRUE), type="l", asp=1, col="gray", main="Regular {3,4,5,7,11}-gonal sets in R^2") for (n in c(3,4,5,7,11)) lines(R2ngon(n1=n, cycle=TRUE), type="b", pch=16, col=hsv(h=(n-2)/9,v=0.9))
plot(R2ngon(n1=90, cycle=TRUE), type="l", asp=1, col="gray", main="Regular {3,4,5,7,11}-gonal sets in R^2") for (n in c(3,4,5,7,11)) lines(R2ngon(n1=n, cycle=TRUE), type="b", pch=16, col=hsv(h=(n-2)/9,v=0.9))