Beispiel #1
0
 def test_gausschebyshev2(self):
     """Test Gauss Chebyshev type 2 polynomial grid."""
     points, weights = roots_chebyu(10)
     grid = GaussChebyshevType2(10)
     weights /= np.sqrt(1 - np.power(points, 2))
     assert_allclose(grid.points, points)
     assert_allclose(grid.weights, weights)
Beispiel #2
0
 def test_errors_raise(self):
     """Test errors raise."""
     with self.assertRaises(ValueError):
         GaussLaguerre(10, -1)
     with self.assertRaises(ValueError):
         TanhSinh(10, 1)
     with self.assertRaises(ValueError):
         Simpson(4)
     with self.assertRaises(ValueError):
         GaussChebyshevType2(-10)
     with self.assertRaises(ValueError):
         GaussChebyshevLobatto(-10)
     with self.assertRaises(ValueError):
         Trapezoidal(-10)
     with self.assertRaises(ValueError):
         RectangleRuleSineEndPoints(-10)
     with self.assertRaises(ValueError):
         RectangleRuleSine(-10)
     with self.assertRaises(ValueError):
         TanhSinh(-11, 1)
     with self.assertRaises(ValueError):
         Simpson(-11)
     with self.assertRaises(ValueError):
         MidPoint(-10)
     with self.assertRaises(ValueError):
         ClenshawCurtis(-10)
     with self.assertRaises(ValueError):
         FejerFirst(-10)
     with self.assertRaises(ValueError):
         FejerSecond(-10)
Beispiel #3
0
    def test_TrefethenGC2_d0(self):
        """Test for Trefethen - Sausage GaussChebyshev2 and parameter d=0."""
        grid = TrefethenGC2(10, 0)

        tmp = GaussChebyshevType2(10)

        assert_allclose(grid.points, tmp.points)
        assert_allclose(grid.weights, tmp.weights)
Beispiel #4
0
    def test_TrefethenStripGC2(self):
        """Test for Trefethen - Strip Gauss Chebyshev 2."""
        grid = TrefethenStripGC2(10, 1.1)

        tmp = GaussChebyshevType2(10)

        new_points = _gstrip(1.1, tmp.points)
        new_weights = _dergstrip(1.1, tmp.points) * tmp.weights

        assert_allclose(grid.points, new_points)
        assert_allclose(grid.weights, new_weights)
Beispiel #5
0
    def test_TrefethenGC2_d3(self):
        """Test for Trefethen - Sausage GaussChebyshev2 and parameter d=3."""
        grid = TrefethenGC2(10, 3)

        tmp = GaussChebyshevType2(10)

        new_points = _g3(tmp.points)
        new_weights = _derg3(tmp.points) * tmp.weights

        assert_allclose(grid.points, new_points)
        assert_allclose(grid.weights, new_weights)