II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Chapter-2 Finite Differences and Interpolation Suppose we are given the following values of y = f(x) for a set of values of x : x : x0 x1 x2 …… xn y : y0 y1 y2 …… yn The process of finding the values of y corresponding to any value of x=xi between x0 and xn is called interpolation. The technique of estimating the value of a function for any intermediate value of the independent variable is called interpolation. The technique of estimating the value of a function outside the given range is called extrapolation. The study of interpolation is based on the concept of differences of a function. Suppose that the function y=f(x) is tabulated for the equally spaced values x = x0, x1=x0+h, x2=x0+2h, …, xn=x0+nh giving y = y0, y1, y2, …, yn. To determine the values of f(x) and f '(x) for some intermediate values of x, we use the following three types of differences 1. Forward differences 2. Backward differences 3. Central differences Forward differences: The forward differences are defined and denoted by ∆f(x)=f(x+h)-f(x), ∆y0 = y1 – y0 ∆y1 = y2 – y1 ∆y2 = y3 – y2 ……………. ∆yr = yr+1 – yr ……………. ∆yn-1 = yn – yn-1 These are called the first forward differences and ∆ is the forward difference operator. Similarly the second forward differences are defined by ∆2 yr = ∆ yr+1 – ∆yr. In general ∆p yr = ∆p-1 yr+1 – ∆p-1yr , th p forward differences. The forward differences systematically set out in a table called forward difference table. Value of Value of 1st diff. 2nd diff. 3rd diff. 4th diff. 5thdiff. x y ∆ ∆2 ∆3 ∆4 ∆5 x0 y0 Drgsk@KLUniversity Page 1 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 ∆y0 x1 ∆2y0 y1 ∆y1 x2 ∆3y0 ∆2y1 y2 ∆4y0 ∆y2 x3 ∆3y1 ∆2y2 y3 ∆4y1 ∆y3 x4 ∆5y0 ∆3y2 ∆2y3 y4 ∆y4 x5 y5 Backward Differences: The backward differences are defined and denoted by f(x)= f(x)-f(x-h), y1 = y1 – y0 y2 = y2 – y1 y3 = y3 – y2 ……………. yr = yr – yr-1 ……………. yn = yn – yn-1. These are called the first backward differences and is the backward difference operator. Similarly the second backward differences are defined by 2 yr = yr – yr-1. In general p p-1 yr= p-1yr – yr-1 , th p backward differences. The backward differences systematically set out in a table called backward difference table. Value of x Value of y x0 y0 1st diff. 2nd diff. 2 3rd diff. 3 4th diff. 4 5thdiff. 5 y1 x1 y1 Drgsk@KLUniversity 2 y2 Page 2 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 3 y2 x2 2 y2 4 y3 3 y3 x3 2 y3 x4 2 y4 y4 5 y4 4 y4 3 y4 y3 y5 y5 y5 y5 y5 x5 y5 Central differences: The central differences are defined and denoted by δf(x)=f(x+h/2)-f(x-h/2), δy1/2 = y1 – y0 δy3/2 = y2 – y1 δy5/2 = y3 – y2 ……………. δyr+1/2 = yr+1 – yr ……………. δyn-1/2 = yn – yn-1 These are called the first central differences and δ is the central difference operator. Similarly the second central differences are defined by δ2 yr = δyr+1/2 – δyr-1/2. In general δp yr = δp-1yr+1/2 – δp-1yr-1/2 , (if p is even) δp yr+1/2 = δp-1yr+1 – δp-1yr , (if p is odd) pth central differences. Note : It is observe that, the differences are not change only notation is changed. y1-y0 = ∆y0= y1= δy1/2 . Example#1. Evaluate (i) ∆ tan-1x (ii) ∆ (ex log 2x) (iii) ∆2 cos 2x Drgsk@KLUniversity Page 3 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Sol. From the definition of forward differences ∆f(x) = f(x+h) – f(x). (i) Let f(x) = tan-1x, then ∆ tan-1x = tan-1(x+h) - tan-1x xhx h tan 1 = tan 1 . 2 1 hx x 1 ( x h) x (ii) (e x log 2 x) e x h log 2( x h) e x log 2 x e x h log 2( x h) e x h log 2 x e x h log 2 x e x log 2 x xh xh x e x h log (e e ) log 2 x x h e x e h log( 1 ) (e h 1) log 2 x . x 2 (iii) ∆ cos 2x = ∆ [∆ cos 2x] = ∆ [ cos 2(x+h) – cos 2x] = ∆ cos 2(x+h) – ∆ cos 2x = cos 2(x+2h) – cos 2(x+h) – [cos 2(x+h) ) – cos 2x] = – 2 cos (2x+3h) sin h + 2 sin(2x+h) sin h = – 2 sin h [sin(2x+3h) – sin(2x+h) ] = – 2 sin h [2 cos(2x+2h)sin h] = – 2 sin2 h cos 2(x+h). Example#2. Evaluate the following, with interval of difference being unity (i) ∆2 (abx) (ii) ∆n ex Sol. From the definition of forward differences ∆f(x) = f(x+h) – f(x). (i) ∆(abx) = a ∆bx = a(bx+1 – bx) = abx(b – 1) ∆2 (abx) = ∆ [∆ (abx)] = ∆ abx(b – 1) = a(b – 1) ∆(bx) = a(b – 1) (bx+1 – bx) = a(b – 1)2 bx. x (ii) ∆e = ex+1 – ex = ex(e – 1) ∆2ex = ∆[∆ex] = ∆ [ex+1 – ex ]= (e – 1)∆ex = (e – 1) ex(e – 1) = (e – 1)2 ex. Similarly ∆2ex = (e – 1)2 ex, ∆3ex = (e – 1)3 ex, … and ∆nex = (e – 1)n ex. Differences of a Polynomial: Let f(x) = a0 xn + a1 xn-1 + a2 xn-2 + … + an-1x + an be an nth degree polynomial in x, then ∆f(x) = f(x+h) – f(x) = a0 [(x+h)n – xn] + a1 [(x+h)n-1 – xn-1 ]+ a2 [(x+h)n-2 – xn-2 ]+ … + an-1 [x+h-x] = a0 n h xn-1 + a11xn-2 + a21xn-2 + … + an-1 h, Drgsk@KLUniversity Page 4 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 where a11, a12, … are new constant coefficients. Thus, the first difference of a polynomial of nth degree is a polynomial of degree n-1. Similarly ∆2f(x) = ∆[∆f(x)] = a0 n h [(x+h)n-1 – xn] + a11 [(x+h)n-2 – xn-2 ]+ a21 [(x+h)n-3 – xn-3 ]+ … + an-2, 1 [x+h-x] = a0 n(n – 1) h2 xn-2 + a12xn-3 + a22xn-4 + … + an-2,1 h, where a12, a12, … are new constant coefficients. Thus, the second difference of a polynomial of nth degree is a polynomial of degree n-2. Continuing this process, for the nth difference, we get a polynomial of degree zero i.e. ∆nf(x) = a0 n(n – 1) (n – 2) … 3.2.1. hn = a0 n! hn which is a constant. From the above discussion, we have the following results: The differences of a polynomial of the nth degree are constant and all higher order differences are zero. If the nth differences of a function tabulated at equally spaced intervals are constant, then the function is a polynomial of degree n (It is important in numerical analysis as it enables as to approximate a function by a polynomial). Example#3. Evaluate ∆10 [(1-ax)(1-bx2)(1-cx3)(1-dx4)]. Sol. Taking interval of difference h = 1. ∆10 [(1-ax)(1-bx2)(1-cx3)(1-dx4)] = ∆10 [abcd x10 + k1 x9 + k2 x8 + … + 1] = abcd ∆10 (x10) + k1 ∆10 (x9)+ k2 ∆10 (x8) + … + ∆10(1), where k1, k2, … are constant coefficients. Since ∆10 (xn) = 0 for n < 10, we have ∆10 [(1-ax)(1-bx2)(1-cx3)(1-dx4)] = abcd ∆10 (x10) = abcd 10!. Factorial Notation: A product of the form x(x – 1) (x – 2) …(x – r +1) is denoted by [x]r and is called a factorial. In particular, [x] = x, [x]2 = x(x – 1) , [x]3 = x(x – 1) (x – 2), …[x]n = x(x – 1) (x – 2) …(x – n +1). If the interval of difference is h, then [x]n = x(x – h) (x – 2h) …(x – (n – 1)h). The factorial notation is of special utility in the theory of finite differences. It helps in finding the successive differences of a polynomial directly by simple rule of differentiation ([x]r as xr). Drgsk@KLUniversity Page 5 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 To express a polynomial of nth degree in the factorial notation, we use the following two steps 1. Arrange the coefficients of the powers of x in descending order, replacing missing powers by zeros. 2. Using detached coefficients divide by x, x – 1, x – 2, … x – (n – 1) successively. Example#4. Express f(x) = 2x3 – 3x2 + 3x – 10 in a factorial notation and hence find all differences. Sol. Let f(x) = A[x]3 + B[x]2 + C[x] + D. Then x3 x2 x 1 2 _ -3 2 3 -1 2 2 _ -1 4 2=C 3 2 _ 3=B -10 = D 2=A Hence f(x) = 2[x]3 + 3[x]2 + 2[x] – 10. Therefore, ∆f(x) = 6[x]2 + 6[x] + 2 ∆2f(x) = 12 [x] + 6 ∆3f(x) = 12. Other Difference Operators: (1) Shift operator : Shift operator E is the operation of increasing the argument x by h so that E f(x) = f(x+h), E2 f(x) = f(x+2h), … En f(x) = f(x+nh). -1 The inverse operator E is defined by E-1 f(x) = f(x-h). Similarly E-n f(x) = f(x-nh). (2) Averaging operator : Averaging operator μ is defined by the equation μ f(x) = ½ [f(x + h/2) + f(x - h/2)]. In the difference calculus, ∆ and E are regarded as the fundamental operators and , δ and μ can be expressed in terms of these. Relations Between the Operators : 1. ∆ = E – 1 2. = 1 – E-1 3. δ = E1/2 – E-1/2 Drgsk@KLUniversity Page 6 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 4. μ = ½ [E1/2 + E-1/2 ] 5. ∆ = E = E =δ E1/2 6. E = ehD. Example#1. Determine the missing values in the following table: x 45 50 55 60 65 y 3 ? 2 ? -2.4 Sol. Let p and q be the missing values in the given table, then the difference table is as follows: x y ∆y ∆2y ∆3y 45 3 p–3 50 p 5 – 2p 2–p 3p + q – 9 55 2 p+q–4 q–2 3.6 – p – 3q 60 q –0.4 – 2q –2.4 – q 65 -2.4 Since three entries are given, the function y can be represented by a second degree polynomial. Therefore, ∆3y0 = 0 and ∆3y1 = 0. Thus 3p + q – 9 = 0 and 3.6 – p – 3q = 0. Solving these equations, we get p = 2.925 and q = 0.225. Example#2. Determine the missing values in the following table without using difference table. x 45 50 55 60 65 y 3 ? 2 ? -2.4 Sol. Given that y0 = 3, y2 = 2 and y4 = -2.4 and missing values be taken as y1= p and y3 = q. Since three entries are given, the function y can be represented by a second degree polynomial. Therefore, ∆3y0 = 0 and ∆3y1 = 0. (E – 1)3y0 = 0 (E – 1)3y1 = 0 3 2 (E – 3E + 3E – 1)y0 = 0 (E3 – 3E2 + 3E – 1)y1 = 0 y3 – 3y2 + 3y1 – y0 = 0 y4 – 3y3 + 3y2 – y1 = 0 q – 3(2)+ 3p – 3 = 0 -2.4 – 3q + 3(2) – p = 0 3p + q – 9 = 0 3.6 – p – 3q = 0. Solving these equations, we get p = 2.925 and q = 0.225. Newton’s Forward Interpolation Formulae: Let the function y=f(x) take the values y0, y1, y2, … corresponding to the values x0, x1, x2, … of x. Suppose it is required to evaluate f(x) for x=x0+ph, p is any real number. For any real number p, we have defined E such that Ep f(x) = f(x0+ph) yp = f(x0+ph) = Epf(x0)= (1+∆)py0 = [1+p∆+p(p-1)/2! ∆2 + p(p-1)(p-2)/3! ∆3 +…] y0 = y0 + p ∆y0 + p(p-1)/2! ∆2 y0+ p(p-1)(p-2)/3! ∆3 y0+… It is called Newton’s forward interpolation formulae. Drgsk@KLUniversity Page 7 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Newton’s Backward Interpolation Formulae: Suppose it is required to evaluate f(x) for x=xn+ph, where p is any real number. Ep f(x) = f(xn+ph) yp = f(xn+ph) = Epf(xn)= (1- )-p yn = [1+p +p(p+1)/2! 2 + p(p+1)(p+2)/3! 3 +…] yn = yn + p yn + p(p+1)/2! 2 yn+ p(p+1)(p+2)/3! 3 yn+… It is called Newton’s backward interpolation formulae. Choice of Newton’s Interpolation formulae: Newton’s forward interpolation formulae is used for interpolating the values of y near the beginning of a set of tabulated values and extrapolating values of y a little backward of y0. Newton’s backward interpolation formulae is used for interpolating the values of y near the end of a set of tabulated values and also extrapolating values of y a little ahead of yn. Example#1. The table gives the distances in nautical miles of the visible horizon for the given heights in feet above the earth’s surface : x=height 100 150 200 250 300 350 400 y=distance 10.63 13.03 15.04 16.81 18.42 19.90 21.27 Find the values of y when (i) x= 218 ft. (ii) x= 410 ft. Sol. The difference table is x y 100 10.63 ∆ ∆2 ∆3 ∆4 2.4 150 13.03 -0.39 2.01 x0=200 0.15 -0.24 15.04 0.08 1.77 250 16.81 18.42 0.03 -0.13 1.48 Drgsk@KLUniversity -0.05 -0.16 1.61 300 -0.07 -0.01 0.02 Page 8 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 350 19.90 -0.11 1.37 xn=400 21.27 (i) If we take x0=200, then y0=15.04, ∆y0=1.77, ∆2y0=-0.16, ∆3y0=0.03, ∆4y0=-0.01. Since x=218, step length h=50 and p=(x-x0)/h =18/50 = 0.36. By Newton’s forward interpolation formula, we have y(218) = y0 + p ∆y0 + p(p-1)/2! ∆2 y0+ p(p-1)(p-2)/3! ∆3 y0+ p(p-1)(p-2)(p-3)/4! ∆4 y0 = 15.04 + 0.36 (1.77) + 0.36(0.36-1)/2 (-0.16)+ 0.36(0.36-1)(0.36-2)/6 (0.03) + 0.36(0.36-1)(0.36-2)(0.36-3)/24 (-0.01) =15.04+0.6372+0.0184+0.0018+ 0.00041 = 15.69741 ≈ 15.7 nautical miles. (ii) If we take xn=400, then yn=21.27, yn=1.37, 2yn=-0.11, 3yn=0.02, 4yn=-0.01. Since x=410, step length h=50 and p=(x-xn)/h =10/50 = 0.2. By Newton’s backward interpolation formula, we have y(410) = yn + p yn + p(p+1)/2! 2 yn+ p(p+1)(p+2)/3! 3 yn+ p(p+1)(p+2)(p+3)/4! 4 yn = 21.27 + 0.2 (1.37) + 0.2(0.2+1)/2 (-0.11) + 0.2(0.2+1)(0.2+2)/6 (0.02) + 0.2(0.2+1)(0.2+2)(0.2+3)/24 (-0.01) =21.27+0.274-0.0132+0.0017- 0.0007 = 21.5318 ≈ 21.53 nautical miles. Central Difference Interpolation: It is best suited for interpolation near the middle of the table. If x takes the values x0-2h, x0-h, x0, x0+h, x0+2h and the corresponding values of y=f(x) are y-2, y-1, y0, y1, y2 , then we can write the difference table in the two notations as follows: Value Value 1st diff. 2nd diff. 3rd diff. 4th diff. of x of y x0-2h y-2 Drgsk@KLUniversity Page 9 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 ∆y-2(=δy-3/2) x0-h ∆2y-2(=δ2y-1) y-1 ∆y-1(=δy-1/2) x0 ∆3y-2(=δ3y-1/2) ∆2y-1(=δ2y0) y0 ∆y0(=δy1/2) x0+h ∆4y-2(=δ4y0) ∆3y-1(=δ3y1/2) ∆2y0(=δ2y1) y1 ∆y1(=δy3/2) x0+2h y2 Gauss’s forward interpolation formula: The Newton’s forward interpolation formula is y(x) = y0 + p ∆y0 + p(p-1)/2! ∆2 y0+ p(p-1)(p-2)/3! ∆3 y0+… We have ∆2y0 - ∆2y-1 = ∆3 y-1 ∆2 y0 = ∆2 y-1 + ∆3 y-1 Similarly ∆3 y0 = ∆3 y-1 + ∆4 y-1 ∆4 y0 = ∆4 y-1 + ∆5 y-1 Also ∆3y-1 - ∆3y-2 = ∆4 y-2 ∆3 y-1 = ∆3 y-2 + ∆4 y-2 Similarly ∆4 y-1 = ∆4 y-2 + ∆5 y-2 ∆5 y-1 = ∆5 y-2 + ∆6 y-2 Substituting the above in Newton’s forward interpolation formula, we get yp = y0 + p ∆y0 + p(p-1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-1+ (p+1)p(p-1)(p-2)/4! ∆4 y-2+ …, which is called Gauss forward interpolation formula. In the central difference notation y(x) = y0 + p δy1/2 + p(p-1)/2! δ2 y0+ (p+1)p(p-1)/3! δ3 y1/2+ (p+1)p(p-1)(p-2)/4! δ4 y0+ … It employs odd differences just below the central line and even differences on the central line. This formula is used to interpolate the values of y for p (0<p<1) measured forwardly from the origin. Value of x Value of y x0-2h y-2 1st diff. 2nd diff. 3rd diff. 4th diff. ∆y-2(=δy-3/2) x0-h ∆2y-2(=δ2y-1) y-1 ∆y-1(=δy-1/2) Drgsk@KLUniversity ∆3y-2(=δ3y-1/2) Page 10 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 x0 ∆2y-1(=δ2y0) y0 ∆y0(=δy1/2) x0+h ∆4y-2(=δ4y0) ∆3y-1(=δ3y1/2) ∆2y0(=δ2y1) y1 ∆y1(=δy3/2) x0+2h y2 Example#1. Use Gauss’s forward formula to evaluate y30, given that y21=18.4708, y25=17.8144, y29=17.1070, y33=16.3432, and y37=15.5154. Sol. Taking x0 = 29. The interval of difference h=4. We require to find value of y for x=30. Therefore, p=(x-x0)/h =(30-29)/4 = 0.25. The difference table is given below x y 21 18.4708 ∆y ∆ 2y ∆ 3y ∆ 4y -0.6564 25 17.8144 -0.0510 -0.7074 x0=29 17.1070 -0.0054 -0.0564 -0.7638 33 16.3432 -0.0022 -0.0076 -0.0640 -0.8278 37 15.5154 Gauss forward interpolation formula is y(x) = y0 + p ∆y0 + p(p-1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-1+ (p+1)p(p-1)(p-2)/4! ∆4 y-2+ … y(30) = 17.1070+(0.25)(-0.7638) + (0.25)(-0.75)/2 (-0.0564) + (1.25)(0.25)(-0.75)/6 (-0.0076) + (1.25)(0.25)(-0.75)(-1.75)/24 (-0.0022) y30 = 16.9216. Gauss’s backward interpolation formula: Drgsk@KLUniversity Page 11 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 The Newton’s forward interpolation formula is y(x) = y0 + p ∆y0 + p(p-1)/2! ∆2 y0 + p(p-1)(p-2)/3! ∆3 y0 +… We have ∆y0 - ∆y-1 = ∆2 y-1, ∆y0 = ∆y-1 + ∆2 y-1. Similarly ∆2 y0 = ∆2 y-1 + ∆3 y-1, ∆3 y0 = ∆3 y-1 + ∆4 y-1. Also ∆3y-1 - ∆3y-2 = ∆4 y-2, ∆3 y-1 = ∆3 y-2 + ∆4 y-2. Similarly ∆4 y-1 = ∆4 y-2 + ∆5 y-2, ∆5 y-1 = ∆5 y-2 + ∆6 y-2 . Substituting the above in The Newton’s forward interpolation formula, we get y(x) = y0 + p ∆y-1 + p(p+1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-2+ (p+2)(p+1)p(p-1)/4! ∆4 y-2+ … which is called Gauss backward interpolation formula. In the central difference notation y(x) = y0 + p δy-1/2 + (p+1)p/2! δ2 y0+ (p+1)p(p-1)/3! δ3 y-1/2+ (p+2)(p+1)p(p-1)/4! δ4 y0+ … It employs odd differences just above the central line and even differences on the central line. This formula is used to interpolate the values of y for p (-1<p<0). Value of x Value of y x0-2h y-2 1st diff. 2nd diff. 3rd diff. 4th diff. ∆y-2(=δy-3/2) x0-h ∆2y-2(=δ2y-1) y-1 ∆y-1(=δy-1/2) x0 ∆2y-1(=δ2y0) y0 ∆y0(=δy1/2) Drgsk@KLUniversity ∆3y-2(=δ3y-1/2) ∆4y-2(=δ4y0) ∆3y-1(=δ3y1/2) Page 12 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 x0+h ∆2y0(=δ2y1) y1 ∆y1(=δy3/2) x0+2h y2 Example#2. Interpolate by means of Gauss’s backward formula, the population of a town for the year 1974, given that Year 1939 1949 1959 1969 1979 1989 Population 12 15 20 27 39 52 (in thousands) Sol. Let x be the year and y be the population. Taking x0 = 1969, h=10. We require to find value of y for x=1974. Therefore, p=(x-x0)/h =(1974-1969)/10 = 0.5. The difference table is x y 1939 12 ∆y ∆2y ∆3y ∆4y ∆5y 3 1949 15 2 5 1959 20 0 2 7 x0=1969 27 3 5 12 1979 3 39 -10 -7 -4 1 13 1989 52 Gauss’s backward formula is y(x)= y0 + p ∆y-1 + p(p+1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-2+ (p+2)(p+1)p(p-1)/4! ∆4 y-2+ … y(1974) = 27+(0.5)(7)+(1.5)(0.5)/2 (5)+ (1.5)(0.5)(-0.5)/6 (3) + (2.5)(1.5)(0.5)(-0.5)/24 (-7) + (2.5)(1.5)(0.5)(-0.5)(-1.5)/120 (-10) Drgsk@KLUniversity Page 13 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 = 32.345 thousands. Stirling’s interpolation formula: The Gauss’s forward formula is yp = y0 + p ∆y0 + p(p-1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-1+ (p+1)p(p-1)(p-2)/4! ∆4 y-2+ … (1) Gauss’s backward formula is yp = y0 + p ∆y-1 + p(p+1)/2! ∆2 y-1+ (p+1)p(p-1)/3! ∆3 y-2+ (p+2)(p+1)p(p-1)/4! ∆4 y-2+ … (2) Taking the mean of (1) and (2), we obtain yp = y0 + p (∆y0 + ∆y-1)/2+ p2/2! ∆2 y-1+ p(p2-1)/3! (∆3 y-1+ ∆3y-2)/2 + p2(p2-1)/4! ∆4 y-2 + p(p2-1)(p2-22)/5! (∆5 y-2+ ∆5 y-3)/2+… which is called Stirling’s formula. This formula involves means of the odd differences just above and below the central line and even differences on this line. Value of x Value of y x0-2h y-2 1st diff. 2nd diff. 3rd diff. 4th diff. ∆y-2(=δy-3/2) x0-h ∆2y-2(=δ2y-1) y-1 ∆y-1(=δy-1/2) x0 ∆3y-2(=δ3y-1/2) ∆2y-1(=δ2y0) y0 ∆y0(=δy1/2) x0+h ∆4y-2(=δ4y0) ∆3y-1(=δ3y1/2) ∆2y0(=δ2y1) y1 ∆y1(=δy3/2) x0+2h y2 Example#1. Employ Stirling’s formula to compute y12.2 from the following table (yx=1+log10sinx): xo Drgsk@KLUniversity 10 11 12 13 14 Page 14 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 105 yx 23,967 28,060 31,788 35,209 38,368 Sol. Taking x0=12, h=1, since x=12.2, we have p=(x-x0)/h = (12.2-12)/1 = 0.2. The difference table is x yx 10 0.23967 ∆y ∆2y ∆3y ∆4y 0.04093 11 0.28060 -0.00365 0.03728 x0=12 0.31788 0.00058 -0.00307 0.03421 13 0.35209 -0.00013 0.00045 -0.00262 0.03159 14 0.38368 By Stirling’s formula y12.2 = y0 + p (∆y0 + ∆y-1)/2+ p2/2! ∆2 y-1+ p(p2-1)/3! (∆3 y-1+ ∆3y-2)/2 + p2(p2-1)/4! ∆4 y-2 = 0.31788+0.2(0.03728+0.03421)/2 + (0.2)2/2 (-0.00307)+0.2[(0.2)2-1]/6 (0.00058 - 0.00045)/2 + (0.2)2[(0.2)2-1]/24 (-0.00013) = 0.31788 + 0.00715 - 0.00006 - 0.000002 + 0.0000002 =0.32495. Bessel’s Interpolation Formula: Gauss forward interpolation formula is yp = y0 + p∆y0 + p(p-1)/2! ∆2y-1 + (p+1)p(p-1)/3! ∆3y-1 + (p+1)p(p-1)(p-2)/4! ∆4y-2 + … (1) We have ∆2y0 - ∆2y-1 = ∆3y-1 ∆2y-1 = ∆2y0 - ∆3y-1. Similarly ∆4y-2 = ∆4y-1 - ∆5y-2. Now we write (1) as yp = y0 + p∆y0 + p(p-1)/2! [(1/2)∆2y-1+(1/2) ∆2y-1] + (p+1)p(p-1)/3! ∆3y-1 + (p+1)p(p-1)(p-2)/4! [(1/2)∆4y-2+(1/2) ∆4y-2] + … Drgsk@KLUniversity Page 15 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 = y0 + p∆y0 + p(p-1)/2! [(1/2)∆2y-1+(1/2) (∆2y0-∆3y-1)] +(p+1)p(p-1)/3! ∆3y-1 + (p+1)p(p-1)(p-2)/4! [(1/2)∆4y-2+(1/2) (∆4y-1-∆5y-2)] +… After simplification, we get yp = y0 + p∆y0 + p(p-1)/2! [∆2y-1+∆2y0]/2 + (p-1/2)p(p-1)/3! ∆3y-1 +(p+1)p(p-1)(p-2)/4! [∆4y-2+∆4y-1]/2+ …, which is known as Bessel’s formula. This is very useful formula for practical purposes. It involves odd differences below central line and means of even differences of and below this line. It is best suitable for value of p between ¼ and ¾ . Value of x Value of y x0-2h y-2 1st diff. 2nd diff. 3rd diff. 4th diff. ∆y-2(=δy-3/2) x0-h ∆2y-2(=δ2y-1) y-1 ∆y-1(=δy-1/2) x0 ∆3y-2(=δ3y-1/2) ∆2y-1(=δ2y0) y0 ∆y0(=δy1/2) x0+h ∆4y-2(=δ4y0) ∆3y-1(=δ3y1/2) ∆2y0(=δ2y1) y1 ∆y1(=δy3/2) x0+2h y2 Example#1. Apply Bessel’s formula to obtain y25, given that y20=2854, y24=3162, y28=3544 and y32=3992. Sol. Taking x0=24, h=4. Since x=25, we have p= (x-x0)/h = (25-24)/4 = ¼ = 0.25. The difference table is x y 20 2854 ∆ ∆2 ∆3 308 x0=24 3162 74 382 Drgsk@KLUniversity -8 Page 16 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 28 3544 66 448 32 3992 Bessel’s formula is yp = y0 + p∆y0 + p(p-1)/2! [∆2y-1+∆2y0]/2 + (p-1/2)p(p-1)/3! ∆3y-1 + (p+1)p(p-1)(p-2)/4! [∆4y-2+∆4y-1]/2+ … y25 = 3162 + (0.25)382 + (0.25)(0.25-1)/2 [74+66]/2 + (0.25-1/2)0.25(0.25-1)/6 (-8) = 3162 + 95.5 – 6 – 5625 – 0.0625 = 3250.875. Interpolation with unequal intervals: The disadvantage for the previous interpolation formulas is that, they are used only for equal intervals. The following are the interpolation with unequal intervals; 1) Lagrange’s formula for unequal intervals, 2) Newton’s divided difference formula. Lagrange’s interpolation formula: If y = f(x) takes the values y0, y1, y2, …, yn corresponding to x0, x1, x2, …, xn, then (x x 0 )(x x 2 ) (x x n ) (x x 1 )(x x 2 ) (x x n ) f(x) y0 y1 (x 0 x 1 )(x 0 x 2 ) (x 0 x n ) (x 1 x 0 )(x 1 x 2 ) (x 1 x n ) (x x 0 )(x x 1 ) (x x n 1 ) yn , (x n x 0 )(x n x 1 ) (x n x n 1 ) which is known as Lagrange’s formula. Divided Differences: If (x0, y0), (x1, y1), …, (xn, yn) are given points, then the first divided differences for the argument x0, x1 is defined by y y0 . [x 0 , x 1 ] 1 x1 x 0 Similarly y y2 y y1 y y n 1 [x 1 , x 2 ] 2 , [x 2 , x 3 ] 3 ,, [x n 1 , x n ] n . x 2 x1 x3 x2 x n x n 1 The second divided differences for x0, x1, x2 is [x , x ] [x 0 , x 1 ] . [x 0 , x 1 , x 2 ] 1 2 x2 x0 The third divided differences for x0, x1, x2 , x3 is [x , x , x ] [x 0 , x 1 , x 2 ] . [x 0 , x 1 , x 2 , x 3 ] 1 2 3 x3 x0 Drgsk@KLUniversity Page 17 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 And so on, the nth divided differences for x0, x1, x2, …, xn is [x , x ,, x n ] [x 0 , x 1 ,, x n -1 ] [x 0 , x 1 , x 2 ,, x n ] 1 2 . xn x0 All the divided differences systematically set out in a table called divided difference table. Value of x Value of y x0 y0 1st divided difference 2nd divided difference 3rd divided difference 4th divided difference 5th divided difference [x0,x1] x1 y1 [x0,x1,x2] [x1,x2] x2 y2 [x0,x1,x2,x3] [x1,x2,x3] [x2,x3] x3 y3 [x1,x2,x3,x4] [x2,x3,x4] [x3,x4] x4 [x0,x1,x2,x3,x4] y4 [x0,x1,x2,x3,x4,x5] [x1,x2,x3,x4,x5] [x2,x3,x4,x5] [x3,x4,x5] [x4,x5] x5 y5 Newton’s divided difference formula: If y = f(x) takes the values y0, y1, y2, …, yn corresponding to x0, x1, x2, …, xn, then f(x) = y0+(x-x0)[x0, x1] + (x-x0)(x-x1)[x0, x1, x2] + …+ (x-x0)(x-x1)…(x-xn-1)[x0, x1, x2, …, xn], which is known as Newton’s general interpolation formula with divided differences. Example#1. Given the values x: 5 f(x): 150 7 11 13 17 392 1452 2366 5202 Evaluate f(9), using (i) Lagranges formula (ii) Newton’s divided difference formula. Sol. Let y = f(x), then from the given data, we have x0 = 5, x1 = 7, x2 = 11, x3 = 13, x4 = 17 and y0 = 150, y1 = 392, y2 = 1452, y3 = 2366, y4 = 5202. (i) By Lagrnge’s interpolation formula Drgsk@KLUniversity Page 18 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 f(x) (x x 1 )(x x 2 )( x x3 )(x x 4 ) (x x 0 )(x x 2 )( x x3 )(x x 4 ) y0 y1 (x 0 x 1 )(x 0 x 2 )( x0 x3 )(x 0 x n ) (x 1 x 0 )(x 1 x 2 )( x1 x3 )(x 1 x n ) (x x 0 )(x x 1 )( x x3 )(x x 4 ) (x x 0 )(x x 1 )( x x 2 )(x x 4 ) y2 y3 (x 2 x 0 )(x 2 x 1 )( x 2 x3 )(x 2 x 4 ) (x 3 x 0 )(x 3 x 1 )( x3 x 2 )(x 3 x 4 ) (x x 0 )(x x 1 )( x x 2 )(x x 3 ) y4. (x 4 x 0 )(x 4 x 1 )( x 4 x 2 )(x 4 x 3 ) (9 7)(9 11)(9 13)(9 17) (9 5)(9 11)(9 13)(9 17) f(9) 150 392 (5 7)(5 11)(5 13)(5 17) (7 5)(7 11)(7 13)(7 17) (9 5)(9 7)(9 13)(9 17) (9 5)(9 7)(9 11)(9 17) 1452 2366 (11 8)(11 7)(11 13)(11 17) (13 5)(13 7)(13 11)(13 17) (9 5)(9 7)(9 11)(9 13) 50 3136 3872 2366 578 5202 810. (17 5)(17 7)(17 11)(17 13) 3 15 3 3 5 (ii) The divided difference table is Value of x Value of y 5 150 1st divided difference 2nd divided difference 3rd divided difference 4th divided difference 121 7 392 24 265 11 1452 1 32 457 13 2366 0 1 42 709 17 5202 By Newton divided difference formula f(x) = y0+(x-x0)[x0, x1] + (x-x0)(x-x1)[x0, x1, x2] +(x-x0)(x-x1)(x-x2)[x0, x1, x2,x3] + (x-x0)(x-x1)(x-x2)(x-x3)[x0, x1, x2,x3,x4]. f(9) = 150 + (9 – 5)×121 + (9 – 5) (9 – 7)×24 + (9 – 5)(9 – 7)(9 – 11)×1 + (9 – 5)(9 – 7)(9 – 11)(9 – 13)×0 = 150 + 484 + 192 – 16 + 0 = 810. Drgsk@KLUniversity Page 19 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Numerical Differentiation: Mathematically, the derivative represents the rate of change of a dependent variable with respect to an independent variable. For example, if we are given a function y(t) that specifies an object’s position as a function of time, differentiation provides a means to determine its velocity, as in: As in following Figure, the derivative can be visualized as the slope of a function. Numerical differentiation is used when the function y = f(x) is given in tabular form or it is highly complex. The basic idea in numerical differentiation is to replace the given function y = f(x) on the interval by an interpolating polynomial P(x) and set f '(x) = P'(x), f '' (x) = P'' (x) etc. Numerical differentiation is less exact than interpolation. Numerical differentiation using Newton’s forward formula: Suppose y = f(x) is specified in an interval [a, b] at equally spaced points xi = x0 + ih (i = 0, 1, …, n) (x0=a, xn=b) by means of values yi = f(xi). By Newton forward interpolation formula p(p 1) 2 p(p 1)(p 2) 3 p(p 1)(p 2)(p 3) 4 y f(x) y 0 py 0 Δ y0 Δ y0 Δ y 0 ... , 2! 3! 4! x x0 dp 1 . where p and h = xi+1 – xi, for i = 1, 2, …, n. Here p is a function of x and dx h h Rewriting the above equation, we have p2 p 2 p 3 3p 2 2p 3 p 4 6p 3 11p 2 3p 4 y(x) y 0 py 0 Δ y0 Δ y0 Δ y 0 ... 2 6 24 Differentiating the above equation with respect to x, we have dy dy dp 1 dy 1 2p 1 2 3p 2 6p 2 3 4p 3 18p 2 22p 6 4 Δy 0 Δ y0 Δ y0 Δ y 0 .... dx dp dx h dp h 2 6 24 Again differentiating with respect to x, we get Drgsk@KLUniversity Page 20 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 d 2 y d dy d dy dp 1 d dy 1 2 6p 2 18p 11 4 3 Δ y ( p 1 ) Δ y Δ y 0 .... 0 0 2 2 dx dx dp dx dx h dp dx h 12 dx Special case: If the derivative is required to find at a basic tabulated point x = xi, then choose x0= xi and the formulas become 1 1 1 1 1 dy Δy 0 Δ 2 y 0 Δ 3 y 0 Δ 4 y 0 Δ 5 y 0 2 3 4 5 dx x x 0 h And d2y 1 2 11 5 Δ y 0 Δ 3 y 0 Δ 4 y 0 Δ 5 y 0 . 2 dx 2 12 6 h x x 0 Numerical differentiation using Newton’s backward formula: In this case we replace y(x) by Newton’s backward interpolation formula p(p 1) 2 p(p 1)(p 2) 3 p(p 1)(p 2)(p 3) 4 y(x) y n py n yn yn y n ... 2! 3! 4! x xn dp 1 . and h = xi+1 – xi, for i = 1, 2, …, n. Here p is a function of x and dx h h Rewriting the above equation, we have where p p2 p 2 p 3 3p 2 2p 3 p 4 6p 3 11p 2 3p 4 y(x) y n py 0 yn yn y n ... 2 6 24 Differentiating the above equation with respect to x, we have dy dy dp 1 dy 1 2p 1 2 3p 2 6p 2 3 4p 3 18p 2 22p 6 4 y n yn yn y n .... dx dp dx h dp h 2 6 24 Again differentiating with respect to x, we get d 2 y d dy d dy dp 1 d dy 1 2 6p 2 18p 11 4 y n ( p 1) 3 y n y n .... 12 dx 2 dx dx dp dx dx h dp dx h 2 Special case: If the derivative is required to find at a basic tabulated point x = xi, then choose xn= xi and the formulas become 1 1 1 1 1 dy y 0 2 y n 3 y n 4 y n 5 y n 2 3 4 5 dx x x n h and d2y 1 2 11 5 y n 3 y n 4 y n 5 y n . 2 dx 2 12 6 x x n h Example#1. Compute f'(x) and f''(x) at (i) x = 16 (ii) x = 15 (iii) x = 24 (iv) x = 25 from the following table x 15 17 19 21 23 25 f(x) 3.873 4.123 4.359 4.583 4.796 5.8 Drgsk@KLUniversity Page 21 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Sol. Let y = f(x), then from the given table x0 = 15, x1 = 17, x2 = 19, x3 = 21, x4 = 23, x5 = 25 and y0 = 3.873, y1 = 4.123, y2 = 4.359, y3 = 4.583, y4 = 4.796, y5 = 5.8. The finite difference table is x y ∆y ∆2y ∆3y ∆4y ∆5y 15 3.873 0.25 17 4.123 -0.014 0.236 0.002 19 4.359 -0.012 -0.001 0.224 0.001 0.002 21 4.583 -0.011 0.001 0.213 0.002 23 4.796 -0.009 0.204 25 5 (i) Since x = 16 is nearer to the beginning of the table we use Newton forward formula. Here the x x0 16 15 1 step size h = 2. Taking x0 = 15, then p 0.5. h 2 2 Newton forward formula to compute first derivative of y=f(x) is dy 1 2p 1 2 3p 2 6p 2 3 4p 3 18p 2 22p 6 4 Δy 0 Δ y0 Δ y0 Δ y 0 .... dx h 2 6 24 2 3 4 5 Substituting x = 16, p = 0.5, ∆y0 = 0.25, ∆ y0= – 0.014, ∆ y0 = 0.002, ∆ y0= – 0.001, ∆ y0=0.002, we have 1 2(0.5) 1 3(0.5) 2 6(0.5) 2 dy 0.25 (-0.014) (0.002) 2 6 dx x 16 2 4(0.5) 3 18(0.5) 2 22(0.5) 6 (-0.001). 24 fʹ(16) = 0.1249375. Newton forward formula to compute second derivative of y=f(x) is d2y 1 2 6p 2 18p 11 4 Δ y 0 ( p 1)Δ 3 y 0 Δ y 0 .... 12 dx 2 h 2 Substituting the values from the table, we have d2y 1 6(0.5) 2 18(0.5) 11 - 0.014 (0.5 1)(0.002) (-0.001). 2 dx 2 12 x16 2 fʹʹ(16) = -0.0038229. (ii) Since x = 15 is in the beginning of the table, we use Newton forward formula. Here the step size h = 2, x = x0 = 15 and p = 0. Newton forward formula to compute first derivative of y=f(x) at x = x0 is Drgsk@KLUniversity Page 22 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 1 1 1 1 1 dy Δy 0 Δ 2 y 0 Δ 3 y 0 Δ 4 y 0 Δ 5 y 0 2 3 4 5 dx x x 0 h Substituting the values from the table, we have 1 1 1 1 1 dy 0.25 (-0.014) (0.002) (-0.001) (0.002) 2 3 4 5 dx x 15 2 f'(15) = 0.128958. Newton forward formula to compute second derivative of y=f(x) at x = x0 is d2y 1 2 11 5 Δ y 0 Δ 3 y 0 Δ 4 y 0 Δ 5 y 0 . 2 dx 2 12 6 h x x 0 Substituting the values from the table, we have d2y 1 11 5 - 0.014 0.002 (-0.001) (0.002) . 2 dx 2 12 6 x 15 2 f''(15) = -0.004229. (iii) Since x = 24 is nearer to the ending of the table, we use Newton backward formula. Here the x xn 24 25 1 step size h = 2. Taking xn = 25, then p 0.5. h 2 2 Newton backward formula to compute first derivative of y=f(x) is dy 1 2p 1 2 3p 2 6p 2 3 4p 3 18p 2 22p 6 4 y n yn yn y n .... dx h 2 6 24 Substituting x = 25, p = – 0.5, yn = 0.204, 2yn= – 0.009, 3yn = 0.002, 4yn= 0.001, 5yn=0.002, we have 2(-0.5) 1 3(-0.5) 2 6(-0.5) 2 1 dy 0.204 (0.009) (0.002) 2 6 dx x 25 2 4(-0.5)3 18(-0.5) 2 22(-0.5) 6 (0.001). 24 f'(24) = 0.09727. Newton backward formula to compute second derivative of y=f(x) is d2y 1 2 6p 2 18p 11 4 3 y n ( p 1) y n y n .... 12 dx 2 h 2 Substituting the values from the table, we have d2y 1 6(-0.5)2 18(-0.5) 11 0 . 009 ( 0 . 5 1 )( 0 . 002 ) (0.001). 2 dx 2 12 x24 2 f''(24) = -0.00242708. (iv) Since x = 25 is in the ending of the table, we use Newton forward formula. Here the step size h = 2, x = x0 = 15 and p = 0. Newton backward formula to compute first derivative of y=f(x) at x = xn is Drgsk@KLUniversity Page 23 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 1 1 1 1 1 dy y 0 2 y n 3 y n 4 y n 5 y n . 2 3 4 5 dx x x n h Substituting the values from the table, we have 1 1 1 1 1 dy 0.204 (0.009) (0.002) (0.001) (0.002). 2 3 4 5 dx x 25 2 f '(25) = 0.10048 Newton backward formula to compute second derivative of y=f(x) at x = xn is d2y 1 2 11 5 y n 3 y n 4 y n 5 y n . 2 dx 2 12 6 x x n h Substituting the values from the table, we have d2y 1 11 5 0 . 009 0 . 002 ( 0 . 001 ) (0.002) . 2 dx 2 12 6 x 25 2 f ''(25) = -0.001833. Numerical Integration Integration is the inverse of differentiation. Just as differentiation uses differences to quantify an instantaneous process, integration involves summing instantaneous information to give a total result over an interval. Thus, if we are provided with velocity as a function of time, integration can be used to determine the distance traveled: According to the dictionary definition, to integrate means “to bring together, as parts, into a whole; to unite; to indicate the total amount” Mathematically, definite integration is represented by (1) which stands for the integral of the function f (x) with respect to the independent variable x, evaluated between the limits x = a to x = b. As suggested by the dictionary definition, the “meaning” of Eq. (1) is the total value, or summation, of f (x)dx over the range x = a to b. In fact, the symbol ∫ is actually a stylized capital S that is intended to signify the close connection between integration and summation. Geometrically, integration is just finding the area under a curve from one point to another. It is b represented by f ( x)dx , where the numbers a and b are the lower and upper limits of a integration, respectively, the function f is the integrand of the integral, and x is the variable of integration. Figure 1 represents a graphical demonstration of the concept. Drgsk@KLUniversity Page 24 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Why are we interested in integration: because most equations in physics are differential equations that must be integrated to find the solution(s). Furthermore, some physical quantities can be obtained by integration (example: displacement from velocity). The problem is that sometimes integrating analytically some functions can easily become laborious. For this reason, a wide variety of numerical methods have been developed to find the integral. The process of evaluating a definite integral from a set of tabulated values of the integrand f(x) is called numerical integration. This process when applied to a function of single variable, is known as quadrature. b Let I y(x)dx , where y(x) takes the values y0, y1, y2, …, yn for x = x0, x1, x2, …, xn. Let a us divide the interval (a, b) into n sub-intervals of width h so that x0 = a, x1 = x0 + h, x2 = x0 + 2h, …, xn = x0 + nh = b. xn Trapezoidal rule : y(x)dx x0 h (y 0 y n ) 2(y1 y 2 ... y n -1 ). 2 Simpson’s 1/3rd rule : xn y(x)dx x0 h (y 0 y n ) 4(y1 y 3 ... y n -1 ) 2(y 2 y 4 ... y n - 2 ) 3 Simpson’s 3/8th rule : Drgsk@KLUniversity Page 25 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 xn y(x)dx x0 3h (y 0 y n ) 3(y1 y 2 y 4 y 5 ... y n -1 y n - 2 ) 2(y 3 y 6 ... y n -3 ) 8 6 Problem#1. Compute the integral dx 01 x 2 , using (i) Trapezoidal rule (ii) Simpson’s 1/3rd rule (iii) Simpson’s 3/8 rule and also determine the relative true error. 1 Sol. Let y(x) and divide the interval (0, 6) into n = 6 subintervals each of length h = 1. 1 x2 Then, we have the following tabular values. x 0 1 2 3 4 5 6 y(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027 (i) Trapezoidal rule th xn y(x)dx h (y 0 y n ) 2(y1 y 2 ... y n -1 ). 2 h (y 0 y 6 ) 2(y1 y 2 y 3 y 4 y 5 ) 2 x0 6 y(x)dx 0 1 (1 0.027) 2(0.5 0.2 0.1 0.0588 0.0385) 2 1.4108. (ii) Simpson’s 1/3rd rule xn y(x)dx x0 6 y(x)dx 0 h (y 0 y n ) 4(y1 y 3 ... y n -1 ) 2(y 2 y 4 ... y n - 2 ) 3 h (y 0 y 6 ) 4(y1 y 3 y 5 ) 2(y 2 y 4 ) 3 1 (1 0.027) 4(0.5 0.1 0.0385) 2(0.2 0.0588) 3 1.3662. (iii) Simpson’s 3/8th rule xn y(x)dx x0 6 3h (y 0 y n ) 3(y1 y 2 y 4 y 5 ... y n -1 y n - 2 ) 2(y 3 y 6 ... y n -3 ) 8 y(x)dx 3h (y 0 y 6 ) 3(y1 y 2 y 4 y 5 ) 2(y 3 ) 8 3 (0 0.027) 3(0.5 0.2 0.0588 0.0385) 2(0.1) 1.3571. 8 0 Drgsk@KLUniversity Page 26 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 The relative true error True value : 6 dx 01 x 2 True value - Approximat e value 100% . True value 6 tan 1 ( x) 0 tan 1 (6) tan 1 (0) 1.4056 0 1.4056. 1.4056 - 1.4108 100% 0.3699%. 1.4056 1.4056 - 1.3662 (ii) Simpson’s 1/3rd rule = 100% 2.803%. 1.4056 1.4056 - 1.3571 (iii) Simpson’s 3/8th rule = 100% 3.4504%. 1.4056 Relative true error for (i) Trapezoidal rule = Problems 1. Estimate the missing values in the following table x 45 50 55 60 y 3.0 ? 2.0 ? 65 -2.4 2. Express y=2x3-3x2+3x-10 in factorial notation and hence show that Δ3y=12. 3. Given Sin450= 0.7071, Sin500= 0.7660, Sin550= 0.8192, Sin 600= 0.8660, find Sin520, using Newton’s forward formula. 4. From the following table, estimate the number of students who obtained marks between 40 and45 Marks 30-40 40-50 50-60 60-70 70-80 No. of 31 42 51 35 students 5. Construct a cubic polynomial which takes the following values: x 0 1 2 f(x) 1 2 1 6. The area of a circle of diameter d is given for the following values: d 80 85 90 95 A 5026 5674 6362 7088 Calculate the area of a circle of diameter 105. 31 3 10 100 7854 7. Use Gauss forward formula to evaluate y30, given that y21 = 18.4708, y25 = 17.8144, y29 = 17.1070, y35 = 16.3432 and y37 = 15.5154. 8. Interpolate by means of Gauss’s backward formula, the population of a town for the year 1974, given that Year 1939 1949 1959 1969 1979 1989 Drgsk@KLUniversity Page 27 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 Population (in thousands) 12 15 20 27 39 52 9. Employ Sterling’s formula to compute y12.2 from the following table: x0 10 11 12 13 14 105ux 23,967 28,060 31,788 35,209 38,368 10. Apply Bessel’s formula to obtain y25, given y20 = 2854, y24 = 3162, y28 = 3544, y32 = 3992. 11. Given the values x: 5 7 11 13 17 f(x): 150 392 1452 2366 5202 Evaluate f(9) by using (a) Lagrange’s formula (b) Newton’s divided difference formula. 12. Use Lagrange’s formula to find the form of f(x) when, x: f(x): 0 2 3 6 648 704 729 792 13. Determine f(x) as a polynomial in x for the following data using Newton’s divided difference formula x: -4 -1 0 2 5 f(x): 1245 33 5 9 1335 14. Apply Lagrange’s formula inversely to obtain a root of the equation f(x) = 0 f(30)= -30, f(34) = -13,f(38) = 3 and f(42)= 18. 15. Given that x 1.0 1.1 1.2 1.3 1.4 1.5 1.6 y 7.989 8.403 8.781 9.129 9.451 9.750 10.031 find the values of dy/dx and d2y/dx2 at x = 1.1and at x 1.6. 16. Find the first and second derivatives of the function tabulated below, at the point x = 1.1 x: 1.0 1.2 1.4 1.6 1.8 2.0 f(x): 0 0.128 0.544 1.296 2.432 4.00 17. From the following table, find the values of dy/dx and d2y/dx2 at x = 2.03 x: 1.96 1.98 2.00 2.02 2.04 y: 0.7825 0.7739 0.7651 0.7563 0.7473 18. The following data gives the corresponding values of pressure and specific volume of a superheated steam. v 2 4 6 8 10 p 105 42.7 25.3 16.7 13 19. From the table below, for each value of x, y is minimum? Also find the value of y Drgsk@KLUniversity Page 28 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 x y 3 0.205 4 0.240 5 0.259 6 0.262 7 0.250 8 0.224 20. Given that , x: 4.0 4.2 4.4 4.6 4.8 5.0 5.2 logx: 1.3863 1.4351 1.4816 1.5261 1.5686 1.6094 1.6484 Evaluate by (a) Trapezoidal rule(b) Simpson’s 1/3 rule (c) Simpson’s th 3/8 rule. 21. Use Simpson’s 1/3rd rule to find dx by taking seven ordinates. 22. The velocity (km/min) of a moped which starts from rest, is given at fixed intervals of time t (min) as follows: T 2 4 6 8 10 12 14 16 18 20 V 10 18 25 29 32 20 11 5 2 0 Estimate approximately the distance covered in 20 minutes. 23. A river is 80 feet wide. The depth d in feet at a distance x feet from one bank is given by the following table: x 0 10 20 30 40 50 60 70 80 d 0 4 7 9 12 15 14 8 3 Find approximately the area of the cross-section. 24. A solid of revolution is formed by rotating about the X-axis, the area between the X-axis, the lines x=0 and x=1 and a curve through the points with the following coordinate: x 0.00 0.25 0.50 0.75 1.00 y 1.0000 0.9896 0.9589 0.9089 0.8415 Short Answer Questions 1. Evaluate Δ2 (abx), interval of differences being unity. 2. Show that Δ log f(x)= log{1+Δf(x)/f(x)} 3. Evaluate Δ10 [(1-x) (1-2x2) (1-3x3) (1-4x4)], if the interval of differencing is 2. 4. Obtain the function whose first difference is 2x3+3x2-5x+4. 5. Prove that y3 = y2 + Δy1 + Δ2y0 + Δ3y0. 6. Prove with usual notations that (E1/2 + E-1/2) (1 + Δ) ½ = 2 + Δ. 7. Prove with usual notations that Δ3y2 = 3y5. 8. Prove with usual notations that µ2 = 1 + δ2/4. 9. State Newton’s forward interpolative formula. 10. State Bessel’s formula. 11. Write the relation between Δ and E. 12. If f(x) = 3x3 – 2x2 + 1, then find Δ3f(x) 13. State Stirling’s formula. 14. Write the relation between Δ , E and 15. Prove with usual notations that (1+Δ)(1- ) = 1 Drgsk@KLUniversity Page 29 II/IV B.Tech CSE&ECM Mathematical Methods for Computing (11BS203) Chapter-2 16. State Lagrange’s Interpolation formula 17. State Newton’s divided difference formula 18. By Trapezoidal rule, write the value of dx 19. State Simpson’s 3/8 th rule. 20. If f(x) is given by x= 0 0.5 1 1.5 f(x) = 0 0.25 1 2.25 Then the value of dx by Simpson’s 1/3 rule. Drgsk@KLUniversity 2 4. Page 30