Numerical Integration

Total Page:16

File Type:pdf, Size:1020Kb

Numerical Integration Chapter 5 Numerical integration In this chapter, we study how to approximate the definite integral of some smooth functions. An idea is to use an interpolating polynomial F (x) to evaluate the integral. Thus we have b b f(x) dx F (x) dx. ≈ Za Za Our purpose is how to design such an interpolation so that the error is mini- mized. 5.1 Closed Newton-Cotes Formulas We would like to design a quadrature for the following integral: b f(x) dx. Za One point formula: If F (x) is a constant interpolation at x0, then the above integral is approximated by (b a)f(x ) called a rectangle rule. One can − 0 show that there exist ξ0 and ξ0 in [a, b] such that the following hold. 2 b (b a) b+a (b a)f(x0)+ −2 f ′(ξ0), if x0 = 2 f(x) dx = − 3 6 (5.1) (b a) b+a a (b a)f(x )+ − f (ξ ), if x = . Z − 0 24 ′′ 1 0 2 Thus one point formula is exact for constant polynomial(except mid point rule), so it is called a 0-th order method. 1 2 CHAPTER 5. NUMERICAL INTEGRATION Two point formula-trapezoidal rule: b b a (b a)3 f(x) dx = − (f(a)+ f(b)) − f ′′(ξ). (5.2) 2 − 12 Za This is exact for linear polynomials, hence it is a first order method. Newton-Cotes Rules Assume we have nodes x , ,x in [a, b] are equally spaced. We use an 0 · · · n interpolating polynomial p(x) to replace the integral. b b n n f(x) dx p(x) dx = cip(xi)= cif(xi). a ≈ a Z Z Xi=0 Xi=0 For example, if we use the Lagrange interpolating polynomial, we have n pn(x)= f(xi)Ln,i(x), (5.3) Xi=0 where n (x xj) Ln,i(x)= − , 0 i n. (xi xj) ≤ ≤ i=i Y6 − We let b n b n f(x) dx f(xi) Ln,i(x) dx = Bn,if(xi), a ∼ a Z Xi=0 Z Xi=0 where b Bn,i = Ln,i(x) dx. Za This is the Newton-Cotes formula. If x0 = a and xn = b, then we say it is a closed Newton-Cotes formula. Otherwise, it is called an open Newton-Cotes formula. Mid point rule is an open Newton-Cotes formula. Three point formula-Simpson rule Use an interpolation at three equally spaced points x0,x1,x2 : Let x2 x2 f(x) dx p (x) dx, (5.4) ≈ 2 Zx0 Zx0 5.1. CLOSED NEWTON-COTES FORMULAS 3 where p2(x) is the Lagrange interpolation. For simplicity, we assume x0 = h, x = 0 and x = h. Then − 1 2 x(x h) (x + h)(x h) (x + h)x p = f(x ) − + f(x ) − + f(x ) . 2 0 2h2 1 h2 2 2h2 − Integrating, we obtain h 1 2 2 = 2 (f0 2f1 + f2)x + ( hf0 + hf2)x + 2h dx h 2h − − Z− 1 h3 = (f 2f + f ) + 4h3f 2h2 3 0 − 1 2 1 h = (f + 4f + f ). 3 0 1 2 Hence we get the following rule, called the Simpson’s rule x2 h f(x) dx (f(x ) + 4f(x )+ f(x )) s (f). (5.5) ∼ 3 0 1 2 ≡ 1 Zx0 One can readily check that this is exact for a polynomial up to degree three, even if we used a quadratic polynomial approximation. Hence this is a third order method. In fact one can show that x2 h h5 f(x) dx = (f(x ) + 4f(x )+ f(x )) f (4)(ξ ), ξ [x ,x ]. (5.6) 3 0 1 2 − 90 1 1 ∈ 0 2 Zx0 Similar phenomenon arises for all even n. Derive formula for n = 3 and n = 4. Error of numerical integration We consider Newton-Cotes formula. We assume the following situation: Let a x0 <x1 < <xn b, xi xi 1 = h and consider an approximation ≤ · · · ≤ − − of b f(x)dx by some quadrature based on the data (x ,f(x ), , (x ,f(x )). a 0 0 · · · n n UseR Taylor formula with remainder: (n) (n+1) f (x0) n f (ξ) n+1 f(x)= f(x )+ f ′(x )(x x )+ + (x x ) + (x x ) 0 0 − 0 · · · n! − 0 (n + 1)! − 0 or Newton’s interpolating polynomial pn(f)= f(x0)+f[x0,x1](x x0)+ +f[x0,x1, ,xn](x x0) (x xn 1). − · · · · · · − · · · − − 4 CHAPTER 5. NUMERICAL INTEGRATION By the error formula, we have f(x)= p (f)+ f[x ,x , ,x ,x](x x ) (x x ). n 0 1 · · · n − 0 · · · − n Integrating the error term of Newton’s formula we have n n b b f (n+1)(ξ) E(f)= f[x0,x1, ,xn,x] (x xi)dx = (x xi)dx. a · · · − a (n + 1)! − Z Yi=0 Z Yi=0 Since the term n (x x ) does not change sign on each subinterval (x ,x ), i=0 − i s s+1 we can use meanQ value theorem to see the above quantity is (n+1) ¯ xs+1 n (n+1) ¯ f (ξs) f (ξs) n+2 (x xi)dx = O(h ), (n + 1)! xs − (n + 1)! × Z Yi=0 for some ξ¯ (x ,x ). A more precise error formula is as follows:(See s ∈ s s+1 Issacson-Keller) Theorem 5.1.1. The error by Newton-Cotes formula is n f (n+2)(ξ¯) b (x x ) (x x )dx, if n is even (n + 2)! − 0 − i Za i=0 E(f)= (n+1) b n Y (5.7) f (ξ¯) (x xi)dx, if n is odd. (n + 1)! − Za i=0 Y As noted earlier, we have one higher order of accuracy for even n. Semi-Simpson rule If n is odd, we can approximate xn−1 f(x) dx Zx0 by Simpson’s rule, but to apply Simpson’s rule to xn f(x) dx Zx0 we split the integral into two parts: xn xn−1 xn f(x) dx = f(x) dx + f(x) dx Zx0 Zx0 Zxn−1 5.1. CLOSED NEWTON-COTES FORMULAS 5 and we can apply Simpson’s rule to the first integral. But how to approximate the second integral (we need the same order method)? One idea is to add an extra point, say xn 2 and use a quadratic interpo- − lation: (x xn 1)(x xn) (x xn 2)(x xn) (x xn 2)(x xn 1) p2(x)= fn 2 − − − +fn 1 − − − +fn − − − − . − ( h)( 2h) − (h)( h) (2h)(h) − − − Change of variable: x xn 1 = th gives − − (t 1)(t 2) t(t 1) p2(x)= fn 2 − − fn 1t(t 2) + fn − . − 2 − − − 2 Thus xn 2 (t 1)(t 2) t(t 1) f(x) dx h fn 2 − − fn 1t(t 2) + fn − dt ≈ − 2 − − − 2 Zxn−1 Z1 h = ( f(xn 2) + 8f(xn 1) + 5f(xn)). 12 − − − x1 Ex. Derive an integration rule for x0 f(x) dx using the data at x0,x1 and x (assume h = x x = x x .) 2 1 − 0 2 − 1 R Composite Simpson’s rule If the domain is large, divide it by even number of intervals and applying Simpson’s rule to a pair of subintervals, one can find a more accurate approx- imation. Let x = a + ih, h = (b a)/2n. Then i − b x2 x4 x2n f(x) dx = f(x) dx + f(x) dx + + f(x) dx. · · · Za Zx0 Zx2 Zx2n−2 If Simpson’s rule is used for each integral, we obtain n b h f(x) dx [f(x2i 2) + 4f(x2i 1)+ f(x2i)]. a ∼ 3 − − Z Xi=1 To avoid repetitions it is rearranged as n n h f(x0) + 2 f(x2i 2) + 4 f(x2i 1)+ f(x2n) . 3 " − − # Xi=2 Xi=1 6 CHAPTER 5. NUMERICAL INTEGRATION 5.2 Open Newton-Cotes Formulas b We consider approximation of integral a f(x)dx by interpolating at n + 1 interior points R x = a + h, x = a + 2h, ,x = a + (n + 1)h. 0 1 · · · n Here h = (b a)/(n+2).This rule is useful when we cannot use or do not want − to use end points. 3 (1) n = 0 : b f(x)dx 2hf(x ). Error: h f (ξ) a ≈ 0 3 ′′ R 3 (2) n = 1 : b f(x)dx 3h (f(x )+ f(x )). Error: 3h f (ξ) a ≈ 2 0 1 4 ′′ R 5 (3) n = 2 : b f(x)dx 4h (2f(x ) f(x ) + 2f(x )). Error: 14h f (4)(ξ) a ≈ 3 0 − 1 2 45 R Notice that even cases are more accurate. How to find the coefficients? One way is to integrate the Lagrange inter- polation b n f(x) dx wif(xi), (5.8) a ∼ Z Xi=0 where b wi = Ln,i(x) dx. Za Another method is to let the formula (5.8) be exact for all monomials xi, (i = 0, 1, ,n.) For n = 3 · · · b 5h f(x) dx (11f(x )+ f(x )+ f(x ) + 11f(x )) (5.9) ∼ 24 0 1 2 3 Za Remark 5.2.1. In general, open Cotes rules are used much less than the closed rule. However, there are instances where end points not available. 5.3 Gaussian quadrature-unequal intervals We now consider a quadrature with unequal intervals. Check that the quadra- ture 1 . 1 1 f(x) dx = f( )+ f( ) 1 − 3 3 Z− r r 5.3. GAUSSIAN QUADRATURE-UNEQUAL INTERVALS 7 is exact up to degree 3.
Recommended publications
  • The Legendre Transform Ross Bannister, May 2005 Orthogonality of the Legendre Polynomials the Legendre Polynomials Satisfy the Following Orthogonality Property [1], 1
    The Legendre Transform Ross Bannister, May 2005 Orthogonality of the Legendre polynomials The Legendre polynomials satisfy the following orthogonality property [1], 1 2 ¥ ¥§¦ ¥ ¤ ¤ d x Pn ¤ x Pm x mn 1 © 2n ¨ 1 x ¡£¢ 1 ¥ where Pn ¤ x is the nth order Legendre polynomial. In meteorology it is sometimes convenient to integrate over the latitude domain, , instead of over x. This is achieved with the following transform, d x ¦ ¦ ¦ ¥ ¤ x sin cos d x cos d 2 d In latitude (measured in radians), Eq. (1) becomes, /2 2 ¥ ¥ ¥§¦ ¤ ¤ d cos Pn ¤ Pm mn 3 ¨ © 2n 1 ¡£¢ /2 The Legendre transform and its inverse convert to and from the latitudinal and Legendre polynomial representations of functions (I call this these transforms a Legendre transform pair). In the following we shall develop these transforms in matrix form. The matrix form of the transforms is a compact and convenient means of performing summations over and over n (we shall assume that functions are represented discreetly in space and so integrals are represented by summations). In the notation to follow, functions are represented as vectors. A function in space shall be denoted by the vector x, and a function in n space shall be denoted by p. Let the matrix consisting of columns of Legendre polynomials be F. The orthogonality condition, Eq. (3), in matrix form is, T ¦ ¥ ¤ F PF 4 where P is the so-called diagonal inner product matrix whose diagonal elements are cos and is the ¨ ¥ diagonal matrix whose diagonal elements are the normalizations 2 / ¤ 2n 1 . Legendre transform pair ('unbalanced' version) The orthogonality condition, Eq.
    [Show full text]
  • Calculation of Highly Oscillatory Integrals by Quadrature Methods
    CALCULATION OF HIGHLY OSCILLATORY INTEGRALS BY QUADRATURE METHODS A Senior Scholars Thesis by KRISHNA THAPA Submitted to Honors and Undergraduate Research Texas A&M University in partial fulfillment of the requirements for the designation as UNDERGRADUATE RESEARCH SCHOLAR May 2012 Major: Physics CALCULATION OF HIGHLY OSCILLATORY INTEGRALS BY QUADRATURE METHODS A Senior Scholars Thesis by KRISHNA THAPA Submitted to Honors and Undergraduate Research Texas A&M University in partial fulfillment of the requirements for the designation as UNDERGRADUATE RESEARCH SCHOLAR Approved by: Research Advisor: Stephen Fulling Associate Director, Honors and Undergraduate Research: Duncan MacKenzie May 2012 Major: Physics iii ABSTRACT Calculation of Highly Oscillatory Integrals by Quadrature Methods. (May 2012) Krishna Thapa Department of Physics Texas A&M University Research Advisor: Dr. Stephen Fulling Department of Mathematics R 1 i!g(x) Highly oscillatory integrals of the form I(f) = 0 dxf(x)e arise in various problems in dynamics, image analysis, optics, and other fields of physics and math- ematics. Conventional approximation methods for such highly oscillatory integrals tend to give huge errors as frequency (!) ! 1. Over years, various attempts have been made to get over this flaw by considering alternative quadrature methods for integration. One such method was developed by Filon in 1928, which Iserles et al. have recently extended. Using this method, Iserles et al. show that as ! ! 1, the error decreases further as the error is inversely proportional to !. We use methods developed by Iserles' group, along with others like Newton-Cotes, Clenshaw-Curtis and Levin's methods with the aid of Mathematica. Our aim is to find a systematic way of calculating highly oscillatory integrals.
    [Show full text]
  • Numerical Construction of Gaussian Quadrature Formulas For
    mathematics of computation, VOLUME 27, NUMBER 124, OCTOBER 1973 Numerical Construction of Gaussian Quadrature Formulas for / (-Log *)• xa-f(x)-dx and / Em(x)-j(x)-dx Jo Jo By Bernard Danloy Abstract. Most nonclassical Gaussian quadrature rules are difficult to construct because of the loss of significant digits during the generation of the associated orthogonal poly- nomials. But, in some particular cases, it is possible to develop stable algorithms. This is true for at least two well-known integrals, namely ¡l-(Loêx)-x°f(x)dx and ¡Ô Em(x)f(x)-dx. A new approach is presented, which makes use of known classical Gaussian quadratures and is remarkably well-conditioned since the generation of the orthogonal polynomials requires only the computation of discrete sums of positive quantities. Finally, some numerical results are given. 1. Introduction. Let w(x) be a nonnegative weight function on (a, b) such that all its moments (1.1) M*= / w(x)-x"-dx, k = 0, 1, 2, ••■ , exist. The «-point Gaussian quadrature rule associated with w(x) and (a, b) is that uniquely defined linear functional (1.2) G„-/= ¿X, •/(*,) ¿-i which satisfies (1.3) G„/ = [ w(x)-j(x)-dx Ja whenever / is a polynomial of degree ^ 2n — 1. It is a well-known result [8] that the Gaussian abscissas *¿ are the roots of the polynomials orthogonal on (a, b) with respect to w(x), and that the associated coeffi- cients X,, called Christoffel constants, can also be expressed in terms of these poly- nomials. A direct exploitation of these results is still the most widely recommended procedure, even though alternative approaches have been suggested by Rutishauser [7], Golub and Welsch [6].
    [Show full text]
  • Handout on Gaussian Quadrature, Parts I and II
    Theoretical foundations of Gaussian quadrature 1 Inner product vector space Definition 1. A vector space (or linear space) is a set V = {u, v, w,...} in which the following two operations are defined: (A) Addition of vectors: u + v ∈ V , which satisfies the properties (A1) associativity: u + (v + w) = (u + v) + w ∀ u, v, w in V ; (A2) existence of a zero vector: ∃ 0 ∈ V such that u + 0 = u ∀u ∈ V ; (A3) existence of an opposite element: ∀u ∈ V ∃(−u) ∈ V such that u + (−u) = 0; (A4) commutativity: u + v = v + u ∀ u, v in V ; (B) Multiplication of a number and a vector: αu ∈ V for α ∈ R, which satisfies the properties (B1) α(u + v) = αu + αv ∀ α ∈ R, ∀u, v ∈ V ; (B2) (α + β)u = αu + βu ∀ α, β ∈ R, ∀u ∈ V ; (B3) (αβ)u = α(βu) ∀ α, β ∈ R, ∀u ∈ V ; (B4) 1u = u ∀u ∈ V . Definition 2. An inner product linear space is a linear space V with an operation (·, ·) satisfying the properties (a) (u, v) = (v, u) ∀ u, v in V ; (b) (u + v, w) = (u, w) + (v, w) ∀ u, v, w in V ; (c) (αu, v) = α(u, v) ∀α ∈ R, ∀ u, v, w in V ; (d) (u, u) ≥ 0 ∀u ∈ V ; moreover, (u, u) = 0 if and only if u = 0. d Example. The “standard” inner product of the vectors u = (u1, u2, . , ud) ∈ R and d v = (v1, v2, . , vd) ∈ R is given by d X (u, v) = uivi . i=1 1 Example. Let G be a symmetric positive-definite matrix, for example 5 4 1 G = (gij) = 4 7 0 .
    [Show full text]
  • [Draft] 4.4.3. Examples of Gaussian Quadrature. Gauss–Legendre
    CAAM 453 · NUMERICAL ANALYSIS I Lecture 26: More on Gaussian Quadrature [draft] 4.4.3. Examples of Gaussian Quadrature. Gauss{Legendre quadrature. The best known Gaussian quadrature rule integrates functions over the interval [−1; 1] with the trivial weight function w(x) = 1. As we saw in Lecture 19, the orthogonal polynomials for this interval and weight are called Legendre polynomials. To construct a Gaussian quadrature rule with n + 1 points, we must determine the roots of the degree-(n + 1) Legendre polynomial, then find the associated weights. First, consider the case of n = 1. The quadratic Legendre polynomial is 2 φ2(x) = x − 1=3; and from this polynomialp one can derive the 2-point quadrature rule that is exact for cubic poly- nomials, with roots ±1= 3. This agrees with the special 2-point rule derived in Section 4.4.1. The values for the weights follow simply, w0 = w1 = 1, giving the 2-point Gauss{Legendre rule p p I(f) = f(−1= 3) + f(1= 3): For Gauss{Legendre quadrature rules based on larger numbers of points, there are various ways to compute the nodes and weights. Traditionally, one would consult a book of mathematical tables, such as the venerable Handbook of Mathematical Functions, edited by Milton Abramowitz and Irene Stegun for the National Bureau of Standards in the early 1960s. Now, one can look up these quadrature nodes and weights on web sites, or determine them to high precision using a symbolic mathematics package such as Mathematica. Most effective of all, one can compute these nodes and weights by solving a symmetric tridiagonal eigenvalue problem.
    [Show full text]
  • Numerical Quadrature
    Numerical Integration Numerical Differentiation Richardson Extrapolation Outline 1 Numerical Integration 2 Numerical Differentiation 3 Richardson Extrapolation Michael T. Heath Scientific Computing 2 / 61 Main Ideas ❑ Quadrature based on polynomial interpolation: ❑ Methods: ❑ Method of undetermined coefficients (e.g., Adams-Bashforth) ❑ Lagrangian interpolation ❑ Rules: ❑ Midpoint, Trapezoidal, Simpson, Newton-Cotes ❑ Gaussian Quadrature ❑ Quadrature based on piecewise polynomial interpolation ❑ Composite trapezoidal rule ❑ Composite Simpson ❑ Richardson extrapolation ❑ Differentiation ❑ Taylor series / Richardson extrapolation ❑ Derivatives of Lagrange polynomials ❑ Derivative matrices Quadrature Examples b = ecos x dx •I Za Di↵erential equations: n u(x)= u φ (x) XN j j 2 j=1 X Find u(x)suchthat du r(x)= f(x) XN dx − ? Numerical Integration Quadrature Rules Numerical Differentiation Adaptive Quadrature Richardson Extrapolation Other Integration Problems Integration For f : R R, definite integral over interval [a, b] ! b I(f)= f(x) dx Za is defined by limit of Riemann sums n R = (x x ) f(⇠ ) n i+1 − i i Xi=1 Riemann integral exists provided integrand f is bounded and continuous almost everywhere Absolute condition number of integration with respect to perturbations in integrand is b a − Integration is inherently well-conditioned because of its smoothing effect Michael T. Heath Scientific Computing 3 / 61 Numerical Integration Quadrature Rules Numerical Differentiation Adaptive Quadrature Richardson Extrapolation Other Integration Problems Numerical Quadrature Quadrature rule is weighted sum of finite number of sample values of integrand function To obtain desired level of accuracy at low cost, How should sample points be chosen? How should their contributions be weighted? Computational work is measured by number of evaluations of integrand function required Michael T.
    [Show full text]
  • Gaussian Quadrature for Computer Aided Robust Design
    Page 1 of 88 Gaussian Quadrature for Computer Aided Robust Design by Geoffrey Scott Reber S.B. Aeronautics and Astronautics Massachusetts Institute of Technology, 2000 Submitted to the Department of Aeronautics and Astronautics in partial fulfillment of the requirements for the degree of Masters of Science in Aeronautics and Astronautics at the Massachusetts Institute of Technology OF TECHN3LOGY JUL 0 1 2004 June, 2004 LIBRARIES © 2004 Massachusetts Institute of Technology. All rights reserved t AERO Signature of Author: Department o auticsd Astronautics -Myay 7, 2004 Certified by: aniel Frey Professor of Mechan' al Engineering Thesis Supervisor Approved by: Edward Greitzer H.N. Slater Professor of Aeronautics and Astronautics Chair, Committee on Graduate Students Page 2 of 88 Gaussian Quadrature for Computer Aided Robust Design by Geoffrey Scott Reber Submitted to the Department of Aeronautics and Astronautics on May 7, 2004 in partial fulfillment of the requirements for the degree of Master of Science in Aeronautics and Astronautics ABSTRACT Computer aided design has allowed many design decisions to be made before hardware is built through "virtual" prototypes: computer simulations of an engineering design. To produce robust systems noise factors must also be considered (robust design), and should they should be considered as early as possible to reduce the impact of late design changes. Robust design on the computer requires a method to analyze the effects of uncertainty. Unfortunately, the most commonly used computer uncertainty analysis technique (Monte Carlo Simulation) requires thousands more simulation runs than needed if noises are ignored. For complex simulations such as Computational Fluid Dynamics, such a drastic increase in the time required to evaluate an engineering design may be probative early in the design process.
    [Show full text]
  • Quadrature Methods
    QUADRATURE METHODS Kenneth L. Judd Hoover Institution July 19, 2011 1 Integration • Most integrals cannot be evaluated analytically • Integrals frequently arise in economics — Expected utility — Discounted utility and profits over a long horizon — Bayesian posterior — Likelihood functions — Solution methods for dynamic economic models 2 Newton-Cotes Formulas • Idea: Approximate function with low order polynomials and then integrate approximation • Step function approximation: — Compute constant function equalling f(x) at midpoint of [a, b] — Integral approximation is aUQV b box • Linear function approximation: — Compute linear function interpolating f(x) at a and b — Integral approximation is trapezoid aP Rb 3 • Parabolic function approximation: — Compute parabola interpolating f(x) at a, b,and(a + b)/2 — Integral approximation is area of aP QRb 4 • Midpoint Rule: piecewise step function approximation b a + b (b − a)3 f(x) dx =(b − a) f + f (ξ) a 2 24 — Simple rule: for some ξ ∈ [a, b] b a + b (b − a)3 f(x) dx =(b − a) f + f (ξ) a 2 24 — Composite midpoint rule: 1 ∗ nodes: xj = a +(j − 2)h, j =1, 2, ...,n, h =(b − a)/n ∗ for some ξ ∈ [a, b] b n 1 h2(b − a) f(x) dx = h f a +(j − )h + f (ξ) 2 24 a j=1 5 • Trapezoid Rule: piecewise linear approximation — Simple rule: for some ξ ∈ [a, b] b b − a (b − a)3 f(x) dx = [f(a)+f(b)] − f (ξ) a 2 12 — Composite trapezoid rule: ∗ x 1 nodes: j = a +(j − 2)h, j =1, 2, ...,n, h =(b − a)/n ∗ for some ξ ∈ [a, b] b h f(x) dx= [f0 +2f1 + ···+2fn−1 + fn] a 2 h2 (b − a) − f (ξ) 12 6 • Simpson’s Rule: piecewise quadratic approximation — for some ξ ∈ [a, b] b b − a a + b f(x) dx= f(a)+4f + f(b) a 6 2 (b − a)5 − f (4) (ξ) 2880 — Composite Simpson’s rule: for some ξ ∈ [a, b] b h f(x) dx= [f0 +4f1 +2f2 +4f3 + ···+4fn−1 + fn] a 3 h4(b − a) − f (4)(ξ) 180 • Obscure rules for degree 3, 4, etc.
    [Show full text]
  • The Comparison of the Trapezoid Rule and the Gaussian Quadrature
    The Comparison of the Trapezoid Rule and the Gaussian Quadrature Margo Rothstein Georgia College and State University May 3, 2018 1 Abstract This paper provides a detailed exploration of the comparison of the Gaussian Quadrature and the Trapezoid Rule. They are both numerical methods that are used to approximate integrals. The Gaussian Quadrature is a much better approximation method than the Trapezoid Rule. We will prove and demonstrate the approximating power of both rules, and provide some practical applications of the rules as well. 2 Introduction Integration is the calculation of the the theorem states the following: area under the curve a function f(x). The integral of f produces a family of an- Z b tiderivatives F (x)+c that is used to calculate f(x)dx = F (b) − F (a): the area, denoted by, a Z f(x)dx: There are many methods developed to find F (x) that will produce the exact area. These A definite integral calculates the area under methods include integration by parts, par- the curve of a function f(x) on a specific in- tial fraction decomposition, change of vari- terval [a; b], denoted by, ables, and trig substitution. However, there are some functions that can not be inte- Z b grated exactly. They must be approximated. f(x)dx: We will discuss two approximation methods a in numerical analysis called the Trapezoid The Fundamental Theorem of Calculus is Rule and the Gaussian Quadrature. The how a definite integral should be calculated; definition of a Quadrature rule for nodes 1 x1 < x2 < x − 3 < ··· < xn is n Z b X f(x)dx ≈ cif(xi): a i=1 A closed quadrature rule means that f(x) is evaluated at the endpoints.
    [Show full text]
  • Gaussian Quadrature
    10 Gaussian Quadrature Lab Objective: Learn the basics of Gaussian quadrature and its application to numerical inte- gration. Build a class to perform numerical integration using Legendre and Chebyshev polynomials. Compare the accuracy and speed of both types of Gaussian quadrature with the built-in Scipy package. Perform multivariate Gaussian quadrature. Legendre and Chebyshev Gaussian Quadrature It can be shown that for any class of orthogonal polynomials p 2 R[x; 2n + 1] with corresponding weight function , there exists a set of points n and weights n such that w(x) fxigi=0 fwigi=0 n Z b X p(x)w(x)dx = p(xi)wi: a i=0 Since this relationship is exact, a good approximation for the integral Z b f(x)w(x)dx a can be expected as long as the function f(x) can be reasonably interpolated by a polynomial at the points xi for i = 0; 1; : : : ; n. In fact, it can be shown that if f(x) is 2n + 1 times dierentiable, the error of the approximation will decrease as n increases. Gaussian quadrature can be performed using any basis of orthonormal polynomials, but the most commonly used are the Legendre polynomials and the Chebyshev polynomials. Their weight functions are w (x) = 1 and w (x) = p 1 , respectively, both dened on the open interval (−1; 1). l c 1−x2 Problem 1. Dene a class for performing Gaussian quadrature. The constructor should accept an integer n denoting the number of points and weights to use (this will be explained later) and a label indicating which class of polynomials to use.
    [Show full text]
  • Gaussian Quadratures
    GaussianGaussian QuadraturesQuadratures • Newton-Cotes Formulae – use evenly-spaced functional values – Did not use the flexibility we have to select the quadrature points • In fact a quadrature point has several degrees of freedom. m Q(f)=∑i=1 ci f(xi) A formula with m function evaluations requires specification of 2m numbers ci and xi • Gaussian Quadratures – select both these weights and locations so that a higher order polynomial can be integrated (alternatively the error is proportional to a higher derivatives) • Price: functional values must now be evaluated at non- uniformly distributed points to achieve higher accuracy • Weights are no longer simple numbers • Usually derived for an interval such as [-1,1] • Other intervals [a,b] determined by mapping to [-1,1] Gaussian Quadrature on [-1, 1] 1 n f ( x )dx ≈ ci f ( xi ) = c1 f ( x1 ) + c2 f ( x 2 ) + + cn f ( xn ) ∫−1 ∑ L i=1 • Two function evaluations: – Choose (c1, c2, x1, x2) such that the method yields “exact integral” for f(x) = x0, x1, x2, x3 1 n = 2 : f(x)dx ∫−1 = c1 f(x1 ) + c2 f(x2 ) -1x1 x2 1 Finding quadrature nodes and weights • One way is through the theory of orthogonal polynomials. • Here we will do it via brute force • Set up equations by requiring that the 2m points guarantee that a polynomial of degree 2m-1 is integrated exactly. • In general process is non-linear – (involves a polynomial function involving the unknown point and its product with unknown weight) – Can be solved by using a multidimensional nonlinear solver – Alternatively can sometimes be done step
    [Show full text]
  • Numerical Integration
    Numerical Integration MAT 2310 Computational Mathematics Wm C Bauldry November, 2011 ICM 1 Contents 1. Numerical Integration 5. Gaussian Quadrature 2. Left- and Right Endpoint, 6. Gauss-Kronrod Quadrature and Midpoint Sums 7. Test Integrals 3. Trapezoid Sums 8. Exercises 4. Simpson’s Rule 9. Links and Others Today ICM 2 Numerical Integration What is Numerical Integration? Numerical integration or (numerical) 2.5 quadrature is the calculation of a definite 2 1.5 integral using numerical formulas, not the 1 fundamental theorem. The Greeks stud- 0.5 ied quadrature: given a figure, construct a -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 -0.5 square that has the same area. The two -1 most famous are Hippocrates of Chios’ Quadrature of the Lune (c. 450 BC) and Archimedes’ Quadrature of the Parabola (c. 250 BC). Archimedes used the method of exhaustion — a precursor of calculus — invented by Eudoxus. Squaring the circle is one of the classical problems of constructing a square with the area of a given circle – it was shown impossible by Lindemann’s theorem (1882). ICM 3 Methods of Elementary Calculus Rectangle Methods Left endpoint sum Midpoint sum Right endpoint sum n n n X X X An ≈ f(xk−1) ∆xk An ≈ f(mk) ∆xk An ≈ f(xk) ∆xk k=1 k=1 k=1 1 mk = 2 (xk−1 + xk) (b−a)2 1 (b−a)3 1 (b−a)2 1 "n ≤ · M1 · "n ≤ · M2 · "n ≤ · M1 · 2 n 24 n2 2 n where M = max f (i)(x) R πf dx = 2 ≈ [1:984; 2:008; 1:984] i 0 n=10 ICM 4 Trapezoid Sums Trapezoid Sums Instead of the degree 0 rectangle approximations to the function, use a linear degree 1 approximation.
    [Show full text]