(self, o)
Is `o` tangent to the ellipse?

        Parameters
        ==========

        o : GeometryEntity
            An Ellipse, LinearEntity or Polygon

        Raises
        ======

        NotImplementedError
            When the wrong type of argument is supplied.

        Returns
        =======

        is_tangent: boolean
            True if o is tangent to the ellipse, False otherwise.

        See Also
        ========

        tangent_lines

        Examples
        ========

        >>> from sympy import Point, Ellipse, Line
        >>> p0, p1, p2 = Point(0, 0), Point(3, 0), Point(3, 3)
        >>> e1 = Ellipse(p0, 3, 2)
        >>> l1 = Line(p1, p2)
        >>> e1.is_tangent(l1)
        True
Is `o` tangent to the ellipse?
Is o tangent to the ellipse?
def is_tangent(self, o):
        """Is `o` tangent to the ellipse?

        Parameters
        ==========

        o : GeometryEntity
            An Ellipse, LinearEntity or Polygon

        Raises
        ======

        NotImplementedError
            When the wrong type of argument is supplied.

        Returns
        =======

        is_tangent: boolean
            True if o is tangent to the ellipse, False otherwise.

        See Also
        ========

        tangent_lines

        Examples
        ========

        >>> from sympy import Point, Ellipse, Line
        >>> p0, p1, p2 = Point(0, 0), Point(3, 0), Point(3, 3)
        >>> e1 = Ellipse(p0, 3, 2)
        >>> l1 = Line(p1, p2)
        >>> e1.is_tangent(l1)
        True

        """
        inter = None
        if isinstance(o, Ellipse):
            inter = self.intersection(o)
            if isinstance(inter, Ellipse):
                return False
            return (inter is not None and isinstance(inter[0], Point)
                    and len(inter) == 1)
        elif isinstance(o, LinearEntity):
            inter = self._do_line_intersection(o)
            if inter is not None and len(inter) == 1:
                return inter[0] in o
            else:
                return False
        elif isinstance(o, Polygon):
            c = 0
            for seg in o.sides:
                inter = self._do_line_intersection(seg)
                c += len([True for point in inter if point in seg])
            return c == 1
        else:
            raise NotImplementedError("Unknown argument type")
def is_tangent ( self , o ) : inter = None if isinstance ( o , Ellipse ) : inter = self . intersection ( o ) if isinstance ( inter , Ellipse ) : return False return ( inter is not None and isinstance ( inter [ 0 ] , Point ) and len ( inter ) == 1 ) elif isinstance ( o , LinearEntity ) : inter = self . _do_line_intersection ( o ) if inter is not None and len ( inter ) == 1 : return inter [ 0 ] in o else : return False elif isinstance ( o , Polygon ) : c = 0 for seg in o . sides : inter = self . _do_line_intersection ( seg ) c += len ( [ True for point in inter if point in seg ] ) return c == 1 else : raise NotImplementedError ( "Unknown argument type" )