I am tryingg to modify Chaos Game Fractals from Wolfram Demonstrations. The part I am having problem with is this. Original code:
m1 = .5; m2 = 0; m3 = 0; m4 = .5; n1 = .5; n2 = 0; n3 = 0; n4 = .5;
k1 = .5; k2 = 0; k3 = 0; k4 = .5;
NestList[RandomChoice[{{{m1, m2}, {m3, m4}}.# + {0,
0}, {{n1, n2}, {n3, n4}}.# + {1/2,
Sqrt[3]/2}, {{k1, k2}, {k3, k4}}.# + {1, 0}}] &, {1, 1}, 2]
This works. The output is
{{1, 1}, {1., 1.36603}, {1., 1.54904}}
(In the original code we have 10000 insted of 2)
But if I define first the list of functions:
F={{{m1, m2}, {m3, m4}}.# + {0,
0}, {{n1, n2}, {n3, n4}}.# + {1/2,
Sqrt[3]/2}, {{k1, k2}, {k3, k4}}.# + {1, 0}};
And then do the NestList:
NestList[RandomChoice[F] &, {1, 1}, 2]
the output is
{{1, 1}, {{{0.5, 0}, {0, 0.5}}.#1, {{0.5, 0}, {0, 0.5}}.#1}, {{{0.5,
0}, {0, 0.5}}.#1, {{0.5, 0}, {0, 0.5}}.#1}}
Question: If my list of functions is longer and functions are more complicated ( I would like to use Table to create my list of functions, perhaps even compiled functions), how can I make the second method to work? I would like to understand the reason why it is not working?