Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
This routine calulates gaussian quadrature rules for different
families of orthogonal polynomials. Let (a, b) be an interval,
W(x) a positive weight function and n a positive integer.
Then the purpose of this routine is to calculate pairs (x_k, w_k)
for k=0, 1, 2, ... (n-1) which give

  int(W(x) * F(x), x = a..b) = sum(w_k * F(x_k),k = 0..(n-1))

exact for all polynomials F(x) of degree (strictly) less than 2*n. For all
integrable functions F(x) the sum is a (more or less) good approximation to(more...)

src/s/y/sympy-0.7.5/sympy/mpmath/tests/test_eigen_symmetric.py   sympy(Download)
def run_gauss(qtype, a, b):
    eps = 1e-5
    d, e = mp.gauss_quadrature(len(a), qtype)
    d -= mp.matrix(a)
  def run(qtype, FW, R, alpha = 0, beta = 0):
    X, W = mp.gauss_quadrature(n, qtype, alpha = alpha, beta = beta)
    a = 0
    for i in xrange(len(X)):