本文整理匯總了Python中polynomial.Polynomial.get_coefficient方法的典型用法代碼示例。如果您正苦於以下問題:Python Polynomial.get_coefficient方法的具體用法?Python Polynomial.get_coefficient怎麽用?Python Polynomial.get_coefficient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類polynomial.Polynomial
的用法示例。
在下文中一共展示了Polynomial.get_coefficient方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_getcoeff
# 需要導入模塊: from polynomial import Polynomial [as 別名]
# 或者: from polynomial.Polynomial import get_coefficient [as 別名]
def test_getcoeff(self):
p = Polynomial([9,3,3,2,2,3,1,-2,-4])
self.assertEqual(p.get_coefficient(0), -4)
self.assertEqual(p.get_coefficient(2), 1)
self.assertEqual(p.get_coefficient(8), 9)
self.assertEqual(p.get_coefficient(9), 0) # try to get a higher coefficient than the length of the polynomial, it should return 0 (non significant high coefficients are removed)