本文整理汇总了Python中polynomial.Polynomial.calc方法的典型用法代码示例。如果您正苦于以下问题:Python Polynomial.calc方法的具体用法?Python Polynomial.calc怎么用?Python Polynomial.calc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polynomial.Polynomial
的用法示例。
在下文中一共展示了Polynomial.calc方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_some_coefficient_is_0
# 需要导入模块: from polynomial import Polynomial [as 别名]
# 或者: from polynomial.Polynomial import calc [as 别名]
def test_some_coefficient_is_0(self):
p = Polynomial([1, 0, 0, 0 ,2]) # x^4 + 2
self.assertEqual(83, p.calc(3))
示例2: test_negative
# 需要导入模块: from polynomial import Polynomial [as 别名]
# 或者: from polynomial.Polynomial import calc [as 别名]
def test_negative(self):
p = Polynomial([-1,2])
self.assertEqual(-1, p.calc(3))
示例3: test_2_size
# 需要导入模块: from polynomial import Polynomial [as 别名]
# 或者: from polynomial.Polynomial import calc [as 别名]
def test_2_size(self):
p = Polynomial([1,2])
self.assertEqual(5, p.calc(3))
示例4: test_5_size
# 需要导入模块: from polynomial import Polynomial [as 别名]
# 或者: from polynomial.Polynomial import calc [as 别名]
def test_5_size(self):
p = Polynomial([1,2,3,4,5]) # x^4 + 2x^3 + 3x^2 + 4x^1 + 5
self.assertEqual(179, p.calc(3))
示例5: test_1_size
# 需要导入模块: from polynomial import Polynomial [as 别名]
# 或者: from polynomial.Polynomial import calc [as 别名]
def test_1_size(self):
p = Polynomial([2])
self.assertEqual(2, p.calc(3))