Пример #1
0
def test_t_roots():
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 5)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 25)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 100)

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

    assert_raises(ValueError, orth.t_roots, 0)
    assert_raises(ValueError, orth.t_roots, 3.3)
Пример #2
0
def test_t_roots():
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 5)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 25)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, 100)

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

    assert_raises(ValueError, orth.t_roots, 0)
    assert_raises(ValueError, orth.t_roots, 3.3)
Пример #3
0
def test_t_roots():
    weightf = orth.chebyt(5).weight_func
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 5)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 25)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 100)

    x, w = orth.t_roots(5, False)
    y, v, m = orth.t_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, -1, 1)
    assert_allclose(m, muI, rtol=muI_err)

    assert_raises(ValueError, orth.t_roots, 0)
    assert_raises(ValueError, orth.t_roots, 3.3)
Пример #4
0
def test_t_roots():
    weightf = orth.chebyt(5).weight_func
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 5)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 25)
    verify_gauss_quad(orth.t_roots, orth.eval_chebyt, weightf, -1., 1., 100)

    x, w = orth.t_roots(5, False)
    y, v, m = orth.t_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, -1, 1)
    assert_allclose(m, muI, rtol=muI_err)

    assert_raises(ValueError, orth.t_roots, 0)
    assert_raises(ValueError, orth.t_roots, 3.3)
 def discretizeChebyshev(self, Axis_i):
     [xi, self.weights[Axis_i]] = t_roots(
         self.
         listOfNbPointsOnEachIntervalForFinalDiscretization_Axis_kTotal[
             Axis_i])
     self.getDxiAfterTransf(
         xi, Axis_i)  # Update self.listOfTuckerGridNodes_Axis_k[Axis_i]
     self.listOfcoefW[Axis_i] = self.lx[Axis_i] / 2
Пример #6
0
    def quadrature(self,n): return so.t_roots(n)

class HermitePolynomial(OrthogonalPolynomial):