Did I find the right examples for you? yes no

All Samples(5)  |  Call(5)  |  Derive(0)  |  Import(0)
Get the Euclidean distance between two points.

Example:
========
    >>> from sympy.geometry import Point
    >>> p1,p2 = Point(1, 1), Point(4, 5)
    >>> Point.distance(p1, p2)
    5

            @staticmethod
    def distance(p1, p2):
        """
        Get the Euclidean distance between two points.

        Example:
        ========
            >>> from sympy.geometry import Point
            >>> p1,p2 = Point(1, 1), Point(4, 5)
            >>> Point.distance(p1, p2)
            5

        """
        return sqrt( sum([(a-b)**2 for a,b in zip(p1,p2)]) )
        


src/s/y/sympy-HEAD/sympy/geometry/tests/test_geometry.py   sympy(Download)
    assert p2.midpoint(p2) == p2
 
    assert Point.distance(p3, p4) == sqrt(2)
    assert Point.distance(p1, p1) == 0
    assert Point.distance(p3, p2) == sqrt(p2.x**2 + p2.y**2)

src/s/y/sympy-polys-HEAD/sympy/geometry/tests/test_geometry.py   sympy-polys(Download)
    assert Point.midpoint(p2, p2) == p2
 
    assert Point.distance(p3, p4) == sqrt(2)
    assert Point.distance(p1, p1) == 0
    #assert Point.distance(p3, p2) == abs(p2)