Calculates the minkowski distance between two points.

    :param x: the first point
    :param y: the second point
    :param p: the order of the minkowski algorithm. If *p=1* it is equal
        to the manhatten distance, if *p=2* it is equal to the euclidian
        distance. The higher the order, the closer it converges to the
        Chebyshev distance, which has *p=infinity*.

def minkowski_distance(x, y, p=2):
    """
    Calculates the minkowski distance between two points.

    :param x: the first point
    :param y: the second point
    :param p: the order of the minkowski algorithm. If *p=1* it is equal
        to the manhatten distance, if *p=2* it is equal to the euclidian
        distance. The higher the order, the closer it converges to the
        Chebyshev distance, which has *p=infinity*.
    """
    from math import pow
    assert len(y) == len(x)
    assert len(x) >= 1
    sum = 0
    for i in range(len(x)):
        sum += abs(x[i] - y[i]) ** p
    return pow(sum, 1.0 / float(p))