Chapter 10 Function Approximation

Chapter 10 Function Approximation

Chapter 10 Function approximation We have studied methods for computing solutions to algebraic equations in the form of real numbers or finite dimensional vectors of real numbers. In contrast, solutions to di↵erential equations are scalar or vector valued functions, which only in simple special cases are analytical functions that can be expressed by a closed mathematical formula. Instead we use the idea to approximate general functions by linear com- binations of a finite set of simple analytical functions, for example trigono- metric functions, splines or polynomials, for which attractive features are orthogonality and locality. We focus in particular on piecewise polynomi- als defined by the finite set of nodes of a mesh, which exhibit both near orthogonality and local support. 10.1 Function approximation The Lebesgue space L2(I) Inner product spaces provide tools for approximation based on orthogonal projections on subspaces. We now introduce an inner product space for functions on the interval I =[a, b], the Lebesgue space L2(I), defined as the class of all square integrable functions f : I R, ! b L2(I)= f : f(x) 2 dx < . (10.1) { | | 1} Za The vector space L2(I)isclosedunderthebasicoperationsofpointwise addition and scalar multiplication, by the inequality, (a + b)2 2(a2 + b2), a, b 0, (10.2) 8 ≥ which follows from Young’s inequality. 97 98 CHAPTER 10. FUNCTION APPROXIMATION Theorem 17 (Young’s inequality). For a, b 0 and ✏>0, ≥ 1 ✏ ab a2 + b2 (10.3) 2✏ 2 Proof. 0 (a ✏b)2 = a2 + ✏2b2 2ab✏. − − The L2-inner product is defined by b (f,g)=(f,g)L2(I) = f(x)g(x) dx, (10.4) Za with the associated L2 norm, b 1/2 1/2 2 f = f 2 =(f,f) = f(x) dx , (10.5) k k k kL (I) | | ✓Za ◆ for which the Cauchy-Schwarz inequality is satisfied, (f,g) f g . (10.6) | |k kk k Approximation of functions in L2(I) We seek to approximate a function f in a vector space V ,byalinear combination of functions φ n V ,thatis { j}j=1 ⇢ n f(x) f (x)= ↵ φ (x), (10.7) ⇡ n j j j=1 X n with ↵j R.Iflinearlyindependent,theset φj j=1 spans a finite dimen- sional subspace2 S V , { } ⇢ n S = fn V : fn = ↵jφj(x),↵j R , (10.8) { 2 2 } j=1 X with the set φ n abasisforS.Forexample,inaFourier series the basis { j}j=1 functions φj are trigonometric functions, in a power series monomials. The question is now how to determine the coordinates ↵j so that fn(x) is a good approximation of f(x). One approach to the problem is to use the techniques of orthogonal projections previously studied for vectors in n R , an alternative approach is interpolation, where ↵j are chosen such that fn(xi)=f(xi), in a set of nodes xi,fori =1,...,n.Ifwecannotevaluate the function f(x)inarbitrarypointsx,butonlyhaveaccesstoasetof sampled data points (x ,f) m ,withm n, we can formulate a least { i i }i=1 ≥ squares problem to determine the coordinates ↵j that minimize the error f(x ) f ,inasuitablenorm. i − i 10.1. FUNCTION APPROXIMATION 99 L2 projection The L2 projection Pf,ontothesubspaceS V ,definedby(10.8),ofa function f V ,withV = L2(I), is the orthogonal⇢ projection of f on S, that is, 2 (f Pf,s)=0, s S, (10.9) − 8 2 which corresponds to, n ↵ (φ ,φ )=(f,φ ), i =1,...,n. (10.10) j i j i 8 j=1 X By solving the matrix equation Ax = b,withaij =(φi,φj), xj = ↵j, and bi =(f,φi), we obtain the L2 projection as n Pf(x)= ↵jφj(x). (10.11) j=1 X We note that if φi(x)haslocal support,thatisφi(x) =0onlyfora subinterval of I,thenthematrixA is sparse, and for φ n an6 orthonormal { i}i=1 basis, A is the identity matrix with ↵j =(f,φj). Interpolation The interpolant ⇡f S,isdeterminedbytheconditionthat⇡f(xi)=f(xi), for n nodes x n .Thatis,2 { i}i=1 n f(xi)=⇡f(xi)= ↵jφj(xi),i=1,...,n, (10.12) j=1 X which corresponds to the matrix equation Ax = b,withaij = φj(xi), xj = ↵j,andbi = f(xi). The matrix A is an identity matrix under the condition that φj(xi)=1, for i = j,andzeroelse.Wethenreferto φ n as a nodal basis,forwhich { i}i=1 ↵j = f(xj), and we can express the interpolant as n n ⇡f(x)= ↵jφj(x)= f(xj)φj(x). (10.13) j=1 j=1 X X 100 CHAPTER 10. FUNCTION APPROXIMATION Regression If we cannot evaluate the function f(x)inarbitrarypoints,butonlyhave m access to a set of data points (xi,fi) i=1,withm n,wecanformulate the least squares problem, { } ≥ n min f f (x ) =min f ↵ φ (x ) ,i=1,...,m, (10.14) i n i n i j j i fn S k − k ↵j k − k 2 { }j=1 j=1 X which corresponds to minimization of the residual b Ax,witha = φ (x ), − ij j i bi = fi,andxj = ↵j,whichwecansolve,forexample,byformingthenormal equations, AT Ax = AT b. (10.15) 10.2 Piecewise polynomial approximation Polynomial spaces We introduce the vector space q(I), defined by the set of polynomials P q p(x)= c xi,xI, (10.16) i 2 i=0 X of at most order q on an interval I R,withthebasisfunctionsxi and 2 coordinates ci,andthebasicoperationsofpointwiseadditionandscalar multiplication, (p + r)(x)=p(x)+r(x), (↵p)(x)=↵p(x), (10.17) for p, r q(I)and↵ R.Onebasisfor q(I)isthesetofmonomials xi q ,anotheris2P (x 2c)i q ,whichgivestheP power series, { }i=0 { − }i=0 q p(x)= a (x c)i = a + a (x c)+... + a (x c)q, (10.18) i − 0 1 − q − i=0 X for c I, with a Taylor series being an example of a power series, 2 1 2 f(x)=f(y)+f 0(y)(x y)+ f 00(y)(x y) + ... (10.19) − 2 − 10.2. PIECEWISE POLYNOMIAL APPROXIMATION 101 Langrange polynomials For a set of nodes x q , we define the Lagrange polynomials λ q ,by { i}i=0 { }i=0 (x x0) (x xi 1)(x xi+1) (x xq) x xj λi(x)= − ··· − − − ··· − = − , (xi x0) (xi xi 1)(xi xi+1) (xi xq) xi xj − i=j − ··· − − ··· − Y6 − that constitutes a basis for q(I), and we note that P λi(xj)=δij, (10.20) with the Dirac delta function defined as 1,i= j δij = (10.21) 0,i= j ( 6 q so that λ i=0 is a nodal basis, which we refer to as the Lagrange basis.We can express{ } any p q(I)as 2P q p(x)= p(xi)λi(x), (10.22) i=1 X and by (10.13) we can define the polynomial interpolant ⇡ f q(I), q 2P q ⇡ f(x)= f(x )λ (x),xI, (10.23) q i i 2 i=1 X for a continuous function f (I). 2C Piecewise polynomial spaces We now introduce piecewise polynomials defined over a partition of the interval I =[a, b], a = x <x < <x = b, (10.24) 0 1 ··· m+1 for which we let the mesh = I denote the set of subintervals I = Th { i} j (xi 1,xi)oflengthhi = xi xi 1,withthemesh function, − − − h(x)=h , for x I . (10.25) i 2 i We define two vector spaces of piecewise polynomials,thediscontinuous piecewise polynomials on I,definedby W (q) = v : v q(I ),i=1,...,m+1 , (10.26) h { |Ii 2P i } 102 CHAPTER 10. FUNCTION APPROXIMATION and the continuous piecewise polynomials on I,definedby V (q) = v W (q) : v (I) . (10.27) h { 2 h 2C } (q) The basis functions for Wh can be defined in terms of the Lagrange basis, for example, xi x xi x λi,0(x)= − = − (10.28) xi xi 1 hi − − x xi 1 x xi 1 λi,1(x)= − − = − − (10.29) xi xi 1 hi − − (1) defining the basis functions for Wh ,by 0,x=[xi 1,xi], φi,j(x)= 6 − (10.30) (λi,j,x [xi 1,xi], 2 − (q) for i =1,...,m+1,andj =0, 1. For Vh we need to construct continuous basis functions, for example, 0,x=[xi 1,xi+1], 6 − φi(x)= λi,1,x[xi 1,xi], (10.31) 8 2 − <>λi+1,0,x [xi,xi+1], 2 (1) :> for Vh , which we also refer to as hat functions. φi,1(x) φi(x) x x x0=a x1 x2 xi-1 xi xi+1 xm xm+1=b x0=a x1 x2 xi-1 xi xi+1 xm xm+1=b Figure 10.1: Illustration of a mesh h = Ii ,withsubintervalsIj = T { } (1) (xi 1,xi)oflengthhi = xi xi 1, and φi,1(x)abasisfunctionforWh − − − (1) (left), and a basis function φi(x)forVh (right). 10.2. PIECEWISE POLYNOMIAL APPROXIMATION 103 2 (1) L projection in Vh The L2 projection of a function f L2(I)ontothespaceofcontinuous (1) 2 piecewise linear polynomials Vh ,onasubdivisionoftheintervalI with n nodes, is given by n Pf(x)= ↵jφj(x), (10.32) j=1 X with the coordinates ↵j determined by from the matrix equation Mx = b, (10.33) with mij =(φj,φi), xj = ↵j,andbi =(f,φi). The matrix M is sparse, since mij =0for i j > 1, and for large n we need to use an iterative method to solve (10.33).| − | We compute the entries of the matrix M,referredtoas a mass matrix,fromthedefinitionofthebasisfunctions(10.31),starting with the diagonal entries, 1 xi xi+1 2 2 2 mii =(φi,φi)= φi (x) dx = λi,1(x) dx + λi+1,0(x) dx 0 xi 1 xi Z Z − Z xi 2 xi+1 2 (x xi 1) (xi+1 x) − = − 2 dx + 2− dx xi 1 hi xi hi+1 Z − Z 3 xi 3 xi+1 1 (x xi 1) 1 (xi+1 x) hi hi+1 = − − + − − = + , h2 3 h2 3 3 3 i xi 1 i+1 xi − and similarly we compute the o↵-diagonal entries, 1 xi+1 mii+1 =(φi,φi+1)= φi(x)φi+1(x) dx = λi+1,0(x)λi+1,1(x) dx Z0 Zxi xi+1 (x x) (x x ) = i+1 − − i dx h h Zxi i+1 i+1 1 xi+1 = (x x x x x2 + xx ) dx h2 i+1 − i+1 i − i i+1 Zxi 1 x x2 x3 x2x xi+1 = i+1 x x x + i h2 2 − i+1 i − 3 2 i+1 xi 1 3 2 2 3 = 2 (xi+1 3xi+1xi +3xi+1xi xi ) 6hi+1 − − 1 3 hi+1 = 2 (xi+1 xi) = , 6hi+1 − 6 and 1 hi mii 1 =(φi,φi 1)= φi(x)φi 1(x) dx = ..

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    23 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us