Given several (x, y) ordered pairs, I want to compare the distances between each of them. So, pretend that I have a list of ordered pairs:
pairs = [a,b,c,d,e,f]
I have a function that takes two ordered pairs and finds the distance between them:
def distance(a,b): from math import sqrt as sqrt from math import pow as pow d1 = pow((a[0] - b[0]),2) d2 = pow((a[1] - b[1]),2) distance = sqrt(d1 + d2) return distance
How can I use this function to compare each ordered pair with every other ordered pair, ultimately finding two ordered pairs with the largest distance between them?
Psuedopsuedocode:
distance(a,b) distance(a,c) ... distance(e,f)
Any help would be greatly appreciated.
Alan
source share