Wyższa Szkoła Zarządzania i Bankowości
LECTURESNOTEBOOKSPACKAGES
2 Discrete Modeling (L-Systems)
2.2 Fractals and Fractal Dimension

1 Introduction to Simulation and Modeling
2 Discrete Medeling (L-Systems)
L-Systems
Fractals and Fractal Dimension
3 Population Dynamics
4 Number Representation and Error Propagation
5 Modeling with Random Numbers
6 Heat Transfer in a Rod (Connection Mathematica and C: MathLink)
7 Special Topics in Stochastic Finance
8 Appendix: Introduction to Mathematica
9 Population Dynamics in Vensim®PLE
     
 

Introduction

Many objects in nature are so complicated and irregular that they cannot be modelled well using conic sections, polygons, spheres and the other familiar objects of classical geometry. For example, circulatory systems, clouds, trees, mountains, and coastlines cannot be reduced to combinations of simple shapes from classical geometry. Where classical geometry ends as a tool for analyzing the complexity of natural objects, fractal geometry begins. Today, fractals are used to model a wide range of biological and topographical entities and to produce ultra-realistic special effects for movies and video games.

The question "How long is the coastline of Britain?" posed by Benoit Mandelbrot, the father of modern fractal theory, in his book The Fractal Geometry of Nature is not as simple as it appears. The problem is that one's answer to this question depends on the length of the ruler one uses.  Unlike circles and the other shapes from classical geometry, coastlines are very irregular. They're full of inlets, bays, and rocky shores. A shorter measuring stick will fit more snugly in these nooks and crannies and increase the estimated length of the coastline. Hence, if we measure the length of Britain's coastline using a mile-long ruler, we will get one value. If we use a shorter ruler, say a yardstick, we will get a larger value because a yardstick can more closely approximate Britain's convoluted boundary. In fact, as the scale of measurement decreases, the estimated length increases without limit. Thus, as the length of the ruler approaches zero, the estimated length of the coastline approaches infinity.  This difficulty in measuring due to the irregularity of the object being measured is characteristic of fractal curves and surfaces.

Fractal theory is grounded in geometry and dimension theory.  Geometrically, fractals are independent of scale and appear equally detailed at any level of magnification.  This property, called self-similarity, means that any portion of a self-similar fractal curve, if blown up in scale, would appear identical to the whole curve.  In other words, if we shrink or enlarge a fractal pattern, its appearance remains unchanged.  This repetition of a pattern at all scales, no matter how small, is exhibited by many natural objects.  For example, imagine that you are in space looking at the coastline of Britain.  As you approach the Earth, the coastline still looks like a coastline.  No matter how close you get to Britain's shore, the coastline appears equally complex.  Even after you land your spacecraft and get down on your hands and knees with a microscope at the water's edge, the coastline still looks jagged and irregular.

The term fractal, introduced in 1975 by Benoit Mandelbrot, is an abbreviation for 'fractional dimension'. We all learned in high school that in classical geometry a line is a one dimensional object and a plane is two dimensional. Strangely, if we put enough kinks in a line, the resulting fractal curve will have a dimension somewhere between one and two, so that it is neither a line nor a plane but something in between. Similarly, an extremely convoluted surface will have a dimension between two and three. Such a figure is called a fractal. The concept of fractal dimension provides a way to measure how rough fractal curves are. The more jagged and irregular a curve is, the higher its fractal dimension. Fractional dimension is related to self-similarity in that the easiest way to create a figure that has fractional dimension is through self-similarity.   

Regular non-random fractals

Fractals fall into two categories, random and non-random (regular). It is instructive to discuss a much-studied regular fractal, the Koch snowflake. The construction of this curve starts with a triangle. In each construction step an edge is replaced by a set of 8 equal-sized new edges. The boundary of the Koch Snowflake constructed by Helge Von Koch in 1904 is the union of three congruent self-similar fractals.  Each third of the snowflake is constructed by starting with one side of an equilateral triangle and performing an iterative process.  The following cell defines a function called Snowflake that illustrates the stages in this iterative process (just execute the code).

Koch Snowflake Construction

[Graphics:Images/nb2_gr_153.gif]
Clear[n,Snowflake,start,finish,doline]
Snowflake[n_Integer?NonNegative]:=
  Show[Graphics[
    Nest[ (#1/.Line[{start_,finish_}] :>doline[start,finish]) &,
          {Line[{{0,0},{1/2,Sqrt[3]/2}}],
           Line[{{1/2,Sqrt[3]/2},{1,0}}],
           Line[{{1,0},{0,0}}]},
          n]],
   AspectRatio->Automatic,PlotRange->All]
doline[start_,finish_]:=
  Module[{vec,Normal},
  vec=finish-start;
  normal=Reverse[vec] {-1,1} Sqrt[3]/6;
  {Line[{start,start + vec/3}],
  Line[{start + vec/3,start + vec/2 + normal}],
  Line[{start + vec/2 + normal, start + 2 vec/3}],
  Line[{start + 2 vec/3, finish}]
  }
  ];

The following cells show examples of different iterations of the Koch code.

Snowflake[0]

[Graphics:Images/nb2_gr_154.gif]

At the next stage of the snowflake's construction, we remove the middle one-third of each side and add two new segments having the same length as the part that was removed.   (See the picture generated by the cell below.)  

Snowflake[1]

[Graphics:Images/nb2_gr_155.gif]

At each stage, we replace the middle-third  of every segment in the previous stage by two new segments, creating a "bump" on the original segment.  Evaluate the following cells to see the next four stages in the construction of the Koch Snowflake.

Snowflake[2]

[Graphics:Images/nb2_gr_156.gif]

Snowflake[3]

[Graphics:Images/nb2_gr_157.gif]

Snowflake[4]

[Graphics:Images/nb2_gr_158.gif]

The Fractal Dimension

Consider a line segment divided into [Graphics:Images/nb2_gr_159.gif] equal pieces.  Each of these [Graphics:Images/nb2_gr_160.gif] pieces can be thought of as a scaled version of the whole segment, with scaling ratio [Graphics:Images/nb2_gr_161.gif].  The relation between [Graphics:Images/nb2_gr_162.gif] and [Graphics:Images/nb2_gr_163.gif] is clearly [Graphics:Images/nb2_gr_164.gif].  For example, if [Graphics:Images/nb2_gr_165.gif], then [Graphics:Images/nb2_gr_166.gif] and [Graphics:Images/nb2_gr_167.gif], see below.

[Graphics:Images/nb2_gr_168.gif]

Now suppose the sides of a square are scaled by a factor [Graphics:Images/nb2_gr_169.gif] to produce [Graphics:Images/nb2_gr_170.gif] identical subsquares, each of which is a scaled version of the whole square.  The relation between [Graphics:Images/nb2_gr_171.gif] and [Graphics:Images/nb2_gr_172.gif] in this case is [Graphics:Images/nb2_gr_173.gif].  For example, if [Graphics:Images/nb2_gr_174.gif], then [Graphics:Images/nb2_gr_175.gif] and [Graphics:Images/nb2_gr_176.gif].  See the figure below.

[Graphics:Images/nb2_gr_177.gif]

Finally, if a cube is scaled in the x, y, and z directions by a factor [Graphics:Images/nb2_gr_178.gif] to produce [Graphics:Images/nb2_gr_179.gif] equal subcubes, then the relation is [Graphics:Images/nb2_gr_180.gif].  For example, if [Graphics:Images/nb2_gr_181.gif], then [Graphics:Images/nb2_gr_182.gif] and [Graphics:Images/nb2_gr_183.gif].  (See the figure generated by the cell below.)

[Graphics:Images/nb2_gr_184.gif]

The line, square, and cube above have integer dimensions of one, two, and three respectively.  Notice that the dimensions of these objects show up as the exponent [Graphics:Images/nb2_gr_185.gif] in the relation [Graphics:Images/nb2_gr_186.gif], where [Graphics:Images/nb2_gr_187.gif] is the number of equal subunits and [Graphics:Images/nb2_gr_188.gif] is the scaling ratio. In general, if a given set is the union of [Graphics:Images/nb2_gr_189.gif] essentially disjoint copies of the original that are scaled by a constant factor [Graphics:Images/nb2_gr_190.gif], then the value of [Graphics:Images/nb2_gr_191.gif] that satisfies the equation [Graphics:Images/nb2_gr_192.gif] is called the fractal dimension or similarity dimension of the set. It turns out that there are configurations for which the value of d in [Graphics:Images/nb2_gr_193.gif] is not an integer. Such configurations are called self-similar fractals!

The explicit formula for [Graphics:Images/nb2_gr_194.gif] in terms or [Graphics:Images/nb2_gr_195.gif] and [Graphics:Images/nb2_gr_196.gif] is given by the cell below.

Solve[n r^d==1,d]
[Graphics:Images/nb2_gr_197.gif]

The logarithm in the formula above can be taken with respect to any positive base different from 1.  The following cell defines a function called dimension that takes the values of [Graphics:Images/nb2_gr_198.gif] and [Graphics:Images/nb2_gr_199.gif] as input and returns the value of [Graphics:Images/nb2_gr_200.gif].  This function will be used later in this notebook, so execute it now.

Clear[dimension,d]
dimension[n_Integer?Positive,r_?Positive]:=
    Module[{d},
        d=Log[1/n]/Log[r]//N]

The Fractal dimension of the Koch Curve

Each third  of the Koch Snowflake converges to a limiting curve [Graphics:Images/nb2_gr_201.gif] that is a self-similar fractal.  If [Graphics:Images/nb2_gr_202.gif] is scaled by a factor of [Graphics:Images/nb2_gr_203.gif], then there are [Graphics:Images/nb2_gr_204.gif] copies of the scaled version making up the entire set [Graphics:Images/nb2_gr_205.gif].  Hence, the fractal dimension of [Graphics:Images/nb2_gr_206.gif] is given by the following  cell.    

dimension[4,1/3]
[Graphics:Images/nb2_gr_207.gif]

Since the dimension of the snowflake (1.26186) is greater than the dimension of the lines making up the curve (1), the Koch Snowflake is a fractal.

Boundary length of the Koch Curve

An important property of the Koch Snowflake is that its boundary has infinite length.  This is especially surprising in light of the fact that the snowflake encloses only a finite area (after all, it can be completely covered with a square of paper).  To show that the boundary of the snowflake has infinite length, it suffices to show that each of the three congruent fractals making up the snowflake has infinite length. Suppose that the initial segment (call it [Graphics:Images/nb2_gr_208.gif]) has length 1. Then [Graphics:Images/nb2_gr_209.gif], the curve produced by removing the middle one-third of [Graphics:Images/nb2_gr_210.gif] and adding two new segments having the same length, has length [Graphics:Images/nb2_gr_211.gif].  The curve [Graphics:Images/nb2_gr_212.gif] at the end of the second stage has length [Graphics:Images/nb2_gr_213.gif].   Repeating this process, the curve [Graphics:Images/nb2_gr_214.gif] produced after [Graphics:Images/nb2_gr_215.gif] stages has length [Graphics:Images/nb2_gr_216.gif].  Hence, the length of the limit curve [Graphics:Images/nb2_gr_217.gif] is given by the following cell.

[Graphics:Images/nb2_gr_218.gif]
[Graphics:Images/nb2_gr_219.gif]

Fractal dimension of non-regular fractals

For the fractals discussed above, the regular fractals, we can calculate the fractal dimension. For irregular fractals such as fractal structures from nature or from random processes (see Simulation and Modelling notebook 5) we need an alternative approach.
Let us assume that a 2D square space is filled with boxes. To simplify, assume that linear size of the whole square is one unit and linear size of each box is [Graphics:Images/nb2_gr_220.gif] Thus, the number of boxes [Graphics:Images/nb2_gr_221.gif]. If  [Graphics:Images/nb2_gr_222.gif]  decreases, the number of boxes increases as [Graphics:Images/nb2_gr_223.gif].
More general, in d-dimensional space:  [Graphics:Images/nb2_gr_224.gif] ⇒ Log N ([) = -d Log [.
The approach called Box counting method is to overlay the object with a grid with gridspacing [Graphics:Images/nb2_gr_225.gif] and count the number of intersected cells. By decreasing [Graphics:Images/nb2_gr_226.gif] we can infer the fractal dimension.

[Graphics:Images/nb2_gr_227.gif]

OPTIONAL
II.2
Fractal dimension of non-regular fractals
Explain in pseudo-code how the box-counting method can be used to determine the fractal dimension.


 
     
  Lectures | Notebooks | Packages

 
  Copyright © 2003 Wyższa Szkoła Zarządzania i Bankowości. Wszystkie prawa zastrzeżone
webmaster@wszib.edu.pl