Friday, October 3, 2025
HomeLanguagesPython | Sympy Ellipse.tangent_lines method

Python | Sympy Ellipse.tangent_lines method

In Sympy, the function tangent_lines() returns Tangent lines between p(point) and the ellipse.
If p is on the ellipse, returns the tangent line through point p. Otherwise, returns the tangent line(s) from p to the ellipse, or None if no tangent line is possible (e.g., p inside ellipse).

Syntax: Ellipse.tangent_lines(p)

Parameter: 
 p:Point

Returns:
 tangent_lines: list with 1 or 2 Lines or empty list

Raises:
 NotImplementedError: Can only find tangent lines for a point, p, on the ellipse.

Example #1:




# import sympy and Point, Ellipse
from sympy import Point, Ellipse
  
# using Ellipse() method
e1 = Ellipse(Point(0, 0), 3, 2)
  
# using tangent_lines() method
l1 = e1.tangent_lines(Point(3, 0))
  
print(l1)


Output:

[Line2D(Point2D(3, 0), Point2D(3, -12))]

Example #2:




# import sympy and Point, Ellipse
from sympy import Point, Ellipse
  
# using Ellipse() method
e2 = Ellipse(Point(0, 0), 3, 2)
  
# using tangent_lines() method
l2 = e2.tangent_lines(Point(1, 1))
  
print(l2)


Output:

[]
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32332 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11868 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11929 POSTS0 COMMENTS
Shaida Kate Naidoo
6819 POSTS0 COMMENTS
Ted Musemwa
7080 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS