Phrallic Frolics

It’s a classic of low literature:

There was a young man of Devizes
Whose balls were of different sizes:
     The one was so small
     ’Twas no use at all;
But t’other won several prizes.

But what if he had been a young man with balls of different colours? This is a core question I want to interrogate issues around in terms of the narrative trajectory of this blog-post. Siriusly. But it’s not the keyliest core question. More corely keyly still, I want to ask what a fractal phallus might look like. Or a phrallus, for short. The narrative trajectory initializes with this fractal, which is known as a pentaflake (so-named from its resemblance to a snowflake):

Pentaflake — a pentagon-based fractal


It’s created by repeatedly replacing pentagons with six smaller pentagons, like this:

Pentaflake stage 0


Pentaflake stage 1


Pentaflake stage 2


Pentaflake stage 3


Pentaflake stage 3


Pentaflake stage 4


Pentaflake (animated)


Pentaflake (static)


This is another version of the pentaflake, missing the central pentagon of the six used in the standard pentaflake:

No-Center Pentaflake stage 0


No-Center Pentaflake stage 1


Stage 2


Stage 3


Stage 4


No-Center Pentaflake (animated)


No-Center Pentaflake (static #1)


No-Center Pentaflake (static #2)


The phrallus, or fractal phallus, begins with an incomplete version of the first stage of the pentaflake (note balls of different colours):

Phrallus stage 1


Phrallus stage 1 (monochrome)


Phrallus stage 2


Phrallus stage 3


Stage 4


Stage 5


Stage 6


Stage 7


Stage 8


And there you have it: a fractal phallus, or phrallus. Here is an animated version:

Phrallus (animated)


Phrallus (static)


But the narrative trajectory is not over. The center of the phrallus can be rotated to yield mutant phralloi. Stage #1 of the mutants looks like this:

Phrallus (mutation #1)


Phrallus (mutation #2)


Phrallus (mutation #3)


Phrallus (mutation #4)


Phrallus (mutation #5)


Mutant phralloi (rotating)


Here are some animations of the mutant phralloi:

Phrallus (mutation #3) (animated)


Phrallus (mutation #5) (animated)


This mutation doesn’t position the pentagons in the usual way:

Phrallus (another upright version) (animated)


The static mutant phralloi look like this:

Phrallus (mutation #2)


Phrallus (mutation #3)


Phrallus (upright #2)


And if the mutant phralloi are combined in a single image, they rotate like this:

Mutant phralloi (rotating)


Coloured mutant rotating phralloi #1


Coloured mutant rotating phralloi #2


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

Corralling Chaos

All the best people brood incessantly on the fact that a point inside a square jumping half-way towards a randomly chosen vertex will not create a fractal. Inside a triangle, yes: a fractal appears. Inside a pentagon too. But not inside a square:

Point jumping half-way towards a randomly chosen vertex


Instead, the interior of the square fills with random points: it crawls with chaos, you might say. However, fractals appear inside a square if the point is restricted in some way: banned from jumping towards a vertex twice in a row; banned from jumping towards the second-nearest vertex; and so on. Those restrictions are what might be called soft, because they take place in software (or in the brain of someone following the rule as a game or piece of performance art). Here’s what might be called a hard restriction that creates a fractal: the point cannot jump towards a randomly vertex if its jump passes over any part of the red upright cross:

Point cannot pass over red lines


I call this a barrier fractal. It’s obvious that the point cannot jump from one corner of the square towards the opposite corner, which creates bare space stretching from each vertex towards the tips of the upright cross. Less obvious is the way in which this bare space “cascades” into other parts of the square, creating a repeatedly branching and shrinking pattern.



When the barrier is a circle, a similar fractal appears:


If the point can also jump towards the center of the circle, this is what happens:

“Down through the aether I saw the accursed earth turning, ever turning, with angry and tempestuous seas gnawing at wild desolate shores and dashing foam against the tottering towers of deserted cities.” — “The Crawling Chaos” (1921), Winifred Jackson and H. P. Lovecraft.


Now here’s an upright cross with a gap in the middle:


Here’s an upright cross when the point can also jump towards the center of the cross:


A slanted cross with a central attractor:


And a single horizontal stroke:


A slanted stroke — note pentagons:


Even if the barrier is small and set on an edge of the square, it affects the rest of the square:


A more attractive example of edge-affects-whole:


Circles away from the edges


Detail of previous image






Here the point can also jump towards the center of the square’s edges:


A more subtle barrier fractal uses the previous jumps of the point to restrict its next jump. For example, if the point cannot jump across the line created by its previous-but-one jump, it moves like this:

Jump can’t cross track of last-but-one jump (animated gif)


The fractal itself looks like this:


Rule: on jump #3, cannot jump across the line created by jump #1; on jump #4, cannot cross the line created by jump #2; and so on.



And this is the fractal if the point cannot jump across the line created by its previous-but-two jump:

Rule: on jump #4, cannot jump across the line created by jump #2; on jump #5, cannot cross the line created by jump #3; and so on



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.

The Swing’s the Thing

Order emerges from chaos with a triangle or pentagon, but not with a square. That is, if you take a triangle or a pentagon, chose a point inside it, then move the point repeatedly halfway towards a vertex chosen at random, a fractal will appear:

triangle

Sierpiński triangle from point jumping halfway to randomly chosen vertex


pentagon

Sierpiński pentagon from point jumping halfway to randomly chosen vertex


But it doesn’t work with a square. Instead, the interior of the square slowly fills with random points:

square

Square filling with point jumping halfway to randomly chosen vertex


As I showed in Polymorphous Perverticity, you can create fractals from squares and randomly moving points if you ban the point from choosing the same vertex twice in a row, and so on. But there are other ways. You can take the point, move it towards a vertex at random, then swing it around the center of the square through some angle before you mark its position, like this:

square_sw90

Point moves at random, then swings by 90° around center


square_sw180

Point moves at random, then swings by 180° around center


You can also adjust the distance of the point from the center of the square using a formula like dist = r * rmdist, where dist is the distance, r is the radius of the circle in which the circle is drawn, and rm takes values like 0.1, 0.25, 0.5, 0.75 and so on:

square_dist_rm0_05

Point moves at random, dist = r * 0.05 – dist


square_dist_rm0_1

Point moves at random, dist = r * 0.1 – dist


square_dist_rm0_2

Point moves at random, dist = r * 0.2 – dist


But you can swing the point while applying a vertex-ban, like banning the previously chosen vertex, or the vertex 90° or 180° away. In fact, swinging the points converts one kind of vertex ban into the others.

square_ban0

Point moves at random towards vertex not chosen previously


square_ban0_sw405

Point moves at random, then swings by 45°


square_ban0_sw360

Point moves at random, then swings by 360°


square_ban0_sw697

Point moves at random, then swings by 697.5°


square_ban0_sw720

Point moves at random, then swings by 720°


square_ban0_sw652

Point moves at random, then swings by 652.5°


square_ban0_swing_va_animated

Animated angle swing


You can also reverse the swing at every second move, swing the point around a vertex instead of the center or around a point on the circle that encloses the square. Here are some of the fractals you get applying these techniques.
square_ban0_sw45_rock

Point moves at random, then swings alternately by 45°, -45°


square_ban0_sw90_rock

Point moves at random, then swings alternately by 90°, -90°


square_ban0_sw135_rock

Point moves at random, then swings alternately by 135°, -135°


square_ban0_sw180_rock

Point moves at random, then swings alternately by 180°, -180°


square_ban0_sw225

Point moves at random, then swings alternately by 225°, -225°


square_ban0_sw315

Point moves at random, then swings alternately by 315°, -315°


square_ban0_sw360_rock

Point moves at random, then swings alternately by 360°, -360°


square_swing_vx0_va_animated

Animated alternate swing


square_circle_sw45

Point moves at random, then swings around point on circle by 45°


square_circle_sw67

Point moves at random, then swings around point on circle by 67.5°


square_circle_sw90

Point moves at random, then swings around point on circle by 90°


square_circle_sw112

Point moves at random, then swings around point on circle by 112.5°


square_circle_sw135

Point moves at random, then swings around point on circle by 135°


square_circle_sw180

Point moves at random, then swings around point on circle by 180°


square_circle_sw_animated

Animated circle swing


Tri Again (Again)

I didn’t expect to find the hourglass fractal playing with squares. I even less expected it playing with triangles. Isosceles right triangles, to be precise. Then again, I found it first playing with the L-triomino, which is composed of three squares. And an isosceles triangle is half of a square. So it all fits. This is an isosceles right triangle:
isosceles_right_triangle

Isosceles right triangle


It’s mirror-symmetrical, so it looks the same in a mirror unless you label one of the acute-angled corners in some way, like this:

right_triangle_chiral_1

Right triangle with labelled corner


right_triangle_chiral_2

Right triangle reflected


Reflection is how you find the hourglass fractal. First, divide a right triangle into four smaller right triangles.

right_triangle_div4

Right triangle rep-tiled


Then discard one of the smaller triangles and repeat. If the acute corners of the smaller triangles have different orientations, one of the permutations creates the hourglass fractal, like this:

right_triangle_div4_1

Hourglass #1


right_triangle_div4_2

Hourglass #2


right_triangle_div4_3

Hourglass #3


right_triangle_div4_4

Hourglass #4


right_triangle_div4_5

Hourglass #5


right_triangle_div4_6

Hourglass #6


right_triangle_div4_7

Hourglass #7


right_triangle_div4_8

Hourglass #8


right_triangle_div4_9

Hourglass #9


right_triangle_div4_123_010

Hourglass animated


Another permutation of corners creates what I’ve decided to call the crane fractal, like this:
right_triangle_div4_123_001

Crane fractal animated


right_triangle_div4_123_001_static

Crane fractal (static)


The crane fractal is something else that I first found playing with the L-triomino:

l-triomino_234

Crane fractal from L-triomino


Previously pre-posted:

Square Routes
Tri Again

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)


Tri-Way to L

The name is more complicated than the shape: L-triomino. The shape is simply three squares forming an L. And it’s a rep-tile — it can be divided into four smaller copies of itself.

l-triomino

An L-triomino — three squares forming an L


l-triomino_anim

L-triomino as rep-tile


That means it can also be turned into a fractal, as I’ve shown in Rep-Tiles Revisited and Get Your Prox Off #2. First you divide an L-triomino into four sub-copies, then discard one sub-copy, then repeat. Here are the standard L-triomino fractals produced by this technique:

l-triomino_123_134

Fractal from L-triomino — divide and discard


l-triomino_234


l-triomino_124


l-triomino_124_upright


l-triomino_124_upright_static1

(Static image)


l-triomino_124_upright_static2

(Static image)


But those fractals don’t exhaust the possibilities of this very simple shape. The standard L-triomino doesn’t have true chirality. That is, it doesn’t come in left- and right-handed forms related by mirror-reflection. But if you number its corners for the purposes of sub-division, you can treat it as though it comes in two distinct orientations. And when the orientations are different in the different sub-copies, new fractals appear. You can also delay the stage at which you discard the first sub-copy. For example, you can divide the L-triomino into four sub-copies, then divide each sub-copy into four more sub-copies, and only then begin discarding.

Here are the new fractals that appear when you apply these techniques:

l-triomino_124_exp

Delay before discarding


l-triomino_124_exp_static

(Static image)


l-triomino_124_tst2_static1

(Static image)


l-triomino_124_tst2_static2

(Static image)


l-triomino_124_tst1


l-triomino_124_tst1_static1

(Static image)


l-triomino_124_tst1_static2

(Static image)


l-triomino_134_adj1

Adjust orientation


l-triomino_134_adj2


l-triomino_134_adj3


l-triomino_134_adj3_tst3

(Static image)


l-triomino_134_adj4


l-triomino_134_exp_static

(Static image)


l-triomino_234_exp

Go with the Floe

Fractals are shapes that contain copies of themselves on smaller and smaller scales. There are many of them in nature: ferns, trees, frost-flowers, ice-floes, clouds and lungs, for example. Fractals are also easy to create on a computer, because you all need do is take a single rule and repeat it at smaller and smaller scales. One of the simplest fractals follows this rule:

1. Take a line of length l and find the midpoint.
2. Erect a new line of length l x lm on the midpoint at right angles.
3. Repeat with each of the four new lines (i.e., the two halves of the original line and the two sides of the line erected at right angles).

When lm = 1/3, the fractal looks like this:

stick1

(Please open image in a new window if it fails to animate)

When lm = 1/2, the fractal is less interesting:

stick2

But you can adjust rule 2 like this:

2. Erect a new line of length l x lm x lm1 on the midpoint at right angles.

When lm1 = 1, 0.99, 0.98, 0.97…, this is what happens:

stick3

The fractals resemble frost-flowers on a windowpane or ice-floes on a bay or lake. You can randomize the adjustments and angles to make the resemblance even stronger:

frostfloe

Ice floes (see Owen Kanzler)

Ice floes (see Owen Kanzler)

Frost on window (see Kenneth G. Libbrecht, )

Frost on window (see Kenneth G. Libbrecht)

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