Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1888

Re: Mathematica loop question

From Ray Koopman <koopman@sfu.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mathematica loop question
Date 2011-04-26 10:50 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <ip6814$bl6$1@smc.vnet.net> (permalink)
References <ip60j0$aan$1@smc.vnet.net>

Show all headers | View raw


On Apr 26, 1:43 am, Sol Lederman <sol.leder...@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}]

Back to comp.soft-sys.math.mathematica | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Mathematica loop question Sol Lederman <sol.lederman@gmail.com> - 2011-04-26 08:43 +0000
  Re: Mathematica loop question Stefan <wutchamacallit27@gmail.com> - 2011-04-26 10:50 +0000
  Re: Mathematica loop question Ray Koopman <koopman@sfu.ca> - 2011-04-26 10:50 +0000
    Re: Mathematica loop question Ray Koopman <koopman@sfu.ca> - 2011-04-27 09:36 +0000

csiph-web