31 6312b 6313 has an 18 procedure tridin integer

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r i = 2 to n do yi := fi ; bi yi;1 f Backward substitution g yn := yn=an for i = n ; 1 downto 1 do yi := (yi ; ciyi+1)=ai end Figure 6.3.2: Tridiagonal algorithm expansion in even powers of h beginning with O(h2) terms. Let's assume that this is the case. Then, Richardson's extrapolation can be used to both estimate the global error and to improve the solution. To this end, we calculate two solutions using di erent step sizes of, e.g., h and h=2. In order to emphasize the dependence of the discrete solution on step size, let yih denote the nite di erence solution yi at xi = a + ih obtained with step size h. With the assumed error dependence we have y(a + ih) ; yih = Ch2 + O(h4) and h= y(a + ih) ; y2i 2 = C ( h )2 + O(h4): 2 h= The variable y2i 2 is the nite di erence solution at a + 2i(h=2) = a + ih. Subtracting the two error equations to eliminate the exact solution yields 4 h= Ch2 = 3 y2i 2 ; yih] + O(h4): 19 Using this result, we estimate the error in the ner grid solution as h= y2i 2 ; yih : 3 h= y(a + ih) ; y2i 2 Furthermore, h=2 h h= i = 1 2 ::: N ;1 yih=2 = y2i 2 + y2i 3; yi ^ is an O(h4) approximation of the solution. Let us apply Richardson's extrapolation to the simple BVP y00 = y y(0) = 0 y(1) = 1: This problem has the form of (6.3.13) with p(x) = r(x) = 0 and q(x) = ;1. Thus, the elements of the tridiagonal system (6.3.18) are ai = ;(2 + h2) bi = 1 i = 1 2 ::: N ;1 i = 2 3 ::: N ; 1 ci = 1 i = 1 2 : : : N ; 2: Central-di erence solutions with h = 1=10 1=20, the solution by Richardson's extrapolation, and the exact solution y(x) = sinh x sinh 1 are shown in Table 6.3.1. Using the error at x = 0:5 as a measure of accuracy, we have 0 jy(0:5) ; y5:1j = 4:26 10;5 0: jy(0:5) ; y1005j = 1:04 10;5 0: 0 jy105 ; y5:1j = 1:07 10;5 3 jy(0:5) ; y5:05j = 3:3 10;7 ^0 These results indicate that 1. the global error of the centered nite di erence solution is approximately O(h2) since decreasing h by one-half quarters the error and 2. Richardson's extrapolation furnishes a good approximation of the error while also improving accuracy. 20 i xi y(xi) 0 0.00 0.0 1 0.05 0.04256364 2 0.10 0.08523370 3 0.15 0.12811690 4 0.20 0.17132045 5 0.25 0.21495240 6 0.30 0.25912184 7 0.35 0.30393920 8 0.40 0.34951658 9 0.45 0.39596749 10 0.50 0.44340942 11 0.55 0.49195965 12 0.60 0.54174004 13 0.65 0.59287506 14 0.70 0.64549258 15 0.75 0.69972415 16 0.80 0.75570543 17 0.85 0.81357636 18 0.90 0.87348163 19 0.95 0.93557107 20 1.00 1.0 Table 6.3.1: Solution of Example Richardson's extrapolation. 0.0 yih h= y2i 2 yih=2 ^ 0.0 0.0 0.04256498 0.08524467 0.08523638 0.08523361 0.12812087 0.17134180 0.17132566 0.17132029 0.21495877 0.25915234 0.25912928 0.25912159 0.30394761 0.34955441 0.34952582 0.34951629 0.39597785 0.44345203 0.44341982 0.44340909 0.49197036 0.54178417 0.54175082 0.54173970 0.59288567 0.64553415 0.64550275 0.64549229 0.69973360 0.75573949 0.75571378 0.75570522 0.81358325 0.87350223 0.87348670 0.87348153 0.93557388 1.0 1.0 1.0 6.3.2 using central di erence approximations and As a next step, let us consider a linear BVP with a prescribed Robin boundary condition, e.g., y00 + p(x)y0 + q(x)y = r(x) a<x<b (6.3.24a) y(a) = A (6.3.24b) y0(b) + Cy(b) = B: (6.3.24c) As distinct from the Dirichlet conditions used in (6.3.1), y(b) is now an unknown. We could approximate y0(b) by backward di erences and use the discrete version of the terminal condition (6.3.24c) to determine an approximation of y(b) however, this has some drawbacks. If rst-order backward di erences (6.3.6) were used to approximate y0(b) 21 y y0 = A h a = x0 x x N-1 xN = b x N+1 x1 Figure 6.3.3: Domain and discretization used to approximate a Robin terminal condition. then the boundary condition (6.3.24c) would only be accurate to O(h) while the discrete approximation of the ODE (6.3.24a) is accurate to O(h2). If higher-order backward di erences were used to approximate y0(b) then the tridiagonal structure of the discrete system would be lost. The usual strategy is to introduce a ctitious external point xN +1 = b + h as shown in Figure 6.3.3. Extending the solution to this exterior point, we use central di erences to approximate the terminal condition (6.3.24c) to O(h2) as yN +1 ; yN ;1 + Cy = B: (6.3.25a) N 2h This does little to solve the problem since we've introduced both another equation (6.3.25a) and another unknown yN +1. The additional equation that we need is the central di erence approximation of the ODE (6.3.24a) at x = xN . Thus, using (6.3.16a) with i = N we have bN yN ;1 + aN yN + cN yN +1 = h2 rN : (6.3.25b) Once again, It is common to eliminate yN +1 by combining (6.3.25a) and (6.3.25b) to obtain (bN + cN )yN ;1 + (aN ; 2hCcN )yN = h2rN ; 2hcN B: 22 (6.3.25c) Observing that bN + cN = 2 by use of (6.3.16b), we obtain the tridiagonal system 2 32 3 2 2 3 a1 c1 h r1 ; b1 A 6 b2 a2 c2 7 6 y1 7 6 7 h2 r2 6 7 6 y2 7 6 7 6 76 7 = 6 7...
View Full Document

Ask a homework question - tutors are online