示例#1
0
def test_ts_roots():
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 5)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 25)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 100, atol=1e-13)

    x, w = orth.ts_roots(5, False)
    y, v, m = orth.ts_roots(5, True)
    assert_allclose(x, y, 1e-14, 1e-14)
    assert_allclose(w, v, 1e-14, 1e-14)

    assert_raises(ValueError, orth.ts_roots, 0)
    assert_raises(ValueError, orth.ts_roots, 3.3)
示例#2
0
def test_ts_roots():
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 5)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 25)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, 100, atol=1e-13)

    x, w = orth.ts_roots(5, False)
    y, v, m = orth.ts_roots(5, True)
    assert_allclose(x, y, 1e-14, 1e-14)
    assert_allclose(w, v, 1e-14, 1e-14)

    assert_raises(ValueError, orth.ts_roots, 0)
    assert_raises(ValueError, orth.ts_roots, 3.3)
示例#3
0
def test_ts_roots():
    weightf = orth.sh_chebyt(5).weight_func
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0.0, 1.0, 5)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0.0, 1.0, 25)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0.0, 1.0, 100, atol=1e-13)

    x, w = orth.ts_roots(5, False)
    y, v, m = orth.ts_roots(5, True)
    assert_allclose(x, y, 1e-14, 1e-14)
    assert_allclose(w, v, 1e-14, 1e-14)

    muI, muI_err = integrate.quad(weightf, 0, 1)
    assert_allclose(m, muI, rtol=muI_err)

    assert_raises(ValueError, orth.ts_roots, 0)
    assert_raises(ValueError, orth.ts_roots, 3.3)
示例#4
0
def test_ts_roots():
    weightf = orth.sh_chebyt(5).weight_func
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0., 1., 5)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0., 1., 25)
    verify_gauss_quad(orth.ts_roots, orth.eval_sh_chebyt, weightf, 0., 1.,
                      100, atol=1e-13)

    x, w = orth.ts_roots(5, False)
    y, v, m = orth.ts_roots(5, True)
    assert_allclose(x, y, 1e-14, 1e-14)
    assert_allclose(w, v, 1e-14, 1e-14)

    muI, muI_err = integrate.quad(weightf, 0, 1)
    assert_allclose(m, muI, rtol=muI_err)

    assert_raises(ValueError, orth.ts_roots, 0)
    assert_raises(ValueError, orth.ts_roots, 3.3)
示例#5
0
 def funnode(self):
     """Chebyshev nodes"""
     return self.a + (self.b - self.a) * orthogonal.ts_roots(self.n)[0]