Python | Sympy Line.is_parallel() method

In Sympy, the function is_parallel() is used to check whether the two linear entities are parallel or not.

Syntax: Line.is_parallel(l2)

Parameters:
 l1: LinearEntity
 l2: LinearEntity

Returns:
 True: if l1 and l2 are parallel,
 False: otherwise.

Example #1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy and Point, Line
from sympy import Point, Line
  
p1, p2 = Point(0, 0), Point(1, 1)
p3, p4 = Point(3, 4), Point(6, 7)
  
l1, l2 = Line(p1, p2), Line(p3, p4)
  
# using is_parallel() method
isParallel = Line.is_parallel(l1, l2)
  
print(isParallel)

chevron_right


Output:

True

Example #2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# import sympy and Point, Line
from sympy import Point, Line
  
p1, p2 = Point(0, 0), Point(1, 1)
p3, p4 = Point(3, 4), Point(6, 6)
  
l1, l2 = Line(p1, p2), Line(p3, p4)
  
# using is_parallel() method
isParallel = Line.is_parallel(l1, l2)
  
print(isParallel)

chevron_right


Output:

False
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.