Re: circular infinity
- To: mathgroup at smc.vnet.net
- Subject: [mg72204] Re: circular infinity
- From: mcmcclure at unca.edu
- Date: Thu, 14 Dec 2006 05:49:29 -0500 (EST)
- References: <elotg7$pe2$1@smc.vnet.net>
On Dec 13, 7:59 am, Eep² <e... at tnlc.com> wrote: > Hi, I'm trying to create the image athttp://tnlc.com/eep/circles.html > in Mathematica but I don't have much programming (or math) > experience and am wondering if anyone here could help me out. How about this: CircleToCircles[Circle[{a_, b_}, r_]] := {Circle[{a - r/2, b}, r/2], Circle[{a + r/2, b}, r/2] }; CircleToCircles[l_List] := CircleToCircles /@ l; Show[Graphics[NestList[CircleToCircles, Circle[{0, 0}, 1], 8]], AspectRatio -> Automatic, PlotRange -> All]; A few comments: * This is an example of functional programming, which you definitely want to learn to use Mathematica. * The function CircleToCircles has two definitions depending upon the type of pattern it encounters. Pattern matching is another major topic you need know. * NestList and related commands tend to be much more efficient than loops. Have fun, Mark