Open In App

Python | Sympy Circle() method

Last Updated : 27 Sep, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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.

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)


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads