       Re: Distance from point to set

• To: mathgroup at smc.vnet.net
• Subject: [mg55307] Re: Distance from point to set
• From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
• Date: Sat, 19 Mar 2005 04:45:09 -0500 (EST)
• Organization: Uni Leipzig
• References: <d1eblq\$ek7\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

distanceToSet[pnt_, pset_] := Min[Sqrt[#.#] &[# -
pnt] & /@ pset]

and

pointSet = Table[Random[], {10}, {2}];

pnt = {-2, 2};

distanceToSet[pnt, pointSet]

Regards

Jens

"Piotr Kowalski" <pkowalsk at ibspan.waw.pl> schrieb
im Newsbeitrag news:d1eblq\$ek7\$1 at smc.vnet.net...
> Hello,
>
> I would like to compute distance d(x,A) from a
> point 'x' to a set 'A',
> (all in R^n, where n=2 or n=3) that is:
>
>   d(x,A) = min ||x - a|| (forall a in A)
>   where: n=2 or n=3,
>          x is point in R^n, A is subset of R^n
>          ||  || is norm (euclidean, max, etc).
>
> Can I find Mathematica function or package for
> such problem ?
>
> Thank you in advance,
> P. Kowalski
>

```

• Prev by Date: Re: Multiple > and < calculations [great than & less than]
• Next by Date: Re: Normal Disappear Problem
• Previous by thread: Re: filling in an array
• Next by thread: Re: Distance from point to set