Vel Tech Dr.RR & Dr.SR Technical University Avadi Department of Mathematics NUMERICAL METHODS (Common to EEE, Civil, Aero and CSE) 1 UNIT - I SOLUTION OF EQUATION AND EIGEN VALUE PROBLEMS Properties of equation: (i) If f(a) and f(b) have opposite signs then one root of f(x) = 0 lies between a and b. (ii) Every equation of an odd degree has at least one real root whose sign is opposite to that of its last term. (iii) Every equation of an even degree with last term negative has at least a pair of real roots one positive and other negative. Formula for false position (or) Regula falsi method: x a f(b) bf(a) f(b) f(a) Order of convergence: Let x0, x1… Xn…. Be a sequence which converge to a number, and set en = - xn. If there exists a number p and a constant C 0 such that lim n en1 C , then P is called the en p order of convergence and C is known as the asymptotic error constant of the sequence. Linear algebraic equations: A system of m linear equation in n unknowns x1, x2, x3 , …..xn is a set of equations of the form. a11 x1 + a12 x2 +……….. + a1n xn = b1 a21 x1 + a22 x2 + ………. + a2n xn = b2 . . am1 x1 +am2 x2 +..……….+ amn xn = bm Where the co efficient of x1 x2 ... xn and b1 b2 …. bm are constants. Then the above system can be written as Ax = B Where a11 A a21 a m1 a12 a13 a22 a23 a m2 am 3 ... a1n x1 b1 ... a2 n , X x2 , B b2 x b ... amn n n Example: 01: Consider the following linear system 2x1 + 3x2 – x3 = 5; - 2x2 – x3 = -7; 5x3 = -15 find x1,x2 ,x3 ? 2 solution: From the last equation x 3 b3 a33 15 3 5 from the sec ond equation x2 b2 a23 x 3 7 3 2 a22 2 Hence the first equation x1 b1 a12 x 2 5 3.2 3 1 a11 2 Procedure to find Eigen value: Let A be any square matrix of order n. Then for any Scalar we can form the matrix A - I. where I is the nth order unit matrix. The determinant of the matrix equal to zero is called characteristic equation. This polynomial of degree n in x having n root for say 1 2 …. n These values are called eigen values of the given matrix A. Latent or eigen vector: First find out eigen values. For these eigen values, the system of equation (A - I) X = 0 has a x1 x non – trivial solution for the vector X 2 is called eigen vector of the corresponding . xn eigen values. Gauss – seidal method is better than Gauss Jacobi method why? In Gauss seidal method the latest values of unknowns at each stage of iteration are used in proceeding to the next stage of iteration. Hence the convergence in Gauss – seidal method is more rapid than Gauss – Jacobi method. Regula falsi method: Let f(x) = 0 be the given equation. (i) Find two number a and b such that f(a) and f(b) are of different signs. Then the root lies between a and b. (ii) The first approximation to the root is given by 3 x1 (iii) af(b) bf(a) ba If f(x1) and f(a) are of opposite signs, then the actual root lies between x 1 and a. Now replacing b by x1 and keeping a as it is we get the next closer approximation x2 to the actual root. (iv) This procedure is repeated till the root is found to be desired degree of accuracy. Gauss Seidal method: Let the rearranged form of a given set of equation be x 1 d1 b1y c1z a1 y 1 d2 a2 x c 2 z b2 z 1 d3 a3 x b3 y c3 we start with the initial values y(0), z(0) for y and z get x(1) from x(1) Condition for Gauss – Jacobi method of converges: Let the given equation be a1x b1y c1z d1 a2 x b2 y c 2 z d2 a3 x b3 y c 3 z d3 a1 b1 c1 The sufficient condition is b2 a2 c 2 c 3 a3 b3 4 1 d1 b1y(0) c1z(0) a1 Newton’s algorithm for finding the Pth root of a Number N: Pth The root of the a positive number N is the root of the equation. xp N 0 f(x) x p N f 1(x) pxp 1 By Newton' salgorithm f(x) xk 1 f '(x) xP N xk k p1 1 Pxk Pxk p xPk N Pxkp 1 (p 1)xPk N Pxpk 1 Newton Raphson formula for cube root of a positive number k. x 3k f(x) x 3 k 0 f 1(x) 3x 2 xn1 xn xn3 k 3xn2 1 k 2xn 2 3 xn Gauss – elimination method to solve Ax = B: In this method the given system is transformed into an equivalent system with upper – triangular co efficient matrix i.e. a matrix in which all elements below the diagonal elements are zero which can be solved by back substitution. Newtons – Raphson – formula xn+1 = a or N Or 1 a xn n = 0, 1, 2, ….. 2 xn 5 Let x a, x 2 a 0 f (x) x 2 a 1 f (x) 2x f (x n ) 1 f (x n ) 2 x a xn n 2x n 2 x a a 1 n xn 2 2x n xn x n1 x n Example:02 Evaluate 12 applying Newton formula. Solution: Let x = 12 x2= 12 x2 – 12 = 0 f(x) = x2 – 12 f(3) = -ve, f(4) = +ve take x0 = 3 x1 x 0 x 2 x1 f(x 0 ) f(3) 3 1 3.5 1 f (x 0 ) f (3) f(x1 ) (3.5)2 12 3.5 3.464 f 1(x1 ) 2(3.5) The root is 3.464 Iteration formula to find the reciprocal of a positive number N by Newton Raphson method: 1 N 1 1 N N 0 x x 1 Let N 0 x 1 f(x) N x 1 f 1(x) x2 x 6 by Newton' s formula f(x ) x n1 x n 1 n f (x n ) 1 N x x n1 x n n 1 x2 n 1 xn N x 2 xn x n x n x 2nN xn 2 N xn The order of converges in Newton Raphsons method: Newton – Raphson process has a second – order convergence. Comparison of Gauss elimination and Gauss seidel methods: (i) Gauss elimination method has only a finite number of computation, since it is a direct method. (ii) Gauss seidel iteration method convergers only when the system is diagonally dominant. (iii) Iteration method is a self-correcting method. Errors made at any step in the computation are corrected in the subsequent iteration. When should we not use Newton – Raphson method: If x1 is the exact root and x0 is its approximate value of the equation f(x) =0. We know that x1 = x0 - f ( x0 ) f (x ) .If f1(x0) is small, the error 1 0 will be large and the computation of 1 f ( x0 ) f ( x0 ) the root by this method will be a slow process. Hence the method should not be used in case where the graph of the functions when it crosses the x axis is nearly horizontal. Merits of Newton’s method of iteration: Newton’s method is successfully used to improve the result obtained by other methods. It is applicable to the solution of equations involving algebraical functions as well as transcendental functions. 7 Compression of the Gaussian elimination method and Gauss-Jordan method: Gauss elimination 1. 2. Gauss Jordan Coefficient matrix is transformed into Coefficient matrix is transformed 3. into diagonal matrix upper triangular matrix. 4. Direct method Direct method 5. We obtain the solutions by bank No need of back substitution 7. method. 6. substitution method. Comparession of Gauss Jacobi and Gauss seidel methods: Gauss Jacobi 1. Gauss seidel Convergence rate is slow The rate of convergence of Gauss. seidel method roughly twice that of Gauss-Jacobi 2 Indirect method Indirect method 3. Condition for con vergence is the Condition for convergence is the coefficient matrix is diagonally coefficient dominant. dominant. matrix is diagonally Distinguish between Direct and iterative methods of solving simultaneous equations. Direct methods involve a certain amount of fixed computation and they are exact solutions. Iterative or indirect methods are those in which the solution is got by successive approximations. But the method of iteration is not applicable to all systems of equations. 8 Numerical Examples: 01. Find the square root of 8. (by Newton – Raphson). Solution: Given N = 8 Clearly 2 8 3 taking x0 2.5 we get x1 1 N 1 8 2.85 x 0 2.5 2 x0 2 2.5 1 N 1 8 2.8285 x1 2.85 2 x1 2 2.85 1 N 1 8 x 3 x 2 2.828 2.8284 2 x2 2 2.828 x2 x4 1 N 1 8 2.8284 x 3 2.8284 2 x3 2 2.8284 8 2.8284 02. By applying Newton’s method twice, find the real root near 2 of the equation x4 – 12x + 7 = 0 Solution: Let f(x) = x4 – 12x + 7 f(x) = 4x3 – 12 Put x0 = 2, f(x0) = -1 f(x0) = 20 x1 x 0 f(x 0 ) ( 1) 41 2 2.05 1 f (x 0 ) 20 20 f(x1 ) (2.05)4 12(2.05) 1 x 2 x1 1 2.05 f (x1 ) 4(2.05)3 12 2.6706 The root of the equation is 2.6706. 9 03. Find the approximately value of the root of equation x3 + x - 1 = 0 near x = 1, by the method of false using the formula twice. Solution: f(x) x 3 x 1 f(0.5) 0.675, f(1) 1 Hence theroot liesbetween 0.5 & 1 a 0.5, b 1 a f(b) b f(a) 0.64 f(b) f(a) f(0.64) 0.097a 0 Theroot lies between0.64 & 1 x0 x1 (0.64) (1)( 0.0979) 0.672 1 ( 0.0979) 04.Use the iteration method to find a root of the equation x = ½ + sin x? Solution: Let f(x) = sin x – x + ½ f(1) = sin 1 – 1 + ½ = 0.84 – 0.5 = +ve f(2) = sin 2 – 2 + ½ = 0.9.9 – 1.5 = -ve. A root lies between 1 and 2. The given equation can be written as x = sin x + ½ = (x) 1(x) cos x 1 in (1,2) . Hence the iteration method can be applied. Le the approximation be x0 = 1. The successive approximation are as follows: x1= (x0) = sin 1 + ½ = 0.8414 + 0.5 = 1.3414 x2= (x1) = sin (1.3414) + ½ = 0.9738 + 0.5 = 1.4738 x3= (x2) = sin (1.4738) + ½ = 0.9952 + 0.5 = 1.4952 x4= (x3) = sin (1.4952) + ½ = 0.9971 + 0.5 = 1.4971 x5= (x4) = sin (1.4971) + ½ = 0.9972 + 0.5 = 1.4972 Since x4 and x5 are almost equal the required root is 1.497. 05. If an approximate root of the equation x ( l- logx) = 0.5 lies between 0.1 and 0.2 find the value of the root correct to three decimal places. Solution: Given f(x) = x( 1- log x) -0.5 10 f1(x) = (1- logx) + x 1 x = - log x f(0.1) = 0.1 [1-log (0.1)] – 0.5 = 0.1697 (-ve) f(0.2) = 0.2 [1-log (0.2)] – 0.5 = 0.02188 (+ve) x0 = 0.9 x1 x 0 f(x 0 ) f 1(x 0 ) 0.2 0.2(1 log(0.2) 0.5 log(0.2) 0.2 0.02188 0.1864 1.6094 x 2 x1 f(x1 ) f 1(x1 ) 0.1864 0.1864(1 log(0.1864) 0.5 log(0.1864) 0.1864 0.0004666 0.1866 1.6799 x 3 x1 f(x 2 ) f 1(x 2 ) 0.1866 0.1866(1 log (0.1866) 0.5 log(0.1866) 0.1866 Hence the approximate root is 0.1866. 06. Find the root between (2, 3) of x3 – 2x – 5 = 0 by regula falsi method Solution: Given f(x) = x3 – 2x – 5 f(2) = 8 – 4 -5 = -1 f(3) = 27 – 6 -5 = 16 Let us take a = 2, b = 3 The first approximation to the root is x1 and is given by x1 = af b bf a f b f a 2 16-3 -1 16 1 2f 3 3f 2 f 3 f 2 2.058 f 2.058 2.058 2 2.058 5 3 =-0.4 11 The root lies between 2.058 and 3 Taking a = 2.058 and b = 3 we have the second approximation to the root given by x2 a f(b) b f(a) f(b) f(a) 2.058 16 3(0.4) 16 ( 0.4) 2.081 f (2.081) (2.081)3 2 2.081 5 0.15 The root lies between 2.081 and 3 Take a = 2.081, b = 3 The third approximation to the root is given by a f(b) b f(a) f(b) f(a) 2.081 16 3( 0.15) 16 ( 0.15) 2.089 x3 Now f (2.089) (2.089)3 2 2.089 5 0.062 The root lies between 2.089 and 3 Take a = 2.089, b = 3 2.089 16 3( 0.062) 16 ( 0.062) 2.093 x1 The required root is 2.09. 07. Find the approximate root of xex = 3 by Newton’s Raphson method correct to three decimal places. Solution: Given f(x) = xex – 3 f1(x) = xex + ex f(1) = 1e-1 – 3 = 2.7182 – 3 = - 0.2817 (-ve) 12 f(1.5) = 1.5e1.5 – 3 = 3.7223 (+ve) Here f(1) is –ve (Negative) and f(1.5) is +ve (positive). Therefore the root lies between 1 ad 1.5. Since the magnitude of f(1) < f(1.5) we can take the initial approximate x0 = 1. The first approximation is x1 x0 1 f(x 0 ) f 1(x 0 ) 0.2817 1.0518 5.4363 The second approximation x 2 x1 f(x1 ) f 1(x1 ) 1.0518 0.0111 5.8739 1.0499 The third approximation is x3 x 2 f(x 2 ) f 1(x 2 ) 1.0499 e1.0499 3 1.0499 1.0499 e1.0499 e1.04999 1.0499 Hence the root of xex is 1.0499 08. Solve the following system by Gaussian elimination method x1 - x 2 + x 3 = 1 -3x1 + 2x 2 - 3x 3 = -6 2x1 - 5x 2 + 4x 3 = 5 Solution: Write the given system as in the matrix form 1 1 1 1 2 3 6 3 2 5 4 5 From the first column with non – zero component select the component with the large absolute value this component is called the pivot. 1 1 1 1 3 2 3 6 2 5 4 5 13 Rearrange the row to move the pivot to the top eg. First column. Here we interchange the first and second row. 3 1 2 2 1 5 3 6 1 1 4 5 Make the pivot as 1, by dividing the first row by the pivot. 1 = 1 2 2 3 1 2 1 1 1 5 4 5 1 0 0 2 3 1 2 R2 R2 R1 1 3 0 1 R3 R3 2R1 11 3 2 1 Delete the first row and first column and perform turn the above procedure. 1 0 0 1 0 0 1 0 0 2 3 1 2 1 New pivot 1 1 3 0 11 3 2 2 3 1 11 3 1 3 2 3 1 0 2 1 R 2 R3 1 2 0 3 6 11 3 11 R 2 R 2 11 2 11 12 11 1 R3 R3 R 2 11 1 2 Delete first two row’s and first two columns 1 0 0 2 3 1 0 6 11 3 11 2 11 12 11 1 2 14 1 0 0 2 3 1 2 1 6 11 3 11 0 1 6 x 3 6 x 2 6 11 x 3 3 11 x2 3 x1 2 3 x 2 x 3 2 x1 2 09. Using the Gauss – Jordan method solve the following equation. 10x + y + z = 12 2x + 10y +z = 13 x + y + 5z = 7 Solution: 10 1 1 12 Step 1 2 10 1 13 1 1 5 7 1 1 10 Step 2 2 10 1 1 1 12 10 10 R 1 13 R1 1 10 5 7 1 1 10 49 Step 3 0 5 0 9 10 1 12 10 10 4 106 R2 R2 2R1 5 10 R3 R3 R1 49 58 10 10 1 1 10 Step 4 0 1 0 9 10 1 12 10 10 4 53 49 R2 R2 49 49 5 49 58 10 10 15 1 0 0.0918 1.0918 4 53 R3 R3 9 10R 2 Step 5 0 1 49 49 R1 R1 1 10R 2 0 0 4.8265 4.8265 1 0 0.0918 1.0918 4 53 Step 6 0 1 R 2 R 3 4.8265 49 49 0 0 1 1 1 0 0 1 R R2 0.0918R3 Step 7 0 1 0 1 2 0 0 1 1 R2 R2 4 49R3 The matrix finally reduced to the form 1 0 0 x 1 0 1 0 y 1 0 0 1 z 1 x y z 1 10. Solve the following equation using Jacobi iteration method:20x + y – 2z = 17 3x + 20y – z = - 18 2x – 3y + 20z = 25 Solution: The above equation can be written as 16 1 17 y 2z 20 1 y 18 3x z 20 1 z 25 2x 3y 20 x First approximation = 1 17 y 0 2z0 20 1 y1 18 3x 0 z0 20 1 z1 25 2x 0 3y 0 20 x1 Put x0 = y0 = z0 = 0 x1 = 0.85, y1 = - 0.9, z1 = 1.25 Second approximation 1 17 y1 2z1 20 1 y2 18 3x1 z1 20 1 z2 25 2x1 3y1 20 x2 x1 = 0.85, y1 = - 0.9, z1 = 1.25 we get x2 = 1.02 y2 = - 0.965 z2 = 1.1515 Third approximation 1 17 y 2 2z2 20 1 y3 18 3x 2 z2 20 1 z3 25 2x 2 3y 2 20 x 2 1.02, y 2 0.965, z 2 1.1515 we get x3 x 3 1.0134, y 3 0.9954, z3 1.0032 17 1 17 y 3 2z3 20 1 y4 18 3x3 z3 20 1 z4 25 2x 3 3y 3 20 x 3 1.0134, y 3 0.9954, z 3 1.0032 we get x4 x 4 1.009, y 4 1.0018, z 4 0.9993 Fifth approximation 1 17 y 4 2z 4 20 1 y5 18 3x 4 z 4 20 1 z5 25 2x 4 3y 4 20 x 4 1.009, y 4 1.0018, z 4 0.994 we get x5 x 5 1, y 5 1.0002, z 5 0.9996 x 1, y 1, z 1 11. Solve by Gauss – seidal method of iteration the equation. 10x1 + x2 + x3 = 12 2x1 + 10x2 + x3 = 13 2x1 +2x2 + 10x3 = 14 Solution: From the above equation 1 12 x 2 x 3 10 1 x2 13 2x1 x 3 10 1 x3 14 2x1 2x 2 10 Put x 2 x 3 0 we get x1 1.2, i.e x1(1) 1.2 x1 1 10.6 13 2.4 0 1.06 10 10 1.2 x (1) 2 1.06 Put x 2 1 x1(1) x (1) 3 1 14 2.4 2.12 0.948 10 18 1 12 1.06 0.948 0.992 10 1 13 2 0.9992 0.948 1.00536 10 1 14 2 0.9992 2 1.00536 0.999098 10 x1(2) x(2) 2 x(2) 3 Thus the iteration process is continued. i x 1(i) x (i) 2 x (i) 3 0 1.2000 0.000 0.000 1 1.2000 1.0600 0.9480 2 0.9992 1.0054 0.9991 3 0.9996 1.001 1.001 4 1.0000 1.0000 1.00 5 1.000 1.000 1.000 The exact values of the roots are X1 = 1, x2 = 1, x3 = 1. 2 1 1 12. Find the inverse of the matrix 3 2 3 using Gauss Jordan method. 1 4 9 Solution: 2 1 1 Let A 3 2 3 1 4 9 x11 x12 X x 21 222 x 31 x32 x13 x33 x33 Ax = I 19 2 1 1 1 0 0 Step 1 3 2 3 0 1 0 1 4 9 0 0 1 2 1 1 1 3 Step 2 0 2 2 7 17 0 2 2 0 0 3 R2 R2 R1 3 2 1 0 2 1 R3 R3 R1 1 2 0 1 2 1 1 2 1 1 1 3 3 Step 3 0 2 2 2 0 0 2 10 0 1 0 R3 R3 7R 2 7 1 2 0 0 6 1 Step 4 0 0 6 2 0 0 2 10 5 17 4 7 1 3 1 R1 R1 R3 4 2 1 2 0 0 6 1 Step 5 0 0 6 2 0 0 2 10 5 17 4 7 1 3 R1 R1 2R 2 4 1 1 0 0 3 Step 6 0 1 0 12 0 0 1 5 0 5 2 17 2 7 2 1 2 R1 R 1 2 3 R2 R2 x 2 2 R R3 Y2 1 3 2 Hence the inverse of the given matrix 3 12 5 5 2 17 2 7 2 1 2 3 2 1 2 20 13. Using power method to find the dominant eigen values and eigen vector of 4 5 A . 1 2 Solution: 1 Let the initial even vector x 0 1 1 4 5 1 9 Now x1 Ax 0 9 1 9x i 1 2 1 3 3 5 7 1 4 4 5 3 3 x 2 Axi 1 1 2 1 2 1 3 3 3 2.333 0.333 1 2.333 0.333 2.333 2.333 x12 4 5 1 3.285 x 3 Ax12 1 2 0.143 0.314 1 3.285 0.714 3.285 3.285 x13 4 5 1 2.915 x 4 Ax13 1 2 0.217 0.566 1 2.915 0.194 2.915 x14 4 5 1 3.030 x5 Ax14 1 2 0.194 0.612 21 1 3.03 0.202 3.03 x15 4 5 1 2.99 x 6 Ax15 1 2 0.202 0.596 1 2.99 0.199 2.99 x16 4 5 1 3.005 x 7 Ax16 1 2 0.199 0.602 1 3.005 0.200 3.005 U 1 U 0.200 The determine eigen vector (1, -0.2). To find dominantevenvalue we have to solve Au = , u for 1 where U = (1, -0.2) 4 5 1 1 1 1 2 0.2 0.2 3 1 1.6 0.21 1 3 14. Using Newton raphson method to find correct to four decimals the root between 0 and 1 of the equation x3 – 6x + 4 = 0. Solution: f (x) = x3 – 6x + 4 Given f (0) = 4, f (1) = -1 f (0) f (1) = 4 (-1) < 0 the root of f (x) = 0 lies between 0 and 1 the value of the root is near to 1. Let x 0 = 0.7 an approximate 22 f(x) x 3 6x 4, f 1(x) 3x 2 6 f(0) x 30 6x 0 4, f 1(x 0 ) 3x 02 6 f(0 7) 0.7 6 0.7 4 0.143 3 f 1(0.7) 3 0.7 6 4.53 2 Then by Newton’s iteration formula we get x1 x0 f(x) f x0 1 0.7316 f x1 0.0019805 f 1 x1 3 0.7316 6 4.394 2 The second approximate x 2 x1 f(x1 ) f 1 x2 0.0019805 4.39428 0.73250699 0.7321 0.7316 the root of the equation = 0.7321 23 UNIT – II INTERPOLATION AND APPROXIMATION First differences of the function. Let y = f(x) be any function given by the values y0, y1, ……yn. Which it takes for the equidistant values x0, x1, ……xn of the independent variable x then y1 - y0, y2 – y1, …….yn – yn-1 are called the first differences of the function y. Denoted by y0, y1, ….. Shift operator: Let y = f(x) be function of x and x, x+h1 x + 2h … etc. be the consecutive values of x, then the operator E is defined as E[f(x)] = f(x+h) E is called Shift Operator. Formula for Newton forward and Newton Backward differences: The Newton’s forward interpolation formula is y ( x0 nh) y0 ny0 n(n 1) 2 n(n 1)(n 2) 3 y0 y0 ..... 2! 3! The Newton’s backward interpolation formula is y ( x0 nh) y0 ny0 n(n 1) 2 y0 ..... 2! Formula for Lagrange’s interpolation . Let Y = f(x) be a function which assumes the values f(x0), f(x1) ….. f(xn) corresponding to the values x: x1, x1 …..xn. Y f ( x) ( x x1 )( x x2 )...( x xn ) f ( x0 ) ( x0 x1 )( x0 x2 )...( x0 xn ) ( x x0 )( x x2 )...( x xn ) f ( x1 ) ......... ( x1 x0 )( x1 x2 )...( x1 xn ) Formula for inverse Lagrange’s interpolation: x ( y y1 )( y y2 )...( y yn ) x0 ( y0 y1 )( y0 y2 )...( y0 yn ) ( y y0 )( y y2 )...( y yn ) x1 ......... ( y1 y0 )( y1 y2 )...( y1 yn ) 24 Operator, , E, , . (i) yx = yx + h - yx (ii) yx = yx – yx – h (iii) yx = yx 1 h yx 1 2 = Y2 yx 1 h yx 1 2 2 h 2 h Relation between the operator and E: f(x) f x 1 h f ( x 1 h) 2 2 = E 1 E 1 E E 2 1 2 E E 1 1 f ( x) E 2 1 2 E 1 2 ( E 1) 2 2 1 2 f ( x) f ( x) Relation between the operator and E: [f(x)]= 1 f ( x 1 h) f ( x 1 h) 2 2 2 1 1 1 E 2 E 2 f ( x) 2 1 1 1 E 2 E 2 2 Error formula in interpolation: f (t ) f (t ) (t ) f ( x) ( x) (t x0 )(t x1 )....(t xn ) ( x x0 )( x x1 )...( x xn ) The above function f(t) is continuous in [x0, xn]. Numerical Examples: 01.Prove that if m and n are positive integers then m n f(x) = m + n f(x). Proof: m n f(x) = ( …. m times) ( ….. n times) f(x) = . …… (m + n) times f(x) = m+n f(x). 25 02. Find log x. Solution: log x = log (x + h) – log x xh log x log x = log (1 + h/x) 03. Find tan-1 x Solution: tan-1 x = tan-1 (x + h) – tan-1 (x) x h x tan 1 1 ( x h) x h tan 1 2 . x hx 1 04. It n is a positive integer then yn = y0 + nc1 y0 + nc2 2y0 + ……. + n y0. Proof: From the let y1 = Ey0 = (1 + ) y0 = y0 + y0 y2 = E2 y0 = (1 + )2 y0 = (1 + 2c1 + 2) y0 = y0 + 2c1 y0 + 2y0 Similarly yn = Eny0 = (1 + )n y0 = (1 + nc1 + …….n) y0 = y0 + nc1 y0 + …..ny0 Hence proved. 26 05. Prove that E E Proof:= E [f(x + h) – f(x)] E f(x) = E [f(x + h) – E [f(x)] = f(x + 2h) – f(x + h) 06. Prove that f(4) = f(3) + f(2) + 2 f(1) + 3 f(1) Solution:f(4) – f(3) f(3) = = [f(2) + f(2)] = f(2) + 2 f(2) = f(2) + 2 [f(1) + f(1)] = f(2) + 2 f(1) + 3 f(1). f(3) – f(2) = f(2) f(4) = f(3) + f(2) + 2f(1) + 3f(1). 07. Express f(x) = x4 – 5x3 + 3x + 4 in terms of factorial polynomials. Solution: Synthetic division method:Given f(x) = x4 – 5x3 + 3x + 4 By Synthetic division 1 1 5 0 3 0 1 4 4 4( E ) 2 1 4 4 1 ( D) 0 2 4 3 1 2 8 ( C ) 0 3 1(=A) 1(=B) f(x) = x(4) + x(3) – 8x(2) – x(1) + 4. 08. Estimate y2 from the following table. X 1 2 3 4 5 Yx 7 ? 13 21 37 27 Solution:- Here we are given four entries Viz. y1, y3, y4 and y5. Therefore the function yx can be represented by a third degree polynomial 3 yx = Constant and 4 yx = 0 in particular 4y1 = 0 (E – 1)4 y1 = 0;(E4 – 4E3 + 6E2 – 4E + 1) y1 = 0 y5 – 4y4 + 6y3 – 4y2 + 7 = 0; 38 – 4y2 = 0; y2 = 9.5 09. Obtain a function whose first differences is 6x2 + 16x + 11 Solution:Expressing the function in factorial notation, we get 6x2 + 16x + 11 = 6x(2) + 16x(1) + 11 f(x) = 6x(2) + 16x(1) + 11 Integrating we get 6 x (3) 16 x (2) 11x(1) f ( x) K 3 2 1 2 x (3) 8 x (2) 11x (1) K which is the required function. 10. Find 10 (1 – ax) (1 – bx2) (1 – cx3) (1 – dx4). Solution:Let f(x) = (1 – ax) (1 – bx2) (1 – cx3) (1 – dx4). f(x) is a polynomial of degree 10 and the coefficient of x10 is a, b, c, d. 10 f(x) = 10 (abcd x10) = abcd 10 x10 = 10! abcd. 11. Find n (1/x). Solution:Now ( 1 ) x 1 2( ) x = 1 1 x 1 x 1 x( x 1) = (1)2 x( x 1) ( x 2) and so on 28 Preceding like this n ( 1 ) = x (1)n x( x 1)( x 2)....( x n) 2 3 12. Evaluate x E Solution:Let h be the interval of differencing 2 3 2 1 3 x ( E ) x E ( E 1)2 E 1 x3 ( E 2 2 E 1) E 1 x3 ( E 2 E 1 ) x3 Ex 3 2 x 3 E 1 x 3 ( x h )3 2 x 3 ( x h )3 6 xh. 13. Given u0 = 1, u1 = 11, u2 = 21, u3 = 28 and u4 = 29 find 4y0. Solution:4y0 = (E4 – 4C1 E3 + 4C2 E2 – 4C3 E + 1) y0 = E4y0 – 4E3y0 + 6E2y0 – 4Ey0 + y0 = y4 – 4y3 + 6y2 – 4y1 + y0 = 29 – 112 + 126 – 44 + 1 = 0. 14. Write the relation between E and . Solution: f(x) = = f(x) – f(x – h) = f(x) – E-1 f(x) = (1 – E-1) f(x) E 1 E 15. Prove that (1+ ) (1 - ) = 1 Solution:(1 + ) (1 - ) f(x) = E E-1 f(x) 29 = E f(x – h) = f(x) (1+ ) (1 - ) = 1 16. Prove that = - Proof:f(x) = (E – 1) (1 – E-1) f(x) = (E – 1) [f(x) – f(x-h)] = E[f(x)] f(x) – E[f(x – h)] + f(x – h) = f(x+h) – f(x) – f(x) + f(x – h) = [Ef(x) – f(x)] – [f(x) – f(x – h)] = (E – 1) f(x) – (1 – E-1) f(x) = [(E – 1) – (1 – E-1)] f(x) = ( - ) f(x). 17. Prove that f(x) = (1 – E-1) f(x). Proof: f(x) = E-1 [f(x)] = E-1 [f(x + h) – f(x)] f(x) – f(x – h) = f(x) – f(x – h) = E-1 18. Prove that 023 6, 303 6 Solution:- 0nr 0 n>r n 0n n ! 0r 1r 1 023 23 2.13 6 303 33 3.23 3.i 3 6 30 19. Calculate (i) 306 (ii) 506 Solution:- 306 =36 – 3.26 + 3.16 (i) = 729 – 192 + 3 = 540 (ii) 506 =56 – 5.46 + 10.36 – 10.26 + 5.16 =15625 – 20480 + 7290 – 640 + 5 =1800. 20. Prove that E 1 2 -1 2 = μ+ 1 δ, E 2 = μ- 1 δ . 2 Solution:- 1 12 12 E 2 E 1 12 E 2 1 2 E 2 E 1 2 2 1 1 1 2 E 2 E 2 2 1 12 12 E 2 E E 1 1 12 E 2 1 1 2 21. Prove that Δ = 1 δ2 +δ 1+ δ 2 4 2 Proof:- 1 E 2 1 1 E 2 4 2 2 1 1 2 2 E E 1 1 2 2 2 2 1 E 1 E E 1 2 E 2 E 2 1 1 2 E E 1 E 2 E 12 E 12 1 1 E E 2 2 2 E 1 = . 2 1 31 2 E 2 4 E E 1 2 4 1 4 1 2 4 1 E 2 E 2 1 1 2 2 2 22. Prove that μ2 = 1+ 1 δ2 4 Proof:- 2 E 2 1 2 1 E 2 1 2 2 E E 1 2 4 1 2 1 1 E 2 E 2 4 4 2 1 4 4 1 2 1 4 2 23. Prove that (E + 1) = 2 (E – 1) . Solution:- 1 ( E 1) 2 E 1 E 2 .E E 1 E 1 2 2 E E 1 1 1 1 1 2 2 E 2 .E 2 E 2 E 1 1 2 2 1 2 E E E 1 1 1 2 2 E 2 E E 1 2 E 1 2 ( E 1) 2. 2 =2( E 1) E 1 1 2 2 1 2 24. Find the missing yx values from the first differences provided. yx 0 a b c d e yx 0 1 2 4 7 11 Solution:- By def: a–0=1 a=1 b – a = 2, b – 1 = 2 c – b = 4, c – 3 = 4 b=3 c=7 32 d – c = 7, d – 7 = 7 d = 14 e – d = 11, e – 14 = 11 e = 25 25. Evaluate n (ax n bx n1 ) Solution:(n (axn + bxn-1) = (n (axn) + (n (bxn-1) = a n! + b(0) = an! 26. Find f(x) if x2 + 2x + 2 = f(x) and the interval of differencing as unity. Solution:f(x) = = f (x + 1) – f (x) ( x + 1)2 + 2 (x + 1) + 2 – [x2 + 2x + 2] x 2 2x 1 2 x 2 2 x 2 2x 2 2x 3 27. Find the second degree polynomial fitting the following data. x 1 2 4 y 4 5 13 Solution:- x0 = 1, x1 = 2, x2 = 4, y0 = 4, y1 =5, y2 = 13 By Lagrange’s formula f ( x) ( x x1 )( x x2 ) ( x0 x1 )( x0 x2 ) y0 ( x x0 )( x x2 ) ( x1 x0 )( x1 x2 ) y1 ( x x0 )( x x1 ) ( x2 x0 )( x2 x0 ) ( x 2)( x 4) ( x 1)( x 4) ( x 1)( x 2) 4 5 13 3 2 6 1 8 x 2 48 x 64 15 x 2 75 x 60 13 x 2 39 x 26 6 1 6 x 2 12 x 30 6 x2 2 x 5 33 y2 Δ 2 x Ee x x 28. Prove that e . 2 x = e E Δ e Solution:- ( E 1 )e x . x Ee x x h Ee e e x e x x x h Ee e .e e h Ee x x e h xh e x ex 3 1 1 29. Show that bcd a abcd Solution: If f(x) = 1/x, f(a) = 1/a 1 1 1 1 b a f(a, b) = b ab a ba f(a, b, c) f b, c f a , b ca = f (a, b, c, d ) 1 1 bc ab ca 1 abc f b, c, d f a, b, c d a 1 1 1 = bcd abc d-a abcd 30. A function f(x) is given by the following table. Find f(0.2) by a suitable formula. x 0 1 2 3 4 5 6 F(x) 176 185 194 203 212 220 229 Solution: 34 The difference table is follows:- y = f(x) 0 176 (y0 1 185 9 (2y0 2 194 9 0 (3 y0 3 203 9 0 0 4 y0 4 212 9 0 0 0 5 y0 5 220 8 -1 -1 -1 -1 6 y0 6 229 9 1 2 3 4 5 x 2 (3 (4 (5 (6 Here x0 = 0, h = 1, y0 = 176 = f(x) We have to find the value of f (0.2). By Newton’s forward interpolation formula we have f ( x0 nh) y0 ny0 n(n 1) y0 ........ 2! f (0.2) ? x0 + nh = 0.2 0 + n = 0.2 n = 0.2 f (0.2) 176 (0.2) 9 (0.2)(0.2 1) 0 2 176 1.8 177.8 31. From the given table compute the value of sin 38. x 0 10 20 30 40 Sin x 0 0.17365 0.34202 0.5 0.64276 Solution:As we have to determine the value of y = sin x near the lower end, we apply Newton’s backward interpolation formula. The difference table is as given below. 35 x0 y y(x) = Sin x0 2y 3y 4y 0 0 10 0.17365 0.17365 20 0.34202 0.16837 - 0.00528 30 0.5000 0.15798 - 0.01039 - 0.00511 40 0.64279 0.14279 - 0.01519 - 0.0048 0.00031 X0 Y0 y0 2y0 3y0 4y0 Here x0 = 40, h = 0.64279, h = 10 Newton’s backward differences formula y ( x0 nh) y0 ny0 n(n 1) 2 y0 .... 2! y (38) x0 nh 38 40 n(10) 38 y (38) 0.64279 ( 0.2) (0.14279) n 0.2 ( 0.2) ( 0.2 1) ( 0.01519) 2! (0.2) (0.21) (0.22) (0.0048) neglible term 3! 0.64279 0.028558 0.0012152 0.0002304 0.61566 32. If Ux = ax2 + bx + C, then show that U2n - nC12U2n-1 +nC2 2U2n-2 ........ + (-2)n un = (-1)n (1- 2an) Solution:Given that Ux=ax2 + bx + C Un =an2 + bn + C, Uni > a polynomial of degree 2 in n 3un = 4 un = 0 Let the interval of differencing be equal to 1. Now Un = an2 + bn + C Un = a (n + 1)2 + b (n + 1) + C – an2 – bn – C 36 = 2Un = 2 an + a + b [Un) = 2a (n + 1) + a + b – 2an – a – b = 2a LHS :U2n – nC1 2U2n-1 + nC2 U2n-2 - ……. = [En Un – nC1 2En-1 Un + nC2 En-2 …..] Un = [En – nC1 2En-1 Un + nC2 En-2 ……..] Un = (E – 2) n Un = (E – 1 -1 )n un = ( - 1)n Un = (-1)n (1 - )n Un = (-1)n [1 – nC1 + nC2 2 + …….]Un = (-1)n [Un – n Un + = n2 n (-1)n an2 bn C n(2an a b) 2a 2 E–1= n( n 1) 2 Un + ….] 2! = (-1)n (C – 2an) = RHS. 33. In an examination the number of candidates who obtained marks between certain limits were as follows:Marks No. of Students 30 – 40 40 – 50 50 – 60 60 – 70 70 – 80 31 42 51 35 31 Find the number at candidate whose scores lie between 45 and 50. Solution:- First we construct a cumulative frequency table for the given table. Upper limits 40 50 60 C.F . 31 73 124 70 159 80 190 37 The difference table is x y Marks C.F. 40 31 50 73 42 60 124 51 9 70 159 35 -16 - 25 80 190 31 -4 12 y 2y 3y 4y 37 We have x0 = 40, x = 45, h = 10 U x x0 45 40 0.5 h 10 y0 = 73, y0 = 42, 2y0 = 9, 3y0 = - 25, 4y0 = 37 From Newton’s forward interpolation formula U (U 1) 2 U (U 1) (U 2) 3 y y 0 0 2! 3! U (U 1) (U 2) (U 3) 4 y ...... 0 4! f ( x) y U y 0 0 (0.5) (0.5) (0.5) (0.5 1) (0.5 2) (9) ( 25) 2! 6 (0.5) (0.5) (1.5) ( 2.5) (37) 24 f (45) 31 (0.5) 42 = 47.8673 = 48 approximately. The number of students who obtained marks less than 45 = 48, and the number of students who scored marks between 45 and 50 = 73 – 48 = 25. 38 34. Find the form of the function f(x) under suitable assumption from the following Solution:- The divided differences table is given below. X f(x) 0 2 1 3 2 12 5 147 f(x) 32 1 0 2f(x) 3f(x) 1 12 3 2 1 9 147 12 52 45 9 1 20 4 45 9 5 1 9 94 1 50 We have x0 = 0, f(x0 = 2, f(x0, x1) = 1, f(x0, x1, x2) = 4 f(x0, x1, x2, x3) = 1 The Newton’s divided difference interpolation formula is X 0 1 2 5 f(x) 2 3 12 147 f ( x) ( fx0 ) ( x x0 ) f ( x0 , x1 ) ( x x0 ) ( x x1 ) f ( x0 , x1 , x2 ) ( x x0 ) ( x x1 ) ( x x2 ) f ( x0 , x1, x2 , x3 ) 2 ( x 0) 1 ( x 0) ( x 1) 4 ( x 0) ( x 1) ( x 2) 1 x3 x 2 x 2 35. Using Lagrange’s interpolation formula, find the value of y corresponding to x = 10 from the following table. x 5 6 9 11 f(x) 12 13 14 16 Solution:We have x0 = 5, x1 = 6, x2 = 9, x3 = 11 Y0 = 12, y1 = 13, y2 = 14, y3 = 16 Using Lagrange’s interpolation formula, we have y f ( x) ( x x1 ) ( x x2 ) ( x x3 ) ( x0 x1 ) ( x0 x2 ) ( x0 x3 ) y0 ( x x0 ) ( x x2 ) ( x x3 ) ( x1 x0 ) ( x1 x2 ) ( x1 x3 ) 39 y1 ( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 ) y2 ( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 ) y3 Substitute f (10) (10 6) (10 9) (10 11) (5 6) (5 9) (5 11) (10 5) (10 6) (10 11) (9 6) (9 6) (9 11) 2 (10 5) (10 9) (10 11) (12) (6 5) (6 9) (6 11) 14 (10 5) (10 6) (10 9) (11 5) (11 6) (11 9) (13) 16 13 35 16 42 3 3 3 3 36. Find the value of x when y = 85, using Lagrange’s formula from the following table. x 2 5 8 14 y 94.8 87.9 81.3 68.7 Solution:- x0 = 2, x1 = 5, x2 = 8, x3 = 14 y0 = 94.8, y1 = 87.9, y2 = 81.3, y3 = 68.7 y = 85 We know that the Lagrange’s inverse formula is x ( y y1 ) ( y y 2 ) ( y y3 ) ( y0 y1 ) ( y0 y 2 ) ( y0 y3 ) x0 ( y y0 )( y y1 )( y y3 ) ( y 2 y0 )( y 2 y1 )( y 2 y3 ) ( y y 0 ) ( y y 2 ) ( y y3 ) ( y1 y0 ) ( y1 y 2 ) ( y1 y3 ) x2 ( y y0 )( y y1 )( y y 2 ) ( y3 y0 )( y3 y1 )( y3 y 2 ) Substituting the above values we get, x (85 87.9) (85 81.3) (85 68.7) 2 (94.8 87.9) (94.8 81.3) (94.8 68.7) (85 94.8) (85 81.3) (85 68.7) .5 (87.9 94.8) (87.9 81.3) (87.9 68.7) (85 94.8) (85 87.9) (85 68.7) (8) (81.3 94.8) (81.3 87.9) (81.3 68.7) (85 94.8) (85 87.9) (85 68.7) 14 (68.7 94.8) (68.7 87.9) (68.7 81.3) x = 6.5928. 40 x1 x3 37. Find the first term of the series whose second and subsequent terms are 8, 3, 0, -1, 0 …….. Solution:- Given f(2) = 8, f(3) = 3, f(4) = 0, f(4) = -1, f(5) = 0 We are to find f(1) We construct the difference table with the given values. f(x) 2 f(x) 3 f(x) X f(x) 2 8 3 3 -5 4 0 -3 2 5 -1 -1 2 0 6 0 1 2 0 4 f(x) 0 We have 3 f(x) = 4 f(x) = 0 Using the displacement operator f(1) = E-1 (f(2)) = (1 + )-1 f(2) = (1 - + 2 - 3 + ….) f(2) = f(2) - f(2) + 2 f(2) - 3 f(2) + …….. = 8 – (- 5) + 2 = 15 f(1) = 15 41 38. Find f(x) as a polynomial in x for the following data by Newton’s divided difference formula X : F(x) : -4 -1 0 2 5 1245 33 5 9 1335 Solution: X F(x) -4 1245 f ( x ) 2 f x 3 f x 4 f x -404 -1 33 94 -28 0 5 -14 10 3 2 2 9 13 88 442 5 1335 By Newton’s divided difference interpolation formula f(x)= 1245 + (x+4) (-404) + (x+4) (x+1) 94 + (x+4) (x+1) x(-14) + (x+4) (x+1) x(x-2)3 = 3x4 + x3 – 14x+5 39. The following table gives same relation between steam pressure and temperature. find the pressure at temperature 372.10 T 3610 3670 3780 3870 3990 P 154.9 167.9 191.0 212.5 244.2 Solution: T P 361 154.9 367 167.0 378 191.0 p 2 p 3 P 4 p 2.016666 0.0097147 2.18181818 0.000024 0.0103535 2.388889 387 212.5 0.00000073 0.000052 0.01203703 2.641667 399 244.2 42 By Newton’s divided difference formula P(T=372.10) = 154.9 + (11.1)(2.016666) + (11.1) (5.1) (0.009914) + (11.1) (5.1) (-5.9) (0.000024) + (11.1) (5.1) (-5.9) (-14.9) (0.00000073) = 177.8394819 40. From the data given below, find the number of students whose weight is between 60 to 70 Weight No of 0-40 40-60 60-80 80-100 100-120 250 120 100 70 50 Students Solution: x Y Weight No of Students Below 40 250 Below 60 370 Below 80 470 y 2 y 3 y 4 y 120 -20 100 -10 -30 70 Below 100 540 20 10 -20 50 Below 120 590 x x0 70 40 1.5 h 20 u u 1 2 y 70 y0 u y0 y0 ....... 2! 1.51.5 0.5 0.5 0.5 =250+ 1.5120 20 10 2 6 1.5 0.5 0.5 1.5 24 =424 u Number of students whose weight is between 60 and 70 = y(70) – y(60) = 424 – 370 = 54 43 41. Explain Cubic Sp line. The concept of the sp line originated from the mechanical drafting tool called spline used by designers for drawing smooth curves. It is a splender flexible bar made of wood or some other elastic material this curves resemble cubic curves and hence the name cubic spline has been given to the piecewise cubic interpolating polynornials. Cubic splines are popular because of their ability to interpolate data with smooth curves. we consider here the construction of cubic spline function which would interpolate the points (x0, f0) (x1, f1) ……(xn, fn). The cubic sp line s(x) consists of (n-1)3 corresponding to (n-1) sub intervals. If we denote such cubic by si(x) then s(x)= s;(x) i = 1,2…….n As pointed out earlier, there cubic must satisfied the following conditions (i) S(x) must interpolate f at all points x0, x1, ……xn i.e. for each i, S(xi) = fi (ii) The function values must be equal at all the interior knots i.e. Si(xi) = Si+1 (xi) The first derivative at the interior knots must be equal.(i.e) si’(xi) (iii) = Si+1’(xi) (iv) The second derivatives at the interior knots must be equal i.e. Si”(xi)= Si+1”(xi) The second derivatives at the end joint are 2000. i.e. S”(x0) (v) =S”(xn) = 0 A Cubic splines with zero second derivatives at the end joints are called the natural cubic splines. 42.. Estimate the function value f at x=7 using cubic splines Xi 4 9 16 Fi 2 3 4 Solution: Here h1 = x1 – x0 = 9 – 4 = 5 h2 = x2 – x1 = 16 – 9 = 7 f0 = 2; f1 = 3, f2 =4 44 ai 1 a hi 2ui ui 3 i ui31 hi2ui 1 6hi 6hi 1 fi ui 1 f i 1ui (1) hi f fi fi f i 1 hi a i-1 2 hi hi 1 ai hi 1ai 1 6 i 1 (2) hi hi 1 Si ( x) . put i = 1in (2) f f f f h1 a 0 2 h1 h2 a1 h2 a2 6 2 1 1 0 0 h1 h2 43 3 2 0 2 5 7 a1 0 6 5 7 1 1 24a 1 = 6 7 5 a 1 0.0142 Since n 3 there are two cubic splines namely, S1 ( x), x 0 x x, and S2 x , x1 x x2 . The target point x = 7 is in the dornain of S1(x) and therefore we need to use only S1(x) for estimation put i=1 in (1) S1 x a0 2 a 1 h1 a1 u13 1 u03 h12u0 f1u0 f 0u1 6 6h1 h1 u0 x x0 7 4 3; S1 x 0 u1 x x1 7 9 2 0.0142 33 52 3 1 3 3 2 2 6 5 5 S1 x 2.6229 43. From the following table X 1 2 3 Y -8 -1 18 compute y(1.5) and y’(1) using cubic splines Solution: here x0=1, t0=-8, x1=2, x2 =3 t1=-1, t2= 18 45 h1=h2=1 t t t t W.K.T. h1a0 +2(h1+h2 )a1+h2 a2 = 6 2 1 1 0 h1 h2 4a1=6(12) a1= 18 u0 = x - x0 = 0.5; S ( x) u1=x –x1 = -0.5 a0 2 a 1 h1 u1 u13 1 u03 h12 u1 t1u0 t0u1 6h1 6h1 h1 S 1.5 0 18 1 3 0.5 12 0.5 1 0.5 8 0.5 6 1 S 1.5 5.625 S x a0 2 a 1 h1 u1 u13 1 u03 h12 u1 t1u0 t0u1 6h1 6h1 h1 18 3 x 1 x 1 1 x 1 8 x 2 6 3 x3 9 x 2 13 x 15 S11 ( x) 9 x 2 18 x 13 S11 1 4 46 UNIT – III NUMERICAL DIFFERENTIATION AND INTEGRATION Numerical differentiation: Numerical differentiation is the process of calculating the derivatives of a given function by means of a table given values of that function. i.e., if y (xi, yi) are the given set of values, then the process of computing the values of dy d2 y , ......... is called numerical dx dx 2 differentiation. Formula of forward difference formula to compute the derivatives: f 1 x 0 1 y 0 1 2 y 0 1 3 y 0 1 4 y 0 ........ h 2 3 4 11 2 3 4 f x 0 1 2 y 0 y 0 11 y 0 .......... 12 h f 111 x 0 1 3 3 y 0 3 4 y 0 ............ 2 h Formula of backward difference formula to computer the derivatives: f 1 x 0 1 y 0 1 2 y 0 1 4 y 0 ........ h 2 3 f 11 x 0 1 2 2 y 0 3 y 0 11 4 y 0 .......... 12 h f 111 x 0 1 3 3 y 0 3 4 y 0 ............ 2 h Numerical Integration: The term numerical integration is the numerical evaluation of a definite integral. b A f x dx Where a and b are given constants and f(x) is a function. a Formula for Trapezoidal Rule: x0 nh y x dx h 2 y 0 y n 2 y1 y 2 ....... y n1 x0 47 Formula for Simpson’s 1/3 rule: x0 nh f x dx h 3 y 0 yn 4 sum of odd ordinates x0 +2 sum of even ordinates Formula for Simpson’s 3/8 rule: x0 nh f x dx 3h 8 y 0 yn 3 y1 y 2 y 4 y 5 ......yn6 x0 +2 y3 y 6 .........yn3 Truncation error in the Trapezoidal rule: The total error h3 11 11 y1 y 2 .......... y11 E n 12 nh3 11 E< y 12 Error in the trapezoidal rule is of the order h2. Truncation error in Simpson rules: The error in the interval (r1, r3) 5 4 h5 y1iv 15 18 24 25 5 iv h y 90 h5 iv y1 90 The total error: nh5 iv y 90 Error in the Simpson 1/3 rule is of the order h4. 48 Formula for Romberg method: I=I2 I2 I1 3 2 I1 dividing h into two parts h I2 dividing h into four parts I3 dividing h into eight parts Formula for Gauss Quadrature 2 point: b Gauss two point formula is f x dx a 1 b a b a a b f z dz 2 1 2 2 1 1 f 3 3 1 f x dx f -1 Formula for Gaussian Quadrature 3 point: b 1 a 1 f x dx f t dt Where the interval (a, b) is changed in fo(-1, 1) by the transformation. x ba ba t 2 2 1 Then f t dt 0.5555 f 0.77459 f 0.77459 0.8888 f 0 1 Formula for Evaluation of Double integration using Trapezoidal: Let the given double integral be of the form b d I f x,y dxdy a c I hK 4 [sum of values of f at the four corners +2 (sum of the values f at the remaining nodes on the boundary) +4 (sum of the values of f at the interior nodes)] 49 Numerical Examples: 5.2 01. Compute the value of the definite integral logxdx using trapezoidal rule? 4 Solution: Here f(x) = log x, a = x0=4, b=xn=5.2 Divide the internal of interaction into six equal parts each of width 0.2. h 5.2 4 0.2 6 X 4.0 4.2 4.4 4.6 4.8 5.0 5.2 F(x) 1.3863 1.4351 1.4816 1.5261 1.5686 1.6094 1.6457 We know that Trapezoidal rule b h f x dx 2 y 0 y n 2 y1 y 2 .........y n1 a 52 h log x dx = 2 y 0 y 6 2 y1 y 2 y 3 y 4 y 5 4 = 0.2 1.386294 1.6486 2 1.435084 2 +1.481604 1.526056 1.568615 1.609237 = 0.1 3.034952 15.241562 =1.876544 2 2 dxdy using Trapezoidal rule with h =0.5. x + y 1 1 02. Evaluate the integral I = Solution: Using Trapezoidal rule 2 2 dxdy xy 1 1 I 1 f 1,1 f 2,1 f 1,2 f 2,2 16 + f 3 ,1 f 1, 3 f 2, 3 f 3 ,2 4f 3 , 3 2 2 2 2 2 2 1 0.5 1 1 0.25 2 0.4 0.4 2 2 4 16 3 3 7 7 3 0.323304 50 2 03. Evaluate dx using Gaussian 2 point formula. x 1 Solution: Transform the variable x to t by the transformation ab ba x t 2 2 1+2 2 1 = t 2 2 =3 t 2 2 dx dt 2 2 1 1 dx 2 dt dt I x 1 3 t 2 1 3 t 1 Here 1 1 f 3 3 1 0.2795 3 1 f 1 0.41288 3 1 3 3 I f 1 f 1 2 3 =0.6923 2 04. Evaluate dx using Gaussian 3 – point formula. x 1 Solution: Transform the variable from x to t by the transformation. ba ba x t 2 2 3 t 2 2 dt dx 2 1 3t dt x 2 3t 1 51 2 1 dx I f t dt A1f x1 A 2 f t 2 A 3 f A 3 x 1 1 A1 A 2 0.555 A 3 0.888 f t1 f 0.7745 1 0.4493 3 0.7745 f t2 f 0 1 3 1 f t3 0.2649 3 0.7745 I= 0.555(0.4493) +0.555(0.2649) +0.333(0.888) = 0.6931 4 05. Using Simpson rule find ex dx given that e0 = 1, e1 = 2.72, e2= 7.39, e3=20.09, 0 e4 = 54.6. Solution: By Simpson rule we have 4 h e dx u y x 0 y 4 2y 2 4 y1 y 3 0 = 1 54.6 1 2 7.39 4 2.72 20.04 3 =53.8733 06. Write the polynomial to calculate the value of x when? X 3 5 7 9 Y 6 24 58 108 Solution: X Y 3 6 y 2y 3y 18 5 24 16 34 3 58 0 16 50 9 108 x0 nx x 3 n2 x; 2n x 3; n x 3 2 52 y x 0 nx y 0 ny 0 n n 1 2 y 0 ..... 2! x 3 x 3 2 2 1 x 3 16 y x 6 18 2 2 y x 2x 2 3x 9 1 07. Evaluating dx 1+ x 2 by a numerical iteration method, Find this value? 0 Solution: 1 1 dx 1 tan x 0 1 x2 0 =tan-1 1 tan1 0 =tan-1 1 = 2 1 09. Find the value of log 21/3 x2 from dx using Simpson’s 1/3 rule with h = 0.25. 1+ x 3 0 Solution: Given h = 0.25 X 0 0.25 0.5 0.75 1 Y 0 0.06154 0.222 0.395 0.5 By Simpson’s 1/3 rule 1 x2 h 0 1 x3 dx 3 y0 y 4 2y2 4 y1 y3 =0.23log3 We know that 1 1 x2 1 log 1 x 3 dx 0 1 x3 3 0 log 2 1 3 = 1 loge2 3 1 x2 dx 0.231083 1 x3 0 53 10. Find the first second and 3rd derivatives of the function tabulated below at the point x=1.5? X 1.5 2.0 2.5 3.0 3.5 4.0 F(x) 3.325 7.0 13.625 24.0 38.87 59.0 Solution: The table of difference is as follows: X F(x) 1.5 3.375 y 2y 3y 4y 3.625 2.0 7.0 3.0 6.625 2.5 13.625 0.75 3.25 0 10.375 3.0 24.0 0.75 4.50 0 14.875 3.5 38.875 0.75 5.25 20.125 4.0 59.0 Here we have to find the derivatives at the point x = 1.5 which is the starting value of the table. Therefore newton’s forward differences formula for derivatives at x = x0, we have f 1 x 0 1 y 0 1 2 y 0 1 3 y 0 ....... h 2 3 f0 1.5, h = 0.5 3.625 1 3 1 0.75 f 1 1.5 1 0.5 2 3 =4.75 f 11 x 0 1 2 2 y 0 3 y 0 11 4 y 0 ....... 12 h 1 = 3.0 0.75 2 0.5 =9.0 f 111 x 0 1 3 3 y 0 3 4 y 0 2 h 1 = 0.75 3 0.5 =6.0 54 11. The population of certain town is shown in the following table. Year 1931 1941 1951 1961 1971 Population 40.6 60.8 79.9 103.6 132.7 (in thousands) Find the rate of growth of the population in the year 1961. Solution: The table of difference is as follows: X Y 1931 40.6 y 2y 3y 4y 20.2 1941 60.8 -1.1 19.1 1951 79.9 5.7 4.6 23.7 1961 103.6 -4.9 0.8 5.4 29.7 1971 132.7 Here h = 10, x0 = 1971 We know that 2 3 2 2n 1 2 3r 6r 2 3 2r 9r 11r 3 4 1 y x0 nh 1 y0 y0 y0 y0 h 2 6 12 1 y 1961 ? x0 nh 1961 1971 n10 1961 n10 10 n 1 55 y1 1961 1 29.1 1 5.4 1 0.8 1 4.9 10 2 6 12 = 1 29.1 2.7 0.1334 0.4083 10 =2.6775 = 1 4 0.7899 0.7943 0.7884 3 we get I h1, h , h I 0.6,0.3,0.15 2 4 = 1 4 I 0.15 0.3 I 0.3, 0.6 3 = 1 4 0.7884 0.7886 3 =0.7883 The table of these values 0.8113 0.7886 0.7948 0.7883 0.7884 0.7899 2 dx 0.7883 1 x 0 I 12 12. Using Romberg’s Method compute I = dx 1+ x correct to 4 decimal places. 0 Solution: Here f(x) = 1 1 x Take h = 0.6, 0.3, 0.15 H = 0.6, h/2=0.3, h/4=0.15 X 0 0.15 0.30 0.45 0.60 0.75 0.9 1.05 1.20 F(x) 1 0.8695 0.7692 0.6896 0.6250 0.5014 0.5263 487 434 Using Trapezoidal method, 56 0.6 1 0.4545 2 0.6256 2 =0.8113 I h I 0.6 I1 with h= 0.6 0.3 2 we get 2 I0.3 I I h 2 0.3 1 0.4545 2 0.7692 0.625 0.5263 2 =0.7943 = with h 0.6 0.15we get 4 4 I0.15 I I h 3 0.15 1 0.4545 0.8695 0.7692 0.6896 2 + 0.6250+0.5714+0.5263+0.4878 =0.7899 Now, I h, h 2 I0.6, 0.3 = I 4 I 0.3 I 0.6 3 = I 4 0.7943 0.8113 3 =0.7886 I h , h I0.3,0.15 2 4 = I 4 I 0.15 I 0.3 3 1 13. Evaluate e -x2 dx by dividing the range of initiation in to 4 equal parts using (i) 0 Trapezoidal rule (ii) Simpson’s rule. Solution: Here the length of the interval is h = 1 0 = 0.25. The values of the function y = e-x2 u for each point of sub divisions are given below. 57 X 0 0.25 0.5 0.75 1 -x2 1 0.9394 0.7784 0.5694 0.3628 Y0 Y1 Y2 Y3 Y4 e (i) By Trapezoidal rule 1 x e dx 2 0 h y 0 y 4 2 y1 y 2 y 3 2 0.25 1.3678 2 2.8761 2 = 0.125 5.943 = =0.7428 (ii) By Simpson’s rule: 1 e x2 dx 0 h y 0 y 4 2y 2 4 y1 y 3 3 0.25 1.3678 1.5576 6.0352 2 =0.7467 = 14. The velocity v of a partial ad distances from a point on its path is given by the table. F 0 10 20 30 40 50 60 Feet V 47 58 64 65 61 52 38 Feet/fer Estimate the time taken to travel 60feet by using Simpson’s one third value. Compare the result with Simpson’s 3/8 rule. Solution: We know that the rate of charge of displacement is velocity ds V dt ds vdt 1 dt ds v 1 Here we find to find the time taken to travel 60 feet. Therefore interstate (1) from 0 to 60 We get 60 60 0 0 1 dt v ds The time taken to travel 60 feet is 58 60 t 0 1 ds v 60 ydx 0 The given table can write as given below: X(5) 0 10 20 30 40 50 60 1 0.2127 0.017 0.0156 0.01538 0.0164 0.01923 0.0263 Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y= v Simpson’s one third we have 60 h ydx 3 y 0 y 6 2 y 2 y 4 4 y1 y 3 y 5 0 = 10 0.02127 0.0263 2 0.01563 0.0164 3 +4 0.01724+0.01538+0.01923 10 0.04758 0.020740 0.06406 3 1.06 sec Hence time taken to travel 60 feet is 1.063 feets By Simpson’s 3/8 rule 60 ydx 3h 8 y 0 0 y 6 3 y1 y 2 y 4 y 5 2 y 3 3 10 0.02127 0.02630 3 0.01723 0.0156 8 + 0.01640+0.01923 2 0.01538 3.75 0.04757 0.20547 0.03076 1.064 sec 1.4 15. Evaluate sinx - ln x + e dx by Simpson’s 1/3 rule. x 0.2 Solution: Let us divide the interval at integration in to twelve equal parts by taking h = 0.1. Now the table of values of the given function y = sinx – lnx + ex at each point of subdivision is as given below. X 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Y 3.0291 2.8493 2.7975 2.8213 2.8915 3.014 3.348 3.559 3.559 X 1.1 1.2 1.3 1.4 Y 3.8007 4.0698 4.3705 4.7041 59 Simpson’s rule 1.4 h ydx 3 y 0 y12 2 y 2 y 4 y 6 y 8 y10 0.2 +4 y1 y 3 y 5 y 7 y 9 y11 0.1 7.73369 2 16.49077 4 20.20418 3 =4.05106 = 2 16. Evaluate dx 1+ x 3 by Gauss 3 point formula:- 1 Solution: Transform the variable from x to t by the transformation. ba ha t 2 2 3 t 3t = 2 2 2 2 1 dx 1 dt 3 3 1 x 3t 2 1 1 1 2 x 1 =4 -1 1 =4 1 8 3 t 3 dt 3 A1f t1 A 2 f t 2 A 3 f t 3 dt -1 8 3 t where 60 f t 1 3 t 3 8 A1 A 2 0.55 A 3 0.888 f t1 f 0.7745 f t2 f 0 1 3 0.7745 3 8 0.0525 1 0.0285 35 f t 3 f 0.7745 1 3 0.7745 3 8 0.0162 I 4 0.5555 0.0525 0.555 0.0285 0.888 0.0162 =4 0.0292+0.0158+0.0144 =0.0594 4 =0.2376 2 2 dxdy Using the trapezoidal rule with h = k = 0.5 and h = x+y 1 1 17. Evaluate to integral I = k = 0.25 Solution: When h = k = 0.5 Y0=1 y Y1=1.5 Y2=2 x X0=1 f01 = 0.4 f00=0.5 X1=1.5 f10=0.4 X2 = 2 f02=0.33 f11=0.33 f12=0.285 f21=0.285 f20=0.33 f22=0.25 hk f00 f02 f21 f22 2 f01 f10 f21 4 f11 u 1 = 0.5 0.33 0.25 0.33 2 0.4 0.4 0.285 0.285 4 0.33 16 =0.3418 I When 61 Y0=1 y Y1=1.25 Y2=1.5 Y3=1.25 Y4=2.0 x X0=1 f(1,1) f(1,1.25) f(1.25,1.25) f(1,1.5) f(1.25,1.5) f(1,1.75) f(1,2.0) f(1.25,1.75) f(1.25,2) f(1.25,1) X1=1.25 f(1.5,1.25) f(1.5,1.5) f(1.5,1.75) f(1.5,2) f(1.5,1) X2=1.5 f(1.75,1.25) f(1.75,1.5) f(1.75,1.75) f(1.75,2) f(1.75,1) X3=1.75 f(2,1) f(2,1.25) f(2,1.5) f(2,1.75) f(2,2) X4=2.0 I 1 f 1,1 f 1,2 f 2,1 f 2,2 2f 1,1.25 f 1,1.5 65 +f 1,1.75 f 1.25,1 f 1.5,1 f 1.75,1 f 2,1.25 +f 2,1.5 f 2,1.75 f 1.25,2 f 1.5,2 f 1.75,2 4 f 1.25,1.25 f 1.25,1.5 f 1.25,1.25 f 1.5,1.25 +f 1.5,1.25 f 1.5,1.5 f 1.5,1.75 f 1.75,1.25 f 1.25,1.5 f 1.25,1.25 0.3401 4.4 2.6 18. Using Trapezoidal and Simpson’s rule evaluate I = 4 2 dydx xy Solution: Taking h = 0.3 along x direction and k =0.2 along y direction we can construct the following table where f x,y 1 xy 62 2.0 2.3 2.6 X0=4.0 f(x0,y0)=0.125 f(x0,y1)=0.108 f(x0,y2)=0.0961 X1=4.2 f(x1,y0)=0.119 f(x1,y1)=0.1035 f(x1,y1)=0.0916 X2=4.4 f(x2,y0)=0.1236 f(x2,y1)=0.0988 f(x2,y2)=0.0874 y x I 0.2 0.3 0.1250 0.0961 0.1136 0.0874 4 +2 0.1190+0.1087+0.0916+0.0988 4 0.1035 0.0250 using Simpson’s rule hk f00 f20 f22 4 f10 f01 f11 f21 16f11 9 0.2 0.3 0.1250 0.0961 0.1136 0.0874 4(0.1087 9 +0.1190+0.0916+0.988)+16 0.1035 I =0.0250 19. If D, E, and be the operators with usual meaning and if hD = u where h13 the interval at differencing. Prove that the following relations between the operator’s. (i) E= eu 2 (iii) μ = cosh u 2 (ii) δ = 2sinh u (iv) (E+1) =2(E-1) Solution: (i) E = ehD =Eu (hD=u) (ii) 2 sin h u 2 eu 2 eu 2 2 2 Eu 1 2 Eu 1 2 by dt 63 (iii) cos u 2 1 E 2 E u E 1 2 u 1 2 E 2 u Eu 2 1 2 2 E 2 1 2 (iv) E 1 E 1 =E 1 2 E E 1 2 1 2 E E 1 2 1 2 E 1 2 E 1 2 E 12 E 12 = E-1 2 2 =2 E-1 20. 12500 = 111.8034, Given that 125110 = 111.8481 12516 . find the value of The difference table X 12500 y x y 2y 111.8034 0.0471 12510 111.8481 0 0.0447 12520 111.8928 0 0.0447 12530 111.9375 We have x0 = 12500, h = 10, x = 12516 u x x0 12516 12510 1.6 h 10 64 u u 1 f x y 0 uy 0 2 y 0 ..... 21 f 12516 111.8034 1.6 0.0447 =111.8034+0.07152 =111.87492 12516 111.87492 21.Use Newton’s forward interpolation and find value of sin 52 from the following data. Estimate the error. X 45 50 55 60 Y=sinx 0.7071 0.7660 0.8192 0.8660 2y 3y Solution:The difference table X Sin x 45 0.7071 y 0.0589 50 0.7660 -0.0057 0.0532 55 0.8192 -0.0007 -0.0064 0.0462 60 0.8660 We have x0 = 45, x1 = 52, y0= 0.7071, y0 = 0.0589, 2y0 = -0.0057, 3y0 = -0.0007 u x x0 52 45 1.4 h 5 Newton’s formula y u0 uy 0 u u 1 2! 2 y0 u u 1 u 2 f 52 0.7071 1.4 0.0589 + 3! 1.4 1.4 1 sin52 0.7880032 u u 1u 2 .... u n n 1! 0.0057 2 1.4 1.4 11.4 2 3! =0.7071+0.8246-0.001596+0.000392 Error 3 y 0 ..... n1y0 65 0.0007 using n = 2 we get u u 1u 2 3 y0 3! 1.4 1.4 11.4 2 6 22.The y= following 0.0007 0.0000392 table gives the values of the e π -x2 dx corresponding to certain values of x. For what value of x is this integral equation of to ½? X 2 π n -x e dx 2 0.46 0.47 0.48 0.49 0.4846 0.4937 0.5027 0.5116 0 Solution: Here x0=0.46, x1=0.47, y0 = 0.487 y = ½ From Laurens’s inverse interpolation formula y y1 y y 2 y y3 x y y0 y y 2 y y 3 x y0 y1 y0 y 2 y0 y3 0 y1 y0 y1 y 2 y1 y3 1 y y0 y y1 y y3 x y y0 y y1 y y 2 x y 2 y0 y 2 y1 y 2 y3 2 y3 y0 y3 y1 y3 y 2 3 x integral n 2 0 y= probability 0.5 0.49 0.5 0.5274 0.5 0.51 0.46 0.48 0.49 0.48 0.52 0.48 0.51 0.5 0.48 0.5 0.502 0.5 0.511 0.47 0.49 0.48 0.49 0.502 0.49 0.511 0.5 0.48 0.5 0.49 0.5 0.511 0.48 0.52 0.48 0.52 0.49 0.52 0.511 0.5 0.48 0.5 0.49 0.5 0.502 0.49 0.51 0.48 0.51 0.49 0.51 0.502 0.0207787 0.157737 0.369928 0.0299495 0.476937 66 UNIT - IV INITIAL VALUE PROBLEMS FOR ORDINARY DIFFERENTIAL EQUATIONS Initial value problem: A general solution of a differential equation of nth order has n arbitrary constants. It will be of the form f(x,y,c1,c2,…cn) =0. if n conditions are given we can obtain the values of the constants c1,c2,…cn. If all the n conditions are specified at the initial point only, then the problem is called an initial value problem Boundary value problem: A general solution of a differential equation of nth order has n arbitrary constants. It will be of the form f(x1, y1, c1, c2, ….cn) = 0. If n conditions are given we can obtain the values of the constants c1, c2….. cn If n conditions are specified at more than one point, then the problem is called a boundary value problem Particular solution: A most general from of an ordinary differential equation is given by Q (x, y, dy d 2 y dny , ,.... n ) = 0 we know that the general solution of a differential equation of nth order dx dx 2 dx has n arbitrary constants. If we give particular values to the constants, the solution is said to be a particular solution. Formula for Taylor series: Yn+1 yn h 1 h 2 II h3 III yn yn yn ...... 1! 2! 3! Formula for Euler’s method or Euler’s algorithm: Yn+1= yn +h f (xn,yn), n = 0,1,2,….. Formula for improved Euler’s method?: Yn+1 =yn + ½ h [f (xn, yn)+ f (xn+h, yn +h f (xn, yn))] Formula for modified Eulers method: Yn+1 =yn +h[f(xn+h/2, yn +h/2 f (xn, yn)) 67 Formula for fourth order Runge-kutta method: K1= h f(x,y) K2 = h f (x+ h/2, y+k1/2) K3 = h f(x+h/2, y+k2/ 2) K4 = h f (x+h, y+k3) 1 y ( K1 2k2 2 K3 k4 ) 6 y ( x h) y ( x) y Runge-kutta method for simultaneous first order differential equations: To solve numerically the simultaneous equations dy dx f1( x, y , z ), and dz dx f2 ( x, y , z ) given the initial conditions y(x 0 ) y0 , z(r0 ) Z o we starting from (x0, Y0, z0) the increments y and Z in y and z respectively are given by formulae K1=hf, (x0,y0,z0) l1 = hf2 (xo, yo, zo) k l k l h h K 2 = hf1 (x 0 + ,y 0 + 1 +Z0 + 1 ) l 2 hf 2 ( x0 , y0 1 , z0 1 ) 2 2 2 2 2 2 k l k l h h K 3 = hf1 (x 0 + ,y 0 + 2 +Z0 + 2 ) l3 hf 2 ( x0 , y0 2 , z0 2 ) 2 2 2 2 2 2 where h = x K 4 = hf1 (x 0 +h,y 0 +k 3 ,Z0 +l3 ) l 4 hf 2 ( x0 h, y0 k3 , z0 l3 ) 1 1 y (k1 2k2 2k3 k4 ) z= (l1 2l2 2l3 l4 ) 6 6 y1=y0+y and z1=z0+z having got (x1,y1,z1 ) we get (x2,y2,z2) by repeating the above algorithm once again starting from (x1,y1,z1) Runge-kutta method for second order differential equation (or R-K-method of order from to solve y|| = f(x,y, y1), given y(x0)= y0 and y1(x0) =y01? To solve yII =f(x,y,y1), given y(x0) =y0 y1(x0) = y1 0 Now, set y1=Z and y” = z1 Hence, differential equation reduce to dy y1 z and dx 68 dz z1 y " = f (x, y, y”) = f (x, y, z) dx dy dz z and f (x, y, z) are simultaneous equation Where f1 (x, y, z) = z, f2 (x, y, z) = f dx dy (x, y, z) given Also y (0) and z (0) are given Starting from these equations, we can use the R – K method for simultaneous equation and solve the problem. Milne’s predictor formula: Yn+1, P = yn-3 + 4h (2yn-21 – y1n-1 +2y1n) 3 Milne’s corrector formula: Yn+1, C = y n -1 + h 1 (y n-1 + 4y1n +y1n+1) 3 Adam – Bashforth predictor formula: Yn+1, P = yn + h [55y1n - 59y1n + 37y1n-2 - 9 y1n-3] 24 Adam – Bashforth corrector formula: Yn+1, C = yn + h [9y1n+1 + 19y1n – 5y1n-1 + y1n-2] 24 Relation between Runge – kutta method of second order and modified Euler’s method: In second order Runge – kutta method, k h y0 = k2 = hf x 0 , y 0 + 1 2 2 y0 = hf x 0 h , y 0 + 1 h f (x 0 , y 0 ) 2 2 y1 = y0 +y0 + y0 + hf h h f (x 0 , y 0 ) x 0 , y0 + 2 2 This is exactly the modified Euler method So, the Runge – kutta method of second order is nothing but the modified Euler method. 69 Numerical Examples: 01. Using Taylor series method, find correct to four decimal places, the values of y (0.1), given dy = x2 +y2 and y (0) = 1 dx Solution: We have y1 = x2 + y2 Yii = 2x + 2yy’ Yiii = 2 +2yy” +2’2 Yiv = 2yyiii + 2yiyii + 4yiyii = 2yyiii + 6yiyii x0 = 0, y0 =1, h = 0.1 x1 = 0.1, y1 = y (0.1) =? Y01= x02 + y02 = 0 +1 = 1 Y0ii = 2x0 + 2y0y01 =2 Y0iii = 2 + 2(1) (2) + 2 (1)2 = 8 Y0iv = 2 1 8 + 6 (1) (2) = 28 By Taylor series method Y1 =y0 + h 1 h 2 2 h3 3 y0 y0 y 0 ...... 1! 2! 3! Y (0.1) = y1 = 1+ 0.1 (0.1) 2 (0.1)3 (0.1) 4 (1) (2) (8) (28) .... 1 2 6 24 = 1 + 0.1 +0.01 +0.0013333 + 0.000116666 = 1.11144999 = 1.11145 02. Using Taylor series method, find y (1.1) correct to four decimal places given dy =xy1/3 and y (1) = 1 dx Solution: Take x0 =1, y0 = 1, h =0.1 Y1 = xy1/3 Yii = 1 -2/3 1 xy y + y2/3 3 70 = 1 2 -1/3 x y + y1/3 3 yiii = x 2 1 43 1 2 x 13 1 23 1 y y y y y 3 3 3 3 y01 = 1 (1)1/3 =1 By Taylor series Y1 = y (1.1) = 1+0.1 + (0.2)2 4 (0.1)3 8 ...... 2 3 6 9 = 1+0.1 + 0.00666 + 0.000148 + ……. = 1.10681 03. Using Taylor series method, find y (0.1) given dy = x2 – y, y (0) = 1 (correct to 4 dx decimal places) Solution: X0 = 0, y0 = 1, h =0.1, x1 =0.1 Y1 = x2 – y Yii = 2x – y1 Yiii = 2 - yii Yiv = - yiii Y01 = x02 – y0 = 0 -1 = -1 Y011 = 2x0 – y01 = 0 – (-1) =1 Y0iii = 2 -1 = 1 Y0iv = - 1 y (o.1) = 1+0.1 (-1)+ 0.01 (0.001) (0.0001) (1) (1) (1, .....) 2 6 24 =0.905125 04. Given y1 = - y and y (0) = 1, determine the value of y at x = (0.01) (0.01) (0.04) by Euler method Solution: Y1 = - y, x0 =0, y0 =1, x1 = 0.01, x2 = 0.02, x3 = 0.03, x4 = 0.04 We have to find y1, y2, y3, y4 takes h = 0.01 By Euler algorithm, yn+1 = yn + hyn1 = yn + hf (xn, yn) Y1 = y0 + h f (x0, y0) = 1 + (0.01) (-1) = 0.99 Y2 = y1 + hy11 = 0.99 + (0.01) (-y1) 71 = 0.99 + (0.01) (-0.99) =0.9801 y3 = y2 +hf (x2, y2) = 0.9801 + (0.01) (-0.9801) = 0.9703 y4 = y3 +h f (x3, y3) = 0.9703 + (0.01) (-0.9703) = 0.9606 05. Compute y at x = 0.25 by modified Euler method given y1 = 2xy, y (0) = 1 Solution: Here f (x, y) = 2xy, x0 = 0, y0 = 1 Take h = 0.25, x1 = 0.25 By modified Euler method h h Y1 = y0 + h [f x 0 , y 0 + f (x 0 , y 0 ) 2 2 f (x0, y0) = f (0, 1) = 2 (0) (1) = 0 y1 = 1 +0.25 [6 (0.125, 1)] = 1+0.25 [2 0.125, 1] =1 = 0.25 [2 0.125 1] = 1.0625 06. Solve dy =-2x – y, y (0) = -1 by Taylor series method to find y (0.1) compare it with dx exact solution? Solution: Here x0 = 0, y0 = -1, h = 0.1 Y1 = -2x –y Yii = -2 –y1 Yiii = - yii Yiv = - yiii Y01 = -2x1 –y0 = 1 Y011 = -2 – 1=-3 Y0iii = 3 Y0iv = -3 y1 =1+ 0.1 (0.1) 2 (0.1)3 (0.1) 4 1 (3) 3 (3) .... 1! 2! 3! 4! = 1+ 0.1 -0.015 +0.0005 – 0.0000125 = -0.91451 72 07. Solve dy =x (1+x3y), y (0) = 3 by Euler’s method for y (0.1) dx Solution: X0 = 0, y0 = 3, h = 0.1, x1 = 0.1 By Euler’s algorithm is y1 = y0 + hf (x0, y0) = 3 +0.1 f (0, 3) = 3 + 0.1(0) =3 08. Solve dy = 2x +3y, y(0) = 1 by Euler’s method for y (0.1), y (o.2) dx Solution: X0 =0, y0 = 1, x1 = 0.1 By Euler algorithm, y1 = 1+0.1 [2 0 + 3 1] = 1.3 Y2 =y1 + hf (x1, y1) = 1.3 + 0.1f [0.1, 1.3] = 1.3 + 0.1 [2 0.1 + 3 1.3] = 1.71 09. Obtain the values of y at x = 0.1 using Runge – kutta method of fourth order for the differential equation y1 = - y, given y (0) = 1 Solution: Here f (x, y) = - y, x0 = 0, y0 = 1, x1 = 0.1 K1 = hf (x0, y0) = 0.1 f (0, 1) = -0.1 k h K2 = hf (x0 + , y0 + 1 ) = (0.1) f (0.05, 0.95) = - 0.095 2 2 K h K3 = hf x 0 + , y 0 2 = (0.1) f (0.05, 0.9525) = -0.09525 2 2 K4 = hf (x0+h, y0 +K3) = (0.1) f (0.1, 0.90475) = - 0.090475 y = 1 (k1+2k2 + 2k3 + k4) 6 y1 = y0 + y = 0.9048375 10. Compute y (0.3) given dy +y+xy2 = 0, y (0) = 1 by taking h = 0.1 using R.K method of dx fourth order? Solution: Y1= - (xy2 +y) = f (x, y), x0 = 0, y0 =1, h =0.1 x1 = 0.1 K1 =h f (x0, y0) = 0.1 [- (x0y02 + y0)] = -0.1 K2 = hf k h , y0 1 x0 2 2 = -0.1 [(0.05) (0.95)2 + 0.95] = -0.0995 73 K3 = hf k2 = h x 0 , y0 2 2 y1 =1 + (0.1) f (o.1, 0.9005) = - 0.0982 1 [-0.1 +2 (-0.0995) + 2 ( -0.0995) – 0.0982] 6 = 0.9006 11. What are the values of k1 and l1 to solve y11 +xy1 + y = 0; y (0) =1, y1 (0) =0 by Runge kutta method of fourth order y11 = -xy1 – y, x0 = 0, y0 =1 Setting y1 = z, the equation becomes y11 =z1 = -xz – y dy dz = z = 6, (x, y, z), =-xz – y = f2 (x, y, z) dx dx given y0 =1, z0 = y01 = 0 By algorithm, k1= hf1 (x0, y0, z0) = 0.1 f1 (0, 1, 0) = 0 L1 = hf2 (x0, y0, z0) = 0.1 f2 (0, 1, 0) = -1 (0.1) = -0.1 12. What are the values of k1 and l1 solve y11 +2xy1-4y=0 ,y(0)=0.2,y1(0)=0.5. Solution: dy Let z then dx dz d 2 dx 2 2 xz 4 y now dx dy the given differential equation becomes dx dy z and dx dz 2 xz 4 y dx x0 0, y0 0.2 h 0.2 f1(x,y,z)=z, f2(x1,x2,x3)=-2x2+4yK1=hf1(x0,y0,z0)=0.10.5=0.05, l1 =ht2(x0,y0,z0)=0.1[-200.5+4.5]=0.8 13. What are the values of k1 and l1 to solve y11 – x2y1 – 2xy = 1 y (0) = 1, y1 (0) = 0 Solution: Let dy =z dx The given differential equation becomes d2y = x2y1 +2xy+1 2 dx dz 2 =x z +2xy +1, x0 =0, y0= 1, z0 =0, f1 (x, y, z) = z dx f2 (x, y, z) = x2z +2xy +1, h = 0.1 x1 =hf1(x0 , y0, z0)= 0.1 f (0, 1, 0) = 0.1 0 = 0 l1 =hf2 (x0, y0, z0) = 0.1 74 14. What are the values of k1, k2, l1 and l2 from the system of equations, dy dz = x +z, = dx dx x – y given y (0) =2, z (0) = 1 using Runge – Kutta method of fourth order. Solution: f1 (x, y, z) = x + z; f2 (x, y, z) = x –y X0 = 0, y0 =2, z0 =1, h = 0.1 Now K1 = hf1 (x0, y0, z0) = (0.2) f1 (0, 2, 1) = (0.1) (0+1) = 0.1 K2 = hf1 x 0 h , y 0 + k1 , z 0 l1 2 2 2 = 0.1 f1 (0.05, 2.05, 0.8) = 0.085 l1 = (0.1) f2 (0, 2, 1) = (0.1) (0 -22) = - 0.4 l2 =hf2 k1 l h , z0 1 x 0 , y0 + 2 2 2 = (0.1) f2 (0.05, 2.05, 0.8) = - 0.41525 15. Solve by Euler’s method dy = x2 + y, y (0) = 1 of x = 0.02, 0.04 dx Solution: Here x0 = 0, y0 =1, f (x, y) = x2 + y, h = 0.2 By Euler’s algorithm, y1 = y0 + h f (x0, y0) i.e. y1 =1 + 0.02 (x02 + y0) = 1.02 y2 = y1 + hf (x1, y1) = 1.02 +0.02 [(0.02)2 + 1.02] =1.04041 16. Solve dy =x + y, given y (1) = 0 and get y (1.1) by Taylor series method? dx Solution: Here x0 = 1, y0 =0, h = 0.1 Y1 =x + y 75 Yii = 1+y1 Yiii = yii Yiv = yiii Y01 = x0 + y0 = 1 + 0 =1 Y011 = 1 +y01 = 2 Y0iii = 2 Y0iv = By Taylor series, we have Y1 =y0 + h 1 h 2 11 h 3 111 y0 y0 y0 .... 1! 2! 3! Y1 = y (1.1) = 0 + 0.1 (0.1) 2 (0.1)3 (0.1) 4 (1) 2 2 2 ...... 1 2 6 24 = 0.11033847 17. Using Taylor method, compute y (0.2) correct to 4 decimal places given and y (0) = 0 Solution: Here x0 = 0, y0 = 0, h =0.2 Y1 = 1 – 2xy Y11 = -2 (xy1 + y) Yiii = -2 [xy11 + 2y1] Yiv = -2 [xyiii + 3y11] Yv = -2 (xyiv + 4yiii] Y01 = 1 – 2.0.0 = 1 Y011 = 0 Y0111 = -4 Y0iv = 0 Y0v = 32 By Taylor series, Y1 =y (0.2) = 0 + 0.2 (0.2) 2 (0.2)3 (0.2)5 (1) (0) ( 4) 0 (32) .... 1 2 6 120 = 0.1948 76 dy = 1 – 2xy dx 18. Solve dy/dx = x+y, given y(1) =0, and get y(1.1), y(1.2) by Taylor series method. Compare your result with the analysis. Solution: Here x0= 1, yo =0x =0.1 Y1=x + y y0I= x0+y0=1+0 = 1 yII = 1+y1 y0II=1xy01 = 2 yIII = yII y0III = y0II = 2 yIV = yIII y0iv = 2 etc By Taylor series, are have y1 y0 h 1 h 2 II h3 III y0 y0 y0 ...... 1! Z! 3! 0.1 (2) (0.1)3 (0.1)4 (2) 0.1 y1 y (1.1) 0 (1) 1 2 6 24 2 0.15 .2 .... (2) 120 = 0.1+0.01+0.00033+0.00000833+0.000000166+…. Y(1.1) = 0.11033847 Now, take x0 = 0.1103847 Now, take x0 = 1.1 h = 0.1, y2 y1 h 1 h 2 II h3 III h 4 IV y1 yI yI y1 .... (3) 1! 2! 3! 4! we calculate y1I , y1II , y1III ,....., x1 1.1, y1 0.11033847 y1I x1 y1 1.1 0.11033847 1.21033847 y1II 1 y1I 2.21033847 y1III y1II y1IV y1V .... 2.21033847 using in (3), y2 = y(1.2) = 0.11033847 + 0.1 / 1 (1.21033847) (0.1)2 (0.1)3 (0.1) h (2.21033847) (2.21033847) (2.21033847) .... 2 6 2h = 0.11033847+2.21033847(0.005+0.0016666+….) = 0.2461077 77 The exact solution dy x y is y = -x-1+2e x-1 dx Y (1.1) = -1 1 -1 +2e 0.1 = 0.11034 y (1.2) = -1.2 – 1+ze0.2 = 0.2428 y (1.1) = 0.11033847 y (1.2) = 0.2461077 Exact values: y(1.1) = 0.110341876 Y(1.2) = 0.24280552 19.Using Taylor method compute y (0.2) and y(0.4) correct to 4 decimal places given dy 1 2 xy and y(0) =0 dx Soln We know y1=1-2xy Here x0=0 y0 =0, h=0.2 yII = -2(xy1+y) y01=1-zx0y0 = 1 yIII =-2(xyII+2yI) y0II = 0 yIV = -2(xyIII +JyII) yoIII =-4 yV = -2(xyiv+4yIII) yivo =0 y0II =J 32 by Taylor series h 1 h 2 II h3 III yI y0 y0 yo y0 .... (!) I! 2! 3! (0.2) 0.2 (0.2)3 (0.2) 4 0 (0.2)5 y1 y (0.2) 0 1 (0) (32) .... 1 2 6 24 120 2 yI=Z-x Z1 = x+y yII =Z1-1 ZII = 1+y1 yIII = ZIIetc ZIII = yII etc By Taylor series, for y1and z we have Y1 = y (0.1) = y0+hy01+ h 2 II h3 III y0 y0 ...... (1) 2! 3! 78 And Z1=Z (0.1) = Z0 +hZ01+ h 2 II h3 III Z 0 Z 0 .....(2) 2 6 Y0 = 1 z0 =1 Y01=Z0-x0= 1-0 = 1 z01 = x0 + y0 + 0 =1=1 Y0II =Z01-1=1-1 = 0 z0II = 1 + yo1 =1 + 1 =2 Y0III =z0II = 2 z0III = y0II = 0 Substituting in (1) and (2), we get z0IV = y0III = 2 Y1 =y (0.1) = 1 + (0.1) + (0.01) (0.001) (0) 2 ..... 2 6 = 1 + 0.1 + 0.000333+…. =1.1007 (correct to 4 decimals) z1 = z (0.1) = 1 + (0.1) + (0.01) (0.001) 0.0001 2 (0) 2 .... 2 6 24 =1+0.1+0.01 +0.0000083+…. =1.1100 (correct to 4 decimal places) y (0.1) = 1.1003 and z (0.1) = 1.1100 20. Solve dy dz z - x, y + x with y (0) = 1, z (0) = 1, by taking h = 0.1, to get y (0.1) dx dx and z (0.1). Here y and z are dependent variables and x is independent. Solution: Y1 = z –x and z1 = x + y Take x0 = 0, y0 = 1 take x0 = 0, z0 = 1 and h = 0.1 Y1= y (0.1) =? Z1 = z (0.1) =? Using in (6) Y1 =y (0.1) = 0 + Y2 = y1 + 0.1 0.19 [1 0.9] 0.095 2 2 1 h [f(x1, y1) +f (x2, y1 +hf (x1, y1)] (7) 2 F (x1, y1) = 1 – y1= 1 – 0.095 = 0.905 F(x2, y1 + h f (x1, y1) = f (0.2, 0.095 + (0.1) (0.905)) = 0.8145 Using in (7) we get y2 = y (0.2) = 0.095 + 0.1 [0.905 +0.8145] 2 Y (0.2) = 0.18098 79 Y3 = y2 + 1 h [f (x2, y2) +6 (x3, x2 +h f (x2, y2))] (8) 2 Using in (8) Y3 =y (0.3) = 0.18098 + 0.1 (0.81902 + 1 – 0.26288) 2 Y (0.3) = 0.258787 The values are tabulated X Modified Improved Exact solution Euler Euler 0.1 0.095 0.095 0.09516 0.2 0.18098 0.18098 0.18127 0.3 0.258787 0.258787 0.25918 Modified Euler and improved Euler methods give the same values come A to sin decimal places. 21. Evaluate the values of y (0.1) and y (0.2) given yII – x (y1)2 +y2 = 0; y (0) =1, y1 (0) =0 by using Taylor series method? Solution: YII – x (y1)2 + y2 = 0 Put y1 =z (1) Hence the eqn reduces to z1 – xz2 +y2 = 0 z1 = xz2 – y2 (2) By initial condition, y0 =y (0) = 1, z0 = y01 = 0 (3) Y1 = 0.2 – 0.00533333 + 0. 000085333 = 0.194752003 Now again starting with x = 0.2 as the starting value so, use again eqn (1) Now y0 = 0.2, y0 = 0.194752003, h = 0.2 Y01 = 1 – 2x0y0 = 1 – 2(0.2) (0.194752003) = 0.9220992 Y0II = -2 (x0y01 + y0) = -2 [(0.2) (0.9220992) + 0.194752003] = -0.758343686 y0III = -2 [x0y0II + 2y01] = -2 [(0.2) (-0.758343686) +2 (0.9220992)] = -3.38505933 y0IV = -2 [(0.2) (-3.38505933) + 3 (-0.758343686)] = 5.90408585 80 Using eqn (1), again Y2 = y (0.4) = 0.194752003 + (0.2) (0.9220992) (0.2)2 (0.2)3 (0.2)4 (0.758343686) (3.38505933) (5.90408585) = 0.359883723 2 6 24 22. Using improved Euler method find y at x =0.1 and y at x =0.2 give dy 2x =y, dx y y (0) = 1 Solution: By improved Euler method, 1 Yn+1 = yn + h [f (xn, yn) +f (xn + h, yn + hf (xn, yn))] (1) 2 1 y1 = y0 + h [f (x0, y0 + h f(x0, y0))] (2) 2 2x 0 =1–0=1 y0 f (x0, y0) = y0 - f (x1, y0 + h f (x0, y0)) = f (0.1, 1.1) = 1.1 - 2 (0.1) 0.91818 1.1 y (0.1) = y1 = 1 + 0.1 [1+0.91818] = 1.095909 2 y2 =y (0.2) =y1 + 1 h [f (x1, y1) + f (x2, x1 +hf (x1, y1))] (3) 2 f (x1, y1) = y1 - 2x1 2 0.1 =1.095909 1.095909 y1 = 0.913412 f (x2, y1 + h f (x1, y1) = f (0.2, 1.095909 + (0.1) (0.9134121) = f (0.2, 1.18732) = 1.18732 - 2 0.2 =0.8594268 1.18732 Using in (3), y2 = 1.095909 + 0.1 [0.913412 + 0.850427] 2 = 1. 1841009 X 0 0.1 Y 1 1.095907 0.2 1.1841009 23. Apply the fourth order Runge – kutta method, to find y (0.2) given that y1 = x + y, y (0) = 1 Solution: 81 Since h is not mentioned in the question we take h = 0.1 Y1 = x + y; y (0) = 1 f (x, y) = x+y, x0 = 0, y0 =1 x1 = 0.1, x2 = 0.2 By fourth order Runge – kutta method, for the first interative K1 = h f (x0, y0) = (0.1) (x0 + y0) = (10.1) (0+1) = 0.1 K2 =h f (x0 + 1 1 h, y0 + k1) 2 2 = (0.1) f (0.05, 1.05) = (1.0) (0.05 +1.05) = 0.11 k3 = h f (x0 + 1 1 h, y0 + k2) = (0.1) f (0.05, 1.055) 2 2 = (0.1) (0.05 + 1.055) = 0.1105 k4 = hf (x0 +h, y0 + k3) = (0.1) f (0.1, 11 05) = (0.1) (0.1 + 1.1105) = 0.12105 y = = 1 (k1 +2k2 + 2k3 + k4) 6 1 [0.1 + 0.22 + 0.2210 + 0.12105) = 0.110341667 6 y (0.1) = y1 = y0 +y = 1.110341667 1.110342 Now starting from (x1, y1) we get (x2, y2) again Apply Runge kutta algorithm replacing (x0, y0) by (x1, y1) K1 = h f (x1, y1) = (0.1) (x1+y1) = (0.1) (0.1 + .110342) = 0.1210342 h 1 K2 = h f (x1+ , y1 + k1) = (0.1) f (0.15, 1.170859) 2 2 = (0.1) (0.15 + 1.170859) = 0.1320859 h 1 k3 = hf (x1 + , y1 + k2) = (0.1) f (0.15, 1.1763848 2 2 = (0.1) (0.15 +1.1763848) = 0.13262848 k4 =hf (x1 + h, y1 +k3) = (0.1) f (0.2, 1.24298048) = 0.144298048 Y (0.2) = y (0.1) + = 1.110342 + 1 [k1 +2k2 + 2k3 + k4] 6 1 (0.794781008 6 Y (0.2) = 1.2428055.Correct to four decimals places, y (0.2) = 1.2428 82 24. Using the Runge – kutta method, tabulate the solution of the system dz = x-y, y = 0, z =1 when x = 0 at intervals of h = 0.1 from x = 0.0 to x =0.2. dx Solution: Given f (x, y, z) = x + z, g (x, y, z) = x – y, x0 =0, y0 =0, z0 =1 and h = 0.1 To compute y (0.1) and z (0.1) K1 = hf (x0, y0, z0) L1 = hg (x0, y0, z0) = h (x0 + z0) = h (x0 – y0) = (0.1) (0 +1) = 0.1 = (0.1) (0 – 0) = 0 k l h K2 = hf (x0 + , y0 + 1 , z0 + 1 ) 2 2 2 k l h L2 = hg x0 , y0 1 , z0 1 2 2 2 l h =h x 0 z 0 1 2 2 k h =h x0 y0 2 2 2 0.1 0 = (0.1) 0 1 2 2 0.1 0.1 = (0.1) 0 0 2 2 =0.105 k l h K3 = hf x0 , y0 2 , z0 2 2 2 2 k l h L3 =hg x0 , y0 2 , z0 2 2 2 2 l h = h x0 z0 2 2 2 h kl 2 = 4 x0 y0 2 2 0.1 0 = (0.1) 0 1 2 2 0.1 0.105 = (0.1) 0 0 2 2 = 0.105 = - 0.00026 K4 = hf (x0 + h, y0 + k3, z0 +l3) L4 = hg (x0 +h, y0 +k3, z0 +l3) = h [x0 +h) + (z0 + l3) = h [x0 +h) – (y0 +k3) = (0.1) [ (0+0.1) + (1 – 0.00026) = (0.1) [(0 +0.1) – (0 +0.105)] = 0.1099 = - 0.0005 83 dy = x +z, dx y = = 1 [k1 + 2k2 + 2k3 + k4] 6 1 z = [l1 +2l2+ 2l3 +l4] 6 1 [0.1+2 (0.105) + 2 (0.105) +0.1099)] 6 = 1 [0+0+2 (- 0.00026) -0.0005] 6 =0.1050 = 0.00017 Y1 = y0 + y Z1 =z0 +z = 0 + 0 .1050 = 1 – 0.00017 y (0.1) = 0.1050 z (0.1) = 0.9998 To compute y (0.2) and z (0.2) Here x1 = 0.1, y1= 0.1050, z1 =0.9998 K1 = hf (x1, y1, z1) L1 = hg (x1, y1, z1) = h (x1 +z1) = h (x1 – y1) = (0.1) (0.1 + 0.9998) = (0.1) (0.1 – 0.1050) = 0.1099 = - 0.0005 K2 = hf x1 = h x1 k l h , y1 1 , z1 1 2 2 2 l1 h z1 2 2 = (0.1) 0.1 L2=hg x1 =h x1 0.1 0.0005 0.9998 2 2 =h 0.1 0.1099 0.105 2 2 = -0.0099 k2 l2 h x1 , y1 , z1 2 2 2 L3 = hg x1 l2 h x1 2 z1 2 = (0.1) k1 h y1 2 2 =(0.1) 0.1 = 0.1149 K3 = hf k l h , y1 1 , z1 1 2 2 2 = h x1 0.1 0.00099 0.1 2 0.9998 2 k2 h y1 2 2 =(0.1) 0.1 k l h , y1 2 , z1 2 2 2 2 0.1 0.1149 0.1050 2 2 = 0.1149 = -0.00125 K4 = hf (x1 + h, y1+k3, z1+l3) L4 = hg [x1+h, y1+k3, z1 + l3] = h [(x1 +h) + z1+l3)] = h [(x1+h) – (y1 + k3)] = (0.1) [(0.1+0.1) + (0.9998 – 0.00125)] = (0.1) [(0.1 +0.1) – (0.1050 + 0.1149)] = 0.1198 = -0.00199 84 y = 1 [k1 +2k2 + 2k3 +k4] 6 z = = 1 [0.1099 + 2 (0.1149) + 2 (0.1149) + 0.1198)] 6 = 1 [0.1099+0.2298 + 0.2298 + 0.1198] 6 = 1 [l1 + 2l2 + 2l3 +l4] 6 1 [-0.0005 +2(-0.00049)+2 (-0.00125) – 6 0.001199] = 1 [-0.0005 -0.00198 -0.00199] 6 = 1 [-0.0005 – 0.00198 – 0.00199 6 = 0.1149 = -0.00116 Y2 = y1 + y Z2 = z1 + z = 0.1050 +0.1149 = 0.9998 – 0.00116 = 0.2199 = 0.9986 y (0.2) = 0.2199 z (0.1) = 0.9986 X=0 X = 0.1 X = 0.2 Y 0 0.1050 0.2199 X 1 0.9998 0.9986 2 d2 y dy x y 2 0 using Runge – kutta method for x = 0.2 correct to 4 25. Solve 2 dx dx decimal places. Initial condition are x = 0, y =1, y1 = 0 Solution: Given: 2 d2y dy x +y2 = 0 (1) 2 dx dx Put dy =z (2) dx d2y d2 (3) dx dx Substituting (2) and (3) in (1), we get dz = xz2 – y2 dx Let dz =xz2 – y2 = g (x, y, z) dx 85 dz =xz2 – y2 = g (x, y, z) dx Also we are give that y0 = 0, y0 = 1, y01 = 0 (or) z0 = 0, h = 0.2 Now K1 = hf (x0, y0, z0) = hz0 = 0 l1 = hg (x0, y0, z0) = h (x0z02 – y02) = (0.2) (0 -1) = - 0.2 k l h k2 = hf x0 , y0 1 , z0 1 2 2 2 l = h z0 1 = (0.2) 2 0.2 0 = - 0.02 2 k l h l2 = hg x0 , y0 1 , z0 1 2 2 2 2 2 l k h = h x0 z0 1 y0 1 2 2 2 2 2 0.2 0.2 0 l2 = (0.2) 0 0 1 2 2 2 = -0.1998 k l h k3 = hf x0 , y0 2 , z0 2 2 2 2 l = h z0 1 = (0.2) 2 0.1998 0 2 = - 0.01998 k l h l3 = hg x0 , y0 2 , z0 2 2 2 2 2 2 l2 k2 h = h x0 z0 y0 2 2 2 2 2 0.2 0.01998 0.02 = (0.2) 0 0 1 2 2 2 = - 0.1958 k4 = hf (x0 +h, y0 + k3, z0 + h2) = h (z0 +l3) = (0.2) (0 -0.1958) = - 0.0392 l4 = hg (x0 +h, y0 + k3, z0 +l3) 86 = h [(x0 +h) (z0 + l3)2 – (y0 + k3)2] = (0.2) [(0.2) (0 – 0.1958)2 – (1 – 0.01998)2] = - 0.1906 y = = 1 [k1 + 2k2 +2k3 +k4] 6 1 [0 +2 (-0.02) + 2 (-0.01998) – 0.0392] 6 = - 0.0199 y (0.2) = y1 = y0 +y =1 – 0.0199 = 0.9801 y (0.2) = 0.9801 26. The differential equation dy = y –x2 is satisfied by y (0) = 1, y (0.2) = 1.12186, y (0.4) dx = 1.46820, y (0.6) = 1.7379 compute the value of y (0.8) by Milne’s predictor corrector formula? Solution: Given dy 1 =y = y – x2 and h = 0.2 dx X0 = 0 y0 =1 X1 =0.2 y1 = 1.12186 X2 = 0.4 y2 = 1.46820 X3 = 0.6 y3 = 1.7379 X4 = 0.8 y4 =? By Milne’s predictor formula, we have Yn+1, P = y n-3 + 4h [zyn-21 – y1n-1 + 2y1n] (1) 3 To get yn, put n = 3 in (1) we get Yn, P =y0 + 4h [2y11 – y12 +2y13] (2) 3 Now y11 = (y – x) 12 = y1 – x12 = 1.12186 – (0.2)2 = 1.08186 (3) 87 y21 = (y – x2)2 = y2 – x12 = 1. 46820 – (0.4)2 = 1.3082 (4) y31 = (y –x2)3 = y3 – x32 =1.7379 – (0.6)2 = 1.3779 (5) Substituting (3), (4) and (5) and (2), we get Yh, g = 1+ 4(0.2) [2(1.08186) – 1.3082 + 2 (1.3779)] 3 = 1+0.266 [2.1637 – 1.3082 + 2.7558] = 1.9630187 y (0.8) = 1.9630187 (by predictor formula) By Milne’s corrector formula we have Yn+1, C = yn-1 + h 1 (y n-1 +4y1n + y1n+1) 3 To get yh, put n = 3, we get Yh, C = y2 + h 1 (y2 +hy31+yn1) (6) 3 Now yn1 = (y –x2) h = yh – xh2 = 1.96277 – (0.8)2 = 1.3230187 (7) Substituting (4), (5), (7) in (6) we get Y4, C = 1.46820 + 0.2 [1.3082 +4 (1.3779) + 1.3230187] 3 = 2.0110546 i.e. y (0.8) = 2.0110546 27. Using Taylor’s series method, solve dy =xy+y2, y (0) = 1 at x = 0.1, 0.2 and 0.3 dx continue the solve at x = 0.4 by Milne’s predictor corrector method? Solution: Given y1 = xy +y2, and x0 = 0, y0 = 1 and h = 0.1 Now y1 = xy + y2 Y11= xy1 + y + 2yy1 YIII = xyII + 2y1 + 2yyII + 2y12 To find y (0.1) By Taylor series we have 88 y (0.1) = y1 + hy01 + h 2 II h3 III y0 + yo + …… (1) 2! 3! y0II = (xy + y2)0 = (x0y0 + y02) = 1 ……. (2) y0II = (xy1 + y + 2yy1) y0II = (x0y01 + y0 + 2y0y01) = 3 ……. (3) y0III = (xy0II + 2y1 + 2yyII + 2y12)0 = 10 …… (4) Substituting (2). (3) and (4) in (1) we get (0.1) 2 (0.1)3 Y (0.1) = 1 + 0.1 + 3+ 10 2 6 = 1 + 0.1 + 0.016 + 0.001666 y (0.1) = 1.11666 To find y (0.2) By Taylor series we have Y2 = y1 + hy11 + h 2 II h3 III y1 + y1 + ….. (5) 2! 3! Now y11 = (xy + y2) = x1y1 + y12 = (0.1) (1.11666) + (1.11666)2 = 0.111666 + 1.2469 = 1.3585 …… (6) y1II = (xy1 + y + 2yy1) = x1y11 + y1 + 2y1 y11 = (0.1) (1.3585) + 1.11666 + 2 (1.11666) (1.3585) = 0.13585 + 1.11666 + 3.0339 = 4.2865 …… (6) y1III = (xyII + 2yI + 2yyII + 2y12) = (x1 y1II + 2y1I + 2yIyIII + 2y112) = (0.1) (4.2865) + 2 (1.3585) + 2 (1.1167) (4.2865) + 2 (1.3585)2 = 0.4287 + 2.717 + 9.5735 + 3.6916 = 16. 4102 …… (8) Substituting (6), (7) and (8) in (5) we get Y (0.2) = 1.1167 + (0.1) (1.3585) + (0.1) 2 (0.1)3 (4.2865) + (16. 4102) 2 6 Y (0.2) = 1.1167 + 0. 13585 + 0. 0214 + 0.002735 Y (0.2) = 1.27668 To find y (0.3) 89 By Taylor series we have Y3 = y2 + hy21 + h 2 II h3 III y2 + y2 + …. (9) 2! 3! Now y21 = (xy +y2)2 = (x2y2 + y22) = (0.2) (1.2767) + (1.2767)2 = 0.2553 + 1.6299 = 1. 8852 …… (10) y2II = (xy1 + y + 2yy1)2 = x2y21 + y2 +2y2y21 = (0.2) (1.8852) + 1.2767 + 2 (1.2767) (1.8852) = 0.33770 + 1.2767 + 4.8136 = 6.4674 …… (11) y2III = (xyIII + 2y1 + 2yyII 2y12)2 = (x2y2II + 2y21 + 2y2y2II + 2y212) = (0.2) (6.4674) + 2 (1.8852) + 2 (1.2767) (6.4774) + 2 (1.8852)2 = 1.2974 + 3.7704 + 16.5138 + 7.1079 = 28.6855 Substituting (10), (11) and (12) in (9), we get 0.12 (0.1)3 Y (0.3) = 1.2767 + (0.1) (1.8852) + (6.4674) + (28.6855) 2 6 = 1.2767 + 0.18852 + 0.0323 + 0.004780 = 1.5023 y (0.3) = 1.5023 We have the following values X0= 0 y0 =1 X1 = 0.1 y1 = 1.11666 X2 = 0.2 y2 = 1.27668 X3 = 0.3 y3 = 1.50233 To find y (0.4) by Milne’s predictor formula Yn+1, P = yn+3 + 4h [2y1n-2 – y1n-2 + 2y1n] ….. (1) 3 Y31 = (xy +y2)3 = (x3y3 + y32) = [(0.3) (1.5023) + (1.5023)2] = 0.45069 + 2.2569 90 = 2. 7076 Putting n =3, we get Y4, P = y0 + =1+ 4h [2y11 – y21 + 2y31] 3 4(0.1) [2 (1.3585) – 1.8852 + 2 (2.7076)] 3 = 1 + 0.1333 [2.717 – 1.0852 + 5.4152] y4, P = 1.8329 To find y (.04) by Milne’s corrector formula By Milne’s corrector formula we have yn+1, C = yn-1 + h 1 [y n-1 + 4yn1 + y1n+1] …… (14) 3 Now y41 = (x2 + y2)4 = (x4y4 + y42) = [(0.4) (1.8327) + (1.8327)2] = 0.7330 + 3.3588 = 4.0918 Putting n = 3 in (14) we get Y4, C = y2 + h 1 [y2 + 4y31 + y41] 2 Y4, C =1.27668 + (0.1) [1.8852 4(2.7076) 4.0918] 3 = 1.27668 + 0.0333 [1.8852 + 10.8304 + 4.0918] = 1.8369 28. Solve and get y (2) given dy 1 = (x + y), y (0) = 2 dx 2 y (0.5) = 2.636, y (1) = 3.595; y (1.5) = 4.968 by Adam’s method? Solution: By Milne’s method, we have y01 = 1 (0 +2) =1 2 Y11 = 1.5680, y21 = 2.2975, y31 = 3.2340 By Adam’s predictor formula Yn+1, P = yn + h [55yn1 – 59y1n-1 + 37y1n-2 – 9y1n-3] 24 91 y4, P = y3 + =4.968 + h [55y1n – 59y21 + 37y11 – 9y10] ….. (1) 24 0.5 [55 (3.2340) – 59 (2.2975) + 37 (1.5680) – 9 (1)] 24 = 68708 y41 = 1 1 (x4 + y4) = (2+6.8708) = 4.4354 2 2 By corrector, y4, C = y3 + = 4.968 + h [9yn1 + 19y31 – 5y21 + y11].. (2) 24 0.5 [9 (4.4354) + 19 (3.234) – (2.2975) + 1.5680] 24 = 6.8731 29. Find y (0.1), y (0.2), y (0.3) from dy = xy + y2, y (0) = 1 by using Runge – kutta dx method and hence obtain y (0.4) using Adam’s method? Solution: f (x, y) = xy + y2, x0 = 0, x1 = 0.1, x2 = 0.2, xy = 0.4, x4 = 0.4, y0 =1 k1 = hf (x0, y0) = (0.1) f (0, 1) = (0.1) 1 = 0.1 k2 = hf (0.05, y0 + k1 ) = (0.1) f (0.05, 1.05) 2 = (0.1) [(0.05) (1.05) + (1.05)2] = 0.1155 k3 = hf (0.05, y0 + k2 ) = (0.1) f (0.05, 1.0578) 2 = (0.1) [(0.5) (1.0578) + (1.0578)2] = 0.1172 k4 = hf (x0 + h, y0 + k3) = (0.1) f (0.1, 1.1172) = (0.1) [(0.10 (1.1172) + (1.1172)2] = 0.13598 y1 = y0 + 1 [k1 + 2k2 + 2k3 + k4] 6 = 1.1169 y (0.1) = 1.1169 Again, start from y1 k1 = hf (x1, y1) = (0.1) f (0.1, 1.1169) = 0.1359 92 k2 = hf (x1+ k h , y1 + 1 ) = (0.1) f (0.15, 1.1849) 2 2 = 0.1582 k3 = hf (0.15, y1+ k3 ) = (0.1) f (0.15, 1.196) 2 = 0.16098 k4 = (0.1) f (0.2, 1.2779) = 0.1889 y2 = 1.1169 + 1 [0.1359 + 2(0.1582 + 0.16098) + 0.1889] 6 y (0.2) = 1.2774 Start from (x2, y2) to get y3 K1 = hf (x2, y2) = (0.1) f (0.2, 1.2774) = 0.1887 k h K2 = hf (x2 + , y2 + 1 ) = (0.1) f (0.25, 1.3718) = 0.2225 2 2 K3 = hf (x2 + k h , y2 + 2 ) 2 2 = (0.1) f (0.25, 1.3887) = 0.2274 k4 = hf (x3, y2 + k3 ) = (0.1) f (0.3, 1.5048) 2 =0.2716 y3 = 1.2774 + 1 [0.1887 + 2 (0.2225) + 2 (0.2274) + 0.2716] = 1.5041 6 Now we use Adam’s predictor formula Y4, P = y3 + h [55y31 – 59y21 + 37y11 – 9y01] …. (2) 24 Y01 = x0y0 + y02 =1 Y11= x1y1 +y12 = 1.3592 Y21 = x2y2 + y22 = 1.8872 Y31 = x3y3 + y32 = 2.7135 Using (2) Y4, P = 1.5041 + 0.1 [55 (2.7135) – 59 (1.8872) + 37 (1.3592) – 9 (1)] 2 = 1.8341 y14, P = x4y4 + y24 = (0.4) (1.8341) + (1.8341)2 = 4.0976 93 y4, P = y3 + h [9y41 + 19y31 – 5y21 + y11] 24 = 1.5041 + 0.1 [9 (4.0976) +19 (2.7135) – 5 (1.8872) + 1.3592) 24 = 1.8389 y (0.4) = 1.8389 30. Solve y1 = y 2 x2 ; y (0) = 1 by Runge – kutta method of fourth order to find y (0.2) y 2 x2 Solution: Y1 =f (x, y) = y 2 x2 , x0 = 0, h = 0.2, x1 = 0.2 y 2 x2 f (x0, y0) = f (0, 1) = 1 0 =1 1 0 k1 = hf (x0, y0) = 0.2 1 = 0.2 k h k2 = hf (x0 + , y0 + 1 ) = (0.2) f (0.1, 1.1) 2 2 1.21 0.01 = 0.2 = 0.9167213 1.21 0.01 k h k3 = hf (x0 + , y0 + 2 ) = (0.2) f (0.1, 1.0983606) 2 2 = 0.1967 k4 =hf (x0 +4, y0 +k3) = 0.2 f (0.2, 1.1967) = 0.1891 y = = 1 [k1 + 2k2 + 2k3 +k4] 6 1 [0.2 + 2 (0.19672) + 2 (1.1967) + 0.1891] 6 = 0.19598 y (0.2) = y1 = y0 + y = 1.19598 94 UNIT – V BOUNDARY VALUE PROBLEMS IN ORDINARY AND PARTIAL DIFFERENTIAL EQUATIONS Classification of a partial differential equations: A general two dimensional second order partial diff. equation is of the form. 2u 2u 2u u u A 2 B C 2 D E Fu G x xy y x y where A, B, C, D, E, F, G are functions of x and y only. This equation is said to be (i) elliptic if (ii) Parabolic if (iii) Hyperbolic B 2 4 AC 0 B 2 4 AC 0 B 2 4 AC 0 Standard five point formula (SFPF) ui , j 1 ui 1, j ui 1, j ui , j 1 ui , j 1 4 Diagonal five point formula (DFPF) ui , j 1 ui 1, j 1 ui 1, j 1 ui 1, j 1 ui 1, j 1 4 Explicit formula for Bender – Schmidt method: ui , j 1 ui 1, j (1 2 )ui , j ui 1, j , where it is valid if 0< 1 2 Bender-Schmidt recurrence equation : ui , j 1 1 1 K ui 1, j ui 1, j , where 2 2 2 ah a is K= h 2 2 Formula for Poisson equation: ui 1, j ui 1, j ui , j 1 ui , j 1 4ui , j h2 f (ih, jh) 95 k ah 2 Crank-Nicholson difference scheme or methods: ui 1, j ui 1, j ui 1, j 1 ui 1, j 1 2( 1)ui , j 2( 1)ui , j 1 Explicit scheme or Explicit formula for hyperbolic equations: ui , j 1 2(1 2 a2 )ui , j 2 a2 (ui 1, j ui 1, j ) ui , j 1 I Standard five point formula is showing laplace equation over a region. ui , j 1 ui 1, j ui 1, j ui , j 1 ui , j 1 4 Numerical Examples: 01. Classify the partial differential equation xfxx+yfyy=0, x>0,y>0 Here A=x, B=0, C=y B 2 4 AC 0 4 xy 0 The given pde. Is elliptic 02.Classify the pde fxx+2fxy+4fyy=0 Here A=1,B=2, C=4 B 2 4 AC 4 16 12 0 The given pde is elliptic 03. Classify the pde fxx-2fxy+fyy=0 Here A=1, B=-2, C=1 B 2 4 AC 4 4 0 The given pde is parabolic. 04. Classify one dimensional wave equation. The one dimensional wave equation is 2 2u 2 u a t 2 x 2 here A=a2, B=0, C=-1 Now B2 -4Ac=0-4a2(-1) =4a2>0 The dimensional wave equation is hyperbolic. 96 05. Classify one dimensional heat equation. The one dimensional heat equation is u 2u a2 2 t x here A=a2, B=0, C=0 Now B2-4Ac=0-0=0 The dimensional wave equation is parabolic. 06. Classify Laplace equation is two dimensions Laplace equation is Here A=1, B=0, C=1 Now B 2 4 AC 0 4.1.1 4 0 Laplace equation is elliptic. 07. Classify Poisson’s equation. The Poisson’s equation is 2u 2u f ( x, y ) x 2 y 2 Here A=1, B=0, C=1 Now B 2 4 AC 0 4.1.1 4 0 Poisson equation is elliptic. 08. Classify 2u 2u 2u 2 0 x 2 xy y 2 Here A=1, B=2, C=1 Now B 2 4 AC 4 4 0, x, y Hence, the given equation is parabolic. 09. Classify x2fxx+(1-y2)fyy=0 Here A=x2, B=0, C=1-y2 Now, B 2 4 AC 0 4 x 2 (1 y 2 ) =4 x 2 ( y 2 1) For all x except x=0,x2 is +ve If -1<y<1, y2-1 is negative B 2 4 AC is negative if -1<y<1, x 0 For x ( x 0), 1 y 1, the given equation is elliptic. For x , x 0, y 1or y 1, the equation is hyperbolic For x=0 for all y or for all x, y=I1 the equation is parabolic. 97 2u 2u 0 x 2 y 2 10. Classify Uxx+4uxy+(x2+4y2)uyy=sin(x+y) Here A=1, B=4, C=x2+4y2 Now, B 2 4 AC =16-4.1.(x2+4y2) = 4(4- x2+4y2) The given equation is elliptic if 4- x2+4y2 <0 Is x2+4y2>4 x2 y 2 1 4 1 x2 y 2 If is elliptic is the region outside the ellipse 1 4 1 x2 y 2 It is hyperbolic inside the ellipse 1 4 1 x2 y 2 It is parabolic on the ellipse 1 4 1 11. Classify (x+1) Uxx – 2(x+2)uxy +(x+3)uyy=0 Here A= x+1, B=-2(x+2), C=x+3 Now, B 2 4 AC = 4(x+2)2-4(x+1)(x+3) x 2 16 16 x x 2 12 x 4 x 12 40 The given equation is hyperbolic at all points of the region. 12. Classify fxx-2fxy=0,x>0, y>0 here A=1. B=-2, C=0 Now, B 2 4 AC =4-0=4>0 Given pde is hyperbolic 13. Classify xfxx +fyy=0 Here A=x, B=0, C=1 Now, B 2 4 AC =0-4x=-4x Given pde is (i) elliptic if x>0 (ii) Parabolic if x=0 (iii) hyperbolic if x<0 98 14. Given 2u u , f (0, t ) f (5, t ) 0 f ( x, 0) x 2 (25 x 2 ) 2 x t find f in the range taking h=1 and up to 2 seconds Solution: To use bender- Schmidt method, K Have a=1, h=1 K Step size of time = ah 2 2 1 2 1 2 Step size of x=1 F(0,0)=0,f(1,0)=2h,f(2,0)=84,f(3,0)=144 f(4,0)=144, d(5,0)=0 We have ui , j 1 1 ui 1, j ui 1, j 2 15.Using crank-Nicholson method, solve u 2u subject to u( x, 0) 0, u (0, t ) 0 and u(1, t ) t t x 2 1 taking h=0.5 and k= 8 1 k 1 Solution:Here a=1 2 8 ah 1 1 2 4 Since 1 , we can not use simplified formula 2 we use formula ui 1, j 1 ui 1, j 1 6ui , j 1 2ui , j ui 1, j ui 1, j 1 0 6u, 2(0) (0 0) 8 1 u1 0.020833 48 99 16. Solve the differential equation d 2x t (1 ) x t , x(1)=2, x(3)=-1. 2 dt 5 Solution: Replace x 2 xi xi 1 d 2x by i+1 2 dt h2 the differential equation becomes t x 2 xi xi 1 d 2x - (1 i ) xi ti by i+1 2 2 5 dt h t xi 1 2 h 2 (1 i ) xi xi 1 h 2ti ..........(1) 5 Let us subdivide the interval (1,3) into 4 equal parts Note that the interval given in the problem is (1,3). T1=1, t2=1.5, t,=2,tn=2.5,t5=3 We write the difference equation (1) for the intermediates joints of ti At t=t2=1.5,i=2 2 1 2 1.5 1 X1 - 2+ 1- x2 x, 1.5 2 2 5 At t t , 2.0, i 3 yi 1 2 yi yi 1 2 y i ...............(1) 2 1 2 2.0 1 X 2 - 2+ 1 x3 xn 2.0 2 2 5 At t tn 2.5, i 4 2 1 2 2.5 1 X3 - 2+ 1 x4 x5 2.5 2 2 5 But the from the boundaries condition, we have x1=x(t1)=x(1)=2 and x5=x(+5)=x(3)=-1 putting there values of x1 and x5 in the above equation. 1 2 2 0.7 x2 x3 0.375 4 We get 1 x2 2 0.6 x3 x4 0.5 4 100 1 x3 2 0.5 x4 1 0.625 4 is 2.175 x2 x3 0.x4 1.625 x2 2.15 x3 x4 0.5 0 x2 x3 2.125 x4 1.625 solving the above there equation we get x2=0.552, x3 0.424, x4 0.964 d2y 17. Solve y given y1(0)=0 and y(1)-1. dx 2 Solution: Replacing d2y by the different formula, dx 2 yi 1 2 yi yi 1 yi ........(1) h2 Let us divide the interval (0,1) into two parts so that X1=0,x2=0.5,x3=1. Note that y1 is not given y3=1 using (1) at x1, (i=1) Y0-2y1+y2=1/4 y1…….(2) (Have y0 is not mentioned in the problem) using (1) at x2,(i=2) yi-2y2+y3=1/4y2 is y1-2y2+1=1/4y2……(3) This we have a system of two equation is three unknown y0,y1 and y2. We need one more equation to solve for y0,y1 and wy2 for this, we have to use the other boundary condition is derivative, y1 (0)=0 Here x1=0 y1(x1)=0 is 0=y1(x1) = y ( x2 ) y ( x0 ) 1y ( x2 ) y ( x0 )or y 2 y0 2h using this in (2), we have 2y2-2y1=1/4 y1 the system to be solved in 8 ½ -9y1=0 and turn (3), 4y1-9 ½ =-4. Is -9y1+8 ½ =0 Hy1 -9 ½ =-4 Showing this, we get y2 36 32 32 36 and y1 is y(o)= and y (1) 49 49 49 49 101 18. Solve the Laplace equation 2u=0 at the interior points of the square region given. Solution: Let u1,u2……u9 be the values of f at the interior lattice points. 1 u5 [17.0 12.1 0 21.0] 12.5[ SFPF ] 4 1 u1 [17.0 0 0 12.5] 7.4( DFPF ) 4 1 1 u3 [18.6 12.5 17 21] 17.3[ DFPF ] u9 [21.0 12.1 12.5 9.0] 13.7[ DFPF ] 4 4 1 1 u7 [12.5 0 0 12.1] 6.2( DFPF ) u2 [17.0 12.5 7.4 17.3] 13.6( SFPF ) 4 4 1 u4 [0 12.5 7.4 6.2] 6.5[ SFPF ] 4 1 u6 [17.3 17.7 12.5 12] 16.1( SFPF ) 4 1 u8 [12.5 12.1 6.2 13.7] 11.1( SFPF ) 4 We have got the rough values at all interior grid points. Now we can start Liebmanns iteration process. We use only standard two point formula to evaluate the in. First iteration: 1 1 u1(1) [o 11.1 u2 un ] [0 11.1 13.6 6.5] 7.8 4 4 1 u2(1) [17.0 12.5 7.8 17.3] 13.7 4 1 u3(1) [13.7 21.9 19.7 16.1] 17.9 4 1 u4(1) [0 12.5 7.8 6.2] 6.6 4 1 u5(1) [13.7 11.1 6.6 16.1] 11.9 4 1 u6(1) [17.9 13.7 11.9 21.0] 16.1 4 1 u7(1) [6.6 8.7 0 11.1] 6.6 4 1 u8(1) [11.9 12.1 6.6 13.7] 11.1 4 1 u9(1) [16.1 12.8 17.0 11.1] 14.3 4 102 Second iteration: 1 u1(2) [o 11.1 13.7 6.6] 7.9 4 1 u2(2) [17.0 17.9 7.9 17.9] 13.7 4 1 u3(2) [13.7 19.7 21.9 16.1] 17.9 4 1 u4(2) [7.9 0 11.9 6.6] 6.6 4 1 u5(2) [13.7 11.1 6.6 16.1] 11.9 4 1 u6(2) [11.9 17.9 21.0 14.3] 16.3 4 1 u7(2) [0 6.6 11.1 8.7] 6.6 4 1 u8(2) [6.6 11.9 14.3 12.1] 11.2 4 1 u9(2) [11.2 16.3 17.0 12.8] 14.3 4 Third iteration: 1 u1(3) [o 11.1 13.7 6.6] 7.9 4 1 u2(3) [7.9 17.9 17.0 11.9] 13.7 4 1 u3(3) [13.7 21.9 19.7 16.3] 17.9 4 1 u4(3) [6.6 0 7.9 11.9] 6.6 4 1 u5(3) [13.7 11.2 6.6 16.3] 11.95 4 1 u6(3) [11.9 21.0 17.9 14.3] 16.3 4 1 u7(3) [6.6 8.7 0 11.2] 6.6 4 1 u8(3) [11.9 12.1 6.6 14.3] 11.2 4 1 u9(3) [11.2 16.3 17.0 12.8] 14.3 4 103 The second and third iterated values are same. Thus we can stop the iteration. We can write the iterated values of is in the table given below. u1 7.9, u2 13.7, u3 17.9, u4 6.6u5 11.95, u6 16.3 u7 6.7, u8 11.2, u9 14.3 19.Solve 2u=8x2y2 in the square mesh given u=0 on the 4 boundaries dividing the square into 16 sub – squares of length. 1 unit. Solution: Take the co-ordinate system with origin at the centre of the square. Since the P.D.E. and boundary conditions are symmetrical about x, y axes and y=x we have, u1= U3=u7=u9 U2=u4=u6=u8 we need to find u1= U2= U3=u5 only (have h=1) As per the five point formula, (have f(x.y)=8x2y2) ui 1, j ui 1, j ui 1, j ui , j 1 4ui , j h2 f (ih, jh) f (i, j )......(1) At (i=-I,j=-1), is have, u2 u4 4u1 8(1) 2 (1) 2 8 is u 2 2u1 4......(2) At (i=0,j=1), is have, u1 u3 u5 4u2 0 2u1 4u2 u5 0......(3) At (i=0,j=0), u2 u4 u6 u8 4u5 0 4u5 4u5 0 u2 u5 0......(4) from (2), u1 1 u2 4 2 from (4) u5=u2 using in (3), u2 4 4u2 u2 0. u2 2 u5 2, u1 3, u1 3, u2 2 u5 , 104 20.Solve ut=uxx subject to u(0,t)=0,u(l,t)=0 and u(x,0)= sin nx, 0<x<1. Solution: Since h, and K are not given in will select then properly and use bender –schmidt method. k a 2 1 2 h h 2 2 a 1 since range of x is (0,1), takes h=0.2 hence K (0.2) 0.02 2 the formula is ui , j 1 u(o,o)=0,u(0.2,0)=sin 1 ui1, j 1 ui1, j 2 5 0.5878 2 3 0.9511;sin(0.6, 0, sin 0.9511 5 5 4 sin(0.8, 0) sin 0.5878 5 sin(1, 0) 0 we form the table u (0.4, o) sin 21. Solve numerically, 4uxx=utt with the boundary conditions u(0,t)=0, u(4,t)=0 and the initial conditions ut (x,0) and u(x,0)=x(4-x), taking h=1 (for 4 time steps) Solution: Since a 2 4, h 1, k h 1 ........(1) a 2 Taking k= ½ , we use the formula, ui , j 1 ui 1, j ui 1, j ui , j 1......(2) From u(0,t)=0 u along x= 0 are all zero From u (e,t)=0 u along x=4 are all zero U(x,0)=x(4-x) implies that u(0,0)=0, u(1,0)=3, u(2,0)=4, u(3,0)=3. Now, we fill up the row t=0 using the above values, Ut(x,o)=o implies ui ,1 ui 1,0 ui 1,0 2 ..........(3) Now we draw the table ; for that we require 105 u1,1 u2,1 u3,1 u2,0 u0,0 2 u3,0 u1,0 2 u4,0 u2,0 2 40 2 2 33 3 2 2 u4,1 0 1 Period is h seconds N 8 h 8 4sec. 2 2u 2u 22. Solve 2 2 , 0 x 1, t o, givenu ( x, 0) ut x, 0 t x u (0, t ) 0andu (1, t ) 100 sin t compute u for 4 times steps with h=0.252 Solution: Here, the two ends are not fixed x=1 is a free end with displacement not equal to zero. Since the differential equation is same, we have ui , j 1 ui 1, j ui 1, j ui , j 1......(1) if k h 0.25 0.25sin ce a =1 a 1 step-size is 0.25 in both variable range of x is (0,1) At t=0, all u’s are zero At x=0, all u’s are zero; since u(1,t)=100 sint, u(1,0)=0. u (1, 0.25) 100sin u (1, 0.5) 100sin 4 70.7106 100 2 3 u (1, 0.75) 100sin 70.7106 4 u (1,1) 0 106 ut ( x, 0) 0 )ui ,1 u1,1 u2,0 u0,0 ui 1,0 ui 1,0 2 0 2 u2,1 0 u2,1 0 u4,1 70.7106 u (4, 0.25) Please note u(x,t) u(i,j) since x=ih, t= jk 23. Solve, uxx +uyy=0 over the square mesh of 4 units, satisfying the following boundary conditions. (i ) u (o, y ) 0, 0 y 4 (ii ) u (4, y ) 12 y, 0 y 4 (iii) u ( x, 0) 3x, 0 x4 (iv) u ( x, 4) x , 0 x4 3 Solution: Let the internal grid points be u1,u2, ……u9 Initial values 1 4 6 0 14 6 4 1 u1 0 6 4 0 2.5 4 u5 1 16 6 14 4 10 4 1 u7 0 6 0 6 3 4 u3 u9 1 6 14 6 12 9.5 4 1 4 6 2.5 10 5.625 4 1 u4 0 6 2.5 3 3.125 4 Now, u2 1 6 14 10 9.5 9.875 4 1 u8 6 6 3 9.5 6.125 4 u6 Let us start the iteration now. 107 After three iterations, we can see that u1=2.37, u2 5.59, u3 9.87, u4 2.88, u5 6.13, u6 9.88, u7 3.01, u8 6.16, u9 9.51, 24. Solve the Poisson equation 2u=-(x+y)2 over the square region bounded by the lines x=0,y=0,x=0,y=3 given that u=0 throughout the boundaries taking h=1. Solution: Here f(x,y)=-(x+y)2=-(i+j)2 The standard five point formula for solving Poisson equation. ui 1, j ui 1, j ui , j 1 ui , j 1 4ui , j h2 f (ih, jh) Using the formula at A, (i=1,j=2) 0+0+u2+u3 -4u1=-(1+2)2=-9 u2+u3-4u1=-9-----------(1) Using the formula is, (i=2,J=2) u1+0+0+u4 -4u2=-(2+2)2=-16 u1+u4-4u2=16 -----------(2) Using the formula at C, (i=1,j=1) 0+u1+u4 +0-4u3=-(1+1)2=-4 u1+u4-4u3=-4 -----------(3) Using the formula at u1(i=2,j=1) U3+u2 0+0 -4u4=-(2+1)2=-9 U3+u2-4u4=-9-----------(4) From (1) and (4), u1=u4 from(2), u2 from(3), u3 1 u1 u4 16............(6) 4 1 u1 u4 4............(7) 4 (6) can be written as u2 1 1 2u1 16 or u2 u1 2 .......(8) 4 2 (7) can be written as u3 1 1 2u1 4 = u1 2 .......(9) 4 2 Now we have to solve u1 1 1 1 u2 u3 9 , u2 u1 8 , u3 u1 2 4 2 2 108 Taking the initial values, for u1,u2,u3, as (0,0,0) and applying gauss seidel method, we get the following table of approximation.u1=4.66,u2=6.33,u3 = 3.33, u4 = 4.66 u 1 2u 25.Solve , 0 x, 12, 0 t 12 with boundary conditions and initial conditions. t 2 x 2 1 x(15 x), 0 x 12 4 =u (o, t ) o, u (12, t ) 9, u (o, t ) o, o x 12 u ( x, 0) using Bender Schmidt relation using h=k=3 Solution: k 3 1 2 ah 29 6 we use the explicit formula ui , j 1 ui 1, j (1 2 )ui , j ui 1, j 1 1 1 = ui 1, j 1 2 ui , j ui 1, j 6 6 6 1 2 = ui 1, j ui 1, j ui , j 6 3 12 0 6.604 10.639 11.104 9 9 0 7.083 11.292 11.583 9 6 0 7.625 12 12.125 9 3 0 8.25 12.75 12.75 9 0 0 9 13.5 13.5 9 t/x 0 3 6 9 12 1 u (3, 0) 3 15 3 9 4 1 u (6, 0) 6 15 6 13.5 4 1 u (9, 0) 9 15 9 13.5 4 109 26.Use crank-Nicholson method, solve ut=uxx, subject to u(x,o)=0,u(o,t)=o and u(1,t)=t, 1 1 taking h , K for one time step. 4 8 1 1 1 k Solution:Here a 1, h , K , 2 8 2 4 8 ah 1 1 6 we can not use the simplified formulas. Using the explicit formula ui 1, j 1 ui 1, j 1 2( x 1)ui , j 1 2 1 ui , j ui 1, j ui 1, j ui 1, j 1 ui 1, j 1 6ui , j 1 2ui , j 2 ui 1, j ui 1, j ui 1, j 1 ui 1, j 1 3ui , j 1 ui , j ui 1, j ui 1, j 1/8 0 U1 U2 1/3 1/8 0 0 0 0 0 0 t/x 0 ¼ ½ ¾ 1 Ui-1,j+1 Ui-1,j+1 Ui-1,j+1 0 u2 u1 0 u1 u3 3u2 0 1 u2 3u3 0 8 Solving these equation, we get U1=0.00595 U2=0.001786 U3=0.04762 27. Solve t= u 2u with the conditions U(x,0)=0, u(o,t)=o and u(1,t)=t compute is for t x 2 1 in two steps using crank –Nicholson formula. 8 Solution: Uxx=ut Here a=1; k= 1 choose h such that =1 Now 16 110 k 1 h2a h 2 a k or h 2 k the simplified crank-Nicholson scheme can be used. ui , j 1 1 ui 1, j 1 ui 1, j 1 ui 1, j ui 1, j 4 1/8 0 U4 U5 U6 1/8 1/16 0 U1 U2 U3 1/16 0 0 0 0 0 0 t/x 0 ¼ ½ ¾ 1 1 step, weget 16 1 At u1 (0 u2 0 0) 4 4u1 u2 0.........(1) t 1 u2 (u1 u3 0 0) 4 4u2 u1 u3 .........(2) 1 1 (u2 0 0) 4 16 1 4u3 u2 ........(3) 16 u3 solving (1), (2) and (3) we get u1=0.0011116, u2=0.004464,u3=0.01674 At t=1/8 step, we have u4 = ¼[0+u5+0+u2] 4u4=u5+0.004464……….(4) u5=1/4[u4+u6+u1+u3] 4u5=u4+u6+0.0011116+0.004464…….(5) 1 1 1 u4 u2 4 8 16 1 1 4u6 u4 0.004464 .........(6) 8 16 u6 solving (4) ,(5) and (6) we get U4=0.005899 U5=0.019132 U6= 0.052771 111 28. Solving 25 uxx-utt=0 for u at this pivotal points given u(0,t)=u(5,t)=0, ut(x,0)=0 and u(x,0)=2x for 0 x 2.5 =10-2x for 2.5 x 5 for one half period of vibration. Solution: 2l 2 5 2sec. a 5 Here a2=25, a=5 period of vibration = Half period =1 second. Thus we have to find the values of u up to t= 1 k 1 h 1 , K for min gh 1 h a a 5 5/5 0 -2 -4 -4 -2 0 4/5 0 -2 -3 -3 -2 0 3/5 0 -1 -1 -1 -1 0 2/5 0 1 1 1 0 (0+3-2) (2+3-4) 3+0-2 1/5 0 2 3 3 2 0 0 0 2 4 4 2 0 t/x 0 1 3 2 4 5 U(1) = 2x1=2 U(2)=2x2=4 U(3)=10-2x3=4 U(4)=10-2x4=2 Now we get the values of u at t= 1/5 using the relation 1 ui ,1 (ui 1,0 ui 1,0 ) 2 1 40 ui ,1 (u2,0 u0,0 ) 2 2 1 u2,1 (u3,0 u1,0 ) 3 2 1 u3,1 (u4,0 u2,0 ) 3 2 1 u4,1 (u5,0 u3,0 ) 3 2 2 3 we have to get the values of u at t = , t etc. 5 5 112 for this we use ui,j+1= ui+1,j+ ui-1,j+ ui,j 29. Solve u 2u in0 x, 15; t o given that u(x,o)=20, u(0,t)=0, u(5,t)=100. compute t x 2 u for one time step with h=1 by crank – Nicholson method. Solution: Here a=1, h=1 K=ah2 to use simple form k=1.12=1 ui , j 1 1 ui 1, j 1 ui 1, j 1 ui 1, j ui 1, j 4 1 1 u1 [0 20 20 u2 ] u1 (40 u2 ).....(1) 4 4 1 1 u2 [u1 20 20 u3 ] u 2 (40 u1 u3 ).....(2) 4 4 1 1 u3 [u2 20 20 u4 ] u 3 (40 u2 u4 ).....(3) 4 4 1 1 u4 [u3 20 20 100] u 4 (140 u3 ).....(4) 4 4 form(1) 4u1-u2=40……..(5) form(2) u1-4u2+u3=-40……..(6) form(3) u2-4u2+u4=-40……..(7) 4 (6) 4u1 16u2 4u3 160.....(8) (5) (6) 15u2 4u3 200.....(9) 1 from(7)u2 4u3 (140 u3 ) 40 4 4u 2 16u3 140 u3 160 4u 2 15u3 300......(10) 4 (9) 60u2 16u3 800.....(11) 15 (10) 60u2 225u3 4500.....(12) (11) (12) 20943 5300 u 3 25.358852 From (10) 4u2=-300+380.38278 80.38278 u2 = 20.095695 From (5) 4u1=40+20.095695 =60.095695 113 u1 = 15.023924 1 (140 25.358852) 4 =41.339712 From(4)u4 is the values are u1 = 15.023924,u2=20.095695 u3=25.358852, u4 = 41.339712 30. Solve 2u 2u 10( x 2 y 2 10) over the square mesh with sides x=0,y=0,x=3,y=3 x 2 y 2 with u=0 on the boundary and mesh length 1 unit solution: The P.D.E. in 2u=-101x2+y2+10) here h=1 ……..(1) ui 1, j ui 1, j ui , j 1 ui , j 4ui , j 10(i 2 j 2 10)......(2) Applying formula (2) at 1) (i=1,j=z) 0+0+u2+u3-4u1=-10(15)=-150 u2+u3-4u1=-150…..(3) Applying (2) at E (i=2,j=2) U1+u4-4u2=-180…..(4) Applying (2) at F, (i=1, j=1) U1+u4-4u3=-120…..(5) Applying (2) at G, (i=2, j=1) U2+u3-4u4=-10(22+12+10)=-150…..(6) We can solve the equation (3), (4), (5), (6) either by direct elimination or by Gauss-seidel method. Method (1) (5)-(4) gives, (Eliminate u1) 4(u2-u3)=60 u2-u3=15------------(7) Eliminate u1 from (3) and (4); (3)+4(4) gives, -15u2+u3+4u4=-870…….(8) Adding (6) and (8) -7u2+u3=-510…….(9) From (7),(9) adding, u2 = 82.5 Using (7), u3=u2-15=82.5-15=67.5 Put in (3), 4u1=300 u1=754u4=150+150; u4=75 u1=u4=75, u2=82.5,u3=67.5 114