Re: Mathematica loop question
- To: mathgroup at smc.vnet.net
- Subject: [mg118400] Re: Mathematica loop question
- From: Ray Koopman <koopman at sfu.ca>
- Date: Wed, 27 Apr 2011 05:36:26 -0400 (EDT)
- References: <ip60j0$aan$1@smc.vnet.net> <ip6814$bl6$1@smc.vnet.net>
On Apr 26, 3:50 am, Ray Koopman <koop... at sfu.ca> wrote: > On Apr 26, 1:43 am, Sol Lederman <sol.leder... at gmail.com> wrote: > >> Hi, >> >> I'm teaching myself Mathematica. >> >> I've plotted this: >> >> Graphics[{ >> Blue, >> Disk[{5, 10}, .25], >> Disk[{4, 9}, .25], >> Disk[{6, 9}, .25], >> Disk[{3, 8}, .25], >> Disk[{5, 8}, .25], >> Disk[{7, 8}, .25], >> Disk[{2, 7}, .25], >> Disk[{4, 7}, .25], >> Disk[{6, 7}, .25], >> Disk[{8, 7}, .25], >> Disk[{1, 6}, .25], >> Disk[{3, 6}, .25], >> Disk[{5, 6}, .25], >> Disk[{7, 6}, .25], >> Disk[{9, 6}, .25] >> }] >> >> Is there an elegant way to write this without a bunch of Disk statements? >> I'm imagining that this would be a double nested loop. >> >> Thanks. >> >> Sol > > Flatten@Table[Disk[{n-7+2i,n},.25],{n,10,6,-1},{i,11-n}] Flatten@Table[Disk[{i,n},.25],{n,10,6,-1},{i,n-5,15-n,2}] is nicer.