示例#1
0
 def test_intersect(self):
     c1 = AlgebraicCurve(x**2 + y**2 - 1, symbols=[x, y, z])
     c2 = AlgebraicCurve(y, symbols=[x, y, z])
     i = c1.intersect(c2)
     assert len(i) == 2
     assert Point(1, 0) in i
     assert Point(-1, 0) in i
示例#2
0
 def test_polynomial(self):
     coeff = np.array([[[0, 1], [1, 0]], [[1, 0], [0, 0]]])
     curve = AlgebraicCurve(coeff, symbols=[x, y, z])
     assert curve.polynomial == x + y + z
示例#3
0
 def test_tangent(self):
     curve = AlgebraicCurve(x**2 + y**2 - 1, symbols=[x, y, z])
     assert curve.tangent(at=Point(1, 0)) == Line(1, 0, 0) + Point(1, 0)
     assert curve.is_tangent(Line(1, 0, 0) + Point(1, 0))
示例#4
0
 def test_contains(self):
     coeff = np.array([[[0, 0], [1, 0]], [[1, 0], [0, 0]]])
     curve = AlgebraicCurve(coeff)
     assert curve.contains(Point(0, 0))