MA 780: Project #2, February 13. Goal: Gaussian quadratures. Problem 1 1. Find the expressions for the weights and nodes for GaussLobatto quadratures with n = 2, 3 and 4. Give those either by algebraic expressions or within a minimum of 15 accurate digits. 2. Read section 9.4 on composite Newton-Cotes formulas. 3. Consider the following integrals (examples 9.1, p.377, 9.2, p.381, 9.3, p.382) R 2π −2π π e−2π , • 0 xe−x cos(2x) dx = 3 (e −1)−10 25 • R1 • R5 0 x5/2 dx = 2/7, 1 −5 1+x2 dx = 2 arctan 5. 4. Compare the performance of Simpson, composite Simpson, GaussLegendre (seen in class), Gauss-Lobatto (derived above) for the above three problems. R1 Problem 2 We approximate the integral I = −1 f (x) dx by In = n X wk f (xk ). (1) k=0 1. Consider the code gauss.m below from N. Trefethen1 . Explain, line by line, why this code corresponds to the Gauss-Legendre quadrature seen in class. 2. The Clenshaw-Curtis quadratures are obtained by using Chebyshev points as nodes, i.e., by using xj = cos jπ , n j = 0, . . . , n in (1). The weights are found by requiring that In = I for f ∈ Pn . Find these weights and explain why the code clenshaw curtis.m below corresponds to this type of quadrature. 3. Reproduce the results (figures) of Figure 2 from the paper cited under point 1. 1 https://people.maths.ox.ac.uk/trefethen/publication/PDF/2008_127.pdf function I = gauss(f,n) beta = .5./sqrt(1−(2*(1:n)).ˆ(−2)); T = diag(beta,1) + diag(beta,−1); [V,D] = eig(T); x = diag(D); [x,i] = sort(x); w = 2*V(1,i).ˆ2; I = w*feval(f,x); % % % % % % % function I = clenshaw curtis(f,n) x = cos(pi*(0:n)'/n); fx = feval(f,x)/(2*n); g = real(fft(fx([1:n+1 n:−1:2]))); a = [g(1); g(2:n)+g(2*n:−1:n+2); g(n+1)]; w = 0*a'; w(1:2:end) = 2./(1−(0:2:n).ˆ2); I = w*a; (n+1)−pt Gauss quadrature of f 3−term recurrence coeffs Jacobi matrix eigenvalue decomposition nodes (= Legendre points) weights the integral% 3−term recurrence coeffs % % % % % % % (n+1)−pt C−C quadrature of f Chebyshev points f evaluated at these points Fast Fourier Transform Chebyshev coefficients weight vector the integral
© Copyright 2026 Paperzz