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

Similar documents
Chapter 2. Numerical Integration also called quadrature. 2.2 Trapezoidal Rule. 2.1 A basic principle Extending the Trapezoidal Rule DRAWINGS

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

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

Numerical Integration

Lecture 14: Quadrature

NUMERICAL INTEGRATION

Key words. Numerical quadrature, piecewise polynomial, convergence rate, trapezoidal rule, midpoint rule, Simpson s rule, spectral accuracy.

Review of Calculus, cont d

Numerical Analysis: Trapezoidal and Simpson s Rule

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

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

Lecture 12: Numerical Quadrature

Math Week 5 concepts and homework, due Friday February 10

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

Derivatives, Finding Roots, Interpolating and Integration

1 The Riemann Integral

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

Numerical integration. Quentin Louveaux (ULiège - Institut Montefiore) Numerical analysis / 10

Lecture 20: Numerical Integration III

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

Topic 6b Finite Difference Approximations

The Riemann Integral

Orthogonal Polynomials and Least-Squares Approximations to Functions

Math& 152 Section Integration by Parts

Discrete Least-squares Approximations

Lecture 14 Numerical integration: advanced topics

COT4501 Spring Homework VII

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 ),

Integration Techniques

Numerical Integration Problems

University of Houston, Department of Mathematics Numerical Analysis II

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

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

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

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

1 The Lagrange interpolation formula

Numerical quadrature based on interpolating functions: A MATLAB implementation

1 Error Analysis of Simple Rules for Numerical Integration

3.4 Numerical integration

Lecture 19: Continuous Least Squares Approximation

Numerical Integration

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

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

The Regulated and Riemann Integrals

Best Approximation. Chapter The General Case

Construction of Gauss Quadrature Rules

AN INTEGRAL INEQUALITY FOR CONVEX FUNCTIONS AND APPLICATIONS IN NUMERICAL INTEGRATION

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...

RGMIA Research Report Collection, Vol. 1, No. 1, SOME OSTROWSKI TYPE INEQUALITIES FOR N-TIME DIFFERENTIA

Sections 5.2: The Definite Integral

A REVIEW OF CALCULUS CONCEPTS FOR JDEP 384H. Thomas Shores Department of Mathematics University of Nebraska Spring 2007

Definite integral. Mathematics FRDIS MENDELU

Orthogonal Polynomials

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

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

Numerical Analysis. Doron Levy. Department of Mathematics Stanford University

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

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

Theoretical foundations of Gaussian quadrature

Math 554 Integration

Chapter 3 Solving Nonlinear Equations

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

DOING PHYSICS WITH MATLAB MATHEMATICAL ROUTINES

B.Sc. in Mathematics (Ordinary)

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

Chapter 3 Polynomials

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

Numerical integration

Arithmetic Mean Derivative Based Midpoint Rule

Calculus I-II Review Sheet

Convex Sets and Functions

APPROXIMATE INTEGRATION

Lecture 23: Interpolatory Quadrature

8 Laplace s Method and Local Limit Theorems

6.5 Numerical Approximations of Definite Integrals

Chapter 5. Numerical Integration

INTRODUCTION TO INTEGRATION

Chapter 7 Notes, Stewart 8e. 7.1 Integration by Parts Trigonometric Integrals Evaluating sin m x cos n (x) dx...

Numerical Methods I Orthogonal Polynomials

Midpoint Approximation

Lecture 4: Piecewise Cubic Interpolation

5.1 Evaluating a polynomial

f(x)dx . Show that there 1, 0 < x 1 does not exist a differentiable function g : [ 1, 1] R such that g (x) = f(x) for all

Introduction to Numerical Analysis

Numerical Integration - (4.3)

Solutions to Assignment #8

The Fundamental Theorem of Calculus. The Total Change Theorem and the Area Under a Curve.

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

12 Basic Integration in R

Chapters 4 & 5 Integrals & Applications

2

Calculus II: Integrations and Series

Lecture 1. Functional series. Pointwise and uniform convergence.

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) =

MAT 772: Numerical Analysis. James V. Lambers

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

Abstract inner product spaces

QUADRATURE is an old-fashioned word that refers to

Introduction to Numerical Analysis. Hector D. Ceniceros

Chapter 1. Basic Concepts

Transcription:

Lecture Note 4: Numericl differentition nd integrtion Xioqun Zng Sngi Jio Tong University Lst updted: November, 0

Numericl Anlysis. Numericl differentition.. Introduction Find n pproximtion of f (x 0 ), f (x 0 ),..., in terms of only f(x). Since we use Used in Secnt metod. > 0, forwrd difference formul < 0, bckwrd difference formul Use grp to illustrte tis. Not successful due to round-off error. Quntittive study of te error: f f(x 0 + ) f(x 0 ) (x 0 ) = lim, 0 f (x 0 ) f(x 0 + ) f(x 0 ) Assume tt x 0 (, b). Suppose tt f C [, b]. x = x 0 + [, b]. Use Tylor s expnsion. So f(x 0 + ) = f(x 0 ) + f (x 0 ) + f (ξ). f (x 0 ) = f(x 0 + ) f(x 0 ) Te error is of O() since f (ξ) is bounded. Error: 0., is O(0.) Error: 0.00, is O(0.00). f (ξ). : To get n ccurte f (x 0 ), must be very smll. However, smll denomintor exggerte te round-off error of f(x 0 + ) f(x 0 ). (Recll loss of significnt digits.) Error is of O( α ). α is te order of te formul. Error 0.0, order : = O(0.0), order : = O(0.). Error 0.000, order : = O(0.000), order : = O(0.0). To minimize te influence of te round-off error, iger order formuls re desired. Higer order formul. Ide: Involving more points tn only x 0, x 0 +.

Numericl Anlysis Metod: using polynomil P (x) interpoltion to pproximte f(x), nd use P (x 0 ) to pproximte f (x 0 ).. Construct polynomil P n (x) tt psses troug ll te given points. (Lgrnge or Newton s divided difference). P n (x) f(x), so P n(x) f (x).. Use P n(x 0 ) s te formul to pproximte f (x). Use grp to illustrte. Polynomil interpoltion (Newton s divided difference formul) n i f(x) = f[x 0,..., x i ] (x x j ) + f (n+) n (x x j ). (n + )! j=0 Two-point formul. (f (x 0 ) f(x0+) f(x0) ) Interpolte f(x) using two points x 0, x. j=0 f(x) = f[x 0 ] + f[x 0, x ](x x 0 ) + f (ξ(x)) (x x 0 )(x x ). Tke derivtive on bot nd side. f (x) =f[x 0, x ] ( + df (ξ(x)) dx (x x 0 )(x x ) + f (ξ(x)) Replce x by x 0 nd x by x 0 +, we obtin f (x 0 ) = f[x 0, x 0 + ] f (ξ(x)). Te sme s obtined from Tylor s expnsion. Higer order formul: tree-point formul. Interpolte f(x) using tree points x 0, x nd x. f(x) =f[x 0 ] + f[x 0, x ](x x 0 ) + f[x 0, x, x ](x x 0 )(x x ) + f (ξ(x)) (x x 0 )(x x )(x x ). Tke derivtive on bot nd sides, (x x 0 ) + f ) (ξ(x)) (x x ) f (x) = f[x 0, x ] + f[x 0, x, x ](x x 0 ) + f[x 0, x, x ](x x ) ( df (ξ(x)) + (x x 0 )(x x )(x x ) dx + f (ξ(x)) ) ((x x 0 )(x x ) + (x x )(x x ) + (x x 0 )(x x ))

Numericl Anlysis Let x = x 0, x = x 0, nd x = x 0 +. We ve f (x 0 ) = f[x 0, x ] + f[x 0, x, x ] f (ξ(x)) f[x 0, x ] + f[x 0, x, x ] = f(x 0 ) f(x 0 ) Centrl difference formul Error term = f(x 0 + ) f(x 0 ) f(x 0 + ) f(x 0 ). f (ξ(x)), O( ). Let x = x 0, x = x +, x = x +. We ve f (x 0 ) = f[x 0, x ] f[x 0, x, x ] + f (ξ(x)) f[x 0, x ] + f[x 0, x, x ] = f(x 0 + ) f(x 0 ) Anoter tree-point formul Error term = f(x 0) + 4f(x 0 + ) f(x 0 + ) f(x 0 ) + 4f(x 0 + ) f(x 0 + ). f (ξ(x)), O( ). f(x 0+) f(x 0 ) f(x0 ) f(x0) + f(x 0+) f(x 0+) f(x0+) f(x0) Te error of te centrl difference formul is lf of te oter. Te reson: x nd x re closer to x 0 in its derivtion. Similrly, we ve Five-point formul. f (x 0 ) = (f(x 0 ) 8f(x 0 )+8f(x+0+) f(x 0 +))+ 4 0 f (5) (ξ) Cn construct formule involving more points. 4

Numericl Anlysis Interpoltion error: Assume > 0. Summry of formuls f(x) P n (x) = f (n+) (ξ) (n + )! (x x )(x x )... (x x n ). Two-points: x 0 nd x 0 + Forwrd difference formul. Two-points: x 0 nd x 0 Bckwrd difference formul. Tree points: x 0, x 0, x 0 + Centrl difference formul. Tree points: x 0, x 0 +, x 0 + f(x 0 + ) f(x 0 ), error = O(). f(x 0 ) f(x 0 ), error = O(). f(x 0 + ) f(x 0 ), error = O( ). f(x 0 ) + 4f(x 0 + ) f(x 0 + ), error = O( ). Five points: x 0, x 0, x 0, x 0 +, x 0 + f(x 0 ) 8f(x 0 ) + 8f(x 0 + ) f(x 0 + ), error = O( 4 )... Higer order derivtive Expnd f t x 0 nd evlute t x 0, x 0 + : f(x 0 + ) = f(x 0 ) + f (x 0 ) + f (x 0 ) + f (x 0 ) + 4 f (4) (ξ ) 4 (.) f(x 0 ) = f(x 0 ) f (x 0 ) + f (x 0 ) f (x 0 ) + 4 f (4) (ξ ) 4 were x 0 < ξ < x 0 < ξ < x 0 +. Add te two equtions, we ve f(x 0 + ) + f(x 0 ) = f(x 0 ) + f (x 0 ) + 4 [f (4) (ξ ) + f (4) (ξ )] 4 5 (.)

Numericl Anlysis We obtin f (x 0 ) = [f(x 0 ) f(x 0 ) + f(x 0 + )] f (4) (ξ) for some x 0 < ξ < x 0 +... Ricrdson s extrpoltion Use less ccurte formuls to generte ig ccurcy formul. Forwrd difference formul: f(x 0 + ) f(x 0 ) Assume tt f is smoot enoug. Expnd te terms involved in te formul by Tylor s expnsion. f(x 0 + ) = f(x 0 ) + f (x 0 ) + f (x 0 ) So te error of tis formul is f (x 0 ) = f(x 0 + ) f(x 0 ) Error is O(). + f (x 0 ) + f (x 0 ) + f (x 0 ) +... + f (n)(x0) n +... n! +... + f (n)(x0) n +... n! Ricrdson s extrpoltion: Using oter s to eliminte te term of O(). Replce by : f (x 0 ) = f(x 0) f(x 0 ) f (x 0 ) Summing togeter nd dividing by : f (x 0 ) = f(x 0 + ) f(x 0 ) Centrl difference formul. Error O( )! + f (x 0 ) + f (x 0 )...+ f (n)(x0) ( ) n +... n! + f (5) (x 0 ) 4 +... 0 To get more ccurcy formul: Replce by in te bove formul f (x 0 ) = f(x 0 + ) f(x 0 ) 4 One 4 T wo f (x 0 ) = (f(x 0 + ) f(x 0 )) Error O( 4 ) + 4f (x 0 ) + f (5) (x 0 ) 4 +... 0 f(x 0 + ) f(x 0 ) 4 f (x 0 ) = f(x 0 ) 8f(x 0 ) + 8f(x 0 + ) f(x 0 + ) + f (5) (x 0 ) 4 +... 0 + f (5) (x 0 ) 4 +... 0

Numericl Anlysis. Numericl integrtion.. Elements of Numericl integrtion Te need often rises for evluting te definite integrl of function tt s no explicit ntiderivtive or wose ntiderivtive is not esy to obtin. We wnt to compute f(x)dx using only f(x), i.e. Clled numericl qudrture. f(x) n i f(x i ) Bsic ide: use piecewise polynomil to pproximte f(x). For ec subintervl, select set of distinct nodes x0,, x n from te intervl [, b]. Ten integrte te interpolting polynomil P n (x) = n f(x i)l i (x) nd its trunction error term over [, b] to obtin f(x) = = i P n (x) + (n + )! i f(x i ) + (n + )!,b,b Π n (x x i )f (n+) (ξ(x))dx Π n (x x i )f (n+) (ξ(x))dx were i (x) = L i(x) for ec i = 0,, n nd ξ(x) [, b]. Numericl qudrture: nd error Trpezoidl rule E n (f) = (n + )! f(x) n i f(x i ) Π n (x x i )f (n+) (ξ(x))dx Use liner polynomil nd pproximte f(x) by trpezoid re. Wen f is positive vlue function, te integrl is given by te trpezoid re (f(x 0 ) + f(x ))/. Used piecewise liner function to pproximte f(x) using x 0 =, x = b, = b. P n (x) = f(x 0 ) x x + f(x ) x x 0 x 0 x x x 0 7

Numericl Anlysis x x 0 (f(x 0 ) x x x 0 x + f(x ) x x 0 x x 0 dx = f(x 0) x 0 x (x x ) x x=x 0 + f(x ) x x 0 (x x 0) x x=x 0 = f(x 0)(x 0 x ) + f(x )(x x 0 ) Remrks: = (f(x 0) + f(x ))(x x 0 ) = (f(x 0) + f(x )). Te error term for te Trpezoidl rule involves f, so te rule gives te exct result wen pplied to ny function wose second derivtive is identiclly zero, tt is, ny polynomil of degree one or less. Simpson s rule Assume tt te polynomil on [x 0, x ] is P (x). Write P (x) = αx + βx + γ x x 0 P (x)dx = x x 0 (αx + βx + γ)dx = ( αx + βx + γx) x x=x 0 = α(x x 0) + β(x x 0) + γ(x x 0 ) = (α(x x 0 )(x + x x 0 + x 0) + β(x x 0 )(x + x 0 ) + γ(x x 0 )) = x x 0 (α(x + x x 0 + x 0) + β(x + x 0 ) + γ) = (α(x + x x 0 + x 0) + β(x + x 0 ) + γ) Let us prove tt α(x + x x 0 + x 0) + β(x + x 0 ) + γ = f(x 0 ) + 4f(x ) + f(x ) Since P (x) is te interpoltion of f t x 0, x nd x, we ve f(x 0 ) = αx 0 + βx 0 + γ ( ) ( ) f(x ) = αx x0 + x x0 + x + βx + γ = α + β + γ f(x ) = αx + βx + γ 8

Numericl Anlysis So f(x 0 ) + 4f(x ) + f(x ) ( ) =α(x x0 + x 0 + 4 + x ) + βα(x 0 + 4 x 0 + x + x ) + γ =... x.. Composite formul x 0 P (x) = (f(x 0) + 4f(x ) + f(x )). We wnt to find f(x)dx using piecewise polynomil to void (Runge s penomenon). Cut [, b] into n subintervls using eqully spced nodes. x 0 =, x, x,..., x n = b. Do integrl on ec subintervl. Composite Trpezoidl formul: let = (b )/n nd x j = + j, j = 0,, n. I n (f) := (f(x 0 )/ + f(x ) + f(x ) +... + f(x n ) + f(x n )/) := n [f() + f(x j ) + f(b)] j= Composite Simpson rule: coose n even integer n nd divide [, b] into n subintervls wit = (b )/n nd x j = + j. Group te nodes every tree points, nd we coose te unique polynomil of degree wic goes troug te points. Do Integrl on ec sub-intervl. I n (f) := (f(x 0) + 4f(x ) + f(x ) + 4f(x ) + f(x 4 ) +... + f(x n ) + 4f(x n ) + f(x n )). Remrk := n/ n/ (f(x 0) + f(x j ) + 4 f(x j ) + f(x n )). j= j=. Wy not use one polynomil nd ten integrl? (Runge s penomenon). lim n + I n (f) = f(x)dx. How fst does it converge?. Trpezoid: order. Simpson: order 4. I n(f) f(x)dx C I n(f) f(x)dx C4 9

Numericl Anlysis 4. If 00 points, = b 00 = 0. Error 0 4 or 0 8... Error nlysis Lemm (Weigted men vlue teorem) Suppose tt g(x), w(x) C[, b] nd w(x) doesn t cnge sign in [, b]. Ten, tere exists θ (, b) suc tt g(x)w(x)dx = g(θ) Error nlysis for Trpezoidl rule w(x)dx I n (f) = (f(x 0 )/ + f(x ) + f(x ) +... + f(x n ) + f(x n )/) Teorem Suppose f C [, b]. Ten ξ n [, b] suc tt Proof. f(x)dx I n (f) = (b )f (ξ n ) Step Let P (x) be te unique polynomil tt goes troug x i nd x i+. Error is Ten f(x) P (x) = f (ξ(x)) (x x i )(x x i+ ), ξ(x) (x i, x i+ ). E i = = xi+ x i xi+ x i (f(x) P (x))dx f (ξ(x)) (x x i )(x x i+ )dx (x x i )(x x i+ ) is continuous nd doesn t cnge te sign in [x i, x i+ ] f (ξ(x)) is continuous. By te weigted men vlue teorem, tere exists η i [x i, x i+ ] suc tt E i = f (η i ) xi+ x i (x x i )(x x i+ )dx. We ve Finlly, xi+ x i (x x i )(x x i+ )dx = (x i+ x i ). E i = f (η i ) 0

Numericl Anlysis Step Te totl error is n E = E i = n Notice tt n = b. Ten, Clim: Tere exists η [, b] suc tt n proof: f (η i ) = n ( ) n f (η i ) n ( ) n (b ) f(x) I n (x) = f (η i ) n n f (η i ) = f (η). min f (x) f (η i ) mx f (x) x [,b] x [,b] n n min f (x) f (η i ) n mx f (x) x [,b] x [,b] min f (x) n f (η i ) mx x [,b] n f (x) x [,b] Since f is continuous on [, b]. it must ttin ll vlue between its minimum nd mximum t, sy c nd d. Let g(x) = f (x) n f (η i ). n Ten, g(c) 0, g(d) 0. Applying intermedite vlue teorem, we get g (η) = 0. Hence f (η) = n f (η i ). n Corollry Te error is f(x)dx I n (f) M(b ).

Numericl Anlysis Error nlysis for Composite Simpson s rule. I n (f) = n/ (f(x i ) + 4f(x i+ ) + f(x i+ )) Teorem Suppose f C 4 [, b]. Ten ξ n [, b] suc tt f(x)dx I n (f) = (b )f (4) (ξ n ) 4 80 Proof. Let E i be te error in te intervl [x i, x i+ ]. Ten, E i = xi+ x i (f(x) P (x))dx = xi+ x i f (ξ(x)) (x x i )(x x i+ )(x x i+ )dx, were ξ(x) [x i, x i+ ]. Let g(x) = f (ξ(x)) nd w(x) = (x x i )(x x i+ )(x x i+ ). We cnnot use te Weigted Men Vlue Teorem, becuse w(x) > 0, wen x i < x < x i+, w(x) < 0, wen x i+i < x < x i+. Clim: η i [x i, x i+ ] s.t. E i = 5 90 f (4) (η i ). Proof. Will not prove it. So, te totl error is 5 n/ 90 f (4) (η i ) = n Need to nlyze n 5 n/ f (4) (η i ) 90 n n/ f (4) (η i ). We ve m f (4) (η i ) M, m n Since f (4) is continuous, η [, b] s.t. n/ = n/ f (4) (η i ) = f (4) (η). (b )4 80 n f (4) (η i ) M. n/ f (4) (η i ). Corollry Te error is f(x)dx I n (f) M(b ) 4. 80

Numericl Anlysis Degree of precision Trpezoidl rule is O( ). ( (b )f (ξ) ). Simpson s rule is O( 4 ). ( (b )f (4) (ξ) 80 4 ). Simpson s rule is so muc better tn te Trpezoidl rule. Definition: A numericl integrtion formul I n (f) is sid ve degree of precision m if. I n (f) = f(x)dx for ll f(x) = xk, k m.. I n (f) f(x)dx for f(x) = xm+. I n (f + g) = I n (f) + I n (g), I n (λf) = λi n (f). Tis is equivlent to: A numericl integrtion formul I n (f) is sid ve degree of precision m if. I n (f) = f(x)dx for ll polynomil f(x) of degree m.. I n (f) f(x)dx for some polynomil f(x) of degree m +. It is expected tt Trpezoidl rule, te degree is, nd Simpson s rule, te degree is. In fct, Trp. rule s degree of precision, nd Simpson s rule s degree of precision. Let prove tt Simpson s rule is exct if f(x) is polynomil of degree. Te reson is tt te error x P (x) on [x 0, x ] cncels tt on [x, x ]. Proof. Step Let prove tt Simpson s rule is exct if f(x) = x. We only need to prove it in subintervl [x i, x i+ ], i.e., (f(x i) + 4f(x i+ ) + f(x i+ ))dx = xi+ x i x dx. In fct Note tt xi+ x i x dx = x4 4 xi+ x=x i = 4 (x4 i+ x 4 i) x 4 i+ x 4 i = (x i+ x i )(x i+ + x i+x i + x i+ x i + x i) nd x i+ x i =.

Numericl Anlysis So xi+ x i On te oter nd, x dx = (x i+ + x i+x i + x i+ x i + x i). f(x i )+4f(x i+ ) + f(x i+ ) = x i + 4( x i + x i+ ) + x i+ = x i + (x i + x i+ ) + x i+ Terefore, = x i + (x i+ + x i+x i + x i+ x i + x i) + x i+ = (x i+ + x i+x i + x i+ x i + x i) (f(x i) + 4f(x i+ ) + f(x i+ )) = (x i+ + x i+x i + x i+ x i + x i) Summing ll togeter, I n (x ) = x dx. Higer order metod (Closed Newton-Cote formul) Trpezoid: points; Simpson s rule: points. Higer order: wit more points. 4 points (/8 rule): interpolte polynomil of degree. x x 0 f(x)dx x x 0 P (x)dx = 8 (f(x 0) + f(x ) + f(x ) + f(x )). Error O( 4 ). f(x)dx 8 n/ (f(x i ) + f(x i+ ) + f(x i+ ) + f(x i+ )). 5 points (Boole s rule): interpolte polynomil of degree 4. x4 x 0 f(x)dx x4 x 0 P (x)dx = 45 (7f(x 0)+f(x )+f(x )+f(x )+7f(x 4 )). 4

Numericl Anlysis f(x)dx 8 Te error is O( ). n/4 Summry: Closed Newton-Cotes Formuls 45 (7f(x 4i)+f(x 4i+ )+f(x 4i+ )+f(x 4i+ )+7f(x 4i+4 )) Trpezoidl Simpson s /8 Boole? Num. of Points 4 5 Deg. of inter. poly. 4 5 Deg. of Precision. 5 5 Order. of Error(composite formul) O( ) O( 4 ) O( 4 ) O( ) O( ) Even polynomils (odd number of points) re better. Te left prt of te errors x n+ P n (x)) cncels te rigt prt!. Romberg integrtion Te min ide of Romber integrtion is to use te composite Trpezoidl rule to give preliminry pproximtion nd ten pplies te Ricrdson verge process to get iger order trunction error. Te Romberg integrtion lgoritm produces tringulr rry of numbers, ll of wic re numericl estimtes of te definite integrl f(x)dx. Te rry is denoted s R, R, R, R, R, R,......... R n, R n, R n, R n,n Let n be positive number. Te first column R n, contins estimtes of te integrl obtined by te recursive trpezoid formul wit decresing vlues of te step size n ( wit n equl subintervls). R, = (f() + f(b)) ( = b ) R, = (f() + f(b) + f( + )) = b b (f() + f(b) + f( + 4 ) = (R, + f( + )) ( = b ) R, = (R, + (f( + ) + f( + ))) 5 ( = b )

Numericl Anlysis In generl R k, = k (R k, + k f( + (i ) k )) i= for ec k =,,, n, k = b k. It cn be sown tt if f C [, b], te composite Trpezoidl rule cn be written wit n lterntive error term in te form f(x)dx R k, = Replce k+ = k /, giving f(x)dx R k+, = i= i= K i i k = K k + i= K i i k+ = 4 K k + Using Ricrdson s verging tecnique, we get f(x)dx [R k+, + R k+, R k, ] = Higer order formul (second column) for ec k =,,, n i= K i i k i= K i i k 4 i K i 4i ( 4 i ) i k = K 4 4 k + R k, = R k, + R k, R k, i= K i 4i ( 4 i ) i k Continue to pply te Ricrdson extrpoltion procedure to tese vlues, we ve, for ec k =,,, n, nd j =,, k, n O( j k pproximtion formul defined by Remrks R k,j = R k,j + R k,j R k,j 4 j Order of computing R,, R,, R,, R,, R,, R, etc. Stopping criterion for n: bot R n,n R n,n nd R n,n R n,n re smller tn tolernce.

Numericl Anlysis.4 Gussin Qudrture In order to find f(x)dx. f(x)dx I n(f). Generl form: I n (f) = w 0 f(x 0 ) + w f(x ) + w f(x ) +... + w n f(x n ) In Newton-Cotes formuls, eqully spced. Te degree of precision is t most m if m points used. How to furter improve te ccurcy? Use non-eqully spced points! Gussin qudrture: coose x 0, x,..., x n nd w 0, w,..., w n simultneously so tt I n (f) s degree of precision s ig s possible. We ve n + unknowns, wic cn be determined by n + equtions for monomils, x, x,..., x n+. We will see tt n + coices llow us to rec degree of precision n +. Exmple: two points, n =. We wnt f(x)dx. I n (f) = w 0 f(x 0 ) + w f(x ). We wnt to coose x 0, x, w 0 nd w s.t. (Here n + =.) I n (f) = f(x)dx, f(x) = x k, k. So we ve 4 unknowns, 4 equtions. w 0 + w = dx = w 0 x 0 + w x = xdx = 0 w 0 x 0 + w x = x dx = w 0 x 0 + w x = x dx = 0 (.) Solve tis system of nonliner equtions to get x 0, x, w 0 nd w. Ten I n (f) = w 0 f(x 0 ) + w f(x ) will be exct for every polynomil of degree. Solution of te eqution.. () implies w x = w 0 x 0. 7

Numericl Anlysis. So (4) implies w 0 x 0 w 0 x 0 x = 0 w 0 x 0 = w 0 x 0 x x 0 = x x = ±x 0.. we wnt to coose different points, so x x 0. Ten x = x 0. 4. So w x 0 = w 0 x 0. Ten w = w 0. 5. () implies w =. w 0 =, w =.. () implies x 0 + x =. x = x 0 =, x =. Formul I (f) = f( ) + f( ) Let try ex dx. I (e x ) = e + e =.48 Exmple: tree points, n =. We wnt f(x)dx. I n (f) = w 0 f(x 0 ) + w f(x ) + w f(x ). We wnt to coose x 0, x, x, w 0, w nd w s.t. (Here n + = 5.) I n (f) = f(x)dx, f(x) = x k, k 5. So we ve w 0 + w + w = dx = w 0 x 0 + w x + w x = xdx = 0 w 0 x 0 + w x + w x = x dx = w 0 x 0 + w x + w x = x dx = 0 w 0 x 4 0 + w x 4 + w x 4 = x4 dx = 5 w 0 x 5 0 + w x 5 + w x 5 = x5 dx = 0 (.4) unknowns, equtions. Solve tis system of nonliner equtions to get x 0, x, w 0 nd w. Ten I n (f) = w 0 f(x 0 ) + w f(x ) will be exct for every polynomil of degree. Solution of te eqution. 8

Numericl Anlysis. ()(4)() implies In mtrix form, w 0 x 0 + w x + w x = xdx = 0 w 0 x 0 + w x + w x = x dx = 0 w 0 x 5 0 + w x 5 + w x 5 = x5 dx = 0 x 0 x x w 0x 0 w x = 0 0 x 4 0 x 4 x 4 w x 0 (.5) We ve two cses () If w 0x 0 w x = 0, ten one of te following olds. i) x i = 0 for t lest w x two indices. Ten x i = x j. Impossible. ii) x i = 0 (sy, x 0 = 0) for only one index. So w = w = 0. Ten I n (f) = w 0 f(0) No solution. (b) Ten te mtrix is nonsingulr. It implies x 0 = x. So x 0 = x.. Ten w 0 + w = w (w 0 w )x 0 = w x (w 0 + w )x 0 = w x (w 0 w )x 0 = w x (.) (w 0 + w )x 4 0 = 5 w x 4 (w 0 w )x 5 0 = w x 5. ()(4)() implies (w 0 w ) x 0 x 0 = w x x x 5 x 5 Ten eiter x = x 0 wic is impossible or bot nds sides re zero vectors. So w 0 = w nd w = 0 (impossible) or w 0 = w nd x = 0 4. So 5. ()() implies x 0 = 5. Ten w 0 = w w 0 x 0 = w 0 x 4 0 = 5 (.7) x 0 = 5, x = 9 5.

Numericl Anlysis. () implies w 0 = 5 9. 7. Finlly, w 0 = 5 9, w = 8 9, w = 5 9, x 0 = 5, x = 0, x = 5. Formul I (f) = 5 9 f( 5 ) + 8 9 f(0) + 5 9 f( 5 ) Let try ex dx. I (e x ) = 5 9 e 5 + 8 9 e0 + 5 9 e 5 =.50 ex dx = e x =.504. Tble.: Gussin Qudrture Nodes nd Weigts n Degree of Precision Nodes x 0 x n Weigts w 0 w i 5 5 5 9 8 5 9 5 9 0