MathGroup Archive 2004

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

Search the Archive

Re: Smalest enclosing circle

  • To: mathgroup at
  • Subject: [mg50075] Re: Smalest enclosing circle
  • From: "Dr. Wolfgang Hintze" <weh at>
  • Date: Sat, 14 Aug 2004 01:50:26 -0400 (EDT)
  • References: <cfi8tm$4p6$>
  • Sender: owner-wri-mathgroup at

My attempted solution

Remark: this is not the correct answer but it seems to be a good 
approximation to the truth - and it is very simple.

The main idea is "center of mass".

Step 1: calculate the center of mass. This will be the center of the circle
Step 2: determine the maximum difference of all points to the center of 
mass: this will be the radius of the circle

Create sample data (e.g. normally distributed around the

<< "Statistics`ContinuousDistributions`"

pp = NormalDistribution[0, 1];

n = 10;
px = RandomArray[NormalDistribution[0, 1], n];
py = RandomArray[NormalDistribution[0, 1], n];
points = Transpose[{px, py}];

Calculate location of center of mass ...

c = {Mean[px], Mean[py]}

{0.2679039580402966, -0.10697128218318264}

... and r as the maximum distance to the center

dif = ((c - #1) . (c - #1) & ) /@ points;

r = Sqrt[Max[dif]]


Show points and circle

Show[{grpoints, Graphics[Circle[c, r]]},
    DisplayFunction -> $DisplayFunction,
    AspectRatio -> Automatic];

Looks quite nice. But isn't correct as usually the circle could be a bit 
smaller, as can be seen by the naked eye.


Steve Gray wrote:

> 	Given n points in the  plane, I want to find the smallest
> enclosing circle. Does anyone have Mathematica code to do this?
> 	I will be grateful for any tips.
> Steve Gray

  • Prev by Date: Re: How does a notebook get its own filename or directory?
  • Next by Date: Re: Smalest enclosing circle
  • Previous by thread: Re: Re: Smalest enclosing circle
  • Next by thread: Re: Smalest enclosing circle