A textbook of Computer Based Numerical and Statiscal Techniques part 39 potx

10 335 0
A textbook of Computer Based Numerical and Statiscal Techniques part 39 potx

Đang tải... (xem toàn văn)

Thông tin tài liệu

366 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES Example 10. Solve y′ = 2e x – y at x = 0.4 and x = 0.5 by Milne’s method, given their values of the four points. x 0 0.1 0.2 0.3 y 2 2.010 2.040 2.090 Sol. Here we find the value of 123. ,, fff 0.1 1 2 2.010 0.2003 fe=− = ⇒ 1 0.2003 f = 0.2 2 2 2.040 0.4028 fe=− = ⇒ 2 0.4028 f = 0.3 3 2 2.090 0.6097 fe=− = ⇒ 3 0.6097 f = By Milne’ predictor formula, we have () 40 12 3 4 22 3 h yy ff f =+ −+ ()()() 40.1 2 2 0.2003 0.4028 2 0.6097 3 × =+ − +   2.162293 2.1623=≈ 4 2.1623 y = Now 0.4 4 2 2.1623 0.8213494 0.8213 fe=− = = ⇒ 4 0.8213 f = Now again by Corrector formula, we get [] 42 2 34 4 3 h yy f ff =++ [] ()() 0.1 2.04 .4028 4 0.6097 2 0.8213 3 =+ − + 2.162096 2.1621== ⇒ 4 2.1621 y = Again by using Predictor formula () =+ −+ 51 23 4 4 22 3 h yy ff f () () 40.1 2.10 2 0.4028 0.6097 2 0.8215 3 × =+ − +   2.2551867 2.2552== ⇒ 5 2.2552 y = NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATION 367 then 0.5 5 2 2.2552 fe=− =1.0422425=1.0422 ⇒ 5 1.0422 f = By Corrector formula, we get [] 53 3 45 4 3 h yy f ff =+ + + () 0.1 2.090 0.6097 4 0.8215 1.0422 3 =+ + +   2.2545967 2.255== ⇒ 5 2.255 y = . Ans. Example 11. Apply Milne’s method to find a solution of the differential equation 2 dy xy dx =− in the range 0 ≤ x ≤ 1 with y(0) = 0. Sol. Here, we use Picard’ method to compute 12 , yy , and 3 y . Picard’s successive approximations are given by () 01 0 , x nn yy fxy dx − =+ ∫ for 1n = , we have 2 1 0 0 2 x x y xdx =+ = ∫ for 2n = , 2 2 2 0 0 2 x x yxdx    =+ −     ∫ 25 220 xx =− Similarly, 2 25 3 0 0 220 x xx yx dx    =+ − −     ∫ 25 8 11 2 20 160 4400 xx x x =−+ − Let us take 25 220 xx y =− for finding the various values of i ys ′ and i fs ′ () 1 0.2 0.019987 0.02, yy == = 1 0.1996 f = () 2 0.4 0.079488 0.0795, yy == = 2 0.3937 f = () 3 0.6 0.176112 0.176, yy == = 3 0.5690 f = Now, using Predictor formula, we get () 40 12 3 4 22 3 h yy ff f =+ −+ 368 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES = () 40.2 0 2 0.1996 0.3937 2(0.5690) 3 × +−+   0.3049333 0.3049== Further, using corrector formula, we get [] 42 2 34 4 3 h yy f ff =+ + + () 0.2 0.0795 0.3937 4 0.5690 0.7070 3 =+ +×+ 0.3046= 3 fxy 444 2 0 8 0 3049 0 7070359 0 7070 =+= − = = . . af ej Hence, 4 0.3046 y = at 0.8x = and corrected () 2 4 0.8 0.3046 0.7072 f =− = Again, using Predictor formula, we get, () 51 23 4 4 22 3 h yy ff f =+ −+ () 40.2 0.2 2 0.3937 0.5690 2 0.7072 3 × =+ ×−+× 0.4554133 0.4554== Now, 3 fxy 555 2 1 0 4554 792610 0 7926 =+=− = = . af ej Using corrector formula, we get [] 53 3 45 4 3 h yy f ff =+ + + [] 0.2 0.176 0.5690 4 0.7072 0.7926 3 =+ +× + ==0.45536 0.4554 Hence, () 1 0.4554.y = Ans. Example 12. Given () 22 dy 1 =1+xy dx 2 and y(0) = 1, y(0.1) = 1.06, y(0.2) = 1.12, y(0.3) = 1.21. Evaluate by Milne’ predictor—Corrector method y(0.4). Sol. Milne’s predictor formula is () 13 21 4 22 3 nn nn n h yy yy y +− −− ′′ ′ =+ −+ Putting 3n = in the above formula, we get () 40 12 3 4 22 3 h yy yy y ′′ ′ =+ −+ (1) We have 0123 1, 1.06, 1.12, 1.21, yy y y== = = and 0.1h = The given differential equation is () 22 1 1 2 yxy ′ =+ NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATION 369 () () ( ) 22 22 111 11 110.11.06 22 yxy  ′ =+ =+ ×  () 2 0.505 1.06 =× = 0.5674 () () ( ) 22 22 222 11 110.21.12 22 yxy  ′ =+ =+ ×  () 2 0.52 1.12 =× = 0.6522 () () ( ) 22 22 333 11 110.31.21 22 yxy  ′ =+ =+ ×  () 2 0.545 1.21 =× = 0.7980 Substituting these values in (1), we get () [] 4 40.1 1 2 0.5674 0.6522 2 0.7980 3 y × =+ × − +× 1.27715= 1.2772= (2) (correct to 4 decimal places) ∴ We get () 22 444 1 1 2 yxy  ′ =+  () ( ) 22 1 1 0.4 1.2772 2  =+ ×  0.9458= Milne’s corrector formula is 1 11 1 24 3 n nn n n h yy y yy + +− −  ′ ′′ =+ ++   (3) Putting n = 3 in (3), we get 4 42 2 3 4 3 h yy y yy  ′ ′′ =+ + +   [] 0.1 1.12 0.6522 4 0.798 0.9458 3 =+ +× + 1.2797= (correct to 4 decimal places) ∴ () 0.4 1.2797y = . Ans. 7.8 AUTOMATIC ERROR MONITORING Error Analysis: The numerical solutions of differential equations certainly differs from their exact solutions. The difference between the computed value y i and the true value y(x i ) at any stage is known as the total error. The total error at any stage is comprised of truncation error and round-off error. The most important aspect of numerical methods is to minimize the errors and obtain the solutions with the least errors. It is usually not possible to follow error development quite closely. We can make only rough estimates. That is why our treatment of error analysis at times, has to be somewhat intuitive. In any method, the truncation error can be reduced by taking smaller sub-intervals. The round-off error cannot be controlled easily unless the computer used has the double precision arithmetic facility. In fact, this error has proved to be more elusive that the truncation error. 370 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES The truncation error in Euler’s method is 2 1 2 n hy ′′ i.e., O (h 2 ) while that of modified Euler’s method is 3 1 2 n hy ′′′ i.e., O (h 3 ). Similarly, in the fourth order Range-Kutta method, the truncation error is of O (h 5 ) In the Milne’s method, the truncation error, (i) due to predictor formula 5 14 45 n hy ′′′′′ and (ii) due to corrector formula 5 1 90 n hy ′′′′′ =− i.e., the truncation error in Milne’s method is also of O (h 5 ). The relative error of an approximate solution is the ratio of the total error to the exact value. It is of greater importance than the error itself for if the true value becomes larger than a larger, error may be acceptable. If the true value diminishes, then the error must also diminish otherwise the computed results may be absurd. Convergence of a Method Any numerical method for solving a differential equation is said to be convergent if the approximate solution y n approaches the exact solution y(x n ) at h tends to zero provided the rounding error arising from the initial conditions approach zero. This means that as a method is continually refined by taking smaller and smaller step-sizes, the sequence of approximate solutions must converge to the exact solution. Taylor’s series method is convergent provided f (x, y) possesses enough continuous derivatives. The Runge-Kutta methods are also convergent under similar conditions. Predictor-corrector methods are convergent if f (x, y) satisfies Lipschitz condition, i.e., () () () ,,fxy fxy ky y −≤− k being constant, then the sequence of approximations to the numerical solution converges to the exact solution. 7.9 STABILITY IN THE SOLUTION OF ORDINARY DIFFERENTIAL EQUATION There is a limit to which the steps-size h can be reduced for controlling the truncation error, beyond which a further reduction in h will result in the increase of round-off error and hence increase in the total error. A method is said to be stable if it produces a bounded solution which imitates the exact solution. Otherwise it is said to be unstable. If a method is stable for all values of the parameter, it is said to be absolutely or unconditionally stable. If it is stable for some values of the parameter, it is said to be conditionally stable. Euler’s method and Runge-Kutta method are conditionally stable. The Milne’s method is, however, unstable since when the parameter is negative, each of the error is magnified while the exact solution decays. Two types of stability considerations in the solution of ordinary differential equations. (i) Inherent stability (ii) Numerical stability NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATION 371 Inherent stability is determined by the mathematical formulations of the problem and is dependent on the eigen values of Jacobian Matrix of the differential equation. Numerical stability is a function of the error propagation in the numerical method. Three types of errors occur in the application of numerical integration methods: (a) Truncation error (b) Round-off error (c) Propagation error Example 13. Applying Euler’s method to the equation. , dy y dx =λ given () 00 yx =y determine its stability zone. What would be the range of stability when λ = –1. Sol. Here, () 00 , yyyx y =λ = (1) By Euler’s method, we have 111 1nn n n n yy hy y hy −−− − ′ =+ =+λ () 1 1 n yy − =+λ () 12 1 nn yyy −− =+λ () 21 1 yyy =+λ () 10 1 yyy =+λ Multiplying all these equations, we obtain (2) () 0 1 n n yyy =+λ Integrating () 1 , we get x yce λ = Using () 00 yx y = , we obtain 0 0 x yce λ = Hence, we have () 0 0 xx yye λ− = In particular, the exact solution through ) (, nn xy is () 0 00 n xx nh yye ye λ− λ == 0 [] n xxnh =+ or () () 2 00 1 2 n n h h yye y h λ  λ ==+λ++   (3) Clearly, the numerical solution (2), agrees with exact solution (3) for small values of h. The solution (2), increases if 11.h+λ > Hence, 1 +λh < 1 defines a stable zone. When λ is real, then the method is stable if |1 + λh|< i.e., –2 < λh < 0. When λ is complex ()aib=+ , then it is stable if () [1 ] 1aibh += < i.e., ()() 22 11 ah bh ++ < 372 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES i.e., (x + 1) 2 + y 2 < 1 where x = ah, y = bh. i.e., lh lies within the unit circles shown in Fig. 7.1 When λ is imaginary (= ib), |1 + λh| = 1, then we have a periodic stability. Hence, Euler’s method is absolutely stable if and only if (i) real λ : – 2 < λh < 0. (ii) Complex λ, λh lies within the unit circle (Fig. 7.1) i.e. Euler’s method is conditionally convergent. (iii) When λ = –1, the solution is stable in the range –2 < –h < 0, i.e., 0 < h < 2. PROBLEM SET 7.2 1. Apply Runge-Kutta method find the solution of the differential equation 1 3 2 dy xy dx =+ with 0 1 y = at 0.1x = [Ans. 1.066652421875] 2. Given 2 1 dy y dx =+ where 0y = when 0x = , find () 0.2 y , () 0.4 y and () 0.6 y , using Runge-Kutta formula of order four. [Ans. y (0.2) = 0.2027, y (0.4) = 0.4228, y (0.6) = 0.6841] 3. Use classical Runge-Kutta method of fourth order to find the numerical solution at x = 1.4 for () =+ = 22 ,1 0 dy yxy dx . Assume step size 0.2.h = [Ans. y(1.2)= 0.246326, y(1.4)=0.622751489] 4. Using Runge-Kutta method to solve 22 10 dy xy dx =+ y (0) = for the interval 00.4x<≤ with 0.1h = .[Ans. 1.0101, 1.0207, 1.0318, 1.0438] 5. Solve the differential equation 2 21 1 dy x y dx x − =+ where 0 1, x = 0 2, y = 0.2h = . Obtain () 1.2 y and () 1.4 y using Runge-Kutta method. [Ans. 2.658913 and 3.432851] 6. Using Runge-Kutta method solve simultaneous differential equation () ,, dy fxyt xy t dx ==+ and () ,, dy ty x g x y t dx =+= where 0 0, t = 0 1, x = 0 1, y =− 0.2h = .[Ans. y (0.2) = −0.8341] 7. By Milne’s method solve 2 2 dy xy dx =− with y (0) = 1 for 1x = taking 0.2h = .[Ans. 1.6505] 8. Apply Milne’s method to solve the differential equation 2 dy xy dx =− at 0.8x = given that () () () () 0 0.2 0.4 0.6 2, 1.923, 1.724, 1.471 yy y y== = = .[Ans. y (0.8) = 1.219] 9. Given that () 22 1 1 2 dy xy dx =+ and () 00,y = () 0.1 1.06,y = () () 0.2 1.12, 0.3 1.21yy == . Evaluate () 0.4y by Milne’s predictor corrector method. [Ans. y (0.2) =1.2797] 10. By Milne’s method solve () 0.3y from 22 , dy xy dx =+ () 01.y = Find the initial values () 0.1y − and () 0.1y , () 0.2y from the Taylor’s series method. [Ans. 1.4392] GGG Unstable lh n () l stable –1 –2 Rh e () l FIG. 7.1 CHAPTER 8 Solution of Simultaneous Linear Equation 8.1 INTRODUCTION Let us consider a system of non-homogeneous linear equations in n unknowns 3 12 , , , , n xx x +++= 11 1 12 2 1 1 nn ax ax ax b 21 1 22 2 2 2 nn ax ax ax b +++= ®®® 11 22 nn nnnn ax ax ax b +++= which we can solve by matrix method. Apart from this method we have some other direct methods to find out the solution of a system of equations like Gauss-Elimination method, Gauss-Jordan’s method etc. The drawback with Cramer’s and matrix inversion method is having the too much calculations. If we consider a system of 10 equations (or variables) then Cramer’s rule contains 7,00,00,000 multiplication while in matrix inversion method, evaluation of A –1 by cofactors became very complicated. Now, we shall describe a few direct methods to solve a system of linear equations: 8.2 GAUSS-ELIMINATION METHOD This is one of the most widely used method. This emthod is a systematic process of eliminating unknowns from the linear equations. This method is divided into two parts: (i) Triangularization, (ii) Back substitution. Let the system of equations in three unknowns, x, y, z be 11 12 13 1 ax ay az b++= 21 22 23 2 ax ay az b++= (1) 31 32 33 3 ax ay az b++= We multiply the first equation by 21 11 a a and subtract it from second equations to eliminate x from second equation. Similarly, we multiply the first equation by 31 11 a a and subtract it from third equation to eliminate x from third equation. Then the above system () 1 becomes,        373 374 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES 11 12 13 1 ax ay az b++= 111 22 23 2 ay az b+= (2) 111 32 33 3 ay az b+= Again, to eliminate y from the third equation of the system () 2 , we multiply the second equation by 32 1 22 a a and subtract it from the third equation. Then, the above system of equations (2) becomes: 11 12 13 1 ax ay az b++= 111 22 23 2 ay az b+= (3) 11 11 33 2 a zb = from which the values of ,,,xyz can be obtained by back substitution. The values of ,zy and x can be obtained from third, second and first equations respectively. The Gauss-Elimination method can be generalized to find the solutions of n simultaneous equations in n-unknowns. Example 1. Solve the system of equation by Gauss-Elimination method. 2x + 3y z = 5− 4x + 4y 3z = 3− (1) 2x 3y + 2x = 2− Sol. To eliminate x from the second equation of the system () 1 , we multiply the first equation by 2 and subtract it from the second equation and obtain. 27yz−−=− or 27yz+= Similarly, to eliminate x from the third equation of the system () 1 we subtract first equation from the third equation and obtain. 63 3yz−+ =− Now, the system of equation (1) becomes. 23 5xyz+−= 27yz+= – 6y + 3z = – 3 (2) Now, to eliminate y from the third equation of the system (2) we multiply the second equation by 3 and add it to third equation of the system (2) and obtain 6z = 18 Thus, the system of equation (2) becomes. 23 5 27 618 xyz yz z += += = U V | W | –                     SOLUTION OF SIMULTANEOUS LINEAR EQUATION 375 By back substitution, gives the solution 3, 2zy== and 1x = Example 2. Solve the following system of equations by Gauss-Elimination method. 2x+y+z=10 3x + 2y + 3z = 18 (1) x + 4y + 9z = 16 Sol. To eliminate x from the second equation of the system () 1 , we multiply the first equation by 3 2 and subtract it from the second equation and obtain. 36yz+= Similarly, to eliminate x from the third equations of the system () 1 , we multiply the first euqaiton by 1 2 and subtract it from the third equation and obtain. 71722yz+= Now, the system of equation () 1 , becomes 210xyz++= 36yz+= (2) 71722yz+= Now, to eliminate y from the third equation of the system () 2 , we multiply the second equation by 7 and subtract it from the third equation of the system () 2 and obtain 420z = Thus, the system of equation (2) becomes 2x – y + z = 10; y + 3z = 6; 4z = 20 (3) Back substitution gives the solution. z = 5, y = –9 and x = 7. Ans. 8.3 GAUSS-ELIMINATION WITH PIVOTING METHOD Pivoting: One of the ways around this problem is to ensure that small values (especially zeros) do not appear on the diagonal and, if they do, to remove them by rearranging the matrix and vectors. Partial Pivoting: If zero element is found in diagonal position i.e., a ij for ij= which is called pivot element interchange the corresponding elements of two rows such that new diagonal element i if non-zero and having maximum value in that corresponding column. The process can be explained in following steps. In the first step the largest coefficient of x 1 (may be positive or negative) is selected from all the equations. Now we interchange the first equation with the equation having largest coefficient of x i . In the second step, the numerically largest coefficient of x 2 is selected from the remaining equations. In this step we will not consider the first equations now interchange the second equation with the equation having U V | W | U V | W | . value y i and the true value y(x i ) at any stage is known as the total error. The total error at any stage is comprised of truncation error and round-off error. The most important aspect of. becomes,        373 374 COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES 11 12 13 1 ax ay az b++= 111 22 23 2 ay az b+= (2) 111 32 33 3 ay az b+= Again, to eliminate y from the third equation of the system. DIFFERENTIAL EQUATION 371 Inherent stability is determined by the mathematical formulations of the problem and is dependent on the eigen values of Jacobian Matrix of the differential equation. Numerical

Ngày đăng: 04/07/2014, 15:20

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan