12.3 KB · commit a9602da
In the previous sections, we considered the least squares approximations of discrete data. We shall, in the present section, discuss the least squares approximation of a continuous function on [a,b]. The summations in the normal equations are now replaced by definite integrals.
Let y(x)=a0+a1x+a2x2+⋯+anxn(4.37) be chosen to minimize S(a0,a1,…,an)=∫abW(x)[y(x)−(a0+a1x+⋯+anxn)]2dx.(4.38) The necessary conditions for a minimum are given by ∂a0∂S=∂a1∂S=⋯=∂an∂S=0,(4.39) which yield
−2∫abW(x)[y(x)−(a0+a1x+a2x2+⋯+anxn)]dx−2∫abW(x)[y(x)−(a0+a1x+a2x2+⋯+anxn)]xdx−2∫abW(x)[y(x)−(a0+a1x+a2x2+⋯+anxn)]x2dx−2∫abW(x)[y(x)−(a0+a1x+a2x2+⋯+anxn)]xndx=0=0=0 ⋮=0.⎭⎬⎫(4.40)Rearrangement of terms in Eq. (4.40) gives the system
a0∫abW(x)dx+a1∫abxW(x)dx+⋯+an∫abxnW(x)dxa0∫abxW(x)dx+a1∫abx2W(x)dx+⋯+an∫abxn+1W(x)dxa0∫abxnW(x)dx+a1∫abxn+1W(x)dx+⋯+an∫abx2nW(x)dx=∫abW(x)y(x)dx=∫abxW(x)y(x)dx ⋮=∫abxnW(x)y(x)dx.⎭⎬⎫(4.41)The system in Eq. (4.41) comprises (n+1) normal equations in (n+1) unknowns, viz. a0,a1,a2,…,an and they always possess a 'unique' solution.
Solution: Let y=a0+a1x+a2x2(i) be the required quadratic approximation. Then using Eq. (4.41), we obtain the system
a0∫0π/2dx+a1∫0π/2xdx+a2∫0π/2x2dxa0∫0π/2xdx+a1∫0π/2x2dx+a2∫0π/2x3dxa0∫0π/2x2dx+a1∫0π/2x3dx+a2∫0π/2x4dx=∫0π/2sinxdx=∫0π/2xsinxdx=∫0π/2x2sinxdx.⎭⎬⎫(ii)Simplifying Eq. (ii), we obtain
a02π+a18π2+a224π3a08π2+a124π3+a264π4a024π3+a164π4+a2160π5=1=1=2(2π−1),whose solution is
a0a1a2=−π18+π296−π3480=−π2144−π31344+π45760=π3240+π42880−π511520.⎭⎬⎫(iii)The required quadratic approximation to y=sinx on [0,π/2] is then given by (i) and (iii), As a check, we obtain, at x=π/4, sinx≈−π3−π260+π3240=0.706167587.
The true value of sin(π/4)=0.707106781, so that the error in the preceding solution is 0.000939194. ◀
In the previous section, we have seen that the method of determining a least square approximation to a continuous function gives satisfactory results. However, this method possesses the disadvantage of solving a large linear system of equations. Besides, such a system may exhibit a peculiar tendency called ill-conditioning, which means that small change in any of its parameters introduces large errors in the solution—the degree of ill-conditioning increasing with the order of the system. Hence, alternative methods of solving the aforesaid least-squares problem have gained importance, and of these the method that employs 'orthogonal polynomials' is currently in use. This method possessess the great advantage that it does not require a linear system to be solved and is described below.
We choose the approximation in the form: Y(x)=a0f0(x)+a1f1(x)+⋯+anfn(x),(4.42) where fj(x) is a polynomial in x of degree j.
Then, we write S(a0,a1,…,an)=∫abW(x){y(x)−[a0f0(x)+a1f1(x)+⋯+anfn(x)]}2dx.(4.43) For S to be minimum, we must have
∂a0∂S∂a1∂S∂an∂S=0=−2∫abW(x){y(x)−[a0f0(x)+a1f1(x)+⋯+anfn(x)]}f0(x)dx=0=−2∫abW(x){y(x)−[a0f0(x)+a1f1(x)+⋯+anfn(x)]}f1(x)dx ⋮=0=−2∫abW(x){y(x)−[a0f0(x)+a1f1(x)+⋯+anfn(x)]}fn(x)dx⎭⎬⎫(4.44)The normal equations are now given by
a0∫abW(x)f02(x)dxa0∫abW(x)f1(x)f0(x)dxa0∫abW(x)fn(x)f0(x)dx+a1∫abW(x)f0(x)f1(x)dx+⋯+an∫abW(x)f0(x)fn(x)dx=∫abW(x)y(x)f0(x)dx+a1∫abW(x)f12(x)dx+⋯+an∫abW(x)f1(x)fn(x)dx=∫abW(x)y(x)f1(x)dx ⋮+a1∫abW(x)fn(x)f1(x)dx+⋯+an∫abW(x)fn2(x)dx=∫abW(x)y(x)fn(x)dx.⎭⎬⎫(4.45)The above system can be written more simply as
a0∫abW(x)f0(x)fj(x)dx+a1∫abW(x)f1(x)fj(x)dx+…+an∫abW(x)fn(x)fj(x)dx=∫abW(x)y(x)fj(x)dx,j=0,1,2,…,n.(4.46)In Eq. (4.45), we find products of the type fp(x)fq(x) in the integrands, and if we assume that
∫abW(x)fp(x)fq(x)dx=⎩⎨⎧0,∫abW(x)fp2(x)dx,p=qp=q,(4.47)then the system (4.45) reduces to
a0∫abW(x)f02(x)dxan∫abW(x)fn2(x)dx=∫abW(x)y(x)f0(x)dx ⋮=∫abW(x)y(x)fn(x)dx.From the preceding equations we obtain aj=∫abW(x)fj2(x)dx∫abW(x)y(x)fj(x)dx,j=0,1,2,…,n.(4.48) Substitution of a0,a1,…,an in Eq. (4.42) then yields the required least squares approximation, but the functions f0(x),f1(x),…,fn(x) are still not known. The fj(x), which are polynomials in x satisfying the conditions (4.47), are called orthogonal polynomials and are said to be orthogonal with respect to the weight function W(x). They play an important role in numerical analysis and a few of them are listed below in Table 4.1.
Table 4.1 Orthogonal Polynomials*
| Name | fj(x) | Interval | W(x) |
|---|---|---|---|
| Jacobi | Pn(α,β)(x) | [−1,1] | (1−x)α(1+x)β (α,β>−1) |
| Chebyshev (first kind) | Tn(x) | [−1,1] | (1−x2)−1/2 |
| Chebyshev (second kind) | Un(x) | [−1,1] | (1−x2)1/2 |
| Legendre | Pn(x) | (−1,1) | 1 |
| Laguerre | Ln(x) | [0,∞) | e−x |
| Hermite | Hn(x) | (−∞,∞) | e−x2 |
A brief discussion of some important properties of the Chebyshev polynomials Tn(x) and their usefulness in the approximation of functions will be given in a later section of this chapter. We now return to our discussion of the problem of determining the least squares approximation. As we noted earlier, the functions fj(x) are yet to be determined. These are obtained by using the 'Gram–Schmidt orthogonalization process,' which has important applications in numerical analysis. This process is described in the next section.
Suppose that the orthogonal polynomial fi(x), valid on the interval [a,b], has the leading term xi. Then, starting with f0(x)=1(4.49)
*For more details concerning orthogonal polynomials, see Abramovitz and Stegun [1965].
we find that the linear polynomial f1(x), with leading term x, can be written as f1(x)=x+k1,0f0(x),(4.50) where k1,0 is a constant to be determined. Since f1(x) and f0(x) are orthogonal, we have ∫abW(x)f0(x)f1(x)dx=0=∫abxW(x)f0(x)dx+k1,0∫abW(x)f02(x)dx using Eqs. (4.47) and (4.49). From the above, we obtain k1,0=−∫abW(x)f02(x)dx∫abxW(x)f0(x)dx(4.51) and Eq. (4.50) gives f1(x)=x−∫abW(x)f02(x)dx∫abxW(x)f0(x)dx. Now, the polynomial f2(x), of degree 2 in x and with leading term x2, may be written as f2(x)=x2+k2,0f0(x)+k2,1f1(x),(4.52) where the constants k2,0 and k2,1 are to be determined by using the orthogonality conditions in Eq. (4.47). Since f2(x) is orthogonal to f0(x), we have ∫abW(x)f0(x)[x2+k2,0f0(x)+k2,1f1(x)]dx=0. Since ∫abW(x)f0(x)f1(x)dx=0, the above equation gives k2,0=−∫abW(x)f02(x)dx∫abx2W(x)f0(x)dx=−∫abW(x)dx∫abx2W(x)dx.(4.53)
Again, since f2(x) is orthogonal to f1(x), we have ∫abW(x)f1(x)[x2+k2,0f0(x)+k2,1f1(x)]dx=0. Using the condition that ∫abW(x)f0(x)f1(x)dx=0, the above yields k2,1=−∫abW(x)f12(x)dx∫abx2W(x)f1(x)dx.(4.54) Since k2,0 and k2,1 are known, Eq. (4.52) determines f2(x). Proceeding in this way, the method can be generalized and we write fj(x)=xj+kj,0f0(x)+kj,1f1(x)+⋯+kj,j−1fj−1(x),(4.55) where the constants kj,i are so chosen that fj(x) is orthogonal to f0(x),f1(x),…,fj−1(x). These conditions yield kj,i=−∫abW(x)fi2(x)dx∫abxjW(x)fi(x)dx.(4.56) Since the ai and fi(x) in Eq. (4.42) are known, the approximation Y(x) can now be determined. The following example illustrates the method of procedure.
and k2,1=−∫−11x2dx∫−11x2xdx=0. Then Eq. (4.52) yields f2(x)=x2−1/3. In a similar manner, we obtain k3,0=−∫−11dx∫−11x3dx=0, k3,1=−∫−11x2dx∫−11x3xdx=−53, k3,2=−∫−11(x2−1/3)2dx∫−11x3(x2−1/3)dx=0. It is easily verified that f3(x)=x3−53x. Thus the required orthogonal polynomials are 1, x, x2−1/3 and x3−(3/5)x. These polynomials are called Legendre polynomials and are usually denoted by Pn(x). It is easy to verify that these polynomials satisfy the orthogonal property given in Eq. (4.47). An important application of Legendre polynomials occurs in numerical quadrature (see Chapter 6). ◀