Anda di halaman 1dari 16

Fractal (Fractile)

Introduction

1. Derived from the Latin word fractus, meaning “fragmented,” or “broken.” It was coined by the Polish-
born mathematician Benoit B. Mandelbrot in 1975 when he asked a question about the length of the
coastline of Britain. If one takes aerial pictures of the coastline at different heights (or use “ruler” of
different divisions), one sees different amount of details. Since the coastline is irregular with bays, inlets,
etc., the estimates of the coastline become arbitrarily large. Does it approach infinity?

2. This idea is different from estimating the circumference of a circle (which is regular) using regular
polygons. The estimates converge.

3. A fractal curve is one whose length becomes arbitrarily large as the measuring scale becomes smaller and
smaller. A fractal may have one or more of the following characteristics:
(a) complex structure at all scales
(b) self-similarity
(c) fractional dimension
(d) infinite branching
(e) chaotic dynamics

4. There are numerous applications to diverse fields dealing with irregularly shaped objects or spatially non-
uniform and random phenomena: the rugged terrain of mountains, coastlines, Brownian movement,
vascular networks, population growth, the shapes of polymer molecules, distribution of galaxies, and the
intricate branch systems of trees and ferns in nature. Computer graphics are used to generate lifelike
images of these complicated, highly irregular natural objects and processes.

5. Introduction of fractals in school mathematics has the following benefits:


(a) as a recent topic in mathematics, it shows students that mathematics is a constantly developing
discipline (unlike most school mathematics which has been fossilised for thousands of years);
(b) they provide visual illustrations of many basic mathematical results, such as sequences, indices,
limit, complex numbers, and symmetry (a multi-modal approach);
(c) challenge students to find and explore visual patterns, linking these activities to computer graphics
(use of Excel, Logo, and special fractal-generating programs); the planet in Star Trek was computer-
generated fractal landscape;
(d) it is fun to discover new fractals;
(e) develop more positive attitudes towards learning mathematics.

Self-Similar Objects

1. A self-similar object: its parts resemble the whole; each part, when magnified, will look basically like the
object as a whole; it remains invariant under changes of scale, i.e., it has scaling symmetry (self-symmetry
under magnification).

2. Koch curve (by Helga von Koch,1870 – 1924, a Swedish mathematician, introduced this curve in1904).
On a piece of A4 paper, draw a line segment of length 18 cm. Take this as a “unit” length. Trisect it and
1
replace the middle segment by the other two sides of an equilateral triangle of side 3 the original length.
Repeat the process up to stage 3. Use pen of different colour for each stage.

3. (Logo) Load fractal.lgo. Type side1 50 0 and change the side (first input) and stage (second input).

1
Stage Length of each segment Number of segments Total length
n sn pn Ln
0 1 1 1

1 1 4 4
3 3

n
( 13 ) n 4n
( 43 ) n
4. The Koch curve is self-similar. As n → ∞, the total length → ∞. Imagine this curve is used to estimate the
length of a coastline. As the scale becomes smaller, the total length becomes increasingly larger.

5. Repeat the above using the following division (quadric Koch curve). (Logo) Type side2 50 0 and so on.

6. These fractal curves are highly complex and contain a great deal of detail. The degree of complexity of
self-similar fractals is described by the similarity fractal dimension. These curves have fractional
dimensions, so FRACTAL also stands for FRACTionAL dimension.

7. Let N be the ratio of the number of final pieces to the number of original pieces (replacement ratio) and r
the ratio of the length of the original piece to the length of each final piece (scaling ratio). Then the
log N
dimension D is defined by r D = N or D = log r . This is an extension of the dimensions of classical
geometric objects, and is based on the notion of Hausdorff dimension for topological spaces.

Figure r N Dimension, D
Line 2 2 = 21 1

Square 2 4 = 22 2

Cube 2 8 = 23 3
Koch curve 3 4 = 3D 1.26
Quadric Koch curve 3 5 1.46

8. These curves form the L-system fractals, where L stands for Lindenmayer, a mathematician who wrote
about the fractal nature of plant development.

2
Snowflakes or Dragon Curves

1. These fractals are often found at the boundaries between regions of the complex plane defined by chaotic
systems.

2. Koch snowflake. Begin with an equilateral triangle (stage 0). Replace each side by a Koch curve
projecting outward. Repeat this process on the resulting figure. The Koch snowflake is not self-similar.

3. (3)
n
Prove that the perimeter of the curve is 4 × P (where P is the initial perimeter of the equilateral

 () n
triangle) and its area is  85 − 53 94  × A (where A is the initial area of the triangle). The perimeter
 
increases without limit, but the area encloses approaches 85 the area of the original triangle. This is
different from the properties of classical geometric shapes like circles.

4. Repeat the above process with the quadric Koch curve.

5. (Logo) To see the Koch curve, type: cs koch 100 0; change the size (first input) and stage (second input).
Type kochst to see a display of four stages of the Koch curve.
To see the quadric Koch curve, type: qkoch 100 0 and so on. Type qkochst to see a display.
Note that for a side of 50 units, stage 7 is the limit of what can be plotted on the screen. With larger side,
more stages can be plotted.

6. If you turn the small triangles of Koch snowflake “inside” instead of outward, the result is a Koch anti-
snowflake! (Logo) Type side5 100 1 and kochanti 100 1 and kochantist to see a display.

7. Exercise.
(a) The Peano curve (1858 – 1932) is generated as follows. It passes through every point of the unit
square! Determine its dimension. (r = 3, N = 9, dimension = 2; is this expected?) (Logo) Try
side3 100 0 and peano 100 0 and peanost.

(b) Determine the dimension for the quadric island. Type side4 50 1 and island 50 1 and islandst.

(r = 4, N = 8, D = 1.5)
3
8. Curves like the Sierpinski curve are closed paths that pass through every point in the unit square. Space-
filling curve will do the same for a cube.

9. Sierpinski triangle (or gasket). Construct an equilateral triangle of side 12 units on an isometric dot paper.
At step 1, bisect each side and shade the middle triangle. This leaves three unshaded triangles. See the first
two stages below.

Stage Number of unshaded triangles Total area of unshaded triangles


n pn An
0 1 1

1 3 3
4

n 3n
( 34 )n
log 3
Show that its dimension is log 2 ≈ 1.58.

10. Sierpinski triangle and the chaos game. This activity demonstrates that a non-deterministic process may
lead to regularity.

Draw an equilateral triangle with top vertex T and left and right vertices L and R. Take any point inside
the triangle. Throw a die and mark a point accordingly:
For 1 or 2, mark the mid-point between the current point and L.
For 3 or 4, mark the mid-point between the current point and T.
For 5 or 6, mark the mid-point between the current point and R.
Repeat this process for a number of points.
To collect class result, give each member a transparency of the same triangle and ask them to mark using
different colours. Put them together later.

11. Let L = (-1, 0), R = (1, 0), and T = (0, √3). The chaos game is generated by three linear mappings:
 x y+ 3 
ρL =  x2−1 , 2  , ρR =  x2+1 ,
y y
,ρ = 2, 2 .
   2 T  

12. Instead of taking the mid-point between a point and a vertex, choose a line that divides the segment from
the point to a vertex in the ratio k : (1 – k). If k < 0.5, we have an overlaid Sierpinski triangle; if k > 0.5,
we have a strict Sierpinski triangle where the triangles have no common point. (Logo) Type sierst and
enter the value of k to use.

13. Repeat the above using a square (or any regular polygon!). (Logo) Type siersqst.

4
Chaos
Many physical phenomena like a swinging pendulum are deterministic and regular. However, some are
deterministic but irregular (atmospheric conditions); a minor change in one parameter may give rise to drastic
changes; this is a state of chaos.

A Logistic Example

1. Let pn + 1 be the population at year (n + 1). A simple model may be:


pn + 1 = pn + b pn = (1 + b) pn, where b is the birth rate (> 0).
This model will show that the population will grow without bound!

2. Let pn + 1 = (1 + b)s pn, where s is the survival rate. Here the overall growth rate is (1 + b)s.
If 0 < (1 + b)s < 1, the population will eventually die out.
If (1 + b)s = 1, the population will remain constant.
If (1 + b)s > 1, the population will grow without bound.

3. These linear models are not realistic. May and Feigenbaum examine a logistic function. Suppose there is
a maximum population P that the resources can support. Multiple the above equation by (P – pn); notice
that as pn increases, this term becomes smaller. We have
p n+1  p p
pn + 1 = (1 + b)s(P – pn)pn or = λ 1 − n  n , or
P  P  P
xn+1 = λ(1 – xn) xn, where 0 < xn ≤ 1. The xn is called relative population and λ the effective growth rate.

1 1 1
4. The maximum value of (1 – xn) xn is when xn = . Thus, the maximum value of xn+1 is λ. Since
4 2 4
0 ≤ xn+1 ≤ 1, we have 0 ≤ λ ≤ 4.

5. (Excel) Use the file chaos.xls to explore what happens when λ is changed, and when x0 is changed
(remains between 0 and 1).

6. If λ < 1, xn+1 = λ(1 – xn) xn ≤ λ xn < xn, so the population decreases to zero as n increases.

7. If λ = 1, the population also decreases to zero.

8. If λ > 1, find the value x* such that x* = λ(1 – x*)x*, i.e., x* = 1− λ1 . This value is called a fixed point of
the logistic function.

9. When λ is between 1 and 3, the sequence converges to one point, the fixed point. In this case, the initial
value has no effect on the fixed point. The population will remain the same each year after the nth year.

10. For λ between 3 and 3.42, the sequence converges alternatively to two points. The population alternates in
size from year to year (perhaps depending on the resources). This dynamic change in behaviour is called a
period-doubling bifurcation.

11. As λ increases from 3.45, each period-two point divides into two points, so the sequence has four fixed
points. The population repeats every four years. With further small increments of λ, the sequence changes
to a period of 8, 16, and so forth. This is called a period-doubling cascade.

5
12. When λ = 3.53, the length of the period grows beyond bounds, and chaotic dynamics has set in. Although
the sequence is completely determined by the initial value x0 and the value chosen for λ, the behaviours
can become unpredictable.

13. When λ = 3.7 and x0 chosen to be 0.9 and 0.9000009, the two sequences appear similar for the first 35
term and then diverge and become unrelated after the 40th term. Thus, a slight change in initial value
causes drastic different behaviours. In terms of prediction, the accuracy of the initial value is crucial
(horizon of predictability, limits the range of valid prediction).

Julia sets

These sets are named after the mathematician, Gaston Julia (1893 – 1978), who first worked on these sets in
1916 when he was recovering in a hospital from injury incurred during the First World War.

Iterations on Real Numbers

1. Consider the iteration on real numbers: x → x2 + c, where c is a fixed real number.

2. Begin with the simple case c = 0 and x → x2. Let x0 be the initial value. Use calculator to compute the
following sequences:
(a) | x0| < 1. The sequence converges to 0; 0 is an attractor which draws the sequence into it.
(b) | x0| > 1. The sequence diverges.
(c) x0 = -1 or 1. The sequence remains at 1.

3. Fix a value for c and let x0 = 0. What happens to the sequence when c changes in values, especially at the
boundaries? Explore these cases using Excel, chaotic.xls.
(a) c < -2: it diverges.
(b) c = -2: it converges to 2. (2 is called the iterates of zero because x0 = 0)
(c) -2 < c ≤ -0.75: it oscillates.
(d) -0.75 < c ≤ 0.25: it converges; the limiting value is the solution of x = x2 + c, i.e., x = 1+ 1− 4c or
2
x = 1− 1− 4c
2
(e) c > 0.25: it diverges.

Iterations on Complex Numbers

1. Consider the same transformation on the complex plane, z → z2 + c, where c is a fixed complex number.
Let z0 be an initial complex number in the transformation. If the sequence of complex numbers from the
transformation converges to the origin (in the Argand diagram), then z0 is said to be a prisoner. If the
sequence diverges, it is an escaper.

2. If c = 0, the transformation becomes z → z2. It is easy to show that all points inside the unit circle about
the origin are prisoners, whereas points outside the unit circle are escapers. Points on the circle are moved
to other points on the circle! It is a useful exercise to plot the first few terms of the sequence for points z0
chosen in different quadrants of the Argand diagram.

3. (Logo) Type juliapt to check whether individual points z0 are escapers or prisoners. Set the maximum
iterations to about 100. For each point in the sequence, determine its distance from the origin; if this
distance is greater than 1 +
2
( 14 + | c |) (Bills & Bills) or 10 (usual limit), the sequence is likely to diverge.
6
4. The boundary of the prisoner set (consisting of the z0 values) is called a Julia set for the specific value of c.

5. (Logo) Type juliaset to plot all the points defined by -1.5 ≤ x ≤ 1.5 and -1.5 ≤ y ≤ 1.5. Examples to try:
c = 0.3; c = -0.05 + 0.745i, c = -0.5; c = -0.71 + 0.36i; c = 0.27 + 0.49i. The cross shows the position of the
point c; in the last two cases, the regions cover the point c. Each diagram takes about 15 minutes.

c = 0.3 c = -0.05 + 0.745i c = -0.6

Mandelbrot Set

1. These sets are named after the mathematician, Benoit Mandelbrot, who first produced them in 1979. The
Mandelbrot set is shown below. It consists of a main bay (the lake), three baylets, and fractal shorelines.

2. Each value of the Mandelbrot set corresponds to one Julia set c. If c is inside the “lake”, the corresponding
Julia set is connected. As c moves towards the shore, the Julia set becomes convoluted and eventually
becomes disconnected.

3. (Logo) The mandelst procedure uses z → z2 + 1.5c,and points are plotted for –1.5 ≤ x ≤ 0.5 and –1 ≤ y ≤ 1.
Using the default parameters, the following plot is obtained; time taken is about 12 minutes. In the
construction, take a value of c and check whether the origin is a prisoner. If so, the value of c is included
(plotted).

4. In colouring Mandelbrot set, points outside the set are coloured according to the number of iterations to
test a point. For example, if a test point escapes in a few iterations, it might be coloured red; if it escapes
in many iterations, it might be coloured blue, and so on.

References

Bills, C., & Bills, L. (1997). A little bit of chaos. In M. Sewell (Ed.), Mathematics masterclass: Stretching the
imagination (pp. 1-15). Oxford: Oxford University Press.
Field, M., & Golubitsky, M. (1992). Symmetry in chaos: A search for pattern in mathematics, art and nature.
Oxford: Oxford University Press.
Muller, J. (1997). The great Logo adventure: Discovering Logo on and off the computer. Madison, AL: Doone
Publications.
Peitgen, H.O., Jürgens, H., Saupe, D., Maletsky, E., Perciante, T., & Yunker, L. (1991). Fractals for the
classroom: Strategic activities (Vol. 1). New York: Springer-Verlag & NCTM .
Fractals: A Fractal Unit for Elementary and Middle School Students (http://math.rice.edu/~lanius/frac/)

7
The Spanky Fractal Database of the Stone Soup Group (http://spanky.triumf.ca/www/fractint/fractint.html) for
the freeware, Fractint, used to generate various types of fractals under DOS. Instructions and examples
given in Wegner, T. & Tyler, B. (1993). Fractal creations (2nd ed.).
Fractal Pictures and Animations (http://www.cnam.fr/fractals.html)

Logo Procedures
TO SIDE1 :SIZE :LEVEL
IF :LEVEL = 0 [FD :SIZE STOP]
SIDE1 :SIZE / 3 :LEVEL - 1 LT 60
SIDE1 :SIZE / 3 :LEVEL - 1 RT 120
SIDE1 :SIZE / 3 :LEVEL - 1 LT 60
SIDE1 :SIZE / 3 :LEVEL - 1
END

TO KOCH :SIZE :LEVEL


REPEAT 3 [RT 120 SIDE1 :SIZE :LEVEL]
END

TO KOCHST
CS WINDOW PU SETXY [-200 80] PD
SETPC 0 KOCH 200 1 WAIT 30
SETPC 9 KOCH 200 2 WAIT 30
SETPC 5 KOCH 200 3 WAIT 30
SETPC 12 KOCH 200 4
END

TO SIDE2 :SIZE :LEVEL


IF :LEVEL = 0 [FD :SIZE STOP]
SIDE2 :SIZE / 3 :LEVEL - 1 LT 90
SIDE2 :SIZE / 3 :LEVEL - 1 RT 90
SIDE2 :SIZE / 3 :LEVEL - 1 RT 90
SIDE2 :SIZE / 3 :LEVEL - 1 LT 90
SIDE2 :SIZE / 3 :LEVEL - 1
END

TO QKOCH:SIZE :LEVEL
REPEAT 4 [RT 90 SIDE2 :SIZE :LEVEL]
END

TO QKOCHST
CS WINDOW PU SETXY [-200 80] PD
SETPC 0 QKOCH 100 1 WAIT 30
SETPC 9 QKOCH 100 2 WAIT 30
SETPC 5 QKOCH 100 3 WAIT 30
SETPC 12 QKOCH 100 4
END

TO SIDE3 :SIZE :LEVEL


IF :LEVEL = 0 [FD :SIZE STOP]
SIDE3 :SIZE / 3 :LEVEL - 1 LT 90
SIDE3 :SIZE / 3 :LEVEL - 1 RT 90
SIDE3 :SIZE / 3 :LEVEL - 1 RT 90
SIDE3 :SIZE / 3 :LEVEL - 1 RT 90
SIDE3 :SIZE / 3 :LEVEL - 1 LT 90
SIDE3 :SIZE / 3 :LEVEL - 1 LT 90
SIDE3 :SIZE / 3 :LEVEL - 1 LT 90
SIDE3 :SIZE / 3 :LEVEL - 1 RT 90
SIDE3 :SIZE / 3 :LEVEL - 1
END
8
TO PEANO :SIZE :LEVEL
REPEAT 4 [RT 90 SIDE3 :SIZE :LEVEL]
END

TO PEANOST
CS PU SETXY [-200 50] PD
SETPC 0 PEANO 100 1 WAIT 30
SETPC 9 PEANO 100 2 WAIT 30
SETPC 5 PEANO 100 3 WAIT 30
SETPC 12 PEANO 100 4
END

TO SIDE4 :SIZE :LEVEL


IF :LEVEL = 0 [FD :SIZE STOP]
SIDE4 :SIZE / 4 :LEVEL - 1 LT 90
SIDE4 :SIZE / 4 :LEVEL - 1 RT 90
SIDE4 :SIZE / 4 :LEVEL - 1 RT 90
SIDE4 :SIZE / 2 :LEVEL - 1 LT 90
SIDE4 :SIZE / 4 :LEVEL - 1 LT 90
SIDE4 :SIZE / 4 :LEVEL - 1 RT 90
SIDE4 :SIZE / 4 :LEVEL - 1
END

TO ISLAND :SIZE :LEVEL


REPEAT 4 [RT 90 SIDE4 :SIZE :LEVEL]
END

TO ISLANDST
CS PU SETXY [-200 50] PD
SETPC 0 ISLAND 100 1 WAIT 30
SETPC 9 ISLAND 100 2 WAIT 30
SETPC 5 ISLAND 100 3 WAIT 30
SETPC 12 ISLAND 100 4
END

TO SIDE5 :SIZE :LEVEL


IF :LEVEL = 0 [FD :SIZE STOP]
SIDE5 :SIZE / 3 :LEVEL - 1 RT 60
SIDE5 :SIZE / 3 :LEVEL - 1 LT 120
SIDE5 :SIZE / 3 :LEVEL - 1 RT 60
SIDE5 :SIZE / 3 :LEVEL - 1
END

TO KOCHANTI :SIZE :LEVEL


REPEAT 3 [RT 120 SIDE5 :SIZE :LEVEL]
END

TO KOCHANTIST
CS WINDOW PU SETXY [-200 80] PD
SETPC 0 KOCHANTI 200 1 WAIT 30
SETPC 9 KOCHANTI 200 2 WAIT 30
SETPC 5 KOCHANTI 200 3 WAIT 30
SETPC 12 KOCHANTI 200 4
END

9
TO SIER
PU
MAKE "V RANDOM 3
IF :V=1 [SETPC 1 SETXY LIST (1-:C)*XCOR (1-:C)*YCOR+119*:C]
IF :V=2 [SETPC 2 SETXY LIST (1-:C)*XCOR-139*:C (1-:C)*YCOR-119*:C]
IF :V=3 [SETPC 12 SETXY LIST(1-:C)*XCOR+139*:C (1-:C)*YCOR-119*:C]
PD FD 1 BK 1
SIER
END

TO SIERST
CS WINDOW PU
TYPE [ENTER THE DIVISION RATIO (SAY .5)] MAKE "C READ
SETXY LIST ( 140 - RANDOM 280) (120-RANDOM 240)
PD FD 1 BK 1
SIER
END

TO SIERSQ
PU MAKE "V RANDOM 4
IF :V=1 [SETPC 1 SETXY LIST (1-:c)*XCOR-139*:C (1-:C)*YCOR+119*:C]
IF :V=2 [SETPC 4 SETXY LIST (1-:C)*XCOR+139*:C (1-:C)*YCOR+119*:C]
IF :V=3 [SETPC 9 SETXY LIST (1-:C)*XCOR-139*:C (1-:C)*YCOR-119*:C]
IF :V=4 [SETPC 12 SETXY LIST (1-:C)*XCOR+139*:C (1-:C)*YCOR-119*:C]
PD FD 1 BK 1
SIERSQ
END

TO SIERSQST
CS WINDOW PU
SETXY LIST ( 140 - RANDOM 280) (120-RANDOM 240)
PD FD 1 BK 1
TYPE [ENTER THE DIVISION RATIO (SAY .5)] MAKE "C READ
SIERSQ
END

TO JULIAPT
CS HT WINDOW SETPC 0
TYPE [ENTER THE SCALING FACTOR FOR AXES (SAY 60) ==>] MAKE "SCALE READ
TYPE [ENTER THE REAL PART OF C ==>] MAKE "CR READ
TYPE [ENTER THE IMAGINARY PART OF C ==>] MAKE "CI READ
MAKE "LIMIT 0.5 + SQRT(.25+ SQRT (:CR*:CR + :CI*:CI))
SETPC 12 DOT LIST :CR*:SCALE :CI*:SCALE
TYPE [HOW MANY ITERATIONS TO TAKE (SAY 100) ==>] MAKE "TIMES READ
GETPOINTS1
END

TO AXES
CS SETPC 0 BK 2*:SCALE TICK
REPEAT 4 [FD :SCALE TICK] BK 2*:SCALE RT 90 BK 2*:SCALE TICK
REPEAT 4 [FD :SCALE TICK] HOME
END

TO TICK
LT 90 FD 3 BK 6 FD 3 RT 90
END

10
TO GETPOINTS1
TYPE [ENTER THE REAL PART OF A COMPLEX NUMBER ==>] MAKE "R0 READ
TYPE [ENTER THE IMAGINARY PART OF THE COMPLEX NUMBER ==>] MAKE "I0 READ
MAKE "RT :R0 MAKE "IT :I0
AXES
PU SETXY LIST :R0*:SCALE :I0*:SCALE PD SETPC 12
CHECKSTATUS :RT :IT
IF :J = 0 (PRINT :R0 :I0 "PRISONER)
IF :J = 1 (PRINT :R0 :I0 "ESCAPER)
GETPOINTS1
END

TO CHECKSTATUS :XR :XI


MAKE "J 0
JULIA 1
END

TO JULIA :T
IF :T = :TIMES [STOP]
MAKE "R1 (:RT*:RT - :IT*:IT + :CR)
MAKE "I1 2*:RT*:IT+:CI
MAKE "DIST SQRT (:R1*:R1 + :I1*:I1)
SETXY LIST :R1*:SCALE :I1*:SCALE
(PR :R1 :I1 "DISTANCE :DIST) WAIT 10
IF :DIST > :LIMIT [MAKE "J 1 STOP]
MAKE "RT :R1 MAKE "IT :I1
JULIA :T+1
END

TO JULIASET
CS WINDOW HT
TYPE [ENTER THE SCALING FACTOR FOR AXES (SAY 50) ==>] MAKE "SCALE READ
TYPE [ENTER THE REAL PART OF C ==>] MAKE "CR READ
TYPE [ENTER THE IMAGINARY PART OF C ==>] MAKE "CI READ
MAKE "LIMIT 0.5 + SQRT(.25+ SQRT (:CR*:CR + :CI*:CI))
SETPC 12 DOT LIST :CR*:SCALE :CI*:SCALE MARK
MAKE "TIMES 20
TYPE [ENTER THE NUMBER OF DIVISIONS TO TAKE (SAY 200)==>] MAKE "D READ
MAKE "LP 3/:D
FOR "N 0 :D [MAKE "R0 (-1.5)+:N*:LP FOR "M 0 :D [MAKE "I0 (-1.5)+:M*:LP
GETPOINTSJ]]
END

TO MARK
PU SETXY LIST :CR*:SCALE :CI*:SCALE SETH 45 PD
REPEAT 4 [FD 5 BK 5 RT 90]
PU
END

TO GETPOINTSJ
MAKE "RT :R0 MAKE "IT :I0
CHECKSTATUSJ :RT :IT
IF :J = 0 [(PRINT :R0 :I0 "PRISONER) SETPC 0 DOT LIST :R0*:SCALE :I0*:SCALE]
;IF :J = 1 [(PRINT :R0 :I0 "ESCAPER) SETPC 13 DOT LIST :R0*:SCALE :I0*:SCALE]
END

TO CHECKSTATUSJ :XR :XI


MAKE "J 0
JULIAJ 1
END

11
TO JULIAJ :T
IF :T = :TIMES [STOP]
MAKE "R1 (:RT*:RT - :IT*:IT + :CR)
MAKE "I1 2*:RT*:IT+:CI
;(PR :R1 :I1) WAIT 10 (INCLUDE THIS TO SHOW THE SEQUENCE)
IF (SQRT (:R1*:R1 + :I1*:I1)) > :LIMIT [MAKE "J 1 STOP]
MAKE "RT :R1 MAKE "IT :I1
JULIAJ :T+1
END

TO MANDELST
CS WINDOW HT
TYPE [ENTER THE SCALING FACTOR FOR AXES (SAY 50) ==>] MAKE "SCALE READ
TYPE [ENTER THE NUMBER OF C TO CHECK (SAY 500)==>] MAKE "C READ
TYPE [ENTER THE LIMIT OF DISTANCE TO TEST (SAY 10) ==>] MAKE "LIMIT READ
TYPE [ENTER THE MAXIMUM NO. OF ITERATION (SAY 20) ==>] MAKE "TIMES READ
MAKE "LP 2/:C
FOR "N 0 :C [MAKE "CR (-1.5)+:N*:LP FOR "M 0 :C [MAKE "CI (-1)+:M*:LP GETPOINTS3]]
END

TO GETPOINTS3
MAKE "R0 0 MAKE "I0 0
MAKE "RT :R0 MAKE "IT :I0
CHECKSTATUS3 :RT :IT
IF :J = 0 [(PRINT :CR :CI "PRISONER) SETPC 0 DOT LIST :CR*:SCALE :CI*:SCALE]
;IF :J = 1 [(PRINT :CR :CI "ESCAPER) SETPC 13 DOT LIST :CR*:SCALE :CI*:SCALE]
END

TO CHECKSTATUS3 :XR :XI


MAKE "J 0
MANDEL 1
END

TO MANDEL :T
IF :T = :TIMES [STOP]
MAKE "R1 (:RT*:RT - :IT*:IT + 1.5*:CR)
MAKE "I1 2*:RT*:IT+1.5*:CI
IF (SQRT (:R1*:R1 + :I1*:I1)) > :LIMIT [MAKE "J 1 STOP]
MAKE "RT :R1 MAKE "IT :I1
MANDEL :T+1
END

12
Koch Curve (stage 3)

Koch Curve (stage 4)

Quadric Koch Curve (stage 3)

Koch Snowflake (stages 1, 2, 3)

13
Koch Anti-Snowflake (stages 1, 2, 3)

Peano Curve (stages 1, 2, 3)

Quadric Island Curve (stages 1, 2, 3)

Sierpinski Triangle

14
Julia Sets

c = 0.3 c = -0.05 + 0.745i

c = -0.6

Mandelbrot Set

15
Instructions for Fractals on PC Logo

In each case, change the input values and see what happen!

Koch Curve ? cs rt 90
? side1 100 0
? side1 100 1
? side1 100 2

Quadric Koch Curve ? cs rt 90


? side2 100 0
? side2 100 1
? side2 100 2

Koch Snowflake ? cs koch 100 0


? koch 100 1
? koch 100 2
? kochst

Koch Anti-Snowflake ? cs kochanti 100 0


? cs kochanti 100 1
? cs kochanti 100 2
? kochantist

Quadric Koch Snowflake ? cs qkoch 100 0


? qkoch 100 1
? qkoch 100 2
? qkochst

Peano Curve ? cs rt 90
? side3 100 0
? side3 100 1
? side3 100 2

Quadric Island ? cs rt 90
? side4 100 0
? side4 100 1
? side4 100 2

Sierpinski Triangle as a chaos sierst (enter a value between 0 and 1)


game

16

Anda mungkin juga menyukai