Пример #1
0
    def test_padua_val_unordered(self):
        domain = [0, 1, 0, 1]
        points = padua_points(20, domain)
        C0f, _abs_error = padua_fit(points, example_functions, 0)
        X = [0, 0.5, 1]

        val = padua_val(X, X, C0f, domain)
        expected = [7.664205912849228e-01, 3.2621734202884815e-01, 3.587865112678535e-02]
        assert_array_almost_equal(val, expected, 14)
Пример #2
0
 def test_padua_val_unordered(self):
     domain = [0, 1, 0, 1]
     points = padua_points(20, domain)
     C0f, abs_error = padua_fit(points, example_functions, 0)
     X = np.array([0, 0.5, 1])
     # true_val = example_functions.franke(X, X)
     val = padua_val(X, X, C0f, domain)
     expected = [0.76642059128493,  0.32621734202885,  0.03587865112678]
     assert_array_almost_equal(val, expected, 14)
     assert_array_almost_equal(abs_error,  0.003897032262116954)
Пример #3
0
 def test_padua_val_grid(self):
     domain = [0, 1, 0, 1]
     a, b, c, d = domain
     points = padua_points(21, domain)
     C0f, _abs_error = padua_fit(points, example_functions, 0)
     X1 = np.linspace(a, b, 2)
     X2 = np.linspace(c, d, 2)
     val = padua_val(X1, X2, C0f, domain, use_meshgrid=True)
     expected = [[7.664205912849229e-01, 1.0757071952145181e-01], [2.703371615911344e-01, 3.5734971024838565e-02]]
     assert_array_almost_equal(val, expected, 14)
Пример #4
0
 def test_padua_val_grid(self):
     domain = [0, 1, 0, 1]
     a, b, c, d = domain
     points = padua_points(21, domain)
     C0f, _abs_error = padua_fit(points, example_functions, 0)
     X1 = np.linspace(a, b, 2)
     X2 = np.linspace(c, d, 2)
     val = padua_val(X1, X2, C0f, domain, use_meshgrid=True)
     expected = [[7.664205912849229e-01, 1.0757071952145181e-01],
                 [2.703371615911344e-01, 3.5734971024838565e-02]]
     assert_array_almost_equal(val, expected, 14)
Пример #5
0
    def test_padua_val_unordered(self):
        domain = [0, 1, 0, 1]
        points = padua_points(20, domain)
        C0f, _abs_error = padua_fit(points, example_functions, 0)
        X = [0, 0.5, 1]

        val = padua_val(X, X, C0f, domain)
        expected = [
            7.664205912849228e-01, 3.2621734202884815e-01,
            3.587865112678535e-02
        ]
        assert_array_almost_equal(val, expected, 14)
Пример #6
0
    def test_padua_val_grid(self):
        domain = [0, 1, 0, 1]
        a, b, c, d = domain
        points = padua_points(21, domain)
        C0f, abs_error = padua_fit(points, example_functions, 0)
        X1 = np.linspace(a, b, 2)
        X2 = np.linspace(c, d, 2)
        val = padua_val(X1, X2, C0f, domain, use_meshgrid=True)

        expected = [[0.76642059128493,  0.10757071952145],
                    [0.27033716159114,  0.03573497102484]]
        assert_array_almost_equal(val, expected, 14)
        assert_array_almost_equal(abs_error,  0.0022486904061664046)