|
SOLUTIONS
|
Search for all pages containing Nearest
BUILT-IN MATHEMATICA SYMBOL
Nearest[{elem1, elem2, ...}, x]
gives the list of
to which x is nearest.
Nearest[{elem1->v1, elem2->v2, ...}, x]
gives the
corresponding to the
to which x is nearest.
Nearest[{elem1, elem2, ...}->{v1, v2, ...}, x]
gives the same result.
Nearest[data, x, n]
gives the n nearest
to x.
Nearest[data]
generates a NearestFunction[...] that can be applied repeatedly to different x.
Details and OptionsDetails and Options
- If the
are vectors or matrices of numbers, Nearest by default in effect uses the metric Norm[#1-#2]&. - For strings, Nearest by default uses the edit distance metric.
- The following option can be given:
-
DistanceFunction Automatic the distance metric to use - For images, Nearest[{img1, img2, ...}, img, DistanceFunction->f] effectively uses DistanceFunction->(ImageDistance[#1, #2, DistanceFunction->f]&).
- When several elements are returned, the nearest ones are given first.
- If several elements are at the same distance, they are returned in the order they appear in data.
New in 6 | Last modified in 9
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »

