(*points)
return True
Is a sequence of points collinear?

        Test whether or not a set of points are collinear. Returns True if
        the set of points are collinear, or False otherwise.

        Parameters
        ==========

        points : sequence of Point

        Returns
        =======

        is_collinear : boolean

        See Also
        ========

        sympy.geometry.line.Line

        Examples
        ========

        >>> from sympy import Point3D, Matrix
        >>> from sympy.abc import x
        >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 1)
        >>> p3, p4, p5 = Point3D(2, 2, 2), Point3D(x, x, x), Point3D(1, 2, 6)
        >>> p1.is_collinear(p2, p3, p4)
        True
        >>> p1.is_collinear(p2, p3, p5)
        False
Is a sequence of points collinear?
Is a sequence of points collinear?
def is_collinear(*points):
        """Is a sequence of points collinear?

        Test whether or not a set of points are collinear. Returns True if
        the set of points are collinear, or False otherwise.

        Parameters
        ==========

        points : sequence of Point

        Returns
        =======

        is_collinear : boolean

        See Also
        ========

        sympy.geometry.line.Line

        Examples
        ========

        >>> from sympy import Point3D, Matrix
        >>> from sympy.abc import x
        >>> p1, p2 = Point3D(0, 0, 0), Point3D(1, 1, 1)
        >>> p3, p4, p5 = Point3D(2, 2, 2), Point3D(x, x, x), Point3D(1, 2, 6)
        >>> p1.is_collinear(p2, p3, p4)
        True
        >>> p1.is_collinear(p2, p3, p5)
        False
        """
        # Coincident points are irrelevant and can confuse this algorithm.
        # Use only unique points.
        points = list(set(points))
        if not all(isinstance(p, Point3D) for p in points):
            raise TypeError('Must pass only 3D Point objects')

        if len(points) == 0:
            return False
        if len(points) <= 2:
            return True  # two points always form a line
        if len(points) == 3:
            return (points[0].direction_cosine(points[1]) ==
            points[1].direction_cosine(points[2]))

        # XXX Cross product is used now,
        # If the concept needs to extend to more than three
        # dimensions then another method would have to be used
        for i in range(len(points) - 2):
            pv1 = [j - k for j, k in zip(points[i].args,   \
                points[i + 1].args)]
            pv2 = [j - k for j, k in zip(points[i + 1].args,
                points[i + 2].args)]
            rank = Matrix([pv1, pv2]).rank()
            if (rank != 1):
                return False
        return True
def is_collinear ( * points ) : # Coincident points are irrelevant and can confuse this algorithm. # Use only unique points. points = list ( set ( points ) ) if not all ( isinstance ( p , Point3D ) for p in points ) : raise TypeError ( 'Must pass only 3D Point objects' ) if len ( points ) == 0 : return False if len ( points ) <= 2 : return True # two points always form a line if len ( points ) == 3 : return ( points [ 0 ] . direction_cosine ( points [ 1 ] ) == points [ 1 ] . direction_cosine ( points [ 2 ] ) ) # XXX Cross product is used now, # If the concept needs to extend to more than three # dimensions then another method would have to be used for i in range ( len ( points ) - 2 ) : pv1 = [ j - k for j , k in zip ( points [ i ] . args , points [ i + 1 ] . args ) ] pv2 = [ j - k for j , k in zip ( points [ i + 1 ] . args , points [ i + 2 ] . args ) ] rank = Matrix ( [ pv1 , pv2 ] ) . rank ( ) if ( rank != 1 ) : return False return True