Red Sails in the Subset

Let’s look at a simple arithmetical rule and a simple arithmetical fact. And the complexity they can create. First the rule. Subtracting a negative number is the same as adding the positive form of that number:

7 – +2 = 5
7 – -2 = 7 + 2 = 9

-10 – +4 = -14
-10 – -4 = -10 + 4 = -6

Now the simple arithmetical fact: The reciprocal of positive x, namely 1/x, is less than 1 when x > 1, identical to x when x = 1, and greater than 1 when 0 < x < 1. Negative x, -x, works in the opposite direction:

1/5 = 0.2; 1/-5 = -0.2
1/4 = 0.25; 1/-4 = -0.25
1/3 = 0.333333…; 1/-3 = -0.333333…
1/2 = 0.5; 1/-2 = -0.5

1/1 = 1; 1/-1 = -1

1/0.5 = 2; 1/-0.5 = -2
1/0.25 = 4; 1/-0.25 = -4
1/0.333333.. = 3; 1/-0.333333.. = -3
1/0.2 = 5; 1/-0.2 = -5

Now, the simple arithmetical rule and the simple arithmetical fact explain the wildly different behaviour of these two nearly identical formulae:

Formula #1: x = x + 1/x
Formula #2: x = x – 1/x

If you seed x = x + 1/x with 2, this is what happens:

2 = x
2.5 = 2 + 1/2 = 2 + 0.5
2.9 = 2.5 + 1/2.5 = 2.5 + 0.4
3.244827586206896551724137931… = 2.9 + 1/2.9 = 2.9 + 0.3448275862…
3.553010370478947561288431236…
3.834461842815967366750790750…
4.095254632258778985771918456…
4.339439692724345181049239663…
4.569884190357676650018985962…
4.788708116379690742064597208…
4.997532704493448986664559639…
5.197631445038131469095668466…
5.390026771750770995914851381…
5.575554607204394029915651664…
5.754908962142979073283550015…
5.928673657045750549124213874…
6.097345447373015508408978797…
6.261351244425377152997703626…
6.421061179383957004641284553…
6.576798676981813718180627345…

The value of x steadily (but more and more slowly) increases. But when you seed the other formula, x = x – 1/x, with 2, this is what happens:

+2
+1.5 = 2 – 1/2 = 2 – 0.5
+0.8333333… = 1.5 – 1/1.5 = 1.5 – 0.666666…
-0.3666666… = 0.8333333… – 1/0.8333333… = 0.8333333… – 1.2
+2.3606060606… = -0.3666666… – 1/-0.3666666… = -0.3666666… – -2.72727272… = -0.3666666… + 2.72727272…
+1.936986034932119656124790913…
+1.420720051612810742016492942…
+0.716851616121389735975863550…
-0.678137217705362317788764881…
+0.796490591963802485322149292…
-0.459017018658980935029501857…
+1.719551442531198550688634398…
+1.138004432499332885157841729…
+0.259273233005005595158072588…
-3.597661740227243739940039228…
-3.319703423907923593779727545…
-3.018471695555874174383708009…
-2.687178213005645221877765061…
-2.315040631969854351245993463…
-1.883082770759830608578236571…
-1.352038668223383718148747858…
-0.612414851610188982350276645…

+1.020465208974159220420492697…
+0.040519992610273807119693182…
-24.63865528804984441050796942…
-24.59806865747650234381633987…
-24.55741505926418687092326558…
-24.51669416101057552476382150…
-24.47590562755526483917345018…
-24.43504912094763238695385804…

The value of x swings between positive and negative in an irregular, non-periodic way, alternating between slow deterministic decay and instantaneous jumps to sometimes large positive or negative values. The deterministic decays explains why, as we’ll see, there are beautiful regular curves — parabolic curves — amid the irregularity. When the function creates a positive number x > 1, it nibbles away at x until x x > -1, x becomes positive at the next step and the process continues. Represented as a graph, x = x – 1/x looks like this when seeded with 2 — note the parabolic curves:

x[i] = x[i-1] – 1/x[i-1], x[1] = 2 (click for larger)


A shark-fin and some red sails (images StockCake + Para-Sailing World Championship)


Sydney Opera House (image Wikipedia)


When x > 0, its value is represented in white; when x < 0, its value is represented in red. The curves created remind of me of shark-fins or sails or Sydney Opera House. So you could say the graph contains red sails in the subset, i.e. the set of values of x that are sub-zero. Here are some variations on the formula:

x = x – (1/4)/x, x[1] = 2


x = x – (4/3)/x, x[1] = 2


x = x – (4/5)/x, x[1] = 2


Now try this formula, x = 1 – 1/x. When it’s seeded with 2, it behaves like this:

2
0.5 = 1 – 1/2 = 1 – 0.5
-1 = 1 – 1/0.5 = 1 – 2
2 = 1 – -1/-1 = 1 – -1 = 1 + 1
1/2
-1
2
[…]

The values cycles through 2, 0.5, -1, 2, 0.5… for ever. So try varying the formula. This is what happens with x = 0.1 – 1.7/x, seeded with 2:

+2
-0.75
+2.366666666666666666666666666…
-0.618309859154929577464788732…
+2.849430523917995444191343963…
-0.496610440482852346310656327…
+3.523206323143542441364433927…
-0.382515028663775083373274222…
+4.544269826308639632084352464…
-0.274097504104620631734792447…
+6.302172491695235560374503419…
-0.169748249867834571832745868…
+10.11483079397645866692882142…
-0.068070038404634195480677189…
+25.07427708053510247498559239…

When you look at the graph of x = 0.1 – 1.7/x, you’ll see it’s also cycling, just in a more complicated way:

x = 0.1 – 1.7/x, x[1] = 2 (click for larger)


And here’s how different seeds can change the graph:

x = 2/3 – 1/x, x[1] = 2/3


x = 2/3 – 1/x, x[1] = 3/2


This graph reminds me of vertebrae:

x = 2/5 – 1/x, x[1] = 2


And this graph reminds of a bone:

x = 9/7 – 1/x, x[1] = 2


As Lucretius nearly said: Mathematica Moles et Machina Mundi — Mathematics is the Mass and Body of the World.


Elsewhere Other-Accessible…

• Moto-Motto — what Lucretius did say

Strartifacts

Here’s a sequence of decreasing numbers. Which number comes next?

612 → 600 → 594 → 414 → 398 → 182 → ?

It’s 166, because the numbers decrease by the product of their digits higher than 0:

612 – 6*2 = 612 – 12 = 600 → 600 – 6 = 594 → 594 – 5*9*4 = 594 – 180 = 414 → 414 – 4*4 = 414 – 16 = 398 → 398 – 3*9*8 = 398 – 216 = 166

Eventually the sequence will reached 0 and stop. If you want to see how this function looks on a graph, here it is:

x = n <= 3722, f(i) -= digmul(f(i)) → 0 (click for larger)


The graph represents n on the x-axis, with the red circles marking n = 100 and n = 1000. The sequence of falling digit-products is on the y-axis, but the graph has a special feature there. The y-axis is compressed according to the size of n, so that n = 1000 falls to 0 with n -= digmul(n) in the same height as n = 100. Here’s a graph for the same function in base 7:

x = n <= 3722 in base 7, f(i) -= digmul(f(i)) → 0


Now the red circles represent 7^2 = 49, 7^3 = 343, 7^4 = 2401, i.e. 100b7, 1000b7, 10000b7. And you can try other functions for n = n – func(n) = n -= func(n). Here’s a graph for n -= hailstep(n), where hailstep(n) returns the number of steps in the Collatz sequence for n:

x = n <= 3722 in base 7, f(i) -= hailstep(f(i)) → f(i) < 2


You form a Collatz sequence by starting with a whole number and finding the next number according to two rules:

1. If n(i) is divisible by 2, n(i+1) = n(i) / 2
2. If n(i) is not divisible by 2, n(i+1) = n(i) * 3 + 1

So the Collatz sequence for n = 10 looks like this:

10 → 10 / 2 = 5 → 5 * 3 + 1 = 16 → 16 / 2 = 8 → 8 / 2 = 4 → 4 / 2 = 2 → 2 / 2 = 1.

When you reach 1, you stop. So that’s six steps for n = 10. But does every n reach 1 in the end? It’s a very simple question about a very simple function. But nobody knows and nobody can prove that either all numbers do or at least one number doesn’t. The German mathematician Lothar Collatz (1910-90) conjectured that all numbers do reach 1. But it can take a surprisingly long time, even with small n. This is the Collatz sequence for n = 27:

27, 82, 41, 124, 62, 31, 94, 47, 142, 71, 214, 107, 322, 161, 484, 242, 121, 364, 182, 91, 274, 137, 412, 206, 103, 310, 155, 466, 233, 700, 350, 175, 526, 263, 790, 395, 1186, 593, 1780, 890, 445, 1336, 668, 334, 167, 502, 251, 754, 377, 1132, 566, 283, 850, 425, 1276, 638, 319, 958, 479, 1438, 719, 2158, 1079, 3238, 1619, 4858, 2429, 7288, 3644, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1

Now some more functions for the y-compressed fall-bands, as I call them. If you use the sum of the factors * powers, you get this:

x = n <= 7422, f(i) -= factpowsum(f(i)) → f(i) < 2


The factpowsum(n) is the sum of the factors multiplied by their powers. For example, 37692 = 2^2 * 3^3 * 349, so factpowsum(4188) = 2*2 + 3*3 + 349*1 = 362. Here’s factpowsum for more n:

x = n <= 14822, f(i) -= factpowsum(f(i)) → f(i) < 2


You can also use the very simple function f(i) -= 1, that is, compress the numbers from n to 1 into the y-gap. But if you do that, you’ll get a completely filled screen:

x = n <= 3722, f(i) -= 1 → f(i) = 0


So you can adjust the color of a pixel according to how many times it’s written to:

x = n <= 1862, f(i) -= 1 → f(i) = 0 (color-adjust)


The patterns in the colors are artifacts of the limited resolution of the screen, so I call these patterns strartifacts = strata + artifacts. Here’s another example:

x = n <= 3722, f(i) -= 1 → f(i) = 0 (color-adjust)


Or adjust the greytone of the pixel:

x = n <= 3722, f(i) -= 1 → f(i) = 0 (greytone-adjust)


And so on (in all cases, you can click for a larger image):

x = n <= 1862, f(i) -= blockmul(f(i)) (multiply run-lengths of same digits) → f(i) < 2


x is triangular(n) = 3 to 1734453, y is 1 < triangular numbers <= n


x = n <= , f(i) -= 1 → f(i) < 2


x = n <= 7442, f(i) -= 1 → f(i) < 2


x = n <= 1862, f(i) -= leaddig(f(i)) → f(i) < 2 # 1


x = n <= , f(i) -= leaddig(f(i)) → f(i) < 2 # 2


x = n <= , f(i) -= trailingdigit(f(i)) + 1 → f(i) < 2


x = n <= , f(i) -= trailingdigit(f(i) in base 5) + 3 → f(i) < 2


for triangular(n) = 3 to 6928503, f(i) -= primes → f(i) < 2



x = n <= 1862, f(i) -= blockmul(f(i) in base 5) (multiply run-lengths of same digits) → f(i) < 2


x = n <= 1862, f(i) -= blockmul(f(i) in base 2) → f(i) < 2


x = n <= 1862, f(i) -= digsum(f(i)) → f(i) < 2


x = n <= 3722, f(i) -= func(x = 1/4 → x < 0, x(1) = 4) → f(i) < 2


x = n <= 932, f(i) -= func(x -= 3/x → x < 0, x(1) = 6) → f(i) < 2


Formulas Focal to the Flesh

Here’s an interesting formula:

fr(1) = 1/2; mx = 3
fr(i) = fr(i-1) + 1/fr(i-1)
if fr(i) > mx, fr(i) = fr(i) – mx

Early terms look like this:

0.5, 2.5, 2.9, 3.244827586…, 4.329334628…, 2.081590666…, 2.561992513…, 2.952313716…, 3.291031107…, 3.727089920…, 2.102435627…, 2.578074447…, 2.965960841…, 3.303119709…, 3.602146368…, 2.262872154…, 2.704788415…, 3.074503101…, 13.49676325…, 10.59203071…, 7.723747777…, 4.935444092…, 2.452121378…, 2.859931533…, 3.209590254…, 4.980804482…, 2.485649867…, 2.887959143…, 3.234224430…, 4.503633905…, 2.168689406…

Can you see any patterns emerging? I’d guess not. And I’d guess a thousand more terms wouldn’t help you see any better. It’s hard for humans to see patterns in a jumble of numbers. Our eyes don’t work as well on numbers as on shapes. That’s why you can make that formula focal to the flesh, as it were, by plotting the numbers on a graph. Or part of the numbers, anyway. Suppose you take the fractional parts of each pair of terms and use them to map (x,y) on a FractL (my name for a graph whose arms run from 0 to 1). For example, the terms 4.935444092… and 2.452121378… would yield x = 0.935444092… and y = 0.452121378… (or vice versa). The resultant graph makes the formula focal to the flesh. And it’s replete with patterns:

fr(i)+=1/fr(i-1); if fr(i)>3, fr(i)-=3; x = frac(fr(i)), y = frac(fr(i+1))


I can’t explain the patterns and they may arise from limited precision in the decimal digits. But I like them however they arise. The graph doesn’t change when mx = 4 (although it creates the lines in a different order):

if fr(i)>4, fr(i)-=4


But it does change when mx = 4/3. The lines almost vanish, except for a tiny comet-like mark towards the upper right-hand corner:

if fr(i)>4/3, fr(i)-=4/3


When mx = 7/2, the graph of mx = 3|4 is back in a slightly different form:

if fr(i)>7/2, fr(i)-=7/2


And again with 7/3:

if fr(i)>7/3, fr(i)-=7/3


There’s a big change with 7/4, Most of the lines disappear:

if fr(i)>7/4, fr(i)-=7/4


And only the main lines appear with 9/5:

if fr(i)>9/5, fr(i)-=9/5


And so on till you try fr -= 2/f, as noted below:

if fr(i)>11/5, fr(i)-=11/5


if fr(i)>11/6, fr(i)-=11/6


if fr(i)>15/8, fr(i)-=15/8


if fr(i)>29/15, fr(i)-=29/15


Now try fr += 2/fr and fr += 3/fr. This is what happens:

fr += 2/fr; if fr(i)>3, fr(i)-=3


fr += 2/fr; if fr(i)>8/3, fr(i)-=8/3


fr += 2/fr; if fr(i)>11/4, fr(i)-=11/4


fr += 3/fr; if fr(i)>6, fr(i)-=6


And what about these graphs?




They’re created by seeding a sum, s, with a fraction, then adding more fractions < 1 whose numerators = 1,2,3… and whose denominators are the prime numbers 1, s -= 1. When s > 1, s -= 1. Then you take the fractional parts of s(i) and s(i+1) and graph (x,y) as above.


Post-Performative Post-Scriptum

The title of this post refers to Morbid Angel’s Formulas Fatal to the Flesh (1998). I’ve never heard it, but I like Morbid Angel’s alphabetically alliterative album-titles.

The Bird Dimension

M.C. Escher, Another World / Andere Wereld (1947)


This is almost my favorite image by Escher. But I’d like a frEscher perspective in it: I think the bird should be looking in the other direction, out into the impossibly overlapping universes, not into the cupola and at the viewer.

Third Whirled Warp

Here’s a regular hexagon inside a regular triangle, that is, an equilateral triangle:

Regular hexagon inside regular triangle


Imagine that two points are moving around the perimeter of each polygon, with the hex-point moving half as fast as the tri-point (after adjustment for the incommensurate relative lengths of the perimeters). If you trace the midpoint of the twin spinning points, you get this shape:

v3v6, 1 : 1/2, pol


And if you adjust the midpoint path as though the triangle had been stretched into a circle, you get this shape:

v3v6, 1 : 1/2, circ, pol


Here’s the same when the ratio of speeds is 1/2 to 1/3, that is, 1 to 2/3:

v3v6, 1/2 : 1/3, circ, pol


Without the polygons, it looks like this:

v3v6, 1/2 : 1/3, circ


When the ratio of speeds if -1/3 to 2/3, that is, the tri-point is moving counter-clockwise around the triangle, you get this shape:

v3v6, -1/3 : 2/3, pol


When it’s stretched into a circle, you get this:

v3v6, -1/3 : 2/3, circ, pol


It looks like a moustache:

v3v6, -1/3 : 2/3, circ


Here are more midpoint shapes created with a hexagon inside a triangle:

v3v6, 2/2 : 3/3, circ


v3v6, -1/2 : 3/4, circ


v3v6, 1/4 : 1/5, circ


v3v6, -1/4 : 3/4, circ


v3v6, -1/4 : 4/5, circ


v3v6, 2/3 : 3/4, circ


v3v6, 2/3 : 3/5, circ


v3v6, 3/4 : 4/5, circ


v3v6, 3/4 : 4/5, circ


Now try aligning the nested hexagon like this, so that the sides of the hexagon coincide with the middle third of the sides of the triangle:

v3v6, side alignment


With two points moving in a ratio of 1/3 to 1/4, you get this midpoint shape:

v3v6, sided, 1/3 : 1/4, pol


Here it is without the polygons:

v3v6, sided, 1/3 : 1/4


Now try a regular octagon inside a square:

v4v8, 1/2 : 1/3, circ, pol


v4v8, 1/2 : 1/3, circ


v4v8, -1/3 : 3/4, circ


v4v8, 2/3 : 3/5, circ


Now place a triangle inside a hexagon:

v6v3, 1 : 1/4, pol


If you stretch the midpoint path according to perimeter of the triangle, you get this:

v6v3, 1 : 1/4, circ, pol


v6v3, 1 : 1/4, circ


The three stretching shapes remind me of hands in Egyptian art, like this image of King Tutankhamun and Queen Ankhesenamun:

Detail from the Golden Throne of Tutankhamnun


Here are more midpoint paths:

v6v3, 1 : -1/4, circ


v6v3, 1 : 1/2, circ


v6v3, 1 : 1/3, circ


v6v3, -1 : 1/3, circ


v6v3, -1 : 1/4, circ


v6v3, 1 : 1/5, circ


v6v3, 2/3 : 1/4, circ


Now try a square inside an octagon:

v8v4, 2/3 : 1/4, circ, pol


v8v4, 2/3 : 1/4, circ


v8v4, 2/5 : 1/6, circ


v8v4, 2/5 : 3/7, circ


v8v4, 4/5 : 3/7, circ


Elsewhere Other-Accessible…

• First Whirled Warp — an earlier look at this kind of geometry
• Second Whirled Warp — and another earlier look

The Hex Crystals

To coin a phrase: Never Mind the Bollocks — Here’s the Hex Crystals! And what is a hex crystal? It’s what I call a shape that’s created algorithmo inside a hexagon and looks like a crystal:

A hex crystal


Here are some more hex-crystals:




I came across hex-crystals when I was looking at an interesting little geometrical question. How does sum(vd), the sum of distances to the vertices of a square, vary from different points, (x,y), inside the square? Say the square is created inside a circle of radius = 500 units and centered on (x,y) = (0,0). When the point is at (0,0), the center of the square, sum(vd) is obviously 2000, because the four vertices all fall on the perimeter of the circle at 500 units from the center and 4 * 500 = 2000:
0

sum(vd) = 2000 = sum of distances to vertices from (0,0)


When is sum(vd) at a maximum? When the point is on one or another of the vertices, which are at (+/-354,+/-354) units in relation to the center at (0,0):

sum(vd) = 2414 = sum of distances to vertices from (354,-354)


More precisely, the sum is 2414.213562373… = 1000 * (√2 + 1) units and the vertices are at (+/-353.55339…, +/-353.55339…) units, as simple geometry dictates for a square inside a circle of radius 500. Accordingly, sum(vd) varies between exactly 2000 and 2414.213562373… as the point moves inside the square:

sum(vd) = 2165 from (132,256)


sum(vd) = 2182 from (-135,271)


sum(vd) = 2069 from (177,51)


I wondered what shapes appeared as one traced the route of a point jumping, say, 1/2 towards the vertices according to tests on sum(vd). For example, if the point starts at (0,0) at time t0) and sum(vd) at time ti has to be alternately greater and less than sum(vd) at ti-1 for successive jumps, you get this shape:

jump = 1/2, test = sum(vd,ti) >,< sum(vd,ti-1)


You can use the binary number 10bin to represent the test on sum(vd) at ti-1 and ti-1, i.e. the test at jump 1 is sum(vd,ti) > sum(vd,ti-1), at step 2 is sum(vd,ti) < sum(vd,ti-1), and so on. Using the same test and a jump of 1/3, you get this shape:

jump = 1/3, test = sum(vd,ti,10bin)


Now the shape is clearly a fractal. So are some of the other shapes I found by applying the same kind of tests to a point jumping inside a pentagon:

vertex = 5, jump = 55/144 = fib(10) / fib(12), test on sum(vd) = 10bin


v = 5, j = 55/144, test = 10010bin


v = 5, j = 55/144, test = 11000bin


When test = 10010bin, you read the binary number left-to-right and check for s1><s0,s2<s1,s3<s2,s4>s3,s5<s4. Then you apply the same tests to subsequent jumps, i.e., you return to the beginning of the binary number and read it left-to-right again. Now let’s apply similar tests to hexagons and create some hex-crystals:

v = 6, j = 1/2, test = 10bin


Various hex-crystals (animated gif courtesy EZgif)


I searched an array to calculate the possible routes, so the same test yielded different results depending on dp, the depth of the search. This is because tl, the length of the test, fits more or less well into dp by dp modulo tl, that is, by whether tl is a factor of dp. For example, when the test is 110 and tl = 3, you get this with dp = 9:

v = 6, j = 1/2, test = 110, dp = 9


And you get this when dp = 10 (i.e., dp = 9+1):

v = 6, j = 1/2, test = 110bin, dp = 10dec


Here are some more hex-crystals:

test = 1100bin


test = 1110bin


test = 10010bin


test = 11010bin


test = 11100bin


test = 101000, dp = 12


test = 101100bin


test = 111100bin


test = 111100, dp = 11


test = 1110010bin


test = 1111100bin


test = 10010110bin


test = 10011110bin


test = 11000110bin


test = 11001110bin


test = 11010110bin


test = 11100110bin


test = 11101000bin


test = 11110010bin


test = 100101000bin


test = 100111110bin


test = 110011110bin


test = 110111000bin


test = 1001101010bin


test = 1001111000bin


test = 1001111010bin


test = 1010011110bin


test = 1011101110bin


test = 1101010000bin


test = 1110001110bin


test = 1110101000bin


test = 1110101010bin


test = 1111100010bin


j = 1/3, test = 1 (i.e., for all jumps sum(vd) at ti > sum(vd) at ti-1, center point


j = 2/3, test = 11100bin


j = 2/5, test = 10010bin


Finally, here are some hex-crystals based on a test of sorted distances from (x,y), i.e. how the vertices rank by distance from (x,y):




Fractional Fractal

Serendipity in some simplification statistics. That’s what I encountered the other day. I was looking at the ways to simplify this set of fractions:

1/2, 1/3, 2/3, 1/4, 2/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 2/6, 3/6, 4/6, 5/6, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 7/8, 1/9, 2/9, 3/9, 4/9, 5/9, 6/9, 7/9, 8/9, 1/10, 2/10, 3/10, 4/10, 5/10, 6/10, 7/10, 8/10, 9/10, 1/11, 2/11, 3/11, …

The underlined fractions are not in their simplest possible form. For example, 2/4 simplifies to 1/2, 2/6 to 1/3, 3/6 to 1/2, and so on:

1/2, 1/3, 2/3, 1/4, 2/4 → 1/2, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 2/6 → 1/3, 3/6 → 1/2, 4/6 → 2/3, 5/6, 1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 1/8, 2/8 → 1/4, 3/8, 4/8 → 1/2, 5/8, 6/8 → 3/4, 7/8, 1/9, 2/9, 3/9 → 1/3, 4/9, 5/9, 6/9 → 2/3, 7/9, 8/9, 1/10, 2/10 → 1/5, 3/10, 4/10 → 2/5, 5/10 → 1/2, 6/10 → 3/5, 7/10, 8/10 → 4/5, 9/10, 1/11, 2/11, 3/11, …

I counted the number of times the simplest possible fractions occurred when simplifying all fractions a/b for (b = 2..n, a = 1..b-1), then displayed the stats as a graph running from 0/1 to 1/1. And there was serendipity in these simplification statistics, because a fractal had appeared:

Graph for count of simplest possible fractions from a/b for (b = 2..n, a = 1..b-1)


It’s interesting to work out what fractions appear where. For example, the peak in the middle is 1/2, but what are the next-highest peaks on either side? The answers are more obvious in the colored version of the graph:

Colored graph for count of simplest possible fractions
Key: n/2, n/3, n/4, n/5, n/6, n/7


The line for 1/2 is red, the lines for 1/3 and 2/3 in light green, the lines for 1/4 and 3/4 in yellow, and so on. But those graphs appear in an equilateral triangle, as it were. The fractals get easier to see in the full-sized versions of these widened graphs:

Widened graph for count of simplest possible fractions from a/b for (b = 2..n, a = 1..b-1)

(click for full size)


Widened and colored graph for count of simplest possible fractions

(click for full size)


Mathemorchids

Flowers are modified leaves. That’s a scientific fact. And it must depend on the way the genetic program of a plant allows for change in variables of growth — in the relative dimensions, directions and forms of various collections of cells.

But I wasn’t thinking of flowers or leaves or botany when I wrote a program to trace the path taken by a point moving in various ways between the center and perimeter of a circle. After I’d run the program, I was definitely thinking of flowers and leaves. How could I not be, when they appeared on the screen in front of my eyes? By adjusting variables in the program, I could produce either flowers or leaves or something between the two:

Flower without color


Flower with color






Some of the flower-shapes reminded me of orchids, so I called them mathemorchids. The variables I used governed this procedure:

defprocmathemorchid
rd = 0
jump = jmin
jinc = +1
repeat
xr = xc + int(sin(rd) * rdius + sin(rd * xmult) * xminl)
yr = yc + int(cos(rd) * rdius + cos(rd * ymult) * yminl)
jump = jump + jinc
if(jump = jmin) or (jump >= jmax) then jinc = -jinc
procDrawLine(xr,yr,xc,yc,jump)
rd = rd + rdinc
until rd > maxrd
endproc

Here are explanations of the variables:

rd — short for radian and setting the angle of the point, 0 to maxrd = pi * 2, as it moves between the center and perimeter of the circle
rdinc — the amount by which rd is incremented
xc, yc — the center of the circle
rdius — the radius of the circle
xr, yr — the adjustable radiuses used in trigonometric calculations for the x and y dimensions
xmult, ymult — used to multiply rd for further trig-calcs using…
xminl, yminl — the lengths by which xr and yr are adjusted
jmin, jmax — these are the lower and upper bounds for a rising and falling variable called jump, which determines how far the point moves before it’s marked on the screen

If you look at the use of the sine and cosine functions, you’ll see that the point can swing back on its path or swing ahead of itself, as it were. That’s how the path of the point can simulate three-dimensionality as it lays down thicker or thinner patches of pixels.

Here are the mathemorchids, leaves, scallops and other shapes created by adjusting the variables described above (with more of the generating program as an appendix):

Mathemorchid for jmin = 6, jmax = 69, xmult = 7, ymult = 7, xminl = 40, yminl = 88 (see file-name)





























 

















And here are a few more examples of the mathemorchids and other shapes look like without color:





 



Code for creating the Mathemorchids

defprocmathemorchid
rd = 0
rd = 0
jump = jmin
jinc = +1
repeat
xr = xc + int(sin(rd) * rdius + sin(rd * xmult) * xminl)
yr = yc + int(cos(rd) * rdius + cos(rd * ymult) * yminl)
jump = jump + jinc
if(jump = jmin) or (jump >= jmax) then jinc = -jinc
procDrawLine(xr,yr,xc,yc,jump)
rd = rd + rdinc
k=inkey(0)
until rd > maxrd or k > -1
endproc

defprocDrawLine(x1,y1,x2,y2,puttest)
xdiff = x1 – x2
ydiff = y1 – y2
if abs(xdiff) > abs(ydiff) then
yinc = -ydiff / abs(xdiff)
if xdiff < 0 then xinc = +1 else xinc = -1
else
xinc = -xdiff / abs(ydiff)
if ydiff colrmx then col = 1
put = 0
endif
if int(x) x2 then x = x + xinc
if int(y) y2 then y = y + yinc
iffunc=2then
ifx<x_lo x_lo=x
ifyx_hi x_hi=x
ify>y_hi y_hi=y
endif
until fnreached
endproc

deffnreached
if xinc > 0 then
xreached = int(x) >= x2
else
xreached = int(x) 0 then
yreached = int(y) >= y2
else
yreached = int(y) <= y2
endif
= xreached and yreached
end