本文整理匯總了Python中pymor.tools.quadratures.GaussQuadratures.iter_quadrature方法的典型用法代碼示例。如果您正苦於以下問題:Python GaussQuadratures.iter_quadrature方法的具體用法?Python GaussQuadratures.iter_quadrature怎麽用?Python GaussQuadratures.iter_quadrature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pymor.tools.quadratures.GaussQuadratures
的用法示例。
在下文中一共展示了GaussQuadratures.iter_quadrature方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_other_functions
# 需要導入模塊: from pymor.tools.quadratures import GaussQuadratures [as 別名]
# 或者: from pymor.tools.quadratures.GaussQuadratures import iter_quadrature [as 別名]
def test_other_functions(self):
order = GaussQuadratures.orders[-1]
for name, function, integral in FUNCTIONS:
Q = GaussQuadratures.iter_quadrature(order)
ret = sum([function(p) * w for (p, w) in Q])
assert float_cmp(ret, integral), '{} integral wrong: {} vs {} (quadrature order {})'.format(
name, integral, ret, order)
示例2: test_other_functions
# 需要導入模塊: from pymor.tools.quadratures import GaussQuadratures [as 別名]
# 或者: from pymor.tools.quadratures.GaussQuadratures import iter_quadrature [as 別名]
def test_other_functions(self):
order = GaussQuadratures.orders[-1]
for name, function, integral in FUNCTIONS:
Q = GaussQuadratures.iter_quadrature(order)
ret = sum([function(p) * w for (p, w) in Q])
assert float_cmp(ret, integral), \
f'{name} integral wrong: {integral} vs {ret} (quadrature order {order})'
示例3: test_polynomials
# 需要導入模塊: from pymor.tools.quadratures import GaussQuadratures [as 別名]
# 或者: from pymor.tools.quadratures.GaussQuadratures import iter_quadrature [as 別名]
def test_polynomials(self):
for n, function, _, integral in polynomials(GaussQuadratures.orders[-1]):
name = 'x^{}'.format(n)
for order in GaussQuadratures.orders:
if n > order / 2:
continue
Q = GaussQuadratures.iter_quadrature(order)
ret = sum([function(p) * w for (p, w) in Q])
assert float_cmp(ret, integral), '{} integral wrong: {} vs {} (quadrature order {})'.format(
name, integral, ret, order)
示例4: test_polynomials
# 需要導入模塊: from pymor.tools.quadratures import GaussQuadratures [as 別名]
# 或者: from pymor.tools.quadratures.GaussQuadratures import iter_quadrature [as 別名]
def test_polynomials(self):
for n, function, _, integral in polynomials(GaussQuadratures.orders[-1]):
name = f'x^{n}'
for order in GaussQuadratures.orders:
if n > order / 2:
continue
Q = GaussQuadratures.iter_quadrature(order)
ret = sum([function(p) * w for (p, w) in Q])
assert float_cmp(ret, integral), \
f'{name} integral wrong: {integral} vs {ret} (quadrature order {order})'