MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Iterated Function System

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67708] Re: Iterated Function System
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 5 Jul 2006 04:18:08 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 7/4/06 at 1:57 AM, jrohal at wooster.edu (JAMES ROHAL) wrote:

>I am looking for a faster way to plot Iterated Function Systems in
>Mathematica. Currently my method is using Barnsley's algorithm which
>randomly chooses a transformation and applies it to a previous point
>to get the next point. I then store the points in a list
>corresponding to the transformation that was applied to it. Is there
>a faster way to program this using functional programming in
>Mathematica? 

Yes, this can be done with a functional program.

Keeping this part of your code

>M = {{1/2, 0}, {0, 1/2}};
>T1[x_] := {{0}, {0}} + M.x;
>T2[x_] := {{1/2}, {0}} + M.x;
>T3[x_] := {{1/4}, {Sqrt[3]/4}} + M.x;

the following will create the same graphic and should be much faster

In[18]:=
f[x_] := Switch[y = Random[Integer, {1, 3}], 1, Flatten[{T1[x], 1}], 2, 
   Flatten[{T2[x], 2}], 3, Flatten[{T3[x], 3}]]

In[20]:=
data = NestList[f[Most[#1]] & , {Random[], Random[], 0}, 3000]; 

In[23]:=
Show[Block[{$DisplayFunction = Identity}, 
    MapThread[ListPlot[Most /@ Cases[data, {__, #1}], 
       PlotStyle -> {PointSize[0.00001], #2}] & , 
     {Range[3], {Red, Green, Blue}}]]];
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: For loop and dynamic Table
  • Next by Date: Re: Iterated Function System
  • Previous by thread: Re: Iterated Function System
  • Next by thread: Re: Iterated Function System