Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #3
0
 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})'
Beispiel #4
0
 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})'