Introduction to Numerical Analysis. Hector D. Ceniceros

Similar documents
Numerical Integration

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

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

Theoretical foundations of Gaussian quadrature

Review of Calculus, cont d

1 The Lagrange interpolation formula

Math& 152 Section Integration by Parts

Lecture 14: Quadrature

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

Best Approximation. Chapter The General Case

The Regulated and Riemann Integrals

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

Lecture 19: Continuous Least Squares Approximation

Discrete Least-squares Approximations

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

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

Orthogonal Polynomials and Least-Squares Approximations to Functions

Numerical Analysis: Trapezoidal and Simpson s Rule

Orthogonal Polynomials

Abstract inner product spaces

Part IB Numerical Analysis

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

NUMERICAL INTEGRATION

Numerical quadrature based on interpolating functions: A MATLAB implementation

Numerical Methods I Orthogonal Polynomials

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

Goals: Determine how to calculate the area described by a function. Define the definite integral. Explore the relationship between the definite

APPROXIMATE INTEGRATION

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

Definite integral. Mathematics FRDIS MENDELU

Numerical Analysis. Doron Levy. Department of Mathematics Stanford University

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)

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

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

Numerical Integration

Numerical integration

Lecture 20: Numerical Integration III

Best Approximation in the 2-norm

MORE FUNCTION GRAPHING; OPTIMIZATION. (Last edited October 28, 2013 at 11:09pm.)

3.4 Numerical integration

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

Overview of Calculus I

1 The Riemann Integral

Lecture 23: Interpolatory Quadrature

UNIFORM CONVERGENCE MA 403: REAL ANALYSIS, INSTRUCTOR: B. V. LIMAYE

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

Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

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

THE EXISTENCE-UNIQUENESS THEOREM FOR FIRST-ORDER DIFFERENTIAL EQUATIONS.

Review of basic calculus

MATH34032: Green s Functions, Integral Equations and the Calculus of Variations 1

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

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

Matrices, Moments and Quadrature, cont d

Definition of Continuity: The function f(x) is continuous at x = a if f(a) exists and lim

The final exam will take place on Friday May 11th from 8am 11am in Evans room 60.

ODE: Existence and Uniqueness of a Solution

Continuous Random Variables

Main topics for the First Midterm

Math 270A: Numerical Linear Algebra

8 Laplace s Method and Local Limit Theorems

Lecture 1. Functional series. Pointwise and uniform convergence.

Chapter 5 : Continuous Random Variables

7.2 The Definite Integral

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

ARITHMETIC OPERATIONS. The real numbers have the following properties: a b c ab ac

The Riemann Integral

Chapter 3 Polynomials

Convex Sets and Functions

4. Calculus of Variations

Riemann is the Mann! (But Lebesgue may besgue to differ.)

Math 61CM - Solutions to homework 9

Integration Techniques

6.5 Numerical Approximations of Definite Integrals

Lecture 12: Numerical Quadrature

New Expansion and Infinite Series

B.Sc. in Mathematics (Ordinary)

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

How can we approximate the area of a region in the plane? What is an interpretation of the area under the graph of a velocity function?

Math 8 Winter 2015 Applications of Integration

Advanced Calculus: MATH 410 Uniform Convergence of Functions Professor David Levermore 11 December 2015

Riemann Sums and Riemann Integrals

Construction of Gauss Quadrature Rules

Lecture 4: Piecewise Cubic Interpolation

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

MATH 174A: PROBLEM SET 5. Suggested Solution

Indefinite Integral. Chapter Integration - reverse of differentiation

Calculus I-II Review Sheet

The Basic Functional 2 1

Chapter 1. Basic Concepts

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

different methods (left endpoint, right endpoint, midpoint, trapezoid, Simpson s).

Riemann Sums and Riemann Integrals

Math 113 Exam 2 Practice

AP Calculus Multiple Choice: BC Edition Solutions

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

Chapter 3 Solving Nonlinear Equations

x = b a n x 2 e x dx. cdx = c(b a), where c is any constant. a b

1 Linear Least Squares

Transcription:

Introduction to Numericl Anlysis Hector D. Ceniceros c Drft dte November 27, 2018

Contents Contents i Prefce 1 1 Introduction 3 1.1 Wht is Numericl Anlysis?.................. 3 1.2 An Illustrtive Exmple..................... 3 1.2.1 An Approximtion Principle............... 4 1.2.2 Divide nd Conquer................... 6 1.2.3 Convergence nd Rte of Convergence......... 7 1.2.4 Error Correction..................... 8 1.2.5 Richrdson Extrpoltion................ 11 1.3 Super-lgebric Convergence................... 13 2 Function Approximtion 17 2.1 Norms............................... 17 2.2 Uniform Polynomil Approximtion............... 19 2.2.1 Bernstein Polynomils nd Bézier Curves........ 19 2.2.2 Weierstrss Approximtion Theorem.......... 23 2.3 Best Approximtion....................... 25 2.3.1 Best Uniform Polynomil Approximtion........ 27 2.4 Chebyshev Polynomils...................... 31 3 Interpoltion 37 3.1 Polynomil Interpoltion..................... 37 3.1.1 Equispced nd Chebyshev Nodes............ 40 3.2 Connection to Best Uniform Approximtion.......... 41 3.3 Brycentric Formul....................... 43 i

ii CONTENTS 3.3.1 Brycentric Weights for Chebyshev Nodes....... 44 3.3.2 Brycentric Weights for Equispced Nodes....... 45 3.3.3 Brycentric Weights for Generl Sets of Nodes..... 45 3.4 Newton s Form nd Divided Differences............. 46 3.5 Cuchy s Reminder....................... 49 3.6 Hermite Interpoltion....................... 52 3.7 Convergence of Polynomil Interpoltion............ 53 3.8 Piece-wise Liner Interpoltion................. 55 3.9 Cubic Splines........................... 56 3.9.1 Solving the Tridigonl System............. 60 3.9.2 Complete Splines..................... 62 3.9.3 Prmetric Curves.................... 63 4 Trigonometric Approximtion 65 4.1 Approximting Periodic Function............... 65 4.2 Interpolting Fourier Polynomil................ 70 4.3 The Fst Fourier Trnsform................... 75 5 Lest Squres Approximtion 79 5.1 Continuous Lest Squres Approximtion............ 79 5.2 Liner Independence nd Grm-Schmidt Orthogonliztion.. 85 5.3 Orthogonl Polynomils..................... 86 5.3.1 Chebyshev Polynomils.................. 89 5.4 Discrete Lest Squres Approximtion............. 90 5.5 High-dimensionl Dt Fitting.................. 95 6 Computer Arithmetic 99 6.1 Floting Point Numbers..................... 99 6.2 Rounding nd Mchine Precision................ 100 6.3 Correctly Rounded Arithmetic.................. 101 6.4 Propgtion of Errors nd Cncelltion of Digits........ 102 7 Numericl Differentition 105 7.1 Finite Differences......................... 105 7.2 The Effect of Round-off Errors.................. 108 7.3 Richrdson s Extrpoltion.................... 109

CONTENTS iii 8 Numericl Integrtion 111 8.1 Elementry Simpson Qudrture................ 111 8.2 Interpoltory Qudrtures.................... 114 8.3 Gussin Qudrtures...................... 116 8.3.1 Convergence of Gussin Qudrtures......... 119 8.4 Computing the Gussin Nodes nd Weights.......... 121 8.5 Clenshw-Curtis Qudrture................... 122 8.6 Composite Qudrtures..................... 124 8.7 Modified Trpezoidl Rule.................... 125 8.8 The Euler-Mclurin Formul.................. 127 8.9 Romberg Integrtion....................... 130 9 Liner Algebr 133 9.1 The Three Min Problems.................... 133 9.2 Nottion.............................. 135 9.3 Some Importnt Types of Mtrices............... 136 9.4 Schur Theorem.......................... 139 9.5 Norms............................... 140 9.6 Condition Number of Mtrix................. 146 9.6.1 Wht to Do When A is Ill-conditioned?......... 148 10 Liner Systems of Equtions I 151 10.1 Esy to Solve Systems...................... 152 10.2 Gussin Elimintion....................... 154 10.2.1 The Cost of Gussin Elimintion............ 161 10.3 LU nd Choleski Fctoriztions................. 162 10.4 Tridigonl Liner Systems................... 166 10.5 A 1D BVP: Deformtion of n Elstic Bem.......... 168 10.6 A 2D BVP: Dirichlet Problem for the Poisson s Eqution... 170 10.7 Liner Itertive Methods for Ax = b............... 173 10.8 Jcobi, Guss-Seidel, nd S.O.R................. 174 10.9 Convergence of Liner Itertive Methods............ 176 11 Liner Systems of Equtions II 181 11.1 Positive Definite Liner Systems s n Optimiztion Problem. 181 11.2 Line Serch Methods....................... 183 11.2.1 Steepest Descent..................... 184 11.3 The Conjugte Grdient Method................ 184

iv CONTENTS 11.3.1 Generting the Conjugte Serch Directions...... 187 11.4 Krylov Subspces......................... 190 11.5 Convergence Rte of the Conjugte Grdient Method..... 192 12 Non-Liner Equtions 193 12.1 Introduction............................ 193 12.2 Bisection.............................. 193 12.2.1 Convergence of the Bisection Method.......... 194 12.3 Rte of Convergence....................... 195 12.4 Interpoltion-Bsed Methods................... 196 12.5 Newton s Method......................... 197 12.6 The Secnt Method........................ 198 12.7 Fixed Point Itertion....................... 200 12.8 Systems of Nonliner Equtions................. 202 12.8.1 Newton s Method..................... 203

List of Figures 2.1 The Bernstein weights b k,n (x) for x = 0.25 ( )nd x = 0.75 ( ), n = 50 nd k = 1... n..................... 21 2.2 Qudrtic Bézier curve....................... 21 2.3 If the error function e n does not equioscillte t lest twice we could lower e n by n mount c > 0.............. 28 4.1 S 8 (x) for f(x) = sin xe cos x on [0, 2π]............... 74 5.1 The function f(x) = e x on [0, 1] nd its Lest Squres Approximtion p 1 (x) = 4e 10 + (18 6e)x............ 81 5.2 Geometric interprettion of the solution X of the Lest Squres problem s the orthogonl projection of f on the pproximting liner subspce W....................... 97 v

vi LIST OF FIGURES

List of Tbles 1.1 Composite Trpezoidl Rule for f(x) = e x in [0, 1]....... 8 1.2 Composite Trpezoidl Rule for f(x) = 1/(2 + sin x) in [0, 2π]. 13 vii

viii LIST OF TABLES

Prefce These notes were prepred by the uthor for use in the upper division undergrdute course of Numericl Anlysis (Mth 104 ABC) t the University of Cliforni t Snt Brbr. They were written with the intent to emphsize the foundtions of Numericl Anlysis rther thn to present long list of numericl methods for different mthemticl problems. We begin with n introduction to Approximtion Theory nd then use the different ides of function pproximtion in the derivtion nd nlysis of mny numericl methods. These notes re intended for undergrdute students with strong mthemtics bckground. The prerequisites re Advnced Clculus, Liner Algebr, nd introductory courses in Anlysis, Differentil Equtions, nd Complex Vribles. The bility to write computer code to implement the numericl methods is lso necessry nd essentil prt of lerning Numericl Anlysis. These notes re not in finlized form nd my contin errors, misprints, nd other inccurcies. They cnnot be used or distributed without written consent from the uthor. 1

2 LIST OF TABLES

Chpter 1 Introduction 1.1 Wht is Numericl Anlysis? This is n introductory course of Numericl Anlysis, which comprises the design, nlysis, nd implementtion of constructive methods nd lgorithms for the solution of mthemticl problems. Numericl Anlysis hs vst pplictions both in Mthemtics nd in modern Science nd Technology. In the res of the Physicl nd Life Sciences, Numericl Anlysis plys the role of virtul lbortory by providing ccurte solutions to the mthemticl models representing given physicl or biologicl system in which the system s prmeters cn be vried t will, in controlled wy. The pplictions of Numericl Anlysis lso extend to more modern res such s dt nlysis, web serch engines, socil networks, nd bsiclly nything where computtion is involved. 1.2 An Illustrtive Exmple: Approximting Definite Integrl The min principles nd objectives of Numericl Anlysis re better illustrted with concrete exmples nd this is the purpose of this chpter. Consider the problem of clculting definite integrl (1.1) I[f] = f(x)dx. 3

4 CHAPTER 1. INTRODUCTION In most cses we cnnot find n exct vlue of I[f] nd very often we only know the integrnd f t finite number of points in [, b]. The problem is then to produce n pproximtion to I[f] s ccurte s we need nd t resonble computtionl cost. 1.2.1 An Approximtion Principle One of the centrl ides in Numericl Anlysis is to pproximte given function or dt by simpler functions which we cn nlyticlly evlute, integrte, differentite, etc. For exmple, we cn pproximte the integrnd f in [, b] by the segment of the stright line, liner polynomil p 1 (x), tht psses through (, f()) nd (b, f(b)). Tht is (1.2) f(x) p 1 (x) = f() + f(b) f() (x ). b nd (1.3) f(x)dx p 1 (x)dx = f()(b ) + 1 [f(b) f()](b ) 2 = 1 [f() + f(b)](b ). 2 Tht is (1.4) f(x)dx b [f() + f(b)]. 2 The right hnd side is known s the simple Trpezoidl Rule Qudrture. A qudrture is method to pproximte n integrl. How ccurte is this pproximtion? Clerly, if f is liner polynomil or constnt then the Trpezoidl Rule would give us the exct vlue of the integrl, i.e. it would be exct. The underlying question is: how well does liner polynomil p 1, stisfying (1.5) (1.6) p 1 () = f(), p 1 (b) = f(b), pproximte f on the intervl [, b]? We cn lmost guess the nswer. The pproximtion is exct t x = nd x = b becuse of (1.5)-(1.6) nd it is

1.2. AN ILLUSTRATIVE EXAMPLE 5 exct for ll polynomils of degree 1. This suggests tht f(x) p 1 (x) = Cf (ξ)(x )(x b), where C is constnt. But where is f evluted t? it cnnot be t x for if it did f would be the solution of second order ODE nd f is n rbitrry (but sufficiently smooth, C 2 [, b] ) function so it hs to be t some undetermined point ξ(x) in (, b). Now, if we tke the prticulr cse f(x) = x 2 on [0, 1] then p 1 (x) = x, f(x) p 1 (x) = x(x 1), nd f (x) = 2, which implies tht C would hve to be 1/2. So our conjecture is (1.7) f(x) p 1 (x) = 1 2 f (ξ(x))(x )(x b). There is beutiful 19th Century proof of this result by A. Cuchy. It goes s follows. If x = or x = b (1.7) holds trivilly. So let us tke x in (, b) nd define the following function of new vrible t s (1.8) (t )(t b) φ(t) = f(t) p 1 (t) [f(x) p 1 (x)] (x )(x b). Then φ, s function of t, is C 2 [, b] nd φ() = φ(b) = φ(x) = 0. Since φ() = φ(x) = 0 by Rolle s theorem there is ξ 1 (, x) such tht φ (ξ 1 ) = 0 nd similrly there is ξ 2 (x, b) such tht φ (ξ 2 ) = 0. Becuse φ is C 2 [, b] we cn pply Rolle s theorem one more time, observing tht φ (ξ 1 ) = φ (ξ 2 ) = 0, to get tht there is point ξ(x) between ξ 1 nd ξ 2 such tht φ (ξ(x)) = 0. Consequently, (1.9) 0 = φ (ξ(x)) = f 2 (ξ(x)) [f(x) p 1 (x)] (x )(x b) nd so (1.10) f(x) p 1 (x) = 1 2 f (ξ(x))(x )(x b), ξ(x) (, b). We cn use (1.10) to find the ccurcy of the simple Trpezoidl Rule. Assuming the integrnd f is C 2 [, b] (1.11) f(x)dx = p 1 (x)dx + 1 2 f (ξ(x))(x )(x b)dx. Now, (x )(x b) does not chnge sign in [, b] nd f is continuous so by the Weighted Men Vlue Theorem for Integrls we hve tht there is

6 CHAPTER 1. INTRODUCTION η (, b) such tht (1.12) f (ξ(x))(x )(x b)dx = f (η) (x )(x b)dx. The lst integrl cn be esily evluted if we shift to the midpoint, i.e., chnging vribles to x = y + 1 ( + b) then 2 [ b ( ) ] 2 2 b (1.13) (x )(x b)dx = y 2 dy = 1 2 6 (b )3. Collecting (1.11) nd (1.13) we get (1.14) b 2 f(x)dx = b 2 [f() + f(b)] 1 12 f (η)(b ) 3, where η is some point in (, b). So in the pproximtion we mke the error (1.15) f(x)dx b [f() + f(b)]. 2 E[f] = 1 12 f (η)(b ) 3. 1.2.2 Divide nd Conquer The error (1.15) of the simple Trpezoidl Rule grows cubiclly with the length of the intervl of integrtion so it is nturl to divide [, b] into smller subintervls, pply the Trpezoidl Rule on ech of them, nd sum up the result. Let us divide [, b] in N subintervls of equl length h = 1 (b ), determined by the points x 0 =, x 1 = x 0 +h, x 2 = x 0 +2h,..., x N = x 0 +Nh = b, N then (1.16) f(x)dx = = x1 x 0 f(x)dx + N 1 j=0 xj+1 x j x2 f(x)dx. x 1 f(x)dx +... + xn x N 1 f(x)dx

1.2. AN ILLUSTRATIVE EXAMPLE 7 But we know (1.17) xj+1 x j f(x)dx = 1 2 [f(x j) + f(x j+1 )]h 1 12 f (ξ j )h 3 for some ξ j (x j, x j+1 ). Therefore, we get [ 1 f(x)dx = h 2 f(x 0) + f(x 1 ) +... + f(x N 1 ) + 1 ] 2 f(x N) 112 N 1 h3 f (ξ j ). The first term on the right hnd side is clled the Composite Trpezoidl Rule Qudrture (CTR): [ 1 T h [f] := h 2 f(x 0) + f(x 1 ) +... + f(x N 1 ) + 1 ] (1.18) 2 f(x N). The error term is (1.19) E h [f] = 1 N 1 12 h3 j=0 [ f (ξ j ) = 1 12 (b 1 )h2 N N 1 j=0 f (ξ j ) where we hve used tht h = (b )/N. The term in brckets is men vlue of f (it is esy to prove tht it lies between the mximum nd the minimum of f ). Since f is ssumed continuous (f C 2 [, b]) then by the Intermedite Vlue Theorem, there is point ξ (, b) such tht f (ξ) is equl to the quntity in the brckets so we obtin tht j=0 ], (1.20) E h [f] = 1 12 (b )h2 f (ξ), for some ξ (, b). 1.2.3 Convergence nd Rte of Convergence We do not not know wht the point ξ is in (1.20). If we knew, the error could be evluted nd we would know the integrl exctly, t lest in principle, becuse (1.21) I[f] = T h [f] + E h [f].

8 CHAPTER 1. INTRODUCTION But (1.20) gives us two importnt properties of the pproximtion method in question. First, (1.20) tell us tht E h [f] 0 s h 0. Tht is, the qudrture rule T h [f] converges to the exct vlue of the integrl s h 0 1. Recll h = (b )/N, so s we increse N our pproximtion to the integrl gets better nd better. Second, (1.20) tells us how fst the pproximtion converges, nmely qudrticlly in h. This is the pproximtion s rte of convergence. If we double N (or equivlently hlve h) then the error decreses by fctor of 4. We lso sy tht the error is order h 2 nd write E h [f] = O(h 2 ). The Big O nottion is used frequently in Numericl Anlysis. Definition 1. We sy tht g(h) is order h α, nd write g(h) = O(h α ), if there is constnt C nd h 0 such tht g(h) Ch α for 0 h h 0, i.e. for sufficiently smll h. Exmple 1. Let s check the Trpezoidl Rule pproximtion for n integrl we cn compute exctly. Tke f(x) = e x in [0, 1]. The exct vlue of the integrl is e 1. Observe how the error I[e x ] T 1/N [e x ] decreses by Tble 1.1: Composite Trpezoidl Rule for f(x) = e x in [0, 1]. N T 1/N [e x ] I[e x ] T 1/N [e x ] Decrese fctor 16 1.718841128579994 5.593001209489579 10 4 32 1.718421660316327 1.398318572816137 10 4 0.250012206406039 64 1.718316786850094 3.495839104861176 10 5 0.250003051723810 128 1.718290568083478 8.739624432374526 10 6 0.250000762913303 fctor of (pproximtely) 1/4 s N is doubled, in ccordnce to (1.20). 1.2.4 Error Correction We cn get n upper bound for the error using (1.20) nd tht f is bounded in [, b], i.e. f (x) M 2 for ll x [, b] for some constnt M 2. Then (1.22) E h [f] 1 12 (b )h2 M 2. 1 Neglecting round-off errors introduced by finite precision number representtion nd computer rithmetic.

1.2. AN ILLUSTRATIVE EXAMPLE 9 However, this bound does not in generl provide n ccurte estimte of the error. It could grossly overestimte it. This cn be seen from (1.19). As N the term in brckets converges to men vlue of f, i.e. (1.23) N 1 1 f (ξ j ) 1 N b j=0 f (x)dx = 1 b [f (b) f ()], s N, which could be significntly smller thn the mximum of f. Tke for exmple f(x) = e 100x on [0, 1]. Then mx f = 10000e 100, wheres the men vlue (1.23) is equl to 100(e 100 1) so the error bound (1.22) overestimtes the ctul error by two orders of mgnitude. Thus, (1.22) is of little prcticl use. Eqution (1.19) nd (1.23) suggest tht symptoticlly, tht is for sufficiently smll h, (1.24) E h [f] = C 2 h 2 + R(h), where (1.25) C 2 = 1 12 [f (b) f ()] nd R(h) goes to zero fster thn h 2 s h 0, i.e. (1.26) R(h) lim = 0. h 0 h 2 We sy tht R(h) = o(h 2 ) (little o h 2 ). Definition 2. A function g(h) is little o h α if nd we write g(h) = o(h α ). g(h) lim h 0 h = 0 α We then hve (1.27) I[f] = T h [f] + C 2 h 2 + R(h). nd, for sufficiently smll h, C 2 h 2 is n pproximtion of the error. If it is possible nd computtionlly efficient to evlute the first derivtive of

10 CHAPTER 1. INTRODUCTION f t the end points of the intervl then we cn compute directly C 2 h 2 nd use this leding order pproximtion of the error to obtin the improved pproximtion (1.28) T h [f] = T h [f] 1 12 [f (b) f ()]h 2. This is clled the (composite) Modified Trpezoidl Rule. It then follows from (1.27) tht error of this corrected pproximtion is R(h), which goes to zero fster thn h 2. In fct, we will prove lter tht the error of the Modified Trpezoidl Rule is O(h 4 ). Often, we only hve ccess to vlues of f nd/or it is difficult to evlute f () nd f (b). Fortuntely, we cn compute sufficiently good pproximtion of the leding order term of the error, C 2 h 2, so tht we cn use the sme error correction ide tht we did for the Modified Trpezoidl Rule. Roughly speking, the error cn be estimted by compring two pproximtions obtined with different h. Consider (1.27). If we hlve h we get (1.29) I[f] = T h/2 [f] + 1 4 C 2h 2 + R(h/2). Subtrcting (1.29) from (1.27) we get (1.30) C 2 h 2 = 4 ( Th/2 [f] T h [f] ) + 4 (R(h/2) R(h)). 3 3 The lst term on the right hnd side is o(h 2 ). Hence, for h sufficiently smll, we hve C 2 h 2 4 ( (1.31) Th/2 [f] T h [f] ) 3 nd this could provide good, computble estimte for the error, i.e. (1.32) E h [f] 4 3 ( Th/2 [f] T h [f] ). The key here is tht h hs to be sufficiently smll to mke the symptotic pproximtion (1.31) vlid. We cn check this by working bckwrds. If h is sufficiently smll, then evluting (1.31) t h/2 we get ( ) 2 h C 2 4 ( (1.33) Th/4 [f] T h/2 [f] ) 2 3

1.2. AN ILLUSTRATIVE EXAMPLE 11 nd consequently the rtio (1.34) q(h) = T h/2[f] T h [f] T h/4 [f] T h/2 [f] should be pproximtely 4. Thus, q(h) offers relible, computble indictor of whether or not h is sufficiently smll for (1.32) to be n ccurte estimte of the error. We cn now use (1.31) nd the ide of error correction to improve the ccurcy of T h [f] with the following pproximtion 2 (1.35) S h [f] := T h [f] + 4 3 ( Th/2 [f] T h [f] ). 1.2.5 Richrdson Extrpoltion We cn view the error correction procedure s wy to eliminte the leding order (in h) contribution to the error. Multiplying (1.29) by 4 nd substrcting (1.27) to the result we get (1.36) I[f] = 4T h/2[f] T h [f] 3 + 4R(h/2) R(h) 3 Note tht S h [f] is exctly the first term in the right hnd side of (1.36) nd tht the lst term converges to zero fster thn h 2. This very useful nd generl procedure in which the leding order component of the symptotic form of error is eliminted by combintion of two computtions performed with two different vlues of h is clled Richrdson s Extrpoltion. Exmple 2. Consider gin f(x) = e x in [0, 1]. With h = 1/16 we get ( ) 1 q = T 1/32[e x ] T 1/16 [e x (1.37) ] 16 T 1/64 [e x ] T 1/32 [e x ] 3.9998 nd the improved pproximtion is (1.38) S 1/16 [e x ] = T 1/16 [e x ] + 4 3 ( T1/32 [e x ] T 1/16 [e x ] ) = 1.718281837561771 which gives us nerly 8 digits of ccurcy (error 9.1 10 9 ). S 1/32 gives us n error 5.7 10 10. It decresed by pproximtely fctor of 1/16. This would correspond to fourth order rte of convergence. We will see in Chpter 8 tht indeed this is the cse. 2 The symbol := mens equl by definition.

12 CHAPTER 1. INTRODUCTION It ppers tht S h [f] gives us superior ccurcy to tht of T h [f] but t roughly twice the computtionl cost. If we group together the common terms in T h [f] nd T h/2 [f] we cn compute S h [f] t bout the sme computtionl cost s tht of T h/2 [f]: [ ] 4T h/2 [f] T h [f] = 4 h 2N 1 1 2 2 f() + f( + jh/2) + 1 2 f(b) j=1 [ ] N 1 1 h 2 f() + f( + jh) + 1 2 f(b) j=1 [ ] = h N 1 N 1 f() + f(b) + 2 f( + kh) + 4 f( + kh/2). 2 Therefore (1.39) S h [f] = h 6 [ f() + 2 N 1 k=1 k=1 N 1 f( + kh) + 4 k=1 k=1 f( + kh/2) + f(b) The resulting qudrture formul S h [f] is known s the Composite Simpson s Rule nd, s we will see in Chpter 8, cn be derived by pproximting the integrnd by qudrtic polynomils. Thus, bsed on cost nd ccurcy, the Composite Simpson s Rule would be preferble to the Composite Trpezoidl Rule, with one importnt exception: periodic smooth integrnds integrted over their period. Exmple 3. Consider the integrl ]. (1.40) I[1/(2 + sin x)] = 2π 0 dx 2 + sin x. Using Complex Vribles techniques (Residues) the exct integrl cn be computed nd I[1/(2 + sin x)] = 2π/ 3. Note tht the integrnd is smooth (hs n infinite number of continuous derivtives) nd periodic in [0, 2π]. If we use the Composite Trpezoidl Rule to find pproximtions to this integrl we obtin the results show in Tble 1.2. The pproximtions converge mzingly fst. With N = 32, we lredy reched mchine precision (with double precision we get bout 16 digits).

1.3. SUPER-ALGEBRAIC CONVERGENCE 13 Tble 1.2: Composite Trpezoidl Rule for f(x) = 1/(2 + sin x) in [0, 2π]. N T 2π/N [1/(2 + sin x)] I[1/(2 + sin x)] T 2π/N [1/(2 + sin x)] 8 3.627791516645356 1.927881769203665 10 4 16 3.627598733591013 5.122577029226250 10 9 32 3.627598728468435 4.440892098500626 10 16 1.3 Super-Algebric Convergence of the CTR for Smooth Periodic Integrnds Integrls of periodic integrnds pper in mny pplictions, most notbly, in Fourier Anlysis. Consider the definite integrl I[f] = 2π 0 f(x)dx, where the integrnd f is periodic in [0, 2π] nd hs m > 1 continuous derivtives, i.e. f C m [0, 2π] nd f(x + 2π) = f(x) for ll x. Due to periodicity we cn work in ny intervl of length 2π nd if the function hs different period, with simple chnge of vribles, we cn reduce the problem to one in [0, 2π]. Consider the eqully spced points in [0, 2π], x j = jh for j = 0, 1,..., N nd h = 2π/N. Becuse f is periodic f(x 0 = 0) = f(x N = 2π) nd the CTR becomes [ f(x0 ) T h [f] = h + f(x 1 ) +... + f(x N 1 ) + f(x ] N 1 N) (1.41) = h f(x j ). 2 2 Being f smooth nd periodic in [0, 2π], it hs uniformly convergent Fourier Series: f(x) = 0 2 + (1.42) ( k cos kx + b k sin kx) where (1.43) (1.44) k = 1 π b k = 1 π 2π 0 2π 0 k=1 f(x) cos kx dx, k = 0, 1,... f(x) sin kx dx, k = 1, 2,... j=0

14 CHAPTER 1. INTRODUCTION Using the Euler formul 3. (1.45) e ix = cos x + i sin x we cn write (1.46) (1.47) cos x = eix + e ix, 2 sin x = eix e ix 2i nd the Fourier series cn be conveniently expressed in complex form in terms of functions e ikx for k = 0, ±1, ±2,... so tht (1.42) becomes (1.48) f(x) = c k e ikx, k= where (1.49) c k = 1 2π f(x)e ikx dx. 2π 0 We re ssuming tht f is rel-vlued so the complex Fourier coefficients stisfy c k = c k, where c k is the complex conjugte of c k. We hve the reltion 2c 0 = 0 nd 2c k = k ib k for k = ±1, ±2,..., between the complex nd rel Fourier coefficients. Using (1.48) in (1.41) we get (1.50) T h [f] = h N 1 j=0 ( k= c k e ikx j Justified by the uniform convergence of the series we cn exchnge the finite nd the infinite sums to get ). (1.51) T h [f] = 2π N k= N 1 c k j=0 e ik 2π N j. 3 i 2 = 1 nd if c = + ib, with, b R, then its complex conjugte c = ib.

1.3. SUPER-ALGEBRAIC CONVERGENCE 15 But (1.52) Note tht e ik 2π N l Z nd if so (1.53) N 1 j=0 e ik 2π N j = N 1 j=0 ( e ik 2π N ) j. = 1 precisely when k is n integer multiple of N, i.e. k = ln, N 1 j=0 ( e ik 2π N ) j = N for k = ln. Otherwise, if k ln, then (1.54) N 1 j=0 ( ) j 1 e ik 2π N = 1 ( e ik 2π N ( e ik 2π N Using (1.53) nd (1.54) we thus get tht ) N ) = 0 for k ln (1.55) On the other hnd (1.56) Therefore T h [f] = 2π l= c ln. c 0 = 1 2π f(x)dx = 1 2π 0 2π I[f]. (1.57) T h [f] = I[f] + 2π [c N + c N + c 2N + c 2N +...], tht is (1.58) T h [f] I[f] 2π [ c N + c N + c 2N + c 2N +...], So now, the relevnt question is how fst the Fourier coefficients c ln of f decy with N. The nswer is tied to the smoothness of f. Doing integrtion by prts in the formul (4.11) for the Fourier coefficients of f we hve c k = 1 [ 1 2π f (x)e ikx dx f(x)e ikx ] (1.59) 2π k 0 2π ik 0 0

16 CHAPTER 1. INTRODUCTION nd the lst term vnishes due to the periodicity of f(x)e ikx. Hence, (1.60) c k = 1 1 2π f (x)e ikx dx k 0. 2π ik 0 Integrting by prts m times we obtin (1.61) c k = 1 2π ( 1 ik ) m 2π f (m) (x)e ikx dx k 0, 0 where f (m) is the m-th derivtive of f. Therefore, for f C m [0, 2π] nd periodic (1.62) c k A m k m, where A m is constnt (depending only on m). Using this in (1.58) we get [ 2 T h [f] I[f] 2πA m N + 2 m (2N) + 2 ] m (3N) +... (1.63) m = 4πA [ m 1 + 1 N m 2 + 1 ] m 3 +..., m nd so for m > 1 we cn conclude tht (1.64) T h [f] I[f] C m N m. Thus, in this prticulr cse, the rte of convergence of the CTR t eqully spced points is not fixed (to 2). It depends on the number of derivtives of f nd we sy tht the ccurcy nd convergence of the pproximtion is spectrl. Note tht if f is smooth, i.e. f C [0, 2π] nd periodic, the CTR converges to the exct integrl t rte fster thn ny power of 1/N (or h)! This is clled super-lgebric convergence.

Chpter 2 Function Approximtion We sw in the introductory chpter tht one key step in the construction of numericl method to pproximte definite integrl is the pproximtion of the integrnd by simpler function, which we cn integrte exctly. The problem of function pproximtion is centrl to mny numericl methods: given continuous function f in n intervl [, b], we would like to find good pproximtion to it by simpler functions, such s polynomils, trigonometric polynomils, wvelets, rtionl functions, etc. We re going to mesure the ccurcy of n pproximtion using norms nd sk whether or not there is best pproximtion out of functions from given fmily of simpler functions. These re the min topics of this introductory chpter to Approximtion Theory. 2.1 Norms A norm on vector spce V over field K = R (or C) is mpping : V [0, ), which stisfy the following properties: (i) x 0 x V nd x = 0 iff x = 0. (ii) x + y x + y x, y V. (iii) λx = λ x x V, λ K. 17

18 CHAPTER 2. FUNCTION APPROXIMATION If we relx (i) to just x 0, we obtin semi-norm. We recll first some of the most importnt exmples of norms in the finite dimensionl cse V = R n (or V = C n ): (2.1) (2.2) (2.3) x 1 = x 1 +... + x n, x 2 = x 1 2 +... + x n 2, x = mx{ x 1,..., x n }. These re ll specil cses of the l p norm: (2.4) x p = ( x 1 p +... + x n p ) 1/p, 1 p. If we hve weights w i > 0 for i = 1,..., n we cn lso define weighted p norm by (2.5) x w,p = (w 1 x 1 p +... + w n x n p ) 1/p, 1 p. All norms in finite dimensionl spce V re equivlent, in the sense tht there re two constnts c nd C such tht (2.6) (2.7) x α C x β, x β c x α, for ll x V nd for ny two norms α nd β defined in V. If V is spce of functions defined on intervl [, b], for exmple C[, b], the corresponding norms to (2.1)-(2.4) re given by (2.8) (2.9) (2.10) (2.11) u 1 = u(x) dx, ( 1/2 u 2 = u(x) dx) 2, u = sup u(x), x [,b] ( 1/p u p = u(x) dx) p, 1 p nd re clled the L 1, L 2, L, nd L p norms, respectively. Similrly to (2.5) we cn defined weighted L p norm by (2.12) ( 1/p u p = w(x) u(x) dx) p, 1 p,

2.2. UNIFORM POLYNOMIAL APPROXIMATION 19 where w is given positive weight function defined in [, b]. If w(x) 0, we get semi-norm. Lemm 1. Let be norm on vector spce V then (2.13) x y x y. This lemm implies tht norm is continuous function (on V to R). Proof. x = x y + y x y + y which gives tht (2.14) x y x y. By reversing the roles of x nd y we lso get (2.15) y x x y. 2.2 Uniform Polynomil Approximtion There is fundmentl result in pproximtion theory, which sttes tht ny continuous function cn be pproximted uniformly, i.e. using the norm, with rbitrry ccurcy by polynomil. This is the celebrted Weierstrss Approximtion Theorem. We re going to present constructive proof due to Sergei Bernstein, which uses clss of polynomils tht hve found widespred pplictions in computer grphics nd nimtion. Historiclly, the use of these so-clled Bernstein polynomils in computer ssisted design (CAD) ws introduced by two engineers working in the French cr industry: Pierre Bézier t Renult nd Pul de Cstelju t Citroën. 2.2.1 Bernstein Polynomils nd Bézier Curves Given function f on [0, 1], the Bernstein polynomil of degree n 1 is defined by (2.16) B n f(x) = f k=0 ( k n ) ( ) n x k (1 x) n k, k

20 CHAPTER 2. FUNCTION APPROXIMATION where (2.17) ( ) n = k n! (n k)!k!, k = 0,..., n re the binomil coefficients. Note tht B n f(0) = f(0) nd B n f(1) = f(1) for ll n. The terms ( ) n (2.18) b k,n (x) = x k (1 x) n k, k = 0,..., n k which re ll nonnegtive, re clled the Bernstein bsis polynomils nd cn be viewed s x-dependent weights tht sum up to one: (2.19) b k,n (x) = k=0 k=0 ( ) n x k (1 x) n k = [x + (1 x)] n = 1. k Thus, for ech x [0, 1], B n f(x) represents weighted verge of the vlues of f t 0, 1/n, 2/n,..., 1. Moreover, s n increses the weights b k,n (x) concentrte more nd more round the points k/n close to x s Fig. 2.1 indictes for b k,n (0.25) nd b k,n (0.75). For n = 1, the Bernstein polynomil is just the stright line connecting f(0) nd f(1), B 1 f(x) = (1 x)f(0)+xf(1). Given two points P 0 = (x 0, y 0 ) nd P 1 = (x 1, y 1 ), the segment of the stright line connecting them cn be written in prmetric form s (2.20) B 1 (t) = (1 t)p 0 + t P 1, t [0, 1]. With three points, P 0, P 1, P 2, we cn employ the qudrtic Bernstein bsis polynomils to get more useful prmetric curve (2.21) B 2 (t) = (1 t) 2 P 0 + 2t(1 t)p 1 + t 2 P 2, t [0, 1]. This curve connects gin P 0 nd P 2 but P 1 cn be used to control how the curve bends. More precisely, the tngents t the end points re B 2(0) = 2(P 1 P 0 ) nd B 2(1) = 2(P 2 P 1 ), which intersect t P 1, s Fig. 2.2 illustrtes. These prmetric curves formed with the Bernstein bsis polynomils re clled Bézier curves nd hve been widely employed in computer grphics, specilly in the design of vector fonts, nd in computer nimtion. To llow the representtion of complex shpes, qudrtic or cubic Bézier curves

2.2. UNIFORM POLYNOMIAL APPROXIMATION 21 0.14 0.12 0.1 0.08 0.06 0.04 b k,n (0.25) b k,n (0.75) 0.02 0 0 10 20 30 40 50 k Figure 2.1: The Bernstein weights b k,n (x) for x = 0.25 ( )nd x = 0.75 ( ), n = 50 nd k = 1... n. P 1 P 0 P 2 Figure 2.2: Qudrtic Bézier curve.

22 CHAPTER 2. FUNCTION APPROXIMATION re pieced together to form composite Bézier curves. To hve some degree of smoothness (C 1 ), the common point for two pieces of composite Bézier curve hs to lie on the line connecting the two djcent control points on either side. For exmple, the TrueType font used in most computers tody is generted with composite, qudrtic Bézier curves while the Metfont used in these pges, vi L A TEX, employs composite, cubic Bézier curves. For ech chrcter, mny pieces of Bézier re stitched together. Let us now do some lgebr to prove some useful identities of the Bernstein polynomils. First, for f(x) = x we hve, (2.22) ( ) k n x k (1 x) n k kn! = n k n(n k)!k! xk (1 x) n k k=1 ( ) n 1 = x x k 1 (1 x) n k k 1 k=1 n 1 ( ) n 1 = x x k (1 x) n 1 k k k=0 k=0 = x [x + (1 x)] n 1 = x. Now for f(x) = x 2, we get (2.23) k=0 ( ) 2 ( ) k n x k (1 x) n k = n k k=1 ( ) k n 1 x k (1 x) n k n k 1 nd writing (2.24) k n = k 1 n + 1 n = n 1 n k 1 n 1 + 1 n,

2.2. UNIFORM POLYNOMIAL APPROXIMATION 23 we hve ( ) 2 ( ) k n x k (1 x) n k = n 1 n k n k=0 + 1 n k=1 = n 1 n = n 1 n ( ) k 1 n 1 x k (1 x) n k n 1 k 1 k=2 ( ) n 1 x k (1 x) n k k 1 ( ) n 2 x k (1 x) n k + x k 2 n k=2 n 2 ( ) n 2 x2 x k (1 x) n 2 k + x n. k=0 k Thus, (2.25) k=0 ( ) 2 ( ) k n x k (1 x) n k = n 1 n k n x2 + x n. Now, expnding ( k n x) 2 nd using (2.19), (2.22), nd (2.25) it follows tht (2.26) k=0 ( k n x ) 2 ( n k ) x k (1 x) n k = 1 x(1 x). n 2.2.2 Weierstrss Approximtion Theorem Theorem 1. (Weierstrss Approximtion Theorem) Let f be continuous function in [, b]. Given ɛ > 0 there is polynomil p such tht mx f(x) p(x) < ɛ. x b Proof. We re going to work on the intervl [0, 1]. For generl intervl [, b], we consider the simple chnge of vribles x = + (b )t for t [0, 1] so tht F (t) = f( + (b )t) is continuous in [0, 1]. Using (2.19), we hve (2.27) f(x) B n f(x) = k=0 [ f(x) f ( k n )] ( ) n x k (1 x) n k. k

24 CHAPTER 2. FUNCTION APPROXIMATION Since f is continuous in [0, 1], it is lso uniformly continuous. Thus, given ɛ > 0 there is δ(ɛ) > 0, independent of x, such tht (2.28) Moreover, f(x) f(k/n) < ɛ 2 if x k/n < δ. (2.29) f(x) f(k/n) 2 f for ll x [0, 1], k = 0, 1,..., n. We now split the sum in (2.27) in two sums, one over the points such tht k/n x < δ nd the other over the points such tht k/n x δ: (2.30) f(x) B n f(x) = k/n x <δ + k/n x δ [ f(x) f [ f(x) f ( )] ( k n n k ( )] ( k n n k ) x k (1 x) n k ) x k (1 x) n k. Using (2.28) nd (2.19) it follows immeditely tht the first sum is bounded by ɛ/2. For the second sum we hve (2.31) k/n x δ ( ) ( k n f(x) f n k ( n 2 f k 2 f δ 2 2 f δ 2 k/n x δ k/n x δ k=0 ( k n x ) x k (1 x) n k ) x k (1 x) n k ( k n x ) 2 ( n k = 2 f x(1 x) f nδ 2 2nδ. 2 ) 2 ( n k ) x k (1 x) n k ) x k (1 x) n k Therefore, there is N such tht for ll n N the second sum in (2.30) is bounded by ɛ/2 nd this completes the proof.

2.3. BEST APPROXIMATION 25 2.3 Best Approximtion We just sw tht ny continuous function f on closed intervl cn be pproximted uniformly with rbitrry ccurcy by polynomil. Idelly we would like to find the closest polynomil, sy of degree t most n, to the function f when the distnce is mesured in the supremum (infinity) norm, or in ny other norm we choose. There re three importnt elements in this generl problem: the spce of functions we wnt to pproximte, the norm, nd the fmily of pproximting functions. The following definition mkes this more precise. Definition 3. Given normed liner spce V nd subspce W of V, p W is clled the best pproximtion of f V by elements in W if (2.32) f p f p, for ll p W. For exmple, the normed liner spce V could be C[, b] with the supremum norm (2.10) nd W could be the set of ll polynomils of degree t most n, which henceforth we will denote by P n. Theorem 2. Let W be finite-dimensionl subspce of normed liner spce V. Then, for every f V, there is t lest one best pproximtion to f by elements in W. Proof. Since W is subspce 0 W nd for ny cndidte p W for best pproximtion to f we must hve (2.33) f p f 0 = f. Therefore we cn restrict our serch to the set (2.34) F = {p W : f p f }. F is closed nd bounded nd becuse W is finite-dimensionl it follows tht F is compct. Now, the function p f p is continuous on this compct set nd hence it ttins its minimum in F. If we remove the finite-dimensionlity of W then we cnnot gurntee tht there is best pproximtion s the following exmple shows.

26 CHAPTER 2. FUNCTION APPROXIMATION Exmple 4. Let V = C[0, 1/2] nd W be the spce of ll polynomils (clerly of subspce of V ). Tke f(x) = 1/(1 x). Then, given ɛ > 0 there is N such tht (2.35) mx 1 x [0,1/2] 1 x (1 + x + x2 +... + x N ) < ɛ. So if there is best pproximtion p in the mx norm, necessrily f p = 0, which implies (2.36) which is impossible. p (x) = 1 1 x, Theorem 2 does not gurntee uniqueness of best pproximtion. Strict convexity of the norm gives us sufficient condition. Definition 4. A norm on vector spce V is strictly convex if for ll f g in V with f = g = 1 then θf + (1 θ)g < 1, for ll 0 < θ < 1. In other words, norm is strictly convex if its unit bll is strictly convex. The p-norm is strictly convex for 1 < p < but not for p = 1 or p =. Theorem 3. Let V be vector spce with strictly convex norm, W subspce of V, nd f V. If p nd q re best pproximtions of f in W then p = q. Proof. Let M = f p = f q, if p q by the strict convexity of the norm (2.37) θ(f p ) + (1 θ)(f q ) < M, for ll 0 < θ < 1. Tking θ = 1/2 we get (2.38) f 1 2 (p + q ) < M, which is impossible becuse 1 2 (p + q ) is in W nd cnnot be better pproximtion.

2.3. BEST APPROXIMATION 27 2.3.1 Best Uniform Polynomil Approximtion Given continuous function f on intervl [, b] we know there is t lest one best pproximtion p n to f, in ny given norm, by polynomils of degree t most n becuse the dimension of P n is finite. The norm is not strictly convex so Theorem 3 does not pply. However, due to specil property (clled the Hr property) of the liner spce P n, which is tht the only element of P n tht hs more thn n roots is the zero element, it is possible to prove tht the best pproximtion is unique. The crux of the mtter is tht error function (2.39) e n (x) = f(x) p n(x), x [, b], hs to equioscillte t lest n+2 points, between + e n nd e n. Tht is, there re k points, x 1, x 2,..., x k, with k n + 2, such tht (2.40) e n (x 1 ) = ± e n e n (x 2 ) = e n (x 1 ), e n (x 3 ) = e n (x 2 ),. e n (x k ) = e n (x k 1 ), for if not, it would be possible to find polynomil of degree t most n, with the sme sign t the extrem of e n (t most n sign chnges), nd use this polynomil to decrese the vlue of e n. This would contrdict the fct tht p n is best pproximtion. This is esy to see for n = 0 s it is impossible to find polynomil of degree 0 ( constnt) with one chnge of sign. This is the content of the next result. Theorem 4. The error e n = f p n hs t lest two extrem x 1 nd x 2 in [, b] such tht e n (x 1 ) = e n (x 2 ) = e n nd e n (x 1 ) = e n (x 2 ) for ll n 0. Proof. The continuous function e n (x) ttins its mximum e n in t lest one point x 1 in [, b]. Suppose e n = e n (x 1 ) nd tht e n (x) > e n for ll x [, b]. Then, m = min x [,b] e n (x) > e n nd we hve some room to decrese e n by shifting down e n suitble mount c. In prticulr, if tke c s one hlf the gp between the minimum m of e n nd e n, (2.41) c = 1 2 (m + e n ) > 0,

28 CHAPTER 2. FUNCTION APPROXIMATION 0 e n (x) c e n (x) Figure 2.3: If the error function e n does not equioscillte t lest twice we could lower e n by n mount c > 0. nd subtrct it to e n, s shown in Fig. 2.3, we hve (2.42) e n + c e n (x) c e n c. Therefore, e n c = f (p n+c) = e n c < e n but p n+c P n so this is impossible since p n is best pproximtion. A similr rgument cn used when e n (x 1 ) = e n. Before proceeding to the generl cse, let us look t the n = 1 sitution. Suppose there only two lternting extrem x 1 nd x 2 for e 1 s described in (2.40). We re going to construct liner polynomil tht hs the sme sign s e 1 t x 1 nd x 2 nd which cn be used to decrese e 1. Suppose e 1 (x 1 ) = e 1 nd e 1 (x 2 ) = e 1. Since e 1 is continuous, we cn find smll closed intervls I 1 nd I 2, contining x 1 nd x 2, respectively, nd such tht (2.43) (2.44) e 1 (x) > e 1 2 e 1 (x) < e 1 2 for ll x I 1, for ll x I 2. Clerly I 1 nd I 2 re disjoint sets so we cn choose point x 0 between the two intervls. Then, it is possible to find liner polynomil q tht psses through x 0 nd tht is positive in I 1 nd negtive in I 2. We re now going

2.3. BEST APPROXIMATION 29 to find suitble constnt α > 0 such tht f p 1 αq < e 1. Since p 1 + αq P 1 this would be contrdiction to the fct tht p 1 is best pproximtion. Let R = [, b] \ (I 1 I 2 ) nd d = mx x R e 1 (x). Clerly d < e 1. Choose α such tht (2.45) On I 1, we hve 0 < α < 1 2 q ( e 1 d). (2.46) 0 < αq(x) < 1 2 q ( e 1 d) q(x) 1 2 ( e 1 d) < e 1 (x). Therefore (2.47) e 1 (x) αq(x) = e 1 (x) αq(x) < e 1, for ll x I 1. Similrly, on I 2, we cn show tht e 1 (x) αq(x) < e 1. Finlly, on R we hve (2.48) e 1 (x) αq(x) e 1 (x) + αq(x) d + 1 2 ( e 1 d) < e 1. Therefore, e 1 αq = f (p 1 + αq) < e 1, which contrdicts the best pproximtion ssumption on p 1. Theorem 5. (Chebyshev Equioscilltion Theorem) Let f C[, b]. Then, p n in P n is best uniform pproximtion of f if nd only if there re t lest n + 2 points, where the error e n = f p n equioscilltes between the vlues ± e n s defined in (2.40). Proof. We first prove tht if the error e n = f p n, for some p n P n, equioscilltes t lest n + 2 times then p n is best pproximtion. Suppose the contrry. Then, there is q n P n such tht (2.49) f q n < f p n. Let x 1,..., x k, with k n + 2, be the points where e n equioscilltes. Then (2.50) f(x j ) q n (x j ) < f(x j ) p n(x j ), j = 1,..., k

30 CHAPTER 2. FUNCTION APPROXIMATION nd since (2.51) f(x j ) p n(x j ) = [f(x j+1 ) p n(x j+1 )], j = 1,..., k 1 we hve tht (2.52) q n (x j ) p n(x j ) = f(x j ) p n(x j ) [f(x j ) q n (x j )] chnges signs k 1 times, i.e. t lest n + 1 times. But q n p n P n. Therefore q n = p n, which contrdicts (2.49), nd consequently p n hs to be best uniform pproximtion of f. For the other hlf of the proof the ide is the sme s for n = 1 but we need to do more bookkeeping. We re going to prtition [, b] into the union of sufficiently smll subintervls so tht we cn gurntee tht e n (t) e n (s) e n /2 for ny two points t nd s in ech of the subintervls. Let us lbel by I 1,..., I k, the subintervls on which e n (x) chieves its mximum e n. Then, on ech of these subintervls either e n (x) > e n /2 or e n (x) < e n /2. We need to prove tht e n chnges sign t lest n + 1 times. Going from left to right, we cn lbel the subintervls I 1,..., I k s (+) or ( ) subintervl depending on the sign of e n. For definiteness, suppose I 1 is (+) subintervl then we hve the groups {I 1,..., I k1 }, (+) {I k1 +1,..., I k2 }, ( ). {I km+1,..., I k }, ( ) m. We hve m chnges of sign so let us ssume tht m n. We lredy know m 1. Since the sets, I kj nd I kj +1 re disjoint for j = 1,..., m, we cn select points t 1,..., t m, such tht t j > x for ll x I kj nd t j < x for ll x I kj +1. Then, the polynomil (2.53) q(x) = (t 1 x)(t 2 x) (t m x) hs the sme sign s e n in ech of the extreml intervls I 1,..., I k nd q P n. The rest of the proof is s in the n = 1 cse to show tht p n + αq would be better pproximtion to f thn p n. Theorem 6. Let f C[, b]. The best uniform pproximtion p n to f by elements of P n is unique.

2.4. CHEBYSHEV POLYNOMIALS 31 Proof. Suppose q n is lso best pproximtion, i.e. e n = f p n = f q n. Then, the midpoint r = 1 2 (p n + q n) is lso best pproximtion, for r P n nd (2.54) f r = 1 2 (f p n) + 1 2 (f q n) 1 2 f p n + 1 2 f q n = e n. Let x 1,..., x n+2 be extreml points of f r with the lternting property (2.40), i.e. f(x j ) r(x j ) = ( 1) m+j e n for some integer m nd j = 1,... n + 2. This implies tht (2.55) f(x j ) p n(x j ) 2 + f(x j) q n(x j ) 2 = ( 1) m+j e n, j = 1,..., n + 2. But f(x j ) p n(x j ) e n nd f(x j ) q n(x j ) e n. As consequence, (2.56) f(x j ) p n(x j ) = f(x j ) qn(x j ) = ( 1) m+j e n, j = 1,..., n + 2, nd it follows tht (2.57) p n(x j ) = q n(x j ), j = 1,..., n + 2 Therefore, q n = p n. 2.4 Chebyshev Polynomils The best uniform pproximtion of f(x) = x n+1 in [ 1, 1] by polynomils of degree t most n cn be found explicitly nd the solution introduces one of the most useful nd remrkble polynomils, the Chebyshev polynomils. Let p n P n be the best uniform pproximtion to x n+1 in the intervl [ 1, 1] nd s before define the error function s e n (x) = x n+1 p n(x). Note tht since e n is monic polynomil (its leding coefficient is 1) of degree

32 CHAPTER 2. FUNCTION APPROXIMATION n + 1, the problem of finding p n is equivlent to finding, mong ll monic polynomils of degree n + 1, the one with the smllest devition (in bsolute vlue) from zero. According to Theorem 5, there exist n + 2 distinct points, (2.58) 1 x 1 < x 2 < < x n+2 1, such tht (2.59) e 2 n(x j ) = e n 2, for j = 1,..., n + 2. Now consider the polynomil (2.60) q(x) = e n 2 e 2 n(x). Then, q(x j ) = 0 for j = 1,..., n+2. Ech of points x j in the interior of [ 1, 1] is lso locl minimum of q, then necessrily q (x j ) = 0 for j = 2,... n + 1. Thus, the n points x 2,..., x n+1 re zeros of q of multiplicity t lest two. But q is nonzero polynomil of degree 2n + 2 exctly. Therefore, x 1 nd x n+2 hve to be simple zeros nd so x 1 = 1 nd x n+1 = 1. Note tht the polynomil p(x) = (1 x 2 )[e n(x)] 2 P 2n+2 hs the sme zeros s q nd so p = cq, for some constnt c. Compring the coefficient of the leding order term of p nd q it follows tht c = (n + 1) 2. Therefore, e n stisfies the ordinry differentil eqution (2.61) (1 x 2 )[e n(x)] 2 = (n + 1) 2 [ e n 2 e 2 n(x) ]. We know e n P n nd its n zeros re the interior points x 2,..., x n+1. Therefore, e n cnnot chnge sign in [ 1, x 2 ]. Suppose it is nonnegtive for x [ 1, x 2 ] (we rech the sme conclusion if we ssume e n(x) 0) then, tking squre roots in (2.61) we get (2.62) e n(x) en 2 e 2 n(x) = n + 1, for x [ 1, x 2]. 1 x 2 Using the trigonometric substitution x = cos θ, we cn integrte to obtin (2.63) e n (x) = e n cos[(n + 1)θ], for x = cos θ [ 1, x 2 ] with 0 < θ π, where we hve chosen the constnt of integrtion to be zero so tht e n (1) = e n. Recll tht e n is polynomil of degree n + 1 then so is cos[(n + 1) cos 1 x]. Since these two polynomils gree in [ 1, x 2 ], (2.63) must lso hold for ll x in [ 1, 1].

2.4. CHEBYSHEV POLYNOMIALS 33 Definition 5. The Chebyshev polynomil (of the first kind) of degree n, T n is defined by (2.64) T n (x) = cos nθ, x = cos θ, 0 θ π. Note tht (2.64) only defines T n for x [ 1, 1]. However, once the coefficients of this polynomil re determined we cn define it for ny rel (or complex) x. Using the trigonometry identity (2.65) cos[(n + 1)θ] + cos[(n 1)θ] = 2 cos nθ cos θ, we immeditely get (2.66) T n+1 (cos θ) + T n 1 (cos θ) = 2T n (cos θ) cos θ nd going bck to the x vrible we obtin the recursion formul (2.67) T 0 (x) = 1, T 1 (x) = x, T n+1 (x) = 2xT n (x) T n 1 (x), n 1, which mkes it more evident the T n for n = 0, 1,... re indeed polynomils of exctly degree n. Let us generte few of them. (2.68) T 0 (x) = 1, T 1 (x) = x, T 2 (x) = 2x x 1 = 2x 2 1, T 3 (x) = 2x (2x 2 1) x = 4x 3 3x, T 4 (x) = 2x(4x 3 3x) (2x 2 1) = 8x 4 8x 2 + 1 T 5 (x) = 2x(8x 4 8x 2 + 1) (4x 3 3x) = 16x 5 20x 3 + 5x. From these few Chebyshev polynomils, nd from (2.67), we see tht (2.69) T n (x) = 2 n 1 x n + lower order terms nd tht T n is n even (odd) function of x if n is even (odd), i.e. (2.70) T n ( x) = ( 1) n T n (x).

34 CHAPTER 2. FUNCTION APPROXIMATION Going bck to (2.63), since the leding order coefficient of e n is 1 nd tht of T n+1 is 2 n, it follows tht e n = 2 n. Therefore (2.71) p n(x) = x n+1 1 2 n T n+1(x) is the best uniform pproximtion of x n+1 in [ 1, 1] by polynomils of degree t most n. Equivlently, s noted in the beginning of this section, the monic polynomil of degree n with smllest infinity norm in [ 1, 1] is (2.72) T n (x) = 1 2 n 1 T n(x). Hence, for ny other monic polynomil p of degree n (2.73) mx p(x) > 1 x [ 1,1] 2. n 1 The zeros nd extrem of T n re esy to find. Becuse T n (x) = cos nθ nd 0 θ π, the zeros occur when θ is n odd multiple of π/2. Therefore, ( ) (2j + 1) π (2.74) x j = cos j = 0,..., n 1. n 2 The extrem of T n (the points x where T n (x) = ±1) correspond to nθ = jπ for j = 0, 1,..., n, tht is ( ) jπ (2.75) x j = cos, j = 0, 1,..., n. n These points re clled Chebyshev or Guss-Lobtto points nd re extremely useful in pplictions. Note tht x j for j = 1,..., n 1 re locl extrem. Therefore (2.76) T n(x j ) = 0, for j = 1,..., n 1. In other words, the Chebyshev points (2.75) re the n 1 zeros of T n plus the end points x 0 = 1 nd x n = 1. Using the Chin Rule we cn differentite T n with respect to x we get (2.77) T n(x) = n sin nθ dθ dx = nsin nθ sin θ, (x = cos θ).

2.4. CHEBYSHEV POLYNOMIALS 35 Therefore (2.78) T n+1(x) n + 1 T n 1(x) n 1 = 1 [sin(n + 1)θ sin(n 1)θ] sin θ nd since sin(n + 1)θ sin(n 1)θ = 2 sin θ cos nθ, we get tht (2.79) The polynomil T n+1(x) n + 1 T n 1(x) n 1 = 2T n(x). (2.80) U n (x) = T n+1(x) n + 1 sin(n + 1)θ =, (x = cos θ) sin θ of degree n is clled the Chebyshev polynomil of second kind. Thus, the Chebyshev nodes (2.75) re the zeros of the polynomil (2.81) q n+1 (x) = (1 x 2 )U n 1 (x).

36 CHAPTER 2. FUNCTION APPROXIMATION

Chpter 3 Interpoltion 3.1 Polynomil Interpoltion One of the bsic tools for pproximting function or given dt set is interpoltion. In this chpter we focus on polynomil nd piece-wise polynomil interpoltion. The polynomil interpoltion problem cn be stted s follows: Given n+1 dt points, (x 0, f 0 ), (x 1, f 1 )..., (x n, f n ), where x 0, x 1,..., x n re distinct, find polynomil p n P n, which stisfies the interpoltion property: p n (x 0 ) = f 0, p n (x 1 ) = f 1,. p n (x n ) = f n. The points x 0, x 1,..., x n re clled interpoltion nodes nd the vlues f 0, f 1,..., f n re dt supplied to us or cn come from function f we re trying to pproximte, in which cse f j = f(x j ) for j = 0, 1,..., n. Let us represent such polynomil s p n (x) = 0 + 1 x + + n x n. Then, the interpoltion property implies 0 + 1 x 0 + + n x n 0 = f 0, 0 + 1 x 1 + + n x n 1 = f 1,. 37

38 CHAPTER 3. INTERPOLATION 0 + 1 x n + + n x n n = f n. This is liner system of n + 1 equtions in n + 1 unknowns (the polynomil coefficients 0, 1,..., n ). In mtrix form: (3.1) 1 x 0 x 2 0 x n 0 0 f 0 1 x 1 x 2 1 x n 1 1.. = f 1. 1 x n x 2 n x n n n f n. Does this liner system hve solution? Is this solution unique? The nswer is yes to both. Here is simple proof. Tke f j = 0 for j = 0, 1,..., n. Then p n (x j ) = 0, for j = 0, 1,..., n but p n is polynomil of degree t most n, it cnnot hve n + 1 zeros unless p n 0, which implies 0 = 1 = = n = 0. Tht is, the homogenous problem ssocited with (3.1) hs only the trivil solution. Therefore, (3.1) hs unique solution. Exmple 5. As n illustrtion let us consider interpoltion by liner polynomil, p 1. Suppose we re given (x 0, f 0 ) nd (x 1, f 1 ). We hve written p 1 explicitly in the Introduction, we write it now in different form: (3.2) p 1 (x) = x x 1 x 0 x 1 f 0 + x x 0 x 1 x 0 f 1. Clerly, this polynomil hs degree t most 1 nd stisfies the interpoltion property: (3.3) (3.4) p 1 (x 0 ) = f 0, p 1 (x 1 ) = f 1. Exmple 6. Given (x 0, f 0 ), (x 1, f 1 ), nd (x 2, f 2 ) let us construct p 2 P 2 tht interpoltes these points. The wy we hve written p 1 in (3.2) is suggestive of how to explicitly write p 2 : p 2 (x) = (x x 1)(x x 2 ) (x 0 x 1 )(x 0 x 2 ) f 0 + (x x 0)(x x 2 ) (x 1 x 0 )(x 1 x 2 ) f 1 + (x x 0)(x x 1 ) (x 2 x 0 )(x 2 x 1 ) f 2.

3.1. POLYNOMIAL INTERPOLATION 39 If we define (3.5) (3.6) (3.7) l 0 (x) = (x x 1)(x x 2 ) (x 0 x 1 )(x 0 x 2 ), l 1 (x) = (x x 0)(x x 2 ) (x 1 x 0 )(x 1 x 2 ), l 2 (x) = (x x 0)(x x 1 ) (x 2 x 0 )(x 2 x 1 ), then we simply hve (3.8) p 2 (x) = l 0 (x)f 0 + l 1 (x)f 1 + l 2 (x)f 2. Note tht ech of the polynomils (3.5), (3.6), nd (3.7) re exctly of degree 2 nd they stisfy l j (x k ) = δ jk 1. Therefore, it follows tht p 2 given by (3.8) stisfies the interpoltion property (3.9) p 2 (x 0 ) = f 0, p 2 (x 1 ) = f 1, p 2 (x 2 ) = f 2. We cn now write down the polynomil of degree t most n tht interpoltes n + 1 given vlues, (x 0, f 0 ),..., (x n, f n ), where the interpoltion nodes x 0,..., x n re ssumed distinct. Define (3.10) l j (x) = (x x 0) (x x j 1 )(x x j+1 ) (x x n ) (x j x 0 ) (x j x j 1 )(x j x j+1 ) (x j x n ) n (x x k ) =, for j = 0, 1,..., n. (x j x k ) k=0 k j These re clled the elementry Lgrnge polynomils of degree n. For simplicity, we re omitting their dependence on n in the nottion. Since l j (x k ) = δ jk, we hve tht (3.11) p n (x) = l 0 (x)f 0 + l 1 (x)f 1 + + l n (x)f n = l j (x)f j j=0 1 δ jk is the Kronecker delt, i.e. δ jk = 0 if k j nd 1 if k = j.