MathGroup Archive 2008

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

Search the Archive

Re: NearestFunction Algorithm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85589] Re: NearestFunction Algorithm
  • From: "D. Grady" <D.C.Grady at gmail.com>
  • Date: Thu, 14 Feb 2008 06:25:11 -0500 (EST)
  • References: <foue29$m1v$1@smc.vnet.net>

On Feb 13, 3:42=A0am, "jwmerr... at gmail.com" <jwmerr... at gmail.com> wrote:
> I'm looking to iteratively assign a list of initial points to a list
> of final points such that at each step, the initial point that is
> furthest from its nearest final point is assigned to its nearest final
> point. =A0That final points is then no longer available to other initial
> points.
>
> I noticed that you can speed up repeated uses of Nearest by calling it
> with only one argument in order to produce a NearestFunction, and then
> using that in later calculations. =A0Can anyone give me a clue about how
> this actually works?
>
> Is it possible to manipulate a NearestFunction in order to remove
> points that have already been assigned?
>
> Regards,
>
> Jason Merrill

If you have a list of points,

pts = {1,2,3,4,5}

then you could make a NearestFunction by writing

myFunction = Nearest[pts]

myFunction works just like any other function, so if you want to find
the nearest element to 7, you write

myFunction[7]

As far as removing points that have already been assigned, I don't
think you can do that without creating a new NearestFunction at every
step of the algorithm.

-Daniel


  • Prev by Date: Re: How should I start with mathematica?
  • Next by Date: Re: eliminate all the occurrences of "theta ->" and "lambda ->"
  • Previous by thread: Re: NearestFunction Algorithm
  • Next by thread: Differential Equation