Advanced Computational Fluid Dynamics AA215A Lecture 3 Polynomial Interpolation: Numerical Differentiation and Integration.

Similar documents
NUMERICAL INTEGRATION. The inverse process to differentiation in calculus is integration. Mathematically, integration is represented by.

CMDA 4604: Intermediate Topics in Mathematical Modeling Lecture 19: Interpolation and Quadrature

Lecture 14: Quadrature

Construction of Gauss Quadrature Rules

Orthogonal Polynomials

Numerical Integration

1 The Lagrange interpolation formula

Lecture 6: Singular Integrals, Open Quadrature rules, and Gauss Quadrature

1. Gauss-Jacobi quadrature and Legendre polynomials. p(t)w(t)dt, p {p(x 0 ),...p(x n )} p(t)w(t)dt = w k p(x k ),

Theoretical foundations of Gaussian quadrature

Best Approximation. Chapter The General Case

Numerical quadrature based on interpolating functions: A MATLAB implementation

Lecture 17. Integration: Gauss Quadrature. David Semeraro. University of Illinois at Urbana-Champaign. March 20, 2014

Chapter 3 Polynomials

Numerical Analysis: Trapezoidal and Simpson s Rule

Lecture Note 4: Numerical differentiation and integration. Xiaoqun Zhang Shanghai Jiao Tong University

Review of Calculus, cont d

Numerical Analysis. Doron Levy. Department of Mathematics Stanford University

Numerical Analysis. 10th ed. R L Burden, J D Faires, and A M Burden

Lecture 19: Continuous Least Squares Approximation

III. Lecture on Numerical Integration. File faclib/dattab/lecture-notes/numerical-inter03.tex /by EC, 3/14/2008 at 15:11, version 9

Math 1B, lecture 4: Error bounds for numerical methods

Lecture 20: Numerical Integration III

COT4501 Spring Homework VII

Best Approximation in the 2-norm

Interpolation. Gaussian Quadrature. September 25, 2011

Numerical Methods I Orthogonal Polynomials

Numerical Integration

3.4 Numerical integration

The Regulated and Riemann Integrals

COSC 3361 Numerical Analysis I Numerical Integration and Differentiation (III) - Gauss Quadrature and Adaptive Quadrature

Euler, Ioachimescu and the trapezium rule. G.J.O. Jameson (Math. Gazette 96 (2012), )

Numerical integration

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

p(x) = 3x 3 + x n 3 k=0 so the right hand side of the equality we have to show is obtained for r = b 0, s = b 1 and 2n 3 b k x k, q 2n 3 (x) =

Numerical Integration. Newton Cotes Formulas. Quadrature. Newton Cotes Formulas. To approximate the integral b

NUMERICAL INTEGRATION

Lecture 12: Numerical Quadrature

Lecture 4: Piecewise Cubic Interpolation

Physics 116C Solution of inhomogeneous ordinary differential equations using Green s functions

Matrices, Moments and Quadrature, cont d

Arithmetic Mean Derivative Based Midpoint Rule

Lecture 14 Numerical integration: advanced topics

Orthogonal Polynomials and Least-Squares Approximations to Functions

1 The Riemann Integral

Abstract inner product spaces

B.Sc. in Mathematics (Ordinary)

Introduction to Numerical Analysis

Definite integral. Mathematics FRDIS MENDELU

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

Discrete Least-squares Approximations

Definite integral. Mathematics FRDIS MENDELU. Simona Fišnarová (Mendel University) Definite integral MENDELU 1 / 30

Lecture 1. Functional series. Pointwise and uniform convergence.

Modern Methods for high-dimensional quadrature

Z b. f(x)dx. Yet in the above two cases we know what f(x) is. Sometimes, engineers want to calculate an area by computing I, but...

THE HANKEL MATRIX METHOD FOR GAUSSIAN QUADRATURE IN 1 AND 2 DIMENSIONS

Review of Gaussian Quadrature method

63. Representation of functions as power series Consider a power series. ( 1) n x 2n for all 1 < x < 1

Sections 5.2: The Definite Integral

Numerical Integration. 1 Introduction. 2 Midpoint Rule, Trapezoid Rule, Simpson Rule. AMSC/CMSC 460/466 T. von Petersdorff 1

Math 554 Integration

The Riemann Integral

Lecture Notes: Orthogonal Polynomials, Gaussian Quadrature, and Integral Equations

New Expansion and Infinite Series

P 3 (x) = f(0) + f (0)x + f (0) 2. x 2 + f (0) . In the problem set, you are asked to show, in general, the n th order term is a n = f (n) (0)

Sturm-Liouville Eigenvalue problem: Let p(x) > 0, q(x) 0, r(x) 0 in I = (a, b). Here we assume b > a. Let X C 2 1

Trapezoidal Rule, n = 1, x 0 = a, x 1 = b, h = b a. f (x)dx = h 2 (f (x 0) + f (x 1 )) h3

c n φ n (x), 0 < x < L, (1) n=1

Part IB Numerical Analysis

Calculus II: Integrations and Series

Math& 152 Section Integration by Parts

AN INTEGRAL INEQUALITY FOR CONVEX FUNCTIONS AND APPLICATIONS IN NUMERICAL INTEGRATION

Numerical Analysis. Chassidy Bozeman. May 30, 2016

1.9 C 2 inner variations

Undergraduate Research

7. Numerical evaluation of definite integrals

Definite Integrals. The area under a curve can be approximated by adding up the areas of rectangles = 1 1 +

MA 124 January 18, Derivatives are. Integrals are.

LECTURE 19. Numerical Integration. Z b. is generally thought of as representing the area under the graph of fèxè between the points x = a and

Solutions to Assignment #8

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER /2019

Math 360: A primitive integral and elementary functions

ODE: Existence and Uniqueness of a Solution

Exam 2, Mathematics 4701, Section ETY6 6:05 pm 7:40 pm, March 31, 2016, IH-1105 Instructor: Attila Máté 1

Problem Set 3 Solutions

DEFINITION The inner product of two functions f 1 and f 2 on an interval [a, b] is the number. ( f 1, f 2 ) b DEFINITION 11.1.

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

Introduction to Numerical Analysis. Hector D. Ceniceros

Quadratic Forms. Quadratic Forms

SOLUTIONS FOR ANALYSIS QUALIFYING EXAM, FALL (1 + µ(f n )) f(x) =. But we don t need the exact bound.) Set

1 Error Analysis of Simple Rules for Numerical Integration

Section 7.1 Integration by Substitution

Section 4.8. D v(t j 1 ) t. (4.8.1) j=1

W. We shall do so one by one, starting with I 1, and we shall do it greedily, trying

CAAM 453 NUMERICAL ANALYSIS I Examination There are four questions, plus a bonus. Do not look at them until you begin the exam.

Numerical Integration

APPROXIMATE INTEGRATION

MAT 772: Numerical Analysis. James V. Lambers

1.2. Linear Variable Coefficient Equations. y + b "! = a y + b " Remark: The case b = 0 and a non-constant can be solved with the same idea as above.

1 Ordinary Differential Equations

Transcription:

Advnced Computtionl Fluid Dynmics AA215A Lecture 3 Polynomil Interpoltion: Numericl Differentition nd Integrtion Antony Jmeson Winter Qurter, 2016, Stnford, CA Lst revised on Jnury 7, 2016

Contents 3 Polynomil Interpoltion: Numericl Differentition nd Integrtion 2 3.1 Interpoltion Polynomils................................. 2 3.2 Error in the Interpolting Polynomil.......................... 3 3.3 Error of Derivtive with Lgrnge Interpoltion..................... 3 3.4 Error of the k th Derivtive of the Interpoltion Polynomil.............. 4 3.5 Interpoltion with Tringle of Polynomils....................... 5 3.6 Newton s Form of the Interpoltion Polynomil..................... 6 3.7 Hermite Interpoltion................................... 8 3.8 Integrtion Formuls using Polynomil Interpoltion.................. 10 3.9 Integrtion with weight function............................ 10 3.10 Newton Cotes formuls.................................. 10 3.11 Guss Qudrture..................................... 11 3.12 Formuls for Guss integrtion with constnt weight function............. 13 3.13 Error bound for Guss integrtion............................ 13 3.14 Discrete orthogonlity of orthogonl polynomils.................... 14 3.15 Equivlence of interpoltion nd lest squres pproximtion using Guss integrtion 14 3.16 Guss Lobto Integrtion................................. 15 3.17 Portrits of Lgrnge, Newton nd Guss........................ 16 1

Lecture 3 Polynomil Interpoltion: Numericl Differentition nd Integrtion 3.1 Interpoltion Polynomils So fr we hve not required P n (x) to equl f(x) t ny points in the intervl. This permits some smoothing! A nturl pproch is to mke P n (x) = 0 + 1 x +... + n x n = f(x) t n + 1 points x 0, x 1,..., x n. Then we hve n + 1 equtions for the n + 1 coefficients. Such polynomil is clled n interpoltion polynomil. A solution exists becuse the determinnt of the equtions is the Vndemonde determinnt 1 x 0... x n 0 1 x 1... x n 1 D =..... =. i x j ) 0 (3.1) i>j(x 1 x n... x n n This cn be seen by noting tht D vnishes if ny x i equls ny x j, but D is polynomil of just the sme order s the product. The interpoltion polynomil is unique since if there were 2 such polynomils P n (x), Q n (x), then P n (x i ) Q n (x i ) = 0 for i = 0, 1,..., n (3.2) But then P n (x) Q n (x) is n n th degree polynomil with n + 1 roots, so it must be zero. In prctice it is esiest to construct P n (x) indirectly s sum of specilly chosen polynomils rther thn solve for the j. To do this note tht φ n,j (x) = (x x 0)(x x 1 )...(x x j 1 )(x x j+1 )...(x x n ) (x j x 0 )(x j x 1 )...(x j x j 1 )(x j x j+1 )...(x j x n ) = 1 when x = x j (3.3) Then we cn get P n (x) = f(x j )φ n,j (x) (3.4) which equls f(x) t x = x 0, x 1,..., x n, nd is the only such polynomil s hs just been shown. The φ n,j (x) re clled Lgrnge interpoltion coefficients. We cn write φ n,j (x) = w n (x) (x x j )w n(x j ) (3.5) 2

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 3 w n (x) = (x x 0 )(x x 1 )...(x x n ) (3.6) 3.2 Error in the Interpolting Polynomil We shll show tht if f(x) hs n (n + 1) th derivtive nd P n (x) is n interpolting polynomil then the reminder is f(x) P n (x) = (x x 0)(x x 1 )...(x x n ) f (n+1) (ξ) (3.7) (n + 1)! ξ is in the intervl defined by x 0, x 1,..., x n. Let S n (x) be defined by f(x) P n (x) = w n (x)s n (x) (3.8) Define w n (x) = (x x 0 )(x x 1 )...(x x n ) (3.9) F (z) = f(z) P n (z) w n (z)s n (x) (3.10) This is continuous in z nd vnishes t n + 2 points x 0, x 1,..., x n, x. Thus by Rolle s theorem F (z) vnishes t n + 1 points, F (z) vnishes t n points,..., nd finlly F (n+1) (z) vnishes t one point ξ. But d n+1 dz n+1 P n(z) = 0 (3.11) Thus nd setting z = ξ d n+1 dz n+1 w n(z)s n (x) = (n + 1)!S n (x) (3.12) F (n+1) (z) = f n+1 (z) (n + 1)!S n (x) (3.13) S n (x) = f(x) P n (x) = 1 (n + 1)! f (n+1) (ξ) (3.14) w n(x) (n + 1)! f (n+1) (ξ) (3.15) Since the error depends on w n (x) we nturlly sk how the x i should be distributed to minimize w n (x). 3.3 Error of Derivtive with Lgrnge Interpoltion Suppose tht Then f (x) = P n(x) + f(x) = P n (x) + w n (n + 1)! f (n+1) (ξ) (3.16) w n (n + 1)! f (n+1) (ξ) + w n (n + 1)! f (n+2) (ξ) dξ dx (3.17)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 4 n w n = (x x k ) (3.18) Then t n interpoltion point, f (x j ) = P n(x j ) + k j n (x j x k ) f (n+1) (ξ) (3.19) (n + 1)! k j with equl intervls h since With one intervl, f (x 0 ) = P (x 0 ) + hn n + 1 f (n+1) (ξ) (3.20) (x 1 x 0 )(x 2 x 0 )...(x n x 0 ) = n!h n (3.21) f (x 0 ) = f(x 1) f(x 0 ) h + h 2 f (ξ) (3.22) 3.4 Error of the k th Derivtive of the Interpoltion Polynomil Let f n+1 (x) be continuous nd let Then R n (x) = f(x) P n (x) (3.23) n k R n (k) (x) = (x ξ j ) f (n+1) (ξ) (n + 1 k)! (3.24) the distinct points ξ j re independent of x nd lie in the intervls x j < ξ j < x j+k for j = 0, 1,..., n k nd ξ(x) is some point in the intervl contining x nd the ξ j. Proof: R n = f P n hs n+1 continuous derivtives nd vnishes t n+1 points x = x j, for j = 0, 1,..., n. Apply Rolle s theorem k n times. The zeros re then distributed s illustrted.

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 5 This leds to the following tble for the distribution of the n k + 1 zeros ξ j of R (k) n. Define R R (1) R (2) R (k) x 0 x 1 (x 0, x 1 ) x 2 (x 1, x 2 ) (x 0, x 2 ). x k (x k 1, x k ) (x k 2, x k ) (x 0, x k ). x n (x n 1, x n ) (x n 2, x n ) (x n k, x n ) For ny x distinct from the ξ j choose α such tht n k F (z) = R n (k) (z) α (z ξ j ) (3.25) F (x) = 0 (3.26) Then F (z) hs n k + 2 zeros nd by Rolle s theorem F (n k+1) (z) hs one zero, η, sy, in the intervl contining x nd the ξ j. Thus 0 = F (n k+1) (η) (3.27) = Rn n+1 (η) α(n k + 1)! (3.28) = f n+1 (η) α(n k + 1)! (3.29) or α = It follows tht for mesh width bounded by h f n+1 (η) (n k + 1)! (3.30) M is proportionl to sup f n+1 (x) in the intervl. R (k) n Mh n k+1 (3.31) 3.5 Interpoltion with Tringle of Polynomils Set w 0 (x) = (x x 0 ) w 1 (x) = (x x 0 )(x x 1 ) w k (x) = (x x 0 )(x x 1 )...(x x k ) Now to interpolte f(x) with vlues f i t x i we set p(x) = 0 + 1 (x x 0 ) + 2 (x x 0 )(x x 1 )... (3.32)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 6 Then p 0 (x 0 ) = f 0 = 0 p 1 (x 1 ) = f 1 = 0 + 1 (x 1 x 0 ) so we cn solve for the i in succession p 2 (x 2 ) = f 2 = 0 + 1 (x 2 x 0 ) + 2 (x 2 x 0 )(x 2 x 1 ). k = f k 0 1 (x k x 0 )... k 1 (x k x 0 )...(x k x k 2 ) (x k x 0 )(x k x 1 )...(x k x k 1 ) = f k p k 1 (x k ) w k 1 (x k ) (3.33) 3.6 Newton s Form of the Interpoltion Polynomil The Lgrngin form of the interpoltion polynomil hs the disdvntge tht the coefficients hve to be recomputed if new interpoltion point is dded. To void this let P n (x) = k w k 1 (x) (3.34) k=0 w k (x) = (x x 0 )(x x 1 )...(x x k ) nd w 1 (x) = 1 (3.35) We cn determine the k so tht Suppose this hs been done for P k 1, nd we now dd x k. Then P n (x j ) = f(x j ) for j = 0, 1,..., n (3.36) P k (x) = P k 1 (x) + k w k 1 (x) (3.37) P k (x j ) = P k 1 (x j ) = f(x j ) for j = 0, 1,..., k 1 (3.38) P k (x k ) = P k 1 (x k ) + k w k 1 (x k ) = f(x k ) (3.39) k = f(x k) P k 1 (x k ) w k 1 (x k ). On the other hnd the coefficient of the highest order term in the Lgrnge expression is so by comprison n = f(x j ) w n(x j ) f(x j ) w n(x j ) Thus n is liner combintion of f(x j ) for j = 0, 1,..., n. Multiply by (3.40) (3.41) x n x 0 = x n x j + x j x 0 (3.42)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 7 Then n (x n x 0 ) = = f(x j ) w n(x j ) (x j x n ) + f(x j ) k j (x j x k ) + j=1 j=1 f(x j ) w n(x j ) (x j x 0 ) f(x j ) k j (x j x k ) (3.43) These re just the expressions for n 1 in the intervls x 0 to x n 1 nd x 1 to x n. Thus if we define f[x 0,..., x n ] = n = f(x j ) k j (x j x k ) (3.44) we find tht nd strting from we hve f[x 0,..., x n ](x 0 x n ) = f[x 1,..., x n ] f[x 0,..., x n 1 ] (3.45) giving Newton s form of the interpoltion polynomil f[x 0 ] = f(x 0 ) (3.46) f[x 0, x 1 ] = f[x 1] f[x 0 ] x 1 x 0 (3.47) f[x 0, x 1, x 2 ] = f[x 1, x 2 ] f[x 0, x 1 ] x 2 x 0 (3.48) P n (x) = f[x 0 ] + (x x 0 )f[x 0, x 1 ] +... + (x x 0 )...(x x n 1 )f[x 0,..., x n ] (3.49) The squre brcketed expressions re Newton s divided differences, nd we now hve Newton s form for the interpoltion polynomil: P n (x) = f[x 0 ] + (x x 0 )f[x 0, x 1 ] +... + (x x 0 )...(x x n 1 )f[x 0,..., x n ] (3.50) ech new term is independent of the previous terms. To estimte the mgnitude of the higher divided differences we cn use the result lredy obtined for the reminder. Theorem: Let x 0, x 1,..., x k 1 be distinct points nd let f be continuous in intervl contining ll these points. Then for some point ξ in this intervl Proof: From Newton s formul f[x 0,..., x k 1, x] = f (k) (ξ) k! (3.51) f(x) P k 1 (x) = (x x 0 )...(x x k 1 )f[x 0,..., x k 1, x] = (x x 0 )...(x x k 1 ) f (k) (ξ) k! (3.52) by the reminder theorem. But x is distinct from x 0, x 1,..., x k 1 so the theorem follows on dividing out the fctors.

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 8 3.7 Hermite Interpoltion We cn generlize interpoltion by mtching derivtives s well s vlues t the interpoltion points. Such polynomil is clled the osculting polynomil nd the procedure is clled Hermite interpoltion. Let H 2n+1 (x) be polynomil of degree 2n + 1 such tht H 2n+1 (x) = f(x j ) for j = 0, 1,..., n (3.53) H 2n+1(x) = f (x j ) for j = 0, 1,..., n (3.54) The 2n + 2 coefficients re needed to stisfy 2n + 2 conditions. H 2n+1 (x) cn be found indirectly s in Lgrnge interpoltion. Let ψ n,j (x) nd γ n,j (x) be polynomils of degree 2n + 1 such tht ψ n,j (x i ) = δ ij, ψ n,j(x i ) = 0, Then the Hermite interpoltion polynomil is for i = 0, 1,..., n γ n,j (x i ) = 0, γ n,j(x i ) = δ ij, for i = 0, 1,..., n H 2n+1 (x) = ( f(xj )ψ n,j (x) + f (x j )γ n,j (x) ) (3.55) It cn be directly verified by differentition tht the required polynomils re nd φ n,j (x) re the Lgrnge polynomils stisfying The error in Hermite interpoltion is ψ n,j (x) = (1 2φ n,j(x)(x x j ))φ 2 n,j(x) (3.56) γ n,j (x) = (x x j )φ 2 n,j(x) (3.57) φ n,j (x i ) = δ ij for i = 0, 1,..., n (3.58) f(x) H 2n+1 (x) = ω 2 n(x) f 2n+2 (ξ) (2n + 2)! (3.59) ω n (x) = (x x 0 )(x x 1 )...(x x n ) (3.60) This cn be proved in the sme wy s the error estimte for Lgrnge interpoltion now F (ξ) = f(ξ) H 2n+1 (ξ) ω 2 n(ξ)s n (x) (3.61) nd on the first ppliction of Rolle s theorem F (ξ) hs 2n + 2 distinct zeros. The Hermite polynomil cn be obtined vi pssge to the limit from the Lgrnge polynomil P 2n+1 (x) which interpoltes f(x) t the 2n + 2 points x 0, x 0 + h, x 1, x 1 + h,..., x n, x n + h (3.62)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 9 s h 0 to produce n + 1 pirs of coincident points. Define N(h) = (x x k + h) (3.63) nd D(h) = k=1,n, k=1,n, Then the contribution of the points x j nd x j + h to P 2n+1 (x) is Expnding f(x j + h) in Tylor series k j k j Q(x) = f(x j ) N(0) N( h) x (x j + h) D(0) D( h) x j (x j + h) + f(x j + h) N(0) D(h) (x j x k + h) (3.64) N( h) x x j D(0) h Q(x) = f(x j ) N(0) N( h) x (x j + h) D(0) D( h) x j (x j + h) + ( f(x j ) + hf (x j ) + O(h 2 ) ) N(0) N( h) x x j D(h) D(0) h = f(x j ) N(0) [ N( h) D(0) D( h) x x ( j 1 N( h) h D( h) 1 )] D(h) + f (x j )(x x j ) N(0) N( h) D(0) D(h) + O(h) Also Thus in the limit s h 0 1 D( h) 1 D(h) = 2h D (0) D 2 (0) + O(h2 ) (3.65) Q(x) = f(x j ) N 2 ( ) (0) D 2 1 2(x x j ) D (0) (0) D(0) + f (x j )(x x j ) N 2 (0) D 2 (0) nd D (0) equls d dx N(0) evluted t x j, so tht N(0) D(0) = φ n,j(x) (3.66) D (0) D(0) = φ n,j(x j ) (3.67)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 10 3.8 Integrtion Formuls using Polynomil Interpoltion Let P n 1 (x) interpolte f(x) t x 0, x 1,..., x n. Then P n (x) = f(x j )φ n,j (x) (3.68) so tht φ n,j (x) = k j (x x k) k j (x j x k ) (3.69) φ n,j (x k ) = δ jk (3.70) Now pproximte f(x)dx by P n(x)dx typiclly = x 0, b = x n. Then E(f) denotes the error, nd f(x)dx = A j = A j f(x j ) + E(f) (3.71) φ n,j (x)dx (3.72) The result is exct if f(x) is polynomil of degree n, since then P n (x) = f(x). This is clled precision of degree n. 3.9 Integrtion with weight function We my include weight function w(x) 0 in the integrl. Then now f(x)w(x)dx = A j = A j f(x j ) + E(f) (3.73) j=n φ n,j (x)w(x)dx (3.74) Depending on w(x), nlyticl expressions re not necessrily vilble for evluting the coefficients A j. 3.10 Newton Cotes formuls These re derived by pproximting f(x) by n interpoltion formul using n + 1 eqully spced points in [, b] including the end points. The first 3 such formuls re: Trpezoidl rule f(x)dx = h (f() + f(b)) + E(f), h = b (3.75) 2

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 11 Simpson s rule f(x)dx = h 3 f() + 4h 3 f( + h) + h b f(b) + E(f), h = 3 2 (3.76) nd Simpson s 3 8 formul f(x)dx = 3h 8 f() + 9h 8 f( + h) + 9h 8 f( + 2h) + 3h 8 3.11 Guss Qudrture f(b) + E(f), h = b 3 (3.77) When the interpoltion points x re fixed the integrtion formul hs n + 1 degrees of freedom corresponding to the coefficients A j for j = 0,..., n. Accordingly we cn find vlues of A j which yield exct vlues of the integrl of ll polynomils of degree n, P n (x) = 0 + 1 x +... + n x n, (3.78) since these lso hve n + 1 degrees of freedom corresponding to the coefficients j for j = 0,..., n. If we re lso free to choose the integrtion points x j, then we hve 2n + 2 degrees of freedom corresponding to x j nd A j, for j = 0,..., n. Now it is possible to find vlues of x j nd A j which enble exct integrtion of polynomils of degree 2n + 1. One could try to find the required vlues by solving 2n + 2 nonliner equtions A j f(x j ) = f(x)dx (3.79) f(x) = 1, x,..., x 2n+1 in turn. However the required vlues cn be found indirectly s follows. Let φ i (x) be orthogonl polynomils for the weight function w(x), so tht φ j (x)φ k (x)w(x) = 0 for j k (3.80) Choose x j s the zeros of φ n+1 (x). Then integrtion using polynomil interpoltion is exct for polynomils up to degree 2n + 1. Proof: If f(x) is polynomil of degree 2n + 1 it cn be uniquely expressed s q(x) nd R(x) re polynomils of degree n. Then f(x)w(x)dx = f(x) = q(x)φ n+1 (x) + R(x) (3.81) q(x)φ n+1 (x)w(x)dx + R(x)w(x)dx = since φ n+1 (x) is orthogonl to ll polynomils of degree < n + 1. R(x)w(x)dx (3.82)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 12 Also the pproximte integrl is I = = = A j f(x j ) A j q(x j )φ n+1 (x j ) + A j R(x j ) A j R(x j ) (3.83) since φ n+1 (x j ) is zero for j = 0, 1,..., n. But then I = R(x)w(x)dx (3.84) exctly, since R(x) is polynomil of degree n. The degree of precision 2n + 1 is the mximum ttinble. Consider the polynomil of φ 2 n+1 (x) of degree 2n + 2. Then I = 0 (3.85) since φ n+1 (x j ) = 0 for j = 0, 1,..., n. But φ 2 n+1(x)w(x)dx > 0 (3.86) becuse φ 2 n+1 (x) > 0 except t the zeros x 0, x 1,..., x n. When pplied to n rbitrry smooth function f(x) which cn be expnded s f() + (x )f () +... + (x )2n+2 f (2n+2) (ξ) (3.87) (2n + 2)! the error is proportionl to bound on f (2n+2) (x) becuse the preceding terms in the Tylor series re integrted exctly.

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 13 3.12 Formuls for Guss integrtion with constnt weight function Number of Points x j A j Precision Order 1 0 2 1 2 2 ± 1 3 1 3 4 3 4 5 ± ± 8 0 ± 15 5 r 5 9 q 3 2 6 5 r 7 q 3+2 6 5 18 30 7 36 128 0 225 ± 5 2 ± 5 + 2 10 7 10 7 9 5 6 18+ 30 36 7 8 322+13 70 900 322 13 70 900 9 10 Tble 3.1: Formuls for Guss integrtion with constnt weight function 3.13 Error bound for Guss integrtion Let H 2n+1 (x) be the Hermite interpoltion polynomil to f(x) t the integrtion points. The Guss integrtion formul is exct for H 2n+1 (x). Hence Thus H 2n+1 (x)w(x)dx = f(x)w(x)dx A j f j = i=0 A j Q(x j ) = According to the error formul for Hermite interpoltion A j f j (3.88) f(x) H 2n+1 (x) = P 2 n(x) f (2n+2)(ξ) (f(x) H 2n+1 (x))w(x)dx (3.89) (2n + 2)! (3.90) P n (x) = (x x 0 )(x x 1 )...(x x n ) (3.91) is the orthogonl polynomil normlized so tht its leding coefficient is unity. Then the error is 1 b E = w(x) (2n + 2)! P n(x)f 2 (2n+2) (ξ)dx (3.92) Since w(x) ˆP 2 n(x) 0 the error lies in the rnge between min f (2n+2) (ξ)a nd mx f (2n+2) (ξ)a (3.93)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 14 nd hence for some vlue of η in [, b]. A = 1 (2n + 2)! w(x) P 2 n(x)dx (3.94) E = Af (2n+2) (η) (3.95) 3.14 Discrete orthogonlity of orthogonl polynomils Let φ j (x) be orthogonl polynomils stisfying (φ j, φ k ) = φ j (x)φ k (x)w(x)dx = 0 for j k (3.96) Let x i be the zeros of φ n+1 (x). Then if j n, k n, φ j (x)φ k (x) is polynomil of degree 2n. Accordingly (φ j, φ k ) is evluted exctly by Guss integrtion. This implies tht the φ j stisfy the discrete orthogonlity condition A i φ j (x i )φ k (x i ) = 0, given j k, j n, k n (3.97) i=0 A i re the coefficients for Guss integrtion t the zeros of φ n+1. 3.15 Equivlence of interpoltion nd lest squres pproximtion using Guss integrtion Let f (x) be the lest squres fit to f(x) using orthogonl polynomils φ j (x) for the intervl [, b] with weight function w(x) 0. Then f (x) = c jφ j (x) (3.98) c j = (f, φ j) (φ j, φ j ) = f(x)φ j(x)w(x)dx φ2 j (x)w(x)dx (3.99) Let x i be the zeros of φ n+1 (x), nd let P n (x) be the interpoltion polynomil to f(x) stisfying P n (x i ) = f(x i ) for i = 0, 1,..., n (3.100) P n (x) cn be expnded s P n (x) = Then the ĉ k re determined by the conditions ĉ k φ k (x) (3.101) k=0 ĉ k φ k (x i ) = f(x i ) for i = 0, 1,..., n (3.102) k=0

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 15 Also the polynomils φ j (x) stisfy the discrete orthogonlity condition A i φ j (x i )φ k (x i ) = 0 given j k, j n, k n (3.103) i=0 A i re the coefficients for Guss integrtion. Now multiplying (3.102) by A i φ j (x i ) nd summing over i, it follows tht ĉ j = n i=0 A if(x i )φ j (x i ) n i=0 A iφ 2 j (x i) (3.104) This is exctly the formul (3.99) for evluting the lest squres coefficient c j by Guss integrtion. Alterntive Proof: The coefficients ĉ j re ctully the lest squres coefficients which minimize in the discrete semi-norm in which J = f f(x) c j φ j 2 (3.105) c j φ j (x) is evluted by Guss integrtion t the zeros x i of φ n+1 (x) s J = i=0 A i f(x i ) 2 c j φ j (x i ) w(x)dx (3.106) 2 w(x 0 ) (3.107) But s consequence of the interpoltion condition (3.99) the coefficients ĉ j yield the vlue J = 0, thus minimizing J. 3.16 Guss Lobto Integrtion To integrte f(x) over [-1,1] choose integrtion points t 1, 1, nd the zeros of Q n 1, which re the zeros of (1 + x)(1 x)φ n 1 (x) (3.108) Then let f(x) = q(x)(1 x 2 )φ n 1 (x) + r(x) (3.109) if f(x) is polynomil of degree 2n 1, q(x) nd r(x) re polynomil of degree n 2. Now let the polynomils φ j be orthogonl for the weight function w(x) = 1 x 2 (3.110) Then I = 1 1 f(x)dx = 1 1 1 1 q(x)φ n 1 (x)w(x)dx + r(x)dx = r(x)dx (3.111) 1 1

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 16 since φ n 1 is orthogonl to ll polynomils of lower degree. Also the pproximte integrl is Then Î = Î = A j = A j f(x j ) (3.112) 1 1 A j q(x j )(1 x 2 j)φ n 1 (x j ) + since (1 x 2 j )φ n 1(x j ) = 0 for j = 0, 1,..., n. But then φ n,j (x)dx (3.113) A j r(x j ) = A j r(x j ) (3.114) Î = I (3.115) since r(x) is polynomil of degree < n. Here φ j re the Jcobi polynomils P (1,1) j, P (α,β) j is orthogonl for the weight (1 x) α (1 + x) β (3.116) 3.17 Portrits of Lgrnge, Newton nd Guss Figure 3.1: Joseph-Louis Lgrnge (1736-1813)

LECTURE 3. NUMERICAL DIFFERENTIATION AND INTEGRATION 17 Figure 3.2: Sir Isc Newton (1642-1726) Figure 3.3: Crl Friedrich Guss (1777-1855)