Posts

Showing posts with the label fractals

Hutchinson's Theorem (1981)

Image
See below for code This was the most up to date thing we proved in my maths degree.  It's a lovely little theorem in the field of Fractal Geometry that enables you to create images like the ones above.  But first some primers.... A fixed point of any map $f:X\to X$ is a point $x\in X$ such that $f(x) = x$.  If $X=\mathbb{R}^N$ we can define a contraction as a map $f$ which brings pairs of points closer together, i.e. we can say $f$ is a contraction if there's some $\lambda < 1$ such that for any $x_1,x_2$ we have  $|f(x_1)-f(x_2)| < \lambda |x_1-x_2|$.  Now, it's easy to see that if $f$ is a contraction then it has a unique fixed point.  All you have to do is note that for any $x$ the following sequence converges $$ x, f(x), f^2(x), f^3(x), ... $$ Why's that?  Well if we let $\epsilon = |x-f(x)|$ then $\epsilon\lambda^{n-1}$ is an upper bound for the distance between the $n^{th}$ and $n+1^{th}$ members of the sequence.  Since $\sum \epsilon\lambda^n$ converges

Lord Greyscale

Image
  Posting a pretty picture of some greyscale in which the fractal nature of it is clearly visible.  Black rectangles represent zeros and white rectangles represent ones. Read it as an array of columns going from left to right.  In each column exactly one bit changes relative to the previous, making it an ideal scheme for a head to determine its position. An $n$-bit greyscale sequence has $2^n$ members, and the last member always differs from the first in just 1 bit position.  This makes greyscale ideal for determining position around a cylinder. Here's the code: #!/usr/bin/env python3 def __greyscale_fwd(nbits, preset_bits): if nbits == 1: yield 0 + preset_bits yield 1 + preset_bits else : for x in __greyscale_fwd(nbits-1, preset_bits): yield x for x in __greyscale_rev(nbits-1, preset_bits | (1 << (nbits-1))): yield x def __greyscale_rev(nbits, preset_bits): if nbits == 1: yield 1 + preset_bits yi

Lightweight building material seen in Devs

Image
Quantum physics slash Silicon Valley drama Devs features an interesting architectural idea, namely a floating laboratory.  In order make a laboratory float you need very lightweight construction materials and it seems that they've solved this problem by using Menger Sponge bricks, which are very lightweight indeed. A Menger Sponge is a 3D version of this To make a Menger Sponge you need to perform an iteration.  Start with any shape, then make 8 copies each scaled down by a factor of 3, and use them to construct the perimeter of a square.  Then take that shape and do the same operation, and keep repeating.  The picture above shows that you end up with the same thing whether you start with a solid square or a hollow square.  But actually it doesn't matter what shape you start off with (as long as it's bounded). So, what's the area $A$ of the 2D version Menger Sponge shown above?  We can see from the first row in the picture that it's made up of 8 copies of itself,

Space filling curve

Image
Q: How do you catch a lion in the Sahara? A: Run along a space filling curve carrying a spear.  ($\dagger$) Surprisingly, it is possible to construct a continuous and surjective map $[0,1]\mapsto  [0,1]^2$.  In less techie language: you can plot a curve that fills space.  But how do you do it?  The answer uses the following four maps $[0,1]^2\mapsto [0,1]^2$. $$ \begin{align} & \phi_0(x,y) = \frac{1}{2}(y,x) & \text{flip about diagonal and shrink}\\ & \phi_1(x,y) = \frac{1}{2}(x,y)+(0,\frac{1}{2}) & \text{shrink and translate to top left}\\ & \phi_2(x,y) = \frac{1}{2}(x,y)+(\frac{1}{2},\frac{1}{2}) & \text{shrink and translate to top right}\\ & \phi_3(x,y) = \frac{1}{2}(1-y,1-x)+(\frac{1}{2},0) & \text{flip, shrink & translate to bottom right}\\ \end{align} $$ In words the recipe goes like this:  start off with any continuous map $\gamma:[0,1]\mapsto[0,1]^2$ with $\gamma(0) = (0,0)$ and $\gamma(1)=(1,0)$. apply al