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.
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
from sympy.geometry import Point, 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
from sympy.geometry import Point, 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
from sympy.geometry import Point, Circle
from sympy import Eq
c3 = Circle(x * * 2 + y * * 2 - 25 )
print (c3)
|
Output:
Circle(Point2D(0, 0), 5)
Share your thoughts in the comments
Please Login to comment...