Algebraic features of algorithm composition for calculating fractal structure

. The construction methods analysis of known geometric fractals allows us to reveal algebraic features of fractal algorithms composition. The main concept of the analysis results is fractal operators which are basic operations for constructing fractals of a certain type. The result of using operators for geometric fractals is a structure with fractures of triangular, square, trapezoidal and similar forms. Multiplication and addition operations are introduced for operators, as well as the concept of the unit, null and inverse operator, which allows us to define periodic and quasi-periodic fractal structures. An algorithm for the formation of periodic and stochastic fractal structures is proposed, a distinctive feature of which is the implementation of the probabilistic choice of the basic geometric primitive on the current iterative cycle. The software implementation of the proposed algorithm confirmed the validity of the algebraic approach in studying and modeling fractal with a complex structure.


Introduction
Two approaches in studying fractals are known: natural-scientific [1] and model-based [1,2].The structure of a fractal depends on its nature, is determined experimentally, and is generally stochastic in studying natural processes.In this case, the main fractal relations for linear fractals -the number of dimensions [2]  =  − and the length of the fractal line [1,2],  =  1− contain undefined multipliers С, the scale ε can vary smoothly within the range from the minimum   to the maximum   values characteristic to the particular problem [3].The dimension of fractals D experiences significant fluctuations depending on the available range of scales ε.All this complicates the analysis of general patterns when studying fractal structures.
In the alternative approach (model) for mathematical modeling and software formation of fractals, the mentioned above disadvantages are absent.In particular, fractals are built sequentially, in accordance with the specified algorithms.The coefficient C has specific values, and its value can be controlled, for example, by selecting the initial length of the fractal line.One can assign specified discrete values to the ε scale.The dimension of regular (non-stochastic) fractals D is strictly determined at each step of the simulation by the specified construction algorithm.As a result, to identify General patterns of fractal theory using such models is easier.Besides, knowledge of common patterns allows us to solve applied problems [3] which in this case can be formulated as the ability to calculate fractal structures "with pre-defined properties».
In this paper the algebraic features of the fractal algorithms composition by the example of geometric fractals are studied.It is shown that using the proposed regularities makes it possible to effectively study and model fractals with a complex structure.

Algebraic features of fractal algorithms composition
Let's consider the features of constructing a geometric fractal using the example of the «Koch Curve» [1].The traditional algorithm for constructing such fractals consists in dividing elementary segments into m parts and replacing them with n such segments.The construction begins with a segment of unit length and after k formation cycles we get a fractal with a minimum scale.From the known fractal relations [2], the algebraic features of the fractal algorithm can be expressed as follows.We introduce the concept of a fractal operator that is defined by the numbers m, n, and the set l on which it operates, i.e., a segment of the fractal line in this cycle of its application.For geometric fractals, each operator corresponds to a geometric primitive: for linear fractals, it is a polyline with fractures of triangular, square, trapezoidal and similar forms.The use of an operator (1) in k cycles corresponds to the product k of such operators, which can be expressed as a generalized operator of the form A generalized cycle operator k generally contains the product of k of different operators of individual cycles ( The additional index s in the operator (3) characterizes a specific set of operators and their order.When the generalized operator (3) is applied cyclically z times, we get a zperiodic fractal characterized by the operator Thus, the fractal period is the minimal sequence of fractal construction cycles characterized by one sequence of operators of the form (3). The study of the commutative properties of fractal operators is a separate problem and is not considered in this paper.
If the number of operators   in product ( 3) is increased to infinity, then we get an object without self-similarity, but with a natural change in scale in the limit of  → 0, which is a limit generalization of a fractal concept.
When generalized operators   are deformed, their z-fold product will generate quasiperiodic fractals instead of strictly periodic ones.When applying a generalized line operator  to each section of the line, the sum of generalized operators is compared as (5) To fully describe the algebraic features of the composition of fractal algorithms, it is necessary to introduce null and unit operators.The product of a null operator  0 on any sequence of operators is zero.The sum of operators of the form (5) does not change when null operators are included in it.Product of operator   by operators of the form (3,4) eliminates the effect on the result.In the sum of the form (5), the action of this operator leads to an increase in the length of the fractal by the segment   , according to its argument.Obviously, the properties of these operators are exactly the same as those of zero and one in algebra of numbers.The inverse operator is defined in the standard way: 3 The stochasticity of fractal algorithm It follows from the above that the formalization of geometric features of fractal algorithms is based on fractal operators   .To construct stochastic fractals, it is necessary to give a probabilistic character to the basic operators   .The structure of such operators is as follows: where   is the possible values of the operator   , the conditions for their implementation are determined by probabilities   and a set of additional conditions that characterize a specific task.Stochasticity and multivariance increase sharply in the product of operators of the form (3,4).When using stochastic operators of the form (7) cyclically, complex arrangements of operators will be obtained.This structure of the generalized operator corresponds to the calculation of a stochastic fractal structure, each part of the latter has an increasing number of sections of different structure and dimension with each cycle.Figure 1 shows two stochastic fractals with the structure of operator (5) of the form where for one curve, the application of the operator corresponds to a geometric primitive with a triangular break, and the second curve with square ones.The probability p is determined by the fractal configuration (8).The presence of a single operator in the structure (8) indicates that the fractal structure degrades with each cycle.The problem of determining the quantitative assessment of the stochasticity degree of fractals of this type requires additional theoretical research and is not considered in this article.
Figure 2 shows four cycles of forming a stochastic fractal with the structure of the operator (5) of the form where operator  1 corresponds to a geometric primitive with square, operator  2 -with triangular, operator  3 -trapezoidal breaks.The boundary values of probabilities had values  1 = 0,25;  2 = 0,5;  3 = 0,25.Comparison with Figure 2 indicates the complexity of fractals in the absence of a single operator in the structure of stochastic operators.

The formation algorithm of periodic and stochastic fractal structures
The algorithm for forming periodic and stochastic fractal structures consists of three independent stages, namely:  forming a periodic fractal structure with a given number of iterative cycles N and the order of applied basic geometric primitives (triangle, square, and trapezoid);  geometric primitive (triangle, square, or trapezoid) and with a probability from 0 to 1 of skipping its application. forming a stochastic fractal structure with a given number of iterative cycles N and with the probability of applying one or another basic geometric primitive on the current segment under consideration.
At the first stage, the product of three fractal operators  1  2  3 is calculated.The complexity of this stage in the best and worst cases is equal to , where N -is the number of iterative cycles for applying the product of operators (in this instance  1  2  3 ).
At the second stage, a fractal structure with a probability value P is calculated, which characterizes the division of the current segment into three equal parts, followed by the use of a basic geometric primitive (triangle, square, or trapezoid).In the best case, i.e. for P = 1, the complexity takes the form(3  ), in the worst case for P = 0 and for the selected primitive: square or trapezoid -(5  ), where N -is the number of iterative cycles.Since the third stage determines the probabilistic application of one or another basic geometric primitive on the current, considered segment, the complexity in the best case is (4  ), if there is always a triangle and (5  ) if the primitive is a square or trapezoid.
These fractal structures calculated by means of the considered algorithm that uses the proposed algebraic features of the algorithm composition for calculating fractal structures are presented in Figure 1 and Figure 2, respectively.The software implementation of the algorithm for generating periodic and stochastic fractal structures is performed in the Python programming language version 3.7 [4] using developed integrated libraries such as: Pygame, OpenGL, PyQT5 and pyuic.

Conclusion
Algebraic features of the fractal algorithms composition are revealed, the main concept of which is fractal operators   , which are the main operations for constructing fractals of a certain type.Fractal operators formalize the generation of basic primitives in the form of broken lines with triangular, square, trapezoidal, and similar breaks.The expediency of introducing zero, single, and inverse operators, as well as their summation and multiplication operations, is justified.The use of these algebraic features of the composition allows us to introduce the concepts of periodic and quasi-periodic fractals.For an infinitely large number of different operators in the product, a limiting generalization of the concept of a fractal is obtained, as a structure without self-similarity, but with a naturally decreasing scale.It is revealed that fractal operators   have complex commutative properties: when changing the order of operators, fractals that are different in shape but the same in dimension are obtained.Giving a stochastic character to the basic operators   allows us to calculate stochastic fractals, analyze patterns of complication of their structure.For periodic fractals, as well as combining fractals, terms of average or generalized dimension are introduced.The implementation of the algorithm for the formation of periodic and stochastic fractal structures confirmed the effectiveness of the proposed algebraic approach in studying and modeling fractals with a complex structure.

Fig. 1 .
Fig. 1.Examples of stochastic fractals corresponding to the stochastic operator (8) for two geometric primitives: with triangular (top) and square (bottom) fractures.

Fig. 2 .
Fig. 2. Four cycles of a stochastic fractal formation corresponding to the stochastic operator (9).