|
|
||
|
|
| Mathematica Tutorial | Functions » |
| Nearest[{elem1,elem2,...},x] | give the list of elemi to which x is nearest |
| Nearest[{elem1->v1,elem2->v2,...},x] | |
| give the vi corresponding to the elemi to which x is nearest | |
| Nearest[{elem1,elem2,...}->{v1,v2,...},x] | |
| give the same result | |
| Nearest[{elem1,elem2,...}->Automatic,x] | |
| take the vi to be the integers 1, 2, 3, ... | |
| Nearest[data,x,n] | give the n nearest elements to x |
| Nearest[data,x,{n,r}] | give up to the n nearest elements to x within a radius r |
| Nearest[data] | generate a NearestFunction[...] which can be applied repeatedly to different x |
Nearest function.
|
|
|
|
|
|
|
This generates a set of 10,000 points in 2D and a NearestFunction.
|
|
It takes much longer if NearestFunction is not used.
|
option name | default value | |
| DistanceFunction | Automatic | the distance metric to use |
Options for Nearest.
| © 2008 Wolfram Research, Inc. |