This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

NearestFunction

NearestFunction[data]
represents a function whose values give the elements closest to an element that is supplied.
  • NearestFunction[...][x] gives the element closest to a particular element x.
Generate a NearestFunction:
Apply to a single element:
Apply to several elements:
Generate a NearestFunction:
In[1]:=
Click for copyable input
Out[1]=
Apply to a single element:
In[2]:=
Click for copyable input
Out[2]=
Apply to several elements:
In[3]:=
Click for copyable input
Out[3]=
Give the 3 nearest elements:
New in 6