easily see that the star is units from the circle these distances are called euclidean distancesand correspond to using the minkowski distance with but imagine that the lines in the picture correspond to streetsand that one has to stay on the streets to get from one place to another in that casethe star remains units from the circlebut the cross is now units away these distances are called manhattan distances, and correspond to using the minkowski distance with figure contains an implementation of the minkowski distance def minkowskidist( )"""assumes and are equal-length arrays of numbers returns minkowski distance of order between and ""dist for in range(len( ))dist +abs( [iv [ ])** return dist**( /pfigure minkowski distance figure contains class animal it defines the distance between two animals as the euclidean distance between the feature vectors associated with the animals class animal(object)def __init__(selfnamefeatures)"""assumes name stringfeatures list of numbers""self name name self features pylab array(featuresdef getname(self)return self name def getfeatures(self)return self features def distance(selfother)"""assumes other an animal returns the euclidean distance between feature vectors of self and other""return minkowskidist(self getfeatures()other getfeatures() figure class animal figure contains function that compares list of animals to each otherand produces table showing the pairwise distances manhattan island is the most densely populated borough of new york city on most of the islandthe streets are laid out in gridso using the minkowski distance with provides good approximation of the distance one has to travel to walk from one place (say the museum of modern art at rd street and th avenueto another (say the american folk art museum at th street and thalso called columbus avenuedriving in manhattan is totally different story