Tuesday, April 9, 2024

Mixed Fractal Surfaces

It is possible to have a fractal surface which varies in local dimension everywhere. That is to say, on any patch of the surface you can zoom into a rough area (e.g. 2.5D) or zoom into a smooth area (2D). 

Here it is applied to the sphere tree fractal:

and to the non-rotated one:
In both cases the the smaller spheres are disproportionately smaller than in the usual shapes, giving a surface that tends to smooth in the vicinity of each sphere base. 

However, if you zoom in on those smooth surfaces enough you will find a sphere, and if you zoom in on that sphere enough you will find a bud at the top which is just as rough as one of the pictured ones. 

This is much like the Mandelbrot set, which has areas that are locally smooth, in the sense of being a straight thin line as you zoom in further:
But everywhere you can find tiny minibrots.

We can do the same thing with the tree surface fractal:



The surface tends to smooth, however, each smooth dome has child domes that can be just as protruding as the largest ones. So we get a mixed dimensionality. 

Because the mixture of roughnesses is everywhere and at every resolution (rather than separated) these are probably all multifractals, though I've never fully understood the definition of these. 

Saturday, April 6, 2024

Scale-based decompositions

There are several ways to decompose a smooth function. A spline, a Fourier decomposition, a Taylor decomposition per-point, and a Pade decomposition per-point, are the first that come to mind. Also a perceptron (Sigmoid decomposition). 

All of these are suited to smooth functions. However nature isn't smooth, and tends to exhibit scale-symmetric roughness in some form. Can we extend some of these useful decomposition methods to support roughness?

The way I'm considering doing this is to treat scale as like another dimension. For example, if our function is 1D: $y = f(x)$, then a new axis $s$ represents scale.

As scale is a logarithmic sort of attribute, we have to treat it as such. We treat the function f(x,s) as the convolution of f(x) with the Gaussian $g(x) \leftarrow N(0,\exp{s})$, and whenever we take the partial derivative $d$ with respect to $s$ we use the logarithm: $\log{|d|}$. The modulus operation is because the logarithm is a function on the magnitude of $d$, representing the entropy of $d$. 

This $\exp$ and $\log$ pairing linearises the scale component of the function.  

We can now do something like a 2D Taylor decomposition of the 2D graph with respect to $x$ and scale $s$. This is a sort of partial derivative that can be looked at in a systematic way:

$f(x,s)$ is the height of the function (mean height of the patch)

$\frac{\partial f}{\partial x}$ is the gradient of the function

$\frac{\partial f}{\partial s}$ is the change in (mean) height with change in s, which is zero

So far not very interesting. But we can go further:

$\frac{\partial^2f}{\partial x^2}$ is the curvature of the function with respect to $x$

$\frac{\partial^2f}{\partial s^2}$ is the change in $\frac{\partial f}{\partial s}$ with scale $s$, also 0

$\frac{\partial^2f}{\partial x \partial s}$ is the change in gradient with respect to scale $s$

Now normally this last one would also be zero, but we are using the absolute value of $\frac{\partial y}{\partial x}$, so it is $\frac{g(x)\star\log{|\frac{\partial y}{\partial x}|}}{\partial s}$, which represents how much the average absolute gradient changes with scale $s$. 

This is non-zero because larger $s$ (lower-pass signals) has lower mean absolute gradient than high-pass signals for rough functions. This is a way to measure the fractal dimension of the function, since it is the slope of a log-log function. It is only non-zero on rough surfaces, and zero on smooth ones. 

This may not seem interesting, but it is starting to incorporate fractal functions and smooth functions into the same framework. This is a sort of Taylor expansion at a point, but it can also be applied piecewise as the basis for approximating a whole 1D function. We can now treat a function as a set of heights quadratically interpolated, and each with their own fractal dimension, so they are rough curves. Moreover, this piecewise decomposition is a mesh in 2D with scale s, giving a different set of slopes and fractal dimensions at different scales. 

This is already very powerful, it supports roughnesses that change with location and with scale. Moreover we can see a link with splines, since piecewise linear approximations are first-order splines. But we can keep going:

$\frac{\partial^3f}{\partial x^3}$ is the rate of change of curvature, used in cubic splines for instance

$\frac{\partial^3f}{\partial x^2 \partial s}$ is the change in curvature with scale, I think this quantifies a C(1) fractal, representing not rough but lumpy functions. However I'm not sure!

$\frac{\partial^3f}{\partial x \partial s^2}$ is the change in fractal dimension with scale. Does it get rougher or smoother as you zoom in. This is connected to my Saturated shapes blog post.

$\frac{\partial^3f}{\partial x \partial s \partial x}$ how the fractal dimension changes with $x$, this allows linear roughness changes along the function. 

$\frac{\partial^3f}{\partial s^3}$ this is zero 

This next level of Taylor expansion can characterise the curvature of the function and the change in roughness.  

 

 There are lots of ways this idea could be extended:

  • Look at Pade decomposition instead, or Fourier decomposition
  • Extend to a 2D function (like a hillside), this adds many more partial derivatives
  • Look at the topological groups instead, e.g. -ve, 0, +ve in each component of the Taylor expansion 

For the 2D case:

$\frac{\partial^2f}{\partial x \partial z}$ - twist or saddleness

$\frac{\partial^3f}{\partial x \partial z \partial s}$ - very weird idea, how much does saddleness change with scale 

$\frac{\partial^3f}{\partial x \partial s \partial z}$ - how much does $x$ fractal dimension change with $z$. Noting that roughness can be different in different axes

We can then have a linear sum of all of these primitive values. Topologically we we can set each to -1,0 or 1, to give us a set of derived shapes.