Numpy найдет наиболее отдаленные элементы в массиве

# credit to Stack Overflow user in the source link
# lower complexity, works with low dimension, convex distributed data
import numpy as np
from scipy import spatial

pts = np.random.rand(100_000, 2)
# two points which are fruthest apart will occur as vertices of the convex hull
candidates = pts[spatial.ConvexHull(pts).vertices]
# get distances between each pair of candidate points
dist_mat = spatial.distance_matrix(candidates, candidates)
# get indices of candidates that are furthest apart
i, j = np.unravel_index(dist_mat.argmax(), dist_mat.shape)
print(candidates[i], candidates[j])
wolf-like_hunter