Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Python | Sympy Circle() method

  • Last Updated : 27 Sep, 2019

In Simpy, the function Circle() is used to make circle from a center and a radius, from three non-collinear points, or the equation of a circle.

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Syntax: Circle()



Parameters:
center : Point and
radius : number or sympy expression or
points : sequence of three Points or
equation : equation of a circle

Error: Raises GeometryError When the given equation is not that of a circle. When trying to construct circle from incorrect parameters.

Example #1: Using center and radius




# import sympy and geometry module
from sympy.geometry import Point, Circle
  
# using Circle()
c1 = Circle(Point(0, 0), 5)
  
print(c1.hradius, c1.vradius, c1.radius)

Output:

(5, 5, 5)

 
Example #2: using sequence of three points




# import sympy and geometry module
from sympy.geometry import Point, Circle
  
# using Circle()
c2 = Circle(Point(0, 0), Point(1, 1), Point(1, 0))
  
print(c2.hradius, c2.vradius, c2.radius)

Output:

(sqrt(2)/2, sqrt(2)/2, sqrt(2)/2)

Example #3: using equation of circle




# import sympy and geometry module
from sympy.geometry import Point, Circle 
from sympy import Eq
  
  
# using Circle()
c3 = Circle(x**2 + y**2 - 25)
  
print(c3)

Output:

Circle(Point2D(0, 0), 5)



My Personal Notes arrow_drop_up
Recommended Articles
Page :