Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: triangles in circles

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26856] Re: [mg26813] triangles in circles
  • From: Andrzej Kozlowski <andrzej at bekkoame.ne.jp>
  • Date: Thu, 25 Jan 2001 01:13:32 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Here is some quickly written code that will create the points on the circle
and the triangles you want. I make use of the Combinatorica package to
construct all the choices of three points out of n.

First we load the package:

<< DiscreteMath`Combinatorica`

Next we get the coordinates of the points on the unit circle:

pts[n_] := {Re[#], Im[#]} & /@ Map[ExpToTrig, Table[E^(2Pi*I*k/n), {k, 1,
n}]]

Here are the triangles that can be made given n-points (n>2).

triangles[n_] := 
Line /@ KSubsets[pts[n], 3] /. Line[a_] :> Line[Append[a, First[a]]]

You can see them with:


Show[Graphics[{triangles[7]}], AspectRatio -> Automatic]

This can be improved in various ways, by adding the ciorcle, colour etc.


-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/


on 1/24/01 6:18 PM, Tom De Vries at 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
> 
> 
> 



  • Prev by Date: Re: triangles in circles
  • Next by Date: Re: Who can help me?
  • Previous by thread: Re: triangles in circles
  • Next by thread: Fw: FORTRAN style, not OK?