在Simpy中,該函數
Circle()
用於從中心和半徑,從三個非共線點或圓方程生成圓。
用法: Circle()
參數:
center:點和
radius:數字或sympy表達式或
points:三個點的順序或
equation:圓方程
錯誤:當給定的方程式不是圓的方程式時,引發GeometryError。嘗試從不正確的參數構造圓時。
示例1:使用中心和半徑
# 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)
輸出:
(5, 5, 5)
示例2:使用三點序列
# 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)
輸出:
(sqrt(2)/2, sqrt(2)/2, sqrt(2)/2)
Example#3:使用圓方程
# 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)
輸出:
Circle(Point2D(0, 0), 5)
相關用法
- Python sympy.gcd()用法及代碼示例
- Python sympy.eye()用法及代碼示例
- Python sympy.lcm()用法及代碼示例
- Python sympy.lcm()用法及代碼示例
- Python sympy.nP()用法及代碼示例
- Python sympy RGS用法及代碼示例
- Python sympy.nT()用法及代碼示例
- Python sympy.apart()用法及代碼示例
- Python sympy.gcd()用法及代碼示例
- Python sympy.Mod()用法及代碼示例
- Python sympy.nC()用法及代碼示例
- Python sympy.crt()用法及代碼示例
- Python sympy.S()用法及代碼示例
- Python sympy.ff()用法及代碼示例
- Python sympy.ones()用法及代碼示例
注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python | Sympy Circle() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。