Square Routes Revisited

Take a square, divide it into four smaller squares, and discard the smaller square on the top right. Do the same to each of the subsquares, dividing it into four sub-subsquares, then discarding the one on the top right. And repeat with the sub-subsquares. And the sub-sub-squares. And the sub-sub-sub-squares. And so on. The result is a fractal like this:

sq2x2_123_1

Stage 1


sq2x2_123_2

Stage 2


sq2x2_123_3

Stage 3


sq2x2_123_4

Stage 4


sq2x2_123

Animated fractal


sq2x2_123_static

Final fractal (static)


It looks as though this procedure isn’t very fertile. But you can enrich it by rotating each of the subsquares in a different way, so that the discarded sub-subsquare is different. Here’s an example:

Stage 1


Stage 2


Stage 3


Stage 4


Stage 5


Stage 6


Stage 7


Animated fractal


Final fractal (static)


Here are more examples of how rotating the subsquares in different ways produces different fractals:

Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Animated fractal

Static fractal


Previously pre-posted:

Square Routes — first look at this kind of fractal

Advertisements

Appointment with Distality

distal, adj. Anat. Situated away from the centre of the body, or from the point of origin (said of the extremity or distant part of a limb or organ); terminal. Opp. to proximal. [← stem of dist- (in distant adj.) + -al, after dorsal, ventral, etc.] — Oxford English Dictionary

When a point jumps inside a triangle, moving halfway towards a randomly chosen vertex each time, a fractal known as the Sierpiński triangle appears:
chaos_triangle

Point jumping halfway towards random vertex of a triangle


chaos_triangle_bw

Point jumping inside triangle (black-and-white version)


But when a point moves at random in the same way inside a square, no fractal appears. Instead, the interior of the square gradually fills with a haze of pixels:
random_fill

Point jumping halfway towards random vertex of a square


Now trying imposing restrictions on the point jumping inside a square. If it can’t jump towards a vertex twice in a row, this fractal appears:
select_1_0

Ban consecutive jumps towards same vertex


select_1_0_bw

Ban consecutive jumps towards same vertex (black-and-white version)


Suppose the vertices are numbered from 1 to 4 and the point can’t jump towards the vertex one lower than the previously chosen vertex. That is, if it jumps towards vertex 3, it can’t jump next towards vertex 2, but it can jump towards vertices 1, 3, or 4 (if the vertex is 1, it’s banned from moving towards vertex 4, i.e. 1-1 = 0 = 4). Now this fractal appears:
select_1_1

Ban jump towards vertex v-1


select_1_1_bw


This is the fractal when the point can’t jump towards the vertex two places lower than the one it has just jumped towards:
select_1_2

Ban jump towards vertex v-2


select_1_2_bw


But if you can ban, you can also un-ban. Suppose the point jumps towards vertex v at time t and is then banned from jumping towards vertex v-2 at time t+1 unless it had jumped towards vertex v-1 at time t-1. This interesting fractal appears:
select_2_1_1_2

Ban jump v-2 at t+1 unless jump v-1 at t-1


Here are some more fractals using the ban / un-ban technique:
select_2_1_various

Ban / un-ban various


select_2_1_0_1

Ban jump v+0 at t+1 unless jump v+1 at t-1


select_2_1_1_3

Ban jump v+1 at t+1 unless jump v+3 at t-1


select_2_1_2_0

Ban jump v+0 at t+1 unless jump v+2 at t-1


select_2_1_2_2

Ban jump v+2 at t+1 unless jump v+2 at t-1


select_1_2_various

Ban / un-ban various


You can also impose or lift bans based not on the vertex the point jumps towards, but on the distance the point jumps. For example, take the radius r of the circle circumscribing the square and divide it into four segments, 0 to ¼r, ¼r to ½r, ½r to ¾r, and ¾r to r. When the point is going to jump towards vertex v, test whether its jump will land in the same segment, measured from the center of the circle, as it currently occupies. If it does, ban the jump and choose another vertex. Or unban the vertex if the point occupied segment s + x at time t-1. Here are some of the fractals produced using this technique:
dist_2_1_various

Ban / un-ban based on distance jumped


dist_center_1_0

Ban jump into segment s+0 of 4


dist_center_1_1

Ban jump into segment s+1 from center


dist_center_1_2

Ban jump into segment s+2


dist_center_-2_1_2_2

Ban jump into s+2 at t+1 unless jump into s+2 at at t-1


dist_xy_1_0

Ban jump into s+0 from present point


dist_xy_1_2

Ban jump into s+2 from present point


dist_xy_1_3

Ban jump into s+3 from present point


dist_xy_2_1_1_0

Ban jump into s+0 at t+1 unless jump into s+1 at at t-1


It’s easy to think of variants on all these themes, but I’ll leave them as an exercise for the interested reader.

Square Routes

One of the pleasures of exploring an ancient city like York or Chester is that of learning new routes to the same destination. There are byways and alleys, short-cuts and diversions. You set off intending to go to one place and end up in another.

Maths is like that, even at its simplest. There are many routes to the same destination. I first found the fractal below by playing with the L-triomino, or the shape created by putting three squares in the shape of an L. You can divide it into four copies of the same shape and discard one copy, then do the same to each of the sub-copies, then repeat. I’ve decided to call it the hourglass fractal:

l-triomino_124

Hourglass fractal (animated)


l-triomino_124_upright_static1

Hourglass fractal (static)


Then I unexpectedly came across the fractal again when playing with what I call a proximity fractal:
v4_ban15_sw3_anim

Hourglass animated (proximity fractal)


v4_ban15_sw3_col

(Static image)


Now I’ve unexpectedly come across it for a third time, playing with a very simple fractal based on a 2×2 square. At first glance, the 2×2 square yields only one interesting fractal. If you divide the square into four smaller squares and discard one square, then do the same to each of the three sub-copies, then repeat, you get a form of the Sierpiński triangle, like this:

sq2x2_123_1

Sierpiński triangle stage 1


sq2x2_123_2

Sierpiński triangle #2


sq2x2_123_3

Sierpiński triangle #3


sq2x2_123_4

Sierpiński triangle #4


sq2x2_123

Sierpiński triangle animated


sq2x2_123_static

(Static image)


The 2×2 square seems too simple for anything more, but there’s a simple way to enrich it: label the corners of the sub-squares so that you can, as it were, individually rotate them 0°, 90°, 180°, or 270°. One set of rotations produces the hourglass fractal, like this:

sq2x2_123_013_1

Hourglass stage 1


sq2x2_123_013_2

Hourglass #2


sq2x2_123_013_3

Fractal #3


sq2x2_123_013_4

Hourglass #4


sq2x2_123_013_5

Hourglass #5


sq2x2_123_013_6

Hourglass #6


sq2x2_123_013

Hourglass animated


sq2x2_123_013_static

(Static image)


Here are some more fractals from the 2×2 square created using this technique (I’ve found some of them previously by other routes):

sq2x2_123_022


sq2x2_123_022_static

(Static image)


sq2x2_123_031


sq2x2_123_031_static

(Static image)


sq2x2_123_102


sq2x2_123_102_static

(Static image)


sq2x2_123_2011


sq2x2_123_201_static

(Static image)


sq2x2_123_211


sq2x2_123_211_static

(Static image)


sq2x2_123_213


sq2x2_123_213_static

(Static image)


sq2x2_123_033_-111


sq2x2_123_033_-111_static

(Static image)


sq2x2_123_201_1-11_static

(Static image)


sq2x2_200_1-11_static

(Static image)


sq2x2_123_132

(Static image)


Polymorphous Perverticity

As I’ve explained before on Overlord of the Über-Feral, the planet’s premier purveyor of polygonic performativity (probably (possibly (perspectivistically))), it works with triangles and pentagons, but not with squares. And what is “it”? A simple procedure in which you create a polygon, choose a point inside it, then repeatedly move half-way towards a vertex chosen at random, marking each new position as you go.

pol3_4_5

When the polygon has three vertices, you get a Sierpiński triangle. When it has five, you get what might be called a  Sierpiński pentagon. When it has four, you get nothing. Or rather: you get everything, because the whole interior of the square gradually fills with points. But, as I’ve also explained before, there’s a simple way to change this. You can adapt the procedure so that a vertex can’t be chosen twice in a row, and so on.

When the rule is “No vertex twice in a row”, you get this fractal (colours change as a pixel is selected again):

pol4_0

But you can also use what might be a vertex increment, or vi, whereby you disallow vertices that are next to the previously chosen vertex, or two positions away, and so on. When the rule is “No vertex twice in a row”, the disallowed vertex is (v + 0), that is, vi = 0. If vi = 2 and the rule is disallow(v + 2), this fractal appears (when vi = 1, there’s no fractal):

pol4_2

v = 4, vi = 2

pol4_2_anim


You can extend these rules to apply not just to the previously chosen vertex, but also to the vertex chosen before that. Here are some fractals produced by the rule disallow(v[1] + vi[1], v[2] + vi[2]), where v[1] is the vertex previously chosen and v[2] is the vertex chosen before that:

pol4_1_2

v = 4, vi[1] = 1, vi[2] = 2

pol4_1_2_anim


pol4_2_0

v = 4, vi[1] = 2, vi[2] = 0

pol4_2_0_anim

pol4_2_0_white


pol4_2_1

v = 4, vi[1] = 2, vi[2] = 1

pol4_2_1_anim


pol4_2_2

v = 4, vi[1] = 2, vi[2] = 2

pol4_2_2_anim


And here are some fractals produced by the rule disallow(v[1] + vi[1], v[2] + vi[2], v[3] + vi[3]):

pol4_1_1_0

v = 4, vi[1] = 1, vi[2] = 1, vi[3] = 0

pol4_1_1_0_anim


pol4_1_1_2

v = 4, vi[1] = 1, vi[2] = 1, vi[3] = 2

pol4_1_1_2_anim


Applying these rules to pentagons rather than squares doesn’t produce such a dramatic difference, because the original procedure – choose any vertex at random, taking no account of previous choices – produces a fractal when v = 5, as noted above, but not when v = 4. Nevertheless, here are some fractals for v > 4:

pol5_0

v = 5, vi = 0


pol5_1

v = 5, vi = 1

pol5_1_anim


pol5_2

v = 5, vi = 2

pol5_2_anim


pol5_0_0

v = 5, vi[1] = 0, vi[2] = 0


pol5_1_0

v = 5, vi[1] = 1, vi[2] = 0


pol5_2_0

v = 5, vi[1] = 2, vi[2] = 0

pol5_2_0_anim


pol5_1_1

v = 5, vi[1] = 1, vi[2] = 1

pol5_1_1_anim


pol5_1_1_1

v = 5, vi[1] = 1, vi[2] = 1, vi[3] = 1


pol5_va2

v = 5, vi = various


pol6_1

v = 6, vi = 1

pol6_1_anim

Tri Again

All roads lead to Rome, so the old saying goes. But you may get your feet wet, so try the Sierpiński triangle instead. This fractal is named after the Polish mathematician Wacław Sierpiński (1882-1969) and quite a few roads lead there too. You can create it by deleting, jumping or bending, inter alia. Here is method #1:

Sierpinski middle delete

Divide an equilateral triangle into four, remove the central triangle, do the same to the new triangles.

Here is method #2:

Sierpinski random jump

Pick a corner at random, jump half-way towards it, mark the spot, repeat.

And here is method #3:

Sierpinski arrowhead

Bend a straight line into a hump consisting of three straight lines, then repeat with each new line.

Each method can be varied to create new fractals. Method #3, which is also known as the arrowhead fractal, depends on the orientation of the additional humps, as you can see from the animated gif above. There are eight, or 2 x 2 x 2, ways of varying these three orientations, so eight fractals can be produced if the same combination of orientations is kept at each stage, like this (some are mirror images — if an animated gif doesn’t work, please open it in a new window):

arrowhead1

arrowhead2

arrowhead3

arrowhead4

arrowhead5

If different combinations are allowed at different stages, the number of different fractals gets much bigger:

• Continuing viewing Tri Again.

V for Vertex

To create a simple fractal, take an equilateral triangle and divide it into four more equilateral triangles. Remove the middle triangle. Repeat the process with each new triangle and go on repeating it. You’ll end up with a shape like this, which is known as the Sierpiński triangle, after the Polish mathematician Wacław Sierpiński (1882-1969):

Sierpinski triangle

But you can also create the Sierpiński triangle one pixel at a time. Choose any point inside an equilateral triangle. Pick a corner of the triangle at random and move half-way towards it. Mark this spot. Then pick a corner at random again and move half-way towards the corner. And repeat. The result looks like this:

triangle

A simple program to create the fractal looks like this:

initial()
repeat
  fractal()
  altervariables()
until false

function initial()
  v = 3 [v for vertex]
  r = 500
  lm = 0.5
endfunc

function fractal()
  th = 2 * pi / v
[the following loop creates the corners of the triangle]
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
  next l
  fx = xcenter
  fy = ycenter
  repeat
    rv = random(v)
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
    plot(fx,fy)
  until keypressed
endfunc

function altervariables()
[change v, lm, r etc]
endfunc

In this case, more is less. When v = 4 and the shape is a square, there is no fractal and plot(fx,fy) covers the entire square.

square

When v = 5 and the shape is a pentagon, this fractal appears:

pentagon

But v = 4 produces a fractal if a simple change is made in the program. This time, a corner cannot be chosen twice in a row:

square_used1

function initial()
  v = 4
  r = 500
  lm = 0.5
  ci = 1 [i.e, number of iterations since corner previously chosen]
endfunc

function fractal()
  th = 2 * pi / v
  for l = 1 to v
    x[l]=xcenter + sin(l*th) * r
    y[l]=ycenter + cos(l*th) * r
    chosen[l]=0
  next l
  fx = xcenter
  fy = ycenter
  repeat
    repeat
      rv = random(v)
    until chosen[rv]=0
    for l = 1 to v
      if chosen[l]>0 then chosen[l] = chosen[l]-1
    next l
    chosen[rv] = ci
    fx = fx + (x[rv]-fx) * lm
    fy = fy + (y[rv]-fy) * lm
    plot(fx,fy)
  until keypressed
endfunc

One can also disallow a corner if the corner next to it has been chosen previously, adjust the size of the movement towards the chosen corner, add a central point to the polygon, and so on. Here are more fractals created with such variations:

square_used1_center

square_used1_vi1

square_used1_vi2

square_used2

pentagon_lm0.6

pentagon_used1_5_vi1

hexagon_used1_6_vi3