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


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

Re: Mathematica loop question

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail
From Patrick Scheibe <pscheibe@trm.uni-leipzig.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mathematica loop question
Date Wed, 27 Apr 2011 09:37:49 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <ip8o5d$pfa$1@smc.vnet.net> (permalink)
Lines 65
NNTP-Posting-Date 27 Apr 2011 08:38:34 GMT
NNTP-Posting-Host f8dfd67f.news.twtelecom.net
X-Trace DXC=D@TF1Oh_W3Xh`QFda^1@_XC_A=>8kQj6];[h;PUXBgbTe6cLf4b_YJSEFiONJ7[GoVA`BSYK@7MXR
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:1897

Show key headers only | View raw


Hi,

I think you don't need the yMax at all. It's just

Module[{num = 10, m = RotationMatrix[3/4 Pi]},
 Graphics[{EdgeForm@Directive[Thin, Black], 
   Table[{ColorData["TemperatureMap"][Abs[i - j]/num], 
     Disk[m.{i, j}, 0.4]}, {i, 0, num}, {j, 0, i}]}]]

Cheers
Patrick

On Tue, 2011-04-26 at 12:37 -0500, DrMajorBob wrote:
> Or this (after Patrick Scheibe):
> 
> Module[{num = 10, m = RotationMatrix[3/4 Pi], yMax},
>   yMax = Last[m.{num, 1}];
>   Graphics[{EdgeForm@Directive[Thin, Black],
>     Table[{x, y} = m.{i, j}; {ColorData["TemperatureMap"][y/yMax],
>       Disk[{x, y}, 0.4]}, {i, 0, num}, {j, 0, i}]}]]
> 
> Bobby
> 
> On Tue, 26 Apr 2011 03:43:16 -0500, Sol Lederman <sol.lederman@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
> 
> 


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


Thread

Re: Mathematica loop question Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-04-27 09:37 +0000

csiph-web