MathGroup Archive 2004

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

Search the Archive

Re: Smalest enclosing circle


For instance:

Needs["DrawGraphics`DrawingMaster`"]
data = RandomArray[NormalDistribution[0, 1], {5, 2}];
sq = #.# &;
radius[x_?NumericQ, y_?NumericQ] := Sqrt@Max[sq[{x, y} - #] & /@ data]
Off[FindMinimum::"lstol"]
soln = FindMinimum[radius[x, y], {x, 0}, {y, 0}, WorkingPrecision -> 20]
pt = {x, y} /. Last@soln;
r = First@soln;
Draw2D[{PointSize[0.02], Point /@ data, Red,
  Point@pt, Circle[pt, r]}, AspectRatio -> Automatic]

I used DrawGraphics only to draw the picture. That's on David Park's mathematica page at

http://home.earthlink.net/~djmp/Mathematica.html

Each time I resample, the resulting circle encloses all the points and two points are ON the circle, as I would expect.

Bobby

On Fri, 13 Aug 2004 05:56:28 -0400 (EDT), Steve Gray <stevebg at adelphia.net> 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
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Smalest enclosing circle
  • Next by Date: Another Combinatorica loading problem
  • Previous by thread: Re: Smallest enclosing circle
  • Next by thread: Re: Smalest enclosing circle