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
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"]
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}]
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]]
Correct answer by Vitaliy Kaurov on May 8, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP