GSB 3204: Statistics & Numerical Analysis Yasin K. Kowa Email:kowayasin@gmail.com April 30, 2019 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Introduction Definition Numerical Methods are methods for solving problems numerically (in terms of number) on computer or calculator or by hand. Numerical methods emphasize the implementation of algorithms. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Introduction Definition Numerical Methods are methods for solving problems numerically (in terms of number) on computer or calculator or by hand. Numerical methods emphasize the implementation of algorithms. Definition Numerical methods provide systematic methods of solving problems in numerical form. Normally starts from an initial data, using high precision digital computers, steps in algorithms and finally obtaining the results. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Introduction Definition The numerical methods give approximate results or solution, that is they have errors. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Introduction Definition The numerical methods give approximate results or solution, that is they have errors. Definition That is True Value=approximate+error Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Error Error refers to the difference between the true value and the estimated (approximated) value Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Error Error refers to the difference between the true value and the estimated (approximated) value Error Error=Actual value-Estimated value Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Error Approximate values or numbers are those that represent the numbers to a certain degree of accuracy. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Error Approximate values or numbers are those that represent the numbers to a certain degree of accuracy. Error But error is different from mistakes (blunders), the last one are the deviations due to human factors such as misreading a number, misreading from a scale or using faulty instrument, misprinting, misfeeding e.t.c Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error When a computational procedure is involved in solving a scientific -mathematical problem, errors often will be involved in the process Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error When a computational procedure is involved in solving a scientific -mathematical problem, errors often will be involved in the process Sources of Error (a) Error due to method itself Sometimes numerical method by virtue of what they are, introduce some error in the result. This error is called Discretization error Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error (b) Truncation Error This occurs due to the failure to do the problem in a finite steps, we are forced to terminate our calculations somewhere or carry a few terms. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error (b) Truncation Error This occurs due to the failure to do the problem in a finite steps, we are forced to terminate our calculations somewhere or carry a few terms. Sources of Error For instance Taylor’s series, f 0 (a) f 00 (a) f (x ) = f (a) + (x − a) + (x − a)2 + . . . 1! 2! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error (c) Round-off Error Is the error that a rises due to the fact that when we have large number of digits and it will be necessary to cut them to usable number of figures. This process is called rounding off Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error (c) Round-off Error Is the error that a rises due to the fact that when we have large number of digits and it will be necessary to cut them to usable number of figures. This process is called rounding off Sources of Error (d) Propagated Error This is an error in the succeeding steps of the process due to the occurrence of earlier error. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Sources of Error (e) Modeling Error Mathematical modeling is a process when mathematical equations are used to represent a physical systems. This modeling introduces errors and are called modeling error Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Accuracy Accuracy refers to how closely a computed or measured value agrees with the true value. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Accuracy Accuracy refers to how closely a computed or measured value agrees with the true value. Precision Precision refers to how closely individual computed or measured values agree with each other. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Calculation of Errors Absolute Error =⇒ ex = |x − x ∗ | where x − represents a true value of a quantity x ∗ − represent approximate value Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Calculation of Errors Absolute Error =⇒ ex = |x − x ∗ | where x − represents a true value of a quantity x ∗ − represent approximate value Calculation of Errors When (i) x ∗ > x , the number x ∗ is said to be an approximation with excess (ii) x ∗ < x , the number x ∗ is said to be an approximation with deficit Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Calculation of Errors For instance√ 2 ,an approximation with deficit x ∗ = 1.4 ≈ √ ∗ x = 2.24 ≈ 5, an approximation with excess Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Error Calculation of Errors For instance√ 2 ,an approximation with deficit x ∗ = 1.4 ≈ √ ∗ x = 2.24 ≈ 5, an approximation with excess Calculation of Errors From True Value=Approximate+error, we can write as x = x ∗ ± ex Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Relative Error The relative error is the ratio of the absolute error to actual figure, that is |x − x ∗ | ex rx = = x x Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Relative Error The relative error is the ratio of the absolute error to actual figure, that is |x − x ∗ | ex rx = = x x Relative Error Where rx is the relative error, the relative error is expressed as percentage.That is ex rx = × 100% x Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Example-1 Suppose that you have the task of measuring the length of bridge and rivet and come up with 9999 cm and 9 cm respectively. If the true values are 10000 cm and 10 cm respectively. Compute Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Example-1 Suppose that you have the task of measuring the length of bridge and rivet and come up with 9999 cm and 9 cm respectively. If the true values are 10000 cm and 10 cm respectively. Compute Example-1 (a) the true error (b) relative error in % Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Solution-1 (a) Case I Given x = 10000cm x ∗ = 9999cm ex = |10000 − 9999|cm=1cm Case II x=10cm x ∗ = 9cm Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Solution-1 (a) Case I Given x = 10000cm x ∗ = 9999cm ex = |10000 − 9999|cm=1cm Case II x=10cm x ∗ = 9cm Solution-1 ex = |10 − 9| cm = |9 − 10| cm = 1cm Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Solution-1 (b) Case I ex 1 cm rx = × 100% = × 100% = 0.01% x 10000 cm Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Solution-1 (b) Case I ex 1 cm rx = × 100% = × 100% = 0.01% x 10000 cm Solution-1 Case II ex 1cm rx = × 100% = = 10% x 10cm Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Exercise-1 Which of the following is more accurate estimate? Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Exercise-1 Which of the following is more accurate estimate? Exercise-1 √ 0.84 × 45 (a) 10 as an estimate for or 0.6 (b) 150cm2 as the area of circle of diameter 14cm Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Exercise-2 1 Three approximate values of the number are given as 0.30, 0.33 3 and 0.34. Which of these values is the best approximate? Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Theorem In addition and subtraction on error bound for the results, is given as the sum of error bounds for the terms. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Theorem In addition and subtraction on error bound for the results, is given as the sum of error bounds for the terms. Proof For addition ex +y = |(x + y ) − (x ∗ + y ∗ )| = |x − x ∗ + y − y ∗ | By triangular rule ex +y ≤ |x − x ∗ | + |y − y ∗ | =⇒ ex +y ≤ ex + ey For subtraction ex −y = |(x −y )−(x ∗ −y ∗ )| = |(x −x ∗ )−(y −y ∗ )| ≤ |x −x ∗ |+|y −y ∗ | ex −y = ex + ey Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Theorem In multiplication and division, a bound for the relative error of the results is given by the sum of the bounds for the relative errors of the given terms or numbers. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Theorem In multiplication and division, a bound for the relative error of the results is given by the sum of the bounds for the relative errors of the given terms or numbers. Proof For multiplication we what to prove that rx .y = rx + ry exy |xy − x ∗ y ∗ | |xy − (x − ex )(y − ey )| rx .y = = = xy xy xy |xy − xy + xey + yex + ex ey | |xey + yex + ex ey | rxy = = xy xy Neglecting the small product we have Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Proof rxy = ey ex xey + yex = + xy y x Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Proof rxy = ey ex xey + yex = + xy y x Proof rxy ≈ rx + ry Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Proof For division, we want to prove r yx ≈ rx + ry Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Calculation of Errors Proof For division, we want to prove r yx ≈ rx + ry Proof r yx = x y − x y x∗ y∗ = x y − x −ex y −ey x y = x (y − ey ) − y (x − ex ) y y (y − e y ) x r yx = xy − xey − yx + yex y −xey + yex y = y (y − ey ) x y (y − ey ) x ry = ye x − xe y (y − ey )−1 y x Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction Consider a function y = f (x ) defined on (a, b), x and y are the independent and dependent variables respectively. If the points x0 , x1 , . . . , xn are taken at equidistance. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction Consider a function y = f (x ) defined on (a, b), x and y are the independent and dependent variables respectively. If the points x0 , x1 , . . . , xn are taken at equidistance. Introduction That is xi = x0 + ih, i = 0, 1, 2, . . . , n then the value of y when x = xi is denoted as yi , where yi = f (xi ) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction Then y1 − y0 , y2 − y1 , y3 − y2 , . . . yn − yn−1 are called the differences of y . Denoting these differences by 4y0 , 4y1 , . . . , 4yn−1 respectively, we have Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction Then y1 − y0 , y2 − y1 , y3 − y2 , . . . yn − yn−1 are called the differences of y . Denoting these differences by 4y0 , 4y1 , . . . , 4yn−1 respectively, we have Introduction 4y0 = y1 −y0 , 4y1 = y2 −y1 , 4y2 = y3 −y2 · · ·4yn−1 = yn −yn−1 Where 4 is the forward difference operator and 4y0 = y1 −y0 , 4y1 = y2 −y1 , 4y2 = y3 −y2 · · ·4yn−1 = yn −yn−1 are called first forward differences Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction The differences of the first forward differences are called second forward differences and are denoted by 42 y0 , 42 y1 , . . . , 42 yn−1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Introduction The differences of the first forward differences are called second forward differences and are denoted by 42 y0 , 42 y1 , . . . , 42 yn−1 Introduction Similarly we can define the third, fourth, . . . We will consider three types of finite differences namely Forward Finite differences Backward Finite differences Central Finite differences Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences The forward finite differences or simply differences operator is denoted by 4 and is defined as 4f (x ) = f (x + h) − f (x ), we can write in terms of y as Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences The forward finite differences or simply differences operator is denoted by 4 and is defined as 4f (x ) = f (x + h) − f (x ), we can write in terms of y as Forward Finite Differences 4yi = yi+1 − yi , i = 0, 1, 2, . . . , n − 1. The differences of the first differences are called the second differences and they are denoted by 42 y0 , 42 y1 , . . . , 42 yn−1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Hence 42 y0 = 4y1 − 4y0 = (y2 − y1 ) − (y1 − y0 ) = y2 − 2y1 + y0 42 y1 = 4y2 − 4y1 = (y3 − y2 ) − (y2 − y1 ) = y3 − 2y2 + y1 .. . Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Hence 42 y0 = 4y1 − 4y0 = (y2 − y1 ) − (y1 − y0 ) = y2 − 2y1 + y0 42 y1 = 4y2 − 4y1 = (y3 − y2 ) − (y2 − y1 ) = y3 − 2y2 + y1 .. . Forward Finite Differences But also 43 y0 = 42 y1 − 42 y0 = (y3 − 2y2 + y1 ) − (y2 − 2y1 + y0 ) that is 43 y0 = y3 − 3y2 + 3y1 − y0 43 y1 = y4 − 3y3 + 3y2 − y1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Generally 4n+1 yi = 4n yi+1 − 4n yi , n = 0, 1, 2, . . . and i = 0, 1, 2, . . . Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Table The difference table is the standard format for displaying differences x x0 y y0 x1 y1 4y 42 y 43 y 44 y 4y0 42 y0 43 y0 4y1 x2 42 y1 y2 42 y2 x3 y3 x4 y4 44 y0 43 y1 42 y2 4y3 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Table The forward difference table is also called as a diagonal difference table, the y0 term in the table above is called the leading term. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Forward Finite Differences Table The forward difference table is also called as a diagonal difference table, the y0 term in the table above is called the leading term. Forward Finite Differences Table The differences 4y0 , 42 y0 , 43 y0 . . . are called the leading differences. In the difference table x is called argument and y as function or entry. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences The backward difference operator is denoted by 5 and is defined as 5f (x ) = f (x ) − f (x − h) or 5yi = yi − yi−1 , i = n, n − 1, . . . , 1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences The backward difference operator is denoted by 5 and is defined as 5f (x ) = f (x ) − f (x − h) or 5yi = yi − yi−1 , i = n, n − 1, . . . , 1 Backward Finite Differences 5y1 = y1 − y0 , 5y2 = y2 − y1 , 5y3 = y3 − y2 · · · 5 yn = yn − yn−1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences The second differences are denoted by 52 y2 , 52 y3 , 52 y4 , · · · 52 yn 52 y2 = 5(5y − 2) = 5(y2 − y1 ) = 5y2 − 5y1 = (y2 − y1 ) − (y1 − y0 ) = y2 − 2y1 + y0 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences The second differences are denoted by 52 y2 , 52 y3 , 52 y4 , · · · 52 yn 52 y2 = 5(5y − 2) = 5(y2 − y1 ) = 5y2 − 5y1 = (y2 − y1 ) − (y1 − y0 ) = y2 − 2y1 + y0 Backward Finite Differences 52 y3 = y3 − 2y2 + y1 52 y4 = y4 − 2y3 + y2 Generally 5k yi = 5k−1 yi − 5k−1 yi−1 , i=n, n-1, . . . ,k where 50 yi = yi , 51 yi = 5yi Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences Table x x0 y y0 5y 52 y V53 y 54 y 55 y 5y1 x1 52 y2 y1 53 y3 5y2 x2 52 y3 y2 5y3 x3 54 y4 53 y 4 52 y4 y3 5y4 x4 y4 The Backward Difference is also known as horizontal differences, and its table is as follows Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Backward Finite Differences Table 52 y 53 y x x0 y y0 5y x1 y1 5y1 x2 y2 5y2 52 y2 x3 y3 5y3 52 y3 53 y3 x4 y4 5y4 52 y4 53 y4 Yasin K. Kowa Email:kowayasin@gmail.com 54 y 54 y4 GSB 3204: Statistics & Numerical Analysis Finite Differences Central Finite Differences The central difference operator is σ and is defined as σf (x ) = f (x + h2 ) − f (x − h2 ) where h is the interval of differences. In terms of y , the first central difference is written as Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Finite Differences The central difference operator is σ and is defined as σf (x ) = f (x + h2 ) − f (x − h2 ) where h is the interval of differences. In terms of y , the first central difference is written as Central Finite Differences σyi = yi+ 1 − yi− 1 2 2 where yi+ 1 = f (x + h2 ) and yi− 1 = f (x − h2 ) 2 2 That is σy 1 = y1 − y0 2 σy 3 = y2 − y1 2 .. . σyn− 1 = yn − yn−1 2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Finite Differences The second central differences are given by σ 2 yi = σyi+ 1 − σyi− 1 2 2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Finite Differences The second central differences are given by σ 2 yi = σyi+ 1 − σyi− 1 2 2 Central Finite Differences σ 2 yi = σyi+ 1 − σy1− 1 = (yi+1 − yi ) − (yi − yi−1 ) 2 2 σ 2 yi = yi+1 − 2yi + yi−1 Generally σ n yi = σ n−1 yi+ 1 − σ n−1 yi− 1 2 Yasin K. Kowa Email:kowayasin@gmail.com 2 GSB 3204: Statistics & Numerical Analysis Finite Differences Central Finite Differences Table x x0 y y0 σy σ2y σ3y σ4y σ5y σ6y σy 1 2 x1 y1 σ 2 y1 σ3y 3 σy 3 2 x2 x3 y2 σy 5 σ3y 5 2 2 y3 σ 2 y3 σ3y σy 7 2 x4 y4 σ 2 y4 σ3y σy 9 2 x5 2 σ 2 y2 y5 σ2y 7 2 σ 4 y2 σ5y 5 2 σ 4 y3 σ5y σ 4 y4 σ 6 y3 7 2 9 2 5 σy 11 2 x6 y6 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example-3 (a) Construct the forward difference table and the horizontal tab;e for the following data x y 1 4 2 6 3 9 4 12 5 17 Example-3 (b) Construct a forward difference table for the following data x y 0 0 10 0.174 Yasin K. Kowa Email:kowayasin@gmail.com 20 0.347 30 0.518 GSB 3204: Statistics & Numerical Analysis Finite Differences Example-3 (c) Obtain the backward differences for the function f (x ) = x 3 from x = 1 to 1.05 to three decimal places take h = 0.01 Example-4 Calculate differences up to the fourth order for the function y = x 3 from x = 1 to x = 6 take h = 1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Solution -4 x 1 y 1 2 8 3 27 4 64 5 125 6 216 4y 42 y 43 y 44 y 7 12 19 6 18 37 0 6 24 61 0 6 30 91 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Solution -4 From the table above we see that third differences are constant (6) and the fourth differences as zero. Solution -4 Thus the finite difference of order n of an algebraic polynomial of degree n is constant. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 5 Find the missing values in the following table x y 45 3 50 - 55 2 60 - 65 -2.4 Example- 6 Assuming that the following values of y belongs to polynomial to degree 4, compute the next three values x y 0 1 1 -1 2 1 Yasin K. Kowa Email:kowayasin@gmail.com 3 -1 4 1 5 - 6 - 7 - GSB 3204: Statistics & Numerical Analysis Finite Differences Error Propagation in a Difference Table Let y0 , y1 , . . . , yn be the true values of a function and suppose the value y2 to be affected with an error ξ. Error Propagation in a Difference Table Thus its value is y2 + ξ. Then the successive differences of the y are as shown below: Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Error Propagation in a Difference Table x x0 y y0 x1 y1 x2 y2 + ξ x3 y3 x4 y4 42 y 4y 4y0 42 y0 + ξ 4y1 + ξ 42 y1 − 2ξ 4y2 − ξ 42 y2 + ξ 4y3 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Error Propagation in a Difference Table From the table above, error have the following characteristics (i) The effect of the error increases with the order of the differences (ii) The errors in any column are binomial coefficients with alternating signs Error Propagation in a Difference Table (iii) The algebraic sum of the errors in any difference column is zero (iv) The error influences a triangular portion of the difference table Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example -6 The following table gives the values of a polynomial of degree five. It is given that f (4) is in error. Correct the value of f (4) Example -6 x y 1 0.975 2 -0.6083 3 -3.5250 Yasin K. Kowa Email:kowayasin@gmail.com 4 -5.5250 5 -6.3583 6 4.2250 GSB 3204: Statistics & Numerical Analysis 7 36.4750 Finite Differences Example -7 The following table gives the values of a polynomial of degree five. It is given that f (3) is in error. Correct the error Example -7 x y 0 1 1 2 2 33 3 254 4 1054 5 3126 6 7777 ans. ξ = −10, f (3) = 244 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Properties of the Operator 4 (i) If c is a constant then 4c = 0 (ii) 4 is distributive 4(f (x ) ± g(x )) = 4f (x ) ± 4g(x ) (iii) If c is constant then 4(cf (x )) = c 4 f (x ) Properties of the Operator 4 (iv) If m and n are positive integers then 4m 4n f (x ) = 4m+n f (x ) (v) 4(f (x ).g(x )) = f (x ) 4 g(x ) + g(x ) 4 f (x ) f (x ) g(x ) 4 f (x ) − f (x ) 4 g(x ) (v) 4 = g(x ) g(x )g(x + h) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Other Difference Operators (a) Shift Operator E The shift operator is defined as Ef (x ) = f (x + h), in terms of y as Eyi = yi+1 E 2 f (x ) = E (Ef (x )) = E (f (x + h)) = f (x + 2h) Generally E n f (x ) = f (x + nh) or E n yi = yi+nh Other Difference Operators The inverse shift operator E −1 is defined as E −1 f (x ) = f (x − h) E −2 f (x ) = f (x − 2h) Generally E −n f (x ) = f (x − nh) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Other Difference Operators (b) Average Operator µ is defined as µf (x ) = 12 f (x + h2 ) + f (x − h2 ) µyi = 1 2 yi+ 1 + yi− 1 2 2 Other Difference Operators (c) Differential Operator, D The differential operator is usually denoted by D where d d , Df (x ) = f (x ) = f 0 (x ) D= dx dx Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Relation between Difference Operators Operator 4 5 σ µ Definition 4f (x ) = f (x + h) − f (x ) 5f (x ) = f (x ) − f (x − h) σf (x ) = f (x + h2 ) − f (x − h2 ) µf (x ) = 1 2 f (x + h 2 + f (x − h2 ) Relation (E − 1)f (x ) (1 − E −1 )f (x ) 1 1 (E 2 − E − 2 )f (x ) 1 1 1 E 2 + E − 2 f (x ) 2 Relation between Difference Operators To link different operators with differential operator D we consider the Taylor’s formula or series h2 f 00 (x ) + ... f (x + h) = f (x ) + hf 0 (x ) + 2!! h2 D 2 Ef (x ) = 1 + hD + + . . . f (x ) 2! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 8 Show that 4 log f (x ) = log 1 + Yasin K. Kowa Email:kowayasin@gmail.com 4f (x ) f (x ) GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 8 Show that 4 log f (x ) = log 1 + 4f (x ) f (x ) Example-9 Evaluate 42 E ! x3 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Exercise Prove that (1 + 4)(1 − 4) = 1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Exercise Prove that (1 + 4)(1 − 4) = 1 Exercise Prove that 45 = 4 − 5 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example-9 Estimate the missing term in the following table by using shift operator Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example-9 Estimate the missing term in the following table by using shift operator Exercise x y 0 4 1 3 Yasin K. Kowa Email:kowayasin@gmail.com 2 4 3 - 4 12 GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation A polynomial of degree n can be expressed as factorial polynomial of the same degree. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation A polynomial of degree n can be expressed as factorial polynomial of the same degree. Representing a Polynomial Using Factorial Notation Let f(x) be a polynomial of degree n which is expressed in factorial notation and let f (x ) = a0 + a1 x + a2 x 2 + · · · + an x n , where a0 , a1 , a2 , . . . an are constants and an 6= 0 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation 4f (x ) = 4(a0 + a1 x + a2 x 2 + · · · + an x n , where a0 , a1 , a2 , . . . an ) From 4f (x ) = f (x + h) − f (x ) then 4f (x ) = a1 h + 2a2 hx + · · · + nan hx n−1 42 f (x ) = 4(a1 h + 2a2 hx + · · · + nan hx n−1 ) 42 f (x ) = 2a2 h2 · · · + h2 n(n − 1)an x n−2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation 4f (x ) = 4(a0 + a1 x + a2 x 2 + · · · + an x n , where a0 , a1 , a2 , . . . an ) From 4f (x ) = f (x + h) − f (x ) then 4f (x ) = a1 h + 2a2 hx + · · · + nan hx n−1 42 f (x ) = 4(a1 h + 2a2 hx + · · · + nan hx n−1 ) 42 f (x ) = 2a2 h2 · · · + h2 n(n − 1)an x n−2 Representing a Polynomial Using Factorial Notation 4f (x ) is a polynomial of degree n − 1 where the coefficient of x n−1 is nan h, 42 f (x ) is a polynomial of degree n − 2 where the coefficient of x n−2 is n(n − 1)an h2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation 4n f (x ) is a polynomial of degree zero with coefficient of (n(n − 1)(n − 2) . . . 1)hn an , and this can be written as n!an hn ∴ 4n f (x ) = n!an hn The (n + 1)th and higher differences of polynomial of nth degree will be zero Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation 4n f (x ) is a polynomial of degree zero with coefficient of (n(n − 1)(n − 2) . . . 1)hn an , and this can be written as n!an hn ∴ 4n f (x ) = n!an hn The (n + 1)th and higher differences of polynomial of nth degree will be zero Representing a Polynomial Using Factorial Notation 4n f (x ) We can write = an h n . n! Now for h=1, and x=0 we have 4f (0) 42 f (0) 43 f (0) a0 = f (0), a1 = , a2 = , a3 = , . . . an = 1! 2! 3! n 4 f (0) n! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation Then 4f (0) 42 f (0) 2 43 f (0) 3 4n f (0) n f (x ) = f (0) + x+ x + x +···+ x 1! 2! 3! n! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Representing a Polynomial Using Factorial Notation Then 4f (0) 42 f (0) 2 43 f (0) 3 4n f (0) n f (x ) = f (0) + x+ x + x +···+ x 1! 2! 3! n! Example -10 (a) Find 43 ((1 − 3x )(1 − 2x )(1 − x )) (b) Express f (x ) = 3x 3 + x 2 + x + 1, in the factorial notation, interval of differencing being unity Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Interpolation is the approximate computation of the values of the function f (x ) from several of its given values f (x0 ), f (x1 ), f (x2 ), . . . , f (xn ), corresponding to the set of x0 , x1 , x2 , . . . , xn equally spaced values of independent variable. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Interpolation is the approximate computation of the values of the function f (x ) from several of its given values f (x0 ), f (x1 ), f (x2 ), . . . , f (xn ), corresponding to the set of x0 , x1 , x2 , . . . , xn equally spaced values of independent variable. Interpolation Let y = f (x ) which takes the values y0 , y1 , y2 , . . . , yn corresponding to set of equally spaced values of the independent variable, x0 , x1 , x2 , . . . , xn that is xi = x0 + ih such that i = 0, 1, 2, . . . , n where h is spacing. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Let φ(x ) be a polynomial of the nth degree in x . Then φ(x ) represents the continuous function y = f (x ) such that f (xi ) = φ(xi ) for i = 0, 1, 2, . . . , n and at all points f (x ) = φ(x ) + R(x ) where R(x ) is called the error term of the interpolation formula Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Let φ(x ) be a polynomial of the nth degree in x . Then φ(x ) represents the continuous function y = f (x ) such that f (xi ) = φ(xi ) for i = 0, 1, 2, . . . , n and at all points f (x ) = φ(x ) + R(x ) where R(x ) is called the error term of the interpolation formula Interpolation Let φ(x ) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 ) + a3 (x − x0 )(x − x1 )(x − x2 ) + · · · + an (x − x0 )(x − x1 )(x − x2 ) . . . (x − xn−1 ) and φ(xi ) = yi , ∀ i = 0, 1, 2, 3, . . . , n Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation The constants a0 , a1 , a2 , . . . , an can be determined by substituting x = x0 , x1 , x2 , . . . , xn successively in the equation above, and get Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation The constants a0 , a1 , a2 , . . . , an can be determined by substituting x = x0 , x1 , x2 , . . . , xn successively in the equation above, and get Interpolation a0 = y0 when x = x0 , taking x = x1 we have y1 = y0 + a1 (x1 − x0 ) y1 − y0 4y0 y1 − y0 = a1 (x1 − x0 ) =⇒ a1 = = x1 − x0 h Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation For x = x2 we have y1 − y0 (x2 − x0 ) + a2 (x2 − x0 )(x2 − x1 ) y2 = y0 + x1 − x0 y1 − y0 y2 − y0 − (x2 − x0 ) = a2 (x2 − x0 )(x2 − x1 ) x1 − x0 y1 − y0 y2 − y0 − 2h = a2 (2h)(h) h Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation For x = x2 we have y1 − y0 (x2 − x0 ) + a2 (x2 − x0 )(x2 − x1 ) y2 = y0 + x1 − x0 y1 − y0 y2 − y0 − (x2 − x0 ) = a2 (x2 − x0 )(x2 − x1 ) x1 − x0 y1 − y0 y2 − y0 − 2h = a2 (2h)(h) h Interpolation y2 − y0 − 2y1 + 2y0 = 2a2 h2 y2 − 2y1 + y0 = a2 (2h2 ) 42 y0 42 y0 = a2 (2h2 =⇒ a2 = 2!h2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation 43 y0 Continuing in this way we have, a3 = 3!h3 4n y0 Generally an = n!hn 42 y0 43 y0 4y0 (x − x0 ) + (x − x )(x − x ) + (x − φ(x ) = y0 + 0 1 h 2!h2 3!h3 n 4 y0 x0 )(x −x1 (x −x2 )+· · ·+ (x −x0 )(x −x1 )(x −x2 ) . . . (x −xn−1 ) n!hn Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation 43 y0 Continuing in this way we have, a3 = 3!h3 4n y0 Generally an = n!hn 42 y0 43 y0 4y0 (x − x0 ) + (x − x )(x − x ) + (x − φ(x ) = y0 + 0 1 h 2!h2 3!h3 n 4 y0 x0 )(x −x1 (x −x2 )+· · ·+ (x −x0 )(x −x1 )(x −x2 ) . . . (x −xn−1 ) n!hn Interpolation x − x0 , then h x − x1 = (x − x0 ) − (x1 − x0 ) = kh − h = (k − 1)h x − x2 = (x − x1 ) − (x2 − x1 ) = (k − 1)h − h = (k − 2)h e.t.c Let x = x0 + kh =⇒ k = Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Now we have k(k − 1) 2 k(k − 1)(k − 2) 3 4 y0 + 4 y0 + 2! n 3! k(k − 1)(k − 2) . . . 1 4 y0 ··· + n! φ(x ) = y0 + k 4 y0 + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Interpolation Now we have k(k − 1) 2 k(k − 1)(k − 2) 3 4 y0 + 4 y0 + 2! n 3! k(k − 1)(k − 2) . . . 1 4 y0 ··· + n! φ(x ) = y0 + k 4 y0 + Interpolation This is called Newton’s Forward Interpolation Formula Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 11 (a) Find a polynomial of degree two which takes the following value x f (x ) 1 6 2 11 3 18 4 27 √ √ (b) Given that √ 15500 = 124.4990, √ 15510 = 124.5392, √ 15520 = 124.5793, 15530 = 124.6194. Find the value of 1516 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 11 (a) Find a polynomial of degree two which takes the following value x f (x ) 1 6 2 11 3 18 4 27 √ √ (b) Given that √ 15500 = 124.4990, √ 15510 = 124.5392, √ 15520 = 124.5793, 15530 = 124.6194. Find the value of 1516 Example- 11 (c) A second degree polynomial passes through the points (1, −1), (2, −2), (3, −1), (4, 2). Find the polynomial Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 12 (a) Evaluate y = e 3x at x = 0.05. Using the following table x e 3x 0 1 0.1 1.3499 Yasin K. Kowa Email:kowayasin@gmail.com 0.2 1.8221 0.3 2.4596 0.4 3.3201 GSB 3204: Statistics & Numerical Analysis Finite Differences Example- 12 (a) Evaluate y = e 3x at x = 0.05. Using the following table x e 3x 0 1 0.1 1.3499 0.2 1.8221 0.3 2.4596 0.4 3.3201 Example- 12 (b) Find the value of sin 42◦ . Using the following table x sin x 40 0.6428 45 0.7071 Yasin K. Kowa Email:kowayasin@gmail.com 50 0.7660 55 0.8192 60 0.8660 GSB 3204: Statistics & Numerical Analysis Finite Differences Exercise Find the cubic polynomial which takes the following values y (1) = 24, y (3) = 120, y (5) = 336, y (7) = 720. Hence obtain the value of y (8), using Newton’s Forward Difference Interpolation. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula Newton’s Backward Interpolation is given as φ(x ) = 5yn 52 yn 53 yn yn + (x − xn ) + (x − x )(x − x ) + (x − xn )(x − n n−1 h 2!h2 n 3!h3 5 yn xn−1 )(x − xn−2 ) + · · · + (x − xn )(x − xn−1 . . . (x − x1 )(x − x0 ) n!hn Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula Newton’s Backward Interpolation is given as φ(x ) = 5yn 52 yn 53 yn yn + (x − xn ) + (x − x )(x − x ) + (x − xn )(x − n n−1 h 2!h2 n 3!h3 5 yn xn−1 )(x − xn−2 ) + · · · + (x − xn )(x − xn−1 . . . (x − x1 )(x − x0 ) n!hn Newton’s Backward Interpolation Formula Now setting x = xn + vh, we obtain x − xn = vh x −xn−1 = (x −xn )−(xn−1 −xn ) = (x −xn )+(xn −xn−1 ) = (v +1)h Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula x − xn−2 = (x − xn ) + (xn − xn−2 ) = (v + 2)h .. . x − x0 = v + n − 1)h Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula x − xn−2 = (x − xn ) + (xn − xn−2 ) = (v + 2)h .. . x − x0 = v + n − 1)h Newton’s Backward Interpolation Formula Then v (v + 1) 2 v (v + 1)(v + 2) 3 φ(x ) = yn + v 5 yn + 5 yn + 5 yn + 2! 3! v (v + 1)(v + 2) . . . (v + n − 1) n ··· + 5 yn n! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula Newton’s forward interpolation formula is suitable for interpolating values of y near the beginning of the table, while Newton’s Backward Interpolation Formula is suitable for interpolation values of y near the end of the table of values Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Newton’s Backward Interpolation Formula Newton’s forward interpolation formula is suitable for interpolating values of y near the beginning of the table, while Newton’s Backward Interpolation Formula is suitable for interpolation values of y near the end of the table of values Example-13 Calculate the value of f (84) for the data given in the table below x f (x ) 40 204 50 224 Yasin K. Kowa Email:kowayasin@gmail.com 60 246 70 270 80 296 90 324 GSB 3204: Statistics & Numerical Analysis Finite Differences Example-14 Values of x in degrees and sinx are given in the following table x sin x 15 0.2588 20 0.3420 25 0.4226 30 0.5 35 0.5736 40 0.6428 Determine the value of sin 38◦ Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Example-14 Values of x in degrees and sinx are given in the following table x sin x 15 0.2588 20 0.3420 25 0.4226 30 0.5 35 0.5736 40 0.6428 Determine the value of sin 38◦ Example-15 From the following table estimate the number of students who obtained marks in GSB 3204 between 75 and 80 Marks No. of Students 35-45 20 Yasin K. Kowa Email:kowayasin@gmail.com 45-55 40 55-65 60 65-75 60 75-85 20 GSB 3204: Statistics & Numerical Analysis Finite Differences Central Difference Interpolation Formulas The central difference interpolation formulas are most suitable for interpolation near the middle of a tabulated set Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Difference Interpolation Formulas The central difference interpolation formulas are most suitable for interpolation near the middle of a tabulated set Central Difference Interpolation Formulas The most important central difference formulas are Gauss’s Formulas, Bessel, Stirling, and Everett Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Difference Interpolation Formulas Let’s start with Gauss’s formulas, let the function y = f (x ) be given for 2n + 1 equispaced values of argument x0 , x0 ± h, x0 ± 2h, . . . , x0 ± nh Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Difference Interpolation Formulas Let’s start with Gauss’s formulas, let the function y = f (x ) be given for 2n + 1 equispaced values of argument x0 , x0 ± h, x0 ± 2h, . . . , x0 ± nh Central Difference Interpolation Formulas The corresponding values of y be yi for i = 0, ‘ ± 1, ±2, . . . , ±n Also let y = y0 denote the central ordinate corresponding to x = x0 . We can then form the difference table as shown below Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Central Difference Interpolation Formulas x x0 − 3h x0 − 2h y 4y y−3 4y−3 y−2 42 y 42 y−2 y−1 42 y0 x0 + 3h y2 4y2 y−3 44 y−2 42 y0 y1 45 y−3 43 y−1 46 y−3 45 y−2 44 y−1 43 y0 4y1 x0 + 2h 46 y 44 y−3 43 y−2 4y0 x0 + h 45 y 43 y−3 4y−1 x0 44 y 42 y−3 4y−2 x0 − h 43 y 42 y1 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Consider the Newton’s Forward Interpolation formula u(u − 1) 2 u(u − 1)(u − 2) 3 y = f (x ) = y0 +u4y0 + 4 y0 + 4 y0 +. . . 2! 3! x − x0 where u = and x = x0 is the origin. Now for Gauss’s h Forward Interpolation Formula, we assume the differences lies on the bottom solid lines and they are of the form Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Consider the Newton’s Forward Interpolation formula u(u − 1) 2 u(u − 1)(u − 2) 3 y = f (x ) = y0 +u4y0 + 4 y0 + 4 y0 +. . . 2! 3! x − x0 where u = and x = x0 is the origin. Now for Gauss’s h Forward Interpolation Formula, we assume the differences lies on the bottom solid lines and they are of the form Gauss’s Forward Interpolation Formulas y = y0 + G1 4 y0 + G2 42 y−1 + G3 43 y−1 + G4 44 y−2 + . . . Where G1 , G2 , G3 , G4 , . . . , Gn are coefficients to be determined. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas From the Newton’s Forward Interpolation formula we have yp = E p y0 = (1 + 4)p y0 = u(u − 1) 2 u(u − 1)(u − 2) 3 y0 + u 4 y0 + 4 y0 + 4 y0 + . . . 2! 3! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas From the Newton’s Forward Interpolation formula we have yp = E p y0 = (1 + 4)p y0 = u(u − 1) 2 u(u − 1)(u − 2) 3 y0 + u 4 y0 + 4 y0 + 4 y0 + . . . 2! 3! Gauss’s Forward Interpolation Formulas Now 42 y−1 = 42 E −1 y0 = 42 (1 + 4)−1 y0 42 (1 + 4)−1 y0 = 42 (1 − 4 + 42 − 43 + . . . )y0 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas 42 y−1 = 42 y0 − 43 y0 + 44 y0 − 45 y0 + . . . 43 y−1 = 43 y0 − 44 y0 + 45 y0 − 46 y0 + . . . Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas 42 y−1 = 42 y0 − 43 y0 + 44 y0 − 45 y0 + . . . 43 y−1 = 43 y0 − 44 y0 + 45 y0 − 46 y0 + . . . Gauss’s Forward Interpolation Formulas 44 y−2 = 44 E −2 y0 = 44 (y0 − 2 4 y0 + 3 42 y0 − 4 43 y0 + . . . ) 44 y2 = 44 y0 − 2 45 y0 + 3 46 y0 − 4 47 + . . . and so on. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Now yp = y0 + G1 4 y0 + G2 (42 y0 − 43 y0 + 44 y0 − 45 y0 + . . . ) + G3 (43 y0 − 44 y0 +45 y0 −46 y0 +. . . )+G4 (44 y0 −245 y0 +346 y0 −447 + . . . ) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Now yp = y0 + G1 4 y0 + G2 (42 y0 − 43 y0 + 44 y0 − 45 y0 + . . . ) + G3 (43 y0 − 44 y0 +45 y0 −46 y0 +. . . )+G4 (44 y0 −245 y0 +346 y0 −447 + . . . ) Gauss’s Forward Interpolation Formulas Comparing the equation above to Newton’s Forward Interpolation Formula we have u(u − 1) (u + 1)u(u − 1) G1 = u, G2 = , G3 = , 2! 3! (u + 1)u(u − 1)(u − 2) G4 = 4! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Hence, the Gauss’s Forward Interpolation Formula can be written as Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Forward Interpolation Formulas Hence, the Gauss’s Forward Interpolation Formula can be written as Gauss’s Forward Interpolation Formulas u(u − 1) 2 (u + 1)u(u − 1) 3 4 y0 + 4 y0 + 2! 3! (u + 1)u(u − 1)(u − 2) 4 4 y0 + . . . 4! yp = y0 + u 4 y0 + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas The Gauss’s backward Interpolation Formula uses the differences which lies on the upper dash line and can be assumed of the form yp = y0 + J1 4 y−1 + J2 42 y−1 + J3 43 y−2 + J4 44 y−2 + . . . Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas The Gauss’s backward Interpolation Formula uses the differences which lies on the upper dash line and can be assumed of the form yp = y0 + J1 4 y−1 + J2 42 y−1 + J3 43 y−2 + J4 44 y−2 + . . . Gauss’s Backward Interpolation Formulas Where J1 , J2 , J3 , J4 , . . . are to be determined. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas Using the same procedure as in the Gauss’s Forward Interpolation Formula we determine Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas Using the same procedure as in the Gauss’s Forward Interpolation Formula we determine Gauss’s Backward Interpolation Formulas J1 = u u(u + 1) J2 = 2! (u + 2)(u + 1)u(u − 1) J3 = 3! (u + 1)u(u − 1)(u − 2) J4 = 4! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas u(u + 1) 2 (u + 1)u(u − 1) 3 4 y−1 + 4 y−2 + 2! 3! (u + 2)(u + 1)u(u − 1) 4 4 y−2 + . . . 4! y = y0 + u 4 y−1 + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Finite Differences Gauss’s Backward Interpolation Formulas u(u + 1) 2 (u + 1)u(u − 1) 3 4 y−1 + 4 y−2 + 2! 3! (u + 2)(u + 1)u(u − 1) 4 4 y−2 + . . . 4! y = y0 + u 4 y−1 + Example- 16 Use Gauss’s Forward Interpolation Formula to find y for x = 20 given that x y 11 19.5673 15 18.8243 19 18.2173 Yasin K. Kowa Email:kowayasin@gmail.com 23 17.1236 27 16.6162 GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula Eliminating odd differences in Gauss’s Forward formula, by using the relation 4y0 = y1 −y0 , 43 y−1 = 42 y0 −42 y−1 , 45 y−2 = 44 y−1 −44 y−2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula Eliminating odd differences in Gauss’s Forward formula, by using the relation 4y0 = y1 −y0 , 43 y−1 = 42 y0 −42 y−1 , 45 y−2 = 44 y−1 −44 y−2 Laplace-Everett’s Formula u(u − 1) 2 (u + 1)u(u − 1) 2 4 y−1 + (4 y0 − 2! 3! (u + 1)u(u − 1)(u − 2) 4 42 y−1 ) + 4 y−2 + 4! (u + 2)(u + 1)u(u − 1)(u − 2) 4 (4 y−1 − 44 y−2 ) + . . . 5! y = y0 + u(y1 − y0 ) + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula y = (1 − u)y0 + uy1 + u(u − 1) 1 u+1 − 2! 3! 42 y−1 + (u + 1)u(u − 1) 2 1 u+2 4 y0 + (u + 1)u(u − 1)(u − 2) − 44 3! 4! 6! (u + 2)(u + 1)u(u − 1)(u − 2) 4 y−2 + 4 y−1 + . . . 5! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula y = (1 − u)y0 + uy1 + u(u − 1) 1 u+1 − 2! 3! 42 y−1 + (u + 1)u(u − 1) 2 1 u+2 4 y0 + (u + 1)u(u − 1)(u − 2) − 44 3! 4! 6! (u + 2)(u + 1)u(u − 1)(u − 2) 4 y−2 + 4 y−1 + . . . 5! Laplace-Everett’s Formula u(u − 1)(u − 2) 2 4 y−1 + 3! (u + 1)u(u − 1) 2 (u + 1)u(u − 1)(u − 2)(u − 3) 4 4 y0 − 4 y−2 + 3! 5! (u + 2)(u + 1)u(u − 1)(u − 2) 4 4 y−1 + . . . 5! y = (1 − u)y0 + uy1 − Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula Let v = 1 − u =⇒ u = 1 − v , u − 2 = −v − 1 (1 − v )v (v + 1) 2 (u + 1)u(u − 1) 2 y = vy0 + uy1 + 4 y−1 + 4 3! 3! (v + 2)(v + 1)v (v − 1)(v − 2) 4 y0 + 4 y−2 + 5! (u + 2)(u + 1)u(u − 1)(u − 2) 4 4 y−1 + . . . 5! Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Central Differences Interpolation Formula Laplace-Everett’s Formula Let v = 1 − u =⇒ u = 1 − v , u − 2 = −v − 1 (1 − v )v (v + 1) 2 (u + 1)u(u − 1) 2 y = vy0 + uy1 + 4 y−1 + 4 3! 3! (v + 2)(v + 1)v (v − 1)(v − 2) 4 y0 + 4 y−2 + 5! (u + 2)(u + 1)u(u − 1)(u − 2) 4 4 y−1 + . . . 5! Laplace-Everett’s Formula v (v 2 − 1) 2 v (v 2 − 1)(v 2 − 4) 4 4 y−1 + 4 y−2 +. . . +uy1 + 3! 5! (u + 1)u(u − 1) 2 (u + 2)(u + 1)u(u − 1)(u − 2) 4 4 y0 + 4 y−1 +. . . 3! 5! y = vy0 + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Laplace-Everett’s Formula Example Use Everett’s Interpolation formula to find the value of y given that x = 1.60 from the following table x y 1.0 1.0543 1.25 1.1281 1.5 1.2247 Yasin K. Kowa Email:kowayasin@gmail.com 1.75 1.3219 2 1.4243 2.25 1.4987 GSB 3204: Statistics & Numerical Analysis Interpolation Choice of Interpolation Formula The selection of an interpolation formula depends to a great extent on the position of the interpolated value in the given data (a) Use Newton’s Forward Interpolation formula to find a tabulated value near the beginning of the table (b) Use Newton’s backward interpolation formula to find a value near the end of the table (c) Use either Stirling’s or Bessel’s or Laplace-Everrett’s formula to find an interpoated value near the center of the table. if u 1 1 is lying between −1 4 and 4 ., Stirling’s formula is preffered, 4 3 and 4 use Bessel’s or Everett’s Formula Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Interpolation with Unequal Intervals Lagrange’s Interpolation Formula Let y = f (x ) be areal valued continuous function defined in the interval [a, b], let x0 , x1 , ..., xn be (n+1) distinct points which are not necessary equally spaced and the corresponding values of the function are y0 , y1 , y2 , ...., yn Lagrange’s Interpolation Formula We can represent the function y = f (x ) as polynomial in x of degree n. Let the polynomial be represented as f (x ) = a0 (x − x1 )(x − x2 )...(x − xn ) + a1 (x − x0 )(x − x2 )...(x − xn ) + a2 (x − x0 )(x − x1 )(x − x3 )...(x − xn ) + .......... + an (x − x0 )(x − x1 )(x − x2 )...(x − xn−1 ) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Interpolation with Unequal Intervals Lagrange’s Interpolation Formula If we put x = x0 in the above we get, f (x0 ) a0 = (x0 − x1 ))(x0 − x2 )....(x0 − xn ) Putting x = x1 f (x1 ) a1 = (x1 − x0 ))(x1 − x2 )....(x1 − xn ) Putting x = x2 f (x2 ) a2 = (x2 − x0 ))(x2 − x1 )....(x2 − xn ) Putting x = xn f (xn ) an = (xn − x0 ))(xn − x1 )....(xn − xn−1 ) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Interpolation with Unequal Intervals Lagrange’s Interpolation Formula y= (x − x1 )(x − x2 )(x − x3 ) . . . (x − xn ) f (x0 )+ (x0 − x1 )(x0 − x2 )(x0 − x3 ) . . . (x0 − xn ) (x − x0 )(x − x2 )(x − x3 ) . . . (x − xn ) f (x1 ) . . . + (x1 − x0 )(x1 − x2 )(x1 − x3 ) . . . (x1 − xn ) (x − x1 )(x − x2 )(x − x3 )....(x − xn−1 ) f (xn ) (xn − x1 )(xn − x2 )(xn − x3 ) . . . (xn − xn−1 ) This is called as Lagrange’s Interpolation Formula Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Lagrange’s Interpolation Formula Example Apply Lagrange’s Interpolation Formula to find a polynomial of which passes through the point (0, -20), (1,-12), (3, -20) and (4, -24) Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Lagrange’s Interpolation Formula Example Apply Lagrange’s Interpolation Formula to find a polynomial of which passes through the point (0, -20), (1,-12), (3, -20) and (4, -24) Example (a) Use Lagrange’s Interpolation Formula to find a polynomial which passes through the points (0, -12), (1, 0), (3, 6), (4, 12) (b) Use Lagrange’s Interpolation Formula to find the value of y corresponding to x = 10 from the following table x y 5 380 Yasin K. Kowa Email:kowayasin@gmail.com 6 -2 9 196 11 508 GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Numerical Differentiation Numerical differentiation is the process of calculating the derivative of a function at some particular value of independent variable by means of a set of given values of that function. Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Numerical Differentiation Numerical differentiation is the process of calculating the derivative of a function at some particular value of independent variable by means of a set of given values of that function. Numerical Differentiation Consider the function y=f(x) which is tabulated for the values x = a + nh, n = 0, 1, 2, .... Numerical Differentiation are based on numerical interpolation as follows: Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Numerical Differentiation (a) Derivatives based on Newton’s Forward interpolation Formula. This formula is used to find the derivative for some given x lying near the beginning of the data table/points. (b) Derivatives based on Newton’s Forward interpolation Formula. This formula is used to find the derivative for some given x lying near the end of the data table/points. (c) Derivatives based on Stirling’s Interpolation Formula. This formula is used to find the derivative for some point lying near the middle of tabulated value Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula Recall the Newton’s Forward Interpolation Formula u(u − 1)(u − 2) 3 u(u − 1) 2 4 y0 + 4 y0 + 2! 3! u(u − 1)(u − 2)(u − 3) 4 4 y0 + .... 4! y = y0 + u 4 y0 + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula Recall the Newton’s Forward Interpolation Formula u(u − 1)(u − 2) 3 u(u − 1) 2 4 y0 + 4 y0 + 2! 3! u(u − 1)(u − 2)(u − 3) 4 4 y0 + .... 4! y = y0 + u 4 y0 + Derivatives Using Newton’s Forward Difference Formula x − x0 where u = ⇒ x = x0 + uh h u2 − u 2 u 3 − u 2 + 2u 3 y = y0 + u 4 y0 + 4 y0 + 4 y0 + 2 6 4 3 2 u − 6u + 11u − 6u 4 4 y0 + .... 24 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula 2u − 1 2 3u 2 − 6u + 2 3 dy = 4y0 + 4 y0 + 4 y0 + du 2 6 4u 3 − 18u 2 + 22u − 6 4 4 y0 + .... 24 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula 2u − 1 2 3u 2 − 6u + 2 3 dy = 4y0 + 4 y0 + 4 y0 + du 2 6 4u 3 − 18u 2 + 22u − 6 4 4 y0 + .... 24 Derivatives Using Newton’s Forward Difference Formula dx =h and du dy dy du = × dx du dx Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula dy 1 2u − 1 2 3u 2 − 6u + 2 3 = [4y0 + 4 y0 + 4 y0 + dx h 2 6 4u 3 − 18u 2 + 22u − 6 4 4 y0 + ....] 24 If x = x0 , u = 0 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula dy 1 2u − 1 2 3u 2 − 6u + 2 3 = [4y0 + 4 y0 + 4 y0 + dx h 2 6 4u 3 − 18u 2 + 22u − 6 4 4 y0 + ....] 24 If x = x0 , u = 0 Derivatives Using Newton’s Forward Difference Formula dy 1 42 y0 43 y0 44 y0 = [4y0 − + − + ....] dx h 2 3 4 and 2 d 2y 1 2 y + 6u − 6 43 y + 12u − 36u + 22 44 y + ...] = [4 0 0 0 dx 2 h2 6 24 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula Foru = 0 d 2y 5 1 11 4 4 y0 − 45 y0 + ...] = 2 [42 y0 − 43 y0 + 2 dx h 24 6 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Using Newton’s Forward Difference Formula Foru = 0 d 2y 5 1 11 4 4 y0 − 45 y0 + ...] = 2 [42 y0 − 43 y0 + 2 dx h 24 6 Example dy d 2y From the following table find the value of and at the dx dx 2 point x = 1.0 x y 1 5.4680 1.1 5.6665 1.2 5.9264 Yasin K. Kowa Email:kowayasin@gmail.com 1.3 6.2551 1.4 6.6601 1.5 7.1488 GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Example d 2y dy and From the following table of values of x and y, obtain dx dx 2 for x = 1.1 and x = 1.2 x y 1.0 2.7183 1.2 3.3201 1.4 4.0562 Yasin K. Kowa Email:kowayasin@gmail.com 1.6 4.9530 1.8 6.0496 2.0 7.3891 GSB 3204: Statistics & Numerical Analysis 2.2 9.0250 Numerical Differentiation Example d 2y dy and From the following table of values of x and y, obtain dx dx 2 for x = 1.1 and x = 1.2 x y 1.0 2.7183 1.2 3.3201 1.4 4.0562 1.6 4.9530 1.8 6.0496 2.0 7.3891 2.2 9.0250 Derivatives Based on Newton’s Backward Interpolation Formula Here, we assume that the function y=f(x) is known at (n+1) points x0 , x1 , x2 , . . ., xn Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Newton’s Backward Interpolation Formula x − xn Let xi = x0 + ih i=0, 1, 2, . . .,n and u = h Recall the Newton’s Backward Interpolation formula u(u + 1) 2 u(u + 1)(u + 2) 3 5 yn + 5 yn + 2! 3! u(u + 1)(u + 2)(u + 3) 4 5 yn +..... 4! f (x ) = yn + u 5 yn + Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Newton’s Backward Interpolation Formula x − xn Let xi = x0 + ih i=0, 1, 2, . . .,n and u = h Recall the Newton’s Backward Interpolation formula u(u + 1) 2 u(u + 1)(u + 2) 3 5 yn + 5 yn + 2! 3! u(u + 1)(u + 2)(u + 3) 4 5 yn +..... 4! f (x ) = yn + u 5 yn + Derivatives Based on Newton’s Backward Interpolation Formula 1 2u + 1 2 3u 2 + 6u + 2 3 [5yn + 5 yn + 5 yn + h 2! 3! 3 2 4u + 18u + 22u + 6 4 5 yn + ......] 4! f 0 (x ) = Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Newton’s Backward Interpolation Formula f 00 (x ) = 2 1 2 y + 6u + 6 53 y + 12u + 36u + 22 54 y + ......] [5 n n n h2 3! 4! For x = xn , u = 0 we have Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Newton’s Backward Interpolation Formula f 00 (x ) = 2 1 2 y + 6u + 6 53 y + 12u + 36u + 22 54 y + ......] [5 n n n h2 3! 4! For x = xn , u = 0 we have Derivatives Based on Newton’s Backward Interpolation Formula f 0 (x ) = 1 52 yn 53 yn 54 yn [5yn + + + + ......] h 2 3 4 f 00 (x ) = 1 11 4 5 yn + ......] [52 yn + 53 yn + 2 h 12 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Example A slider in a machine moves a long a fixed straight rod. Its distance xm along the rod are given in the following table for various values of the time t(seconds). t(sec) x(m) 1 0.0201 2 0.0844 3 0.3444 4 1.0100 5 2.3660 6 4.7719 Find the velocity and acceleration of the slider at time t=6 sec Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Example A slider in a machine moves a long a fixed straight rod. Its distance xm along the rod are given in the following table for various values of the time t(seconds). t(sec) x(m) 1 0.0201 2 0.0844 3 0.3444 4 1.0100 5 2.3660 6 4.7719 Find the velocity and acceleration of the slider at time t=6 sec Derivatives Based on Stirling’s Interpolation Formula Suppose y±i = f (x±i ), i=0, 1, 2, ......,n are given for (2n+1) points x0 , x±1 , x±2 , ......, x±n where x±i = x0 ± ih, i=0, 1, .....n Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Stirling’s Interpolation Formula The Stirling’s Interpolation formula is given by f (x ) = u2 2 u 3 − u 43 y−2 + 43 y−1 4y−1 + 4y0 ]+ 4 y−1 + [ ]+ 2 2! 3! 2 u4 − u2 4 u 5 − 5u 3 + 4u 45 y−3 + 45 y−2 4 y−2 + [ + ....] 4! 5! 2 y0 + u[ Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Stirling’s Interpolation Formula The Stirling’s Interpolation formula is given by f (x ) = u2 2 u 3 − u 43 y−2 + 43 y−1 4y−1 + 4y0 ]+ 4 y−1 + [ ]+ 2 2! 3! 2 u4 − u2 4 u 5 − 5u 3 + 4u 45 y−3 + 45 y−2 4 y−2 + [ + ....] 4! 5! 2 y0 + u[ Derivatives Based on Stirling’s Interpolation Formula x − x0 where u = h Then 1 4y−1 + 4y0 3u 2 − 1 43 y−2 + 43 y−1 f 0 (x ) = [ + u 42 y−1 + [ ]+ h 2 6 2 3 4 2 5 5 4u − 2u 4 5u − 15u + 4 4 y−3 + 4 y−2 4 y−2 + [ ] + .......] 4! 5! 2 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Stirling’s Interpolation Formula and 12u 2 − 2 4 1 43 y−2 + 43 y−2 ]+ 4 y−2 + f 00 (x ) = 2 [42 y−1 + u[ h 2 4! 20u 3 − 30u 45 y−3 + 45 y−2 [ ]+..........] 5! 2 at x = x0 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Derivatives Based on Stirling’s Interpolation Formula and 12u 2 − 2 4 1 43 y−2 + 43 y−2 ]+ 4 y−2 + f 00 (x ) = 2 [42 y−1 + u[ h 2 4! 20u 3 − 30u 45 y−3 + 45 y−2 [ ]+..........] 5! 2 at x = x0 Derivatives Based on Stirling’s Interpolation Formula f 0 (x ) = 1 4y−1 +4y0 1 43 y−2 + 43 y−1 1 45 y−3 + 45 y−2 [ − [ ] + [ ] + .....] 2 h 6 2 30 2 f 00 (x ) = 1 1 4 4 y−2 + ..........] [42 y−1 − h2 12 Yasin K. Kowa Email:kowayasin@gmail.com GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Example dy d 2y Find and for x=0.2 for the data given in the following dx dx 2 table. x y 0 0 0.1 0.10017 0.2 0.20134 Yasin K. Kowa Email:kowayasin@gmail.com 0.3 0.30452 0.4 0.41076 0.5 0.52115 GSB 3204: Statistics & Numerical Analysis Numerical Differentiation Example dy d 2y Find and for x=0.2 for the data given in the following dx dx 2 table. x y 0 0 0.1 0.10017 0.2 0.20134 0.3 0.30452 0.4 0.41076 0.5 0.52115 Exercise Compute the values of f 0 (3.1) and f 0 (3.2) using the following table x f(x) 1 0 2 1.4 Yasin K. Kowa Email:kowayasin@gmail.com 3 3.3 4 5.6 5 8.1 GSB 3204: Statistics & Numerical Analysis