TransWikia.com

Lévy C curve fractal from a substitution systems in NKS book p.190?

Mathematica Asked by Quantum Fields on May 8, 2021

How can I make the geometrical transformation described in the page 190 in the New Kind of Science book by Stephen Wolfram to produce the fractal pattern?

https://www.wolframscience.com/nks/p190–substitution-systems-and-fractals

One Answer

enter image description here

That page has a few links at the end, one called "Implementation [of geometric substitution systems]"

https://www.wolframscience.com/nks/notes-5-4--implementation-of-geometric-substitution-systems

It suggest a very simple implementation via complex numbers. The WL code there can be used in the following way:

f[z_]:=1/2 (1-I) {I z+1/2,z-1/2}
data[n_]:=Nest[Flatten[N@f[#]]&,{0},n];
ComplexListPlot[data[15],PlotTheme->"Detailed"]

enter image description here

You can also use so called AffineTransform and iterated function system (IFS) to build patter more closely to the visual rules. Define:

TransformIFS[g_,IFS[l_List]]:= 
Module[{prim=First[g],h=Head[g]},
t=Table[GeometricTransformation[prim,l[[i]]],{i,Length[l]}];h[t]];

TransformIFS[g_,ifs_IFS,0]:=g;
TransformIFS[g_,ifs_IFS,1]:=TransformIFS[g,ifs];
TransformIFS[g_,ifs_IFS,n_Integer?Positive] := 
TransformIFS[TransformIFS[g,ifs],ifs,n-1];

HeighwayDragon=IFS[{
AffineTransform[{{{1/2, -1/2},{1/2,1/2}},{1,1}/4}],
AffineTransform[{-{{-1/2, -1/2},{1/2,-1/2}},{1,1}/4}]}];

Table[TransformIFS[Graphics[Rectangle[]],HeighwayDragon,n],{n,0,11}]

enter image description here

Another beautiful way of making Lévy C curve fractal from a substitution system is considering representation of substitution systems by paths:

https://www.wolframscience.com/nks/notes-3-5--representation-of-substitution-systems-by-paths

Graphics[Line[AnglePath[(-1)^# Pi/2]]]&@
Last[SubstitutionSystem[{0->{0,0,1},1->{1}},{0},14]]

enter image description here

Correct answer by Vitaliy Kaurov on May 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP