Re: Smalest enclosing circle
- To: mathgroup at smc.vnet.net
- Subject: [mg50092] Re: [mg50062] Smalest enclosing circle
- From: DrBob <drbob at bigfoot.com>
- Date: Sat, 14 Aug 2004 01:51:09 -0400 (EDT)
- References: <200408130956.FAA03686@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
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
- References:
- Smalest enclosing circle
- From: Steve Gray <stevebg@adelphia.net>
- Smalest enclosing circle