本文整理匯總了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))