# Fractal square partition

Consider the following sequence:

the next are c), d) and so on. Let's assume that p1=0.2, p2=0.5, p3=0.2, p4=0.1.

The question is: how to obtain (not necessarily graphically illustrated in example a) and b) ) a matrix of numbers with successive results for parameter q, where q is the number of steps (in case of a) q = 1, in case b) q = 2 , in case c) q = 3, etc.

As a consequence we should get (I think in step q = 8) a graph like 'Model III (right plot)' shown here: https://en.wikipedia.org/wiki/Multiplicative_cascade

ralph

• The pictures in your link to multiplicative cascade are done with a multiplicative random process, so they are different from the deterministic method in this question. – bill s Sep 24 '17 at 18:55

It appears that you are looking for the Kronecker product.

q1 = {{p1, p2}, {p3, p4}};
q2 = KroneckerProduct[q1, q1];
q2 // MatrixForm


For the next step:

KroneckerProduct[q1, q2]


To do this in general, set up a recursion:

kprod[1] = {{p1, p2}, {p3, p4}};
kprod[n_] := kprod[n] = KroneckerProduct[kprod[1], kprod[n - 1]];


and so

kprod[3] // MatrixForm


gives the third term.

It might also be worth mentioning that these matrices can be used to model certain multi-fractal measures - especially, since the post has the tag. We can visualize this measure like so:

MatrixPlot[kprod[8] /. {p1 -> 0.2, p2 -> 0.5, p3 -> 0.2, p4 -> 0.1},
Frame -> False]


• @Marc McClure thanks for the visualization! – bill s Sep 24 '17 at 18:51

I would recommend not computing the matrix symbolically as bill s illustrated, then replacing, but operating upon your numeric matrix directly. You might also consider using Nest or NestList in place of recursion.

prods[m_?MatrixQ, n_Integer] := NestList[KroneckerProduct[m, #] &, m, n - 1]

prods[{{p1, p2}, {p3, p4}}, 5] === Array[kprod, 5]

True


But also critically:

prods[{{0.2, 0.5}, {0.2, 0.1}}, 13]; // AbsoluteTiming

{0.324644, Null}


(Don't try this with kprod unless you want to hang your machine.)