|
SOLUTIONS
|
MATHEMATICA 内置符号
Nearest[{elem1, elem2, ...}, x]
给出离 x 最近的
列表.
Nearest[{elem1->v1, elem2->v2, ...}, x]
给出离 x 最近的
所对应的
.
Nearest[{elem1, elem2, ...}->{v1, v2, ...}, x]
给出相同的结果.
Nearest[data, x, n]
给出离
最近的 n,赋给 x.
Nearest[data]
产生一个 NearestFunction[...],它能反复应用于不同的 x.
更多信息更多信息
- 如果
是向量或者矩阵元素,有效的缺省值 Nearest 使用公制的 Norm[#1-#2]&. - 对于字符串,缺省的 Nearest 使用可编辑的距离测量.
- 给出如下选项:
-
DistanceFunction Automatic 距离测量使用 - 对于图像,Nearest[{img1, img2, ...}, img, DistanceFunction->f] 事实上使用 DistanceFunction->(ImageDistance[#1, #2, DistanceFunction->f]&).
- 当多个元素返回时,首先给出最近的元素.
- 如果多个元素距离相同,它们将按在 data 中的次序返回.
版本 6 的新功能 | 版本 9 修改功能
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »

