You are on page 1of 131
According to New Syllabus of Tribhuvan University, Pokhara University, Purbanchal University, Mid-Western University and Kathmandu University A Textbook of Numerical Methods fe or BE, BSc, BSc CSIT, BCA, BIT, BIM with ¢ Algorithms, Flowcharts, Pseudo-Codes + Codes in C Language « MATLAB Programs + Programs of EX/ES-Plus Series Calculators ¢ 31 Sets of Important Questions Chapter 1 7 18 18 19 1.10 Contents Introduction, Approximation and Errors in Computation Introduction Approximation and Errors in Computation 1.2.1 Approximate Numbers: 1.2.2 Accuracy and Preci om 1.2.3 Significant Digits or Figures 1.24 Rounding Off Numbers 1.2.5 Floating Point Representation Errors in Numerical Methods 1.3.1 Inherent Errors 13.2) Num 1.3.3. Analysis of Errors ical Errors 1.3.4 Approximate Errors and Relative Approximate Errors ‘Some Rules for Estimating Errors Exercise 14 Taylor's series Finite Differences; ifference, Shift and Differential operators 1.6.1 Finite Differences and Difference Operators 1.6.2 Forward Differences and Forward Difference Operators 1.6.3 Backward Differences and Backward Difference Operators 1.6.4 Central Differences and Central Difference Operators 1.6.5. Divided Differences 1.6.6 Shift Operator, Average Operator and Differential Operator 1.6.7 Summary and Relation among Operators Error Propagation General Error Formula 1.8.1. Error in the Approximation of a Function 1.8.2 Errorina$ jes Approximation Order of Appror Usage and Importance of Computer Programming in Numerical Methods 1.9.1 Mathematical Background mation 1.9.2. Different Forms of Equations and Process of Numerical Computing Algorithm, Pseudo-code and Flowchart 1.10.1 Pseudo-code 1.10.2 Flowchart 23 24 25 26 27 Solution of Non-linear Equations ‘Numerical eration Methods Bisection Method for Solving Nonlinear Equations Working Procedure Criterion for Terminating the Computations [Number of Iterations Required for Achieving an Accuracy Convergence of Bisection Method ‘Merits and Demerits of Bisection Method Features of Bisection Method Algorithm and Pseudo-code forthe Bisection Method Source Code in C Program for Bisecton Method Exercise 22 “Method of False Postion or Regula-Falsi Method 23.1, Regul-Falsi Method Algorithm 23.2 Source Code in € Program for Regul Exercise 23 Fixed Point Heration 24.1. Sufficient Condition for Convergence of Iterations 24.2. Features of Fixed Point Iteration Method 243 Algoritm for eration Method 24.4 Source Code in C program for Iteration Method Exercise 24 ‘Newlon-Raphson (N-R) Method 25.1 Derivation 2.52. Convergence of Newton Raphson Method. 2.5.3. Features of Newion-Raphson Method 2.54 Advantages and Limitations of Newton-Raphson Method 2.5.5 Algorithm for the Newton-Raphson Method 2.56 Source Code fr Newton Rephson Method in C Exercise 25 ‘Secant Method 2.6.1 Derivation: Geometrically and from NR Method 2.62 Features of Secant Method 2.6.3 Algorithm for Secant Method 264 C Programming Source Code for Secant Method Exercise 2.6 (Comparison of Iterative Methods asi Method ‘Chapter 3 31 32 33 34 35 36 37 38 39 en Solution of System of Linear Equations Introduction Solution of a System and Methods of Solving Linear Equations 3.2.1. Methods of Solving System of Equations Direct Methods Iterative Methods Direct Methods of Solution Basic Gauss Elimination Method Gauss Elimination with Pivoting 3.4.1. Gauss Elimination Algorithm 3.42. Source Code for Gauss Elimination Method in C Gauss-lordan Method 35.1. Working Procedure 3.5.2. Gauss Jordan Method Algorithm and Pseudo-code 3.5.3. Source Code for Gauss-Jordan Method in C LLU Factorization Method Triangular Method 36.1, Doolittle Method 362. LU Factorization Algorithm 363. Source Code for LU Factorization in © 3.64 Crout Method 3.65 Cholesky Method Method of Determinants (Cramer’ rule) Matrix Inversion Method 3.8.1. Matrix Inversion Algorithm 3.82. Source Code for Matrix Inverse in C 3.83. Matrix Inverse using Gauss Jordan Method 3.84 Matrix Inverse using Gauss Elimination Method 3.8.5. Matrix Inverse by Factorization Method Exercise 38, erative Solutions ofthe System of Linear Equations 39.1 Jacobs erative Method. 3.9.2. Gauss-Seidel Method Algorithm 3.9.3 Source Code for Jacobi Iterative Method in C Gauss-Seidel Iteration Method 3.10.1 Gauss-Seidel Method Algorithm. 3.10.2 Source Code for Gauss-Seidel Method in C Exercise 3.10 Dominant (Absolutely Largest) Eigen values by Power Method 3.11.1 Bigen Value and Eigen Vector 3.11.2 Cayley-Hamilton Theorem » y 0 a at st a at 86 sees 100 100 101 101 106 108 109 Ho un m2 13 us ur us 120 120 iP 12 1s 126 rr 130 BI BI 133 sf 312 Chapter 4 a a2 43 44 45 46 3.11.3 Power Method 3.114 Source Code for Power Method in C Exercise 3.11 Well Conditioning and Il-Conditioning Linear System 3.12.1 Iterative Method to Improve Accuracy of an Ill-congitioned System Exercise 312 Interpolation and Curve Fitting Introduction Interpolation with Equal Intervals 42.1 Newton's Forward Interpolation 422. Newton's Backward Interpolation 423. Source Code for Newton Forward Interpolation in C Exercise 42 (Central Difference Interpolation 43.1. Gauss's Forward Interpotation 43.2 Gauss's Backward Interpolation 433 Stirling's Interpolation 43.4 Bessel’ Interpolation Exercise 43 Interpolation with Unequal Intervals 44.1. Lagrange's Interpolation Formula 4482 Algorithm for Lagrange’s Interpolation 443. Source Code for Lagrange Interpolation in C: Exercise 44 Newton's Divided Differences 45.1 Newton's Divided Difference Formula 452 Relation between Divided and Forward Differences 453 Newton Divided Difference in C Exercise 45 Spline's Interpolation 46.1 Cubic Spline Interpolation Exercise 46 Curve Fiting 4.7.1 Principle of Least Square 472 Fiting of y= a+ br by the Method of Least Squares 4.7.3 Multiple Linear Least Squares 4.74 Algorithm and Source Code for Linear Curve Fitting in C 4.7.5 Curve Fiting by a Polynomial 47.6 Linearization of Nonlinear Laws 47.7 Source Code for Exponential Curve Fitting in C Exercise 4.7 Chapter 5 sa 52 Chapter 6 61 62 63 64 66 67 68 69 ‘Numerical Differentiation and Integration ‘Numerical Differentiation 5.1.1 Derivatives using Newton's Forward Difference Formula 5.1.2. Derivatives using Newton's Backward Difference Formula, 5.13 Derivatives using Central Difference Formula 5.14 Maxima and Minima of Tabulated Functions Exercise 5.1 Numerical Integration 5.2. Newton-Cotes Quadrature Formula 5.2.2 Trapezoidal Rule 5.2.3 Simpson's 1/3 Rule 5.2.4 Simpson's 38 Rule 5.2.5 Boole’s Rule 5.2.6 Weddle’s Rule 5.2.7 Errors 5.2.8 Romberg Method 5.2.9 Gaussian Integration 5.2.10 Gaussian Integration Formula for n = 2 5.2.11 Gaussian Integration Formula for n= 3 Exercise 5.6 Numerical Solution of Ordinary Differential Equations Introduction Picard Method Taylor's Series Method 63.1. Improving Accuracy Euler's Method {6441 Alternative Derivation of Euler Method 6.4.2 Euler's Method Algorithm 643. Source Code for Euler's Method in © Modified Euler's Method 6.5.1. Modified Euler's Method Algorithm 6.5.2. Source Code for Euler's Method in C Runge-Kutta Method 6.6.1. Runge-Kutta Method of Order Two Runge-Kutta Method of Fourth Order 62.1 Source Code for Runge Kutta Method in C Simultaneous Differential Equations 6.8.1 RK-2 and RK-4 Methods for Simultaneous Differential Equations Second Order Differential Equations Me 183 183 184 185 Iss 190 190 190 192 194 196 198 19 199 203 205 206 206 207 200 6.0 au on 716 Appendix 1 Appendix 2 Appendix 3 Bibliography ‘Boundary Value Problems (BVPS) ‘Shooting Method Finite Difference Method Exercise 6 Numerical Solution of Partial Differential Equations Introduction Elliptic Equations 7.2.1. Laplace's Equations Finite Difference Iterative Process Poisson's Equation Relaxation Method for Solving Elliptic Equation Exercise 7.5 Solution of one Dimensional Heat Equation Exercise 7.6 Programming Lab Sheets Introduction to MATLAB Important Question sets for Practice eee ERE eee ee Chapter Introduction, Approximation | and Errors in Computation 1.1 Introduction Numerical analysis is the study of algorithms that use numerical approximation for the problems of ‘mathematical analysis, This involves the study of methods of computing numerical data. In many problems, this implies producing a sequence of tio ti In numerical analysis, a numerical method is a mathematical tool designed to solve numerical problems. People who employ numerical methods for solving problems have to worry about the following 7) The rate of convergence (how long does it take for the method to end the answer) i) The accuracy (or even validity) of the answer, and ii) The completeness of the response (do other solutions, in addition tothe one found, exist). Numerical methods provide approximations to the problems in question, No matter how accurate they are they do not, in most cases, provide the exact answer. In some instances, working out the exact answer by a different approach may not be possible or may be too time consuming and itis in these cases Where numerical methods are most often used, Use of Technology Programs written in C, FORTRAN and MATLAB are fast and efficient. So, C, FORTRAN and MATLAB are the most common languages used in analysis of problems in Numerical Methods. Each topic is provided with a brief explanation, mathematical derivation, numerical example, source ‘code, and the corresponding sample inpuvoutput. The source codes, algorithms and flowcharts have been presented in simple and understandable way as far as possible. Use of Numerical Methods in Engineering ‘Numerical analysis naturally finds applications in all fields of engineering and the physical sciences, but in the 21” century also the life sciences and even the ans have adopted elements of scientific ‘computations. mn solving practical technical problems using scientific and mathematical tools when available, and using expertense and Tataton, mathematical models provide a pri ‘ery desirable when prototypes of experiments are cost timates oF performance - 2. Engineering problems frequently arise in which exact analytical solutions are not available. 3. Approximate solutions ate normally sufficient for engineering applications, allowing the use of approximate numerical methods. 4. Most of the real life problems are not solvable accurately analytically and these problems ean be solved using numerical methods, Example: Quantitative Enj ring Actviti ‘Analysis and Design 2_A Textbook of Numerical Methods _ ‘Analysis: Predicting the response of a system given a fixed system design and operating conditions. ‘0-60 mph acceleration time of a vehicle (Mechanical Engineering) + Power output ofan electric motor _(Eletrical/Mechanical Engineering) ‘+ Gain ofan electromagnetic antenna (Electrical Engineering) ‘+ Maximum load a bridge can support (Civil Engineering) + Reaction time ofa chemical process (Chemical Engineering) + Drag force of an airplane (Acrospace Engineering) + Expected retum ofa product portfolio (Industrial and Operations Engineering) ‘Design: Det@rmining an ideal system design such that a desired response is achieved. + Maximizing a vehicle's fuel economy while maintaining adequate performance levels by varying vehicle desigit parameters + Minimizing the weight of a mountain bike while ensuring it will not fail structurally by vayig frame shape and thickness. Characteristics of Numerical Methods SL. The problems are numeric. ‘<2 There are severa! methods (direct and iterative) to solve a particular problem. solution procedure is conceptually simple, with algorithms representing the solution procedure that can be easly programmed on a digital computer. 4 The solution procedure is iterative, with the accuracy ofthe estimated solution improving with ext iteration. 5+ The solution provedure provides only an approximation to true (exact), but unknown solution, (~& The solution procedure may occasionally diverge from rather converge tothe true solution. 7. Am initial estimate of the solution may be required. J Fast computations (answers within time limits) 9. The solution is numeric. (Categories of Numerical Methods and Applications ‘Selected Categories of Numerical Methods and Applications are as follows: {) Linearization il) Finding Roots of Functions i) Solving Systems of Equations ¥) Optimization vi) Numerical Integration and Differentiation vii) Solving Differential Equations. 1.2 Approximation and Errors in Computation 1.2.1 Approximate Numbers ‘There are two types of numbers: exact and approximate. Exact numbers are 1, 2, 3, 4, 11/2, 13.5, However, there are numbers such as } (= 0.33333 ...)-f2 (= 1.414213 ...) and x (= 3.141592 ...) whi cannot be expressed by a finite number of digits. These may be approximated by numbers 0.3333, 14142 and 3.1416 respectively. Such numbers which represent the given numbers to a certain degree of accuse] are called approximate numbers. 1.2.2 Accuracy and Precision Measurements and calculations can be characterized with regard to their accuracy and preciso Accuracy refers to how closely a value agrees with the true value. Precision refers to how closely vali agree with each other. Introduction Approximation and Errors in Computation 3 Bias, An estimate of a parameter 0 made from sample statistic is said to be an unbiased estimate if the expected value ofthe sample quantity 6 is; that is, — EG) =8. “The bias is defined as a systematic deviation of values from the true value. Itis given by (£6) - 9), Precision; Precision is defined as the ability of an estimator to give repeated estimates that are very close to each other. Precision can be expressed in terms of the variance of the estimator. It cannot be improved. Precision Varo 1 Lack of precision Varo) 4 High precision Var ()= ‘Absolute precision Impreeision (uncertainty) refers to the magnitude ofthe scatter. ‘Accuracy: Accuracy is defined as the closeness of nearness of the measured or computed value (or ‘measurement) tothe true or actual value ofthe quantity being measured. It can be improved. Bias and Precision are considered elements of Accuracy, Bias + Precision = Accuracy. Inaccuracy (also known as bias) is the systematic deviation from the truth, This can result from either a bias or a lack of precsign. a aan ‘Consider the four dartboards of the following figure. Assuming that these shooting at the targets ‘were aiming at the center, the person shooting at target A was successful. ©) Increasing Accuracy SSS Increasing Precision Figure 1.2 Concept of accuracy, precision and bias. ‘A: accurate, precise and unbiased, _B : inaccurate, precise and biased (Cs accurate, imprecise and unbiased: inaccurate, imprecise and biased 4A Teno of Numerical Methods SS reper the center. Foy «Telia Cues ie as fo incre ee eee Teta ups AaB ace sacmetetrenin Macon te ot me prcaeen srecamerone ope raves ccc ae aaa Sceinepaccinaer ea eee «Towed mu nvemidetw abeniwcaar ar taoteat ae Jn the figure, accuracy increases as precision increases, therefore. the shooter of target Aig, ‘most accurate. there isa systematic disor Biampie 12.1] Four sents performed an experiment to measure the density of sluminum (27 py ‘Which datas accurate but not precise? ‘A: Data of A is not accurate because it is not clos tothe true vale 2.7. However, i is preci because cach value is very close to 29. B : Data of B is neither accurate nor frecise. C > Data of Cis fairly accurate in comparison of A and B but not precise. D = Data of Dis definite! ‘Therefore, the dats of C is accurate but not precise. 1.2.3 Significant Digits or Figures ‘The sumber of significant figures (or digits) in a result is simply the number of figures that are katt of reliabili pasa deme of labia. Soil Eze ae he igi ns ale tat ae ae? some degree of confidence These are Used to expreye a number. eel As the mamber of significant figures increases. the move certain isthe measurement. As precise! Sanne a rane oes te mamber of sence Teas The number 13.2 is Said to have! ‘Sigufican igres 5.20 is said wo have 4 sigficant figures. ‘There are conventions that must be followed for expressing numbers so that their significant figu® are properly indicated. These conventions are: 1. All non-zero digits are always significant: 1,2,3,4,5,6,7,8.9. 5) $49 ghas three significant figures. i) 1.292 g has four significant figures. All zeros oceurring between non-zero digits are always significant: 102, 200.5, 50.009. 1) 4023 keg has four significant figures, 48) $0.014 ml i¢., 50014 10° ml has five significane figures. OE _—_ OO en Se eae ening og oe rs ae ever en i) 0.000034 ie, 34 «10 * ghas only two significant figures. 2» MOnTT'C ie, LIN 10°C bas four signcant Rgures smber with a decimal point, trailing zeros (thove to the right of the lst non-zero digit) ane 4m ano wi ia i aig has hei fhe be nor a in For ren miro cnr owen ees Se ee eee Bla eee Oe ee ee ee Wn i ry az om ii) The number 400 or 4 * 10° indicates only one significant figure. a eee eee i er Ee Pera one iarie meee eee eanaete ee ee i eee cee oe ee scientific notation. For example, depending on whether 3, 4, or § significant figures is correct, we ‘could write $0,600 calories as: 5.06 * 10 calories (3 significant figures) 5.060 « 10* calories (4 significant figures), 5.0600 » 10* calories (significant figures) ‘Therefore 50,600 calories may be 3.4 oS significant figures. 6. Exact oumbers have an infinite number of significant digits bur they are generally not reported. — ‘Some numbers are exact because they are known with complete certainty. Most exact numbers are integers: exactly 12 inches are ina foot there might be exactly 23 students in a class. Exact numbers are often found as conversion factors of as counts of objects. ‘Ifyou count 2 pencils, then the number of pencils is 2.000. 7. Defined numbers also have an infinite m significant digits. Thumber of centimeters per inch (2.54) has an infinite number of significant digits, as does the speed of light (299792488 ms), Concise rules for Significant Zeros .. ALL zeroes between non-zero numbers are ALWAYS significant. 2. ALL zeroes which are SIMULTANEOUSLY to the right ofthe decimal point AND at the end ofthe number are ALWAYS significant, 3 ALL zeroes which are tothe left of a written decimal point and are in a number > 10 are ALWAYS. significant Remarks: The concept of accuracy related as follows: 5 and precison ar chosly related to significa digits. They ae 4. Acumey refers tothe numberof snc gis ina vale. For example, the number 3.525 secure oie sinifcan digi (a 2. Precision refers to the number of decimal pasitins, i... the order of magnitude ofthe last digit in Value, The number 33.525 has a precision of 0.001 or 10" (6A Textbook of Numerical Meads [Esampie 122] Find the accuracy ofthe following numbers “ad 750.08 (b) 0.00002932. (€) 43102 (4) 403109 (€) 43102 (9 403100 (8) 3081009, Solution: 2) The aumber 75005 is accurat five significant digits. 1b) The number 0,00002932 i accurate to four significant digits ©) The umber 43102 is accurate 1o five significant digits 4 The mumber 403100 is accurate to gix significant digits ©) The number 43102 is accurate to five significant digits $) The accuracy ofthe number 4310200 is not specified. It may have 5, 6 ors {) The number 4310200,00 is accurate 6 nie significant digits. Eazampie 123] which ofthe following numbers asthe gests prevision? Ta) 750.05 (B) 000002932 (c) 43102 (4) 405100 (<) 43102 (1) 403100 (g) 403100 Solution: 3) The number 750.05 has a prsison of 001 or 10 'b) The number 0.00002932 has a precision of 0.00000001 or 10°. ‘¢) The number 4.3102 has a precision of 0.0001 or 10~. d) The number 4.03100 has a precision of 0.001 or 10 ) The number 43102 bas a precision of 0. 1) Toe mumber 4310200 basa precision of 0 2) Toe number 431020000 bas a precision of 0_ Heac, te munber 0.00002932 has the greatest precision Ezmple 124] Explain tne concept of accuracy ad precision with examples. Find 1) the acura and precision ofthe numbers 750-5 and 0,00002932. 2) the greatest precision moog the numbers 43102, 431, 4:3102156, Solution: Similar to previous example Rules for Mathematical Operations In canying out calculations. the general rle is thatthe accuracy of x calculated result is limited byt least scoure measurement involved in the calcalation. 1. In ation and subtraction, the result i rounded off to the lst common digit occurring furthes © the right inal components. For example, 100 (assume 3 sufcant figures) = 23.643 (5 signfiat figures) ~ 123.683, whic should be rounded 1 124 (3 significant figures. 2 In multiplication and division, the result should be rounded off so as to have the off so as ave the same number of Siem ges ihe capone! wh he eas mambo of spin ies. For exag! significant gars) 12.60 (4 significant figures) = 378000 which 2 pda should be rounded off to 38 1.2.4 Rounding Off Numbers The process of dropping unwanted digit is called rounding off Rate to round offs sumber ton significant figures We round off a number to msi e stn eificant Figures discarding the (n+ 1)* and all subsequent dein —— 1. Rounding up: If the digit at (n +1)" place 10 be dropped ownage (Gicarded) is greater than 5, the ined digit inthe? place increased by ove. For example, 126 sounded 13 2. Rounding down: If the digit at (n +1)" place to be feta gh pce ohh ci Foc ec tt 2, he irvasory (russa5 Inirodvction, Approximation and Errors in Computation 7 te com sead 4 he a steven For example — Hes wrmlelto 12 the digit to be dropped is 5 followed only by zeroes, the result is (cis to avoid bias in rounding: half of the time we the last remaining digit is increased by always This rule means that if “ rounded to the even digit, The r a half the time we round down ote. The numbers thus rounded off to significant figures (or decimal places) re said to be correct ‘ovraignifieant figures (or n decimal places). different significant figures and decimal pl 23450 three places of decimal 2.345 40871 three places of decimal 40.871 | 03652. three places of decimal 0.837 167535 four places of decimal 40.8754 '$7566 four places of decimal 40.8737 “The following numbers are rounded off to 2.3750 three significant figures 2.38 40.850 three significant figures, 40.8 (0.83652 three significant figures 0.837 4406750. four significant figures 406800 | 40. 40875.6 four significant figures 408780 | 40. 1.2.5 Floating Point Representation Most digital computers have two ways of representing aumbers, called fixed point and floating point. In 2 fixed point system, the numbers are represented by a fixed number of decimal places e.g. 52.123, 10.0123, 3.000. In a floating point system the numbers are represented with a fixed number of significant git for example 9.1714 «10° 9ATISE-13 0.2000 « 10! 0.2000 E01 4.6238 « 10° also writen as 4.6238 E03 {fx isa real number, then its floating point form representation is x= (x10. “The number { (i. digits before E) is called mantissa and ¢ (i.e. digits after E) isthe exponent. The mantissa part may have positive or negative siga, and exponent part must have at least one digit which can be ether positive or negative. For example, in 4.6238 x 10° Remarks 1. The shifting ofthe decimal point 10 she left of She most significant digit is called normalisation and the numbers represented inthe normalised form are known as normalised floating point number 2. Mantssa should satisfy the condition: 0.1 | {| 1, That i, ') For positive numbers: tess than 1,0 but greater than or equal to 0.1 For negative numbers: less than 1.0 but greater than or equal to ~ 0.1 4.6238E03), the mantissa is 4.6238. and the exponent is 03. Jet the following numbers into normalised floating point representation notation (a) 0.00345 (b) 78.3456 (¢) 456.7 Solution: (a) 000345 = 0345 x10? ie, 04S E-2 (b) 78.3456 = 0.783456 = 10? ie, 0.783456 E2 (©) ~4567 0.4567 x10" ie,, 0.4567 £3, EE tt~— Ara om es as ised exponentid in Pi a genus an pen sl Pg ‘added te x and y. and let: be the result. Denote the fray Adin: Let the ro mambers 19 Bs “Then the addition algorithm is as follows, part and exponents by fs fn {:and én én € respectively Algorithm for Addition , Set e- =the larger of ¢, and ¢,.(Ife, 2 ¢, then sete, = € (Then exponent of ¢, and ¢, become same), 1 2. Shift righe Shit {, 10 the right by es — 3. Add. Set = fet f “A. Normale: If f,/> 1 sift the decimal point off, 10 the left of the most significant digi ag them increase £, by one. Then z= f, = 10) In the following examples, we assume a precision of 6 and the mantissa is truncated to 6 digits Example 12.7] 460 the numbers (a) 0.345678 E2 and 0.987654 ES (b) 0.345678 E and 0.987684 Solution: a) Let x= O.MS678 ED and y=09876S4 ES. Then £ = 5. f, = 0.000987, fe = o> f= 0348678 + 0.000987 = 0.346665, Hence 0.346865 ES. [Note that both the mantissa and exponent of the number withthe smaller exponent are meds and the modified mantissa is truncated to six digits] b) Let «=0MS67SE4 and y=09876S4E4 Then B= 4, f= f+ f= 0.385678 + 0.987654 = 1.333332. Hence = = 0133333 ES where mantissa of the result is truncated Subtraction: It is addition of numbers with different signs. If mantissa in the number is less (011, then the decimal point should be shifted tothe left of the most significant digit and the expooet Of the result should then be decreased accordingly Example 1.25] Subtract 2) 0.345678 E-S from 0.987654 E-S b) 0.995678 E-5 from 0.997654 E-S Solution 8) Let r= 0345678 ES and y= 0987654 ES. Then E, = -5 f, = 0.987654 ~0.345678 = 0.641976, = 0611976 Es b) Let x= 0.995678 E-5 and y= 0.997654 E-S. Then E, = -5. 1, = 0.97654 ~0.99567% = 0.001976, Hence F = 0001976 E-S Hence 0197600 £7 (normalised). 1.3 Errors in Numerical Methods Iniroduction, Approximation and Errors in Computation 9 a formance of the car, no matter how accurate the aumerical-methods you-may-Use. s¢¢. determining the pert s themselves or in the measurement of physical quantities from mistakes in programs juan - tiem cannot be analytically-Wrved, the true value will not be Known. In numerical methods, the Pele eed to express exact mathematical operations, and numerically computed solutions are “These errors are introduced by the computational process itself. Computers perform fy a finite number of digits. Ifthe number X, is an approximate to the exact (, is called error Second, etrors may afi approximations are us subject to certain errors tnalematical operations with onl result NY. then the difference Xi Definition: Ifthe number X, isan approximate to the exact result (true value) Xs, then the difference Xp is called error. That is, ‘ {Error (E)~ Truc value — approximation = Xe ~ Xe Sometimes, itis known as true error and it may negative or positive. Thus, Exact value = approximate value + error. In applications of numerical methods, we come across the following types of errors: Inherent errors, Round off error and Truncation error. 1.3.1 Inherent Errors “The errors, which are already present in the statement of a problem before its solutions are called Inherent errors oF Ingu_efzars These eons contin two components namely. data errors and Taversion errors. mee Data Errors: Data errors (also known as experimental or empirical Errors) arise when the data is ‘obtained from certain physical measurements of the parameters of the problem and they are of limited accuracy and precision. Conversion Errors: Conversion errors (also known as representation Errors) arise duc to the limitations of mathematical tables, calculators or the digital computer Reduction of Inherent Errors: Inhercat errors cannot be completely eliminated but can be ‘minimized by selecting better data or by using bigh precision computing aids. Represent the decimal numbers 0.1 ard 0.4 in binary form with an ace accuracy ‘i of 8 iary digits. Add them and then convert the result back to the decimal form, 0.149 = 0.0001 1001, 4. = O.01100110 Sum= OUI = 025 + 0.125 + 0.0625 + 0.03125 + 0.015625 + 0.078125 + 0.00390625 0.49609375 the answer should be 0.8, but itis not. This is ber, both the numbers have non-t Error is equal to 2 * = 0.00300625. tt is clear that The ern my lgits that represent the number For example, if we a: O1S2587K0 = 194 . «due to the error ig conversion from decimal terminating binary representation jor can be reduced by increasing the 16 bits, then the error will he equal to 2 Numerical Errors trical errors (also knen jhumerical method, They eu wn as procedural errors) occur duit Ing the process of ‘80 forms: roundoff errors and franca : nd truncation errors, of a Rounding Errors / Round-off Errors ‘A computer can only represent number approximately. For example, a number like (0.333233 » 000000033. They, represented as 0.333333. Then the round off eror in this case is axe other number tht cannot be represented exastly. Fr example, rand V3 are numbers that ne approximated in computer calculations. * When the numbers ike igi, ae involved in ou ealaion, we ate fed 10 the only af numberof digi fom 4 decimal expression and thus an err named ound-fT error gets involved Thus rounding Of” @rOe arises kom the process of rounding off the numbers durgg computation because digital computes canna specced ane. Suaiis suas, Digital comput ie on inion ther ality to represent numer. Thtefore, sch ems aeunaidfeS ‘Sst ofthe clans dro MUOAVOT IE Sanpnng ue These rea cal chopping Effet of roundoff errors: When numbers are added or subcted, an accurate peSetaton result may rege a much ger numberof digits than needed forthe number add or subtated. Seg {mount of round off err occur in two es of stations: a) when adding subtmcting avery small ty toffom a age number, nd() when a aime is suerte fom another hats very clove Reduction of Rounding Error |) By changing the calculation procedure o as to avoid subtraction of nearly equal numbers afin by small umber i) By retaining at least one more significant figure at each step than that given in the data and rounkny ateieces Truncations Errors or Residual Errors Troma res ly wing pein iat lina ie oy 2s the err caused by testing a mathematical prose muncating mat «#6, whose decimal representation involve infinite nung one. Therefore, muncation exor is This error occurs when mathematical functions like 2,2 ce and talaxt ‘hose infinite series expansion exis, are usd inthe calculations. Because in calculating the at of such function fr an assigned value of x, only a fate number of terms ean be taken, an ero introduced for nt considering the remaining terms For example, the Maclaurin series frei given as e slert £+ St bene Ae (say), ‘This series has an infinite number of terms but when using this series to calculate e, only a fit ‘number of terms can be used. For example, if one uses thre terms to calculate ¢, then, Xs (say) The truncation error for such an approximation is sleet 1 met a Truncation error (E)= Xe ~Xy . Example 13. What is truncation error? tlustrate with examples, Calculate the truneation error in & series expansion of efor x= using first three terms. creas ERED EET Inirodution, Approximation sd Lorin Computation 1 for eis given as 1p des ‘Ths series has an infinite number of tems but when using this series to calculate e, only a finite hhumber of terms can be used, IT we use three terms to calculate «then Solution: The Maclaurin seri ea ttes bee meta) al fel ees Fe =X, (say), mn err (E) = Xp ~Xy - dar, uae =p Henee, truncat Reduction of Truncation Error However, how can truncation eror be controlled in this example? We can use the concept of relative approvimate eror to see how many terms need to be considered. Assume that one i calculating e'” using the Maclaurin’s series, then a, e ‘Suppose one wants the absolute relative approximate error tobe less than 1%, In Table, we show the value of e', approximate error and absolute relative approximate error as a function of the numberof | terms, n = z Tie i T : = 2 23 7 35a, 3 393 073 25.658 4 53.208 0.288 597%] 5 33043 |00 2626) 6 3315136 | 00x 0.62550 Using 6 terms of the series yields a |£,|% 0, we have to use finite value of, to give fo) = Hera So the truncation eror is caused by choosing a finite value of Ax as opposed toa Ar -> 0. For example, in finding ((3) for ((x) =x, we have the exact value calculated as follows Fromite denon (0) = Hy {2° 8= oe ye (x) =26 Then (0)=6 I wenow chose r= 02, hen (0) = LEZAD=U 12_A Textbook of Numerical Methods B_ATeseah ft a ‘We purposefully chose a simple function f(x) = .¢ with value of r= 2 and Ar = 0.2 becaug, eases ave po roundoff ero in ou calculations 9 thatthe truncation ero ean De Soa ye truncation error inthis example is 6-62=-02 (Can you reduce the truncate eror by choosing a smaller Ax? (Check!) Another example of truncation error isthe numerical integration ofa function —_—e—“_—eeo 2), If more terms are used, the ero is smaller ~ 8) {If spacing is smaller the eror fora given number of terms is salle. «) Total Numerical Error: The total numerical ero isthe sum ofthe runcation and rounshof eruq ‘The truncation error generally increases as the step 5 while the FOUN ony decreases as the step size ‘Therefore, the bes way 10 minimize the tutcation enor sy Gece the step See and wo minimize the round-ofT errors i 1 increase the numberof sgnicu, fous of Be Seaputen. In gener, te truncation errs gre decreased a5 Te OuBE OT eon ay Increased a i mumerical differentiation. “There exist no systematic and general approaches in evaluating numerical eror fr a oblems In must eaiereror esimates are based on experiment and jdgment ofthe engines Other Errors |). Approximation Error- error between the exact solution ofan exact problem, and the exact sir of an approximation o the exact problem. 3) eration Exror- errr in an iterative soltion method which should approach zero asympttial til) Madeling Error ~ These errors result from incomplete mathematical models jv) Blonders - Errors caused by malfunctions of the computer or human imperfection. 1.3.3 Analysis of Errors Absolute, Relative and Percentage Errors EX is the tue or exact value of a quantity and Xi its approximate valu, then (Tre value approximation) = + (Nr~Xa) Me Xe ‘Tue error «) Absolute true error (E.) Seas) provided that Xp #00r Xe is not too close to 2er0 Relative true error (E_) 7 {Ae Ae| 00%, eee X,)< then isan upper limit onthe magni Percentage relative error (F,) =, 100" Error bound: If fis 4 number such that | Xe of absolute error and measures the absofute accuracy 1 The relative and percentage errors are independent of the units used while absolute erm * cexpresed in terms ofthese units 22a umber is comet tom decimal places then the error = j 210% i For exp, ifthe number is3.146 comet 4 decimal places, then th enor = « 10" = 0.000 traduction, Approximation and Errors in Computation 4. Approximate Errors and Relative Approximate Errors tthe previous section, We diseussed how to eakulat ti ers. Such erors are ealeuated only i rue aie Pree Pnowen, However, mostly we wall not have the huxury of knowing tre values as why you vay ant Rn the approximate values if you know the tne values. Therefore, when we ae solving & bln numerical. we wll nly have acces to approximate values, We need to know how to quantify ror for such cases ‘Approximate error is defined a the difference between the present approximation and previous approximation “Approximate Error» Present Approximation - Previous Approximation Relative approximate error: It is defined as the ratio between the approximate error and the present approximation. Relative approximate error pase 1.4 Some Rules for Estimating Errors ‘The following rules are useful to estimate the errors when the numbers in a calculation are truncated oF rounded off oa certain numberof digits. If the approximate value ofa number Xs having m decimal digits is X,. then x, |<10 1. Absolute error due to truncation tok digits = | Xe 2. Absolute ertor due to rounding off to k digits = |X 4. Relative error due to truncation t digits 4. Relative eror due to rounding off tok digits Note L 1 number is correct tod decimal places, then the absolute error 2. Ifthe first significant figure of a number isk and the number is correct 1 m significant figures then Therelane ror < We sei hs rok by fipee. LZ ee ling the relative error in the number 868.32 correct to 5 signi S.n=Sand_ absolute error $ O01 « 00s Tenn > Wee Hence, the result is veri, Relative eror The derivative ofa function {(v) ata particular vale of x can be approximately fo = Meenas a 8) For f(x) = 12° and t= 03, find ') approximate value of (2), it) true value of (2), it) true error for part (i, iv) Relative true error, absolute relative tue error, and tre percentage eror at = 2, 14 _A Textbook of Numerial Methods ) For {iz)= 7e° and.x= 2, find the following i) Q)usingh=03, ii) (12) using h=0.15, il) approximate eror forthe value of (2) for part i. Solution: a) ) For f(a) 12% and h=03, . f2+0.3)- (2) eNO fe) = 03 oF ii) The exact value of (2) can be calculated by using defi fe) = 72%. fa)= 352%. £Q)= 352% = 9.5140. E,= Thue value — Approximate value = 9.5140 - 10.2646 = - 0.7506 =0.7506 9.5140 07885 re Given ‘Then ‘So, the true value of, it) Tre eroris Tre err “True value = |- 0.07889) = 7889%., iv) Relative nue erroris & ~0.07889. [Absolute relative rue error ‘True percentage error b) i) Using h=03,we get £(2)= 10.2686. ii) Using h= 0.15, we get_£(2) = 9.8799. ii) So the approximate error = Present Approximation ~ Previous Approximation = 9.8799 ~ 10.2646 = — 0.3847. —Approximate error_ _ = 0.3847 [Relative approximate error = APBDRime STO. OARET «0.03804, Absolute relative approximate eros is 3.894%. Round off the nunbers 865250 and 3746235 to four significant figures and comes (rv ae 3) Given umber is (4) = 865250. Number rounded off to fou significant figures is (X,) = 65200. Absolte Emor (E,) = |Xe~Ma| = [865250 ~ 865200 = 50, Retivetmor 6) =| | = ag Percentage Eno (E,) = E,* 100% = 5:78» 10” 1) Given number is (4) = 3746235. [Number rounded of to four significant Sigues is (X,) = 37.46. Absolute Error (E,) = | Xe~Xi{ = (3746235 -37.46 |= 0.0235. 5.18 10°, Y __ Inoduction, Approximation and Errors in Computation 1S jxample 1.4.3] Find the absolute error if the number X= 0.00456789 is (i) truncation to three decimal digits, (i) rounded of to three decimal digits Solution; Given exact value is X, = 0.00456789 = 0.456789 » 10°, i). After rncating to thre decimal places, its approximate value Ny = 0856. 10°. Absolute eror = |X Xe) = 0.789 10% < 1074, Note. This proves the rule: Absolute eror due to truncation to k digits = | ;—X| <10"4 {i) After rounding of to tree decimal places, its approximate value y= 0457 + 102 Absolute eror = |, | 211 «10% whichis < 05 «10° [Note This proves the rule: Absolut error due to rounding off 0 k digits =| Xp —X,< 0.5 x 10". Find the relative err if the number X= 0.008997 is i) tuneaed to three decimal digits (i) rounded off to thre decimal digits 008997 = 0.899% 107 i) After truncating tothe thre decimal places, its approximate value is X, = 0899 210°, Relative enor = | 2&=4a | _ |08997 107 0.899 « 10°) Te 09997 10 = 078 10° < 10" Nate. This proves the rule: Relative error due to truncation tk digits < 10" i) Afr rounding off to three decimal places, the approximate value of the given number is 2%, =0.900» 10°. Relative error || fossststo—a009 «we Xr DA99T = 10 = 0333107 (0.033 « 10" which is tess than 0.5 10° ‘Note. Ths proves the rule: Re Wve eror due to rounding offto k digits <0.5 x 10%, Exercise 1.4 dy cone ee a el 2. What are the applications of Numerical Methods in the field of sci .s? ret er 3 Dosa econ mes tis wih example We diaeresis andl orth ppropa campen yn asec ets hoe Souoan dig fade sali acer 1A Texto o mera Mad Round off he amber 754624 four significant digs ad then calculate the able ga percentage eer. % 61103333 sth approximate vale of find the sso and eave err 2. Find he relive erin the king £= 314159268 as 23/7 Tue height of a bueraton tower was estimated oe 49 whereas it act eight way 4 Cane he percentage elatve eo in the measirement . ‘A student measures the lengths of a bridge and a rivet as 9999 and 9 cm, respectively. I ‘alues are 10,000 and 10 om respectively, compute the percentage relative errr in each ease ey 10. Find the value of e using series expansion error les than 0,005. 11. Given a=9.00 0.08, b= 0.0356 + 0.0002, value of absolute err in a+b +c +d. 12, Find the absolute error and the relative error in the product of 432.8 and 0.12584 using four dg, mantissa. With an abou 5300+ 100, d = 62000 + $00, Find the maxing 1.5 Taylor's series “The Taylor series is given by froth = faa =h Oe + FP Ud + FPO + ~ +f where xp = base value or starting value {x = the point at which the value ofthe function is needed = x~%= distance between 19 and x (step size) nin-1)(n~2) .. 21 indicates the n* derivative of the function f(x) ‘the remainder of Taylor series expansion, “Taylor series expansion can also be given ina compset form as follows: to) = t+ = EE Ceo ‘where 0! = 1 by convention. The above equation is based on the assumption that continuous erivative exist in an interval that include the points x and. Characteristics of Taylor Series 1. Taylor series provides a means wo predict function value atone point in terms ofthe Function vat and its derivatives at another point 2. Taylor series is commonly used in engineering analysis to approximate functions that donot closed form solution, ‘3. Taylor series i the sum of functions based on continually inereasng derivatives. Definition: The order of the approximation is defined by the order of the highest derivative ih! {included in te approximation, First-order approximation (two terms) fla +h) = fl) +h fx), Second-order approximation (three terms) f+) = (ey +h M0) + Pe. dander approximation (our ers) : F feo) = foo ha 6 Poe +5 1] (Taylor Series) Devclopa Taylor series expansion ofthe function: {(e)= °—3r"+8 = 3 asthe base (or starting) point and has the increment. (i = 0-30 +8 = (0)=170 ‘The function as the following derivatives: Use ree 14) S892 = (0) = 324 1) =208- 18k (PG) = 486 Pe) = 60-18 > = 2 (%) =1200 = = 360 #8) = 120 = 120 fe) = 0 > ° “The Taylor series given by {059 +h) = (oe) +h O00) + Fe) + . Ee Bp 4a) + a +H U0) + Rot “ « + 360% + 120 5 (c= ge = 179630684865 + 1.6 Finite Differences; Difference, Shift and Differential operators Lot of operators are used in numerical analysis/computation. Some ofthe frequently used operators are forward difference operator (A), backward difference operator (V). central difference operator (8). Shift ‘operator (E), Average operator (ji) Differential Operator (D) ete 1.6.1 Finite Differences and Difference Operators Suppose we have a table of values, :) = 0 1,2, oF any function {(2) with x= + th, =. 1,2, nt If we have o find the value {(x) for some intemedate value of x orto obiain the derivative of {(x) for some x in the range 10 Sx tq then the meth forte solution to these problems are based on the concept ofthe differences of unc ‘Let the fumetony = (x) be defined onthe closed interval [2 8] ad Lt x= 45 Bethe (+1) salues of x. Assumed that thee values ae equidiance, Le. 5; = x9 + =O, 1,2, om is a suitable real number called the difference ofthe itera or spacing. When x =. the value of vis denote by » and is defined by»; = (cx) = {Cte + ih). The values of x and y are called arguments and entries respectively. The differences ~ yu): Vics Ba Ye ae calle the frst differences ofthe Function y “They are denoted by Ay Ae et. Thais Avv=M— Yo Aedes Ae ‘The symbol Ais called the difference operator. 1.6.2 Forward Differences and Forward Difference Operators ‘The forward diference denote by A{() is defined by Afi) = fhe + f00. o When x=, then from above equation Aft) = flr. 10~ f(x), ie. Ay, Mar rMis 12012, od 2 “18 _A Texthook of Numerical Methods ‘The differences Avo = y1 Ye AM =¥2 ‘The second forward differences are the differences of the first differences Yo metas v2 ‘Ayes =Yn— Yes are called first forward ditt ey Ad =I = Aly = yan —2et ver = Ave Aes Generalization: AMG) = ATE +N) — (= ATH -™"OD a By, = AM ya — OT = 3, ‘where the difference operator A” is called mh forward difference operator, is Identity opery, ie. A°f@)= f@)and A! {0)=Af(0. “The forward difference table for the five arguments x, 12 11,4 is as follows: ‘Table: Forward difference x z ay | sy [ae ay a] ¥ an * n ay ay * » An a: an 5 » an 4 un [om a ay a |» | “The table in which forward differences i shown forthe arguments is known as diagonal difees table or forward difference table. The fist term yy is called leading term and the differences Sn Ayn A'yy are called leading differences. The differences Ay with fixed subscript ‘i” are callt forward diferences an they lie slong the diagonal downward sloping. Properties of the Operator A Let (2), be functions, a, b be constants and m, n be postive integers. Then UVAfe)= (+h) - ()=c-¢=0) 2 Afaf(x) + bg(x)] = aAl f(x)] + bAlgtx)). 3. AA") =A") 4. A[ f(x) gx] = fix + A) Aglx) + gtx) Af(a). ‘Hit. Af fx) atx) = (0+) ah + 1) ete) (C2) = (Gch) whet) — (ox) a) + (och) g)- at) (0 _ AG) Aas) sf) Af) str +) bets) ) 6. Let the function y = {() take the values yp, 9, ya --. pq correspond : Dae Ie ling tothe values xo, x0 +. Bho %+ MOF Then A= Ye~Clm Les + Cin 2a + lp Hin. [2] = ete Introduction, Approximation and Exors in Computation 19 Yim Yat yo= I-20 = 0B, d 2 6B, Dy + Dye ‘Aye = 91~ See A= By — Mo ‘lyn = Avs 2B + Avo = Y= 22-3 Sitar, 80 = ya CU Der # UR na = = fa) take the values ym yu yn Ye comespoding to the ves 20+ We have, 71. Let the function y es see Dh vnvtet mhof x Them Y= (1-4 BYY9= Yor CU 1) Ayo + Cl 2) By + BY. Wehave, Ae 1- 3% (+ ap dy = (1+ Ayn = +4)%0 bn =H n+ yr (L4Ap2 =04 80% Similarly, ye = (148) %0= Jot Cln 1) Aye + Clr, 2) +BY 1.6.3 Backward Differences and Backward Difference Operators ‘The backward diflerences are defined 3s Vile) = fe) ~ (-h). oo () “This equation canbe written as Vy =~ ened 2 Bot “These differences Vi =91—¥o Wi =Ve— Vivo Wa Pao ine called frst backward differences and the symbol V is called first backward difference operator ‘The second backward differences are. 75 Hence, Vin = VOR) = PO2—W Generalization: V'y = V™'y — VT Vy vy. where the symbol, V"is called nth backward difference operator, Vy; = »; and V' “The backward difference table forthe five arguments, x... 4 is given follows: ‘Table: Background differences z z oi ey wy | ¥ * » wn * ” vn ve vy s v vs vn ws vr. % » vn Wy The table in which backward differences is shown for the arguments is Known as backward Ja = Yer“ Ves= Vyas = Vi yy Ves = Yor— Jas =P Yea = Yer ~VIea= (I Vy =(- Vy ‘Similarly, yn =C1— W)¥e= Ye CU 1) Vye+ UK. 2) Pre = + DEV 1.6.4 Central Differences and Central Difference Operators eworsovard and backward nteroltinfrmalac apple for iteration hee seee ute sue Now we shall dvlo etal dence frmune whch are bx a ‘mepnotontea mal feb atthe fiction = (be defined on he lost inteval 28] a) YB BE a the pinata Then the ifleence sie s B69 = (+2) (-W2) scaled central iference ad symbol 8iscalled is cll the central difeences operator. Then he it centr ference nts fy i writen as By. = yeaa Vian, Where yyia= (+2) and yiaa= (x h?). Hence the first central difference are Byia = Yo Byya= Y Yoo Bata Ya Yt ‘The second central difference are By: = Byiua— Byran = Wisi ~V~ 04 ~Ye= Year — WAY Ingeneral, By; = 8a - 8 yar ‘The central difference table for the five arguments xy ~ 2h, x9 h, x0 + hy x0 + 2h fx takes the values ~ 2h, x0 — h, x4 9+ h, x0 + 2h and the corresponding values “yous Ys then we can waite the difference table in the two notations as follows: = z aiff Ind dif | Sed fk [_—-Ah ai moh | ya dys B70) Xo-h va Sy= Fy) Ay © 6¥12) aiyl= B10) | x we Aye By) ay 8yn2) Syeda) nth | on Ay (= 8ys0) th Note. All odd differences have fraction suffices and all the even difference are with integral sf 1.6.5 Divided Differences I (x, yuh Cee Ys Oa, 32)» Be given points, then the first divided difference forthe arguments" denoted by [re] oF {Cx xi) i defined by the relation Inrodvetion, Approximation and Errors in Compulsion _24 (00.4) = fron) = Lea, at Similarly, fn) = SE and fs.) = BoE ete “Te second divided difference for 2,33 8 defined as fron} = Hash Leatl “The third divided difference forx,x,t2 4 i defined as eee rary Cor: boa] = Note. Tr the divided differences are symmetrical in their arguments ic. independent of the order of the arguments. For it is easy to write TE «Bish borin Peraevery fritata) oF fq 25.21) and $0 0n fon = 2 The th divided differences of a polynomial ofthe nth degree are constant. 1.6.6 Shift Operator, Average Operator and Differential Operator Shift Operator, E: Let the function » = {(x) be defined onthe closed interval [a 6} and let the als of fa) at = 9+ th, = 0,102. Be (x)= {G50 + i). Then the shifting (ie, right Shifting) ofthe function (() is defined by Ett) = (ee) o Be =H So shift operator £ shifts the function tothe next higher vay. The second shift operator gives E fea) = LE (0) = Ax + Wi] = +2, “The shi operator E is tinear and obeys laws of indices. Generalizing we wt E{l)= teen) on Ey “The inverse shift operator Ee. let shifting ofthe funtion (x) is defined by Ee) = Similar E“{() = (nh. “The more general form of E operators E f(x) = {(x-+ rh) where ris positive as well as negative rational Average Operator 1: The average operator denoted by 1 is defined as L f(s) $104 02+ (WD ee wor =F aaty ve) Differential Operator D : Ifthe function {(x) is differentiable then the first order differential ‘operator denoted by Dis defined as Dic = £ (eo= ft) = jig, eB Simi, D'{() = (= ("scaled second order differential operator and 0 om. 22_A Textbook of Numerical Metbods 1.6.7 Summary and Relation among Operators tn order to develop approsmation o differential equations, the fllowing summary Of OPETAO ‘Operator: Definition Forward differences operator & Ala) = (4A) (0) ‘Backward diferences operator V Via) = (@)—(@-h ‘Central diferences operator 5 Blix) = (Gr h)— (wh) Shift Operator E E{G) = (+h) ‘Average operator fa) = 05 (e+ 2) + (Ce H2)) Differential operator D Die) = (9. Relation among Operators If be fimetion (() is defined on a interval, isthe difference interval then ie, AfG)= +) (6= EfG)- (6) =(E-1) (6) Vie) = (= (&-A= (Ea) =01-E 1) 2 V=1-E* ic, LEM ie, Ele) = (+ A2)—f WD) = EM) EE) = (EF EM iy EV=VE=6E" ie, EV{)= AL{(e)~ (6 W]= Ef@)- Ele —M= (+h) (0) ie, AV(G)= A[{G)- f@-A]= AfG)-afe-) = B(x + W2)— Bf -W2)= 8 {) 5. aV=VA=8 6 (A-AD=L i 1% “Taylors series Formula: ((r+ A) = fix) +h (10) +3507 (a) + 37H £0) + Eta) = {@)+AD{Q) +H ¥ Da) +5" DG) + becomes = (@)+hD{) + qh D(a) + Hh DI) + = Le hD+ EP D+ ZR D +] (0) = &(@) Therefore, E =e? Also, hDine = InE So, hp = n(ieayna—daretar-dat La-vyae! ad Da H(oedvisdostots-) ‘Taylors series Formula: ((<—A) = {(2)—h (12) +370 (0)— HP ("+= becomes Ef) = f(x) ADI) + Dif) ph DM) +~ = [1-hD+ ER DFR D+] (@) =” () ‘Therefore, E' =e". Also, -hDine = InE* So, AD = In (1-9) =-V-F P-L 0-3 m Intaduction, Approximation and Esors in Computation 23 Solved Examples 7] Generate forward diferente rom the following data (71 He 200 Chis of 3 43 6] of eT) Forward difference Table yyy aD —_ay 2 ' 2 s 7 1 2 9 2 a 9 6 1 3 * 18 ° 1 yw 6 ° 4 6 En o on 6 5 126 0 3 Example 1.62] Generate difference able for y= {(2)=1° +e | for x Solution: Forward diference Table = = 1) oy ay a ay 1 4 ’ 2 » 2 x ‘ 3 ou 6 ° » ‘ 4 3 Pa e s bs [Erampie 1.63] Oban backward diferences for (2) Prom 1 to 1.05 ot decimals chopped. Solution: Backward diference Table = oy wy vy 10 1030 Lor 1030 2001 oat 2.001 Le 1061 000 02 ost o.001 0.003 Loa 1092 o.00t a0 1032 ‘1000 Loans 001 033 Las? —_— eeet—~—™ 24 _A Tentbook of Numerical Methods — awe mane . a introduction, Approximation and Eoin Computation 28 Example 164] Obtain divided difterences table fom the following data — a —lodecin, Approcinton sd Eros Compotstion Ce TeTsT7 [Teter 2. Absolute Error in Subtraction ToL a8_| 100 | 298900 [1210 | 3028 KAY = Ut Ea) ("+ Ea) = 1) + Ew Eo) i Solution: Divided Difference Table JO-N-O-V)1 = |Fa- En| $1 El +1 Eo| is ie am Po ie gg ich me ied 3. Absolute Error in Multiplication differences __diflerences__ differences differences “ Aerio era Then By = KE + YE Eakin = XEq + YEm approximately. i 1.7 Error Propagation The propagation of eros in invidual mathematical operations, suchas adtion, mliplicaton, ig suber 1 powers, canbe determin wth pei aalytal formulas, However, the sales of opagatin of emorsthrougha model is frequently most easly accomplished numerly 1a number of computational steps are cated out for the solution of a problem, then i cesar to understand the Way the ero propagates with progressive computation Find te bounds forthe propagation in adding to numbers fone is eseuaing X+Y where K=1.5£005,=34 008 Solution: Maximum possible valusof’ X= 185 and Maximum posible ale of + Y= 155 +344=4.99, Minimum possible vale of X= 145 and ¥=3.36, Minimum possible vahe of X+ ¥= 145 +336-=481 Hence asisx+rcan, a ‘Let 1° and Y° be the approximate values of two numbers X and Y respectively. Then the absolut error are Ea = XX and Ey = ¥-¥" 1. Absolute error in addition AY =H Eq) +4 Ea) = (U8 4 Eat By) [A+ 9-004 1)|=| Bet By |<| El +| El where Yq and Ere assumed reasonably small so that EE, can be ignored 4. Absolute Error in Division “The absolute eror E, in the quotient of two numbers X and ¥is given by XeEy KX YeNE. Veg =XEe O° VeR, YW +E) FUE TNE ssming Ete sl t Find the absolute eror and relative eror in J + f7 + 8 correct to 4 significant digits Solution: We have V6 = 249, V7 =2.616, YR = 2.828 5 = YBVTHNH = 7923 ‘Then the absolute enor Ein Sis , = 0.0005 + 00007 + 0.0004 = 0.0016 “This shows that S is comect wo 3 significant digits only. Therefore, we take § = 7.92. Then the relative ero, 0.0016 1.8 General Error Formula 1.8.1 Error in the Approximation of a Function Consider the function y= fsy.22) where xx: ae variables. IFS, Ses represent the errors in, the error yin vis given by y+ 60s flat Brn 2+. Expanding the right hand side by Taylor’ serie, we get y= tovee(thane 2b then ) teminvaing ihr ove tad {the errors Sx, rz beso small that their second and higher powers can be neglected, then (i) gives ty Bla + ey gprs Hee y= than s See

You might also like