Re: triangles in circles
- To: mathgroup at smc.vnet.net
- Subject: [mg26831] Re: triangles in circles
- From: Brian Higgins <bghiggins at ucdavis.edu>
- Date: Thu, 25 Jan 2001 01:13:12 -0500 (EST)
- References: <94ma2t$3pi@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Tom, Here is a way (if I understand correctly what you want to do): Load this package so we can use the KSubsets function: Needs["DiscreteMath`Combinatorica`"]; n = 5; ptlist = Table[{Cos[i 2 \[Pi]/n], Sin[i 2 \[Pi]/n]}, {i, 1, n}]; Define a simple color function to make the graphic look pretty clr := RGBColor[Random[], Random[], Random[]] Construct a list of line primitives that define our triangles TrianglePrimitives = Map[{clr, Line[{#[[1]], #[[2]], #[[3]], #[[1]]}]} &, KSubsets[ptlist, 3]]; Show[Graphics[{Circle[{0, 0}, 1], {PointSize[0.02], Point /@ ptlist}, TrianglePrimitives}], AspectRatio -> Automatic] Enjoy, Brian In article <94ma2t$3pi at smc.vnet.net>, "Tom De Vries" <tdevries at shop.westworld.ca> wrote: > Hello all, > > I'm teaching a high school math class and we are doing permutations and > combinations. One of the "standard" questions is ..."given a certain number > of points located around a circle, how many triangles can be formed...." > > The simple line below creates a circle with 5 points arranged around it. > Could someone help me with a way to generate the lists of points that would > create all the triangles. I know that for more points it would get kind of > messy, but I wanted to actually draw all the triangles as I thought it might > be an interesting graphic... > > Thanks for any help you might have.... > > n = 5; > > ptlist = Table[{Cos[i 2 \[Pi]/n], Sin[i 2 \[Pi]/n]}, {i, 1, n}]; > > Show[Graphics[{ > Circle[{0, 0}, 1], > {PointSize[0.02], Point /@ ptlist} > }], AspectRatio -> Automatic] > > Sincerely, Tom De Vries > > Sent via Deja.com http://www.deja.com/