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