Documente Academic
Documente Profesional
Documente Cultură
New Delhi Bangalore Chennai Cochin Guwahati Hyderabad Jalandhar Kolkata Lucknow Mumbai Ranchi Visit us at www.newagepublishers.com
Copyright 2006, 2002 New Age International (P) Ltd., Publishers Published by New Age International (P) Ltd., Publishers All rights reserved. No part of this ebook may be reproduced in any form, by photostat, microfilm, xerography, or any other means, or incorporated into any information retrieval system, electronic or mechanical, without the written permission of the publisher. All inquiries should be emailed to rights@newagepublishers.com
NEW AGE INTERNATIONAL (P) LIMITED, PUBLISHERS 4835/24, Ansari Road, Daryaganj, New Delhi - 110002 Visit us at www.newagepublishers.com
To My father,
G. Narayana Rao
G. SHANKER RAO
(vii)
G. SHANKER RAO
(ix)
CONTENTS
Preface to the Third Edition Preface to the First Edition CHAPTER 1Errors 1.1 1.2 1.3 1.4 1.5 1.6 1.7 Introduction 1 Significant digits 1 Rounding off numbers 2 Errors 3 Relative error and the number of correct digits 5 General error formula 10 Application of errors to the fundamental operations of arithmetic 11 Exercise 1.1 15 1959 vii ix 118
CHAPTER 2Solution of Algebraic and Transcendental Equations 2.1 2.2 2.3 2.4 2.5 Introduction 19 Graphical solution of equations 20 Exercise 2.1 21 Method of bisection 22 Exercise 2.2 24 The iteration method 25 Exercise 2.3 32 NewtonRaphson method or Newton iteration method 33 Exercise 2.4 41 Exercise 2.5 43 Generalized Newtons method for multiple roots 46 Exercise 2.6 51 RegulaFalsi method 52 Mullers method 55 Exercise 2.7 59
CHAPTER 3Finite Differences 3.1 3.2 3.3 Introduction 60 Forward difference operator 60 The operator E 69
(xi)
6095
(xii)
The operator D 73 Backward differences 74 Factorial polynomial 76 Error propagation in a difference table 82 Central differences 83 Mean operator 84 Separation of symbols 86 Herchels theorem 92 Exercise 3.1 93 96115
CHAPTER 4Interpolation with Equal Intervals 4.1 4.2 4.3 4.4 4.5 4.6 Introduction 96 Missing values 96 Newtons binomial expansion formula 96 Newtons forward interpolation formula 98 NewtonGregory backward interpolation formula 104 Error in the interpolation formula 107 Exercise 4.1 109
CHAPTER 5Interpolation with Unequal Intervals 5.1 5.2 5.3 5.4 Introduction 116 Newtons general divided differences formula 120 Exercise 5.1 122 Lagranges interpolation formula 123 Exercise 5.2 125 Inverse interpolation 127 Exercise 5.3 132
116133
CHAPTER 6Central Difference Interpolation Formulae 6.1 6.2 6.3 6.4 6.5 6.6 Introduction 134 Gauss forward interpolation formula 135 Gauss backward interpolation formula 136 Bessels formula 137 Stirlings formula 138 LaplaceEverett formula 139 Exercise 6.1 147
134150
CHAPTER 7Inverse Interpolation 7.1 7.2 7.3 Introduction 151 Method of successive approximations 151 Method of reversion series 156 Exercise 7.1 162
151163
(xiii)
CHAPTER 8Numerical Differentiation 8.1 8.2 8.3 8.4 Introduction 164 Derivatives using Newtons forward interpolation formula 164 Derivatives using Newtons backward interpolation formula 166 Derivatives using Stirlings formula 167 Exercise 8.1 174
164177
CHAPTER 9Numerical Integration 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 9.10 9.11 9.12 Introduction 178 General quadrature formula for equidistant ordinates 179 Trapezoidal rule 180 Simpsons one-third rule 181 Simpsons three-eighths rule 182 Weddles rule 184 Exercise 9.1 192 NewtonCotes formula 195 Derivation of Trapezoidal rule, and Simpsons rule from NewtonCotes formula 197 Booles Rule 200 Romberg integration 201 Exercise 9.2 205 Double integration 205 Euler-Maclaurin summation formula 208 Exercise 9.3 211
178211
CHAPTER 10Numerical Solution of Ordinary Differential Equations 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 Introduction 212 Taylors series method 213 Eulers method 217 Modified Eulers method 218 Exercise 10.1 223 PredictorCorrector methods 224 Milnes method 224 Adams BashforthMoulton method 230 Exercise 10.2 232 Runge-Kutta method 233 Exercise 10.3 240 Picards method of successive approximation 242 Exercise 10.4 246
212247
CHAPTER 11Solution of Linear Equations 11.1 Matrix inversion method 248 Exercise 11.1 250
248267
(xiv)
11.2 11.3
11.4
GaussElimination method 250 Exercise 11.2 252 Iteration methods 253 Exercise 11.3 255 Exercise 11.4 258 Crouts triangularisation method (method of factorisation) 258 Exercise 11.5 266 268281
CHAPTER 12Curve Fitting 12.1 12.2 12.3 12.4 12.5 Introduction 268 The straight line 268 Fitting a straight line 268 Fitting a parabola 272 Exponential function y = aebx Exercise 12.1 278
272 282299
CHAPTER 13Eigen Values and Eigen Vectors of a Matrix 13.1 13.2 12.3 Introduction 282 Method for the largest eigen value 290 Cayley-Hamilton theorem 294 Exercise 13.1 298
CHAPTER 14Regression Analysis 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 14.10 14.11 14.12 14.13 14.14 Regression analysis 300 Correlation 300 Coefficient of correlation (r) 300 Scatter diagram 300 Calculation of r (correlation coefficient) (Karl Pearsons formula) 302 Regression 302 Regression equation 303 Curve of regression 303 Types of regression 303 Regression equations (linear fit) 303 Angle between two lines of regression 306 Solved examples 307 Multilinear linear regression 314 Uses of regression analysis 316 Exercise 14.1 316
300319
Bibliography Index
320 321322
1
ERRORS
1.1 INTRODUCTION There are two kinds of numbersexact and approximate numbers. An approximate number x is a number that differs, but slightly, from an exact number X and is used in place of the latter in calculations.
The numbers 1, 2, 3, , manner are also exact. 1.41 is an approximate value of
2. Similarly
1.2 SIGNIFICANT DIGITS The digits that are used to express a number are called significant digits. Figure is synonymous with digit. Definition 1 A significant digit of an approximate number is any non-zero digit in its decimal representation, or any zero lying between significant digits, or used as place holder to indicate a retained place. The digits 1, 2, 3, 4, 5, 6, 7, 8, 9 are significant digits. 0 is also a significant figure except when it is used to fix the decimal point, or to fill the places of unknown or discarded digits. For example, in the number 0.0005010, the first four 0s are not significant digits, since they serve only to fix the position of the decimal point and indicate the place values of the other digits. The other two 0s are significant. Two notational conventions which make clear how many digits of a given number are significant are given below.
1. The significant figure in a number in positional notation consists of: (a) All non-zero digits and (b) Zero digits which
1
NUMERICAL ANALYSIS
(i ) lie between significant digits (ii ) lie to the right of decimal point, and at the same time to the right of a non-zero digit (iii ) are specifically indicated to be significant 2. The significant figure in a number written in scientific notation (M 10n) consists of all the digits explicitly in M. Significant figures are counted from left to right starting with the left most non zero digit.
Example 1.1 Number 37.89 5090 7.00 0.00082 0.000620 5.2 104 3.506 10 8 103 Significant figures 3, 7, 8, 9 5, 0, 9 7, 0, 0 8, 2 6, 2, 0 5, 2 3, 5, 0, 6 8 No. of Significant figures 4 3 3 2 3 2 4 1
1.3 ROUNDING OFF NUMBERS With a computer it is easy to input a vast number of data and perform an immense number of calculations. Sometimes it may be necessary to cut the numbers with large numbers of digits. This process of cutting the numbers is called rounding off numbers. In rounding off a number after a computation, the number is chosen which has the required number of significant figures and which is closest to the number to be rounded off. Usually numbers are rounded off according to the following rule. Rounding-off rule In order to round-off a number to n significant digits drop all the digits to the right of the nth significant digit or replace them by 0s if the 0s are needed as place holders, and if this discarded digit is
1. Less than 5, leave the remaining digits unchanged 2. Greater than 5, add 1 to the last retained digit 3. Exactly 5 and there are non-zero digits among those discarded, add unity to the last retained digit However, if the first discarded digit is exactly 5 and all the other discarded digits are 0s, the last retained digit is left unchanged if even and is increased by unity if odd. In other words, if the discarded number is less than half a unit in the nth place, the nth digit is unaltered. But if the discarded number is greater than half a unit in the nth place, the nth digit is increased by unity. And if the discarded number is exactly half a unit in the nth place, the even digit rule is applied.
ERRORS
Example 1.2 Number Three figures 00.522341 93.2155 00.66666 Example 1.3 Number Rounded-off to Four significant figures 9.678 29.16 3.142 30.06 00.522 93.2 00.667 Rounded-off to Four figures 00.5223 93.22 00.6667 Five figures 00.52234 93.216 00.66667
1.4 ERRORS One of the most important aspects of numerical analysis is the error analysis. Errors may occur at any stage of the process of solving a problem. By the error we mean the difference between the true value and the approximate value. Error = True value Approximate value. 1.4.1 Types of Errors Usually we come across the following types of errors in numerical analysis. (i) Inherent Errors. These are the errors involved in the statement of a problem. When a problem is first presented to the numerical analyst it may contain certain data or parameters. If the data or parameters are in some way determined by physical measurement, they will probably differ from the exact values. Errors inherent in the statement of the problem are called inherent errors. (ii) Analytic Errors. These are the errors introduced due to transforming a physical or mathematical problem into a computational problem. Once a problem has been carefully stated, it is time to begin the analysis of the problem which involves certain simplifying assumptions. The functions involved in mathematical formulas are frequently specified in the form of infinite sequences or series. For example, consider
sin x = x x3 x5 x 7 + + ... 3! 5! 7!
sin x = x
x3 x5 + , 3! 5!
NUMERICAL ANALYSIS
F1 x + x x I x = 0 , GH 2! 3! J K
2 3
involves an analytical error. The magnitude of the error in the value of the function due to cutting (truncation) of its series is equal to the sum of all the discarded terms. It may be large and may even exceed the sum of the terms retained, thus making the calculated result meaningless. (iii) Round-off errors. When depicting even rational numbers in decimal system or some other positional system, there may be an infinity of digits to the right of the decimal point, and it may not be possible for us to use an infinity of digits, in a computational problem. Therefore it is obvious that we can only use a finite number of digits in our computations. This is the source of the socalled rounding errors. Each of the FORTRAN Operations +, , *, /, **, is subject to possible roundoff error. To denote the cumulative effect of round-off error in the computation of a solution to a given computational problem, we use the computational error and the computational error can be made arbitrarily small by carrying all the calculations to a sufficiently high degree of precision. Definition 2 By the error of an approximate number we mean the difference between the exact number X, and the given approximate number x. It is denoted by E (or by )
E = = X x.
Note An exact number may be regarded as an approximate number with error zero.
Definition 3 The absolute error of an approximate number x is the absolute value of the difference between the corresponding exact number X and the number x. It is denoted by EA. Thus
EA = X x
Definition 4 The limiting error of an approximate number denoted by x is any number not less than the absolute error of that number. Note From the definition we have
E A = X x x .
Therefore X lies within the range
x x X x + x
Thus we can write X = x x Definition 5 The relative error of an approximate number x is the ratio of the absolute error of the number to the absolute value of the corresponding exact number X, where X 0 . It is denoted by ER (or by )
ER = =
EA . X
ERRORS
Definition 6 The limiting relative error x of a given approximate number x, is any number not less than the relative error of that number. From the definition it is clear that
E R x ,
i.e.,
EA x , X
E A X x
In practical situations X x. Therefore we may use x = x x . If x denotes the limiting absolute error of x then
ER =
x , for the limiting error of the number x. x x Definition 7 The percentage error is 100 times the relative error. It is denoted by Ep. Ep = ER 100.
Thus we can write x =
1.5 RELATIVE ERROR AND THE NUMBER OF CORRECT DIGITS The relationship between the relative error of an approximate error and the number of correct digits: Any positive number x can be represented as a terminating or non-terminating decimal as follows:
x = m 10 m + m 110m 1 + ... + m n + 110 m n + 1 + ...
(1)
where i are the digits of the number x, i.e., (i = 0, 1, 2, 3, , 9) and m 0 (m is an integer). For example: 1734.58 = 1.103 + 7.102 + 3.101 + 4.100 + 5.101 + 8.102 + Now we introduce the notation of correct digits of an approximate number. Definition 8 If the absolute error of an approximate number does not exceed one half unit in the nth place, counting from left to right then we say that the first n significant digits of the approximate number are correct. If x denotes an approximate number as represented by (1) taking the place of an exact number X, we can write
E A = | X x|
FG 1 IJ 10 H 2K
m n +1
then by definition the first digits m , m 1 , m 2 , ..., m n +1 of this number are correct. For example if X = 73.97 and the number x = 74.00 is an approximation correct to three digits, since
NUMERICAL ANALYSIS
X x = 0.03 <
1 (10)1 3 + 1 , 2 1 01 . . 2
i.e.,
E A = 0.03 <
b g
Note 1. All the indicated significant digits in mathematical tables are correct. 2. Sometimes it may be convenient to say that the number x is the approximation to an exact number X to n correct digits. In the broad sense this means that the absolute error EA does not exceed one unit in the nth significant digit of the approximate number.
Theorem If a positive number x has n correct digits in the narrow sense, the relative error ER of
F 1 I divided by the first significant digit of the given number or this number does not exceed G J H 10 K 1 F 1I E G J , where is first significant digit of number x. H 10 K
n 1
n 1
Proof
Let
x = m 10 m + m 110m 1 + ... + m n + 110 m n+1 + ...,
( where m 1)
denote an approximate value of the exact number X and let it be correct to n digits. Then by definition we have
EA = X x X x 1 10 2
b g
m n +1
Therefore
1 (10) m n + 1 . 2
1 m 1 10 2 m n 1 , 2 10 1 10 2
FG H
IJ K
b g b2
m
1.
ERRORS
Since
2 m 1 = m + ( m 1) m
we get
1 m 10 m . 2
m n +1 1 E A 2 10 ER = . m 1 X 10 m 2
1 ER m
FG 1 IJ H 10 K
n 1
proving the theorem. Corollary 1 The limiting relating error of the number x is x = significant digit of the number x.
1 m
FG 1 IJ H 10K
n 1
, where m is the
Corollary 2 If the number x has more than two correct digits that is n 2 , then for all practical purpose the formula
E R = R =
1 1 2 m 10
FG IJ H K
n 1
holds.
1.5.1 Important Rules Rule 1 If x is the approximate value of X correctly rounded to m decimal places then
X x 1 10 m 2
NUMERICAL ANALYSIS
Rule 5 If a number is correct to n significant figures, and the first. Significant digit of the number is m , then the relative error E R <
1 . m 10n 1
20 so that the error does not exceed 0.1%?
Example 1.4 How many digits are to be taken in computing Solution The first digit of
20 is 4.
m = 4 , E R = 0. 001
1 m
FG 1 IJ H 10 K
n 1
1 0.001 4.104 1
10n 1 250 n 4.
Example 1.5 If X = 8 and the exact decimal representation of X is 0.888 , verify rule 1, numerically when X is 9 rounded-off to three decimal digits. Solution We have
X =
8 , k = 3 9
EA =
8000 8001 1 = 3 9 10 9 10 3
1 1 10 3 < 10 3 9 2 1 10 3 2
EA <
Hence, rule 1 is verified.
1.5.2
Tables for Determining the Limiting Relative Error from the Number of Correct Digits and vice-versa It is easy to compute the limiting relative error of an approximate number when it is written with indicated correct digits. The table given below indicates the relative error as a percentage of the approximate number depending upon the number of correct digits (in the broad sense) and on the first two significant digits of the number, counting from left to right.
ERRORS
The table below gives upper bounds for relative errors (in %) that ensure a given approximate value, a certain number of correct digits in the broad sense depending on its first two digits. Number of correct digits of an approximate number depending on the limiting relative error (in %).
First two significant digits 1011 1213 14, , 16 17, , 19 20, , 22 23, , 25 26, , 29 30, , 34 35, , 39 40, , 44 45, , 49 50, , 54 2 4.2 3.6 2.9 2.5 1.9 1.9 1.7 1.4 1.2 1.1 1 0.9 n 3 0.42 0.36 0.29 0.25 0.19 0.19 0.17 0.14 0.12 0.11 0.1 0.09 4 0.042 0.036 0.029 0.025 0.019 0.019 0.017 0.014 0.012 0.011 0.01 0.009 Contd.
10
NUMERICAL ANALYSIS
First two significant digits 55, 60, 70, 80, , , , , 59 69 79 99 2 0.8 0.7 0.6 0.5
1.6 GENERAL ERROR FORMULA Let u be a function of several independent quantities x1, x2, , xn which are subject to errors of magnitudes x1, ..., xn respectively. If u denotes the error in u then
u = f x1 , x2 , ..., xn
u + u = f x1 + x1 , x2 + x2 , ..., xn + xn .
Using Taylors theorem for a function of several variables and expanding the right hand side we get
u + u = f x1 , x2 , ..., xn + x1
terms involving xi
f f f + x2 +... + xn + x1 x2 xn
b g
, etc.,
u + u = u +
terms involving xi
f f f x2 + L + xn + + x1 x1 x2 x
2
b g
, etc.
The errors x1 , x2 , ..., xn , are very small quantities. Therefore, neglecting the squares and higher powers of xi , we can write
u f f x x1 + x2 + ... + xn . x1 x2 xn
(1)
FG H
IJ K
(2)
FGQ f H x
u xi
IJ K
ERRORS
11
1.7
u = x1 + x2 + ... + xn
u = E A = x1 + x2 + ... + xn
Thus the absolute error of an algebraic sum of several approximate numbers does not exceed the sum of the absolute errors of the numbers.
Note To add numbers of different absolute accuracies the following rules are useful: (a) Find the numbers with the least number of decimal places and leave them unchanged. (b) Round-off the remaining numbers retaining one or two more decimal places than those with the smallest number of decimals. (c) Add the numbers, taking into account all retained decimals. (d) Round-off the result obtained by reducing it by one decimal.
u = x1 x2
(iii) Multiplication (a) A simple formula for the absolute error in a product of two numbers is given below. Let X = x1 x2, and EA denotes the absolute error in the product of the given numbers then
E A = x1 + x1
g bx
+ x2 x1 x2
= x1x2 + x2 x1 + x1 x2 , E A = x1 x2 + x2 x1 ( approximately).
and the relative error in X is given by
ER = x x2 EA X = = 1 + X X x1 x2
(b) The relative error in the product of n numbers is given below: Let X = x1, x2, , xn and x1 , x2 , ..., xn , denote the absolute errors in x1, x2, , xn respectively. Then the relative error in X is given by
12
NUMERICAL ANALYSIS
ER =
X x x x = 1 + 2 + ... + n X x1 x2 xn
(iv) Division For formula for the absolute error of a quotient can be found as shown under: Let EA denote the absolute error in
x1 the x2
EA =
=
x1 + x1 x 1 x2 + x2 x2
x1x2 + x2 . x1 x1x2 x1 . x2 x2 ( x2 + x2 ) x1 =
x x x1x2 = 2 1 x2 x2 + x2
FG x x x x IJ H xx K b x + x g
2 1 1 2 1 2 2 2
x1 =
FG x Hx
x2 x2
x2 + x2
IJ K
OP Q
x1 x2
LM x x OP Nx x Q FG1 + x IJ H x K
1 2 1 2 2 2
x1 x2
Example 1.6 Round-off 27.8793 correct to four significant figures. Solution The number 27.8793 rounded-off to four significant figures is 27.88. Example 1.7 Round-off the number 0.00243468 to four significant figures. Solution The rounded-off number is 0.002435. Example 1.8 Find the sum of the approximate numbers 0.348, 0.1834, 345.4, 235.2, 11.75, 0.0849, 0.0214, 0.000354 each correct to the indicated significant digits. Solution 345.4 and 235.4 are numbers with the least accuracy whose absolute error may attain 0.1. Rounding the remaining numbers to 0.01 and adding we get 345.4 + 235.2 + 11.75 + 9.27 + 0.35 + 0.18 + 0.08 + 0.02 + 0.00 = 602.25. Applying the even-digit rule for rounding the result we get the sum to be equal to 602.2.
LM x Nx
x 2 , approximately. x2
The sum of the given numbers = 602.2. Example 1.9 Find the number of significant figures in the approximate number 11.2461 given its absolute error as 0.25 102.
Solution Given that absolute error = 0.25 102 = 0.0025.
ERRORS
13
Example 1.10 Find the product 349.1 863.4 and state how many figures of the result are trust worthy, assuming that each number is correct to four decimals. Solution and then now Let x1 = 349.1. x2 = 863.4, u = x1 x2 u = x1x2 = 349.1 863.4 = 301412.94
x1 x2 u 0. 05 0. 05 + + u x1 x2 x1 x2 | x | + | x2 | | u| 1 1 = ( 0. 05) 1 ( 0. 05) + | u| | x1| | x2 | | x1| | x2 | | u| ( 0. 05) | u|
1 2
R S T
LM | x | + | x | OP = 0.05 b| x | + | x |g N |u| Q
1 2
U V W
LM N
OP Q
i.e., i.e.,
301352.31 and 301473.559 3014 102 and 3015 102 We infer that; only the first three figures are reliable.
2 = 141421356 . ...
X = 2.01 2
= (1.41774469 ...) (1.41421356 ...) = 0.00353 = 3.53 103. Example 1.12 If x = 0.005, y = 0.001 be the absolute errors in x = 2.11 and y = 4.15, find the relative error in the computation of x + y. Solution x = 2.11, y = 4.15 x + y = 2.11 + 4.15 = 6.26,
and
14
NUMERICAL ANALYSIS
u 5 y 2 u 10 xy u 15xy 2 = 3 , = 3 , = x y z z z z4 u = u u u x + y + z x y z = u u u x + y + z x y z = 5y 2 10 xy 15xy 2 + + x y z z3 z3 z4
(1)
bug
max
Substituting the given values in (1) and using the formula to find the relative maximum error we get
bE g
R max
b u g
max
0.03 = 0.006. 5
Example 1.14 If X = 2.536, find the absolute error and relative error when (i) X is rounded and (ii) X is truncated to two decimal digits. Solution (i) Here X = 2.536 Rounded-off value of X is x = 2.54 The Absolute Error in X is EA = |2.536 2.54| = | 0.004| = 0.004 Relative Error = ER =
= 1.5772 103. (ii) Truncated Value of X is x = 2.53 Absolute Error EA = |2.536 2.53| = |0.006| = 0.006
Relative Error = ER =
22 is approximated as 3.14, find the absolute error, relative error and relative percentage error. 7
Absolute Error = EA =
22 2198 . 22 = 314 . 7 7
ERRORS
15
=
Relative Error ER =
0.02 7
= 0.002857.
0.002857 = 0.0009 22 / 7
EP = 0.09%.
Example 1.16 The number x = 37.46235 is rounded off to four significant figures. Compute the absolute error, relative error and the percentage error. Solution We have X = 37.46235; x = 37.46000
E P = Er 100 = 6. 27 103
Exercise 1.1
1. Round-off the following numbers to two decimal places. (a) 52.275 (a) 0.4699 (a) 0.235082 (b) 2.375 (b) 1.0532 (b) 0.0022218 (c) 2.385 (c) 0.0004555 (c) 4.50089 (d) 81.255 (d) 0.0028561 (d) 2.36425 (e) 2.375 (e) 0.0015 (e) 1.3456
2. Round-off the following numbers to three decimal places. 3. Round-off the following numbers to four decimal places. 4. The following numbers are correct to the last digit, find the sum. (a) 2.56, 4.5627, 1.253, 1.0534 (b) 0.532, 7.46571, 1.501, 3.62102 (c) 1.3526, 2.00462, 1.532, 28.201, 31.0012 (d) 5.2146, 20.12, 11.2356, 1.8948 5. Find the relative error in computation of x y for x = 12.05 and y = 8.02 having absolute errors x = 0.005 and y = 0.001. 6. Find the relative error in computation of x y for x = 9.05 and y = 6.56 having absolute errors x = 0.001 and y = 0.003 respectively. 7. Find the relative error in computation of x + y for x = 11.75 and y = 7.23 having absolute errors x = 0.002 and y = 0.005. 8. If y = 4x6 5x, find the percentage error in y at x = 1, if the error is x = 0.04.
16
NUMERICAL ANALYSIS
9. If
5 be represented approximately by 0.8333, find (a) relative error and (b) percentage error. 6
10. If f (x) = 4 cos x 6x, find the relative percentage error in f (x) for x = 0 if the error in x = 0.005. 11. Find the relative percentage error in the approximate representation of
4 by 1.33. 3
12. Determine the number of correct digits in the number x given its relative error ER. (a) x = 386.4, ER = 0.3 (b) x = 86.34, ER = 0.1 (c) x = 0.4785, ER = 0.2 102 13. Determine the number of correct digits in the number x, given its absolute error EA. (a) x = 0.00985, EA = 0.1 104 (b) x = 33.783, EA = 0.3 102 (c) x = 48.2461, EA = 0.21 102 (d) x = 841.256, EA = 0.1 (e) x = 0.4942, EA = 0.24 102 14. Evaluate X = 5. 01 5 correct to three significant figures. 15. If 2 is approximated to 0.6667. Find 3
(a) absolute error (b) relative error and (c) percentage error 16. Given X = 66.888. If x is rounded to 66.89 find the absolute error. 17. If
(a) absolute error (b) relative error and (c) relative percentage error 18. If u = z = 1. 19. If the true value of a number is 2.546282 and 2.5463 is its approximate value; find the absolute error, relative error and the percentage error in the number. 20. If a = 10. 00 0. 05 b = 0. 0356 0. 002
5xy 2 and error in x, y, z be 0.001, 0.002, and 0.003, compute the relative error in u. Where x = y = z3
c = 15300 100
d = 62000 500 Find the maximum value of the absolute error in
ERRORS
17
(i) a + b + c + d (ii) a + 5c d (iii) c3 21. If (0. 31 x + 2. 73) / ( x + 0. 35) where the coefficients are rounded off find the absolute and relative in y when x = 0.5 0.1. 22. If u = 4x2y3/z4 and errors in x, y, z be 0.001 compute the relative maximum error in u when x = y = z = 1. 23. If x = 865 250 is rounded off to four significant figures compute the absolute error, relative error and the percentage error in x. 24. Find the relative error in the function y = k x1m1 x2 m2 ... xn mn 25. If y = 3x ( x 6 2) find the percentage error in y at x = 1, if the percentage error in x is 5. 26. If u = 10 x 3 y 2 z 2 and errors in x, y, z are 0.03, 0.01, 0.02 respectively at x = 3, y = 1, z = 2. Calculate the asolute error and relative error and percentage erro in u. 27. If the number X = 3.1416 is correct to 4 decimal places; then find the error in X. 28. If u =
5xy 2 and x = y = z = 0.1, compute the maximum relative error in u where x = y = z = 1. z2
29. Find the relative error in the evaluation of x + y where x = 13.24, y = 14.32, x = 0.004 and y = 0.002. 30. If u = xy + yz + zx, find the relative percentage error in the evaluation of u for x = 2.104, y = 1.935, z = 0.845, which are the approximate values of the last digit. 31. If u = 4x6 + 3x 9, find the relative, percentage errors in computing x = 1.1 given that error in x is 0.05%. 32. If a = 5.43 m and b = 3.82 m, where a and b denote the length and breadth of a rectangular plate, measured accurate upto 1 cm, find error in computing its area. 33. Find the percentage error in computing y = 3x6 6x at x = 1, given that x = 0.05. 34. Find the percentage error in computing u = 35. Define the terms : (a) Absolute error (b) Relative error (c) Percentage error. 36. Explain the rules of round off. x at x = 4.44, when x is corrected to its last digit.
Answers
1. (a) 52.28 2. (a) 0.470 3. (a) 0.2351 4. (a) 9.43 5. 0.00029 (b) 2.38 (b) 1.05 (b) 0.002222 (b) 13.120 6. 0.00034 (c) 2.38 (c) 0.000456 (c) 4.501 (c) 64.091 7. 0.00037 10. 0.75% (d) 81.26 (d) 0.00286 (d) 2.364 (d) 38.46 8. 76% 11. Ep = 0.25% (e) 2.37 (e) 0.002 (e) 1.346
9. ER = 0.00004, Ep = 0.004%
18
NUMERICAL ANALYSIS
(b) 0 (b) 4
(c) 2 (c) 4 (d) 3 (c) 0.005 18. 0.0141 (e) 2 16. 0.002
15. (a) 0.000033 (b) 0.00005 (b) 0.001 (c) 0.1% 104% (iii) 5.766 1012
106,
7.07
27. EA = 50, EP = 6.71 105 EP = 6.71 103 30. 0.062% 31. 0.55% 32. 0.0925 ~ 0.1 m2
2
SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS
2.1 INTRODUCTION In this chapter we shall discuss some numerical methods for solving algebraic and transcendental equations. The equation f (x) = 0 is said to be algebraic if f (x) is purely a polynomial in x. If f (x) contains some other functions, namely, Trigonometric, Logarithmic, Exponential, etc., then the equation f (x) = 0 is called a Transcendental Equation.
The equations and x3 7x + 8 = 0 x4 + 4x3 + 7x2 + 6x + 3 = 0 The equations 3 tan 3x = 3x + 1, x 2 sin x = 0 ex = 4x
are algebraic.
Algebraically, the real number is called the real root (or zero of the function f (x)) of the equation f (x) = 0 if and only if f () = 0 and geometrically the real root of an equation f (x) = 0 is the value of x where the graph of f (x) meets the x-axis in rectangular coordinate system. We will assume that the equation f (x ) = 0 (1)
has only isolated roots, that is for each root of the equation there is a neighbourhood which does not contain any other roots of the equation. Approximately the isolated roots of the equation (1) has two stages. 1. Isolating the roots that is finding the smallest possible interval (a, b) containing one and only one root of the equation (1). 2. Improving the values of the approximate roots to the specified degree of accuracy. Now we state a very useful theorem of mathematical analysis without proof.
19
20
NUMERICAL ANALYSIS
Theorem 2.1 If a function f (x) assumes values of opposite sign at the end points of interval (a, b), i.e., f (a) f (b) < 0 then the interval will contain at least one root of the equation f (x) = 0, in other words, there will be at least one number c (a, b) such that f (c) = 0. Throughout our discussion in this chapter we assume that 1. f (x) is continuous and continuously differentiable up to sufficient number of times. 2. f (x) = 0 has no multiple root, that is, if c is a real root f (x) = 0 then f (c) = 0 and f ( x ) < 0 f ( x ) > 0 in (a, b), (see Fig. 2.1).
Y
f(b) x=c
X
x=a
O
Fig. 2.1
2.2 GRAPHICAL SOLUTION OF EQUATIONS The real root of the equation f ( x ) = 0, refer (1) can be determined approximately as the abscissas of the points of intersection of the graph of the function y = f (x) with the x-axis. If f (x) is simple, we shall draw the graph of y = f (x) with respect to a rectangular axis XOX and YOY. The points at which the graph meets the x-axis are the location of the roots of (1). If f (x) is not simple we replace equation (1) by an equivalent equation say ( x ) = ( x ), where the functions ( x ) and ( x ) are simpler than f(x). Then we construct the graphs of y = ( x ) and y = ( x). Then the x-coordinate of the point of intersection of the graphs gives the crude approximation of the real roots of the equation (1).
Example 2.1 Solve the equation x log10x = 1, graphically. Solution The given equation x log10x = 1 can be written as log10x =
1 x
21
1 1 simpler than xlog10x, constructing the curves y = log10x and y = , we get x-coordinate of the x x point of intersection as 2.5 (see Fig. 2.2).
y = log10x
Fig. 2.2
Exercise 2.1
1. Solve x2 + x 1 = 0 graphically. 2. Solve e2x + 2x + 0.1 = 0 graphically. 3. Solve the cubic equation x3 1.75x + 0.75 = 0 graphically. 4. Solve x3 + 2x + 7.8 = 0. 5. Solve graphically the real root of x3 3.6 log10x 2.7 = 0 correct to two decimal places. 6. Solve graphically the equation 2x3 x2 7x + 6 = 0. 7. Draw the graph of y = x3 and y + 2x = 20 and find an approximate solution of the equation x3 + 2x 20 = 0. 8. Solve x3 + 10x 15 = 0 graphically. 9. Solve graphically the following equations in the range (0, /2) ; (i) x = cos x (ii) ex = 4x (iii) x = tan x.
Answers
1. 0.6 and 1.6 (approximately) 4. 1.65 7. 2.47 2. 0.3 (approximately) 5. 1.93 8. 1.297 3. 1.5, 0.5 and 1 6. 1, 1.5, 2 9. (i) 0.74 (ii) 0.36, 2.15 (iii) 4.49
22
NUMERICAL ANALYSIS
2.3 METHOD OF BISECTION Consider the equation f ( x ) = 0, refer (1) where f(x) is continuous on (a, b) and f(a) f(b) < 0. In order to find a root of (1) lying in the interval (a, b). We shall determine a very small interval (a0, b0) (by graphical method) in which f(a0) f(b0) < 0 and f ( x ) maintains the same sign in (a0, b0), so that there is only one real root of the equation f(x) = 0. Divide the interval in half and let
x1 = a0 + b0 2
If f(x) = 0 then x1 is a root of the equation. If f(x1) 0 then either f(a0) f(x1) < 0 of f(b0) f(x1) < 0. If f(a0) f(x1) < 0 then the root of the equation lies in (a0, x1) otherwise the root of the equation lies in (x1, b0). We rename the interval in which the root lies as (a1, b1) so that 1 b1 a1 = b0 a0 , 2
now we take
a1 + b1 2 If f(x2) = 0 then x2 is the root of f(x) = 0. If f(x2) 0 and f(x2) f(a1) < 0, then the root lies in (a1, x2). In which case we rename the interval as (a2, b2), otherwise (x2, b1) is renamed as (a2, b2) where x2 = a2 b2 = 1 b0 a0 . 22 an + bn 2
which gives us the (n + 1)th approximation of the root of f(x) = 0, and the root lies (an, bn) where 1 bn an = n b0 a0 , 2
since the left end points a1, a2, , an, form a monotonic non-decreasing bounded sequence, and the right end points b1, b2, b2, , bn, form a monotonic non-increasing bounded sequence, then there is a common limit
c = lim an = lim bn
n n
such that f(c) = 0 which means that c is a root of equation (1). The bisection method is well suited to electronic computers. The method may be conveniently used in rough approximations of the root of the given equation. The bisection method is a simple but slowly convergent method.
23
Example 2.2 Solve the equation x3 9x + 1 = 0 for the root lying between 2 and 3, correct to three significant figures. Solution We have f(x) = x3 9x + 1, f(2) = 9, f(3) = 1
Let
f(2) f(3) < 0. a0 = 2, b0 = 3 n 0 1 2 3 4 5 6 7 8 check 9 an 2 2.5 2.75 2.88 2.94 2.94 2.94 2.94 2.94 2.9419 bn 3 3 3 3 3 2.97 2.955 2.9475 2.9438 2.9438
xn + 1 =
FG a H
+ bn 2
IJ K
f(xn + 1) 5.8 2.9 1.03 0.05 0.47 0.21 0.08 0.017 0.016 0.003
2.5 2.75 2.88 2.94 2.97 2.955 2.9475 2.9438 2.9419 2.9428
In the 8th step an, bn and xn + 1 are equal up to three significant figures. We can take 2.94 as a root up to three significant figures.
f x
b0 = 1.6.
bg
= ex 3 > 0 for x [1.5, 1.6], only one root of f(x) = 0 lies between 1.5 and 1.6, here a0 = 1.5,
n 0 1 2 3 4 check 5
xn + 1 =
FG a H
+ bn 2
IJ K
24
NUMERICAL ANALYSIS
In the 4th step an, bn and xn + 1 are equal up to two decimal places. Thus, x = 1.51 is the root of f(x) = 0, correct up to two decimal places. Example 2.4 Find the root of tan x + x = 0 up to two decimal places, which lies between 2 and 2.1. Solution Here Let f(x) = tan x + x f(2) = 0.18, f(2.1) = 0.39
a0 = 2, b0 = 2.1
xn + 1 =
FG a H
+ bn 2
IJ K
2.02812 2.02813
In the 5th step, an, bn and xn + 1 are equal up to two decimal places.
Exercise 2.2
1. Find a root of the equation x3 4x 9 = 0 correct to three decimal places by using bisection method. 2. Find the positive roots of the equation x3 3x + 1.06 = 0, by method of bisection, correct to three decimal places. 3. Compute one positive root of 2x 3 sin x 5 = 0, by bisection method, correct to three significant figures. 4. Compute one root of x + log x 2 = 0 correct to two decimal places which lies between 1 and 2. 5. Compute one root of sin x = 10(x 1) correct to three significant figures. 6. Compute the root of log x = cos x correct to two decimal places. 7. Find the interval in which the smallest positive root of the following equation lies. Also find the root correct to two decimal places. Use bisection method (a) tan x + tan hx = 0 (b) x3 x 4 = 0 8. Find the root of the equation x3 x 11 = 0, using bisection method correct to three decimal places (which lies between 2 and 3). 9. Find the root of the equation x4 x 10 = 0, using bisection method.
25
FG 1 IJ H xK
= 0, by bisection method
Answers
1. 2.6875 4. 1.56 9. 1.8556 2. 0.370 5. 1.09 10. 0.567 3. 2.88 6. 1.30 8. 2.375
2.4 THE ITERATION METHOD Suppose we have an equation f(x) = 0 whose roots are to be determined. The equation (1) can be expressed as x = f ( x ), putting x = x0 in R.H.S. of (2) we get the first approximation
x1 = xo .
The successive approximations are then given by
b g b b b d
x2 = x1 x3 = x2 x4 = x3 M xn = xn 1
g g g
where the sequence of approximations x1, x2, , xn always converge to the root of x = x and it can be shown that if x
bg
bg
< 1 when x is sufficiently close to the exact value c of the root and
xn c as n .
interval containing . If | ( x )| < 1 for all x in I, then the sequence of approximations x0, x1, , xn will converge to the root , provided that the initial approximation x0 is chosen in I. Proof
bg
and I be an
is a root of f(x) = 0
is a root of x = x
bg = b g .
(3)
26
NUMERICAL ANALYSIS
Let xn
xn
d i = d x i b g .
xn = xn 1 ,
n 1
xn 1 xn 1
d i b g = bg ,
xn 1 < <
where
xn 1 = xn 1 .
Let be the maximum absolute value of
d i bg d
(4)
x n xn 1
xn 1 xn 2
(5)
xn 2 xn 2
proceeding in this way, we get
(6)
xn n x0 .
If < 1 over I, then the RHS of (7) becomes small (as n increases) such that
(7)
Lt xn = 0 Lt xn = . The sequence of approximations will converge to the root if < 1 , i.e., x < 1 .
If > 1, then
bg
x > 1
bg
27
xn xn 1 , ( is a constant).
Hence the error at any stage is proportional to the error in the previous stage. Therefore the iteration method has a linear convergence. 3. Iteration method is more useful for finding the real roots of an equation which is in the form of an infinite series. Example 2.5 Find the root of x3 + x 1 = 0 by iteration method, given that root lies near 1. Solution Given x = 1 is the approximate value of the root x3 + x 1 = 0 can be put in the form
x=
1 1 + x2 1 1 + x2
and x0 = 1
such that
x =
bg
x =
bg
d1 + x i
2 x
2 2
at x = 1; we have
x = 1 =
bg
bg
d1 + 1 i
2.1
2 2
<1
x1 = x0 =
b g
1 1 = = 0.5 2 1 + x0 1 + 12
x2 = x1 =
b g
1 1 = 2 1 + x1 1 + 0.5
b g
= 0.8 ,
x 3 = x2 =
b g
1 1 = 2 1 + x2 1 + 0.8
b g
= 0.61.
The root of the given equation is 0.61 after three iterations. Note: We can write the equation x3 + x 1 = 0 in different forms as
x= 1 1 , and x = 1 x x
1/ 3
Example 2.6 Find a real root of cos x = 3x 1, correct to three decimal places. Solution We have
f x = cos x 3x + 1 = 0
28
NUMERICAL ANALYSIS
. 2 1 1 + cos x . 3
x = x = x =
bg
bg
bg
FG IJ H K
We get
x 2 = x1 = x 3 = x2 = x4 = x3 = x5 = x 4 = x 6 = x5 = x7 = x6 =
x1 = x 0 =
b g
1 1 + cos 0 = 0.66667 3
b g
1 1 + cos 0.66667 = 0.595295 0.59530 3 1 1 + cos 0.59530 = 0.6093267 0.60933 3 1 1 + cos 0.60933 = 0.6066772 0.60668 3 1 1 + cos 0.60668 = 0.6071818 0.60718 3 1 1 + cos 0.60718 = 0.6070867 0.60709 3
b g b g
b g b g
b g
x8 = x 7 =
b g
The correct root of the equation is 0.607 correct to three decimal places.
29
Example 2.7 Find by the iteration method, the root near 3.8, of the equation 2x log10 x = 7 correct to four decimal places. Solution The given equation can be written as
x=
clearly x < 1 when x is near 3.8 we have
1 log10 x + 7 2
bg
x0 = 3.8
x1 = x0 = x 2 = x1 = x 3 = x2 =
b g
b g
b g
x2 = x3 = 3.7893
We can take 3.7893 as the root of the given equation. Example 2.8 Find the smallest root of the equation
1 x + x2 x3 x4 x5 + + ... = 0 ( 2! )2 ( 3! )2 ( 4! )2 ( 5! )2 ...(1)
Solution. The given equation can be written as x = 1+ x2 x3 x4 x5 + + ... = ( x ) 2 2 2 ( 2!) ( 3!) (4!) (5!) 2 (say)
omitting x2 and the other higher powers of x we get x = 1 Taking x0 = 1, we obtain x1 = (x0) = 1 + = 1.2239 x2 = ( x1 ) = 1 + = 1.3263 x3 = ( x2 ) = 1 + = 1.3800 x4 = ( x3 ) = 1 + = 1.409 (1. 3800) 2 (1. 3800) 3 (1. 3800) 4 (1. 3800)5 + + ... (2!)2 ( 3!) 2 (4!)2 (5!) 2 (1.3263) 2 (1. 3263)3 (1. 3263) 4 (1. 3263)5 + + ... (2!) 2 (3!) 2 ( 4!) 2 (5!) 2 (1. 2239) 2 (1. 2239 )3 (1.2239 ) 4 (1. 2239)5 + + ... (2!) 2 (3!)2 ( 4!) 2 (5!) 2
1 1 1 1 + + + ... ( 2!) 2 ( 3!) 2 ( 4!) 2 (5!) 2
30
NUMERICAL ANALYSIS
Similarly,
Correct to 2 decimal places, we get x7 = 1.44 and x8 = 1.44 The root of (1) is 1.44 (approximately).
2 2.4.1 Aitkens Method
Let x = be a root of the equation f(x) = 0 and let I be an interval containing the point x = . The equation (1) can be written as (1)
such that x xi
1, xi and xi
bg
+ 1
and x
bg
x=x
bg
d
bg
xi = xi 1
and
xi + 1 = xi
b g
= xi + 1
Since and
dx
2
dx
i +1
xi
i +1
2 xi xi 1
(2)
xi = xi +1 xi
2 xi 1 = E 1
2
b g x = d E 2 E + 1i x
i 1
i 1
= xi +1 2 xi + xi 1
(2) can be written as
= xi +1
b x g
i
2 xi 1
(3)
31
formula (3) yields successive approximation to the root and the method is called Aitkens 2 method.
Note: We know that iteration method is linearly convergent. The slow rate of convergence can be accelerated by using Aitkens method. And for any numerical application the values of the under-mentioned quantities, must be computed.
xi 1 xi 1
xi
2 xi 1
xi
xi + 1
Example 2.9 Find the root of the equation 3x = 1 + cos x correct to three decimal places. Solution We have f(x) = cos x 3x + 1.
f 0 = 1 and f
bg
= 8.42857
f 0 > 0 and f
bg
f 0 f
IJ < 0, b g FGH 2K
x= x =
1 1 + cos x = x 3 sin x 3
g bg bg
(say)
bg
x =
sin x < 1 x 0, 3 2
FG IJ H K
Hence, iteration method can be applied. Let x0 = 0 be the initial approximation of the root
x1 = x 0 = x 2 = x1 =
b g 1 b1 + cos 0g = 0.6667 3
x 3 = x2 =
32
NUMERICAL ANALYSIS
0.0854 2 x1
x3 = 0.6093
0.014 x2
Hence
x 4 = x3
b x g
2
2 x1
= 0.6093
b0.014g b0.0854g
2
= 0.607
Exercise 2.3
1. Find the real root of the equation x3 + x 1 = 0 by the iteration method. 2. Solve the equation x3 2x2 5 = 0 by the method of iteration. 3. Find a real root of the equation, x3 + x2 100 = 0 by the method of successive approximations (the iteration method). 4. Find the negative root of the equation x3 2x + 5 = 0. 5. Find the real root of the equation x sin x = 0.25 to three significant digits. 6. Find the root of x2 = sin x, which lies between 0.5 and 1 correct to four decimals. 7. Find the real root of the equation x3 5x 11 = 0. 8. Find the real root of the equation
x x 3 x5 x 7 x9 x11 + + + ... + 3 10 42 216 1320
b1g
n 1
10. Use iteration method to find a root of the equations to four decimal places. (i) x3 + x2 1 = 0 (ii) x = 1/2 + sin x and (iii) ex 3x = 0, lying between 0 and 1. (iv) x3 3x + 1 = 0 (v) 3x log10 x 16 = 0
33
11. Evaluate
30 by iteration method.
12. (a) Show that the equation loge x = x2 1, has exactly two real roots 1 = 0.45 and 2 = 1 . (b) Determine for which initial approximation x0, the iteration
xn +1 = 1 + log e xn
14. Apply Aitkens 2 method and show that 1.524 is a root of 2x = cos x + 3.
Answers
1. 0.68 4. 2.09455 7. 2.95 10. (i) 0.7548 (ii) 1.4973 (iii) 0.671 (iv) 1.532 (v) 2.108 2. 5. 8. 11. 2.69 1.172 0.47693 5.4772 3. 6. 9. 13. 4.3311 0.8767 1.442 1.4973
2.5 NEWTONRAPHSON METHOD OR NEWTON ITERATION METHOD This is also an iteration method and is used to find the isolated roots of an equation f(x) = 0, when the derivative of f(x) is a simple expression. It is derived as follows: Let x = x0 be an approximate value of one root of the equation f(x) = 0. If x = x1, is the exact root then (8) f( x 1) = 0 where the difference between x0 and x1 is very small and if h denotes the difference then (9) x1 = x0 + h
Substituting in (8) we get f ( x 1) = f(x0 + h) = 0 Expanding by Taylors theorem we get
f x0 +
b g
h h2 f x0 + f x0 + ... = 0 1! 2!
b g
b g
(10)
Since h is small, neglecting all the powers of h above the first from (10) we get
f x0 +
b g
h f x0 = 0 , approximately 1! f x0 h= f x0
b g
b g b g
x1 = x0 + h = x0
b g f bx g
f x0
0
(11)
34
NUMERICAL ANALYSIS
The above value of x1 is a closer approximation to the root of f(x) = 0 than x0. Similarly if x2 denotes a better approximation, starting with x1, we get
x2 = x1
Proceeding in this way we get
b g. f b x g
f x1
1
xn + 1 = xn
b g. f b x g
f xn
n
(12)
The above is a general formula, known as NewtonRaphson formula. Geometrically, Newtons method is equivalent to replacing a small arc of the curve y = f(x) by a tangent line drawn to a point of the curve. For definition sake, let us suppose f x > 0, for a x b and f(b) > 0 (see Fig. 2.3) whose x0 = b, for which f x0 f x0 > 0 .
b g b g
bg
Draw the tangent line to the curve y = f(x) at the point B0 [x0, f(x0)]. Let us take the abscissa of the point of intersection of this tangent with the x-axis, as the first approximation x1 of the root of c. Again draw a tangent line through B [x1, f(x1)], whose abscissa of the intersection point with the x-axis gives us the second approximation x2 of the root c and so on. The equation of the tangent at the point Bx [xn, f(xn)] [n = 0, 1, 2, , n] is given by
y f xn = f xn x xn .
Putting y = 0, x = xn
+ 1'
b g
b gb
we get
xn + 1 = xn
Y
b g. f b x g
f xn
n
B0
B1 B2 a
O
b = xn
C x2 x1
x xn
f(a) A
Fig. 2.3
35
Note : 1. If we put x0 = b, (where f ( x0 ) f ( x0 ) < 0) then the tangent drawn to the curve y = f(x) at the point A [ a, f(a)], would give us a point x1 which lies outside the interval [ a, b] from which it is clear that the method is impractical for such a choice. Thus the good choice of initial approximation for which f ( x0 ) f ( x0 ) > 0 yields better results. Newtons method is applicable to the solution of equation involving algebraic functions as well as transcendental functions. At any stage of the iteration, if
f ( xi ) f ( xi )
has n zeros, after decimal point then the result is taken to be correct to 2n decimal places. 2. Criterion for ending the iteration: The decision of stopping the iteration depends on the accuracy desired by the user. If denotes the tolerable error, then the process of iteration should be terminated when
xn +1 xn .
In the case of linearly convergent methods the process of iteration should be terminated when f ( xn ) where
is tolerable error.
Example 2.10 Using NewtonRaphson method, find correct to four decimals the root between 0 and 1 of the equation x3 6x + 4 = 0 Solution We have f(x) = x3 6x + 4 f(0) = 4 and f(1) = 1 f(0) f(1) = 4 < 0.
A root of f(x) = 0 lies between 0 and 1. The value of the root is nearer to 1.
Let x0 = 0.7 be an approximate value of the root Now f(x) = x3 6x + 4
f x = 3x 2 6
x1 = x0
b g f b x g
f x0
0
= 0.7
. g b0143 b4.53g
f x1 = 0.7316
b g b
6 0.7316 + 4 = 0.0019805
36
NUMERICAL ANALYSIS
x2 = x1
f x1
f x1
Here
b g f b x g = 4 x
x0 = 2
3
f x1 = x 4 12 x + 7
3
12
f x0 = f 2 = 2 4 12.2 + 7 = 1
0
b g bg f b x g = f b2g = 4b2g
12 = 20
x1 = x0
and
x2
f x = ex 4 f x0 = e 2.1
b g
37
x1 = x0
b g f b x g
f x0
0
= 2.1
b0.23383g
4.16617
x2 = x1
f x1
f x1
b g b g
e 2.561 4 2.1561 e 2.561 4
= 2.1561
= 2.1561
0.0129861 4.6373861
b g b g f b x g = f b2.1533g = 4.6106516.
2
f x2 = f 2.1533 = 0.0013484
x 3 = x2
b g f b x g
f x2
2
= 2.1533
b0.0013484g b4.6106516g
= 2.1532
The first approximation to the root is given by ( 1)3 sin ( 1) + 1 f ( x0 ) x1 = x0 = 1 f ( x0 ) 3( 1) 2 cos ( 1) = 1 0.8415 = 1.3421 2. 4597
38
NUMERICAL ANALYSIS
f ( x2 ) x3 = x2 f ( x ) 2
= 1. 2565
= 1.249 (correct to three decimal places) Hence the root is 1.249. Example 2.14 Solve x4 5x3 + 20x2 40x + 60 = 0, by NewtonRaphson method given that all the roots of the given equation are complex. Solution Let f(x) = x4 5x3 + 20x2 40x + 60
So that
The given equation is f(x) = 0
f x = 4 x 3 15x 2 + 40 x 40
(1)
bg
x n + 1 = xn
f xn
f xn
b g b g
= xn
4 3 2 xn 5x n + 20 xn 40 xn + 60 3 2 4 xn 15xn + 40 xn 40
=
Putting n = 0 and, Taking x0 = 2(1 + i) by trial, we get
4 3 2 3x n 10 xn + 20 xn 60 3 2 4 xn 15xn + 40 xn 40
(2)
x1 =
4 3 2 10 x0 + 20 x0 60 3 x0 3 2 4 x0 15x0 + 40 x0 40
b g 10b2 + 2ig + 20b2 + 2ig 60 4b2 + 2i g 15b2 + 2i g + 40b2 + 2i g 40 . + 192 . i = 192 . b1 + i g = 192
= 3 2 + 2i
4 3 2 3 2
39
Similarly,
x2 =
b g . + 192 . ig 4b192
. + 192 . i 3 192
4 3
10 192 . + 192 . i
b g 15b192 . + 192 . ig
3 2
+ 20 192 . + 192 . i 60
b g + 40b192 . + 192 . i g 40
= 1915 . + 1908 . i
1.915 + 1.908i is a root of the given equation Imaginary roots appear in pairs, therefore 1.915 1.908i is also a root of the equation.
Since, f(x) = 0 is a biquadratic equation, the number of roots of the equation is four. Let us assume that + i and i is the other pair of roots of the given equation. From (1), we get
g b
g b
g b
2 + 383 . =5
= 5 383 . = 0.585 3
b d
gb gb . g + b1908 . i g = 60 + i b1915
2
gb
eb0.585g
+ 2 7.307689 = 60
jb
Solution. Given
ex 1 x
Let
x2 x 3 0.3 x e 2 6
40
NUMERICAL ANALYSIS
then
x f (x) = e 1 x
x 2 0.3 x x 3 0.3 x e e 0. 3 . 2 6
We have let
FG H
IJ K
Hence: the root of f(x) = 0, lies between 2 and 3 using, the Newton-Raphson formula xn+1 = xn
we obtain
x1 = x0
f ( x0 ) f ( x0 )
= 2.461326 x2 = x1
f ( x1 ) f ( x1 )
2.5
1 2.5
2.5
1 2.5 e0.75
OP PQ FG1 2.5IJ OP H 10 K PQ
x2 =
LMe M 2. 461326 N
2.461326
1 2. 461326
x2 = 2.379358
f ( x2 ) x3 = x2 f ( x ) 1
LMe N
2.461326
1 2. 461326 e0.7383978 1
FG H
2. 461326 10
IJ OP KQ
OP PQ
LMe MN = 2. 379358
x3 = 2.363884
f ( x3 ) x4 = x3 f ( x ) 3
2.379358
1 2. 379358
LMe N
2.379358
1 2. 379358 e0.713874 1
FG H
2. 379358 10
IJ OP KQ
OP PQ
LMe M = 2. 363884 N
f ( x4 ) f ( x4 )
2.363884
1 2. 363884
LMe N
2.363884
1 2. 363884 e0.7091652 1
FG H
2. 363884 10
IJ OP KQ
OP PQ
x4 = 2.363377 x5 = x4
41
LMe M = 2. 363377 N
= 2.363376 Hence, the required root is 2.363376.
2.363377
1 2. 363377
LMe N
2.363377
1 2. 363377 e0.7090131 1
FG H
2. 363377 10
IJ OP KQ
OP PQ
Exercise 2.4
1. Apply Newtons method to find the real root of x3 + x 1 = 0. 2. Find the positive root of the equation x = 2 sin x. 3. The equation 3 tan 3x = 3x + 1 is found to have a root near x = 0.9, x being in radians. 4. Find the root of x3 8x 4 = 0, which lies between 3 and 4, by NewtonRaphson method, correct to four decimal places. 5. Find a positive root of x2 + 2x 2 = 0, by NewtonRaphson method, correct to two significant figures. 6. Find a positive root of x + log x 2 = 0, by NewtonRaphson method, correct to six decimal figures. 7. Find by NewtonRaphson method the real root of 3x cos x 1 = 0. 8. Find a real root of x4 x 10 = 0 by NewtonRaphson method. 9. Find a positive root of x ex = 0, by NewtonRaphson method. 10. Compute the positive root of x3 x 0.1 = 0, by NewtonRaphson method, correct to six decimal figures. 11. Using Newtons method, compute a negative root of the equation f(x) x4 3x2 + 75x 10000 = 0, correct to five places. 12. Use Newtons method to find the smallest positive root of the equation tan x = x. 13. Apply Newtons method to find a pair of complex roots of the equation x4 + x3 + 5x2 + 4x + 4 = 0 starting with x0 = i. 14. Solve f(z) = z3 3z2 z + 9 using Newtons method (z is a complex variable) starting with z0 = 1 + i. 15. Perform three iterations of NewtonRaphson method for solving
1 + z 2 = 0, z0 = 1+ i 2
Answers
1. 0.68 4. 3.0514 7. 0.60710 10. 1.046681 2. 1.895 5. 0.73 8. 1.8556 11. 10.261 15. 0.00172 3. 0.8831 6. 1.55714 9. 0.5671 12. 4.4934 13. 0.573
0.89i
13
14.
2 7
0.9973i
42
NUMERICAL ANALYSIS
Example 2.16 Using NewtonRaphson formula, establish the iterative formula xn +1 = square root of N. Solution Let
1 N xn + 2 xn
LM N
OP to calculate the Q
x=
x2 = N x2 N = 0
Let then
f(x) = x2 N
f x = 2x
By NewtonRaphson rule, if xn denotes the nth iterate
bg
xn + 1 = xn
b g f b x g
f xn
n
= xn
2 xn N
2 xn
2 xn + N 2 xn
1 N xn + , n = 0, 1, 2, 3, ... 2 xn
xn + 1 =
Example 2.17 Find the square root of 8. Solution Let N = 8
N 1 xn + , n = 0, 1, 2, ... xn 2
LM N
OP Q
LM N
OP Q
x1 =
x2
x3
x4
LM N 1L = Mx 2N 1L = Mx 2N 1L = Mx 2N
N 1 x0 + x0 2
OP = 1 L2.5 + 8 O = 2.85 Q 2 MN 2.5 PQ 1L 8 O NO + P = M2.85 + 2N 2.85 P x Q Q = 2.8285 1L 8 NO + P =2 MN2.8285 + 2.8285 OPQ = 2.8284271 x Q 1L 8 NO O = 2.8284271 + P = M2.8284271 + 2N 2.8284271P x Q Q
1 2 3
8 = 2.828427.
1 N 2xn + 2 3 xn
Example 2.18 Using Newtons iterative formula establish the iterative formula xn +1 = cube root of N. Solution Let
LM MN
OP to calculate the PQ
x=
N x3 = N
43
x3 N = 0
we have such that
bg f b x g = 3x
f x = x3 N
2
x n + 1 = xn
LM f b x g OP MN f b x g PQ
n n 3 xn N 2 3 xn
xn + 1 = xn =
3 2 xn + N 2 3 xn
N 1 2 xn + 2 , n = 0, 1, 2, ... 3 xn
LM N
3 3 3x n xn +N 2 3 xn
OP Q
xn + 1 =
N 1 2 xn + 2 , n = 0, 1, 2, ... 3 xn
LM N
OP Q
Example 2.19 Find the cube root of 12 applying the NewtonRaphson formula twice. Solution Clearly 8 < 12 < 27
x0 =
2+3 = 2.5 2
x1 =
and
x2
12 = 2.2901.
Exercise 2.5
1. Find the square root of 5. 2. Compute (a)
27 (b) 12 .
44
NUMERICAL ANALYSIS
3. From the equation x5 N = 0, deduce the Newtonian iterative formula xn +1 = 4. Show that the iterative formula for finding the reciprocal of N is xn +
1
N 1 4 xn + 4 . 5 xn
LM MN
OP PQ
1 . the value of 31
5. Evaluate (a)
3
13 (b)
125 .
Answers
1. 2.2361 2. (a) 5.196154 (b) 3.46412 4. 0.03226 5. (a) 2.351 (b) 1.993
b g f b x g
f xn
n
= xn ( say).
b g
(13)
x= x ,
we know that the iteration method given by (14) converges if x < 1 . Here
bg
(14)
x =x
bg
b g, f b x g
f xn
n 2 2
bg
f x f x
2
bg bg f b x g
(15)
If denotes the actual root of f(x) = 0, then we can select a small interval in which f(x), f ( x ), and f ( x ) are all continuous and the condition (15) is satisfied. Hence Newtons formula always converges provided the initial approximation x0 is taken very close to the actual root .
45
be two successive
approximations to the actual root . If n and n +1 are the corresponding errors, we have
xn = + n and xn +1 = + n +1
by Newtons iterative formula
+ n +1 = + n n +1 n
n +1
b g f b + g f b + g = f b + g F I f bg + f bg + G J f bg + ... H 2K = f bg + f b g + ...
f + n
n n n 2 n n n n
n +1
2 n
2 n
(16)
From (16) it is clear that the error at each stage is proportional to the sequence of the error in the previous stage. Therefore NewtonRaphson method has a quadratic convergence.
Example 2.20 Obtain the NewtonRaphsons extended formula
x1 = x0
for the root of the equation f(x) = 0.
b g 1 m f b x gr f b x g f b x g 2 m f b x gr
f x0
2 0 0 3 0 0
46
NUMERICAL ANALYSIS
bg b g b f bx g x=x . f b x g
0 0 0
0 = f x = f x 0 + x x0 f x0 ,
g b g
x1 = x0
f x0
f x0
b g. b g
f x = f x0 + x x0 f x0 +
bg b g b
1 g b g 2 b x x g f b x g ,
2 0 0
f x1 = f x 0 + x1 x 0 f x0 +
but f(x1) = 0 as x1 is an approximation to the root.
b g b g b
2 0
1 g b g 2 bx
x0
g f b x g ,
2 0
f x 0 + x x0 f x0 +
b g b
1 g b g 2 b x x g f b x g = 0 ,
0
or
f x0 + x x 0 f x0
b g b
g b g
1 f x0 f x0 + = 0, 3 2 f x0 x1
0
or
m b gr b g m b gr f bx g 1 m f b x gr f b x g =x . f b x g 2 m f b x gr
2 2 0 0 0 3 0 0
2.6
xn + 1 = xn p
b g f b x g
f xn
n
The above formula is called the generalised Newtons formula for multiple roots. It reduces to NewtonRaphson formula for p = 1. If is a root of f(x) = 0 with multiplicity p, then it is also a root of f ( x ) = 0, with multiplicity p 1, of f ( x ) = 0, with multiplicity (p 2), of f ( x ) = 0, with multiplicity (p 3) and so on. If the initial approximation x0 is chosen sufficiently close to the root then the expressions f x0 f x0 f x0 x0 p , x0 p 1 , x0 p 2 , ... f x0 f x0 f x0
b g b g
g bb gg
g bb gg
47
Example 2.21
and verify that the convergtence is only of first order in each case. Solution. We have f(x) = x 3 x 2 x + 1; f(x) = 3x 2 2 x 1 and x0 = 0.8
f ( x0 ) f ( x0 ) ( 0.8) 3 ( 0.8) 2 0.8 + 1 3 ( 0.8) 2 2 ( 0.8) 1 f ( x1 ) f ( x1 )
= 0.905882
= 0. 905882 = 0.9554132 x3 = x2
e(0.905882)
( 0. 905882 )2 0. 905882 + 1
2
3( 0. 905882 ) 2( 0. 905882 ) 1
= 0. 954132 = 0.97738
0 = 1 x0 = 1 0.8 = 0. 2 = 0. 2 100
1 1 = 1 x1 = 1 0. 9054132 = 0. 094118 = 0. 94 10
then
bg f b x g
f x
= x3 x2 + x + 1 = 3x2 2x + 1
48
NUMERICAL ANALYSIS
f x = 6x 2
bg
and
b g = f(0.9) = (0.9) (0.9) + (0.9) + 1 = 0.019 f b x g = f b0.9g = 3 (0.9) 2 (0.9) + 1 = 0.37 f b x g = f b0.9g = 6 (0.9) 2 = 5.4 2 = 3.4 f bx g b0.019g = 0.9 + 01027 = 0.9 2 x p . f b x g b0.37g
f x0
3 2
x0 p 1
= 1.0027
= 1.0088. The closeness of these values indicate that there is double root near x = 1. For the next approximation we choose x1 = 1.01
x1 2
and
x1
The values obtained are equal. This shows that there is a double root at x = 1.0001. Which is close to the actual root unity.
2.6.1 Newtons Method for System of two non-linear Equations Now we consider the solution of simultaneous non-linear equations by Newtons method. Consider the system f(x, y) = 0 f(x, y) = 0 (1) involving two non-linear equations. Let (x0, y0) be an initial approximation to the root of the system, and (x0 + h, y0 + k) be the root of the system given by (1). Then we must have f(x0 + h, y0 + k) = 0 (2) and g(x0 + h, y0 + k) = 0
Let us assume that f and g are differentiable expanding (2) by Taylors series, we obtain
f x0 + h , y0 + k = f 0 + h
f f +k + ... = 0 x0 y0
49
and
g x0 + h, y0 + k = g 0 + h
g g +k + ... = 0 x0 y0
(3)
neglecting, the second and higher order terms and retaining only the linear terms of (3), we obtain
h
and where
f f +k = f0 x0 y0 g g +k = g0 x0 y0
f0 = f x0 , y0 , (4)
f f f f = = ; x0 x x = x0 y0 y solving (4) for h and k, the next approximation of the root is given by x1 = x0 + h and y1 = y0 + k
FG IJ H K
FG IJ H K
, etc.
y = y0
2 x 2 = 16
x=2 2
let x0 = 2 2 , y0 = 2 2 , and (x0, y0) be the initial approximation to the root of the system. We have and differentiating partially, we obtain f = x2 y2 4 f0 = 4 g = x2 + y2 16
g0 = 0
f f = 2 x, = 2y x y g g = 2 x, = 2y x y
so that
f f = 2 x0 = 4 2 , = 2 y0 = 4 2 x0 y0
g g = 2 x0 = 4 2 , = 2 y0 = 4 2 x 0 y0
The system of linear equations can be written as
f f +k = f 0 h 4 2 k 4 2 = ( 4 ) x0 y0 h k = 0.7072
e j e j
50
NUMERICAL ANALYSIS
and
g g +k = g0 h 4 2 + k 4 2 = 0 x0 y0
e j e j
h+k =0
so that solving we get h k = 0.7072 h + k = 0 h = 0.3536, k = 0.3536 The second approximation to the root is given by x1 = x0 + h = 2 2 + 0.3536 = 3.1820 y1 = y0 + k = 2 2 0.3536 = 2.4748 The process can be repeated. Example 2.24 Solve f(x, y) = x2 + y 20x + 40 = 0 g(x, y) = x + y2 20y + 20 = 0 Solution Let x0 = 0, y0 = 0 be the initial approximation to the root f = x2 + y 20x + 40 (i) (ii)
f f = 2 x 20, =1 x y g g = 1, = 2 y 20 x y
f f = 20, =1 x 0 y 0 g g = 1, = 20 x0 y0
f f +k = f0 x0 y0
20h + k = 40
(i)
h
Solving, we get
g g +k = g0 x0 y0
h 20k = 20
(ii)
51
Exercise 2.6
1. Show the Newtons square root formula has a quadratic convergence. 2. Show that the order of convergence of Newtons inverse formula is two. 3. Show that the modified NewtonRaphsons method xn +1 = xn
2 f ( xn ) gives a quadratic converf ( xn ) gence when the equation f(x) = 0 has a pair of double roots in the neighbourhood of x = xn.
4. (i) Show that both of the following two sequences have convergence of the second order with the same limit
xn +1 =
x2 a 1 1 xn 1 + 2 , and xn +1 = xn 3 n . a 2 2 xn
a , show that error in the first formula for xn + 1 is about
F GH
I JK
F GH
I JK
one-third that in the second formula, and deduce that the formula xn +1 = a sequence with third order convergence.
FG x IJ FG 6 + 3a H 8KH x
n
2 n
2 xn a
I JK
given
5. Use Newton-Raphson method to find a solution of the following simultaneous equations x2 + y 11 = 0 x + y2 7 = 0 given the approximate values of the roots : x0 = 3, y0 = 2. 6. Solve x2 = 3xy 7 y = 2(x + 1) 7. Solve x2 y2 + y = 5, +x=3 Ans. x = 2, y = 1 x = 1.683, y = 2.164 8. Solve x = 2(y + 1) y2 = 3xy 7 9. Solve x = x2 + y2 y = x2 y2 Correct to two decimals, starting with the approximation (0.8, 0.4). Ans. x = 0.7974, y = 0.4006 10. Solve sin xy + x y = 0 y cos xy + 1 = 0 with x0 = 1, y0 = 2, by Newton-Raphson method. + y= 11. Given x = approximation as (0.8, 0.4). x2 y2, x2 y2. Ans. x = 1.0828, y = 1.9461 Solve the equations, by using Newton-Raphson method with the initial Ans. x = 0.7719, y = 0.4196 Ans. x = 3.5844, y = 1.8481 Ans. 1853, 1.927 Ans. 1.9266, 1.8533 Ans. 3.585, 1.8485
52
NUMERICAL ANALYSIS
2.7 REGULA-FALSI METHOD Consider the equation f(x) = 0 and let a, b be two values of x such that f(a) and f(b) are of opposite signs. Also let a < b. The graph of y = f(x)will meet the x-axis at the same point between a and b. The equation of the chord joining the two points [a, f(a)] and [b, f(b)] is
y f a f b f a = xa ba
bg
bg bg
(17)
In the small interval (a, b) the graph of the function can be considered as a straight line. So that x-coordinate of the point of intersection of the chord joining [a, f(a)] and [b, f(b)] with the xaxis will give an approximate value of the root. So putting y = 0 in (17) we get
f a
x x1
bg
f b f a ba
bg bg
f a f a f a
or
x=a
or
If f(a) and f(x0) are of apposite signs then the root lies between a and x0 otherwise it lies between x0 and b. If the root lies between a and x0 then the next approximation
x1 =
otherwise
x1
b g bg f b x g f ba g x f bbg bf b x g = . f bbg f b x g
af x0 x0 f a
0 0 0 0
The above method is applied repeatedly till the desired accuracy is obtained. The Geometrical interpretation of the method is as follows In Fig. 2.4, the curve y = f(x) between A(x = a) and B(x = b) cuts OX at Q. The chord AB cuts OX at P. It is clear that x = OQ is the actual value of the root whereas x = OP = x0 is the first approximation to the root f(x0) and f(a) are of opposite signs. So we apply the false position method to the interval (a, x0) and get OP1 the next approximation to the root. The procedure is continued till the root is obtained to the desired degree of accuracy. The points of intersection of the successive chords with x-axis, namely P1, P2, tend to coincide with Q the point where the curve y = f(x) cuts the x-axis and so we get successive approximate values of the root of the equation.
53
a
O
P2 Q
P x1
Px0
Db
[b, f(b)]
Fig. 2.4
Example 2.25 Find an approximate value of the root of the equation x3 + x 1 = 0 near x = 1, by the method of Falsi using the formula twice. Solution Here f(x) = x3 + x 1 f(0.5) = 0.375, f(x) = 1 Hence the root lies between 0.5 and 1. We take a = 0.5, b = 1
x0 =
Now applying the formula again we get
b g b g b gb g b g bg bg b g
x1 =
Example 2.26 Find the real root of the equation x log10 x 1.2 = 0 correct to five decimal places by RegulaFalsi method using the formula four times. Solution Here f(x) = x log10 x 1.2 f(2) = 0.6, f(3) = 0.23. Thus the root lies between a and 3 and it is nearer to 3.
54
NUMERICAL ANALYSIS
x0 =
Now We note that
bg bg b g b g bg bg b g
x1 =
since f(2.74) = 0.0006
x2 =
since but
x3 =
= 2.7392 is the required value. Example 2.27 Solve the equation x tan x = 1, by Regula falsi method starting with 2.5 and 3.0 as the initial approximations to the root. Solution. We have f(x) = x tan x + 1 f(a) = f(2.5) = 2.5 tan (2.5) + 1 = 0.8675 f(b) = f(3) = 3 tan 3 + 1 = 0.5724 By regula falsi method, the first approximation is given by x1 = =
af (b) bf ( a ) f (b ) f ( a )
= 2.8012 Now, f(x1) = f(2.8012) = 2.8012 tan (2.8012) + 1 = 0.00787 f(2.5) f(2.8012) < 0 therefore, the root lies between 2.5 and 2.8012. The second approximation to the root is given by x2 =
2.8012 f ( 2.5) 2.5 f ( 2.8012 ) f ( 2.5) f ( 2.8012 )
55
= 2.7984 f(x2) = f(2.7984) = 2.7984 tan (2.7984) + 1 = 0.000039 f(2.5) f(2.7984) < 0 The root lies between 2.5 and 2.79 84 The third approximation to the root is given by x3 = =
2.8 MULLERS METHOD Mullers method is an iterative method. It requires three starting points. (x0, f(x0)), (x1, f(x1)) and (x2, f(x2)). A parabola is constructed that passes through these points then the quadratic formula is used to find a root of the quadratic for the next approximation. Without loss of generality we assume that x2 is the best approximation to the root and consider the parabola through the three starting values as shown in Fig. 2.5. Make the change of variable using the differences (18) t = x x2 (19) using the differences h0 = x0 x2 and h1 = x1 x2.
Consider the quadratic polynomial involving t y = at2 + bt + c each point is used to obtain an equation involving a, b and c
2 at t = h0 ; ah0 + bh0 + c = f 0
(20)
at t = h1 ; ah12 + bh1 + c = f 1
at t = 0; a 02 + b 0 + c = f 2
from equation (23) we get c = f2. Substituting c = f2 in (21) and (22) and using e0 = f0 c, e1 = f1 c, we get
2 + bh0 = f 0 c = e0 , ah0
(24) (25)
ah12 + bh1 = f 1 c = e1
56
NUMERICAL ANALYSIS
(x1, f(x1)) 1
Fig. 2.5
a=
e0 h1 e1h0 e h 2 e0 h12 , b= 1 0 h0 h1 h0 h1 h0 h1 h0 h1
2 c
1/ 2
(26)
The formula (26) is equivalent to the standard formula for the roots of a quadratic equation since c = f2 is known to give better results.
Note: If b > 0, we use the positive sign with the square root and if b < 0, we use the negative sign. We choose the root of (26) that has the smallest absolute value. x3 is given by x3 = x2 + z (27) (see Fig. 2.5). For the next iteration choose x0 and x1 to be the two values selected from (x0, x1, x2) that lie closest to x3 then replace x2 with x3. Example 2.28 Find the root of the equation f(x) = x3 3x 5 = 0, which lies between 2 and 3 by using Mullers Method. Solution We choose x0 = 1, x1 = 2, x2 = 3
3 f 0 = x0 3 x0 5 = 1 3 5 = 7 3 3x1 5 = 8 6 5 = 3 f 1 = x1
we obtain
3 f 2 = x2 3x2 5 = 27 9 5 = 13
h0 = x0 x2 = 1 3 = 2 and h1 = x1 x2 = 2 3 = 1 y = at2 + bt + c
3
FINITE DIFFERENCES
3.1 INTRODUCTION Numerical Analysis is a branch of mathematics which leads to approximate solution by repeated application of four basic operations of Algebra. The knowledge of finite differences is essential for the study of Numerical Analysis. In this section we introduce few basic operators. 3.2 FORWARD DIFFERENCE OPERATOR Let y = f(x) be any function given by the values y0, y1, y2, , yn, which it takes for the equidistant values x0, x1, x2, , xn, of the independent variable x, then y1 y0, y2 y1, , yn yn 1 are called the first differences of the function y. They are denoted by y0 , y1 , , etc.
We have
y0 = y1 y0 y1 = y2 y1 ... yn = yn yn 1
The symbol is called the difference operator. The differences of the first differences denoted by 2 y0 , 2 y1 , ..., 2 yn are called second differences, where
...
2 y1 = y1 = y3 2 y2 + y1
...
60
FINITE DIFFERENCES
61
3 y0 = 2 y1 2 y0
= y3 3 y2 + 3 y1 y0
...
r yn = r 1 y n + 1 r 1 yn
= yn + r
r r 1 r r yn + r 1 + yn + r 2 + ... + 1 yn 1! 2!
b g b
b g
r yn = r 1 yn + 1 r 1 yn
= yn + r
r n1 r r yn + r 1 + yn + r 2 + ... + 1 yn 1! 2!
b g
3.2.1 Difference Table It is a convenient method for displaying the successive differences of a function. The following table is an example to show how the differences are formed.
x y
2 y
3 y
4 y
5 y
x0
y0
y0 x1 x2
x3
y1
y1
2 y0 3 y0 2 y1
y2
y2
y3
4 y0 3 y1 5 y0 4 y1 3 y2
2 y2
y3
x4 x5
y4
y4
2 y3
y5
The above table is called a diagonal difference table. The first term in the table is y0. It is called the leading term. The differences y0 , 2 y0 , 3 y0 , ..., are called the leading differences. The differences n yn with a fixed subscript are called forward differences. In forming such a difference table care must be taken to maintain correct sign.
62
NUMERICAL ANALYSIS
A convenient check may be obtained by noting the sum of the entries in any column equals the differences between the first and the last entries in preceding column. Another type of difference table called horizontal difference table which is more compact and convenient is not discussed here as it is beyond the scope of this book.
f a = f a + h f a ,
bg b
g bg
bg
f a + h = f a + h + h f a + h = f a + 2h f a + h
Similarly
2
g b
g b g b g b g f ba g = f ba g = f b a + hg f b a g = f b a + hg f b a g = f b a + 2hg f b a + hg f b a + hg f b a g = f b a + 2hg 2 f b a + hg + f b a g ,
= f ( x + h) f ( x )
= f ( x + h ) f ( x )
= f ( x + 2h) f ( x + h) f ( x + h) f ( x )
= f ( x + 2h) 2 f ( x + h) f ( x ). Similarly we can write the other higher order differences as 3 , 4 , ..., etc., and , 2 , 3 , ..., n , ..., etc., are called the forward differences. The difference table called the forward difference table in the new notation is given below.
FINITE DIFFERENCES
63
f(x)
x+h
f x+h
g g
f x
bg
g g
2
x + 2h
f x + 2h
f x + h
2 f x
bg g
x + 3h
f x + 3h
f x + 2h
f x+h
3 f x
bg
f x = f x + h f x = c c = 0 c = 0
bg b
g bg
bg bg bg bg Proof f b x g + gb xg = f b x + hg + gb x + hg f b xg + gb x g = f b x + hg f b x g + g b x + hg gb x g = f b x g + gb xg . Similarly we can show that f b x g gb x g = f b x g gb x g 3. If c is a constant then cf b x g = cf b x g . Proof cf b x g = cf b x + hg cf b x g = c f b x + hg f b x g = cf b x g cf b x g = cf b x g . f b xg . 4. If m and n are positive integers then f b x g =
2. is distributive, i.e., f x g x = f x g x .
m n m+ n
64
NUMERICAL ANALYSIS
bg b
gb g bg = c ... bm + ng timesh f b x g f b xg . =
m+ n
bg
bg
7.
Note:
bg bg bg bg f b x g g b x g = f b x g g b x g + g b x g f b x g . L f b xg OP = gb xg f b xg f b xg gb xg . M g b x g g b x + hg MN gb xg PQ
1. From the properties (2) and (3) it is clear that is a linear operator. 2. If n is a positive integer n.[n f (x)] = f (x)] = f (x) and in particular when n = 1, n.[1 f (x)] = f (x)] = f (x). Example 3.1 Find (a) eax (b) 2e x (c) sin x (d) log x (e) tan1 x. Solution (a)
e ax = e
a x+h
b g
e ax
= e ax + ah e ax = e ax e ah 1
e ax = e ax e ah 1 .
(b)
2 e x = e x
= ex+h ex
h x
(c)
i = de 1i e = de 1i de e i = de 1i e e = de 1i e . sin x = sin b x + hg sin x F x + h + x IJ sin FG x + h x IJ = 2 cos G H 2 K H 2 K F hI h = 2 cos G x + J sin H 2K 2 F hI h sin x = 2 cos G x + J sin . H 2K 2
= e x eh 1
h x +h x h 2 2 x h 2 x
FINITE DIFFERENCES
65
(d)
log x = log 1 +
(e)
LM N
b g LM x + h x OP MN1 + b x + hg x PQ
20 0.347
OP Q
LM N
OP Q
LM h OP . N1 + hx + x Q
2
Example 3.2 Construct a forward difference table for the following data x y Solution x 0 10 20 30 y 0 0.174 0.174 0.173 0.347 0.171 0.518 0.002 0.001 0.001 0 0 10 0.174 30 0.518
2 y
3 y
Example 3.3 Construct a difference table for y = f(x) = x3 + 2x + 1 for x = 1, 2, 3, 4, 5. Solution x 1 2 3 4 5 y = f(x) 4 9 13 21 34 39 73 63 136 24 18 6 12 6
2 y
3 y
Theorem 3.1 The nth differences of a polynomial of the nth degree are constant when the values of independent variable are at equal intervals.
66
NUMERICAL ANALYSIS
Proof Let the polynomial be f ( x ) = a0xn + a1xn where a0, a1, a2, , an are constants and a0 0.
1
+ + an
x + an,
+ + an 1(x + h) + an,
where h is the interval of differencing. f ( x ) = f(x + h) f(x) = a0(x + h)n + a1(x + h)n 1 + + an(x + h) + an a0xn a1xn 1 an 1 x an = a0 [(x + h)n xn] + a1 [(x + h)n = = = [xn
1
xn 1] + + an + an bm
+ nc1xn 1 h + nc2xn 2 h2 + + hn xn] a0 n + h 1 xn 1] + + an 1h a0nhxn 1 + [a0nc2h2 + a1h(n 1)]xn 2 + + a0nhxn 1 + b2xn 2 + b3xn 3 + + bn 1x +
1 [x + h x] n a1 [x 1 + n 1c1xn 2h 1h
(1)
where b2, b3, , bm are constants. From (1) it is clear that the first difference of f(x) is a polynomial of (n 1)th degree. Similarly
2 f x = f x
bg
bg
g bg = f b x + hg f b x g = a nh b x + hg x
= f x+h f x
n 1 0
n 1
+ b2 x + h
n2
x n 2 + ... +
bn 1 x + h x = a0 n n 1 h 2 x n 2 + c3 a n 3 + c4 x n 4 + ... + cn 1 x + c l ,
are constants.
Therefore the second differences of f(x) reduces to a polynomial of (n 2)th degree. Proceeding as above and differencing for n times we get
n f x = a0 n n 1 ... 3 2 1h x x n n = a0n!h n ,
which is a constant. and
bg
n + 1 f x = n f x
bg
bg
= a n n ! h n a 0 n! h n = 0
which completes the proof of the theorem.
Note: The converse of the above theorem is true, i.e., if the nth differences of a tabulated function and the values of the independent variable are equally spaced then the function is a polynomial of degree n.
FINITE DIFFERENCES
67
Example 3.4 By constructing a difference table and taking the second order differences as constant find the sixth term of the series 8, 12, 19, 29, 42, . Solution Let K be the sixth term of the series. The difference table is x 1 2 3 y 8 4 12 7 19 10 4 5 6 The second differences are constant. 29 13 42 K 4 K K 55 3 3 3
The sixth term of the series is 58. Example 3.5 (1 3x) Solution (a) Let
f x = 1 ax a bx 2 1 cx 3 1 dx 4
f(x) is a polynomial of degree 10 and the coefficient of x10 is abcd,
bg b
gd
id
id
10 f x = 10 abcd x 10
bg
= abcd 10 x 10
= abcd 10!.
(b) Let f(x) = (1 x) (1 2x) (1 3x) = 6x3 + 11x2 6x + 1 f(x) is a polynomial of degree 3 and the coefficient of x3 is ( 6).
3 f x = 6 3! = 36 .
Example 3.6 Evaluate (a) Solution (a)
bg b g
LM 5x + 12 OP N x + 5x + 6 Q
2
68
NUMERICAL ANALYSIS
LM 2b x + 3g + 3b x + 2g OP = L 2 + 3 O MN b x + 2gb x + 3g PQ MN x + 2 x + 3 PQ L 2 OP + LM 3 OP = M N x + 2 Q N x + 3Q L 2 2 OP + LM 3 3 OP =M N x + 1 + 2 x + 2 Q N x + 1 + 3 x + 3Q
=
=
(b)
Now
gb g b L1O M P NxQ
gb
FG H
a 2
IJ K
sin ax + b + n
Solution
b g b g L F aIO F aI = 2 Mcos G ax + b + J P sin G J H K 2 N Q H 2K F F a a II = 2 sin sin G + G ax + b + J J H2 H 2 2KK a + O a L = 2 sin sin Mbax + bg + 2 2 P N Q, a a + I a a + I F F sin bax + bg = 2 sin sin G ab x + 1g + b + 2 sin sin G b ax + bg + J J H K H 2 2 K 2 2
sin ax + b = sin a x + 1 + b sin ax + b
2
LM N
FG a + IJ OP, H 2 KQ
= 2 sin
FG H
2a + a a sin 2 cos ax + b + 2 2 2
IJ K
FG H
IJ K
FINITE DIFFERENCES
69
FG + ax + b + 2a + IJ H2 2 K F F a + IJ IJ . sin G ax + b + 2 G H 2 KK H
sin
n sin ax + b = 2 sin
g FGH
a 2
IJ K
sin ax + b + n
FG H
FG a + IJ IJ . H 2 KK
3.3 THE OPERATOR E Let y = f(x) be function of x and x, x + h, x + 2h, x + 3h, , etc., be the consecutive values of x, then the operator E is defined as Ef ( x ) = f(x + h), E is called shift operator. It is also called displacement operator.
Note: E is only a symbol but not an algebraic sum. E2f(x) means the operator E is applied twice on f(x), i.e., E2f(x) = E[Ef(x)] = Ef(x + h) = f(x + 2h) Similarly and Enf(x) = f(x + nh) Enf(x) = f(x nh). The operator E has the following properties: 1. E(f1(x) + f2(x) + + fn(x)) = Ef1(x) + Ef2(x) + + Efn(x) 2. E(cf(x)) = cEf(x) (where c is constant) 3. Em(Enf(x)) = En(Emf(x)) = Em + nf(x) where m, n are positive integers 4. If n is positive integer En[Enf(x)] = f(x)
Alternative notation If y0, y1, y2, , yn, , etc., are consecutive values of the function y = f(x) corresponding to equally spaced values x0, x1, x2, , xn, etc., of x then in alternative notation E y0 = y1 E y1 = y2 E2y0 = y2 and in general En y
0
= yn.
Theorem 3.2 If n is a positive integer then yn = y0 + nc1 y0 + nc2 2 y0 + + n y0. Proof From the definition
y1 = Ey0 = 1 + y0 = y0 + y0
70
NUMERICAL ANALYSIS
y 2 = E 2 y 0 = 1 + y0 = 1 + 2c1 + 2 y0
= y0 + 2c1 y0 + 2 y0
L
Similarly we get
yn = E n y0 = 1 + y0
= 1 + nc1 + ... + n y0
= y0 + nc1 y0 + ... + n y0 ,
hence proved.
f x = f x + h f x ,
where h is the interval of differencing. Using the operator E we can write
bg b
g bg
f x = Ef x f x
bg bg bg f b x g = b E 1g f b x g .
= E 1 E = 1 + .
i.e.,
3.3.2 E E
Proof
Ef x = E f x + h f x
b g c b g b gh = Ef b x + hg Ef b x g = f b x + 2hg f b x + hg = f b x + hg = Ef b x g
f ( x ) . f (x)
E E .
Example 3.8 Prove that log f ( x ) = log 1 + Solution Let h be the interval of differencing
LM N
OP Q
f x+h =Ef x
b g = b + 1g f b xg
= f x + f x
bg bg
FINITE DIFFERENCES
71
f x+h f x
g = f b xg + 1, b g f b xg
F Ix . GH E JK
2 3
F I x = d E i x GH E JK
2 3 2 1
= (E 1)2 E1 x3 = (E2 2E + 1) E1 x3 = (E 2 + E1) x3 = Ex3 2x3 + E1 x3 = (x + h)3 2x3 + (x h)3 = 6xh. Note If h = 1, then
F Ix GH E JK
2
= 6 x.
2 x Ee x e . 2 x , the interval of differencing being h. E e
Ef x = f x+h
bg b
g i
2
E ex = ex+h ,
again ex = ex+h ex = ex (eh 1)
2 e x = e x . e h 1
2
F I e = d E i e = e GH E JK = e d e i = e e de
x 2 1 x 2 x h h 2 x h x
R.H.S. = e h e x ( eh 1)
e x+h = ex. e x ( eh 1)
72
NUMERICAL ANALYSIS
Example 3.11 Prove that f(4) = f(3) + f(2) + 2 f(1) + 3 f(1). Solution
f 4 f 3 =f 3
bg bg
bg = f b2 g + f b 2g csince f b3g f b 2g = f b2 gh = f b2g + f b2g = f b2g + f b1g + f b1g = f b2g + f b1g + f b1g f b4g = f b3g + f b2g + f b1g + f b1g .
2
2
Example 3.12 Given u0 = 1, u1 = 11, u2 = 21, u3 = 28 and u4 = 29, find 4u0. Solution 4u0 = (E 1)4u0 = = = = = (E4 4c1E3 + 4c2 E2 4c3 E + 1) u0 E4y0 4E3u0 + 6 E2 u0 4Eu0 + u0 u4 4u3 + 6u2 4u1 + u0 29 112 + 126 44 + 1 0.
Example 3.13 Given u0 = 3, u1 = 12, u2 = 81, u3 = 200, u4 = 100, and u5 = 8, find 5u0 . Solution
5u0 = (E 1)5u0
= (E5 5E4 + 10E3 10E2 + 5E 1)u0 = u5 5u4 + 10u3 10u2 + 5u1 u0 = 8 500 + 2000 810 + 60 3 = 755.
Example 3.14 Find the first term of the series whose second and subsequent terms are 8, 3, 0, 1, 0, Solution Given f(2) = 8, f(3) = 3, f(3) = 0, f(4) = 1, f(5) = 0, we are to find f(1). We construct the difference table with the given values. x 2 3 4 5 6 We have
f x
8
bg
3
f x
bg
2 f x
bg
3 f x
bg
4 f x
bg
5 2 3 0 1 1 1 0 2 2 0 0 0
3 f x = 4 f x = ... = 0 .
bg
bg
FINITE DIFFERENCES
73
f 1 = E 1 f 2
bg
f 1 = 15.
bg
3.4
THE OPERATOR D
dy d . The . We have Dy = dx dx
bg
d f x = f x dx
bg
bg
D2 f x =
From the definition we have
bg
d2 f x = f x dx 2
bg
bg
etc.
Ef ( x ) = f(x + h)
= f x + = f x +
bg bg
h h2 f x + f x + ... 1! 2! h h2 2 Df x + D f x + ... 1! 2!
(expanding by Taylors series method)
bg
bg
bg
2
bg
F h D + h D + ...I f b xg GH 1! 2! JK F hD + h D + ...I f b xg = e f b xg = G1 + H 1! 2! JK Ef b x g = e f b x g ,
= 1+
2 2 2 hD
hD
E e hD .
74
NUMERICAL ANALYSIS
We have already proved that E 1 + and E e hD . Now consider E = e hD . Applying logarithms, we get
1 2 3 4 + + ... . h 2 3 4
LM N
OP Q
3.5
BACKWARD DIFFERENCES
Let y = f(x) be a function given by the values y0, y1, yn which it takes for the equally spaced values x0, x1, , xn of the independent variable x. Then y y0, y2 y1, , yn yn 1 are called the first backward differences of y = f(x). They are denoted by y0 , y1 , ..., yn , respectively. Thus we have
y1 y0 = y1 y2 y1 = y2 L y n y n 1 = y n ,
y y0
2 y
3 y
4 y
y1 y1
2 y2
y 2
3 y3 y3
2
y2
4 y4 3 y4
y3 y3 y 4 x4 y4
y4
2
Note: In the above table the differences n y with a fixed subscript i, lie along the diagonal upward sloping.
Alternative notation Let the function y = f(x) be given at equal spaces of the independent variable x at x = a, a + h, a + 2h, then we define
f a = f a f a h
bg bg b
where is called the backward difference operator, h is called the interval of differencing.
FINITE DIFFERENCES
75
We observe that
bg bg b g f b x + hg = f b x + hg f b x g = f b x g f b x + 2hg = f b x + 2hg f b x + hg = f b x + hg
f x = f x f x h . f x + nh = f x + nh f x + n 1 h
Similarly we get
g c b = f c x + bn 1g hh . f b x + 2hg = f b x + 2hg = f b x + hg = f b x g = f b xg
2
g b
gh
n f x + nh = n f x .
Relation between E and :
bg
f x = f x f x h = f x E 1 f x
bg bg b
= E 1 . E
g bg
bg
= 1 E 1
or
gb
Solution (a)
(b)
b1 + gb1 g f b xg = E E f b xg = Ef b x hg = f b x g = 1. f ( x ) b1 + gb1 g 1. f b x g = b E 1g d1 E i f b x g = b E 1g f b x g f b x hg
1
1
76
NUMERICAL ANALYSIS
bg bg b g b g = f b x + h g f b x g f b x g + f b x hg = Ef b x g f b x g f b x g f b x hg = b E 1g f b x g d1 E i f b x g = b E 1g d1 E i f b x g = b g f b x g f b x g = b g f b x g
= Ef x f x Ef x h + f x h
1
= .
(c) and
f x = 1 E 1 f x
E 1
bg d f b x g = E
i b g = f b x g f b x hg f b x + hg f b x g = f b x g f b x hg
1
= E 1 .
3.6 FACTORIAL POLYNOMIAL A factorial polynomial denoted by xr is the product of r consecutive factors of which the first factor is x and successive factors are decreased by a constant h > 0. Thus xr = x(x h) (x 2h) ... [x (r 1)h].
When h = 1 and in particular
x r = x x 1 x 2 ... x r + 1
gb
g b
x0 = 1 x1 = x x r = x + h
b g x = b x + hg x b x hg ... c x + h b x 1g hh xb x 1g ... c x b x 1g hh
r r
= rhx b
r 1
g.
r x r = r r 1 ... 1 h r = h r r !.
b g
FINITE DIFFERENCES
77
Note: 1.
r +1 r
x =0
2. If the interval of differencing is unity then the successive differences of xr, can be obtained by ordinary successive differentiation of xr. 3. If r is a positive integer then
x( r ) = x( r ) = 1 ( x + h) ( x + 2h)...( x + rh) 1 . ( x + 1) ( x + 2)...( x + r )
and if r = 1
3.6.1 To Express a given Polynomial in Factorial Notation A polynomial of degree r can be expressed as a fractional polynomial of the same degree. Let f(x) be a polynomial of degree which is to be expressed in factorial notation and let
r 1 2 f ( x ) = a0 + a1x + a2 x + .... + ar x
(2)
g bg f b x g = a + 2a x + ... + ra x b g f b x g = 2a + 2 3a x + ... + r br 1g x b
f x = a1 + 2a2 x1 + ... + rar x b
2 1 1 2
r 1
r 1
r 2
f x = ar r r 1 ... 2 1 x b 0g
r
bg
b g
f 0 1!
= ar r !.
Substituting x = 0 in the above we get
f 0 = a0 ,
bg
2!
r!
bg bg
f 0 1!
bgx
2 f 0 2!
bgx
+ ... +
r f 0 r!
bgx .
r
Example 3.16 If m is a positive integer and interval of differencing is 1, prove that (a) 2 x ( x ) = m(m 1) x ( m 2 ) (b) 2 x ( m) = m(m + 1) x ( m 2 ) Solution (a) x b
m
= x x 1 ... x m 1
78
NUMERICAL ANALYSIS
x b
= mx b
g
= m x b
m 1
2 x b
(b) x b
m
m = x b g
= m m 1 x m 2 .
1 , x + 1 x + 2 ... x + m
gb
g b
xb
1 1 x + 2 x + 1 ... x + m + 1 x + 1 ... x + m
gb
m 1
n o r = n r nc1 n 1 + nc2 n 2
Proof
b g
... + nc4 1 .
b g
+ nc2En
+ + (1)n]xr
2
= Enxr nc1En
nc 1(1)
1xr
+ nc2En
+ + (1)\xr
+ 1)r + (1)nxr.
Substituting x = 0, we get
n o r = nr nc1 (n 1)r + nc2(n 2)r + + ncn(1)r. 3o 4 = 34 3c1(3 1)4 + 3c2(3 2)4 + 3c3(3 3)4 = 81 3c1 16 + 3 + 0
= 36.
Note:
n r 1. When n . r , o = 0
2. no n = n! 3. o r = 1r = 1
FINITE DIFFERENCES
79
Example 3.17 Prove that (a) 2o3 = 6 (b) 3o3 = 6 Solution (a) 2 o 3 = 2 3 2.13 = 6 . (b) 3o 3 = 33 3.2 3 + 31 . 3 = 6. Example 3.18 Calculate (a) 3o6 = 6 (b) 5o6 (c) 6 o6 Solution (a)
3o 6 = 36 3.2 6 + 31 .6
= 729 192 + 3 = 540.
(b)
(c)
6 o 6 = 6!.
Example 3.19 Express f(x) = 3x3 + x2 + x + 1, in the factorial notation, interval of differencing being unity. Solution f(x) is a polynomial of degree 3.
We can write
f x = f 0 +
bg bg
f 0 1!
b g x b g + f b0g x b g + f b0g x b g .
2 3 1 2 3
2!
3!
(3)
The interval of differencing is unit and finding the values of the function at x = 0, 1, 2 and 3, we get
x
0 1 2 3
f x
bg
1 6
f x
bg
5
2 f x
bg
20
3 f x
bg
25 31 63 94 38
16
From the table we have f 0 = 1, f 0 = 5, 2 f 0 = 20, 3 f 0 = 18 . Substituting the above values in (3) we get 20 b 2 g 18 b 3g 1 f x = 1 + 5x b g + x + x , 2! 3!
bg
bg
bg
bg
bg f b x g = 3x b g + 10 x b g + 5x b g + 1.
3 2 1
80
NUMERICAL ANALYSIS
= ax x 1 x 2 + bx x 1 + cx + d
Putting x = 0 in (4) we get Putting x = 1 in (4) we get Putting x = 2 in (4) we get 1 = d. c = 5. 31 = 2b + 11 10. sides of (4) we get 3 3x(3) + 10x(2) + 5x(1) + 1.
gb
(4)
1. Unless stated the interval of differencing is taken to be unity (i.e., h = 1). 2. We can also use another method known as synthetic division to express given polynomial in its factorial notation. Example 3.20 Express 3x3 4x2 + 3x 11, in factorial notation. Solution Here we apply the method of synthetic division as follows: Omit the coefficients of x 3, x 2 , x the signs of constant terms in ( x 1), ( x 2), (x 3), are changed so that addition takes the place of subtraction and the remainders are obtained. Thus 1 3 0 2 3 0 3 3 0 3 = A 4 3 1 6 5 = B 3 1 2 = C 11 = D
3 x 3 4 x 2 + 3 x 11 = 3x b 3g + 5x b 2 g + 2 x b1g 11.
Note While applying the methods of synthetic division the coefficients of powers of x should be arranged in descending order, counting zero for the coefficient of missing term. Example 3.21 Express f(x) = x4 5x3 + 3x + 4 in terms of factorial polynomials (by using the method of detached coefficients). Solution By the method of synthetic division (method of detached coefficients) we get 1 2 3 4 1 0 1 0 1 0 1 0 1 = A
3 + xb g 2 8x b g
5 1 4 2 2 3 1 = B
0 4 4 4 8 = C
3 4 1 = D
4 = E
4 f b xg = x b g
x b g + 4.
1
FINITE DIFFERENCES
81
Example 3.22 Obtain a function whose first difference is 6x2 + 10x + 11. Solution Expressing the function in factorial notation, we get
6 x 2 + 10 x + 11 = 6 x b 2 g + 16 x b1g + 11
f (x) = 6x(2) + 16x(1) + 11 Integrating we get
f x =
b3g
b2g
b1g
n o r = n n r 1
LM bn 1g + bn 1gbn 2g + + OP ... b 1g 1! 2! MN PQ L bn 1gbn 1g + bn 1gbn 2gbn 2g = n Mn 1! 2! MN = n b1 + n 1g b gc bn 1g + b gc bn 2g = n b1 + n 1g b gc b1 + n 2g + ... + b 1g = n E 1 b gc E b1g + b gc E b1g =n E 1 b1g = n b1g = n E bog csince 1 = E bogh = n b1 + g o
r r r r 1 r 1 r 1 n 1 r 1 n 1 1 2 n 1 r 1 r 1 n 1 r 1 n 1 n2 r 1 n 1 n3 1 2
r 1
+ ... + 1
r 1
O b g PP Q ... + b 1g
r r
r 1
... + 1
b g
n 1
r 1
n 1
n 1
r 1
r 1
n 1
r 1
= n n 1 o r 1 + n o r 1
which is the required relation.
n n +1 = Example 3.23 Prove that o
n n+1 2
go .
n n
Solution
We know that n o m = n n 1 o m 1 + n o m 1 .
82
NUMERICAL ANALYSIS
n o n + 1 = n n 1 o n + n o n n 1o n = n 1 n 2 o n 1 + n 1 o n 1 n 2 o n 1
n3
b g = bn 2 g
L
o n 2 + n 2 o n 2
2 o 3 = 2 o 2 + 2 o 2 o 3 = 1 0 o1 + 1 o1 .
By back substituting of the above values we have
n o n + 1 = n n o n + n n 1 n 1o n 1 + n n 1 n 2 n 2 o n 2 +
b gb g = n! n + bn 1g + bn 2g + ... + 2 + 1 n bn + 1g n bn + 1g = n! = o .
... + n n 1 n 2 ... 2 1 o
1 1 n n
gb
3.7 ERROR PROPAGATION IN A DIFFERENCE TABLE Let y0, y1, y2, , yn be the values of the function y = f(x) and the value y5 be effected with an error , such that the erroneous value of y5 is y5 + . In this case the error effects the successive differences and spreads out facewise as higher orders are formed in the table. The table given below shows us the effect of the error.
y
y0 y
2 y
3 y
y0 y1
y1 y2
2 y0 3 y0 y0
2
y2 y3
y3 y4
2
3 y1 y1
2
3 y2 + y3 + 3 y3 3 2 y4 2 3 y4 + 3 2 y5 + 3 y5 y6
2
y4 + y5 +
y 5 y6
y6 y7
y7 y8
3 y6 y7
2
y8 y9
FINITE DIFFERENCES
83
Example 3.24 The following is a table of values of a polynomial of degree 5. It is given that f(3) is in error. Correct the error. x y 0 1 1 2 2 33 3 254 4 1054 5 3126 6 7777
x
0
y
1
2 y
3 y
4 y
5 y
1 1 2 31 2 33 30
160 + 190 + 200 4 360 3 550 2 420 + 6 1780 + 3 1330 + 440 4 1220
12550
221 +
3
220 + 10 20 10
254 + 1771
1.50 2101
3126 4651
7777
bg f b3g = 244 .
3.8
CENTRAL DIFFERENCES
The operator : We now introduce another operator known as the central difference operator to represent the successive differences of a function in a more convenient way. The central difference operator, denoted by the symbol is defined by
y1 y0 = y1/ 2
84
NUMERICAL ANALYSIS
y2 y1 = y3/ 2 L
yn yn 1 = yn 1/ 2 .
For higher order differences
y3/ 2 y1/ 2 = 2 y1
y2 y1 = 2 y3/ 2 L n 1 yr + 1/ 2 n 1 yr 1/ 2 = n yr = E 1/ 2 E 1/ 2
In its alternative notation
f x = f x+
iy
n
b g FGH
2
1 1 h f x h , 2 2
IJ K
FG H
IJ K
where h is the interval of differencing. The central difference table can be formed as follows.
x
x0 x1 x2 x3 x4 x5 x6
y
y0
y1/ 2 y1 y 3 / 2 y2 y5 / 2 y3 y 7 / 2 y4 y 9 / 2 y5 y11/ 2 y6
2 y1 3 y3 / 2 2 y2 3 y5/ 2 2 y3 3 y7 / 2 2 y4 3 y9 / 2 2 y5 4 y4 4 y3 5 y7 / 2 4 y2 5 y5/ 2 6 y3
3.9
MEAN OPERATOR
1L F 1 I F 1 IO hJ + f G x hJ P . bg 2 MN f GH x + 2 K H 2 KQ
In addition to the operator , , E and , we define the mean operator (averaging operator) as
f x =
FINITE DIFFERENCES
85
Alternative notation If y = f(x) is a functional notation between the variable x and y then it can also denoted by y = fx or by y = yx. Let yx, yx + h, yx + 2h, , etc., denote the values of the dependent variable y = yx, corresponding to the values x, x + h, x + 2h, , etc, of the independent variables then the operators , , , and are defined as
y x = y x + h y x
y x = y x y x h y x = y
1h x +2
1h x2
1 y 1 + y 1 , x 2h 2 x + 2h
FG H
IJ K
f ( x) = f x +
(i)
Further
FG 1 hIJ f FG x 1 hIJ H 2K H 2K F 1I F 1I f b x g = f G x + hJ f G x hJ H 2K H 2K = E f b xg E f b xg = dE E i f b xg dE E i f b xg = E b E 1g f b xg = E f b xg
1/ 2 1/ 2 1/ 2 1/ 2 1/ 2 1/ 2 1/ 2 1/ 2
= E 1/ 2 .
Note: From the above result we get E 1/ 2 =
(ii )
f x =
1L F 1 I F 1 IO hJ + f G x hJ P bg 2 MN f GH x + 2 K H 2 KQ 1 = E +E f b xg 2
1/ 2 1/ 2
1 1/ 2 E + E 1/ 2 . 2
86
NUMERICAL ANALYSIS
(iii)
E f x = E f x f x h
bg
bg b g = Ef b x g Ef b x hg = f b x + hg f b x g = f b x g
b b g bg g
E
and
Ef x = f x + h
bg
= f x+h f x E = E = E.
=f x
bg
Note: From the above it is clear that operators E and commute and , , , E and also commute.
3.10 SEPARATION OF SYMBOLS The symbolic relation between the operators can be used to prove a number of identities. The method used is known as the method of separation of symbols. Few examples based on this method are given below.
Example 3.25 Use the method of separation of symbols to prove the following identities: (a) u0 u1 + u2 ... = (b) u0 +
1 1 1 u0 u0 + 2u0 ... 2 4 8
LM MN
OP PQ
2 (c) ( u1 u0 ) x( u2 u1 ) + x ( u3 u2 ) ... =
u0 2u0 2 u0 ... x + x2 2 1+ x (1 + x ) (1 + x )3
d i = b1 + E g u = b1 + 1 + g u = b2 + g u F I = 2 G1 + J u H 2K O 1L = M1 + + ...P u 2N 2 2 2 Q
= 1 E + E 2 ... u0
1 0 1 1 0
1 1 0
FINITE DIFFERENCES
87
u0 u1 + u2 u3
LM N 1L + ... = Mu 2N
=
OP Q O + ...P Q
(b)
u0 +
LM N
xE x 2 E 2 x3E 3 + + + ... u0 1! 2! 3!
OP Q
= e x Eu0 = e x b1+ g u0 = e x e x u0 . = ex 1 +
= ex
(c)
LHS = u u0 x u2 u0 + x2 u3 u2 ...
LM N LMu N
x x 2 2 + + ... u0 1! 2!
+ xu0 x 2 2 u0 + + ... . 1! 2!
OP Q
g b
OP Q
u0
...
x 1 x x 2 2 x 3 3 1+ x 1 = + ... u0 = u0 2 3 x 1 + x x 1+ x 1+ x 1+ x 1+ x
b g b g F IJ u = F I u =G H 1 + x + x K GH 1 + x b1 + g JK F IJ u = b1 + xE g u = L.H.S. =G H 1 + xE K
0 0
1 0 0
LM MN
OP PQ
LM MM MN
OP PP PQ
Example 3.26 Use the method of seperation of symbols and prove the following (a) (b) u x = ux1 + ux2 + 2ux3 + ... + nuxn u x = un ( n x )c1 un 1 + ( n x )c2 2 un 2 ...
+ ( 1)n x n x un ( n x )
88
NUMERICAL ANALYSIS
LM 1 E OP u + MN 1 E PQ L1 E O = M E Pu + u MN PQ
1 = E n n 1 x n n x n
= E 1 [1 + E 1 + 2 E 2 + ... + n 1 E ( n 1) ] ux + n ux n
n n n ux n = 1 1 E ux + n ux n E 1 E 1
xn
LM 1 E OP u MN 1 PQ
n n
LM MN
OP PQ
+ n ux n (Q E = 1 + E = 1)
= ux n ux n + n ux n = ux = L.H.S. (b)
(Q E n un = un x )
un = 1
LM N
OP Q
n x
un
LM E OP N E Q
n x
un =
FG 1 IJ H EK
n x
un = E ( n x ) un
= un ( n x ) = u x = L.H.S. Example 3.27 If ux = ax2 + bx + c, then show that u2n nc12u2n 1 + nc222u2n 2 + (2)nun = (1)n (c 2an). Solution Given that
ux = ax 2 + bx + c un = an 2 + bn + c .
un is a polynomial of degree 2 in n
3un = 4 un = ... = 0 .
Let the interval of differencing be equal to 1. Now
un = an 2 + bn + c un = a n + 1
and
+ b n + 1 + c an 2 bn c = 2an + a + b
2 un = un = 2a n + 1 + a + b 2an a b = 2a
FINITE DIFFERENCES
89
= E 2 un = E 1 1 un
= ( 1) n un Q = E 1
= ... = 0
n ux = n 1 e ax + b
= n 1 e ax eb = n 1eb e ax = e b n 1 e ax + h e ax
= eb n 1 eah 1 . eax
d = e de
b
= eb e ah 1 n 1 e ax
ah 2
i 1i
n 2 e ax
= eb e ah 1 e ax .
Example 3.29 If , , denote the forward, backward and central difference operators, and E, are respectively the shift and averaging operators in the analysis of data with equal spacing. Prove the following. (a) = 2 (d) 2 = 1 + (b) E 1/ 2 = + (e) =
1 1 , E 1/ 2 = 2 2
(c) =
1 2 2 + 1+ 2 4
1 2 4
1 1 E 1 + 2 2
90
NUMERICAL ANALYSIS
Solution (a)
= E 1/ 2 E 1/ 2
= E 1/ 2 E 1/ 2
= = 2
= 2 .
(b)
1 1 1/ 2 1 1/ 2 E + E 1/ 2 + E E 1/ 2 = 2 2 2 1 1 1/ 2 1 1/ 2 E + E 1/ 2 E E 1/ 2 = 2 2 2
i d
i i
4
1 2 E 1/ 2 = E 1/ 2 2
i d i
2
= E 1/ 2 .
(c)
1 2 1 1/ 2 2 E E 1/ 2 + 1+ = 2 4 2 = 1 1/ 2 E E 1/ 2 2
dE 1+
1/ 2
1/ 2
E 1/ 2
d d d d
i + dE
2
E 1/ 2
4 + E + E 1 2 4
1/ 2
1 E + E 1 2 + E 1/ 2 E 1/ 2 = 2 = =
i d
E i d
E 1/ 2 4
E 1/ 2 E 1/ 2 E 1/ 2 + E 1/ 2 1 E + E 1 2 + 2 2 1 1 E + E 1 2 + E E 1 2 2
i d
id
i d i
2
= E 1 = .
(d)
2 = = =
FG 1 IJ d E H 2K
2
1/ 2
+ E 1/ 2
1 E + E 1 + 2 4
d d
1 4
FH d E
1/ 2
E 1/ 2
+4
IK
1 2 1 + 4 = 1 + 2 4 4 1 2 . 4
2 = 1 + = =
(e)
1 1/ 2 E + E 1/ 2 E 1/ 2 E 1/ 2 2 1 E E 1 2
id
1 E 1 + 1 e1 2
FINITE DIFFERENCES
91
= =
1 1 + 1 E 1 2 2 1 1 + E 1 . 2 2
bg d
1 1 E 1 + 2 2 E
Example 3.30 If D, E, and be the operators with usual meaning and if hD = U where h is the interval of differencing. Prove the following relations between the operators: (i) E = eU Solution (i) By definition (ii) = 2sinh
U 2
(iii) = 2cosh
U 2
(iv) ( E + 1) = 2( E 1)
E = e hD
E = EU
bQ hD = U g
U 2
F GG GH
I JJ JK
1 U 2
= EU
d i dE i
1 2
U 2
U 2
dE i =
=
(iv)
U 1/ 2
+ EU 2
d i
1/ 2
E 1/ 2 + E 1/ 2 2
L.H.S. = (E + 1)
b gd = dE E = E dE = E dE
1/ 2 1/ 2 1/ 2
= E + 1 E 1/ 2 E 1/ 2
1/ 2
+ E 1/ 2 E 1/ 2
E 1/ 2
1/ 2
+ E 1/ 2 E 1/ 2
1/ 2
i dE i dE
1/ 2
E 1/ 2
i i
1/ 2
+ E 1/ 2
92
NUMERICAL ANALYSIS
1/ 2
1/ 2
bg
b g f b x ng
n
bg
Proof Let
f x =
b g a
n=0
xn ,
(5)
eb eb
y + nh t
=1+ =1+
t y + nh 1!
g + t b y + nhg
2
2!
t 3 y + nh 3!
+ ...
y + nh t
t nh t 2 nh 2 t 3 nh 3 E y+ E y + E y + ... 1! 2! 3!
(6)
eb
o + nh t
= e nht = 1 +
t nh t 2 nh 2 t 3 nh 3 E o+ E o + E o + ... 1! 2! 3!
FINITE DIFFERENCES
93
d i a de i = a e
ht n n n n=0 n=0
nht
L M N
n=0
an 1 +
t nh t 2 nh 2 t 3 nh 3 E o+ E o + E o + ... 1! 2! 3!
OP Q
n=0
an +
t3 t t2 an E nh o 3 + ... an E nh o + an E nh o 2 + 1! n = 0 2! n = 0 3! n = 0
= f 1 +
bg
t t2 t3 f E o+ f E o2 + f E o 3 + ... 1! 2! 3!
bg
bg
bg
Exercise 3.1
1. Show that = 1 e hD 2. Prove the following operator relations (a) = 1 (1 + ) 1 (c) 2 = (1 + ) 2 (b) = (1 + ) 1/ 2 (d )
=+
(f) = 2 sinh
FG hDIJ H2K
(h) r f k = r f k r
e j b
3. Find the values of (a) 2o 4. Prove the following (a) u0 + (b) 5o5 (c) 6o5
LM N
OP Q
(b) un un +1 + un + 2 + un + 3 + ...
=
1 3 1 1 1 u 1 2 u 3 + n 2 n 2 8 2! 8 2
LM MN
FG IJ HK
4 u
5 n 2
+ ...
OP PQ
2 n n n (c) u0 + c1 u1 x + c2 u2 x + ... = (1 + x ) + u0 + n
94
2 (d) u0 = u3 3u2 + 3u1 u0
NUMERICAL ANALYSIS
(e) If ux = 2n then un = ux
x (f) ux + h = ux + c1un 1 + x +1
c1 2un 2 + ...
2 3 5. Show that y4 = y3 + y2 + y1 + y1
6. Express the following functions in factorial notation (a) x4 12x3 + 42x2 30x + 9 (b) 2x4 7x2 + 5x 13 (c) 3x3 4x2 + 3x 11 (d) 2x3 3x2 + 3x + 15 (e) x4 5x3 + 3x + 4 (f) x4 2x2 x 7. Obtain the function whose first difference is ( a) e x (b) 2x3 + 5x2 6x + 13 (c) x4 5x3 + 3x + 4 (d) cx
1I b g FGH 2 JK Ef b xg. bg f b x g = 2 x x + 3x + 1 then show that f b x g = 12 x + 10. f b x g = e , then show that f b 0g, f b0g, f b 0g are in G.P.
2
3 2 2 ax 2
9. If 10. If
2 x 3 6 . = ( x + 1)2 Ex 3
12. Taking 1 as the interval of differencing, prove the following (i) tan ax (ii) 2 abc x = a bc 1 bcx (iii) (iv)
n x x n
cos a + bx +
FG H
n (b + ) 2
IJ K
(i) f ( x ) g ( x ) = f x g x + g x f x (ii)
bg bg bg bg L f b xg OP = gb xg f b xg f b xg gb xg M F hI g F x + hI MN gb xg PQ g x H 2K H 2K
FINITE DIFFERENCES
95
(iii)
bg bg
bg bg
1 f x g x 4
bg bg bg
f x 1 g x 1 = f x g x = f ( x 1) g x
15. Prove (i) y = (ii) y =
b g b g LM N
bg bg
1 2 y 3 y 4 y y + + ... and 2 3 4 h
1 h2
2 3 4
OP Q LM y + y + 11 y + ...OP 12 N Q
where the symbols have their usual meanings. 16. Given y0 + y8 = 1.9243, y1 + y7 = 1.9540 y2 + y6 = 1.9823 and y3 + y5 = 1.9956 Show that y4 = 0.9999557.
Answers
5. (a) x(4) 6x(3) + 13x(2) + x(1) + 9 (c) 3x(3) + 5x(2) + 2x(1) 11 (e) 6. (a) x(4) + x(3) 8x(2) x(1) + 4 (b) 2x(4) + 12x(3) + 7x(2) 13 (d) 2x(3) + 3x(2) + 2x(1) + 15 (f) (b ) x(4) + 4x(3) + x(2) 21
x ( 4 ) 11 ( 3) 1 ( 2 ) x + x + 13x (1) + K + 2 3 2 cx c1
(c)
(d)
96
NUMERICAL ANALYSIS
4
INTERPOLATION WITH EQUAL INTERVALS
4.1 INTRODUCTION The word interpolation denotes the method of computing the value of the function y = f(x) for any given value of the independent variable x when a set of values of y = f(x) for certain values of x are given. Definition 4.1: Interpoltation is the estimation of a most likely estimate in given conditions. It is the technique of estimating a Past figure (Hiral). According to Theile: Interpolation is the art of reading between the lines of a table. According to W.M. Harper: Interpolation consists in reading a value which lies between two extreme points. The study of interpoltation is based on the assumption that there are no sudden jumps in the values of the dependent variable for the period under consideration. It is also assumed that the rate of change of figures from one period to another is uniform.
Let y = f(x) be a function which takes the values y0, y1, y2, , yn, corresponding to the values x0, x1, x2, , xn of the independent variable x. If the form of the function y = f(x) is known we can very easily calculate the value of y correspondig to any value of x. But in most of the practical problems, the exact form of the function is not known. In such cases the function f(x) is replaced by a simpler function say ( x ) which has the same values as f(x) for x0, x1, x2, ..., xn. The function ( x ) is called an interpolating function.
4.2
MISSING VALUES
Let a function y = f(x) be given for equally spaced values x0, x1, x2, ..., xn of the argument and y0, y1, y2, , yn denote the corresponding values of the function. If one or more values of y = f(x) are missing we can find the missing values by using the relation between the operators E and .
4.3
Let y0, y1, y2, , yn denote the values of the function y = f(x) corresponding to the values x0, x0 + h, x0 + 2h , x0 + nh of x and let one of the values of y be missing since n values of the functions are known. We have
96
97
b E 1g
n y0 = 0
n
y0 = 0
E n nc1 E n 1 + n c2 E n 2 + ... + 1
E n y0 n E n 1 y0 + yn n yn 1 +
n n1
n n1 2
gy
1 2
n2
gE
b g
y0 = 0
n2
y0 + ... + 1 y0 = 0
b g
+ ... + 1 y0 = 0
b g
The above formula is called Newtons binomial expansion formula and is useful in finding the missing values without constructing the difference table.
Example 4.1 Find the missing entry in the following table x yx 0 1 1 3 2 9 3 4 81
4 y0 = 0
dE
4 E 3 + 6E 2
b E 1g y 4 E + 1i y
4
=0
=0
E 4y0 4 E 3 y0 + 6 E 2 y0 4 Ey0 + y0 = 0
y4 4 y3 + 6 y2 4 y1 + y0 = 0 81 4 y3 + 6 9 4 3 + 1 = 0 y3 = 31.
Example 4.2 Following are the population of a district Year (x) Population (y) 1881 363 1891 391 1901 421 1911 ? 1921 467 1931 501
Find the population of the year 1911. Solution We have y0 = 363, y1 = 391, y2 = 421, y3 = ?, y4 = 467, y5 = 501 Five values of y are given. Let us assume that y is a polynomial in x of degree 4. 5y0 = 0
b E 1g
y0 = 0
dE
5E 4 + 10 E 3 10 E 2 + 5E 1 y0 = 0 y5 5 y4 + 10 y3 10 y2 + 5 y1 y0 = 0
98
NUMERICAL ANALYSIS
y3 = 445.2
The population of the district in 1911 is 445.2 lakh. Example 4.3 Interpolate the missing entries x y = f(x) 0 0 1 2 8 3 15 4 5 35
Solution Given y0 = 0, y1 = ?, y2 = 8, y3 = 15, y4 = ?, y5 = 35. Three values are known. Let us assume that y = f(x) is a polynomial of degree 3.
dE
4 y0 = 0
4
4 E 3 + 6 E 2 4 E + 1 y0 = 0
b E 1g
y0 = 0
y4 4 y3 + 6 y2 4 y1 + y0 = 0 y4 4 15 + 6 8 4 y1 0 = 0 y4 4 y1 = 12
and (1)
5 y0 = 0
dE
5E 4 + 10 E 3 10 E 2 + 5E 1 y0 = 0
b E 1g y
5
=0
y5 5 y4 + 10 y3 10 y2 + 5 y1 y0 = 0
y1 = 3, y4 = 24 .
4.4 NEWTONS FORWARD INTERPOLATION FORMULA Let y = f(x) be a function which takes the values y0, y1, y2, , yn corresponding to the (n + 1) values x0, x1, x2, , xn of the independent variable x. Let the values x be equally spaced, i.e.,
xr = x0 + rh, r = 0, 1, 2, ..., h
where h is the interval of differencing. Let ( x ) be a polynomial of the nth degree in x taking the same values as y corresponding to x = x0, x1, , xn, then, ( x ) represents the continuous function y = f(x) such that f(xr) = (xr) for r = 0, 1, 2, , n and at all other points f ( x ) = ( x ) + R ( x ) where R(x) is called the error term (Remainder term) of the interpolation formula. Ignoring the error term let us assume
f x x a0 + a1 x x0 + a2 x x0 x x1 + ... + an x xo x x1 ... x xn 1
the constants a0, a1, a2, , an can be determine as follows.
bg bg
gb
gb
g d
(3)
99
f x0 x0 = a 0 y0 = a 0
putting x = x1 in (3) we get
b g b g b g
f x1 x1 = a0 + a1 x1 x0 = y0 + a1h y1 = y0 + a1h
a1 = y 0 y1 y0 = . h h
b g b g
f x2 x2 = a0 + a1 x2 x0 a2 x2 x0 x2 x1
y2 = y 0
0 2
b g b g
y2 = y 0 a2 =
g b y + b2hg + a b2hgbhg h + 2 b y y g + a d 2h i
2 1 0 2
gb
y2 2 y1 + y0 2 y0 = 2h 2 2! h 2
a3 =
3 y0 4 y0 n y0 = = a a , , ..., 4 n n! h n 3! h 3 4! h 4
f x x = y0 +
bg bg
y0 2 y0 x x0 + x x0 x x1 + h 2! h 2
gb
3 y0 x x0 x x1 x x2 + ... + 3! h 3 n y0 x x0 x x1 x xn 1 n! h n
Writing u =
x x0 , we get x x0 = uh h
gb
gb
gb
gd
(4)
x x1 = x x0 + x0 x1 = x x0 x1 x0
g b
= uh h = u 1 h
100
NUMERICAL ANALYSIS
Similarly
x x2 = u 2 h x x3
b g = bu 3g h
b
L
x xn 1 = u n + 1 h
x = y0 + u
bg
u u 1 ... u n + 1 n y0 u u 1 2 yo . + y0 + ... + n! 1! 2!
g b
x
12500 x0 12510 12520 12530 We have
y=
y
0.0447 y0
2 y
u=
from Newtons forward interpolation formula
101
Example 4.5 Evaluate y = e2x for x = 0.05 using the following table x y = e2x 0.00 1.000 0.10 1.2214 0.20 1.4918 0.30 1.8221 0.40 2.255
x
0.000 0.10 0.20 0.30 0.40
y = e2 x
1.0000
y
0.2214
2 y
3 y
4 y
u=
Using Newtons forward formula
f x = y0 + u y0 +
bg
u u 1 2!
g y
2
u u1 u2 3!
gb
g y
3
u u1 u2 u3 4!
gb
gb
g y
4
+ ...
b g
0.5 0.5 1 2
gb
gb
g b0.0023g
b g
Solution x = 32 is very near to the starting value xo = 30. We compute sin 32 by using Newtons forward interpolation formula.
102
NUMERICAL ANALYSIS
y = sin x
0.5000
2 y
3 y
4 y
0.0736 0.5736 0.0692 0.6428 0.0643 0.7071 0.0589 0.7660 0.0054 0.0049 0.005 0.0044 0.005 0
u=
x x0 32 30 = = 0.4 . h 5
We have y0 = 0.5000, y0 = 0.0736, 2 y0 = 0.0044, 3 y0 = 0.005 putting these values in Newtons forward interpolation formula we get
f x = y0 + uy0 +
bg
u u1 2!
g y
2
u u1 u2 3!
gb
g y
3
+ ...
f(32) = 0.5000 + 0.02944 + 0.000528 0.00032 = 0.529936 = 0.299. Example 4.7 In an examination the number of candidates who obtained marks between certain limits were as follows: Marks No. of Students 3040 31 4050 42 5060 51 6070 35 7080 31
Find the number of candidates whose scores lie between 45 and 50. Solution Fist of all we construct a cumulative frequency table for the given data. Upper limits of the class intervals Cumulative frequency The difference table is 40 31 50 73 60 124 70 80 159 190
x
marks
y
cumulative frequencies
2 y
3 y
4 y
40 50
31 42 73 51 9 25
103
60 70 80 we have
16 12 4
37
and
f x = y0 + u y0 +
bg
u u1 2!
g y
2
u u1 u 2 3!
gb
g y
3
u u1 u2 u3 4!
gb
gb
g y
2
+ ...
f 45 = 31 + 0.5 42 +
b g
The number of students who obtained marks less than 45 = 48, and the number of students who scored marks between 45 and 50 = 73 48 = 25.
Example 4.8 A second degree polynomial passes through the points (1, 1), (2, 1), (3, 1), (4, 5). Find the polynomial. Solution We construct difference table with the given values of x and y
x
1 2 3 4 We have
y
1
2 y
3 y
0 1 2 1 4 5 x0 = 1, h = 1, y0 = 1, y0 = 0, 2 y0 = 2, 2 2 0
u=
x x0 = x 1. h
104
NUMERICAL ANALYSIS
y = f x = y0 + u y0 + f x = 1 + x 1 0 + f x = x 2 3x + 1.
bg
u u 1 2!
g y
2
+ ...
bg bg
b x 1gb x 1 1g 2
2
Note: There may be polynomials of higher degree which also fit the data, but Newtons formula gives us the polynomial of least degree which fits the data.
4.5 NEWTONGREGORY BACKWARD INTERPOLATION FORMULA Newtons forward interpolation formula cannot be used for interpolating a value of y near the end of a table of values. For this purpose, we use another formula known as NewtonGregory backward interpolation formula. It can be derived as follows. Let y = f(x) be a function which takes the values y0, y1, y2, , yn corresponding to the values x0, x1, x2, , xn of the independent variable x. Let the values of x be equally spaced with h as the interval of differencing, i.e., Let xr = x0 + rh, r = 0, 1, 2, , n
Let x be a polynomial of the nth degree in x taking the same values as y corresponding to x = x0, x1, , xn, i.e., x represents y = f(x) such that f xr = xr , r = 0, 1, 2, ..., we may write x as
bg
bg
bg
b g
b g
f x x = a0 + a1 x xn + a2 x xn x xn 1 +
n n n 1 1
bg bg
b g b gd ... + a b x x g d x x i ... b x x g
(5)
f xn xn = a0 . yn = a 0 .
Putting x = xn
1
b g b g
in (5) we get
f xn 1 xn 1 = a0 + a1 xn 1 xn
y n 1 = y n + a1 h
d i d i
b g
a1 h = yn yn 1 = yn
a1 =
Putting x = xn
2,
yn 1! h
we get
105
d i d i Fy y =y +G H
n2 n
f xn 2 xn 2 = a0 + a1 xn 2 xn + a2 xn 2 xn xn 2 xn 1
n
yn 1 h
y n 2 = yn 2 yn + 2 yn 1 a2 = yn 2 yn 1 + y n 2 2h 2
d i d I b 2hg + a b 2hgb hg JK + d 2h i a
2
2 2
id
2 yn 2! h 2
a3 =
substituting these values in (5)
3 yn 4 y n n yn , a4 = , ..., an = 3 3 n! h n 3! h 4! h
f x n = yn =
bg bg
yn 2 yn x xn + x x n x xn 1 + h 2! h 2
gd
gd
id
gd
i b
x xn = uh
x xn 1 = x xn + xn xn 1 = uh + h = u + 1 h
x xn 2
1
b g b g = b u + 2g h, ..., b x x g = b u + x 1g h
u u+1 u+2 3 u yn u u + 1 2 yn + + yn + 2! 1! 2! u u + 1 u + 2 ... u + n 1 n yn . ... + n! The above formula is known as Newtons backward interpolation formula.
bg bg
gb
gb
g b
Example 4.9 The following data gives the melting point of an alloy of lead and zinc, where t is the temperature in degrees c and P is the percentage of lead in the alloy. P t 40 180 50 204 60 226 70 250 80 276 90 304
Find the melting point of the alloy containing 84 per cent lead. Solution The value of 84 is near the end of the table, therefore we use the Newtons backward interpolation formula. The difference table is
106
NUMERICAL ANALYSIS
P 40 50 60 70 80 90
t 184
20
2 0 2 0 2 0 2 0 0 0
fh = fh
3 yn = 4 yn = 5 yn = 0,
u = From Newtons backward formula
x xn 84 90 = = 0. 6. h 10
f 84 = t n + u t n +
b g
u u +1 2
g t
2
+ ...
f 84 = 304 0.6 28 +
b g
b 0.6gb 0.6 + 1g 2
2
b g
Solution 7.5 is near to the end of the table, we use Newtons backward formula to find f(7.5). x 1 2 3 4 y 1 7 8 19 27 37 64 24 18 6 0 (Contd.) 12 6 0 0
2 y
3 y
4 y
5 y
107
6 0 6 0 6
0 0
4 yn = 5 yn = ... = 0
we get f x = yn + u yn +
u=
x xn 7.5 8 = = 0.5. h 1
bg
uu+1 2!
g y
2
u u+1 u+2 3!
gb
g y
3
+ ...
b g
4.6
Let the function f(x) be continuous and possess continuous derivatives of all orders with in the interval [x0, xn] and let f(x) denote the interpolating polynomial. Define the auxiliary function F(t) as given below
F t = f t t f x x
The function F(t) is continuous in [x0, xn]. F(t) possesses continuous derivatives of all orders in [x0, xn] and variables for the values t = x, x0, , xn. Therefore F(t) satisfies all the conditions of Rolles Theorem in each of the subintervals (x0, x1), (x1, x2) (xn 1, xn). Hence FI(t) vanishes at least once in each of the subintervals. Therefore f ( t ) vanishes at least (n + 1) times in (x0, xn), f (t ) vanishes at least n times in the interval (x0, xn), , Fn + 1(t) vanishes at least once in (x0, xn) say at , where x0 < 1 < xn. The expression (t x0) (t x1) (t xn) is a polynomial of degree (n + 1) in t and the coefficient of t = 1.
bg
n +1
108
n +1
NUMERICAL ANALYSIS
If
b g b g bn + 1bg!g b x x gb x x g ... b x x g Rb xg denotes the error in the formula then Rb x g = f b x g b x g f bg b x x gb x x g ... b x x g Rb x g = bn + 1g!
f x x = f
0 1 n n +1 0 1 n
But x x0 = uh x x1 = (u 1)h, (x xh) = (u n)h where h is the interval of differencing therefore we can write
Error R x = 1 h D n +1 1 h
n +1 n +1
bg
h n +1 f
bn + 1g!
n + 1
n +1
we get
n +1
bg n +f b1x g
0
R x =
bt x g dt x i ... bt x g b g b g b g m b g b gr b x x g d x x i ... b x x g ,
n n 1 0 n n 1 0
and proceeding as above we get the error in the Newton backward interpolation formula as
R x =
y u bu + 1g ... bu + ng b g b n + 1g!
n +1 n
where uh = x xn .
Example 4.11 Use Newtons forward interpolation formula and find the value of sin 52 from the following data. Estimate the error. x y = sin x 45 0.7071 50 0.7660 55 0.8192 60 0.8660
109
x
45 50 55 60
y = sin x
0.7071
2 y
3 y
x x 0 52 45 = = 1.4 . h 5
y = u0 + u y0 +
u u1 2!
gy
2
u u1 u2 3!
gb
gy
3
+ ...
. 0.0589 + f 52 = 0.7071 + 14
b g
gb
g b bn + 1g
3
n +1
y0
taking n = 2 we get
Error =
u u1 u 2 3!
gb
gy
Exercise 4.1
1. Find the missing figures in the following table
x y 0 7 5 11 10 15 18 20 25 32
2. Estimate the production of cotton in the year 1985 from the data given below
Year (x) Production (y) 1981 17.1 1982 13.0 1983 14.0 1984 9.6 1985 1986 12.4 1987 18.2
110
NUMERICAL ANALYSIS
Using the Newtons formula, find the pressure of the steam for a temperature of 142C. 11. The area A of circle of diameter d is given for the following values
d A 80 5026 85 5674 90 6362 95 7088 100 7854
Find approximate values for the areas of circles of diameter 82 and 91 respectively.
111
13. Find the value of y when x = 0.37, using the given values
x y = e2x 0.000 1.000 0.10 1.2214 0.20 1.4918 0.30 1.8221 0.40 2.2255
14. Find the value of log10 2.91, using table given below
x y = log10 x 2.0 0.30103 2.2 0.34242 2.4 0.38021 2.6 0.41497 2.8 0.44716 3.0 0.47721
18. Given the following table find f(x) and hence find f(4.5)
x f(x) 0 1 2 13 4 43 6 89 8 151
19. A second degree polynomial passes through (0,1) (1,3) (2, 7) (3, 13), find the polynomial. 20. Find a cubic polynomial which takes the following values
x f(x) 0 1 1 0 2 1 3 10
21. u0 = 560, u1 =556, u2 = 520, u4 = 385 show that u3 = 465. 22. In an examination the number of candidates who secured marks between certain limit were as follows:
Marks No. of candidates 019 41 2039 62 4059 65 6079 50 8099 17
Estimate the number of candidates whose marks are less than 70.
112
NUMERICAL ANALYSIS
Find (i) the number of students who secured below 35. (ii) the number of students who secured above 65. (iii) the number of students who secured between 3545. 24. Assuming that the following values of y belong to a polynomial of degree 4, compute the next three values:
x y 0 1 1 1 2 1 3 1 4 1 5 6 7
25. The table gives the distance in nautical miles of the visible horizon for the given heights above the earths surface:
x = height y = distance 100 10.63 150 13.03 200 15.04 250 16.81 300 18.42 350 19.90 400 21.27
find the values of y when (i) x = 218 ft (ii) x = 410 ft. 26. Find a cubic polynomial which takes the following values
x f(x) 0 1 1 2 2 1 3 10
Hence or otherwise evaluate f(4). 27. Using Newtons forward formula, find the value of f(1.6), if;
x f(x) 1 3.49 1.4 4.82 1.8 5.96 2.2 6.5
28. Using Newtons Interpolation formulae find the value of y when x = 1.85 and x = 2.4, if
x y= e
x
1.7 5.474
1.8 6.050
1.9 6.686
2.0 7.389
2.1 8.166
2.2 9.025
2.3 9.974
find f(0.7) approximately. 30. Apply Newtons backward difference formula to the data below, to obtain a polynomial of degree y is x:
x y 1 1 2 1 3 1 4 1 5 1
113
31. The following data give the melting point of an alloy of lead and zinc, where t is the temperature in C and p, the percentage of lead in the alloy:
p t 60 226 70 250 80 276 90 304
Find the melting point of the alloy containing 84 per cent lead, using Newtons interpolation formula. 32. Find a polynomial of degree 4, passing through the points (0, 1) (1, 5) (2, 31), (3, 121), (4, 341), (5, 781) 33. Find the form of the function, given
x f(x) 0 3 1 6 2 11 3 18 4 27
34. Find and correct any error that may be present in the following table:
x y 0 2 1 5 2 8 3 17 4 38 5 75 6 140 7 233 8 362 9 533 10 752
35. The following table gives the population of Bengal during the period from 1881 to 1931. Estimate the population of Bengal in 1911:
Year Population (in lakh) 1881 363 1891 391 1901 421 1911 1921 467 1931 501
36. Find the index number of exports in 1922, from the table:
Year (x) Index No. of exports (y) 1920 72 1921 57 1922 1923 81 1924 103
37. In the table of values given below the values of y are consecutive terms of a series of which the number 21.6 in the 6th term. Find the first and the tenth terms of the series.
x y 3 2.7 4 6.4 5 12.5 6 21.6 7 34.3 8 51.2 9 72.9
39. The table below gives the values of tan x for 0.10 x 0.30:
x y = tan x 0.10 0.1003 0.15 0.1511 0.20 0.2027 0.25 0.2553 0.30 0.3093
114
NUMERICAL ANALYSIS
bg
sin x x2
:
0.5 1.9177
0.4 2.4339
Calculate g(0.25) as accurately as possible, by using Newtons forward interpolation formula. 41. Find the value of e1.85 give e1.7 = 5.4739, e1.8 = 6.0496, e1.9 = 6.6859, e2.0 = 7.3891, e2.1 = 8.1662, e2.2 = 9.0250, e2.3 = 9.9742. 42. Using Newtons formula find sin ( 1604) from the table
x sin x 0.160 0.1593182066 0.161 0.160305341 0.162 0.1612923412
5 = 2. 236,
6 = 2. 449,
45. In the bending of an elastic beam, the normal stress y at a distance x from the middle section is given by the following table
x y 0.0 0.46 0.25 0.39 0.50 0.25 0.75 0.12 1.0 0.04
find the pressure of the steam for a temperature of 142C. 46. A rod is rotating in a plane. The following table gives the angle (in radians) through which the rod has turned for various values of time t seconds.
t 0 0 0.2 0.12 0.4 0.49 0.6 1.12 0.8 2.02 1.0 3. 20 1.2 4.67
47. From the table given below compute the value of sin 38.
x sin x 0 0 10 0.17365 20 0.34202 30 0.50000 40 0.64279
0 1
0.1 1.1052
0.2 0.2214
0.3 1.3499
0.4 1.4918
115
49. Apply Newtons backward difference formula, to the data below and find y when x = 10.
x y 5 12 6 13 9 14 11 16
50. Find the expectation of life at age 32 from the following data :
Age Expectation of life 10 35.3 15 32.4 20 29.2 25 26.1 30 23.2 35 20.5
Answers
1. 17 4. 23.5, 14.25 7. 14 10. 3.899 13. 2.0959 16. 19. x2 + x + 41 x2 + x + 1 2. 6.60 5. f(3) = 0.123, f(6) = 0.090 8. 31 11. 5281, 6504 14. 0.46389 17. 4x3 + x 20. x3 2x2 + 1 23. (i) 26 (ii) 7 (iii) 46 27. 5.54 30.
y=
3. 48 6. 9.5 9. 7.13 12. 10.963 15. 27.992 18. 2x3 + 3x 1 21. 24. 31, 129, 351 28. 6.36, 11.02
22. 197 26. 2x3 7x2 + 6x + 1, 41 29. 4.43 31. 286.96 34. The true value of y at x = 5 is 77 37. 0.1, 100 40. 3.8647 43. 16.375 46. 0.8 49. 14.666
35. 445.2 lakh 38. 47.9 41. 6.3598 44. 2.344 47. 0.61566 50. 22.0948
36. 62.8 39. 0.1205, 0.2662 42. 0.1597130489 45. 0.308384 48. 1.4623
116
NUMERICAL ANALYSIS
5
INTERPOLATION WITH UNEQUAL INTERVALS
5.1 INTRODUCTION The Newtons forward and backward interpolation formulae which were derived in the previous section are applicable only when the values of n are given at equal intervals. In this section we study the problem of interpolation when the values of the independent variable x are given at unequal intervals. The concept of divided differences: Let the function y = f(x) be given at the point x0, x1, x2, , xn (which need not be equally spaced) f(x0), f(x1), f(x2), , f(xn) denote the (n + 1) values the function at the points x0, x2, , xn. Then the first divided differences of f(x) for the arguments x0, x1, is defined as
f x0 f x1 x0 x1
b g b g. b
f x0 , x1 =
Similarly we can define
f bx g . g f b xx g x
x1
f bx g , g f bxxg x f bx g f bx g f bx , x g = , f x1 , x2 =
x2 x3
The second divided differences for the arguments x0, x1, x2, is defined as
f x0 , x1 , x2 =
f bx , x g , g f bx , xx g x
0 1 1 2 0 1
similarly the third differences for the arguments x0, x1, x2, x3 is defined as
116
117
f x0 , x1 , x2 , x3 =
f bx , x , x g . g f b x , x , xx g x
0 1 2 1 2 3 0 3
The first divided differences are called the divided differences of order one, the second divided differences are called the divided differences of order two, etc.
The divided difference table: Argument x x0 x1 x2 x3 Entry f(x) f(x0) f(x0, x1) f(x1) f(x1, x2) f(x2) f(x2, x3) f(x3) f(x1, x2, x3) f(x0, x1, x2) f(x0, x1, x2, x3) f(x)
2
f(x)
f(x)
Example 5.1 If f ( x ) =
Solution
f x =
bg
1 , x
bg bg f ba , bg = ab
f a f b
1 1 a b = ba = 1 = ab ab a b ab
and
f a , b, c =
FG IJ H K
b
1 c + a b ac
FG H
IJ 1 = 1 K a c abc
f a, b =
b g
1 1 , f a , b, c = . ab abc
Example 5.2 Prepare the divided difference table for the following data x f(x) 1 0 3 18 4 58 6 190 10 920
x 1
f(x) 0
f(x)
f(x)
f(x)
118
NUMERICAL ANALYSIS
0 18 =9 1 3
3 18
9 40 = 10.33 1 4 18 58 = 40 3 4 10.33 7 = 0.6660 1 6 40 61 =7 3 6 58 190 = 61 46 6.660 0.4643 . = 01248 1 60 7 10.25 = 0.4643 3 10 61 182.5 = 10.25 4 10 190 920 = 182.5 6 10
58
190
10
920
Properties of divided differences: The divided differences are symmetric functions of their arguments:
also
f bx g f bx g bx g = = f bx , x g g f bxx g x x x f bx g f bx g f bx g f bx g = + f bx , x g = f x0 , x1 =
and
f x0 , x1 , x2 =
f bx , x g g f bx , xx g x LM f b x g + f b x g f b x g f b x g OP 1 = x x Nx x x x x x x x Q LM f b x g + b x x g b x x g f b x g f b x g OP 1 = x x P x x M N x x b x x gb x x g Q LM f b x g + b x x g f b x g f b x g OP 1 = x x P x x M N x x b x x gb x x g Q f bx g f bx g f bx g = + + b x x gb x x g b x x gb x x g b x x gb x x g .
0 1 1 2 0 2 0 1 1 2 0 2 0 1 1 0 1 2 2 1
0 1 2 1 0 2 1 0 2 0 1 1 0 1 2 2 1 0 0 2 2 1 0 2 0 1 1 0 1 2 2 1 0 1 2 0 1 0 2 1 0 1 2 2 0 2 1
x0 x1
x0 x1
x0 x1
x1 x0
(1)
(2)
119
Similarly
f x0 , x1 , x2 , x3 =
g bx
x1 x0 x 2 x0 x3
2
gb g + f bx g + b x x gbx x gbx x g b x x gb x x gb x x g , gb gb f bx g
+ x1 x0 x1 x 2 x1 x3
3 2 0 2 1 2 3 3 0 3 1 3 2
f x0
b g
g b
gb
f x1
b g
(3)
From (1), (2), (3) it is clear that a divided difference will remain unchanged regardless how much its arguments are interchanged. By mathematical induction it can be shown that
f x0 , x1 , x2 , ..., xn =
g bx
b g gb g b g+ f bx g b x x gb x x g ... b x x g +
f x0
0
x1 x0 x 2 ... x0 xn
1
... +
b g b x x gb x x gd x
f xn
n 0 n 1
xn 1
which prove that f(x0, x1, , xn) is a symmetrical function of x0, x1, , xn. Theorem 5.1 The divided differences of the product of a constant and a function is equal to the product of the constant and the divided difference of the function is k f(x) = k f(x), where k is a constant. Proof By definition
kf x =
bg
kf x0 kf x1 x0 x1
0
b g
b g
1
=k
LM f bx g f bx g OP N x x Q
0 1
= k
f x .
bg
Theorem 5.2 The divided difference of the sum (or difference) of two functions is equal to the sum (or difference) of the corresponding separate divided differences. Proof Let f(x) = g(x) + h(x), then
f x0 , x1 =
f bx g g f bxx g x gb x g + hb x g gb x g + hb x g =
0 1 0 1
0 0 1 1
g x0 g x1
b g b g + hb x g hb x g
0 1
x0 x1
= g x0 , x1 + h x0 , x1 ,
similarly we can show that f(x0, x1) = g(x0, x1) h(x0, x1) where f(x) = g(x) h(x)
x0 x1
g b
x0 x1
120
NUMERICAL ANALYSIS
Theorem 5.3 The nth order divided differences of a polynomial of degree in n and x are constants. Proof let f(x) = xn, where n is a positive integer. Then
f x0 , x1 =
g b x g x b g = xx
f x0 f x1
0 1
n 0 0
n x1 x1
n 1 n2 n 1 = x0 + x1 x0 + ... + x1 .
f(x0, x1) is a polynomial of degree (n 1) symmetrical in x0, x1 with leading coefficient 1. The first order divided difference of f(x) for the arguments x0, x1 a polynomial of degree (n 1).
Now
f x0 , x1 , x2 =
f bx , x g g f b x , xx g x
0 1 1 2 0 2
ex =
n 1 0
n2 n 1 n 1 n2 n 1 + x1 x0 + ... + x1 x1 + x2 x1 + ... + x2
x0 x2
j e
n2 n2 n2 n 1 n 1 x1 x1 x0 x1 x0 x2 x2 x0 = + + ... + x0 x 2 x0 x 2 x 0 x2
g
j
f(x0, x1, x2) is a polynomial of degree (n 2) symmetrical in x0, x1, x2, , xn with leading coefficient 1. The nth divided differences of a polynomial xn are constant. Similarly when F(x) = a0xn + a1xn 1 + a2xn 2 + an where a 0.
F(x) is a polynomial of degree of n in x. The nth divided differences of F( x) = a0 [nth divided differences of xn] + [a1 (nth divided differences of xn = a0 1 + 0 + 0 = a0, is a constant.
Note: The (n + 1)th order divided differences will be zero.
1)]
5.2
Let a function f(x) be given for the (n + 1) values x0, x1, x2 , xn as f(x0), f(x1), f(x2), , f(xn) where x0, x1, x2, , xn are not necessarily equispaced. From the definition of divided difference
f x , x0 =
f bx g g f b xxg x
0 0
121
bg b g b g b g f bx , x g f bx , x g f b x, x , x g = xx f b x, x g = f b x , x g + b x x g f b x, x , x g.
f x = f x0 + x x0 f x , x0
1 0 0 1 0 1 1
0 0 1 1 0 1
(4)
f x = f x0 + f x x0 f x0 , x1 +
0 1 0 1
bg b g b g b g b x x gb x x g f b x, x , x g .
g b g bx x g f b x, x , x g
1 0 1
(5)
f x = f x0 + x x0 f x , x0 + x x0
bg b g b
g b
+ ... + (x x0) (x x1) .. (x xn1) f (x, x0, x1, ..., xn1) + (x x0) (x x1) ... (x xn) f (x, x0, x1, ..., xn) (6) If f(x) is a polynomial of degree n, then the (n + 1)th divided differences of f(x) will be zero.
f x = f x0 + x x0 f x0 x1 + ... +
0 1 n 1
bg b g b g b g b x x gb x x g ... d x x i f b x , x , ..., x g
0 1 n
(7)
5 150
7 392
11 1452
13 2366
21 9702
f(x)
f(x)
f(x)
We have f(x0) = 150 f(x0, x1) = 121, f(x0, x1, x2) = 24, f(x0, x1, x2, x3) = 1
122
NUMERICAL ANALYSIS
f(x) = f(x0) + (x x0) f(x0, x1) + (x x0), (x x1) f(x0, x1, x2) + (x x0) (x x1) (x x2) f(x0, x1, x2, x3) + (x x0) (x x1) (x x2) (x x3) (x x3) f(x0, x1, x2, x3, x4) +
x f(x) 0 2
Example 5.4 Find the form of the function f(x) under suitable assumption from the following data. 1 3 2 12 5 147
We have x0 = 0, f(x0) = 2 f(x0, x1) = 1, f(x0, x1, x2) = 4, f(x0, x1, x2, x3) = 1. The Newtons divided difference interpolation formula is f(x) = f(x0) + (x x0) f(x0, x1) + (x x0) (x x1) f(x0, x1, x2) + (x x0) (x x1) (x x2) f(x0, x1, x2, x3). Substituting we get
Exercise 5.1
1. If f ( x ) = 2. If f x =
bg
b g
and f a , b, c =
ab + bc + ca . a 2 b 2 c2
3. If f(0) = 8, f(1) = 11, f(4) = 68, f(15) = 123, then find the form of the function which satisfies the above values. 4. If u5 = 150, u7 = 392, u11 = 1452, u13 = 2366, u21 = 9702, then show that u6.417 = 305.417.
123
5. Using the table given below find the value of f(8) x f(x) 4 48 5 100 7 294 10 900 11 1210 12 2028
find the cubic function of x. 7. Using the following table, find f(x) as a polynomial in powers of (x 6). x f(x) 1 11 0 1 2 1 3 1 7 141 10 561
8. Given the following data find f(x) as a polynomial in powers of (x 5). x f(x) 0 4 2 26 3 58 4 112 7 466 9 922
9. If f x =
bg
b g
10. Find the polynomial of the lowest degree which assumes the values 3, 12, 15, 21 when x has the values 3, 2, 1, 1 respectively.
Answers
3. 448 7. x3 9x2 + 17x + 6 5. x3 x2 3x + 8 6. x3 + x2 x + 2
8. (x 6)3 + 13 (x 6)2 + 54 (x 6) + 73
5.3
Let y = f(x) be a function which assumes the values f(x0), f(x1), f(x2), , f(xn) corresponding to the values x = x0, x1, x2, , xn, where the values of x are not equispaced. Since (n + 1) values of the function are given corresponding to the (n + 1) values of the independent variable x, we can represent the function y = f(x) be a polynomial in x of degree n. Let the polynomial be
f x = a0 x x1 x x2 ... x xn + a1 x x0 x x2 ... x xn +
2 0 1 3 n n 0
bg
gb
(8)
124
NUMERICAL ANALYSIS
Each term in equation (8) being a product of n factors in x of degree n, putting x = x0 is (8) we get
f x = a0 x0 x1 x0 x2 ... x0 xn a0 =
Putting x = x2 in (8) we get
bg
b g b x x gb x x g ... bx
f x0
0 1 0 2
gb
g b
xn
g g
f x1 = a1 x1 x0 x1 x2 ... x1 xn a1 =
b g
x1 x0 x1 x2 ... x1 xn
b g gb g b
f x1 f x2
2 1
gb
g b
g, g, i
.
a2 =
b g b x x gb x x g ... b x
2 0
xn
an =
b g b x x gb x x g ... d x
f xn
1 n 0 n n 0 0 n
xn 1
gb x x g ... b x x g f b x g + b g b xbx xx gb x x g ... b x x g bx x gbx x g ... bx x g f b x g + ... + b x x gb x x g ... d x x i f b x g ... b x x gb x x g ... b x x g b x x gb x x g ... d x x i
y= f x =
1 2 0 1 0 2 0 2 n 0 1 1 n 1 1 0 1 2 1 n n n 0 n 1 n n 1
(9)
The formula given by (9) is called Lagranges interpolation formula. It is simple and easy to remember but the calculations in the formula are more complicated than in Newtons divided difference formula. The application of the formula is not speedy and there is always a chance of committing some error due to the number of positive and negative signs in the numerator and denominator of each term.
Example 5.5 Using Lagranges interpolation formula find a polynomial which passes the points (0, 12), (1, 0), (3, 6), (4, 12). Solution We have x 0 = 0, x 1 = 1, x 2 = 3, x 3 = 4, y 0 = f ( x 0 ) = 12, y 1 = f ( x 1 ) = 0, y2 = f(x2) = 6, y3 = f(x3) = 12. Using Lagranges interpolation formula we can write
f x =
x x g bx x g b x x gb x x g b x x g f b x g + f bx g + b g b x b x x xgbgb x x g ... b x x g b x x gb x x g b x x g
1 2 3 0 2 3 0 1 0 1 0 2 0 3 1 0 1 2 1 3
126
NUMERICAL ANALYSIS
2. Compute f(0.4) using the table x f(x) 0.3 0.61 0.5 0.69 0.6 0.72
3. Compute sin 39 form the table x sin x 0 0 10 1.1736 20 0.3420 30 0.5000 40 0.6428
4. Use Lagranges interpolation formula and find f(0.35) x f(x) 0.0 1.0000 0.1 1.1052 0.2 1.2214 0.3 1.3499 0.4 1.4918
5. Use Lagranges interpolation formula to find the value of f(x) for x = 0 given the following table x f(x) 1 1 2 9 2 11 4 69
6. Use Lagranges formula and compute x f(x) 0.20 1.6596 0.22 1.6698 0.24 1.6804 0.26 1.6912 0.28 1.7024 0.30 1.7139
7. Find by Lagranges formula the interpolation polynomial which corresponds to the following data x f(x) 1 9 0 5 2 3 5 15
8. Find log 5.15 from the table x log 10 x 5.1 0.7076 5.2 0.7160 5.3 0.7243 5.4 0.7324 5.5 0.7404
9. The following table gives the sales of a concern for the five years. Estimate the sales for the year (a) 1986 (b) 1992 Year Sales (in thousands) 10. Find the polynomial of the least degree which attains the prescribed values at the given points x f(x) 2 25 1 8 2 15 4 25 1985 40 1987 43 1989 48 1991 52 1993 57
11. Use Lagranges interpolation formula to find y when x = 5 from the following data x y 0 1 1 3 3 13 8 123
127
Find the form of the function f(x); by Lagranges formula. 13. Using Lagranges interpolation formula find y at x = 10, given x y 5 12 6 13 9 14 11 16
15. Use Lagranges interpolation formula and find f(0), given the following table x 1 y = f(x) 1 2 9 2 11 4 69
Answers
1. x2 3x + 5 4. 0.65 7. 0.7118 10. 1 13. 14.7 2. x3 + x + 1 5. (a) 41.02 (b) 54.46 8. 1.4191 11. 38.143 14. 19 3. x2 10x + 1
5.4 INVERSE INTERPOLATION In interpolation we have discussed various methods of estimating the missing value of the function y = f(x) corresponding to a value x intermediate between two given values. Now we discuss inverse interpolation in which we interpolate the value of argument x corresponding to an intermediate value y of the entry. Use of Lagranges interpolation formula for inverse interpolation In Lagranges Interpolation formula y is expressed as a function of x as given below
y= f x =
+ ...
128
NUMERICAL ANALYSIS
x=
+ ...
F ( ) =
z
0
d 1 2 1 sin 2
F( f )
21 0.3706
23 0.4068
25 0.4433
Solution We have = 21 , 1 = 23 , 2 = 25 , F = 0.3887, F0 = 0.3706, F1 = 0.4068 and F2 = 0.4433. Using the inverse interpolation formula we can write
b F F gb F F g b F F gb F F g b F F gb F F g b F F gb F F g + b F F gb F F g + b F F gb F F g , b0.3887 0.4068gb0.3887 0.4433g 21 + b0.3887 0.3706gb0.3887 0.4433g 23 + = b0.3706 0.4068gb0.3706 0.4433g b0.4068 0.3706gb0.4068 0.4433g b0.3887 0.3706gb0.3887 0.4068g 25 b0.4433 0.3706gb0.4433 0.4068g
1 1 2 0 2 0 1
x=
b y y gb y y g b y y gb y y g b y y gb y y g b y y gb y y g x + b y y gb y y g x + b y y gb y y g x .
1 2 0 2 0 1 0 1 2 0 1 0 2 1 0 1 2 2 0 2 1
Substituting x0 = 0.4, x1 = 0.6, x2 = 0.8, y0 = 0.3683, y1 = 0.3332, y2 = 0.2899 in the above formula, we get
129
x=
b0.3 0.3332gb0.3 0.2897g b0.4g + b0.3 0.3683gb0.3 0.2897g b0.6g + b gb g b0.3332 0.3683gb0.3332 0.2897g b0.3 0.3683gb0.3 0.3332g b0.2897 0.3683gb0.2897 0.3332g b0.8g
0.3683 0.3332 0.3683 0.2897
2
= 0.757358. Example 5.9 The following table gives the values of the probability integral y =
z
n 0
e x dx corresponding to certain
z
n 0
0
0.46 e x dx
2
0.47
0.48
0.49
0.484655
0.4937452
0.5027498
0.5116683
Solution Here x0 = 0.46, x1 = 0.47, x2 = 0.48, x3 = 0.48, y0 = 0.484655, y1 = 0.4937452, y2 = 0.5027498, 1 y3 = 0.5116683 and y = . 2 From Lagranges inverse interpolation formula
x=
b y y gb y y gb y y g b y y gb y y gb y y g b y y gb y y gb y y g x + b y y gb y y gb y y g x + b y y gb y y gb y y g x + b y y gb y y gb y y g x . y b y gb y y gb y y g b y y gb y y gb y y g
1 2 3 0 2 3 0 1 0 1 2 0 3 1 0 1 2 1 3
x =
( 0.5 0. 4937452 ) ( 0.5 0.50274498) ( 0.5 0.5116683) 0. 46 + ( 0. 4846555 0. 4937452 ) (0. 484655 0.5027498) ( 0. 4846555 0.5116683) ( 0.5 0. 4846555) ( 0.5 0.5 0.5027498) ( 0.5 0.5116683) 0. 47 + ( 0. 493752 0. 4846555) ( 0. 4937452 0.5027498) (0. 4937452 0.5116683) ( 0.5 0. 486555) ( 0.5 0. 4937452 ) ( 0.5 0.5116683) 0. 48 + ( 0.5027498 0. 484655) (0.5027498 0. 4937452 ) (0.5027498 0.5116683) ( 0.5 0. 484655) ( 0.5 0. 4937452 ) ( 0.5 0.5027498) 0. 49 ( 0.5116683 0. 484655) (0.5116683 0. 4937452 ) (0.5 0.5027498)
where and
g b g b x xb x g bx g b x g = b x x gb x x g ... b x x g d bx g = b x g at x = x dx
r =n
f x =
n
r =0
130
NUMERICAL ANALYSIS
Solution We have
Example 5.11 By means of Lagranges formula prove that (i) y1 = y3 0.3 y5 y3 + 0.2 y3 y5 (ii) y0 =
1 1 1 1 y1 + y1 ( y3 y1 ) ( y1 y3 ) 2 8 2 2
LM N
OP Q
+
Solution (i) y5, y3, y3 and y5 are given, therefore the values of the arguments are 5, 3, 3, and 5, y1 is to be obtained. By Lagranges formula
yx =
b g b x 3gb x 5g y + 5 b 3g b 5 3gb 5 5g x b 5g x b 3g b x 5g y + 3 b 5g 3 b 3g b3 5g
x 3
5 3 5
b g b x 3gb x 5g y 3 b 5g b 3 3gb 3 5g x b 5g x b 3g b x 3g y 5 b 5g 5 b 3g b5 3g
x 5
5 3
Taking x = 1, we get
y1 =
y1
b1 + 3gb1 3gb1 5g b1 + 5gb1 3gb1 5g b 5 + 3gb 5 3gb 5 5g y + b 3 + 5gb 3 3gb 3 5g y + b1 + 5gb1 + 3gb1 5g y + b1 + 5gb1 + 3gb1 3g y b3 + 5gb3 + 3gb3 5g b5 + 5gb5 + 3gb5 3g b4gb 2gb 4g y + b6gb 2gb 4g y + b6gb4gb 4g y + b6gb4gb 2g y = b8gb6gb 2g b10gb8gb2g b 2gb 8gb10g b2gb 6gb 8g
3 5 5 3 3
y 5 5
y 3 2
+ y3
3 y5 10
131
(ii) y3, y1, y1, and y3 are given, y0 is to be obtained. By Lagranges formula
y0 =
b0 + 1gb0 1gb0 3g b0 + 3gb0 1gb0 3g b 3 + 1gb 3 1gb 3 3g y + b 1 + 3gb 1 1gb 1 3g y b0 + 3gb0 + 1gb0 3g y + b0 + 3gb0 + 1gb0 1g y b1 + 3gb1 + 1gb1 3g b3 + 3gb3 + 1gb3 1g
3
= = y0 =
1 9 9 1 y 3 + y 1 + y1 y3 16 16 16 16
1 1 y1 + y 1 y3 y1 y 1 y 3 2 16
g d
i iOPQ
1 1 1 1 y1 + y 1 y3 y1 y 1 y 3 2 8 2 2
i LMN b
g d
Example 5.12 The values of f(x) are given at a, b, and c. Show that the maximum is obtained by
x=
f a b2 c2 + f b c2 a 2 + f c a 2 b 2
b gd i b gd i b gd i 2 f ba g bb cg + f bbg bc a g + f bcg ba bg
x bgb x cg b x agb x cg f bbg + b x agb x bg f bcg f ba g + b g bba bgba cg bb agbb cg bc agbc bg x bb + cg x + bc x bc + a g x + ca x ba + bg x + ab = f ba g + f ba g + ba bgba cg bb cgbb ag bc agbc bg f bcg for maximum or minimum we have f b x g = 0 2 x bb + cg 2 x ba + c g 2 x ba + b g ba bgbc ag f bag ba bgbb cg f bbg bb cgbc ag f bcg = 0 2 x bb cg f ba g + bc a g f bbg + ba bg f bcg db c i f bag + dc a i f bbg + da b i f bcg = 0 db c i f bag + dc a i f bbg + da b i f bcg . x= 2 bb cg f ba g + bc a g f bbg + ba bg f bcg f x =
2 2 2
Example 5.13 Given log10 654 = 2.8156, log10 658 = 2.8182, log10 659 = 2.8189, log10 661 = 2.8202, find log10 656. Solution Here x0 = 654, x1 = 658, x2 = 659, x3 = 661 and f(x) = log10 656. By Lagranges formula we have
f x =
gb x x gb x x g y + b x x gb x x gb x x g y + b g b xb x xx gb x x gb x x g b x x gb x x gb x x g b x x gb x x gb x x g b x x gb x x gb x x g b x x gb x x gb x x g y + b x x gb x x gb x x g y
1 2 3 0 2 3 0 1 0 1 0 2 0 3 1 0 1 2 1 3
133
2. If all terms except y5 of the sequence y1, y2, y3, , y9 be given, show that the value of y5 is
LM156 b y MN
+ y6 28 y3 + y7 + 8 y2 + y8 y1 + y9 70
g b
g b
g OP PQ
3. If y0, y1, y2, , y6 are the consecutive terms of a series then prove that y3 = 0.05(y0 + y6) 0.3(y1 + y5) + 0.75(y2 + y4). 4. Show that the sum of coefficients of yis in the Lagranges interpolation formula is unity. 5. The following values of the function f(x) for values of x are given: f(1) = 4, f(2) = 5, f(7) = 5, f(8) = 4. Find the values of f(6) and also the value of x for which f(x) is maximum or minimum. 6. The following table is given x f(x) 0 2 1 3 2 12 5 147
show that the form of f(x) is x3 + x2 x + 2. 7. Using Lagranges formula show that (a )
b gb
2
x 3 10 x + 13 2 3 4 = + x 1 x 2 x 3 x 1 x2 x3
gb
g b g b
=
g b
g b g b g
(b )
e x 1j b x 4gb x + 6g
x2 + 6x + 1
2 4 41 1 + 25 x + 1 21 x 1 150 x 4 350 x + 6
b g
b g g
b g b gb
gb
x2 + x 3 as sum of partial x 2 x2 x + 2
3
Answers
6.
1 1 1 2 x 1 x2 2 x +1
g b g
g b g
g g b g
7.
2 4 41 73 + + 35 x + 1 15 x 1 30 x 4 70 x 6
6
CENTRAL DIFFERENCE INTERPOLATION FORMULAE
6.1 INTRODUCTION In the preceding sections we have derived and discussed a few interpolation formulae which were suited for interpolation near the beginning and end values of the tabulated data. For interpolation near the middle of a difference table, central difference formulae are preferable. In this section we study some central difference formulae which are used for interpolation near the middle values of the given data. Let the function y = yx = f(x) be given for (2n + 1) equispaced values of argument x0, x0 h1, x0 2h, ..., xo, xh. The corresponding values of y be yr (r = 0, 1, 2, ..., n). Let y = y0 denote the central ordinate corresponding to x = x0. We can form the difference table as given below.
x y
2 y
3 y
4 y
5 y
6 y
x0 3h x 0 2h x0 h x0 x0 + h x0 + 2h x0 + 3h
y 3 y3 y 2 y 2 y 1 y1 y0 y0 y1 y1 y2 y2 y3
134
2 y3 3 y 3 y2
2
4 y3 3 y 2 5 y 3 4 y2 3 y 1 5 y2 4 y1 3 y0 6 y 3
2 y1 2 y0 2 y1
135
The above table can also be written in terms of central differences using the Sheppards operator as follows:
x y
y
y 5/ 2
2 y
3 y
4 y
5 y
6 y
x 0 3h x0 2h x0 h x0 x0 + h x0 + 2h x 0 + 3h
y 3 y 2 y 3/ 2 y 1 y 1/ 2 y0 y1/ 2 y1 y 3 / 2 y2 y5 / 2 y3
2 y2 3 y 3/ 2 2 y1 3 y 1/ 2 2 y0 3 y1/ 2 2 y1 y3 / 2
3
4 y1 5 y 1/ 2 4 y0 5 y1/ 2 4 y1 6 y0
2 y2
= E 1/ 2 is used. Both the tables given above are called central difference tables. One can very easily observe that the differences given in both the tables are same in corresponding positions.
6.2 GAUSS FORWARD INTERPOLATION FORMULA The Newton forward interpolation formula is
y = f x = y0 + uy0 +
where u =
bg
u u1 1 2
g y
2
u u1 u2 1 2 3
gb
g y
3
+ ...,
(1)
2 y0 = 2 y1 + 3 y1
3 y0 = 3 y 1 + 4 y 1
4 y0 = 4 y1 + 5 y1 ... 3 y1 = 3 y2 + 4 y2 4 y1 = 4 y2 + 5 y2
M
136
NUMERICAL ANALYSIS
y = f x = y0 + uy0 +
bg
u u1 2!
g d y
2
+ 3 y 1 +
u u1 u2 3!
gb
g d y
3
+ 4 y1 +
4
u u1 u2 u3 4!
The above formula may be written as
gb
gb
+
g d y
+ 5 y1 + ...
y4 = f x = y0 + uy0 +
bg
u u1 2!
g y
2
bu + 1g u bu 1g y
3
3!
bu + 1g u bu 1gbu 2g y
4
4!
+ ...
(2)
and
3 y1 = 3 y2 + 2 y2
4 y 1 = 4 y2 + 5 y 2
In Newtons forward interpolation formula we see
y = f x = y0 + y 4 = y0
bg
u u1 2 u y 1 + 2 y 1 + y 1 + 3 y1 + ... 1! 2!
2 1 3 2
u y 1 1!
i b gd i u bu + 1g bu + 1g u bu 1g y + + y +
2! 3!
bu + 2g bu + 1g u bu 1g y
4
4!
+ ...
137
2 y
3 y
4 y
5 y
6 y
x 4 x 3 x 2 x 1 x0 x1 x2 x3
y 4
y 4
y 3
2 y4
y3
3 y4 2 y3 4 y4 3 y3 2 y2 4 y3 3 y2 2 y1 4 y2 3 y 1 2 y0 4 y1 3 y0 2 y1 4 y0 5 y 1 5 y 2 6 y 2 5 y 3 6 y 3 5 y 4 6 y 4
y 2
y 2
y 1
y1
y0
y0
y1
y1
y2
y2
y3 y3
2 y2
x4
y4
Gausss forward formula is used to interpolate the values of the function for the value of u such that 0 < u < 1, and Gausss backward formula is used to interpolate line value of the function for a negative value of u which lies between 1 and 0 (i.e., 1 < u < 0).
6.4 BESSELS FORMULA Changing the origin in the Gausss backward interpolation formula from 0 to 1, we have
y = y1 + u 1 y0 +
u u1 2!
g y
3
u u 1 u 2 3!
gb
g y
3
+ ...
Taking the mean of the above formula and the Gausss forward interpolation formula, we obtain
y4 =
u u1 1 2 1 1 y0 + y1 + 2 y0 + y0 + y1 + u 2 2 2! 2
FG H
IJ K
FG u 1 IJ u bu 1g H 2K y
3
3!
+ ...
138
NUMERICAL ANALYSIS
x3 x 2 x1 x0 x1 x2 x3 x4
y 3
y 3
y 2
y 2
2 y3 3 y3 2 y2 4 y3 3 y2 4 y2 3 y 1 4 y1 3 y0 2 y1
y 2
y 1 y0 y1 y2 y3
y3
U | V | W
y 1
2 y1
y 0
2 y0
y1
U | V | W
U | V | W
5 y 3 6 y3 5 y 2 6 y2 5 y 1
4 y0 3 y1
2 y2
y4
The brackets mean that the average of the values has to be taken Bessels formula is most efficient for 1 3 u . 4 4
gb
bu + 1g u bu + 1gbu 2g y
4! yu = y0 +
bu + 2gbu + 1g u bu 1gbu 2g y
5
5!
+ ...
(3)
u1 u 2 u +1 u u 1 3 u y1 + y 1 + y 2 + 1! 2! 3!
4 2
gb
bu + 2g u bu + 1gbu 1g y
4!
+ ...
(4)
139
yu = y0 + u
2
LM y + y OP + u y + N 2 Q 2 u du 1i d y + y i u du 1i + y
0 1 2 2 1
3 1 3 2 2 2 4
3!
4!
u u2 1 u2 4 5!
id
i d y
5
+ 5 y 3 + ...
The above is called Stirlings formula. Stirlings formula gives the most accurate result for 0.25 u 0.25. Therefore, we have to choose x0 such that u satisfies this inequality.
6.6 LAPLACEEVERETT FORMULA Eliminating odd differences in Gausss forward formula by using the relation
y0 = y1 y0 3 y 1 = 2 y0 2 y 1
5 y2 = 4 y1 4 y2 ...,
we get y = f x y0 +
bg
u u1 2 u y 1 + y1 y0 + 1! 2!
4 2
g b
bu + 1g u bu 1g d y
2
3!
2 y 1 +
4
bu + 1g u bu 1gbu 2g y
4!
= 1 u y0 + uy1 + u u 1
bu + 2gbu + 1g u bu 1gbu 2g d y
5!
2 1
4 y 2 + ...
bu + 1g u bu 1g y
2
3!
= 1 u y0 +
4 (5) 2 1 + ... 3! 5! Writing v = 1 u, i.e., u = 1 v and changing the terms (5) with a negative sign we get
5!
y = vy0 +
bv + 2gbv + 1g v bv 1gbv 2g y
4
v +1 v v 1 2 u y 1 + y1 + 1! 3! 5!
2
gb
bu + 1g u bu 1g y
2
bu + 2gbu + 1g u bu 1gbu 2g y
4
3!
+
1
5!
+ ...
(6)
140
NUMERICAL ANALYSIS
bg
v v 2 12 3!
i y
2
u u 2 12 u 2 2 2 2 u ( u2 12 ) 2 y0 + y1 + ... 3! 5!
id
v ( v 2 12 ) ( u 2 22 ) 4 y2 + ... + uy1 5!
(7)
Equation (7) is known as LaplaceEveretts formula. The formula uses only even differences of the function, hence for a rapidly converging series of differences of the function we will have only a few number of terms in both the u series and v series.
Note: LaplaceEveretts formula can be used in sub-tabulation. Example 6.1 Use Gauss forward formula to find y for x = 30 given that x y 21 18.4708 25 17.8144 29 17.1070 33 16.3432 37 15.5154
Solution We construct the difference table by taking as x x0 2h = 21 x0 h = 25 x0 = 29 x + h + 33 x0 + 2h = 37 y 18.4708 0.6564 17.8144 0.7074 17.1070 0.7638 16.3432 0.8278 15.5154 0.0640 0.0564 0.0076 0.0510 0.0054 0.002
2 y
3 y
4 y
Here h = 4, u =
u u1 2 u+1 u u1 3 u y0 + y1 + y 1 + 1! 2! 3!
gb
bu + 1g u bu 1gbu 2g y
4
4!
+ ...
g (0.25) 2(0.75) (0.0564) + . gb0.25gb0.75gb175 . g b125 (1. 25) (0. 25) ( 0. 75) b0.0076g + b0.0022g
6
b g
b gb
24
= 16.9216 .
141
Example 6.2 Use Gausss backward formula and find the sales for the year 1966, given that Year Sales (in lakhs) Solution We have h = 10, we take 1971 as the origin. The central difference table with origin at 1971 is u 4 3 2 1 0 1 u at 1996 is Gausss backward formula is substituting we get y 12 3 15 5 20 7 27 12 39 13 52 1 5 4 2 3 7 2 0 3 10 1931 12 1941 15 1951 20 1961 27 1971 39 1981 52
2 y
3 y
4 y
5 y
gb
y0.5 = 39 + 0.5 12 +
= 39 6 0125 . 0.25
y1966 = 32.625.
f x
14
bg
f x
bg
2 f x
bg
3 f x
bg
4 f x
bg
10 24 8 32 3 35 5 40 2 5 7 2 3 10
142
NUMERICAL ANALYSIS
y0 = 32, y0 = 3, 2 y1 = 5, 3 y 3 = 3, 4 y 2 = 7
u= x x0 98 1 = = . h 4 4
f x = y0 + uy0 +
bg
u u1 2!
g y
2
bu + 1g u bu 1g y
3
3!
bu + 1g u bu 1gbu 2g y
4
4!
+ ...
y0.25
1 1 1 1 1 1 1 +1 1 4 4 4 4 4 = 32 + 3 + 5 + 7 + 4 1 2 1 2 3
= 32 + 3 15 35 175 . + + + = 331162 4 32 128 1024
FG IJ FG H KH
IJ F K b g GH
IJ FG IJ FG KH KH
u9 = 33 approximately .
Example 6.4 Apply Gausss backward interpolation formula and find the population of a town in 1946, with the help of following data Year Population (in thousands) Solution We have h = 10 taking origin at 1951 1931 15 1941 20 1951 27 1961 39 1971 52
u=
The difference table is x 2 1 0 2 2 y 15
2 y
3 y
4 y
5 20 7 27 12 39 13 52 1 5 4 2 3 7
y0.5 = 27 + 0.5 7 +
b g
143
. = 27 35
b gb g b gb gb g
The population of the town in the year 1946 is 22.898 thousand, i.e., 22898.
Example 6.5 Compute the value of (a) Gausss forward formula (b) Gausss backward formula (c) Stirlings formula x y 0.62 0.6194114 0.63 0.6270463 0.64 0.634857 0.65 0.6420292 0.66 0.6493765 0.67 0.6566275 0.68 0.6637820 2
z
x 0
e x
2 y
3 y
4 y
5 y
6 y
we have
u=
(a) Using Gausss forward interpolation formula
y4 = y0 + uy0 +
u u1 2!
g y
2
bu + 1g u bu 1g y
3
3!
+ ...
= 0.6448325.
144
NUMERICAL ANALYSIS
y = y0 + uy 1 +
u u+1 2!
g y
2
bu + 1g u bu 1g y
3
3!
+ ...
= 0.6448325.
(c) Using Stirlings formula The arithmetic mean of Gausss forward and Gausss backward formulae is
y0.38 =
0.6448325 + 0.6448325 2
y = 0.6448325.
Example 6.6 Apply Bessels formula to obtain Y25 given that Y20 = 2854, Y24 = 3162, Y28 = 3544 and Y32 = 3992. Solution Taking 24 as the origin we get
u=
The difference table is X 20 24 28 32
25 24 1 = . 4 4
u=
X 24 4
1 0 1 2
Yu 2854
Yu
2Yu
3Yu
2 2 u u 1 Y1 + Y0 1 1 Yn = Y0 + Y1 + u Y0 + + 2 2 2! 2
g FGH
IJ K
gd
Y0.25 =
g FGH
IJ b g K
2!
3!
y = 3250.875.
at
x = 25
y25 = 3250.875 .
145
Example 6.7 If third difference are constant, prove that Y Solution Bessels formula is
X 1 2
1 (YX + YX 2
+ 1)
1 2 YX 1 + 2YX . 16
X X 1 2 Y1 + 2Y0 Y + Y1 1 YX = 0 + X + Y0 + 2 2 2! 2
FG H
IJ K
FG X 1 IJ X b X 1g H 2K Y
3
3!
+ ...
(8)
Given that the third difference are constant and taking the formula up to third differences and putting X = in (8) we get
1 2
Y1 =
2
Y0 + Y1 1 2 Y1 + 2Y0 , 2 16
(9)
X+
1 2
1 1 2 YX + YX +1 YX 1 + 2YX . 2 16
Example 6.8 Use Stirlings formula to find Y28, given that Y20 = 49225, Y25 = 48316, Y30 = 47236, Y35 = 45926, Y40 = 44306. Solution Taking X = 30 as origin and h = 5 we get
u=
The difference table is X 20 25 30 35 40 The Stirlings formula is
28 30 = 0.4 . 5
u=
X 30 5
2 1 0 1 2
Yu 49225
Yu
2Yu
3Yu
3Yu
909 48316 1080 47236 1310 45926 1620 44306 310 230 60 171 59 21
Yu = y0
d Y +u
2
+ 2Y1
u u 2 1 3Y1 + 3Y2 6 2
id
i+u Y
2 2
+
2 2
i + u du
24
iY
4
+ ...,
146
NUMERICAL ANALYSIS
putting u = 0.4 and the values of various differences in the formula we get
= 47692
Y28 = 47692.
Example 6.9 Use Stirlings formula to compute u12.2 from the following table x0 105log x Solution The difference table is 10 23967 11 28060 12 31788 13 35209 14 38368
x0
10 11 12 13 14 We have where x0 = 12 is the origin. The Stirlings formula is
105 ux
23967
105 ux
4093
105 2 ux
105 3ux
105 4 ux
u=
x x0 12.2 12 = = 0.2 , h 1
yu = y0 + u 105 u12.2
d y
2
+ 2 y 1
i+uy
2 2
u u 2 1 3 y 1 + 3 y 2 2
id
i + u du
2
b g FGH
IJ b gb K
24
i y
4
+ ...
Example 6.10 Apply Everetts formula to obtain y25, given that y20 = 2854, y24 = 3162, y28 = 3544, y32 = 3992. Solution Taking origin at x = 24, and h = 4 we get
u=
25 24 1 = , 4 4
147
V =1 u =1
The difference table is x 20 24 28 32
1 3 = . 4 4
u=
x 24 4
1 0 1 2
yu 2854
y u
2 yu
3 yu
yu = u y1 +
u u2 1 3!
i y
2
u u2 1 u2 4 5!
id
i y
4
+ ... + Vy0 +
V V2 1 3!
i y
2
+ ...
1 1 3 9 1 1 1 3 4 16 4 16 66 + 3162 + 74 = 3544 + 4 6 4 6
FG H
IJ Kb g
FG H
IJ Kb g
Exercise 6.1
1. Apply Gausss forward formula to find the value of f(x) at x = 3.75 from the table x f(x) 2.5 24.145 3.0 22.043 3.5 20.225 4.0 18.644 4.5 17.262 5.0 16.047
2. Find the value of f(x), by applying Gausss forward formula from the following data x f(x) 30 3678.2 35 29995.1 40 2400.1 45 1876.2 50 1416.3
3. Find the value of cos 51 42 by Gauss backward formula given that x cos x 50 0.6428 51 0.6293 52 0.6157 53 0.6018 54 0.5878
148
NUMERICAL ANALYSIS
using Gausss backward formula find the value of tan 51 42'. 5. f(x) is a polynomial of degree for a and given that f(4) = 270, f(5) = 648, f (5) = 682, 3 f (4) = 132 = 132 find the value of f(5.8). 6. Use Stirlings formula to find the value of f(1.22) from the table x f(x) 1.0 0.84147 1.1 0.89121 1.2 0.93204 1.3 0.96356 1.4 0.98545 1.5 0.99749 1.6 0.999570 1.7 0.99385 1.8 0.9385
7. Apply Stirlings formula to find the value of f(1.22) from the following table which give the values of f x = x f(x)
bg
1 2
z
x 0
x2 2
0 0
0.5 191
1.0 0.341
1.5 0.433
2.0 0.477
8. Apply Bessels formula to find the value of f(27.4) from the table x f(x) 25 4.000 26 3.846 27 3.704 28 3.571 29 3.448 30 3.333
9. Apply Bessels formula to find the value of y = f(x) at x = 3.75 given that x f(x) 2.5 24.145 3.0 22.043 3.5 20.2250 4.0 18.644 4.5 17.262 5.0 16.047
10. Find the value of y15 using Bessels formula if y10 = 2854, y14 = 3162, y18 = 3544, y22 = 3992. 11. Apply LaplaceEveretts formula to find the value of log 23.75, from the table x log x 21 1.3222 22 1.3424 23 1.3617 24 1.3802 25 1.919 26 1.4150
12. Find the value of ex when x = 1.748 form the following x f(x) = ex 1.72 0.1790 1.73 0.1773 1.74 0.1755 1.75 0.1738 1.76 0.1720 1.77 0.1703
13. Interpolate by means of Gausss backward formula the population of a town for the year 1974, given that Year Population (in thousands) 1939 12 1949 15 1959 20 1969 27 1979 39 1989 52
149
15. u20 = 51203, u30 = 43931, u40 = 34563, u50 = 24348.Find the value of u35, by using Gauss forward interpolation formula. 16. Use Gausss backward formula to find the population in the year 1936, given the following table Year Population (in thousands) 17. Use (i) Stirlings and (ii) Bessels formulae to find the value of sin 25 40 30, given that
sin
1901 12
1911 15
1921 20
1931 27
1941 39
1951 52
25400 0.43313479
254020 0.43322218
254040 0.4330956
25410 0.43339695
254120 0.43348433
18. Compute the value of ex when x = 0.644, by using (i) Bessels formula (ii) Everetts formula, given that x y = ex 0.61 0.62 0.63 0.64 0.65 0.66 0.67 1.840431 1.858928 1.877610 1.896481 1.915541 1.934792 1.954237
19. f(20) = 51203, f(30) = 43931, f(40) = 34563, f(50) = 24348 find f(35) using, Bessels formula. 20. Employ Bessels formula to find the value of F at x = 1.95 given that x F 21. Given that 1.7 2.979 1.8 3.144 1.9 3.283 2.0 3.391 2.1 3.463 2.2 3.997 2.3 4.491
f(1.20) = 1.096, f(1.30) = 1.40 Use Everets formula and find f(1.15). 22. Using Bessels formula find f(25) given that f(20) = 24, f(24) = 32, f(28) = 35 and f(32) = 40. 23. Prove that (i) y n =
K=0
F I b1g GH KJK
n K n
i+ r 2
(ii) r f i = r f
= r f i + r = r ! h r f xi , xi +1 , ..., xi + r
bg
150
NUMERICAL ANALYSIS
Answers
1. 19.407 4. 1.2662 7. 0.389 10. 3251 13. 32.345 thousands 16. 32.3437 19. 39431 22. 32.95 2. 2290 5. 0.1163 8. 3.6497 11. 3.3756 14. 111.874930 20. 3.347 3. 06198 6. 0.93910 9. 19.407 12. 0.1741 15. 39431 21. 1.0728
17. (i) 0.43322218 (ii) 0.43326587 18. (i) 1.904082 (ii) 1.904082
7
INVERSE INTERPOLATION
7.1 INTRODUCTION Inverse interpolation by using Lagranges interpolation formula was already discussed in the previous chapter in which the roles of x and y were interchanged and x was expressed as a function of y. Now we study two more methods namely (a) Successive approximations and (b) Reversion of series. 7.2 METHOD OF SUCCESSIVE APPROXIMATIONS Let the values of independent variable x be given as x0, x1, x2, , xn where xi are equispaced with h as the interval of differencing (i.e., xi = x0 + ih, h = 0, 1, , n). If we are required to find x for a given value of y near the beginning of the tabulated value of y, we make use of Newtons forward interpolation formula as follows. From Newtons forward interpolation we have
y = y0 + uy0 + u u 1 2!
g y
2
u u 1 u 2 3!
x x0 . h
gb
g y
3
+ ... +
u u 1 ... u n + 1 n!
g b
g y , ...
n 0
(1) where
u=
y y0 = uy0 +
u u1 2!
g y
2
u u1 u2 3!
gb
g y
3
+ ... + u u 1 ... u n + 1 n y . 0 n!
g b
gb
gb
g b
152
NUMERICAL ANALYSIS
Neglecting all the higher order differences other than the first we get
u=
we denote it by u1,
y y0 , y0
u1 =
Expression (2) may be written as
y y0 . y0
u1 =
u u 1 u 2 ... u n + 1 n y0 y y0 u u 1 2 y0 u u 1 u 2 3 y0 ... , y0 2! y0 3! y0 n! y0
(3)
gb
gb
g b
and the subsequent approximations u2, u3, , un of u are obtained from (3) as follows
u2 =
y y0 u1 u 1 2 y0 u1 u1 1 u1 2 3 y0 ... y0 2! y0 3! y0 u1 u1 1 u1 2 ... u1 n + 1 n y0 , y0 n! L L L
gb
gb
g b
un =
un 1 un 1 1 ... un 1 n + 1 n y un 1 un 1 1 2 y0 y y0 0 ... . y0 y0 n! y0 2!
d id
i d
The process of finding the approximations of u is continued till two successive approximations of u agree with each other to the required accuracy. If un denotes the interpolated value of u, then x = x0 + h un gives the required value of x for a given value of y. Similarly we use same technique with Newtons backward formula and Central difference interpolation formulae and interpolate x for a given y. As an example we consider the Stirlings interpolation formula. Stirlings interpolation formula is
y = y0
L y + uM N
u u 2 1 3 y + 3 y + y1 u2 2 1 2 + ... y 1 + + 3! 2 2 2!
OP Q
i LM N
OP Q
(4)
We construct the difference table, substitute the values of the differences in (4), and write it in the form y = y0 + ua1 + u2 a2 + u(u2 1) a3 + (5)
INVERSE INTERPOLATION
153
where a1, a2, an, are constants. Expression (5) may be written as u a1 = (y y0) u2 a2 u(u2 1) a3 which gives
u= y u0 u2a2 u ( u2 1) a3 ... a1 a1 a1
To get the first approximation of u, we neglect all differences higher than the first and write
u1 =
y y0 , a1
where u1 denotes the first approximation of u. Substituting u1 in (2) we get u2, i.e., the second approximation of u. Similarly we can obtain the approximations of u3, u4, , un of u.
Example 7.1 Given table of values of the probability integral what values of x in this integral equal to 0.5? x y = f(x) Solution x 0.46 y 0.4846555 0.0090897 0.47 0.4937452 0.0090046 0.48 0.5027498 0.0088850 0.49 0.5116683 0.0001196 0.0000851 0.0000345 0.46 0.4846555 0.47 0.4937452 0.48 0.5027498 0.49 0.5116683 2
z
x 0
2 y
3 y
Taking x0 = 0.47, we get x1 = 0.46, x1 = 0.48, x2 = 0.49 and h = 0.01. Correspondingly we have y0 = 0.4937452, y1 = 0.4846555, y1 = 0.5027498, y2 = 0.5116683.
y = y0 + uy0 +
u u1 2!
g y
2
bu + 1g u bu 1g y
3
3!
+ ...
2 u u 1 2 y 1 u u 1 3 y 1 y y0 . =u+ + y0 y0 y0 2! 3!
(6)
154
NUMERICAL ANALYSIS
u1 =
u1 = 0.694623.
Expression (6) can be written as
2 y u0 u u 1 2 y 1 u u 1 3 y 1 , y0 y0 y0 2! 3!
u=
and for the second approximation of u we have
(7)
u2 =
g b b
g g
0.694623 0.694623 6
eb
j b0.0000345g b0.0090046g
u3 = u3 = 0.694623
gb g b0.0090046g
0.693391 0.693391 6
eb
1 0.0000345 0.0090046
jb b
g g
1.47 = y 1
0.18 = 2 y1
0.02 = 3 y 1
INVERSE INTERPOLATION
155
y = f x = y0 + u 14 = 14.88 + u
bg
. 147 . O u LM 129 PQ + 2 2 N
LM y N
+ y1 u2 2 + y 1 + ... 2 2!
2
OP Q
018 .
(8)
u1 =
form (8) second approximation
u2 =
x = x0 + hu = 5 + 5 0.6288
x 0 2h = 4.80
60.7511 = y 2
0.0062
0
156
NUMERICAL ANALYSIS
x0 = 4.82
619785 . = y0 0.6230 = y0
0.0062 = 2 y1 0 = y 1
3
x0 + h = 4.83 x0 2h = 4.84
62.6015
0.6292 = y1
0.0062
632307 .
From the table we have y0 = 0.6230, y 1 = 0.6168, 2 y 1 = 0.0062 and using Stirlings formula we may write
y = y0 + u
LM y N
+ y1 u2 + u1 + ..., 2 2!
62 = 619785 . +u
simplifying we get 31u2 + 6199u 215 = 0, neglecting the negative roots u = 0.0347
OP Q
x = 4.820347.
7.3
(9)
x=
y a0 y a0 + c1 a1 a1 cn 1
LM y a OP N a Q
0 1
LM N
OP Q
+ c2
LM y a OP N 3 Q
0
+ ... +
+ ...
(10)
1,
(11)
INVERSE INTERPOLATION
157
Expression (9) may be written as y a0 = a1x + a2x2 + + anxn + Substituting y a0 = a1c1 (12)
in (12) using the expression given in (10) for n and then comparing the coefficients of u2, u3, u4, on both sides we get
c1 =
a2 , a1 a3 a +2 2 a1 a1 a4 a1
a5 a1
2
c2 =
c3 =
c4 =
FG IJ , H K F a a IJ 5FG a IJ + 5G H a K Ha K F a a I + 3F a I + 6G H a JK GH a JK
2 3 2 1 1 2 4 3 2 1 1
,
2 2 a3 a 2a2 + 14 2 3 a1 a1
FG IJ H K
c5 =
a6 a a +a a a2 a + a a2 a3 a a + 7 2 5 2 3 4 28 2 4 3 2 3 + 84 2 4 3 42 2 a1 a1 a1 a1 a1
M
F GH
I JK
F GH
I JK
FG IJ H K
(13) The values of cs are computed by using (5) and then substituted when reverting the series with numerical coefficients. We shall now write Newtons forward interpolation formula, Gauss forward, Gauss backward, Stirlings and Bessels formula in the form of power series and then write down the values of a0, a2, a3, a4, in each case. Since the higher order difference are usually very small, we shall stop computations with forth differences. (a) Newtons forward interpolation formula
y = y0 + uy0 + = y0 + y0
u u1 2!
g y
2
u u 1 u 2
gb
F y GH 6
3
F GH
0
2 y0 3 y0 4 y0 + u+ 2 3 4
4 y0 3 4 y0 4 u + u . 4 24
I JK
I JK
3!
g y
3
u u1 u2 u3
gb
gb
F y GH 2
2
3 y0 114 y0 2 + u + 3 24
I JK
4!
g y
4
Hence a0 = y0 ,
a1 = y0
2 y0 3 y0 4 y0 + , 2 3 4
158
NUMERICAL ANALYSIS
a2 = a3 = a4 =
2 y0 3 y0 114 y0 + , 2 2 24 2 y0 4 y0 , 6 4 4 y0 . 24
Using equations of (13) we compute the values of c1, c2, c3, c4 and the interpolate inversely. (b) Gausss forward formula
y = y0 + uy0 +
= y0 + y0
u2 u 2 u3 u 3 u 2 2u 3 u 2 + 24 4 y 2 + ... y 1 + y 1 + 2 6 24
1 2 1 1 4 y 1 3 y1 + y 12 u + 2 6 12
FG H
IJ K
FG 1 y H2
2
1 4 y 2 u 2 + 24
IJ K
FG 1 y H6
3
1 4 1 4 y 2 u 3 + y 1 u 4 + ... 12 24 a1 = y0 a2 = a3 = a4 = 1 2 1 1 4 y 1 3 y1 + y 2 , 2 6 12
IJ K
FG H
IJ K
Here a0 = y0 ,
1 2 1 4 y 1 y 2 , 2 24 1 3 1 4 y 1 y 2 , 6 12 1 4 y 2 . 24
y = y0 + uy 1 +
= y 0 + y 1 +
u2 u 2 u3 u 3 u 4 + 2u 3 u 2 24 4 y 2 + ... y 1 + y 2 + 6 6 24
1 2 1 1 4 y 1 3 y 2 y 2 u + 2 6 12
FG H
IJ K
FG 1 y H2
2
1 4 y 2 u 2 + 24
IJ K
FG 1 y H6
3
1 4 1 4 y 2 u 3 + y 2 u 4 + ... 12 24
IJ K
FG H
IJ K
Here a0 = y0 ,
INVERSE INTERPOLATION
159
a1 = y1 + a3 = a4 =
1 2 1 1 4 y 1 3 y 2 y 2 , 2 6 12
1 3 1 4 y 2 + y 2 , 6 12 1 4 y 2 . 24
y = y0 + u y = y0 +
F y GH 2
2
F y GH
1
LM y N
u u 2 1 3 y + 3 y u2 u2 1 4 + y0 u2 2 2 3 y 1 + + + y 2 + ... 2 2 6 2 24
OP Q
+ y0 3 y 2 + 3 y1 u+ 2 12
4 y2 2 3 y2 + 3 y 1 3 4 y2 4 u + u + u . 24 12 24
I JK
F GH
I JK
i LM N
OP Q
I JK
Here a0 = y0 ,
1 1 y 1 + y0 3 y 2 + 3 y 1 , 2 2 1 1 4 y 2 , a2 = 2 y 1 2 24 1 3 y2 + 3 y 1 , a3 = 12 a1 =
a4 =
1 4 y 2 . 24 1I JK u bu 1g OP FGH u 2 y 3! Q
3
u u1 y + y1 1 + u y0 + y= 0 2 2 2!
bu + 1g u bu 1gbu 2g d y
4
FG H
IJ K
4!
g LM y N + y i .
2
4 2
+ 2 y1 + 2
Taking u
1 = v we get 2
y + y1 y= 0 + vy0 + 2 v v2 6
FG v H
FG H
1 4
IJ Ky
2
FG v H +
1 2 2 4 y 1 + y 0 + 2 2
2
IJ K
1 4
IJ FG v KH
24
9 4 4 4 y 2 + y 1 2
IJ K
160
NUMERICAL ANALYSIS
LM 1 d y N4
2
y0 + y1 2 y1 + 2 y0 3 + 4 y2 + 4 y1 + 2 16 256
1
+ 2 y0
5 4 1 3 1 4 y 2 + 4 y 1 v 2 + y 1v 3 + y 2 + 4 y1 v 4 . 96 6 48 a0 = 1 1 2 3 y1 + 2 y0 + 4 y 2 + 4 y 1 , y0 + y1 2 18 256 1 3 y 1 , 24
iOPQ
LMy N
1 3 y 1 v + 24
OP Q
Here
a1 = y0 a2 = a3 = a4 =
1 2 5 4 y 1 + 2 y0 y 2 + 4 y 1 , 4 96 1 3 y 1 , 6 1 4 y 2 + 4 y1 . 48
We find the values of c1, c2, c3, c4 by using equations of (13) and interpolate inversely.
Example 7.4 If sinh x = 62, find x using the following data x sinh x Solution x y = sin x 4.80 60.7511 4.81 61.3617 4.82 61.9785 4.83 62.6015 4.84 63.2307
y 2 = 0.6106
x 0 2h = 4.80 x 0 h = 4.81
0.75111 = y 2
. 613617 = y 1 y 1 = 0.6168
2 y2 = 0.0062
0
x0 = 4.82
x 0 + h = 4.83 x 0 + 2h = 4.84
y1 = 0.0062
2
0 0
y0 = 0.0062
2
y = 61.9785 +
+ ...
INVERSE INTERPOLATION
161
We have
u=
c2 = 0 + 2 0.00501
c3 = 3
= 0.0000502
= 4.8203.
Example 7.5 Find by the method of inverse interpolation the real root of the equation x3 + x 3 = 0 which lies between 1.2 and 1.3. Solution Let f(x) = x3 + x 3 We construct a difference table for values of x starting from 1 with 0.1 as the step length. The table is given below x 1.0 1.1 1.2 1.3 1.4
f x
1
bg
u=
x 1.2 1
2
2 y
3 y
4 y
0.431 0.569 0.072 0.497 1.144 1 0.497 0 0.569 1 0.647 2 0.078 0.072 0.006 0.066 0.006 0
From the table it is clear that f(x) changes its between x = 1.2 and x = 1.3. Hence the root of f(x) = 0 should lie between 1.2 and 1.3 to find the value of x we use Stirlings formula (taking 1.2 as the origin). We have
u u 2 1 3 y + 3 y y 0 + y 1 u 2 2 1 2 y = y0 + u + + ... y 1 + 2 2 6 2
162
NUMERICAL ANALYSIS
g d
ib
g
(14)
u1 =
u = 01353 .
Taking u = 0.134, we get x = x0 + hu
= 0134 . .
Exercise 7.1
1. The equation x3 15x + 4 = 0 has a root close to 0.3. Obtain this root up to 6 decimal places, using inverse interpolation with Bessels Interpolation formula. 2. Given f(0) = 16.35, f(5) = 14.88, f(10) = 13.5, f(15) = 12.46. Find x for which f(x) = 14.00. 3. Given u10 = 544, u15 = 1227, u20 = 1775 find correct to one decimal place, the value of x for which ux =100. 4. The following values of f(x) are given x f(x) 10 1754 15 2648 20 3564
Find the value of x for which f(x) = 3000, by successive approximation method. 5. Use Lagranges formula to find the number whose Logarithm is 0.30500 having given log 1 = 0, log 2 = 0.30103, log 3 = 0.47712 and log 4 = 0.060206
2
z
x 0
e x dx
2
1 2
INVERSE INTERPOLATION
163
x f(x)
0.45 0.4754818
0.46 0.484655
0.47 0.4937452
0.48 0.5027498
0.49 0.4116583
0.50 0.5304999
7. For the function y = x3 construct a forward difference table when x takes the values x = 2, 3, 4, 5, and find the cube root of 10. 8. Find the value of x for y = cos x = 1.285 by the method of inverse interpolation using difference up to second order only given x y = cos x 0.736 1.2832974 0.737 0.738 0.739 1.2857159 0.740 1.2865247 0.741 1.2873348 1.2841023 1.2849085
9. The equation x3 6x 11 = 0 has a root between 3 and 4. Find the root. 10. Find by the method of inverse interpolation the real root of the equation x3 + x 3 = 0 which lies between 1.2 and 1.3.
Answers
1. 0.267949 4. 16.896 7. 2.154 10. 1.2314 2. 8.34 5. 2.018 8. 0.738110 3. 13.3 6. 0.47693612 9. 3.091
164
NUMERICAL ANALYSIS
8
NUMERICAL DIFFERENTIATION
8.1 INTRODUCTION
dy for some particular value of x from the dx given data when the actual form of the function is not known is called Numerical differentiation. When the values of the argument are equally spaced and we are to find the derivative for some given x lying near the beginning of the table, we can represent the function by NewtonGregory forward
dy is required at a point near the end of the table, we use dx Newtons backward interpolation formula and we may use suitable Central difference interpolation formula when the derivative is to be found at some point lying near the middle of the tabulated values. If the values of argument x are not equally spaced, we should use Newtons divided difference formula to approximate the function y = f(x).
8.2
y = y0 + uy0 +
u= x x0 h
u u1 1 2
g y
2
u u1 u2 1 2 3
gb
g y
3
+ ...
(1)
where
(2)
2u 1 2 3u 2 6u + 2 3 dy = y 0 + y0 + y0 + ... 1 2 1 2 3 du
differentiating (2) w.r.t. x we get
164
(3)
NUMERICAL DIFFERENTIATION
165
du 1 = . dx h
(4)
2u 1 2 3u 2 6u + 2 3 dy 1 = y0 + y0 + y0 + ... dx h 1 2 1 2 3
LM N
OP Q
(5)
dy at any x which is not tabulated. The formula (5) becomes dx simple for tabulated values of x, in particular when x = x0 and u = 0.
FG dy IJ H dx K
differentiating (5) w.r.t. x
=
x = x0
1 1 1 1 y0 2 y0 + 3 y0 4 y0 + ... , h 2 3 4
LM N
OP Q
(6)
d2y d dy dy = 2 dx dx dx dx
2
FG IJ H K 1 L = M y + bu 1g y h N
3 2 0
OP Q
F d yI GH dx JK
2 2
=
x = x0
1 2 11 4 y0 3 y0 + y0 ... , 2 12 h
LM N LM N
OP Q
similarly we get
F d yI GH dx JK
3 3
=
x = x0
OP Q
(8)
E = e hD
1 + = e hD
hD = log 1 +
166
NUMERICAL ANALYSIS
hD = D=
1 2 1 3 1 4 + + ... 2 3 4
LM OP N Q 1 L 1 1 1 O D = h M N 2 + 3 4 + ...PQ 1 L 11 5 O + + ...P D = M 12 6 h N Q
1 1 1 1 2 + 3 4 + ... h 2 3 4
2 3 4 2 2 2 2 3 4 5 2
Dy0 =
D 2 y0
FG dy IJ H dx K F d yI =G H dx JK
2 2
x = x0
1 1 1 1 y0 2 y0 + 3 y0 4 y0 + ... h 2 3 4
= 1 2 11 4 y0 3 y0 + y0 + ... 2 12 h
LM N
OP Q
x = x0
LM N
OP Q
8.3
DERIVATIVES USING NEWTONS BACKWARD INTERPOLATION FORMULA Consider the Newtons backward interpolation formula
y = yn + uyn +
where
u= x xn h
u u+1 2!
g y
2
u u+1 u+2 3!
gb
g y
3
+ ... (9)
(10)
3u 2 + 6u + 2 3 2u + 1 2 dy yn + ... = yn + yn + 1 2 1 2 3 du
and differentiating (10) w.r.t. x we get
du 1 = . dx h
(11)
(12)
NUMERICAL DIFFERENTIATION
167
dy dy du = , dx du dx
LM MN
OP PQ
xn xn = 0. n
FG dy IJ H dx K
x = xn
1 1 1 1 1 yn + 2 yn + 3 yn + 3 yn + 4 yn + ... , (14) h 2 3 3 4
LM N
OP Q
d2y d dy du = 2 du dx dx dx
6u 2 + 18u + 11 4 1 2 3 = 2 yn + u + 1 y n + yn + ... (15) 12 h
LM MN
FG IJ H K
OP PQ
F d yI GH dx JK
2
=
x = xn
1 11 4 2 yn + 3 yn + yn + ... . 2 12 h
LM N
OP Q
u u 2 12 3!
d d
i d y
3
+ 3 y 2 2
i + u du
2
12
4! + ...
i y
4
u u 2 12 u 2 2 2 5!
id
5 y 2 + 5 y 3 2
(16)
168
NUMERICAL ANALYSIS
where
u=
x x0 . h
(17)
3u 2 1 3 y + 3 y 2u 2 dy y0 + y1 1 2 = + + y 1 + 2 1 2 1 2 3 2 du 5u 4 15u 2 + u 5 y + 5 y 4 u 3 2u 4 2 3 y 2 + + ..., 1 2 3 4 1 2 3 4 5 2
Differentiating (17) w.r.t. x
dy 1 = dx h dy dy du = dx du dx dy 1 dy = dx h du dy 1 y0 + y1 2u 2 y 1 + = + dx h 2 1 2
2 3 1
iF GH
I JK
iF GH
I JK
(18)
(19)
LM N
1 2 3
OP Q d3u 1i d y
+ 3 y 2 2
i + d 4u
2
2u
1 2 3 4
4 y 2 +
1 2 3 4 5
u = 0 at x = x0. Putting u = 0 in (20) we get
d5u
15u 2 + u 5 y 2 + 5 y 3
id
i + ...
(20)
FG dy IJ H dx K
=
x = x0
3 3 5 5 1 y0 + y 1 1 y 1 + y 2 1 y 2 + y 3 + + ... h 2 6 2 30 2
LM MN
i OP PQ
(21)
F d yI GH dx JK
2 2
=
x = x0
1 2 1 4 y 1 y 2 + ... . 2 12 h
LM N
OP Q
(22)
NUMERICAL DIFFERENTIATION
169
27
2 y
3 y
4 y
FG dy IJ H dx K F dy I G J H dx K
2 2
x = x0
x =1
LM N 1L 1 1 O = M7 12 + 6 0 + ...P hN 2 3 Q
=
1 1 1 1 y0 2 y0 + 3 y0 4 y0 + ... 2 3 4 h
OP Q
=76+2 = 3
and
F d yI GH dx JK F d yI G H dx JK F dy I G J H dx K
2 2
x = x0
1 2 11 4 y0 3 y0 + y0 ... 12 h2 1 12 6 = 6 12
LM N
OP Q
=
x =1
= 3,
x =1
F d yI GH dx JK
2 2
= 6.
x =1
Example 8.2 From the following table of values of x and y find x y 1.00 1.00000 1.05 1.02470 1.10 1.04881 1.15 1.07238
170
NUMERICAL ANALYSIS
Solution The difference table is as follows x 1.00 1.05 1.10 1.15 1.20 1.25 1.30 y 1.00000 0.02470 1.02470 0.002411 1.04881 0.02357 1.07238 0.02306 1.09544 0.02259 1.11803 0.02214 1.14017 0.00045 0.00047 0.00051 0.00002 0.00054 0.00001 0.00003 0.00059 0.00002 0.00003 0.00006
y0 = 0.02411,
FG dy IJ H dx K F dy I G J H dx K F d yI and GH dx JK F d yI G H dx JK F d yI GH dx JK
2 2 2 2 2 2
=
x = 1.05
LM N
FG dy IJ H dx K
=
x = x0
1 1 1 1 y0 2 y0 3 y0 4 y0 + ... 2 3 4 h
LM N
gOPQ
LM b N
OP Q
g b
gOPQ
= 0.48763
x = 1.05
=
x = x0
1 2 11 4 5 y 0 3 y0 + y0 5 y0 + ... 2 12 6 h 1
LM N
OP Q
x = 1.05
= 0.2144 .
x = 1.05
NUMERICAL DIFFERENTIATION
171
Example 8.3 A rod is rotating in a plane about one of its ends. If the following table gives the angle radians through which the rod has turned for different values of time t seconds, find its angular velocity at t = 7 secs. t seconds 0.0 0.0 0.2 0.12 0.4 0.48 0.6 0.10 0.8 2.0 1.0 3.20
radians
Solution The difference table is given below t 0.0 0.2 0.4 0.6 0.8 1.0 Here
0.0
0.12 0.12 0.36 0.48 0.62 1.10 0.90 2.0 1.20 3.20 xn = tn = 1.0, h = 0.2, x = t = 0.7 0.30 0.28 0.02 0.26 0.02 0 0.24 0.02 0
u=
FG d IJ H dt K
=
n = 0.7
LM N
LM MN
b g g
. +2 6 15
b g b0.02gOP 6 PQ
OP Q
and
F d I GH dt JK
2 2
1 2 0 + u + 1 20 h2
b0.2g
172
NUMERICAL ANALYSIS
Solution The difference table x 0.4 0.5 0.6 0.7 0.8 y 1.5836494 0.2137932 1.7974426 0.2467950 2.0442376 0.2832678 2.3275054 0.3235764 2.6510818 0.0403084 0.0364728 0.0038358 0.0330018 0.0034710 0.0003648
2 y
we get
FG dy IJ H dx K FG dy IJ H dx K
FG dy IJ H dx K
1.3
=
x = x0
1 y0 + y1 1 3 y1 + 3 y2 + ... 2 6 2 h
x = 0.6
LM N
OP Q
gOPQ
= 2.644225 .
x = 0.6
Example 8.5 From the following table find x correct to two decimal places, for which y is maximum and find this value of y x y Solution The forward difference table is x 1.2 1.3 1.4 y 0.9320 0.0316 0.9636 0.0219 0.9855 0.0099 0.0097 0.0002 1.2 0.9320 1.4 0.9855 1.5 0.9975 1.6 0.996 0.9636
2 y
3 y
NUMERICAL DIFFERENTIATION
173
0.0002
dy = 0. dx
Differentiating Newtons forward interpolation formula w.r.t. u and neglecting terms of second differences we get
Substituting in we get
u = 38 . .
The value 1.58 is closer to x = 1.6, hence we use Newtons backward difference formula
b g
b gb
Solution The forward difference table is x 0 = x0 1 2 3 4 5 y 0 = y0 0.25 = y 0 0.25 0.25 0 2.25 2.25 13.75 16.00 40.25 56.25 26.50 11.50 15.00 2.50 9.00 6
2 0.50 = y0 3 3.00 = y0 4 6 = y0 5 0 = y0
174
NUMERICAL ANALYSIS
f x =
O 1 3u 6u + 2 4u 18u + 22u 6 1L y + y + y + ...P bg h MNy + 2u2 3! 4! ! Q 2u 1 dy 1 f b x g = = 0.25 = b 0.50g + 1 d3u 6u + 2i b3.00g + 24 d4u 18u + 22u 6i b6.00g dx 6 2
2 3 2 2 3 4 0 0 0 0
2 3 2
dy = u 3 3u 2 + 24. dx dy =0 dx
u 3 3u 2 + 2u = 0
u u 1 u 2 = 0 u = 0, u = 1, u = 2,
d2y 1 2 6u 2 18u + 1 4 3 f x y u y y0 + ... = = + + 1 0 0 12 dx 2 h2
gb
bg
1 6u 2 18u + 11 . u . 0 5 1 3 00 + + 6 , 12 12
2
clearly
and
F d yI GH dx JK F d yI f bg = G H dx JK
f b 0g =
2 2 2 2
LM N
LM MN
OP Q
gb g
OP Q
>0
x=0
>0
x=2
f b1 g =
F d yI GH dx JK
2 2
<0
x=1
Exercise 8.1
1. Find the first and second derivatives of the function tabulated below at the point x = 1.5 x y = f(x) 1.5 3.375 2.0 7.0 2.5 13.625 3.0 240 3.5 38.875 4.0 59.0
2. Find f (1.1), f (1.1) from the following table x f(x) 1.1 2.0091 1.2 2.0333 1.3 2.0692 1.4 2.1143 1.5 2.1667
NUMERICAL DIFFERENTIATION
175
3. Find x
dy at x = 1 dx
1 1
d2y at x = 1. dx2
2 8
3 27
4 64
5 125
6 216
y = f(x)
also find
4. Find x y
5. Find f (0.4) from the following table x f(x) 0.1 1.10517 0.2 1.22140 0.3 1.34986 0.4 1.49182
6. Find f(0.96) and f(0.96) from the following table x f(x) 0.96 0.7825 0.98 0.7739 1.00 0.7651 1.02 0.7563 1.04 0.7473
2 12
4 248
6 1284
8 4080
10 9980
8. The elevations above a datum line of seven points of roads 300 units apart are 135, 149, 157, 183, 201, 205, 193 unit. Find the gradient of the road at the middle point. 9. From the following table, calculate x y 1.1 1.62628 1.2 0.15584 1.3 2.45256
dy d2y and at x = 1.35 dx dx2
1.4 5.39168
1.5 9.125001
1.6 3.83072
10. In a machine a slider moves along a fixed straight rod. Its distance x units along the rod is given below for various values of the time t seconds. Find (a) the velocity of the slider and (b) its acceleration when t = 0.3 sec t (time in sec) x (distance in units) 0 3.013 0.1 3.162 0.2 3.207 0.3 3.364 0.4 3.395 0.5 3.381 0.6 3.324
176
NUMERICAL ANALYSIS
11. Using Bessels formula find f (x) at x = 0.04 from the following table x f(x) 0.01 0.1023 0.02 0.1047 0.03 0.1071 0.04 0.1096 0.05 0.1122 0.06 0.1148
12. From the following table, find the value of x for which y is minimum and find this value of y x f(x) 0.60 0.6221 0.65 0.6155 0.70 0.6138 0.75 0.6170
13. From the following data, evaluate x y 0.00 0.00000 0.05 0.10017
dy at x = 0.00 dx
0.10 0.20134
0.15 0.30452
0.20 0.41075
0.25 0.52110
14. A rod is rotating in a place the following table gives the angle (radians) through with the rod has turned for various values of the time t seconds find (i) the angular velocity of the rod, (ii) its angular acceleration when t = 0.6 sec t 0 0 0.2 0.122 0.4 0.493 0.6 1.123 0.8 2.022 1.0 3.200 1.2 4.666
15. Find the first and second derivatives of at x = 15 from the table x
x
15 3.873
17 4.123
19 4.359
21 4.583
23 4.796
25 5.000
16. From the table below, for what value of x, y is minimum? Also find this value of y? x y 3 0.205 4 0.240 5 0.259 6 0.262 7 0.250 8 0.224
17. Find the first and second derivatives of the function y = f(x), tabulated below at the point x = 1.1 x y 1 0.00 1.2 0.1280 1.4 0.5440 1.6 1.2960 1.8 2.4320 2.0 4.0000
72724
19. Use Stirlings formula to find the first derivative of the function y = 2ex x 1, tabulated below at x = 0.6 x y 0.4 1.5836494 0.5 1.7974426 0.6 2.0442376 0.7 2.3275054 0.8 2.6510818
NUMERICAL DIFFERENTIATION
177
LM MN
OP PQ
0.50 1.467 0.55 1.444 0.60 1.418 0.65 1.389
21. A function is according to the table given below x f(x) 0.35 1.521 0.40 1.506 0.45 1.488
Use Stirlings formula and find the value of f (0.5) 22. Estimate the annual rate of cloth sales of 1935 from the following data year : 1920 250 1925 285 1930 328 1940 444 Sales of cloth : in lakhs of metres
23. The elevation above a datum line of seven points of a road are given below x y 0 135 300 149 600 157 900 183 1200 201 1500 205 1800 193
Answers
1. 4.75, 9.0 4. 18 7. 2, 0 10. 0.5333 units/sec, 4.56 units/sec2 13. 2.0034 15. 0.12915, 0.0046 18. 0.099154 21. 11.55 2. 0.1737, 1.4750 5. 1.4913 8. 0.085222 11. 0.2563 3. 3, 6 6. 0.425, 0.500 9. 29.32975, 71.33 12. 0.6137
14. 3.814 radian/sec, 6.725 radian/sec2 16. x = 5.6875, y = 0.2628 19. 2.644225, 0.000013. 22. 0.08522 17. 0.630, 6.60 20. 0.44
9
NUMERICAL INTEGRATION
9.1 INTRODUCTION Numerical integration is used to obtain approximate answers for definite integrals that cannot be solved analytically. Numerical integration is a process of finding the numerical value of a definite integral
I =
z bg
b a
f x dx ,
when a function y = f (x) is not known explicitly. But we give only a set of values of the function y = f (x) corresponding to the same values of x. To evaluate the integral, we fit up a suitable interpolation polynomial to the given set of values of f (x) and then integrate it within the desired limits. Here we integrate an approximate interpolation formula instead of f (x). When this technique is applied on a function of single variable, the process is called Quadrature. Suppose we are required to evaluate the definite integral I = approximate f (x) by a polynomial ( x ) of suitable degree. Then we integrate f(x) within limits [a, b], i.e., the difference
z bg
b a
f x dx , firstly we have to
z
b a
f x dx x dx ,
a
bg
zbg
b
LM f x dx x dx ,OP , bg P MN b g Q
z
b a
z
b a
NUMERICAL INTEGRATION
179
z bg
b a
f x dx
(1)
Let f (x) take the values f (x0) = y0, f (x0 + h) = y1, , f (x + nh) = yn, when x = x0, x = x0 + h, , x = x0 + nh respectively. To evaluate I, we replace f (x) by a suitable interpolation formula. Let the interval [a, b] be divided into n subintervals with the division points a = x0 < x0 + h < < x0 + xh = b where the h is the width of each subinterval. Approximating f (x) by Newtons forward interpolation formula we can write the integral (1) as
x0 + nh
I =
x0
z bg
x0 + nh
f x dx =
x0
z FGH
y0 + uy0 +
u u1 2!
g y
2
+ ... dx ,
I JK
x = x0 + uh dx = hdu
and
x = x0
u=0
x = x0 + nh
u = n.
I =h
z z
0 n 0
180
NUMERICAL ANALYSIS
Fn GH 4
n3 + n2
Iy JK 6
3
Fn GH 5
4 y0 3 4 11n 3 + ... . 3n 2 n + 2 3 24
I JK
OP PQ
(3)
The equation (3) is called General Gauss Legendre Quadrature formula, for equidistant ordinates from which we can generate any Numerical integration formula by assigning suitable positive integral value to n. Now we deduce four quadrature formulae, namely (a) Trapezoidal rule (b) Simpsons one-third rule (c) Simpsons three-eighths rule and (d) Weddles rule from the general quadrature formula (3).
9.3 TRAPEZOIDAL RULE Substituting n = 1 in the relation (3) and neglecting all differences greater than the first we get
x0 + h
I1 =
x0
z
b
f x dx = h y0 +
bg
LM N
1 y 0 2
OP Q g
h h 2 y0 + y1 y0 = y0 + y1 , 2 2
g b
l2 =
x0 + h
x0 + 3h
l3 =
x0 + 2 h
z bg z bg
b g
f x dx =
h y1 + y2 , 2
f x dx =
h y2 + y3 , 2
L L L
x0 + nh
In =
x0 + n 1 h
z bg
f x dx =
h yn 1 + yn , 2
I 1 + I 2 + ... + I n
x0 + h
x0
x0 + 2 h
f ( x ) dx +
x0 + h
x0 + 3h
f ( x ) dx +
x0 + 2 h
x0 + nh
f ( x ) dx + ... +
x0 + ( n 1) h
f ( x ) dx
NUMERICAL INTEGRATION
181
=
x0 + nh
h h h h y0 + y1 + y1 + y2 + y2 + y3 + ... + yn 1 + yn , 2 2 2 2 h y0 + yn + 2 y1 + y2 + ... + yn 1 , 2
x0
z bg
f x dx =
g d b
I =
z bg
b a
f x dx =
h y0 + yn + 2 y1 + y2 + ... + yn 1 . 2
g d
(4)
The formula (4) is called Trapezoidal rule for numerical integration. The error committed in this formula is given by
E
where
ba h3 f = 12 12n 2
bg b
g f bg ,
3
a = x0 < < xn = b .
Note: Trapezoidal rule can be applied to any number of subintervals odd or even.
9.4 SIMPSONS ONE-THIRD RULE Substituting n = 2 in the General quadrature formula given by (3) and neglecting the third and other higher order differences we get
x0 + 2 h
I1 =
x0
f x dx = h 2 y0 + 2 y0 +
bg
LM N
FG 8 2IJ y OP H3 K Q
2 0
= h 2 y0 + 2 y1 y0 + = I1 = h y0 + 4 y1 + y2 3 h y0 + 4 y1 + y2 , 3
x0 + 2 h
LM N
g 1 by 3
2 y1 + y0
gOPQ
Similarly
I2 =
x0 + 2 h
f x dx =
bg
L L L
h y 2 + 4 y3 + y4 , 3
182
x0 + nh
NUMERICAL ANALYSIS
In/2 =
x0 + b n 2 g h
f x dx =
bg
h yn 2 + 4 yn 1 + yn . 3
Adding I 1 , I 2 , I n / 2 we get
x0 + 2 h
I 1 + I 2 + ... + I n / 2 =
x0
z bg z bg
x0 + 2 h
x0 + nh
f x dx +
f x dx + ... +
x0 + 2 h
x0 + b n 2 g h
z bg
f x dx
h h h yn 2 + 4 yn 1 + y n , y0 + 4 y1 + y2 + y2 + 4 y3 + y4 + ... + 3 3 3
= =
= =
h 2 sum of the even ordinates 3 The above rule is known as Simpsons one-third rule. The error committed in Simpsons onethird rule is given by
bg b
g bg
5
I=
x0
f ( x ) dx
2. Simpsons one-third rule can be applied only when the given interval [a, b] is subdivided into even number of subintervals each of width h and within any two consecutive subintervals the interpolating polynomial (x) is of degree 2.
9.5
We assume that within any three consecutive subintervals of width h, the interpolating polynomial x approximating f (x) is of degree 3. Hence substituting n = 3, i.e., the General quadrature formula and neglecting all the differences above 3 , we get
bg
NUMERICAL INTEGRATION
x0 + 3h
183
I1 =
x0
z
LM N
f x dx = h 3 y0 +
bg
LM N
9 9 2 y0 + 9 y0 + 2 2 2 y1 + y0 +
FG H
IJ K
FG 81 27 + 9IJ y OP H4 K 6 Q
3 0
= h 3 y0 + 9 y1 y0 + =
g 9 by 4
3 y3 3 y2 + 3 y1 + y0 8
gOPQ
3h y0 + 3 y1 + 3 y2 + y3 , 8
x0 + 6 h
Similarly
I2 =
x0 + 3h x0 + 9 h
I3 =
x0 + 6h
z z
f x dx =
bg
3h y3 + 3 y4 + 3 y5 + y6 , 8
f x dx =
bg
3h y6 + 3 y7 + 3 y8 + y9 , 8
L L L
x0 + nh
In/3 =
x0 + n 3 h
b g
f x dx =
bg
3h yn 3 + 3 y n 2 + 3 yn 1 + yn . 8
I 1 + I 2 + ... + I n / 3 =
x0
z bg z bg
x0 + 6 h
x0 + nh
f x dx +
f x dx + ... +
x 0 + 3h
x0 + n 3 h
b g
z bg
f x dx ,
I =
3h 3h y0 + 3 y1 + 3 y2 + y3 + y3 + 3 y4 + 3 y5 + y6 + 8 8 ... + 3h y n 3 + 3 yn 2 + 3 yn 1 + y n , 8
I =
3h y0 + yn + 3 y1 + y2 + y4 + y5 + ... + yn 1 + 8
g d
2 y3 + y6 + ... + yn 3 .
Note: 1. Simpsons three-eighths rule can be applied when the range [a, b] is divided into a number of subintervals, which must be a multiple of 3.
184
NUMERICAL ANALYSIS
9.6
WEDDLES RULE
Here we assume that within any six consecutive subintervals of width h each, the interpolating polynomial approximating f (x) will be of degree 6. Substituting n = 6 in the General quadrature formula given by expression (3) and neglecting all differences above 6 , we get
x0 + 6h
I1 =
x0
f x dx = h 6 y0 + 18y0 + 27 2 y0 + 24 3 y0 +
bg
LM N
123 4 33 5 41 6 y0 + y0 + y0 . 10 10 140
OP Q
Since
I1 =
x0
x0 + 12 h
Similarly
I2 =
x0 + 6 h
z z
f x dx =
bg
f x dx =
bg
L L L
x0 + nh
I n /6 =
x0 + n 6 h
b g
f x dx =
bg
3h yn 6 + 5 yn 1 + yn 4 + 6 yn 3 + 10
y n 2 + 5 yn 1 + yn .
Adding I 1 , I 2 , I n / 6 , we get
I =
x0 + nh
x0
z bg
f x dx
6 y n 3 + y n 2 + 5 y n 1 + yn
NUMERICAL INTEGRATION
185
g b
yn 4 + yn 2 + 5 y1 + y5 + y7 + y11 + ... + yn 5 + yn 1 +
i d
i d
z
x 0
f x =
bg
x , 1+ x
a = 0, b = 1 and n = 6,
h=
x y = f (x) 0 0.00000 y0 1/6 0.14286 y1
b a 1 0 1 = = . n 6 6
2/6 3/6 0.33333 y3 4/6 0.40000 y4 5/6 0.45454 y5 6/6 = 1 0.50000 y6
0.25000 y2
I =
=
h y0 + y6 + 2 y1 + y2 + y3 + y4 + y5 2
g b
z
1 0
dx 1 + x2
f x =
bg
1 , 1 + x2
186
NUMERICAL ANALYSIS
a = 0, b = 1 and n = 5,
h=
x y = f (x) 0.0 1.000000 y0 Using trapezoidal rule we get 0.2 0.961538 y1
1 0 1 = + 0.2 . 5 5
0.4 0.832069 y2 0.6 0.735294 y3 0.8 0.609756 y4 1 0.500000 y5
I =
z
1
dx h y0 + y5 + 2 y1 + y 2 + y3 + y4 = 2 2 1+ x 0
g b g
z
1
1 dx = tan 1 x 2 1 x + 0
1 0
= tan 1 1 tan 1 0 =
= 0.7853981 4
z
1
1 dx = 0.78540 , 1 x2 + 0
z
5 1
log10 xdx, taking 8 subintervals correct to four decimal places by Trapezoidal rule.
f x = log10 x ,
a = 1, b = 5 and n = 8,
bg
h=
x f (x) 1.0 0.00000 y0 1.5 0.17609 y1 2.0 y2
4.0 0.60206 y6
4.5 0.65321 y7
5.0 0.69897 y8
0.30103 0.39794
NUMERICAL INTEGRATION
187
I = =
h y0 + y8 + 2 y1 + y2 + y3 + y 4 + y5 + y6 + y7 2
g b
g g
0.5 0.00000 + 0.69897 + 2 0.17609 + 0.30103 + 0.39794 + 2 0.5 2 0.47712 + 0.54407 + 0.60206 + 0.65321 2
g b
= 17505025 .
I =
0.6
z
5 1
z
0
f x = ex ,
a = 0, b = 0.6, n = 6.
bg
h=
x y = f (x) 0.0 1.0000 y0 The Simpsons rule is 0.1 1.10517 y1 0.2
b a 0.6 0 = = 0.1. n 6
0.3 1.34986 y3 y2 0.4 1.49182 y4 0.5 1.64872 y5 0.6 1.82212 y6
1.22140
I = = =
h y 0 + y6 + 4 y1 + y3 + y5 + 2 y2 + y 4 3
g b
g b
g g
0.1 1.00000 + 182212 . . . + 4 110517 + 134986 + 1.64872 + 2 122140 . + 149182 . 3 01 . 2.82212 + 4 4.10375 + 2 2.71322 3
g b
g b
g b
188
NUMERICAL ANALYSIS
v=
z z z
s=
0
ds dt
ds = v. dt
ds = v. dt
20
v. dt .
The train starts from rest, the velocity v = 0 when t = 0. The given table of velocities can be written t v 0 0 y0 2 16 y1 4 28.8 y2 6 40 y3 8 46.4 y4 10 51.2 y5 12 32.0 y6 14 17.6 y7 16 8 y8 18 3.2 y9 20 0 y10
h=
The Simpsons rule is
20
2 1 hrs = hrs. 60 30
s=
z
0
v. dt =
h y 0 + y10 + 4 y1 + y3 + y5 + y 7 + y9 + 2 y2 + y4 + y6 + y8 3
g b
g g
=
=
g b
= 8.25 km.
1.809 2.10
2.462 2.70
Using the formula (0.018) T = 3.0 m to 15 m above the orifice. Solution We have h = 0.15,
1.5
A x
dx , calculate T the time in seconds for the level of the water to drop from
A x
is
NUMERICAL INTEGRATION
189
1.50
1.65
1.80
1.95
2.10
2.25
2.40
2.55
2.70
2.85
3.00
y=
A x
1.5
A x
dx =
g b
= 19743 .
1.5
z
3
A x
dx = 1.9743.
0.018 T =
1.5
z
3
A x
dx ,
we get
. b0.018g T = 19743
T= 1.9743 = 110 sec approximately 0.018
T = 110 sec.
z
1 0
1 1 + x2
0,
x 0
1 2 3 4 5 , , , , , 1. 6 6 6 6 6
1/6 2/6 3/6 0.8000000 4/6 0.6923077 5/6 0.5901639 1 0.5000000
y=
1 1 + x2
Here h =
190
NUMERICAL ANALYSIS
I =
3h y0 + y 6 + 3 y1 + y2 + y4 + y5 + 2 y 3 8
g b
g b g
g b
g b
= 0.7853959 .
/2
z
0
Solution We divide the range in three equal points with the division points
x 0 = 0, x1 =
where
, x2 = , x 3 = 6 3 2
h=
The table of values of the function is x 0 1 y0 By Simpsons three-eighths rule we get I=
. 6 6
1.64872 y1
3
2.36320 y2
2
2.71828 y3
y = e sin x
/2
z
0
esin x dx =
3h y0 + y3 + 3 y1 + y2 8
g b
= =
g b
= 0.091111
I=
z
0
esin x dx = 0. 091111.
NUMERICAL INTEGRATION
/2
191
z
0
y = f = 1 0162 . sin 2 ,
a = 0, b =
taking n = 12 we get
bg
, 2
0 ba h= = 2 = . n 12 24
f 0 y = f (f) 1.000000 0.998619 0.994559 0.988067 0.979541 0.969518 y0 y1 y2 y3 y4 y5 f y = f (f) 0.958645 0.947647 0.937283 0.928291 0.921332 0.916930 0.915423 y6 y7 y8 y9 y10 y11 y12
6 24 7 24 8 24 9 24 10 24 11 24 12 = 24 2
24 2 24 3 24 4 24 5 24
I =
z
0
1 0.162 sin2 f df
= =
3h 3h y2 + y4 + y8 + y10 + 6 y3 + y9 + 2 y6 y0 + y12 + 5 y1 + y5 + y 7 + y11 + 10 10 3 11.000000 + 0.915423 + 5 0.998619 + 0.969518 + 0.947647 + 0.916930 + 240 3 3 0.994559 + 0.979541 + 0.937283 + 0.9213322 + 6 0.988067 + 0.928291 + 2 0.958645 240 240
g b
g b
g b
I = 1505103504 . .
192
5.2
NUMERICAL ANALYSIS
z
4
h=
x y = f(x) 4.0 1.3863 4.2 1.4351 4.4
5.2 4 = 0.2 , 6
4.6 1.5261 4.8 1.5686 5.0 1.6094 5.2 1.6457
1.4816
Weddles rule is
5.2
I =
z
4
log e x dx =
3h y0 + 5 y1 + y2 + 6 y 3 + y 4 + 5 y5 + y6 10
3 0.2 10
= 0.06 30.4643
5.2
z
4
= 1827858 .
log e x = 1827858 . .
1. Evaluate
2. Evaluate
z ze
1 0 1 0
Exercise 9.1
x 3 dx by Trapezoidal rule.
3. Given that e0 = 1, e1 = 2.72, e2 = 7.39, e3 = 20.09, e4 = 54.60, find an approximation value of Trapezoidal rule. 4. Evaluate
z
4 0
e x by
z
1 0
1 x 3 dx by (i) Simpsons rule and (ii) Trapezoidal rule, taking six interval correct to two
decimal places.
5. Evaluate
z
2 0
sin x dx taking x = 6, correct to four significant figures by (i) Simpsons one-third rule
NUMERICAL INTEGRATION
193
6. Evaluate
z
2 0
dx taking 4 subintervals, correct to five decimal places (i) Simpsons one-third rule (ii) x
Trapezoidal rule. 7. Compute by Simpsons one-third rule, the integral taking step length equal to 0.1. 8. Evaluate
z
1 0
b g
z
1 0
sin x 2dx by (i) Trapezoidal rule and (ii) Simpsons one-third rule, correct to four decimals
z
3
sin x 4 dx by using (i) Trapezoidal rule and (ii) Simpsons rule, taking
11. Compute
0.5
12. Evaluate
0.4
13. Evaluate
z z z
1 0 0
2 0
z
2 0
cos x dx by (i) Trapezoidal rule and (ii) Simpsons one-third rule taking x = 6.
15
e x dx by (i) Trapezoidal rule and (ii) Simpsons one-third rule taking x = 10.
x dx taking n = 10, by (i) Trapezoidal rule and (ii) Simpsons one-third rule. cos x
cos x dx taking four equal intervals by (i) Trapezoidal rule and (ii) Simpsons one-third rule.
14. Evaluate
15. Evaluate
16. Evaluate
z z z
1 0 2 0
x2 + 2 dx by Weddles rule, correct to four decimals taking n = 12. x2 + 1 1 dx by using Weddles rule taking twelve intervals. 1 + x2
194
16
NUMERICAL ANALYSIS
17. Evaluate
0.4
z z z
2
1 dx taking n = 4. loge x
21. A river is 80 unit wide. The depth at a distance x unit from one bank d is given by the following table x d 0 0 10 4 20 7 30 9 40 12 50 15 60 14 70 8 80 3
23. Evaluate
24. Evaluate
z z
0
z
2 0
sin x + cos x dx, correct to two decimal places using seven ordinates.
0.3
z
0
z
0
(1 8 x 3 ) 2 dx.
dx 1 x2
z
1
f ( x ) dx =
1 13 f (1) f ( 3) f ( 3) 12
NUMERICAL INTEGRATION
195
z
3 1
ux dx = 2u2 +
1 u0 2u2 + u4 12
dx
1
that f 0 =
bg
2 u1 1 u0 2 2u
LM MN
OP PQ
3
1
f x dx, u0 =
bg
z
1
f x dx, u1 =
bg
z bg
3 1
f x dx then show
Answers
1. 0.260 4. 0.83 7. 0.083 10. 1.170, 1.187 13. 0.3891, 0.3894 16. 1.1071 19. 1.007 22. 1.1872 25. 0.2899 2. 0.995 5. 1.187, 1.170 8. 0.3112, 0.3103 11. 1.764, 1.763 14. 1.18916 17. 1.1020 20. 3.1832 23. 0.08409 26. 0.52359895 3. 58.00 6. 0.69326, 0.69702 9. 115, 98 12. 0.133494, 0.133400 15. 1.7854 18. 2.545 21. 710 Sq units 24. 1.14
gb x x g ... b x x g f b x g + b g b xb x xx gb x x g ... b x x g
1 2 n 0 0 1 0 2 0 n
x0
z bg
f x dx = H0 f x0 + H1 f x1 + ... + Hr f xr + ... + Hn f xn .
b g
b g
b g
b g
(5)
196
NUMERICAL ANALYSIS
xr + 1 xr = h
for all r such that and substituting we get and
xr = x0 + rh u= x x0 h
hdu = dx
Hr = h
b g bu r 1g h ... bu ng h du brhg br 1g h br 2g h ... b1hgb1hg ... bn r g h u bu 1gbu 2g ... bu r + 1gbu r 1g ... bu ng =h h du h r !b 1g h bn r g! b1g h u bu 1gbu 2g ... bu ng du , (6) = r ! b n r g! bu r g
n
z z
0 n 0
uh u 1 h ... u r + 1 h
nr
nr
nr
z
n 0
expression (6) gives the values of Hr. To obtain the error in the NewtonCotes formula. We integrate the error term of the Lagranges interpolation formula over the range x0 to xn = x0 + nh. The error term in Lagranges formula is
Error =
where x 0 < < xn .
fb
bn + 1g! b x x gb x x g ... b x x g ,
0 1 n
n +1
g b g
E =
x0
= h h n +1
0
z z
n
n
fb
n +1
g bg
n +1
n + 1 y0 n +1 fb g , n +1 h
E =h
bg
we can write
zb
0
n + 1 y0 u u 1 u 2 ... u n du . n+1
g b
gb
g b
NUMERICAL INTEGRATION
197
I=
x0 n
f ( x ) dx = nh
r=0
f (x ) c
r
r n r
= ( xn x0 )
f (x ) c .
r n 0
Corollary The coefficients of the NewtonCotes formula are symmetric from both the ends. Proof Putting n v = u, in (6) we get, u n = v du = dv and
Hr = h
n
zb g
0
nr
=h
=h
=h
=h
=h
r! n r !
r! n r ! 1
2n r
n +1
v v 1 ... v n 1 v n + 1 dv
dv
v v 1 ... v n 1 v n + 1
r! n r ! 1
2n
v v 1 ... v n 1 v n + 1
r! n r ! 1
r
dv
v v 1 ... v n 1 v n + 1
r! n r !
r
dv
v v 1 ... v n 1 v n + 1
dv = Hn r
Hr = Hn r proved.
9.8
DERIVATION OF TRAPEZOIDAL RULE, AND SIMPSONS RULE FORM NEWTONCOTES FORMULA 1. Trapezoidal rule Putting n = 1 in (5), we get
198
x0 + h
NUMERICAL ANALYSIS
I =
x0
z bg
1 0
f x dx = H0 f x0 + H1 f x1
b g
b g
2
where and
n1 = n0 + h
H0 =
b1g
0! 1!
H1 = h u du =
0 x0 + h
I =
x0
z z
1
z
1 0
L bu 1g du = b1g h MN u2
b g b g
u =
OP Q
h 2
h , 2 h f x0 + f x1 . 2
f x dx =
bg
I =
x0
z bg
20
f x dx = H0 f x0 + H1 f x1 + H2 f x2
b g gb
b g
b g
H0 =
b1g
2! 0!
zb
2 0
u u1 u2 du u
1 = h 2 =
h 8 h 6+4 = , 2 3 3
LM N
zd
u 3u + 2 du =
2
h u 3 3u 2 + 2u 2 3 2
H1
b1g =
= h
2 1
1! 1!
z
2 0
OP Q
LM N
OP Q
Lu u bu 2g du = h M N3
O u P Q
2
LM 8 4OP = 4h , N3 Q 3
h 3
since we get
H r = Hn r
H 2 = H0 =
NUMERICAL INTEGRATION
x0 + 2 h
199
I =
x0 x0 + 2 h
f x dx =
bg
h h 4h f x0 + f x1 + f x2 3 3 3
b g
b g
b g
x0
f x dx =
bg
h f x0 + 4 f x1 + f x2 . 3
b g
b g b g
Note: Similarly by putting n = 3, and n = 6 in respectively (5) we can derive Simpsons three-eighths rule and Weddles rule. Example 9.11 If yx is a polynomial in x of the third degree, find an expression for y3. Use this results to show that:
z
2 0
z
2 1
0
y x dx =
1 y0 + 13 y1 + 13 y2 y3 . 24
Solution
We have
yx = =
x x2 x3
b gb g y b1gb2gb3g
x x 1 x 3
gb g y b2gb1gb1g
x x 1 x 2
gb g y b3gb2gb1g
x 3 6 x 2 + 11x 6 x 3 5x 2 + 6 x y0 + y1 + 6 2
x 3 4 x 2 + 3x x 3 3x 2 + 2 x y2 + y3 . 2 6
3
We get
z
1 0
yx
L 1F x dx = M G MN 6 H 4
11x 2 1 x4 5 3 2x + 6 x y0 + x + 3x 2 y1 2 2 4 3
I JK
F GH
I JK
OP PQ
+
0
LM 1 F x 4 x + 3x I y + 1 F x x MN 2 GH 4 3 2 JK 6 GH 4 F 1 I F 9 I F 1 I F 19 I F 1 I F 5 I = G J G J y + G J G J y G J G J y H 6 K H 4 K H 2 K H 12 K H 2 K H 12 K
4 2 4 3 2
0 1
I O +x Jy P K PQ 1 F 1I + G Jy , 6 H 4K
1 2 0 0
3 3
similarly
z z
2 0 2 1
y x dx =
FG 1 IJ b2g y + FG 1 IJ FG 8 IJ y FG 1 IJ FG 8 IJ y H 6K H 2 K H 3K H 2 K H 3K
0 1
FG 1 IJ b0g y H 6K
y x dx =
1 y 0 + 13 y1 + 13 y2 y3 . 24
z
1 0
y x dx =
1 ( 5u1 + 8u0 u1 ) 12
200
NUMERICAL ANALYSIS
Solution
We have x ux 1 u1 0 u0 1 u1
ux =
b x 0gb x 1g u b1 0gb1 1g
x2 x u1 x 2 1 u0 + x 2 + x u1 2
1 u 1 2
z
1 0
u x dx =
z
1 0
dx
x dx u0
z
1 0
dx
1 dx +
1 u1 x 2 + x dx 2 0
zd
1
= =
1 2 5 u1 + u0 + u1 12 3 12
1 5u1 + 8u0 u1 . 12
9.9 BOOLES RULE Retaining differences up to those of the fourth order in the general formula and integrating between x0 and x4 we get
x4
I1 =
x0
z bg z bg
x0 + uh
f x dx =
f x dx
x0
LM N L = 4h M y N b
= 4h u0 + 2 y0 +
5 2 2 7 4 y0 + 3 y0 + y0 3 3 90
OP Q gOPQ
+ 2 y1 y0 +
g 5 by 3
g
2 y1 + y0 +
2 7 y3 3 y2 + 3 y1 y0 + y4 4 y3 + 6 y2 4 y1 + y0 3 90 = 2h 7 y0 + 32 y1 + 12 y2 + 32 y3 + 7 y4 45
NUMERICAL INTEGRATION
x0 + 8h
201
Similarly
I2 =
x0 + 4 h
z bg
L L L
f x dx =
2h 7 y4 + 32 y5 + 12 y6 + 32 y7 + 7 y8 45
x0 + nh
I n /4 =
x0 + n 4 h
b g
z bg
f x dx =
2h 7 yn 4 + 32 yn 3 + 12 yn 2 + 32 yn 1 + 7 yn 45
x0 + nh
x0
z bg z bg
b
f x dx =
f x dx
2h 7 y0 + 32 y1 + 12 y2 + 32 y3 + 14 y4 + 32 y5 + 12 y6 + 32 y7 + 14 y8 + ... + 14 yn 4 + 32 yn 3 45
12 yn 2 + 32 yn 1 + 7 yn
The above formula is known as Booles rule. The leading term in the error of the formula is
8h 7 VI f . 945
Example 9.13 Evaluate the integral of f(x) = 1 + ex sin 4x over the interval [0, 1] using exactly five functional evaluations. Solution Taking h =
bg
z bg
1 0
f x dx = =
LM b g N
FG IJ HK
FG IJ HK
FG IJ HK
b gOPQ
1 32 1.06666 + 7 0.72159 90
= 130859 . .
E=
where If we put
b a < < bg .
c=
bb ag y bg h
12
bb ag y bg
12
202
NUMERICAL ANALYSIS
If y , the second derivative, is reasonably constant c may be taken to be constant. Consider the valuation of the integral
I =
bg
z
b a
y dx
by the Trapezoidal rule with two different intervals say h1, h2. Let I1 and I2 denote the approximate values with the corresponding errors E1 and E2 respectively. Then and
I = I1 + ch12
2 I = I 2 + ch2
We get
or
2 I1 + ch12 = I 2 + ch2
c=
I1 I 2 . 2 h12 h2
I = I1 +
FI GH h
1 2 2
I2 2 h1 h12
(7)
I JK
I =
This will be a better approximation to I than I1 or I2. The above method is called Richardsons method. If we take h = h1 and h2 =
1 h in (7) 2
we get
I =
I1
1 h2 I1 I 2 I2h2 4 I I1 4 4 = = 2 2 3 3 h h2 4 4
I 2 I1 . 3
I = I2 +
(8)
If we apply the Trapezoidal rule several times successively halving h, every time the error is reduced by a factor
1 . Let A1, A2, A3, denote the results. Let the formula (8) be applied to each 4 pair of Ai s and denote the results by B1, B2, B3, , etc.
Applying formula (8) to each pair of Bi s we get next results C1, C2, in this process the following array of results is obtained.
NUMERICAL INTEGRATION
203
A1
A2 B1
A3 B2 C1
A4 B3 C2
The above computation is continued with two successive values are very close to each other. This refinement of Richardsons method is known as Romberg integration. The values of the integral, in Romberg integration can be tabulated as follows. I(h) I(h, h/2) I(h/2) I(h/2, h/4) I(h/4) I(h/4, h/8) I(h/8) where
4 I b h / 2g I b hg g 1 3 1 I bh / 2 , h / 4 g = 4 I bh / 4 g I bh / 2 g 3 I h, h / 2 =
I(h, h/2, h/4) I(h, h/2, h/4, h/8) I(h/2, h/4, h/8)
L
I h, h / 2, h / 4 = I h / 2, h / 4, h / 8 = I h, h / 2, h / 4, h / 8 =
1 4 I h / 2, h / 4 I h, h / 2 3
g b
1 4 I h / 4, h / 8 I h / 2, h / 4 3
g b
g
g
1 4 I h / 2, h / 4, h / 8 I h, h / 2, h / 4 3
1.2
g b
z
0
Solution Here We can take h = 0.6, 0.3, 0.15 i.e., x f (x) 0 1 0.15 0.8695 0.30 0.7692
f x =
bg
1 1+ x
h = 0.6,
0.40 0.6896
h h . = 0.3, = 015 2 4
0.60 0.6250 0.75 0.5714 0.90 0.5263 1.05 0.48780 1.20 0.4545
204
NUMERICAL ANALYSIS
I h = I 0.6 = I1 =
with h =
bg b g
I h / 2 = I 0.3 = I 2
with h =
I h / 4 = I 015 . = I3
= 0.15 0.15 1 + 0.4545 + 2 0.8695 + 0.7692 + 0.6896 + 2 0.6250 + 0.5714 + 0.5263 + 0.4878 2 2
b g b g
= 0.7899 .
Now
Similarly
We get
= 0.7883
0.7883
I =
z
0
1 dx = 0.7883 1+ x
NUMERICAL INTEGRATION
205
Exercise 9.2
1. If H0, H1, H2, , Hn are Cotes coefficients, show that (a) H0 + h1 + H2 + + Hn = nh (b) Hr = Hn r 2. Using Cotes formula, show that
x2
x0
z bg
f x dx = x2 x0
y g FGH 1 6
4 1 y1 + y2 6 6
IJ K
2 = C0
z
1 0
1 dx = 0.6931. 1+ x
5.2
z
4
z
2 0
sin x dx = 1.
4.0 1.3863
4.2 1.4351
4.4 1.4816
4.6 1.526
dx = 0.7855. 1 + x2
4.8 1.5686
5.0 1.6094
5.2 1.6486
z
1 0
9.11
DOUBLE INTEGRATION
In this section we obtain double integration formulae by shifting the single integration formulae. Trapezoidal rule Consider the integral of the form
I =
zz
d b c a
F f x, y dxI dy , GH b g JK
(9)
over the rectangles x = a, x = b, and y = c, y = d. Evaluating the inner integral by the Trapezoidal rule we get
I = ba 2
z
d c
f a , y + f b, y dy ,
b g b g
(10)
applying Trapezoidal rule again to evaluate the integral on the right hand side of (10) we get
206
NUMERICAL ANALYSIS
I =
(11)
If discrete value are given we can use the composite Trapezoidal rule by dividing the interval [a, b] into n equal subintervals each of length h and the interval [c, d ] into m equal subintervals each of length k. We have xi = x0 + ih, x0 = a, xn = b yj = y0 + jk, y0 = c, ym = d applying composite Trapezoidal rule in both the directions we get
I = hk f x0 , y0 + 2 f x0 , y 1 + f x0 , y2 + ... + f x0 , ym 1 + 4 2
ob
g cb
i 0
g b
i
ij
f b x , y g + 2c f b x , y g + f b x , y g + ... +
1 i 2 i =1
n 1
ij + f b x , y g + f b x , y g + 2b f ( x , y ) + f ( x , y ) + ... + f ( x , y ) g + f ( x , y )r.
f xi , ym 1
1
m 1
(12)
mb g b g b g b g 4 f ba , c + k g, f ba + h, cg + f ba + h, d g + f bb, c + k g + 16 f ba + h, c + k gr . (13)
hk f a , c + f a , d + f b, c + f b, d + 9
Example 9.15
zz
2 2 1 1
zz
2 2 1 1
dx dy x+ y
1 1 3 3 3 3 f 1, 1 + f 2, 1 + f 1, 2 + f 2, 2 + 2 f , 1 + f 1, ,2 + f 2, + f 16 16 2 2 2 2
FG IJ FG IJ FG IJ OP + 4 f FG 3 , 3IJ OP H K H K H K Q H 2 2K Q
= 0.343304 .
NUMERICAL INTEGRATION
207
Example 9.16 Using the table of values given below evaluate the integral of f(x, y) = ey sin x over the interval 0 x 0.2, 0 y < 0.2 (a) by the Trapezoidal rule with h = k = 0.2 and (b) by Simpsons one-third rule with h = k = 0.1 y 0.0 0.1 0.2 Solution (a) Applying Trapezoidal rule we get
I =
b0.2g
4
g b
= 0.004413.
0.5 0.5
Evaluate
zz
0 0
xy dx dy using Simpsons rule for double integrals with both step sizes 1 + xy
n = k = 0.25, x 0 = 0, x1 = 0.25, x2 = 0.5 y 0 = 0, y1 = 0.25, y2 = 0.5 f (0, 0) = 0, f (0, 0.25) = 0, f (0, 0.5) = 0 f (0.25, 0) = 0, f (0.25, 0.25) = 0.05878525, f (0.25, 0.5) = 0.110822 f (0.5, 0) = 0, f (0.5, 0.25) = 0.110822, f (0.5, 0.5) = 0.197923
LM N
FG IJ H K
FG 1 , 0IJ OP H 2 KQ
+ 4 f 0,
R F 1I F 1 1I F 1 1I U S T GH 4 JK + 4 f GH 4 , 4 JK + f GH 2 , 4 JK V W F 1I F 1 1I F 1 1I + f G 0, J + 4 f G , J + f G , J H 2K H 4 2K H 2 2K
= 0.014063
208
NUMERICAL ANALYSIS
9.12 EULER-MACLAURIN SUMMATION FORMULA Consider the function F(x), such that F( x ) = f ( x ) let x0, x1, x2, ..., xn, be equi-spaced values of x, with difference. From (1), we get F( x ) = f ( x 0 ) F(x1) F(x0) = f ( x 0) Similarly, F(x2) F(x1) = f ( x 1) ... F(xn) F(xn1) = f (xn1) Adding, these we get
n1
...(1)
i=0
f bx g
i
...(2)
1 h 1 h
z z
f ( x ) dx f ( x ) dx
...(3)
NUMERICAL INTEGRATION
209
1 F(xn) F(x0) = h
+
xn
x0
z z
f ( x ) dx
1 f ( xn ) f ( x0 ) 2
i =0
n 1
1 f ( xi ) = h
f ( x ) dx
x0
1 f ( xn ) f ( x0 ) + 2
h h3 f ( xn ) f ( x0 ) f ( xn ) f ( x0 ) + ... 12 720
1 h
xn
x0
f ( x ) dx =
f (x ) + 2
i i =0
n 1
f ( xn ) f ( x0 )
h h3 f ( xn ) f ( x0 ) + f ( xn ) f ( x0 ) ... 12 720
Hence, we obtain
xn
x0
x0+nh
f ( x ) dx =
x0
y dx
h y0 + 2 y1 + 2 y2 + ... + 2 yn 1 + yn 2
h2 h4 ( yn ( yn y0 ) + y0 ) + ... 12 720
...(5)
z
1 0
Solution
Taking
1 y = 1 + x , and n = 10
We have
x0 = 0, xn = 1, h = 0.1 y = 1 (1 + x ) 2 , y = 2 (1 + x ) 3 , y = 6 (1 + x ) 4
210
NUMERICAL ANALYSIS
z
1 0
LM FG N H ( 0.1) L 1 ( 1) M2 1 12 M N
2 2
IJ K
OP Q
4 4
z
1 0
...(2)
x=1
n ( n + 1) ( 2n + 1) 6
Solution We have
y0 + y1 + ... yn =
x
x =1 xn
1 = h
x0
z
e
f ( x ) dx +
1 1 ( yn + y0 ) + ( yn yn ) + ... 2 12
z
n 1
x 2dx +
1 2 1 (n + 1) + (2 n 2) 2 12
= =
1 2 1 1 ( n 1) + ( n2 + 1) + ( n 1) 3 2 6 1 2n3 2 + 3n2 + 3 + n 1 6
= Hence Proved.
2 n3 + 3n 2 + n 1 = n( n + 1) ( 2n + 1) 6 6
NUMERICAL INTEGRATION
211
Exercise 9.3
1. Evaluate
zz
2 2 1 1
zz
1 2 0 0 2
F I 2 xy GG dyJ dx H e1 + x j e1 + y j JK
2 2 1 2 2
3. 4.
F I G JJ dy using the Trapezoidal rule with two and four subintervals. dx Evaluate the double integral G GH e x + y j JK Using the table of values given below evaluate the integral of f (x, y) = e
zz
5 5 1 1
0 < x < 0.2, 0 < y < 0.2 (a) by the Trapezoidal rule with h = k = 0.1 (b) by Simpsons one-third rule with h = k = 0.1 yx 0 0.1 0.2 0.0 0.0 0.0 0.0 0.1 0.0998 0.1103 0.1219 0.2 0.1987 0.2196 0.2427
5. Integrate the following functions over the given domains by the Trapezoidal formula, using the indicated spacing. (a) f x , y = 1 xy ; 0 x 1, 0 y 1, with h = k = 0.5 (b ) with h = k =
3.2 3.6
b g f b x , y g = sin x cos y; 0 x 2
zz
2 1
1 dy dx. x+y
x =1
x3 =
n2 (n + 1)2 4
Answers
1. 0.340668 4. 0.004413 2. (i) 0.31233 (ii) 0.31772 5. (a) 0.8308 (b) 0.8988 3. n = 2, I = 4.134; n = 4, I = 3.997 6. 0.48997
212
NUMERICAL ANALYSIS
10
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
10.1 INTRODUCTION The most general form of an ordinary differential equation of nth order is given by
x, y,
FG H
dy d 2 y dny , 2 , L, n = 0 dx dx dx
IJ K
g
(1)
A general solution of an ordinary differential equation such as (1) is a relation between y, x and n arbitrary constants which satisfies the equation and it is of the form
f x , y , c1 , c2 , ..., cn = 0 .
(2)
If particular values are given to the constants c1, c2, , cn, then the resulting solution is called a Particular solution. To obtain a particular solution from the general solution given by (2), we must be given n conditions so that the constants can be determined. If all the n conditions are specified at the same value of x, then the problem is termed as initial value problem. Though there are many analytical methods for finding the solution of the equation form given by (1), there exist large number of ordinary differential equations, whose solution cannot be obtained by the known analytical methods. In such cases we use numerical methods to get an approximate solution of a given differential equation under the prescribed initial condition. In this chapter we restrict ourselves and develop the numerical methods for findings a solution of an ordinary differential equation of first order and first degree which is of the form
dy = f x, y , dx
a f
with the initial condition y(x0) = y0, which is called initial value problem. The general solutions of equation (3) will be obtained in two forms: (1) the values of y as a power series in independent variable x and (2) as a set of tabulated values of x and y. We shall now develop numerical methods for solution of the initial value problem of the form given by (3). We partition the interval [a, b] on which the solution is derived in finite number of subintervals by the points
212
213
The existence of uniqueness of the solution of an initial value problem in [x0, b] depends on the theorem due to Lipschitz, which states that: (1) If f (x, y) is a real function defined and continuous in [x0, b], y , + , where x0, and b are finite. (2) There exists a constant L > 0 called Lipschitzs constant such that for any two values y = y1 and y = y2
f ( x , y1 ) f ( x , y2 ) < L L1 L2
where x x 0 , b , then for any y(x0) = y0, the initial value problem (3), has unique solution for
x x0 , b .
Now we shall discuss the Taylors series method and the Eulers method.
a f
2
refer (3)
with y(x0) = y0. Expanding it by Taylors series about the point x0, we get
0 0
b x x g f b x g + b x x g f b x g + L, f a xf = f b x g + 1! 2!
0 0 0
y = f x = y0
Putting x = x1 = x0 + h, we get
f x1 = y1 = y0 +
af
b x x g y + b x x g +
0 0
1!
2!
+ L y0
b g
h h h2 y0 y0 + + 3 y0 + L 1! 2! 3!
(4)
Similarly we obtain
yn + 1 = y n + h h2 h yn yn yn + + + L 1! 2! 3!
(5)
214
NUMERICAL ANALYSIS
yn + 1 = yn +
h h2 yn yn + + O h 3 , 1! 2!
d i
(6)
where O(h3) means that all the succeeding terms containing the third and higher powers of h. If the terms containing the third and higher powers of h are neglected then the local truncation error in the solution is kh3 where k is a constant. For a better approximation terms containing higher powers of h are considered.
Note: Taylors series method is applicable only when the various derivatives of f(x, y) exist and the value of (x x0) in the expansion of y = f(x) near x0 must be very small so that the series converge. Example 10.1 Solve
dy = y = x + y y0 = 1 + 0 + 1, dx d2y = y = 1 + y y0 = 1 + 1 = 2, dx 2 d3y = y = y y0 = 2, dx 3
d4y = y v = y y0 v = 2, 4 dx
d5y = y v = y v y v 0 = 2, dx 5
M
Substituting the above values in
y1 = y0 +
we get
y1
h h2 h3 h4 v h5 v y0 y0 y0 y0 y0 + L + + + + 1! 2! 3! 4! 5!
2
.g b01 2+ 6
.g b01 2+ 24
.g b01 2+
120
2 +L
y1 = 011033847 .
y1 = y 01 . 0110 . .
Now we have
b g
y1 v = 2.21,
215
y1v = 2.21, M
Substituting the above values in (1), we get
y2 = 0.24205
y 0.2 = 0.242
dy = 1 + xy with the initial condition that y = 1, x = 0. Compute y (0.1) correct to four places dx of decimal by using Taylors series method. Example 10.2 Given Solution Given
b g
dy = 1 + xy and y (0) = 1, dx
y1 0 = 1 + 0 1 = 1.
Differentiating the given equation w.r.t. x, we get
bg
d2y dy =y+x , 2 dx dx
y0 = 1 + 0 1 = 1 + 0 = 1
similarly
d3y d2y dy x +2 , 3 = dx dx dx 2 y0 = 2,
and
y0 v = 3,
from Taylors series method, we have
y1 = 1 + hy0 +
h2 h3 h4 v y0 y0 y0 + + +L 2 3 24
2
. = 1 + 01 . 1 + y 01
. = 11053425
b g
.g b gb g b01 2
1+
.g b01 6
2+
.g b01 24
3+L
y 01 . = 11053 .
correct to four decimal places.
b g
216
NUMERICAL ANALYSIS
Example 10.3 Apply the Taylors series method to find the value of y (1.1) and y (1.2) correct to three decimal places given that dy = xy 3 , y( 1) = y(1) = 1 taking the first three terms of the Taylors series expansion. dx Solution Given
1 dy . = xy 3 , y0 = 1, x0 = 1, h = 01 dx 1
y0 . 3 = 1, = x 0 y 0 3 = 11
differentiating the given equation w.r.t. x we get
2 dy d2y 1 3 = xy + y3 2 dx 3 dx
1 xy 3
2 3
F xy I + y GH JK
1 3
1 3
1 2 3 x y + y3 3
y0 =
1 4 11 . +1= . 3 3
y1 = y0 = hy0 +
substituting the values in (7)
h2 y 2 . i 4 d01 = 11066 .
2
(7)
y1 = y 11 . = 1 + 01 . 1+
b g
b g
y1 11 . = 11066 . ,
x1 = x 0 + h = 1 + 0.1 = 11 .
b g
y1 = x1 y13
1
F GH
I . gb11066 . JK = b11 g
1
1 3
= 1138 . ,
y1 = =
1 2 3 x1 y1 + y13 3 1 2 . 11066 . 11 3
b gb
1 3
. + 11066
1 3
= 14249 . .
Substituting in
y2 = y1 + hy1 +
h2 y1 , 2 .g b01 2
2
we get
y2 = y 12 + 01 + . = 11066 . . 1138 .
b g
14249 .
217
b g
10.3 EULERS METHOD Consider the first order and first degree differential equation
dy = f x, y dx
b g
refer (3)
with the condition that y(x0) = y0. Suppose we want to find the approximate value of y say yn when x = xn. We divide the interval [x0, xn] into nsubintervals of equal length say h, with the division point x0, x1, , xn, where xr = x0 + rh, (r 1, 2, , n). Let us assume that
f x , y f x r 1 , yr 1
in [xr1, xr]. Integrating (3) in [xr1, xr], we get
xr
b g d
xr
xr 1
yr yr 1 =
z zb zb
dy =
xr 1 xr xr 1
f x , y dx
f x , y dx
y r y r 1 + f xr 1 , y r 1
d
d
xr
xr 1
dx
y r yr 1 + f xr 1 , y r 1
yr yr 1 + hf xr 1 , yr 1
Equation (8) is called Eulers iteration formula.
i dx i.
xr 1
i
(8)
y1 = y x1 = y0 + hf x0 , y0 y2
2 1 1
b g = yb x g = y
M
b g + hf b x , y g
1
yn = y xn = yn 1 + hf xn 1 , yn 1
b g
218
NUMERICAL ANALYSIS
Note: Eulers method has limited usage because of the large error that is accumulated as the process proceeds. The process is very slow and to obtain reasonable accuracy with Eulers method we have to take a smaller value of h. Further, the method should not be used for a larger range of x as the values found by this method go on becoming farther and farther away from the true values. To avoid this difficulty one can choose Eulers modified method to solve the equation (3).
10.4 MODIFIED EULERS METHOD From Eulers iteration formula we h known that
yr yr 1 + hf xr 1 , yr 1
(9)
0 can be calculated Let y(xr) = yr denote the initial value using (9) an approximate value of yr
as
xr ( 0) yr
= yr 1 +
xr 1
zb
d
d
f x , y dx
yr( 0) yr 1 + hf xr 1 , yr 1
(10)
replacing f (x, y) by f (xr1, yr1) in xr1 x < xr using Trapezoidal rule in [xr1, rx], we can write
( 0) yr = yr 1 +
h f x r 1 , yr 1 + f xr , yr . 2
Replacing f (xr, yr) by its approximate value f xr , yr( 0) [xr1, xr], we get
(1) = yr 1 + yr
h ( 0) f xr 1 , y r 1 + f xr , y r , 2
i d
(1) where yr is the first approximation to yr = y(xr) proceeding as above we get the iteration formula
(n) = yr 1 + yr
h ( n 1 f x r 1 , yr 1 + f xr , yr , 2
i d
(11)
we have
(n) = yr 1 + yr y r
h f xr 1 , yr 1 + f xr , yr( n 1 . 2
i d
dy = 1 y, with the initial condition x = 0, y = 0, using Eulers algorithm and dx tabulate the solutions at x = 0.1, 0.2, 0.3.
Example 10.4 Solve the equation
219
Solution Given
f x, y = 1 y
we have
b g
Taking n = 0 in we get
yn + 1 = y n + hf xn , yn
y1 = y0
b g + hf b x , y g
0 0
= 0 + 01 . 1 0 = 01 .
b gb
y2 = y1 + hf x1 , y1
y2 = 01 . + 01 . 1 y1
y2
y3 y3
b gb g . = 01 . + b01 . gb1 01 . g = 019 = yb0.2g = 019 . , = y + hf b x , y g = 019 . + b01 . gb1 019 . g . + b01 . gb1 y g = 019 = 019 . + b01 . gb0.81g = 0.271
2 2 2 2
y3 = y ( 0. 3) = 0. 271. x 0 0.1 0.2 0.3 Solution by Eulers method 0 0.1 0.19 0.271
dy = x3 + y , dx
with the initial condition y(0) = 1.
220
NUMERICAL ANALYSIS
We have
f x, y = x 3 + y
x 0 = 0, y0 = 1, h = 0.01 x1 = x0 + h = 0 + 0.01 = 0.01 ,
b g
x2 + x0 + 2h = 0 + 2 0.01 = 0.02 .
Applying Eulers formula we get
b g
b g y = 1 + b0.01g d x + y i = 1 + b0.01g d0 + 1i = 101 . y = yb0.01g = 101 . , y = y + hf b x , y g . + b0.01g x + y = 101 . + b0.01g b0.01g + 101 . = 10201 . = 101 y = yb0.02g = 10201 . .
y1 = y0 + hf x0 , y0
1 3 0 3 0 1 2 1 1 1 3 1 1 3 2
Example 10.6 Solve by Eulers method the following differential equation x = 0.1 correct to four decimal places
dy y x = dx y + x f x, y =
b g
yx , y+x
the initial condition is y(0) = 1. Taking h = 0.02, we get x1 = 0.02, x2 = 0.04, x3 = 0.06, x4 = 0.08, x5 = 0.1. Using Eulers formula we get
y1 = y 0.02 = y0 + hf x0 , y0
b g
221
= y0 + h
y 0.02 = 10200 . ,
y2 = y 0.04 = y1 + hf x1 , y1
b g
FG y Hy
0 0
x0 + x0
IJ K
= 1 + 0.02
0I b g FGH 1 J 1 + 0K
= 10200 .
b g
= y1 + h
FG y Hy
1 1
x1 + x1
IJ K
= 1.0200 + 0.02
y2 = y 0.04 = 10392 . ,
y3 = y 0.06 = y2 + h
b g
= 10392 .
b g
FG y Hy
2 2
x2 + x2
IJ K
= 1.0392 + 0.02
y3 = y 0.06 = 10577 . ,
y4 = y 0.08 = y3 + hf x3 , y3
b g
b g
= y3 + h
FG y Hy
3 3
x3 + x3
IJ K
= 1.0577 + 0.02
y4 = y 0.08 = 10756 . ,
y5
4
y 01 . = 10928 . .
Example 10.7 Solve the Eulers modified method the following differential equation for x = 0.02 by taking h = 0.01 given
b g
= 10756 .
= 10928 .
dy = x 2 + y, y = 1, when x = 0. dx
Here we have
Solution
f x, y = x 2 + y
b g
222
NUMERICAL ANALYSIS
h = 0.01, x0 = 0 , y0 = y 0 = 1
x1 = 0.01, x2 = 0.02
we get
( 0) y1 = y0 + hf x0 , y0
bg
2 = 1 + 0.01 x0 + y0
b gd
g
i
. = 1 + 0.01 0 2 + 1 = 101
b gd
i
( 0) . . y1 = 101
h ( 0) f x0 , y0 + f x1 , y1 2
g d
=1+
b g
= 101005 .
(1) y1 = 101005 . ,
(2) y1 = y0 +
h (1) f x 0 , y0 + f x1 , y1 2
g d
i
= 101005 .
=1+
b g
2 . = 101005 + 0.01 x1 + y1
b gd
b g eb g
. + 101005
= 102015 . ,
b g b g d
g b g b
= 1020204 . ,
(2) y2 = y1 +
h (1) f x1 , y1 + f x2 , y2 2
i
. g b g + b1020204 g
2
= 1.01 +
b g b
y2 = 1.020204
y2 = y 0.02 = 1020204 . .
b g
223
Exercise 10.1
1. Given
1 dy = , y (4) = 4 find y(4.2) by Taylors series method, taking h = 0.1. dx x 2 + y dy = x + y 2 , y 0 = 1 find y(0.2). dx
bg
4. Apply Taylors algorithm to y1 = x2 + y2, y(0) = 1. Take h = 0.5 and determine approximations to y(0.5). Carry the calculations up to 3 decimals. 5. Find y(1) by Eulers method from the differential equation to four decimal places taking step length h = 0.1. 6. Find y(4.4), by Eulers modified method taking h = 0.2 from the differential equation when x = 4. 7. Given 8. Given 9. Given
dy y , when y (0.3) = 2. Convert up = dx 1+x
dy 2 y 2 = , y =1 dx 5x
dy = x 2 + y , with y(0) = 1, evaluate y(0.02), y(0.04) by Eulers method. dx dy = y x , where y(0) = 2, find y(0.1) and y(0.2) by Eulers method up to two decimal places. dx
yx dy = , with boundary condition y(0) = 1, find approximately y for x = 0.1, by Eulers dx 1+x method (five steps). dy = x 2 + y , y = 0.94 , when x = 0. dx
10. Use modified Eulers method with one step to find the value of y at x = 0.1 to five significant figures, where
11. Solve y = x y2, by Eulers method for x = 0.2 to 0.6 with h = 0.2 initially x = 0, y = 1. 12. Solve the differential equation
dy = 2 y + 3e x dx
with x0 = 0, y0 = 0, using Taylors series method to obtain and check the value of y for x = 0.1, 0.2. 13. Solve y1 = y sin x + cos x, subject to x = 0, y = 0 by Taylors series method. 14. Using Eulers modified method, solve numerically the equation
dy = x+ dx
with boundary condition y = 1 at x = 0 for the range 0 < x < 0.4 in steps of 0.2. 15. Solve
dy = 1 y with y = 0 when x = 0 in the range 0 < x < 0.2 by taking h = 0.1 (apply Eulers modified dx formula).
224
NUMERICAL ANALYSIS
Answers
1. 4.0098 4. 1.052 7. 1.0202, 1.0408, 1.0619 10. 1.039474 12.
x 0.1 0.2 Calculated values of y 0.3488 0.8112 Exact values 0.3486 0.8112
13. 14.
y=x+
1 3 1 5 x + x +L 6 120
x 0.0 0.2 0.4 y 1 1.2309 1.5253
15.
x 0.0 0.1 0.2 y 0.0000 0.09524 0.1814076
10.5 PREDICTORCORRECTOR METHODS Predictorcorrector formulae are easily derived but require the previous evaluation of y and y1 = f (x, y) at a certain number of evenly spaced pivotal point (discrete points of xi of x-axis) in the neighbourhood of x0. In general the Predictorcorrector methods are the methods which require the values of y at xn, xn1, xn2, for computing the value of y at xn+1. A Predictor formula is used to predict the value of yn+1. Now we discuss Milnes method and AdamsBashforthMoulton methods which are known as Predictorcorrector methods. 10.6 MILNES METHOD This method is a simple and reasonable accurate method of solving the ordinary first order differential equation numerically. To solve the differential equation
dy = y = f x, y , dx
b g
225
by this method we first obtain the approximate value of yn+1 by predictor formula and then improve the value of yn+1 by means of a corrector formula. Both these formulas can be derived from the Newton forward interpolation formula as follows: From Newtons formula, we have
f x = f x0 + uh = f x0 + uf x0 +
bg b
g b g
bu 1g f b xg + u bu 1gbu 2g f x + L b g u1 b g 2 1 2 3
2 3 0
(14) where u =
x x0 , or x = x0 + uh. h
bg
b g
1 2 3
1 2 3 4
x0
y dx = h
y x 0 + 4 h y x0 = h 4 y 0 + y0 +
LM N
20 2 8 28 4 y0 + 3 y0 + y0 3 3 90
OP Q
LM N
8 14 4 3 20 2 y0 E 1 y0 E 1 y0 + + 3 45 3 4h 14 4 y0 y2 + 2 y3 + . 2 y1 3 45
OP Q
(16)
y4 y0 =
This is known as Milnes predictor formula. The corrector formula is obtained by integrating (15) from x0 to x0 + 2h, i.e., from u = 0 to u = z
x0 + 2 h
x0
y dx = h
z FGH
2 0
I I + u y0 + y0
u u1 2
g y
2
I 0
+ ... du
I JK
226
NUMERICAL ANALYSIS
y2 y0 = h 2 y0 + 2 y0 +
LM N
1 2 1 4 y0 y0 3 90
OP Q
(17)
Expression (17) is called Milnes corrector formula. The general forms of Equations (16) and (17) are
yn + 1 = yn 3 + 4h 2 + yn 1 + 2 yn , 2 yn 3 h yn 1 + 4 yn + yn +1 , 3
y n + 1 = yn 1 + y n + 1 yn 3 =
4h 2 + yn 1 + 2 yn , 2 yn 3 h yn 1 + 4 yn + yn +1 . 3
yn + 1 = yn 1 +
yn +1 = yn 3 +
the corrector formula is
yn + 1 = yn 1 +
4h 2 f n 2 f n 1 + 2 f n , 3
(22)
h f n 1 + 4 f n + f n +1 . 3
Note: In deriving the formula we have considered the differences up to third order because we fit up with a polynomial of degree four. To solve the first order differential equation, we first find the three consecutive values of y and x in addition to the initial values and then we find the next value of y by (18) or (22). The value of y thus obtained is then substituted in y = f x , y
value of the new y. If the corrected value of y agrees closely with the predicted value then we proceed to the next interval and if the corrected value of y differs with the predicted value, we then compute the value of
If the value of is very small we proceed to the next interval otherwise value of is made small.
dy 1 = ( 1 + x 2 )y 2 and y(0) = 1, y(0.1) = 1.06, y(0.2) = 1.12, y(0.3) = 1.21. Evaluate y(0.4) dx 2 by Milnes PredictorCorrector method.
Example 10.8 Given Solution Milnes predictor formula is
yn +1 = yn 3 +
4h ( 2 yn 2 yn 1 + 2 yn ). 3
227
y4 = y0 +
We have The given differential equation is
4h 2 y1 y2 + 2 y3 . 3
(23)
y = y1 =
1 1 + x2 y2 2 1 1 2 2 2 y1 = 1 + x1 1 + 0.1 2 2
2
b g 1 1 O . g y = d1 + x i y = L Ne1 + b0.2g jPQ b112 2 2M . g = 0.6522 , = 0.52 b112 1 1 O . g y = d1 + x i y = L Ne1 + b0.3g jPQ b121 2 2M = 0.545 b121 . g = 0.7980 .
= 0.5674, = 0.505 106 .
2 2 2 2 2
3 2
2 3
y4 = 1 +
4 01 . 3
= 127715 . = 12772 .
(correct to 4 decimal places).
We get
y4 =
= 0.9458 .
yn + 1 = yn 1 +
putting n = 3 in (25) we get
h yn 1 + 4 yn + yn +1 , 3
(25)
y4 = y2 +
. + = 112
= 12797 .
(correct to 4 decimal places)
y 0.4 = 12797 . .
b g
228
NUMERICAL ANALYSIS
dy = x + y with initial conditions x0 = 0, y0 dx = 1, from x = 0.20 to x = 0.30 with y1 = 1.1026, y2 = 1.2104, y3 = 1.3237.
Example 10.9 Tabulate by Milnes method the numerical solution of Solution Here y1 = x + y
y = 1 + y , y = y , y = y v , y v = y v , ...
Hence
y0 = x0 + y0 = 0 + 1 = 1 y0 = 1 + y0 =1+1= 2 y0 = y0 = 2
v y0 =2 v = 2 , y0
Now taking h = 0.05, we get x4 = 0.20, x5 = 0.25, x6 = 0.30 and y1 = 11026 . , y2 = 12104 . , y3 = 13237 . . Using Milnes predictor formula we get
y4 = y0 +
=1+
4 0.05 3
4h 2 y1 y2 + 2 y3 3
= 12428 .
y4 = y2 +
. = 11104 +
which is the same as the predicted value,
= 12428 .
y4 = y0.20 = 12428 .
and
y4 . . = 14428
Again putting n = 4, h = 0.05 we get
y 5 = y1 +
4h 2 y2 y3 + 2 y4 3
. = 10526 +
4 0.05 3
= 13181 .
y5 = 15681 . . . = x5 + y5 = 0.25 + 13181
Using Milnes corrector formula we get
y5 = y3 +
h y3 + 4 y4 + y5 3
. y5 = 11737 +
229
y6 = y2 +
4h 2 y3 y4 + 2 y5 3
. = 11104 + y6 . = 13997
4 0.05 3
y6 = y4 +
h y4 + 4 y5 + y6 3
. = 12428 +
= 13997 .
which is same as the predicted value
y6 = y0.30 = 1.3997
and x 0.20 0.25 0.30
y6 = 1.6997 .
y 1.2428 1.3181 1.3997
y
1.4428 1.5681 1.6997
Example 10.10 Part of a numerical solution of difference equation dy = 0.2x = 0.1y dx is shown in the following table. x y 0.00 2.0000 0.05 2.0103 0.10 2.0211 0.15 2.0323
use Milnes method to find the next entry in the table. Solution We have x0= 0.00, x1 = 0.05, x2 = 0.10, x3 = 0.15, x4 = 0.20, and u = 0.05 The corresponding values of y are y0 = 2, y1 = 2.0103, y2 = 2.0211, y3 = 2.0323 and y4 = ?
1 = 0.2x1 + 0.1y1 = 0.2 0.05 + 0.1 2.0103 y1
= 0.21103
230
NUMERICAL ANALYSIS
4h 2 y 1 y 2 2 y 3 4
= 2.0 + = 2.0 +
= 2.044427
y1 4
= 0.2 x 4 + 0.1y4
= 0.2 0.2 + 0.1 2.044427 = 0.2444427
= 2.0211 +
10.7 ADAMSBASHFORTHMOULTON METHOD We give below another Predictorcorrector method known as the AdamsBashforthMoulton method. This method is a multistep method based on the fundamental theorem of calculus.
y x k +1 = y x k +
b g b g
g
x k +1
xk
where y1 = f x, y is given with boundary condition y = y0 at x = x0. The predictor uses the Lagranges polynomial approximation for f ( x , y ( x )) based on the points
a f
zb
f x, y x dx
a fg
id
dx
k 3,
yk 3 ,
231
dx
x+k ,
yk + 1 = x k + 1 , f x k + 1 yk + 1 .
i e
d i
id
dy = x 2 + x 2 y, y(1) = 1 at x = 1(0.1) 1.3, by any dx numerical method you know and at x = 1.4 by AdamsBashforth method.
Example 10.11 Obtain the solution of the initial value problem Solution The given differential equation is
dy = x2 + x2y = x2 1 + y dx
y = x 2 (1 + y)
and we have x0 = 1 y0 = 1. Computing the values of y(1.1), y(1.2), y(1.3) by Taylors algorithm we get y (1.1) = y1 = 1. 233, y2 = 1.548488, y3 = 1. 9789 and
y 4 = y3 +
h 59 y2 + 37 y1 9 y0 55 y3 24
= 1.9789 +
= 2.5762
a0.1f
24
2 y4 1 + y4 = x4
2 x4 1 + y 4 = 1.4
a f a3.5726f = 7.004 .
2
y 4 = y3 +
a f
24
= 1.9789 +
y 14 . = 2.5751.
b g
232
NUMERICAL ANALYSIS
Exercise 10.2
1. Solve numerically the equation y = x + y with the initial conditions x0 = 0, y0 = 1 by Milnes method from (1) x = 0, x = 0.4. 2. Solve the differential equation y = x3 y2 2 using Milnes method for x = 0.3 (0.1) (0.6). Initial value x = 0, y = 1. The values of y for x = 0.1, 0.1, and 0.2 are two be computed by series expansion. 3. Solve the differential equation y = x2 + y2 2 using Milnes predictor-corrector method for x = 0.3 given the initial value x = 0, y = 1. The values of y for x = 0.1, 0.1 and 0.2 should be computed by Taylors expansion. 4. Use Milnes method to solve
dy = y + x , with initial condition y(0) = 1, from x = 0.20 to x = 0.30. dx
5. Solve numerically at x = 0.4, 0.5 by Milnes predictor-corrector method given their values at the four points x = 0, 0.1, 0.2, 0.3,
dy = 2e x y , given y0 = 2, y1 = 2.010, y2 = 2.040, y3 = 2.09. dx
dy 1 = ( x + y) dx 2
assuming y(0) = 2, y(0.5) = 2.636. y(1.0) = 3.595 and y(1.5) = 4.968. 8. Given y1 = 2 xy 2 and y(0) = 10. Show by Milnes method, that y(1) = 1.6505 taking h = 0.2. 9. Solve y1 = y with y(0) = 1 by using Milnes method from x = 0.5 to x = 0.8 with h = 0.1 10. Solve the initial value problem
dy = x y 2 , y(0) = 1 to find y(0.4) by Adams method. With y(0.1) = dx 0.9117, y(0.2) = 0.8494, y(0.3) = 0.8061.
11. Using AdamsBashforth formula, determine y(0.4) given the differential equation data x y 0 1 0.1 1.0025 0.2 1.0101 0.3 1.0228
12. Using Adams-Bashforth formula, determine y (0.4) given the differential equation data x y 0 1 0.1 1.0025 0.2 1.0101 0.3 1.0228
dy 1 = xy and the dx 2
233
determine y(1.1) by Adams-Bashforth formula. 14. Using Adams-Bashforth method, obtain the solution of x y 9 0 0.2 0.0200 0.4 0.0795
dy = x y 2 at x = 0.8, given dx
0.6 0.1762
Answers
1. 2.
x y 0.3 0.061493 0.4 0.45625 0.5 0.29078 0.6 0.12566
y4 = 1.583627, = 1.5703
9. y(0.5) = 0.6065, y(0.6) = 0.5490, y(0.7) = 0.4965, y(0.8) = 4495 10. y(0.4) = 0.7785 11. 1.1749
10.8 RUNGE-KUTTA METHOD The method is very simple. It is named after two German mathematicians Carl Runge (18561927) and Wilhelm Kutta (18671944). It was developed to avoid the computation of higher order derivations which the Taylors method may involve. In the place of these derivatives extra values of the given function f(x, y) are used. The Runge-Kutta formulas for several types of differential equations are given below.
Fourthorder Runge-Kutta Method: Let
dy = f x, y dx represent any first order differential equation and let h denote the step length. If x0, y0 denote the initial values, then the first increment y in y is computed from the formulae
k1 = h f x 0 , y0 , k2
0
a f
b g F h = h f Gx + , y H 2
k1 , 2
IJ K
234
NUMERICAL ANALYSIS
FG h , y + k IJ , H 2 2K k = h f b x + h, y + k g, 1 y = bk + 2 k + 2 k + k g . 6
k3 = h f x0 +
4 0
x1 = x 0 + h, y1 = y0 + y .
Similarly the increments for the other intervals are computed. It will be noted that if f(x, y) is independent of y then the method reduces to Simpsons formula. Though approximately the same as Taylors polynomial of degree four. Runge-Kutta formulae do not require prior calculations of higher derivatives of y(x), as the Taylors method does. These formulae involve computation of f (x, y) of various position. This method known as Runge-Kutta fourth order method is very popular and extensively used but the errors in method are not easy to watch. The error in the Runge-Kutta method is of the order h5. Runge-Kutta methods agree with Taylors series solution up to the term hm where m differs from the method and is called the order of that method. First order Runge-Kutta method: Consider the first order equation
dy = f x , y , y x 0 = y0 L dx
a f b g
b
(1)
y1 = y0 + h f x 0 , y0 = y0 + hy0 L
(2)
h2 y0 + L 2
(3)
Comparing (2) and (3), it follows that, Eulers method agrees with Taylors series solution up to the term in h. Hence Eulers method is the Runge-Kutta method of the first order. Second order Runge-Kutta method: The modified Eulers method gives
y1 = y0 + h f x0 , y0 + f x0 + h, y1 2 h f 0 + f x0 + h, y 0 + h f 0 2 h2 h3 y0 y0 + + L 2! 3!
g b
(4)
= y0 +
(5)
(6)
235
Expanding f (x0 + h, y0 + h f0) by Taylors series for a function of the variables, we obtain f (x0 + h, y0 + h f0) = f x0 , y0 + h
fI g FGH J x K
+ h f0
0
FG f IJ H y K
FG f IJ H x K
+ h f0
0
FG f IJ H y K
+ O h2
0
d i
+ f0
0
LM MN
LMFG f IJ MNH x K
FG f IJ OP + O dh iOP H y K PQ PQ
3 0
= y0 + hf 0 +
h2 f 0 + O h 3 2
d i b gOPQ
LMQ N
= y0 + hy0 +
f f df = + f where f = f x , y y dx x
h2 y0 + O h 3 . 2!
d i
(7)
Comparing (6) and (7), it follows that the modified Eulers method agrees with Taylors series solution up to the term in h2. Hence the modified Eulers method is the Runge-Kutta method of second order. The second order Runge-Kutta formula is as follows:
k1 = h f xn , yn k2
n
b g = h f b x + h, y
1 k1 + k 2 2
0
+ k1
yn + 1 = yn + yn
where which gives
yn =
k1 k2
and
y1
g = h f bx , y g = h f b x + h, y + k g 1 = y + bk + k g = y 2
0 0 0 1 0 1 2
+ y0 .
236
NUMERICAL ANALYSIS
Third order Runge-Kutta method This method agrees with Taylors series solution up to the term in h3. The formula is as follows:
y1 = y0 + 1 k1 + 4 k 2 + k 3 6
where
b g k I F h k = h f Gx + , y + J H 2 2K k = h f b x + h, y + 2 k k g
k1 = h f x0 , y0
2 0 1 0 3 0 0 2 1
yn +1 = yn + y
where
and
b g 1 I F 1 k = hf G x + h , y + k J H 2 2 K k = hf b x + h , y + 2 k k g 1 y = b k + 4 k + k g 6
k1 = h f xn + yn
2 n n 1
3 n n 2 1
Runge-Kutta methods are one-step methods and are widely used. Fourth order R-K method is most commonly used and is known as Runge-Kutta method only. We can increase the accuracy of Runge-Kutta method by taking higher order terms.
Example 10.12 Use RungeKutta method to approximate y when x = 0.1, given that y = 1, when
x = 0 and
Solution We have
dy = x + y. dx
x0 = 0, y0 = 1
we get
b g f bx , y g = x
0 0
f x , y = x + y , and h = 01 ..
0
+ y0 = 0 + 1 = 1,
k1 = h f x0 , y0
k 2 = h f x0 +
FG h , y + k IJ = b01 . g c f b0 + 0.05g, 1 + 0.05h H 2 2K . , = b01 . g f b0.05, 105 . g = b01 . gb0.05 + 105 . g = 011
1 0
= 01 . 1 = 01 . ,
237
k 3 = h f x0 +
k4
FG h , y + k IJ H 2 2K = b01 . g c f b0 + 0.05g, 1 + 0.055h = b01 . gb0.05 + 1055 . g = b01 . , . gb1105 . g = 01105 = f bx + h , y + k g = b01 . g f b0 + 0.01, 1 + 01105 . . g f b01 . , 11105 . g = b01 g = b01 . , . gb12105 . g = 012105
2 0
y = =
We get
1 k1 + 2 k 2 + 2 k 3 + k 4 6
g g
= 011034 . .
x1 = x0 + h = 0 + 01 . = 01 .
. . y1 = y0 + y = 1 + 0.11034 = 111034
Example 10.13 Using RungeKutta method, find an approximate value of y for x = 0.2, if y = 1 when x = 0. Solution Taking step-length h = 0.1, we have
dy = x + y 2 , gives that dx
x 0 = 0, y 0 = 1,
Now
dy = f x, y = x + y 2 . dx
b g
1
k1 = h f x0 , y0 = 01 . 0 + 1 01 . ,
k2
k3
k4
b g b gb g k I F h = h f G x + , y + J = b01 . gb0.05 + 11025 . g H 2 2K = b01 . , . gb11525 . g = 011525 k I F h = h f G x + , y + J = b01 . gb0.05 + 11185 . g H 2 2K = b01 . , . gb11685 . g = 011685 = h f bx + h , y + k g . gb13474 . . , = b01 . gb0.01 + 12474 . g = 013474 g = b01
0 0 2 0 0
y =
1 k1 + 2 k 2 + 2 k 3 + k 4 6
238
NUMERICAL ANALYSIS
= =
We get
g b
y 01 . = 11165 . .
For the second step, we have
b g
y1 = y0 + y = 1 + 01165 .
x0 = 01 . , y0 = 11165 . ,
b gb g . , k = b01 . gb015 . + 14014 . . gb15514 . g = b01 g = 01551 . , k = b01 . gb015 . + 14259 . . gb15759 . g = b01 g = 01576 . , k = b01 . gb0.2 + 16233 . . gb18233 . g = b01 g = 01823 1 y = b 0.9424 g = 0.1571 , 6 yb0.2g = 11165 + 01571 = 12736 . . . yb01 and yb0.2g = 12736 . g = 11165 . . .
k1 = 01 = 01347 . 01 . + 12466 . . ,
2 3 4
Example 10.14
Using Runge-Kutta method of order 4, find y for x = 0.1, 0.2, 0.3, given that
dy = xy + y 2 , y(0 ) = 1. . Continue the solution at x = 0.4 using Milnes method. dx Solution. We have f(x, y) = xy + y2 x0 = 0, y0 = 1 x1 = 0.1, x2 = 0.2, x3 = 0.3, x4 = 0.4, and h = 0.1 To find y1 = y (0.1): k 1 = hf (x0, y0) = (0.1) (0 1 + 12) = 0.1000 k 2 = hf
FG x H
k h , y0 + 1 2 2
IJ K
FG H
IJ K
239
k 1 = hf (x1, y1) = (0.1) f (1, 1.1169) = 0.1359 k 2 = hf x1 + = 0.1581 k 3 = hf x1 + = 0.1609 k 4 = hf ( x1 + h, y1 + k3 ) = ( 0.1) f ( 0. 2, 1. 2778) = 0.1888 k = 1 k1 + 2 k2 + 2 k3 + k4 6 1 0.1359 + 2 0.1581 + 2 0.1609 + 0.1888 = 6 = 0.1605
FG H
IJ K
FG H
k h , y1 + 2 2 2
IJ = (0.1) f (0.15,1.0959) K
b b
y2 = y(0.2) = y1 + k = 1.1169 + 0.1605 = 1.2774 To find y3 = y(0.3) Here we have k 1 = hf (x2, y2) = (0.1) f (0.2, 1.2774) = 0.1887 k 2 = hf x2 + = 0.2224 k 3 = hf x2 + = 0.2275
FG H
FG H
IJ K
k h , y2 + 2 = (0.1) f ( 0. 25,1.3885) 2 2
IJ K
1 k1 + 2 k2 + 2 k3 + k4 6
g g
= 0.2267
240
NUMERICAL ANALYSIS
we have
y3 = y(0.3) = y2 + k = 1.2774 + 0.2267 = 1.5041 x0 = 0.0, x1 = 0.1, x2 = 0.2, x3 = 0.3, x4 = 0.4 y0 = 1, y1 = 1.1169, y2 = 1.2774, y3 = 1.5041 y0 = 1.000, y1 = 1.3591, y2 = 1.8869, y3 = 2.7132
4h 2 y 1 y 2 2 y 3 3
Exercise 10.3
1. Solve the equation dy = x y 2 , y 0 = 1 for x = 0.2 and x = 0.4 to 3 decimal places by Runge-Kutta dx fourth order method. 2. Use the Runge-Kutta method to approximate y at x = 0.1 and x = 0.2 for the equation 3. For the equation
bg
dy = x + y , y 0 = 1. dx
bg
bg
4. Use Runge-Kutta method to solve y = xy for x = 1.4, initially x = 1, y = 2 (by taking step-length h = 0.2). 5.
dy y 2 2 x , use RungeKutta method to find y at x = 0.1, 0.2, 0.3 and 0.4, given that y = 1 when = 2 dx y +x x = 0.
6. Use Runge-Kutta method to obtain y when x = 1.1 given that y = 1.2 when x = 1 and y satisfies the equation
dy = 3x + y 2 . dx
dy 1 = for x = 2.0 by using Runge-Kutta method. Initial values dx x + y
241
8. Use Runge-Kutta method to calculate the value of y at x = 0.1, to five decimal places after a single step of 0.1, if
dy = 0. 31 + 0.25 y + 0.3x 2 dx
and y = 0.72 when x = 0 9. Using Runge-Kutta method of fourth order solve
dy y2 x2 , with y(0) = 1 at x = 0.2, 0.4. = 2 dx y + x2
10. Using Runge-Kutta method of order, 4 compute y(0.2) and y(0.4) from 10 x = 0.1.
dy = x 2 + y 2 , y (0) = 1, taking dx
11. Find by Runge-Kutta method an approximate value of y for x = 0.8, given that y = 0.41 when x = 0.4 and
dy = dx
12. The unique solution of the problem
x + y.
dy = xy, y 0 = 1 dx
is y = e x
2
bg
/3
Answers
1. 0851, 0.780 3.
x 0.1 0.2 0.4 h 0.1 0.2 0.4 y 1.0665242 1.1672208 1.4782
2. 1.1103, 1.2428
0.5 1.3571
1.0 1.5837
1.5 1.7555
2.0 1.8957
242
NUMERICAL ANALYSIS
b g
x0
y y0 =
z zb zb
x x
dy =
f x , y dx
x0 x
f x , y dx
x0
y = y0 +
x0
zb
x x
f x , y dx ,
(26)
satisfying the initial condition y(x0) = y0. Equation (26) is known as an integral equation, because the dependent variable y in the function f(x, y) on the right hand side occurs under the sign of integration. The first approximation y1 of y is obtained by replacing y by y0 in f (x, y0) in equation (26). This gives
y1 = y0 +
x0
zb
x x0
f x , y0 dx .
(27)
The value of y1 obtained from equation (27) is substituted for y in the integral equation (26) to get second approximation y2, such that
y 2 = y0 +
zb
x x
f x , y1 dx .
(28)
y 3 = y0 +
M
x0
yn = y0 +
x0
zb zd
f x , y2 dx
f x , yn 1 dx .
The process of iteration is stopped when the values of yn 1 and yn are approximately the same.
Example 10.14 Solve
bg
x0 = 0, y0 = 0, f x , y = 1 + y 2 .
b g
243
yn = y 0 +
x0
yn =
z
x 0
zd
x
f x , yn 1 dx ,
2 1 + yn 1 dx ,
yn = x +
z
x 0 x 0 x
2 yn 1 dx .
y1 = x +
y2 = x +
y3 = x +
y3 = x +
z z z z FGH
0
2 y0 dx = x +
2 y1 dx = x +
2 y2 dx = x +
zb g z z FGH
x 0 x 0
0 dx = x , x3 , 3
x 2 dx = x +
x+
x3 3
I JK
dx ,
x2 +
x6 2x4 dx + 3 9
I JK
y3 = x +
x3 2x5 x7 . + + 3 15 63
The solution can successively be improved further. Example 10.15 Use Picards method to approximate y when x = 0.1, x = 0.2, for x = 0. Solution The first approximation be y1
dy = x + y 2 , where y = 0, when dx
y1 = 0 +
the second approximation be y2. Then
zb
x 0
x + 0 dx =
x2 , 2
y2 = 0 +
the third approximation be y3. Then
z
x 0
FG x + x IJ dx = x H 4K 2
4 x
1 5 x , 20
y3 = 0 +
z
0
LMx + F x MN GH 2
1 5 x 20
IJ K
OP dx PQ
244
NUMERICAL ANALYSIS
z
x 0
FG x + x H 4
1 10 1 7 x + x dx 400 20
IJ K
= =
For x = 0.1
y2 = y3 =
0.01 0.00001 + = 0.005 + 0.0000005 = 0.00500, 2 20 0.01 0.00001 0.00000001 + + + L = 0.00500 . 2 20 160
y1 = 0.005 +
0.1
Lx = 0.005M N2
For x = 0.2
za
x
x + 0.000025 dx
x
O + 0.000025P Q
0.1
1 2 25 x + 6 x. 2 10
y1 =
y2 = 0.005 +
0.1
Lx = 0.005 + M N2
For x = 0.2
za
x
x + 0.0004 dx
2
O + 0.0004 x P Q
=
0.1
x2 4 4 + 4 x 5. 2 10 10
dy dx
245
dy = x y , with the condition y = 1 when x = 0, use Picards method dx to obtain y for x = 0.2 correct to five decimal places.
Example 10.16 Given the differential equation Solution Here f(x, y) = x y, x0 = 0, y0 = 1. The successive approximations are given by
y1 = 1 +
y2 = 1 +
y3 = 1 +
z z FGH z FGH
x 0 x 0
x 0
a x 1f dx = 1 x + x2 ,
2
x 1+ x
x2 2
x 1 + x x2
IJ dx = 1 x + x x , 6 K x I x + 6J K dx = 1 x + x 3
3 2
3 2
x4 , 24
y4 = 1 + x 2 x y5 = 1 x + x 2
x3 x4 x5 + , 3 12 120 x3 x4 x5 x6 + + . 3 12 60 720
When x = 0.2, the successive approximation of y are given by y0 = 1, y1 = 0.82, y2 = 0.83867, y3 = 0.43740, y4 = 0.83746, y5 = 0.83746
dy = y, y(0) = 1 by Picards method and compare the solution with the exact solution. dx
Solution We have f(x, y) = y, x0 = 0, y0 = 1, Picards formula takes the form yn = 1 + Therefore taking n = 1, 2, 3, , we get
z
x 0
yn 1 dx , n = 1, 2, 3, ...
y1 = 1 +
y2 = 1 +
y2
y3
y4
z z
x 0 x 0
y0 dx = 1 +
y1dx = 1 +
za f za
x 0 x 0 2
1 dx = 1 + x,
1 + x dx,
z z
x 0 x 0
246
NUMERICAL ANALYSIS
y4 = 1 + x +
x2 x3 x4 + + +L 2! 3! 4!
(29)
= ce x
(30)
(31)
The Picard solution is given by (29) is the same as the first five terms of (31).
Exercise 10.4
1. Solve
dy = 1 + xy, given that the integral curve passes through the point (0,1) tabulate the values dx of y is 0(0.1) 0.5. dy = x + y 2 , x = 0, y = 1. dx d2y dy x3 + x3 y = 0 2 dx dx
2. Solve
3. Use Picards method, to obtain the second approximation to the solution of given that y = 1, 4. Solve
dy 1 = at x = 0. dx 2
dy y x = , y (0) = 1 . dx y + x
6. Obtain Picards Second approximate solution of the initial value problem
y = x2 ; y ( 0) = 0 y2 + 1
247
Answers
1.
y3 = 1 + x + y2 = 1 + x +
x2 x3 x4 x5 x6 + + + + +L 2 3 8 15 48 3x 2 2x3 x4 x5 + + + +. 2 3 4 20
2.
3.
y2 = 1 +
x 3x 5 + +L 2 40
1 3 1 9 x x + ... 3 8
248
NUMERICAL ANALYSIS
11
SOLUTION OF LINEAR EQUATIONS
11.1 MATRIX INVERSION METHOD System of linear equations arise frequently and if n equations in n unknowns are given, we write
a11 x1 + a12 x2 + ... a1n xn a21 x1 + a22 x2 + ... + a2 n xn a31 x1 + a32 x2 + ... + a3n xn M an1 x1 + an 2 x2 + ... + ann xn = b1 = b2 = b3
n
U | | V | =b | W
OP PP PQ
(1)
The set of numbers x1, x2, x3, xn which reduces (1) to an identity is called the solution set of the system. If we denote the matrix of coefficients by
LMa a A = ML MM L Na
the column of its constant terms by
1 2 n
11 21
n1
a12 a22 L L an 2
LMb OP B = Mb P , MNbM PQ
and the column of the unknowns by
LM x OP X = Mx P , MN xM PQ
1 2 n
248
249
then the system (1) can be compactly written in the form of a matrix equation AX = B If the matrix A is non-singular, that is if
(2)
LMa a det A = = M K MM K Na
11 21
n1
OP PP PQ
then (1) has a unique solution. A1, or If det A 0, there is an inverse matrix A1. Pre multiplying both sides of (2) by the matrix we obtain A1 AX = A1 B (3) X = A1 B. Formula (3) yields a solution of (2) and the solution is unique.
Example 11.1 Solve the system of equations by matrix inversion method. x1 + x2 + x3 = 1 x1 + 2x2 + 3x3 = 6 x1 + 3x2 + 4x3 = 6, Solution The given equation can be put in the form AX = B
where
LM MN L1 det A = M1 MN1
x1 1 1 1 1 A = 1 2 3 , X = x2 , B = 6 . 1 3 4 6 x3
1 2 3
OP PQ 1O 3P = 1 4P Q
LM MN
OP PQ
LM OP MN PQ
det A = 1 0
A 1 exists.
A 1 = 1 Adj A det A
1 1 1 1 1 1 1 1 3 2 = 1 3 2 . 1 1 2 1 1 2 1
=
From (3)
LM MN
OP LM PQ MN
OP PQ
X = A1 B
250
NUMERICAL ANALYSIS
x1 1 1 1 x2 = 1 3 2 1 2 1 x3
LM MN
OP PQ
LM MN
x1 = 1, x2 = 5, x3 = 5.
Exercise 11.1
Solve the following system of equations by matrix inversion method 1. 3x1 x2 = 5 2x1 + x2 + x3 = 0 2x1 x2 = 4x3 = 15 2. 2x 3y 5z = 11 5x + 2y 7z = 12 4x + 3y + z = 5 3. x+y+z =7 x + 2y + 3z = 16 x + 3y + 4z = 22 4. 7x1 + 7x2 7x3 = 2 x1 + 11x2 + 7x3 = 1 11x1 + 5x2 + 7x3 = 0 5. x1 + x2 + x3 = 6 x1 + 2x2 + 3x3 = 14 x1 + x2 x3 = 2
Answers
1. x1 = 2, x2 = 1, x3 = 3 4. x1 = 0, x2 = 16, x3 = 105/882 2. x = 1, y = 2, z = 3 5. x1 = 1, x2 = 2, x3 = 3 3. x = 1, y = 3, z = 3
11.2 GAUSSELIMINATION METHOD The system equations given by (1) may also be written the tabular form as x1 x2 x3 xn bi L
a11 a21 a31 a12 a22 a32 a13 a23 a33
L L L L
b1 b2 b3
M
an1 an2 an3 ann bn
251
The above system is first reduced to triangular form by eliminating one of the unknowns at a time. The unknown x1 is first eliminated from (n1) equations by dividing the first equation by a11 and by subtracting this equation multiplied by aii(i = 2, 3, .., n) from the remaining (n1) equations. The unknown x2 is then eliminated from the (n2) equations of (n1) equations not containing x1. The Process of elimination is continued until appears only in the last equation as shown in the table below.
x1 1 0 x2 c12
1
x3 L c13 L c22 L
xn c1n czn
bi d1 d2
L L L
L L L
L L L
L L
1
L L
dn
The unknowns x1, x2, , xn are then evaluated by backward substitutions. The value of xn is obtained from the nth equation the value of x2 is then substituted in (n1)th equation which gives xn1. The values of xn and xn1 are then substituted in (n2)nd equation to get the value of xn2, etc. The computations are checked at each row by means of an additional column. The additional column of such checks is denoted by s. The Process described above is called GaussElimination. If aii 0, the ith row cannot be used to eliminate the element in ith column and row r must be changed with some row below the diagonal to obtained a zero element which is used eliminate x2. The example given below is an illustrations of the method.
Example 11.2 Solve by GaussElimination method 2x + 2y + 4z = 18 x + 3y + 2z = 13 3x + y + 3z = 14 Row No. I II III IV V VI VII VIII IX x 2 1 3 1 0 0 y 2 3 1 1 2 2 1 0 z 4 2 1 2 0 3 0 3 1 d 18 13 14 9 4 13 2 9 3 s 26 19 21 13 6 18 3 12 4 I/a11 = I/2 II 1 (III) III 3 (IV) V/a22 = V/2 VI + 2 VII VIII/a33 = VIII/(3) Explanation
252
NUMERICAL ANALYSIS
From IV,
y = 2
x + y + 2z = 9
x = 9 y 2z = 9 2 2 3 x = 1, y = 2, z = 3.
Exercise 11.2
Solve the following by GaussElimination method 1. x1 + 2x2 + 3x3 = 7 2x1 + 7x2 + 15x3 = 26 3x1 + 15x2 + 41x3 = 26 2. 2x1 + 6x2 x3 = 23 4x1 x2 + 3x3 = 9 3x1 + x2 + 2x3 = 13 3. 2x + 2y + 4z = 14 3x y + 2z = 13 5x + 2y 2z = 2 4. 4x y + 2z = 15 x + 2y + 3z = 5 5x 7y + 9z = 8 5. 2x + y + 4z = 12 8x 3y + 2z = 20 4x + 11y z =33
Answers
1. x1 = 2, x2 = 1, x3 = 1 4. x = 4, y = 3, z = 1 2. x1 = 1, x2 = 4, x3 = 3 5. x = 3, y = 2, z = 1 3. x = 2, y = 1, z = 3
253
11.3 ITERATION METHODS The Matrix inversion method and Gauss elimination methods are called Direct methods (or exact methods) they are based on the elimination of variables in order to reduce the given system of equations to a triangular form. When a linear system has a large number of unknowns, the Gaussian scheme becomes very unwieldily. Under such conditions it is more convenient to use indirect or iterative methods. The iterative methods are not applicable to all systems of equations. In order that the iteration may succeed, each equation of the system must contain one large coefficient and the large coefficient must be attached to a different unknown in that equation. Successful use of the iteration process requires that the moduli of the diagonal coefficients of the given systems be large in comparison with the moduli of the non-diagonal coefficients. We shall discuss two particular methods of iteration. 11.3.1 Jacobis Method Consider the system of equations a11 x1 + a12 x2 + a13 x3 = b1 a21 x1 + a22 x2 + a23 x3 = b2 a31 x1 + a32 x2 + a33 x3 = b3, (4) assume that the diagonal coefficients, a11, a22 and a33 are large, compared to other coefficients solving for x1, x2 and x3 respectively. We get
x1 = x2 = x3 = 1 b1 a12 x2 a13 x3 , a11 1 b2 a21 x1 a23 x3 , a22 1 b3 a3 x1 a32 x2 , a33
(5)
( 0) ( 0) ( 0) let x1 , x2 , x3 , denote the initial estimates for the values of the unknowns x1, x2, x3. Substituting these values in the right sides of (5) we get the first iterative values x1, x2, x3 as follows:
(1) = x1
(1) = x2
(1) = x3
(1) (1) (1) , x2 , x3 Substituting the values x1 the right sides of (5), we get
(2) = x1
254
NUMERICAL ANALYSIS
(2) = x2
1 (1) (1) a23 x3 b2 a21 x1 , a22 1 (1) (1) a32 x2 b3 a31 x1 . a33
(2) = x3
1 (n) (n) b1 a12 x2 a13 x3 , a11 1 (n) ( n) b2 a21 x1 a23 x3 , a22 1 (n) (n) b3 a31 x1 a32 x2 . a33
( n + 1) x2 =
( n + 1) x3 =
Example 11.3 Solve by GaussJacobis method 5x + 2y + z = 12, x + 4y + 2z = 15, x + 2y + 5z = 20. Solution The above system is diagonally dominant, i.e., in each equation the absolute value of the largest coefficient is greater than the sum of the remaining coefficients. The given equations can be written as
x= y= z=
1 12 2 y 3 , 5 1 15 x 2 z , 4 1 20 x 2 y . 5
For the first iteration we get x (1) = y (1) = z (1) = 1 12 0 0 = 2.40 , 5 1 15 0 0 = 3.75 , 4 1 20 0 0 = 4.00 , 5
255
putting the values y(1), z(1) in the right side of (1), we get
x (2) =
b g
y (2) =
and putting the values of x(1) and y(1) in the right side of (3) we get
z (2) =
The iteration process is continued and the results are tabulated as follows Iterations x y z 1 2.40 3.75 4.00 2 0.10 1.15 2.02 3 1.54 1.72 3.57
The values of x, y, z, at the end of the 8th iteration are x = 1.084, y = 1.95, and z = 3.164.
Exercise 11.3
Solve by GaussJacobis method of iteration: 1. 27x1 + 6x2 x3 = 85 6x1 + 5x2 + 2x3 = 72 x1 + x2 + 54x3 = 110 2. x + 10y + 3 = 6 10x + y + z = 6 x + y + 10z = 6 3. 13x1 + 5x2 3x3 + x4 = 18 2x1 + 12x2 + x3 4x4 = 13 3x1 4x2 + 10x3 + x4 = 29 2x1 + x2 3x3 + 9x4 = 31 4. 4x1 + 0.24x2 0.08x3 = 8 0.09x1 + 3x2 0.15x3 = 9 0.04x1 0.08x2 + 4x3 = 20
Answers
1. x1 = 2.4255, x2 = 3.5730, x3 = 1.9260 3. x1 = 1, x2 = 2, x3 = 3, x4 = 4 2. 4. x = 0.5, y = 0.5, z = 0.5 x1 = 1.90923, x2 = 3.19495, x3 = 5.04485
256
NUMERICAL ANALYSIS
refer (4)
Suppose in the above system, the coefficients of the diagonal terms are large in each equation compared to other coefficients, solving for x1, x2, x3 respectively
1 b1 a12 x2 a13 x3 , a11 1 x2 = b2 a21 x1 a23 x3 , a22 1 x3 = b3 a 3 x1 a32 x2 . a33 x1 =
U | | | V | | | W
(6)
( 0) ( 0) ( 0) ( 0) Let x1 , x2 , x3 , denote the initial approximations of x1, x2, x3 respectively. Substituting x2 , ( 0) and x3 in the first equation of (6) we get ,
(1) = x1
(1) ( 0) Then we substitute x1 for x3 in second equation of (6) which gives , and x1 and x3
(1) = x2
(1) (1) We substitute x1 for x, and x2 for x2 in the third equation of (6) which gives
(1) = x3
In the above process, we observe that the new value when found is immediately used in the following equations:
( n + 1) x1 =
1 (n) (n) b1 a12 x2 a13 x3 , a11 1 ( n + 1) ( n) b2 a21 x1 a23 x3 , a22 1 ( n + 1) ( n + 1) b3 a31 x1 a32 x2 . a33
( n + 1) x2 =
( n + 1) x3 =
257
Example 11.4 Solve by GaussSeidel method of iteration the equations 10x1 + x2 + x3 = 12 2x1 + 10x2 + x3 = 13 2x1 + 2x2 + 10x3 = 14 Solution From the given equations we have
x1 = x2 = x3 =
Putting x = 0 in right side of (7) we get
(1) x1 =
1 12 x1 x2 , 10 1 13 2 x1 x3 , 10 1 14 2 x1 2 x2 . 10
12 12 . , 10
(2 ) x2 =
(2) x3 =
g b
Thus the iteration process is continued. The results are tabulated as follows correcting to four decimal places i 0 1 2 3 4 5
(i ) x1 (i ) x2 (i ) x3
258
NUMERICAL ANALYSIS
Exercise 11.4
Solve by GaussSeidel method, the equations: 1. 27x + 6y z = 85 6x + 15y + 2z = 72 x + y + 54z = 110 2. 10x1 x2 x3 = 13 x1 + 10x2 + x3 = 36 x1 x2 + 10x3 = 35 3. x1 + 10x2 + x3 = 6 10x1 + x2 + x3 = 6 x1 + x2 + 10x3 = 6 4. 13x1 + 5x2 3x3 + x4 = 18 2x1 + 12x2 + x3 4x4 = 13 3x1 4x2 + 10x3 x4 = 29 2x1 + x2 3x3 + 9x4 = 31 5. 5x + 2y + z = 12 x + 4y + 2z = 15 x + 2y + 5z = 20
Answers
1. x = 2.4255, y = 3.5730, z = 1.9260 2. x1 = 2, x2 = 3, x3 = 4 5. x = 0.996, y = 2, z = 3. 3. x1 = 0.5, x2 = 0.5, x3 = 0.5
4. x1 = 1, x2 = 2, x3 = 3, x4= 4
11.4 CROUTS TRIANGULARISATION METHOD (METHOD OF FACTORISATION) Basic Definitions Consider the square matrix A = [ a ij] n n
(i ) If aij = 0 for i > j. Then A is called an upper triangular matrix. (ii ) If aij = 0 for i < j. Then the matrix A is called a lower triangular matrix.
A=
LMa MN 0 0
11
a12 a22 0
OP PQ
259
and
LM MN
0 0 a33
OP PQ
from the above; it is clear that; A is an upper triangular matrix if all the elements below the main diagonal are zero, and A is lower triangular if A has all elements above the principal diagonal as zero. Triangularization Method Consider the system a11 x1 + a12 x2 + a13 x3 = b1 a21 x1 + a22 x2 + a23 x3 = b2 a31 x1 + a32 x2 + a33 x3 = b3 The above system can be written as AX = B ... where Let where (1)
LM MN
OP PQ
LM MN
OP PQ
LM MN
OP PQ OP PQ
LM MN
OP PQ
LM MN
(2)
Hence the equation (1) becomes LUX = B.. . If we write Equation (3) becomes LV = B ... Which is equivalent to the system v 1 = b1 l21 v1 + v2 = b2 l31 v1 + l32 v2 + v3 = b3 UX = V...
the above system can be solved to know the values of v1, v2 and v3 which give us the matrix V. When V is known the system. u11 x1 + u12 u22 UX x2 + u13 x3 x2 + u23 x3 u33 x3 = = = = V, becomes v1 v2 v3
which can be solved for x3, x2 and x1 by the backward substitution To compute the Matrices L and U, we write (2) as
260
NUMERICAL ANALYSIS
LM 1 MNll
21 31
0 1 l32
0 0 1
OP LMu PQ MN 0 0
11
u12 u22 0
OP PQ
LM MN
OP PQ U | V | | W
a21 a12 a11 a 21 a13 a11
multiplying the matrices on the left and equating the corresponding elements of both sides, we obtain (i ) u11 = a11, u12 = a12, u13 = a13
(ii )
l21 u12 + u22 = a22 u22 = a22 l21 u13 + u23 = a23 u23 = a23
U | V | | W
OP Q
(iii)
LM N
( iv ) (v)
and
l31 u13 + l32 u23 + u33 = a33 The value of u33 can be computed from (v)
To evaluate the elements of L and U, we first find the first row of U and the first column of L: then we determine the second row of U and the second column of L: and finally, we compute the third row of U. The procedure can be generalised.
Example 11.5 Apply Triangularization (factorization) method to solve the equation 2x + 3y + z = 9 x + 2y + 3z = 6 3x + y + 2z = 8
Solution We have
x 2 3 1 9 A= 1 2 3 , X = y , B= 6 3 1 2 8 z 0 1 l32 0 0 1
LM MN
OP PQ
LM OP MN PQ
LM OP MN PQ
Let
LM l MNll
21 31
OP LMu PQ MN 0 0
11
u12 u22 0
OP L PQ MMN
OP PQ
(i)
261
1 2 ... 3 = 2
U | V | W
(ii)
U | V | W
(iii)
FG IJ HK
(iv)
3 5 1 + 7 + u33 = 2 u33 = 18 2 2
b g
(v)
Thus, we get
LM MM 1 1 A= MM 2 3 MM 2 N
0
0 1 7
OP PP LM2 0 M0 PP M M0 1P N PQ
3 1 2 0
1 5 2 18
OP PP PQ
LM MM 1 1 MM 2 3 MM 2 N
0 1 7
OP PP LM2 0 M0 PP M M0 1P N PQ LM MM 1 1 MM 2 3 MM 2 N
3 1 1 5 2 2 0 18
OP L O L9 O PP MM x y P = M 6P PQ N z PQ MN8PQ
Writing; LV = B we get
0 1 7
OP P L v O L9 O 0P M v P = M 6 P PP MNv PQ MN8PQ 1P PQ
1 2 3
which gives
262
NUMERICAL ANALYSIS
v1 = 9
v1 3 + v2 + 6 or v2 = 2 2
and
3 1 1 5 2 2 0 18
OP L O LM 9 OP 3 PP MM x yP = M P 2 PQ N z PQ MMN 8 PPQ
i.e.,
2x + 3 y + z = 9
y 5z 3 + = 2 2 2
18z = 5 by back substituting, we have
x=
35 29 5 . ,y= ,z= 18 18 18
Crouts Method Consider the system a11 x1 + a12 x2 + a13 x3 = b1 a21 x1 + a22 x2 + a23 x3 = b2 a31 x1 + a32 x2 + a33 x3 = b3 The above system can be written as AX = B Let A = LU ...(2) ... (3)
0 l22 l32
...(1)
where
L =
LM l MMl Nl
11 21 31
OP 0P l P Q
0
33
and
LM1 U = M0 MN0
11 21 31
u12 1 0
OP u P 1P Q
u13
23
L is a lower triangular matrix and u is an upper triangular matrix with diagonal elements unity. A = LU A1 = U1L1 ...(4)
0 l22 l32
Now
LM a A = LU M a MNa
11 21 31
OP LMl PP = MMl Q Nl
OP 0P l P Q
0
33
LM1 MM0 N0
u12 1 0
OP u P 1P Q
u13
23
263
LMa MMa Na
11 21 31
OP PP = Q
LM l MMl Nl
11 21 31
l11u12 l11u13 l21u12 + l22 l21u13 + l22u23 l31u12 + l32 l31u13 + l32u23 + l33
OP PP Q
...( i ) ...( ii ) ...( iii ) ...( iv ) ...( v ) (using (i)) ...( vi ) ...( vii ) ...( viii ) ...(ix )
Equating the corresponding elements, we get l11 = a11 l11u12 = a12 l21 u12 + l22 = a22 l21 u13 + l22 u23 = a23 and l31 u13 + l32 u23 + l33 = a33 u12 = a12/l11 = a12/a11 from (iii) we get (iv) gives from the relation (v) we get l33 = a33 l31 u13 l32 u23 Thus, we have determined all the elements of L and U. From (2) and (3) we have LUX = B ... (5) l22 = a22 l21 u12 l32 = a32 l31 u12 u23 = (a23 l21 u23)/l22 from (ii) we get l21 = a21 l11u13 = a13 l31 u12 + l32 = a32 l31 = a31
Let
UX = V
where V =
From (5) we have LV = B, which on forward substitution gives V. From UX = V, we find X (by backward substitution)
Note: Using (4) we can also find the in case of A. Example 1. Solve 2x + y = 7 x + 2y = 5 Solution. The given system can be written as AX = B where A = ...(1)
Let A = LU where
L =
264
NUMERICAL ANALYSIS
A = LU
LM2 1OP N1 2Q
LMl Nl LMl Nl
11 21
0 l22
OP LM1 Q N0
u12 1
11 21
OP Q
OP Q
Equating the corresponding elements we get l11 = 2, l21 = 1, l11 u12 = 1 u12 = 1/2 l21 u12 + l22 = 2 1.u12 + l22 = 2
1 + l22 = 2 2
L =
l22 =
3 2
LM2 MN1
0 1 1/ 2 3 , U = 0 1 2
OP PQ
LM N
OP Q
...(2)
2v1 = 7, v1 + v1 =
3 v2 = 5 2
7 7 3 + v2 = 5 u2 = 1 and 2 2 2
7 v1 = , v = 1 U = 2 2
Now
UX = V
x+
7 1 y = , y =1 2 2 7 1 = 2 2
x =
x+
7 1 6 = =3 2 2 2
265
2x 3y + 4z = 13 3x + 4y + 5z = 40
Solution. We have
A =
1 3 4
OP 4P, 5P Q
1 0
LM x OP X = M y P, MNz PQ OP PP Q LM MM N0
1 0
LM 9 OP B = M13P MN40PQ
...(1) ...(2)
where
L =
l33
OP P 1 P Q
A = LU
1 3 4 1 4
OP 4P 5P Q
1 1
11 21 31
0 l22 l32
OP LM1 0 P M0 l P Q MN0
0
33
u12
u13
u23
OP P 1 P Q OP PP Q
3 4
OP P 5P Q
LMl MMl Nl
11 21 31
Equating the corresponding elements, we have l11 u12 = 1 1.u12 = 1 u12 = 1; l11u13 = 1 u13 = 1 l21 u12 + l22 = 3 2 + l22 = 3; l21u13 + l22u23 = 4 l22 = 5; 2 5u23 = 4
2 u23 = . 5
l31 = 3, l31u12 + l32 = 4; 3 + l32 = 4; l32 = 1; l31 u13 + l32 u23 + l33 = 5 3
2 + l33 = 5 5 12 5
l33 = 0 0 5 0 12 1 5
L =
OP PP PQ
and
LM1 U = M0 MN0
1
1 2 1 5 0 1
OP PP Q
...(3)
LUX = B
Let
UX = V where
LMv OP V = Mv P MNv PQ
2 3
266
NUMERICAL ANALYSIS
LV = B
LM1 M2 MM3 N
0 0 5 0 12 1 5
OP LM v PP MM2v 5v MM3v + v + 12 v PP 5 Q N
1 1 2 1 2 3
v1 = 9,
12 v3 = 40 5
Now
V =
; v3 = 5
UX = V
LM1 MM0 N0
1 1 0
1 2 5 1
OP L x O PP MM yPP Q MNz PQ
x + y + z = 9 y
2 z = 1 5
z = 5
2 2 z = 1 y .5 = 1 y 2 = 1 y = 3 5 5
Exercise 11.5
Applying (a) Crouts method (b) triangularization method solve the equations 1. 3x + 2y + 7z = 4 2x + 3y + z = 5 3x + 4y + z = 7
267
2.
3.
5x + 2y + z = 12 x + 4y + 2z = 20 2x 3y + 10z = 3
4.
2x 6y + 8z = 24 5x + 4y 3z = 2 3x + y + 2z = 16
5.
10x1 + 7x2 + 8x3 + 7x4 = 32 7x1 + 5x2 + 6x3 + 5x4 = 23 8x1 + 6x2 + 10x3 + 9x4 = 33 7x1 + 5x2 + 9x3 + 10x4 = 31
6.
Answers
1. x = 7/8, y = 9/8, z = 1/8 4. x = 1, y = 3, z = 5 2. 5. x =y=z=1 x1 = x2 = x3 = x4 = 1 3. 6. z = 2, y = 3, x = 4 x1 = 1, x2 = 0, x3 = 1, x4 = 2.
268
NUMERICAL ANALYSIS
12
CURVE FITTING
12.1 INTRODUCTION In this chapter we are concerned with the problem of fitting an equation or a curve to data involving paired values. An approximate non-mathematical relationship between the two variables, can be established by a diagram called scatter diagram. The exact mathematical relationship between the two variables is given by simple algebraic expression called curve fitting. Though there are infinite variety of curves in mathematics, the curves used for the purpose of curve fitting are relatively limited in type. The straight line is the simplest and one of the most important curves used. 12.2 THE STRAIGHT LINE The equation
y = a + bx is an equation of the first degree in x and y. It represents a straight line. The difference yi (a + bxi) is zero if and only if the point (xi, yi) lies on the line given by (1). (2) (1)
12.3 FITTING A STRAIGHT LINE Usually fitting a straight line means finding the values of the parameters a and b of the straight line given by (1), as well as actually constructing the line itself. The Graphic methods and the Method of least squares are two useful methods for fitting a straight line. 12.3.1 The Graphical Method This method can be used whenever the given formula can be plotted as a straight line either directly or after suitable transformation. The straight line drawn after a careful visual estimate of its position has been made with the aid of a ruler. The co-ordinates of any two points on the line, not too near together are then measures and substituted in equation (1). The resulting equations in a and b are then solved for their parameters. Graphical method, whatever its theoretical attractions, suffers from the disadvantage that it is difficult to apply in practice except for the straight line. This method will give fairly good results when finely divided co-ordinate paper is used, but in general it is not recommended.
268
CURVE FITTING
269
Pr (xr , yr)
er
,a Qr (x r
. . . . . . . . . . . . . . . . x . a+b . . . .
a + bxr Yr
) + bxr
y=
x xr
An alternative method, which is in almost universal use at present time, is known as the method of Least Squares and we proceed to discuss it at length.
12.3.2 The Method of Least Squares This method of curve fitting was suggested early in the nineteenth century by the French mathematician Adrien Legendre. The method of least squares assumes that the best fitting line in the curve for which the sum of the squares of the vertical distances of the points (xr, yr) from the line is minimum. This method is more accurate than the graphical method. Let y = a + bx refer (1) be the equation of the line. The ordinate of any point Qr on the line vertically above or below a given point Pr, can be found by substituting the abscissa xr, in the right-hand side of (1). The two coordinates of Qr, will be (xr, a + bxr) (see in the above figure). The vertical distance er from the line of any point, Pr with co-ordinates (xr, yr), will therefore be given by the equation (3) er = yr (a + xr). We may say that er represents the difference between the actual ordinate yr, of a point and its theoretical ordinate a + bxr.
Let
q=
r =1
er2 =
c y ba + bx gh
n r r r =1
(4)
2 The best fitting line is that line for which the sum of the squares, q = er is a minimum. We find the values of a and b which make q minimum as follows:
270
NUMERICAL ANALYSIS
Differentiating q partially with respect to a and b and equally these partially to zero, we obtain
q = a q = b
b2g y ba + bx g
n r r r =1 n
= 0,
and
b2g x
r =1 n
yr a + bxr
g = 0,
(5)
r =1
yr = an + b
x
r =1
,
n
and
r =1
yr yr = a
r =1
xr + b
x
r =1 n
2 r
(6)
a=
xr2
1 1 n
yr
2 r
x G H x JK
r 1 1 n r r n r r =1
x x y
r 1 n
r r
(7)
n b=
F I F IF I GH x y JK GH x JK GH x JK , F I F I nG x J G x J H K H K
n n 2 r r =1 r =1 n 2 r r r =1 r =1
(8)
where n is the number of points (xr, yr). To simplify the formulae, we let
tr = xr x , h
(9)
where h is the interval between successive values of x assumed to be equally spaced. Shifting the origin to the mean x and compressing the intervals to unity we get the transformed equation of (2) referred to the new (t, y) axes as
y = a + bt,
(10)
where a and b are the parameters in the new equation. In terms of the new co-ordinate formulae (7) and (8) become
CURVE FITTING
271
a =
t r2
1 1
yr t r2
n
t t
r
yr ,
(11)
n
n
e j
tr
r 2
n b =
tr yr
n 2 r
F I nt Gt J H K
1 n r 1 1
t y
(12)
Transformation (9) replace the xrs by unit deviations tr from the mean x . Since
t
1
= 0,
y 0 a = , nt 0
t r2
r 1 1 2 r
and
b =
t
1 n 1
yr 0 , 0
t r2
a =
1 n
y
1
r
= y,
(13)
b =
t
1 n 1
yr .
(14)
t r2
272
NUMERICAL ANALYSIS
12.4 FITTING A PARABOLA When a set of points exhibits a parabolic trend, the fitting of a quadratic function y = a + bx + cx2, to the data may be carried out by the method of least squares, which leads to the three equations
na + b
xr + c
n 1
xr2 =
y
1 n 1
1 n 1
xr + b
1 n 1
2 +c xr
n 1
xr3 =
x
n 1
yr ,
2 r
+b
3 r
+c
x = x
4 r
2 r
yr .
12.5 EXPONENTIAL FUNCTION y = aebx Transforming the exponential equation y = aebx by taking logarithms on both sides we get log y = log a + bx log e.
If we replace log y by y and the constants log a and b log e by a and b respectively, we obtain
Y = a + b x ,
which defines a straight line.
Example 12.1 Find the least square line y = a + bx for the data points (1, 10), (0,9), (1,7), (2,5), (3,4), (4,3), (5,0) and (6, 1). Solution Here xr 1 0 1 2 3 4 5 6 20 From the table we have n = 8, xr = 20, yr = 37, x r 2 = 92, and x r y r = 25. yr 10 9 7 5 4 3 0 1 37 xr2 1 0 1 4 9 9 25 36 92 xryr 10 0 7 10 12 12 0 6 25
CURVE FITTING
273
na + b xr = yr ,
a xr + b xr2 = xr yr .
Putting the values in normal equations
8a + 20b = 37 ,
and and solving these equations we get a = 8.6428571, b = 1.6071429. Therefore the least square line is y = 8.6428571 + (1) 1.6071429x, i.e., y = 1.6071429x + 8.6428571. Example 12.2 Find the least square line y =a + bx for the data xr yr Solution xr 2 1 0 1 2 0 yr 1 2 3 3 4 13 xr2 4 1 0 1 4 10 xr yr 2 2 0 3 8 7 2 1 1 2 0 3 1 3 2 4
20a = 97b = 25 ,
In this case
The normal equations are
na + b xr = y r ,
a xr + b xr2 = xr yr .
2 Putting the values of n, xr , yr , xr and xr yr in the above equation we get 5a = 13, 10b = 7.
274
NUMERICAL ANALYSIS
10a + 4.5b + 2.85c = 31.7616, 4.5a + 2.85b + 2.025c = 14.0896, 2.85a + 2.025b + 1.5333c = 8.82881, and solving these equations we obtain a = 3.1951, b = 0.44254, c = 0.76531.
Solution The values of x are, 0, 1, 2, 3, 4 The number of values is odd. Shifting the origin to the middle value 2 of x, and making the substitution u = x 2, v = y, the curve of fit as v = a + bu + cu2, we obtain x 0 1 2 3 4 v 1 1.8 1.2 2.5 6.3 u 1 2 0 1 2 0 v 1 1.8 1.3 2.5 6.3 12.9 uv 2 1.6 0 2.5 12.6 11.3 u2 4 1 0 1 4 10 u 2v 4 1.8 0 2.5 25.2 33.5 u3 8 1 0 1 8 0 u4 16 1 0 1 16 34
v = na + b u + c u 2 , uv = a u + b u 2 + c u 3 , u 2v = a u 2 + b u3 + c u 4 .
Putting the values of n, u, v , uv , ..., etc.,
CURVE FITTING
275
12.9 = 5a + 10c, 11.3 = 10b, 33.5 = 10a + 34c, solving these normal equations we get a = 1.48, b = 1.13, c = 0.550.
b x
r = 1, 2, ..., x y = ax +
b x
...(1)
...(2)
yn = axn + putting
b xn
1 = z in (1) we get x
y = ax + bz ...(3) ...(4) S = ( yr axr bzr ) 2
276
NUMERICAL ANALYSIS
s 2 = 0 2 ( xr , yr axr bxr zr ) = 0 a
2 xr yr = a xr + bxr zr
...(5)
...(6)
but z =
1 x
from (5) and (6) obtain the required normal equations can be written as
2 + b x r xr yr = a xr
1 xr
i.e., and
...(7)
na + b
1
2 xr
yr xr
...(8)
Example 12.6 Given the following data v (ft/min) t (min) Solution Substituting : : 350 61 400 26 v = atb log10 v = log10 a + b log10 t x = log10 t, y = log10 v, a = log10a in (1) we get y = a + bx The normal equations can be wirtten as 4a + bxr = yr
2 = x y a xr + bxr r r
500 7
600 2.6
If v and t an connected by the relation v = atb, find the best possible values of a and b.
...(1)
...(2) ...(3) y 2.5441 2.6021 2.6990 2.7782 10.6234 xy 4.542 3.682 2.281 1.153 11.658 x2 3.187 2.002 0.714 0.172 6.075 ...(4) ...(5)
k 61 26 7 2.6
Substituting the above values in (2) and (3) we get 4a + 4.4604b = 10.623 4.4604a + 6.075b = 11.658
CURVE FITTING
277
Solving (4) and (5) we get a = 2.845, b = 0.1697 x: y: Consider 2 8.3 3 15.4 4 33.1 a = antilog a = antilog 2.845 = 699.8 5 65.2 6 127.4 ...(1) ...(2) Example 12.7 Using the method of least squares bit a curve of the form y = abx to the following data
Solution. Here we have n = 5 (number of observation) y = abx log18 y = log10a + x log10b taking log10 y = Y, the equaiton (2) can be written as Y = a + b x where a = log10a, b = log10b Equation (3) is linear in X and Y, hence the normal equations are na + b x = Y a x + b x 2 = XY we have x 2 3 4 5 6 Total 20 The normal equations are 5a + 20b = 7.5458 20a + 90b = 33.1821 Solving (4) and (5) we get a = 0.3096, b = 0.2995 Now a = 0.3096 log10a = 0.3096 a = 2.0399 b = 0.2999 log10b = 0.2999 b = 1.9948 y = 2.0399 (1.9948)x ...(4) ...(5) y 8.3 15.4 33.1 65.2 127.4 Y = log10 y 0.9191 1.1875 1.5198 1.1842 2.1052 7.5458 XY 1.8382 3.5625 6.0792 9.0710 12.6312 33.1821 x2 4 9 16 25 36 90 ...(3) Applying logarithms on both sides we get
278
NUMERICAL ANALYSIS
Example 12.8 Fit a least square curve of the form y = aebx (a > 0) to the data given below x: y: Solution. Consider 1 1.65 2 2.70 3 4.50 4 7.35 y = aebx log10 y = log10a + bx log10e taking where a = log10a, b = log10e (2) is a linear equation in x and Y, the normal equations are na + b x = Y a x + b x 2 = XY x 1 2 3 4 Total 10 y 1.65 2.70 4.50 7.35 Y = log10 y 0.2175 0.4314 0.6532 0.8663 2.1684 xY 0.2175 0.8628 1.9596 3.4652 6.5051 x2 1 4 9 16 30 log10 y = Y, the equaiton (1) can be written as Y = a + bx ...(2) ...(1)
The normal equation can be written as 4a + 10b = 2.1684 10a + 30b = 6.5051 Solving the euqaitons (3) and (4), we get a = 0.0001, b = 0.2168 Now a = 0.0001 log10a = 0.0001 a = 1.0002 b = 0.2168 The required curve is b log10e = 0.2168 ...(3) ...(4)
b = 0.4992 y = (1.0002).e0.4992x.
Exercise 12.1
1. Find the least square line y = a + bx for the data xr yr 4 1.2 2 2.8 0 6.2 2 7.8 4 13.2
CURVE FITTING
279
2. Fit a straight line to the following data regarding x as the independent variable x y 0 1 1 1.8 2 3.3 3 4.5 4 6.3
5. Find the least squares parabola for the points (3, 3), (0, 1), (2, 1), (4, 3). 6. The profit of a certain company in the xth year of its life are given by x y 1 1250 2 1400 3 1950 4 2300
y 1650 , show that the parabola of the second degree of v on u is v + 50 0.086 = 5.30u + 0.643u2 and deduce that the parabola of the second degree of y on x is y = 114 + 72x + 32.15x2.
Taking u = x 3 and V = 7. Find the least square line y = a0 + a1x for the data x y 1 0 2 1 3 1 4 2
8. Find the least square fit straight line (of the form y = a0 + a1x) for the data of fertilize application and yield of a plant Fertilizer applied (gm/week/plant) Yield (kg) 0 0.8 10 0.8 20 1.3 30 1.6 40 1.7 50 1.8
9. Find the normal equations that arise from filling by the least squares method, an equation of the form y = a0a1sin x, to the set of points (0, 0), (/6, 1), (/2, 3), and (5/6, 2) solve for a0 and a1. 10. The following data relates the percentage of alloying element to the compressive strength of an alloy: % alloying element 10 15 29.57 20 31.166 25 31.366 30 31.0 Compressive strength 27.066
11. Find the least squares parabolic fit y = ax2 + bx + c, for the following data x y 3 15 1 5 1 1 3 5
280
NUMERICAL ANALYSIS
12. Find the polynomial of degree two that best fits the following data in least square sense x y 2 3.150 1 1.390 0 0.620 1 2.880 2 5.378
13. If P is the Pull required to lift a load W by means of a pulley block, find a liner law of the form P = mW + c, connecting P and W, using the data P W 12 50 15 70 21 100 25 120
where P and W are taken in kg-wt. Compute P when W = 150 kg. 14. In some determination of the volume v of carbondioxide dissolved in a given volume of water at different temperatures , the following pairs of values were obtained
0 1.80
5 1.45
10 1.80
15 1.00
obtain by the method of least squares, a relation of the form v = a + b . Which best fits to these observations. 15. The observations from an experiment are as given below y x 2 600 10 500 26 400 61 350
It is known that a relation of type y = aebx exists. Find the best possible values of a and b. Hint : The normal equations are
a + bxr = log yr
2 a xr + bxr = xr log yr
and the curve is y = 43.12777 e0.0057056x 16. Fit a least square geometric curve y = axb to the following data. x y 1 0.5 2 2 3 4.5 4 8 5 12.5
17. Using the method of least squares, fit a relation of the form y = abx to the following data x y 2 144 3 172.8 4 207.4 5 248.8 6 298.5
CURVE FITTING
281
18. Using the method of least squares fit a curve of the form y = abx to the following data x y 1 4 2 11 3 35 4 100
19. Fit a least square curve of the form y = axb for the following data where a and b are constants x y 61 350 26 400 7 500 2.6 600
20. The pressure and volume of a gas are related by the equation PV = k ( an k are constants). Fit this equation for the data given below: p v 0.5 1.62 1.0 1.00 1.5 0.75 2.0 0.62 2.5 0.52 3.0 .046
Answers
1. y = 6.24 + 1.45x 4. y = 2.125 1.70x + 7. 0.875x2 2. y = 0.72 + 1.33x 3. y = 3.3 + 1.45x
y=
1 3 + x 2 5
10. y = 18.988 + 1.0125x 0.02048x2 12. y = 0.621 + 2.1326x + 0.1233x2 14. v = 1.758 0.053 . 17. y = 9986 x1.2 19. y = (701.94) x0.1708
11.
y=
7 2 17 17 x x+ 8 10 8
13. 2.2759 + 0.1879 W, 30.4635 kg 16. y = 0.5012 x1.9977 18. y = (1.3268) . (2.9485)x 20. pv1.4225 = 0.997
13
EIGEN VALUES AND EIGEN VECTORS OF A MATRIX
13.1 Let A = [aij] be a square matrix of dimension n n. The equation
(1)
where is a parameter called the characteristic equation of A. It is of degree n. The roots of this characteristic equation are called the characteristic roots or the Eigen values of the matrix A. A square matrix of order n has always n eigen values. When the determinant in (1) is expanded it becomes a polynomial of degree n, which is called characteristic polynomial. From (1) we get
b g
det A = 0
1 2 ... n = det A = A .
Consider the homogeneous equations
U | V | W
(2)
where is an undetermined parameter. The n values of for which non-zero roots of the homogeneous equations (2) exist, are called the Eigen values or Characteristic values of the parameter . The non-zero column vector x satisfying (A I ) X = 0, is called Eigen vector of A. Corresponding to each of the eigen value there is an eigen vector of A. Consider the projection transformation in two dimensional space OX1X2 defined by the matrix
282
283
0 A= 1 0 0 .
Here the eigen vectors are: ( i ) The non-zero vectors directed along the X1-axis with eigen value 1 = 1 and (ii ) The non-zero vectors directed along the X2-axis with eigen value 2 = 1 (see Fig. 1)
X2
LM OP N Q
x
Fig. 1
X1
We state below some important properties of eigen values and eigen vectors of a matrix: 1. For each distinct eigen value , there exists at least one eigen vector corresponding to . 2. If A is a square matrix and 1 , 2 , ..., n are distinct eigen values of A with associated eigen vectors v1, v2, , vn respectively, then {v1, v2, , vn} is a set of linearly independent vectors. 3. If B is a non-singular matrix then A and B1 AB have same eigen values. 4. The eigen values of a Hermitian matrix are real. 5. The eigen values and eigen vectors of a real symmetric matrix are real. 6. The number of linearly independent eigen vectors corresponding to one and the same root of the characteristic equation does not exceed the multiplicity of that root.
Note: In this chapter, we write a11 a12 a21 | A = I | = ... an1 ... an 2 ... a1n ... ... ... ann = p0n + p1n 1 + ... + pn (say)
a22 ... a2 n
Example 13.1 Find the characteristic values (Eigen values) of the matrix A =
LM 3 N2
1 0
OP Q
284
NUMERICAL ANALYSIS
| A I | = 0
i.e., The roots of are 3 x 1 = 0
() (3 ) + 2 = 0 2 3 + 2 = 0 ( 1) ( 2) = 0 = 1, = 2 ...(1)
The characteristic roots of values of A are 1, 2. Example 13.2 Find the characteristic values and the corresponding characteristic vectors of A = Solution The characteristic equation of A is |A I| = 0 i.e., Let 3 1 1 = 0 (3 )2 1 = 0 3
LM3 N1
1 3
OP Q
2 6 + 9 1 = 0 2 6 + 8 = 0
( 2) ( 4) = 0 = 2, = 4 are the characteristic values of A. x =
LM x OP Nx Q
1 2
1
i.e.,
LM1 N1
LM3 2 N1
( A I ) x = 0
OP Q 1O L x O 1P Q MN x PQ =
1 3 2 =
1 2
0O LM x OP L M N x Q N0P Q
LM0OP N0Q
x1 + x2 = 0, x1 + x2 = 0
x1 + x2 = 0 x1 = x2
x1 x2 = k (say) = 1 1
LM k OP N k Q
285
or when = 4 : we have
X1 =
LM 1 OP N1Q
x1 x2 = 0
(A I) X = 0
x1 + x2 = 0,
x1 = x2
LM3 4 N1
1 3 4
OP LM x OP = LM0OP Q N x Q N0Q
1 2
x1 x2 = k (say) = 1 1
The characteristic roots of A are = 2, = 4 and the characteristic vectors of A are X1 = Note: The characteristic vectors may be normalized and expressed as
LM 1 OP, N1Q
X2 =
LM1OP N1Q
X1 =
LM 1 OP MM 21 PP, MN 2 PQ
LM MM N1
1
X2
LM 1 OP 2P =M 1 MM PP N 2Q
Example 13.3 Obtain the eigen values and eigen vectors of the symmetric matrix 0 1 1 A= 1 0 1 Solution The characteristic equation
OP P 0P Q
A I = 0 gives 1 1
1 1
1 1 = 0,
+1
g b 2g = 0 ,
2
hence eigen values are = 1, 1, 2. Case 1 When = 2 The corresponding eigen vector is given by (A 2I)X = 0
2x + y + z = 0
x 2y + z = 0 x + y 2z = 0 solving we get x = y = z = k (say), thus X1 = [k k k]T.
286
NUMERICAL ANALYSIS
x + y + z = 0
(all three equations are equivalent). [1 0 1]T and [1 + k 1 k]T since these are orthogonal, we have 1 + k + k = 0
k = 1/2
T
hence
X2 =
LM 1 0 1 OP N 2 2Q
, X3 =
LM 1 N6
2 1 6
OP . 6Q
T
Example 13.4 Determine the eigen values and the corresponding eigen vectors of the following system 10x1 + 2x2 + x3 = x1 2x1 + 10x2 + x3 = x2 2x1 + x2 + 10x3 = x3 Solution We have
LM 10 A = M2 MN 2
The characteristic equation
2 10 1
OP 1 P 10 P Q
1
A I =
10 1 1 2 10 1 =0 2 1 10
10
7 10 + 6 = 0
= 13, = 9, = 8
i.e., Case 1 When 1 = 13
1 = 13, 2 = 9, 3 = 8 .
We get
3x1 + 2x2 + x3 = 0, 2x1 3x2 + x3 = 0, 2x1 + x2 + 3x3 = 0, solving the first two equations with x3 = 1, we get x1 = 1, x2 = 1 these values satisfies all the three equations. The first eigen vector is [1 1 1]T.
287
Case 2 When 2 = 9
(A 9I)X = 0
LM 1 1 1OP . N 33Q
T
LM 3 1 1OP . N 2 Q
T
Example 13.5 Find the Eigen values and eigen vectors of the matrix
LM 2 A = M1 MN 1
1 1 2 1 1 2
OP PP Q
A I =
2 1 1 2 2 1 =0 2 1 2
1
we get Case 1
g b4 g = 0
2
1 = 2 = 1, 3 = 4 1 = 1, we get
b A I g X = 0
x1 + x2 + x3 = 0 x1 + x2 + x3 = 0 x1 + x2 + x3 = 0
U | V | W
21 1 1 x1 2 21 1 x2 = 0 2 1 2 1 x3
(3)
LM MN
OP PQ
The rank of the system (3) is one, therefore two of the equations are consequences of the third. It suffices to solve the equation
288
NUMERICAL ANALYSIS
x1 + x2 + x3 = 0. Putting x1 = k1, x2 = k2, we get x3 = [k1 + k2], where k1 and k2 are arbitrary scalars not simultaneously zero. In particular choosing k1 = 1, k2 = 0, and then k1 = 0, k2 = 1, we get the solution consisting of two linearly independent eigen vectors of matrix A X1 = [1 0 1]T, X2 = [0 1 1]T. All the other eigen vectors of A that correspond to the eigen value 1 = 1 are linear combinations of these basis vectors and fill the plane spannel by the vectors X1 and X2. Case 2 Now 3 = 4, gives
LM12 MN 1
or
1 1 2 1 1 2
OP LM xx OP = 0 , PQ MN x PQ
1 2 3
2x1 + x2 + x3 = 0 x1 2x2 + x3 = 0 x1 + x2 2x3 = 0 The rank of the above system is 2. The third equation of the system is a consequence of the first two equations.
x1 x2 x = = 3 3 3 3
x1 = x2 = x3 = k
where k is a constant different from zero, putting k =1, we get the simplest solution that effects the eigen vector of A.
3 = 1 1 1 .
Example 13.6 If a + b + c = 0; find the characteristic roots of the matrix
A =
c b a
OP P cP Q
a b a
A I = applying c1 c1 + c2 + c3
OP P c P Q
289
~ R 2 R 2 R1 R 3 R 3 R1
LM MM N LM MM0 N0
0 0
c b a
OP PP c Q
b a
OP b c a b P ac c b P Q
c b c bc ac b ab cb =0
|A I| = 0
( ) (b c ) (c b ) (a b) ( a c) = 0 (b c) (b c + ) a 2 + ac + ab bc = 0
2 2 2 (b c) a + ac + ab bc = 0
2 2 2 2 b c + 2bc a + ac + ab bc = 0 2 2 2 2 ( a + b + c ) + ab + bc + ca = 0
...(1)
but
...(2)
F GH
3( a 2 + b 2 + c2 ) 2
I JK
= 0
290
NUMERICAL ANALYSIS
13.2 METHOD FOR THE LARGEST EIGEN VALUE (POWER METHOD) Let A be a given matrix whose (largest) eigen value is to be determined and X0 be an arbitrary vector. We use X0 as the initial approximation to an eigen value of the matrix A. Suppose we normalize the vector X0; by requiring that one component say the last by unity. Compute the sequence AX0 = 1x1 AX1 = 2x2 AX2 = 3x3 ... ... AXi1 = i xi ... ... In this sequence; all the vectors X1, X2, ... are to be normalized in whatever manner was chosen originally. The iterative procedure converges, and we get a relation of this form AX = X where X = lim xi, = lim i If the eigen value of A is real and unrepeated the above process will converge to give the largest eigen value of the matrix A.
Example 1 Find the largest eigen value for the matrix
LM10 MM 4 N 1
Solution
4 2 3
1 3
also find the eigen vector corresponding to the largest eigen vector.
Let
A =
OP P 1P Q
and
X0 =
AX 0 =
LM10 MM 4 N 1
4 2 3
1 3
LM13OP = M9 P MN3 PQ
OP LM P MM N0.23076PQ
291
X1 =
AX 1 =
AX 2 =
LM10 MM4 N1
4 2 3
1.0 = 11.834836 x3 where x3 = 0. 44634 4 1O L1. 0 OP LM10 M P 4 2 3 . 0 44634 P P MM MM 1P Q N0.04717PQ N1 3 LM11.73821 OP LM1.0 OP MM5.03421 PP = 11.73821 MM0.42887 PP N0.386210Q N0.032902Q
AX 3 =
= 11.73821 x4
where
X4 =
4 2 3
AX 4 =
292
NUMERICAL ANALYSIS
AX 5 =
LM11.6826 OP LM1.0 OP = 4 95645 11 6826 . . PP MM MM0.424259PP N0.319524Q N0.027350Q LM1.0 OP 11. 6826 x where x = M0. 424259 P MN0.027350PQ 4 1O L1. 0 OP L11.66969 O LM10 M P 2 3 P M0. 424259 P = M4.93057 P MM4 P M 1P Q MN0.027350PQ MN0.300129PQ N1 3 LM1.0 OP 11. 66969 M0. 422510P NM0.025718QP
5 5
AX 6 =
LM1.0 OP 11. 66969 x where x = M0. 422510P MN0.025718PQ 4 1O L1. 0 OP LM10 M P 4 2 3 . 0 422510 P P MM MM 1 P Q N0.025718PQ N 1 3 LM11.6643 OP LM1.0 OP MM4.92217PP = 11.6643 MM0.42198PP N0.29325 Q N0.02514Q
6 6
LM1.0 OP PP MM Q N 4 1O L1. 0 OP LM10 M P 4 2 3 . 0 42198 P P MM AX = M MN1 3 1 P Q N0.02514PQ LM11.6628 OP LM1.0 OP = M4. 91939 P = 11. 6628 M0. 42180P MN0.291099PQ MN0.02495PQ LM1.0 OP = 11.6628 x where X = M0. 42180P MN0.02495PQ LM1.0 OP The largest eign value is 11.6628 and corresponding eigen vector is M0. 42180P . MN0.02495PQ
= 11. 6643 x7 where x7 = 0. 42198 0. 02514
7 7
293
Example 2 Find the largest eigen value and the corresponding eigen vector of the matrix.
A =
6 0
2 0
OP P 3P Q
1
taking x0 = 0
LM1 OP MM PP N0 Q
6 1 2 0 0
Solution
We have
AX 0 =
OP P 3P Q
LM1 OP LM1OP LM1OP MM0PP = MM1PP = 1 . MM1PP N0Q N0Q N0Q LM1 OP = M1 P NM0PQ
2
= 1.X1, where X1
AX 1 =
LM1 MM1 N0
6 1 2 0
OP 0P 3P Q
where
X2 =
Then
AX 2 =
OP P 3P Q
LM1 OP MM0.4PP N0 Q
= 1. 4 = 3. 4 0.52
LM3.4OP MM PP N0 Q
LM1 MM N0
OP PP Q
AX 3 =
where
X4 =
Now
AX 4 =
OP P 3P Q OP PP Q
LM1 OP MM PP N Q LM1 OP LM4.12 OP MM0.52PP = MM2.04PP = 4.12X N 0 Q N0 Q LM1 OP LM3.94OP MM0.49PP = MM1.98 PP N0 Q N 0 Q
0 3
1 = 3. 94 0.5 = 3. 94 X5 0
OP PP Q
294
NUMERICAL ANALYSIS
where
X5 =
LM1 OP LM4OP LM1 OP MM0.5PP = MM2PP = 4MM0.5PP AX = N0 Q N0 Q N0 Q LM1 OP = 4X , where X = M0.5P MN0 PQ LM1 OP The largest eigen value is 4 and the corresponding eigen vector is M0.5P . MN0 PQ
1
5
0 3
OP PP Q
+ B1 n 2 + ... + Bn 1
...(1)
where B0, B1, ..., Bn1 are matrices of order n and whose elements are polynomials in the elements of A ...(2) ; say ...(3)
(where |A I| = P0n + P1n 1 + ... + Pn ) Using (1), we can write (A I) (B0n 1 + B1n 2 + ... + Bn 1 ) = ( P0n + P1n 1 + ... + Pn ) I B0 = P0I AB0 B1 = P1I AB1 B2 = P2I . . . . . . ABr1 Br = PrI . . . ABn1 = PnI ....(5) ...(4)
(4) is an identity in : therefore equating the coefficients of like powers of from both sides we obtain
295
By pre-multiplying these equations with An, An1, ..., A, I respectively and adding we have 0 = P0An + P1An1 + ... + PnI The matrix A satisfies its own characteristic equation. Hence Proved. ...(6)
...(i)
...(ii)
...(iii)
Thus; inverse of A can be evaluated by putting the values of An1; An2, ... in (iii) Remark : We can also apply cayley-Hamilton theorem to find A2, A3,... Example 13.7 Verify cayley-Hamilton theorem for the matrix
LM 5 N1
Also; find the inverse of the matrix A. Solution Let A =
6 2
OP Q
6 2
LM5 N1
OP Q
(5 ) (2 ) 6 = 0 2 7 + 4 = 0 ...(1)
LM5 N1 LM31 N7
6 2
OP LM5 Q N1 OP LM Q N
6 31 = 2 7
OP LM Q N
42 10
OP Q
0 1
42 5 7 10 1
6 1 +4 2 0
OP LM Q N
OP Q
296
NUMERICAL ANALYSIS
A2 7A + 4I = 0
LM31 35 + 4 N7 7 + 0
42 42 + 0 0 = 10 14 + 4 0
OP LM Q N
0 0
OP Q
...(2)
Hence, the matrix A satisfies its own characteristic equation. Cayley-Hamilton theorem is verified from (2), we have A2 7A + 4I = 0 A 1 (A 2 7A + 4I) = 0 A 7I + 4IA 1 = 0 4 A 1 = 7 I A = 7 1 2 4 1
A1 =
LM N
LM1 N0
6 5
0 1
OP Q
OP LM5 Q N1
6 2
OP Q
A =
LM1 MM2 N0
2 1 0
0 1
OP PP Q
0 0 =0 1
Satisfies its own characteristic equation and find A1. Solution The characteristic equation of A is 1 2 1 0
A I = 0 2 0
(1 ) 1 0 1 2 0 2 0
0 +0=0 1
(1 ) (1 + ) 2 + 4(1 + ) = 0 3 2 + 5 + 5 = 0 x 3 + 2 5 5 = 0 A3 + A2 2 1 0 0 0 1 5A 5I = 0 ...(1)
now
A2 =
LM1 A . A = M2 MN0
0 5 0
OP LM1 0P M2 1P Q MN0
0
2 1 0
OP 0P 1P Q
0
LM 5 =M0 MN 0
OP PP Q
297
A3
A2
LM5 . A = M0 NM0
10 5 0
0 5 0
OP LM1 PP MM2 1 Q N0
0 0
2 1 0
OP PP 1Q
= A3 + A2 5A 5I
LM 5 MM10 N0
OP 0 P 1 P Q
0
LM 5 = M10 MN 0
10 5 0
OP LM 1 0P 5 M 2 1P Q MN0
0 5 + 5 + 5 5 0+0+0+0
2 1 0
OP LM 1 0P 5 M 0 1P Q MN0
0 0+0+0+0
0 1 0
10 + 0 10 + 0
0+0+0+0 1 + 1 + 5 5
OP PP Q
0 1
OP PP Q
LM0 MM0 N0
0 0 0
OP 0P 0P Q
0
5A1
LM5 = 0 MM N0
0 5 0
OP LM1 0P M 2 5P Q MN0
0 = 2 0 1 1 2 5 0
2 1 0
OP LM5 0 P M0 1 P Q MN0
0 2 1 0
0 5 0
OP 0P 1P Q
0
LM1 MM N
OP P 1 P Q
0 0 2 0
A1 =
LM MM N
OP P 5 P Q
0 0
298
NUMERICAL ANALYSIS
Exercise 13.1
1. Determine the eigen values and the corresponding eigen vectors for the matrices (a)
LM2 MN 2
2 1
OP PQ
1 (b) 3
LM N
4 2
OP Q
1 (c) 3
LM N
2 4
OP Q
2. Find the characteristic roots and the corresponding characteristic vectors of the matrices
LM 8 (a) 6 MM N2
6 7 4
2 4 3
OP PP Q
LM1 (b) 0 MM N0
2 4 0
3 2 7
OP PP Q
LM 3 (c) M1 MN 0
1 2 1
3 1 3
OP PP Q
3. Find the largest eigen values and the corresponding eigen vector of the matrix
LM15 A = M 10 MN 20 LM MM N
4 12 4
OP P 2P Q
3 6
4. Determine the largest eigen value and the corresponding eigen vector of the matrix
2 A = 1 0
1 2 1
0 1 2
OP PP Q
5. Find the latent roots and the characteristic vectors of the matrices
L2 (i) M0 MM N1 LM MM N
0 2 0
1 0
OP P 2P Q
ii)
LM 6 A = M 2 MN 2
2 3 1
2 1
OP P 3P Q
1 (iii) 0
LM MM N0
2 2 0
OP P 2P Q
3 3
a A= o o
h b o
g o c
OP PP Q
LM 0 A=M 3 MN2
where A = 2
0 1 1
1 0 4
OP PP Q
2 2 1
LM1 MM N2
2 1 2
OP PP Q
299
2 1
OP Q
1 1 3
2 1 1
OP PP Q
Answers
1. (a) 1 = 0, 2 = 3,
(b) 1 = 2, 2
(c) 5. 38,
LM0.46OP N1Q
2 1 3 3
T
OP PQ
, 2 2 1
(c) 1 = 1, 2 = 3, 3 = 4, 1 2 1 , 1 0 1 , 1 1 1 3. [1 0.5 1]T 4. 3.41[0.74 1 0.67]T 5. (i) 1, 2, 3, [1 0 1]T, [0 1 0]T, [1 0 1]T (ii) 8, 2, 2, [2 1 1]T, [1 0 2]T, [1 2 0]T. (iii) [1 0 0]T, [2 10]T 6. [k, 0 0]T, [k2h k2(b a)0]T [k3 g 0 k3(c a)]T
300
NUMERICAL ANALYSIS
14
REGRESSION ANALYSIS
14.1 REGRESSION ANALYSIS
In this chapter we Regression methods are variable y with one or dependent variable with discuss regression which measures the nature and extent of correlation. meant to determine the best functional relationship between a dependent more related variable (or variables) x. The functional relationship of a one or more independent variables is called a regression equation.
14.2 CORRELATION
Correlation is a statistical measure for finding out the degree of association between two variables with the help of correlation we study the relationship between variables. Definition 14.1. If two or more quantities varies in other sympathy so that movements in the one tends to be accompanied by corresponding movements in the other, then they are said to be correlated. Types of correlation: Correlation may be (i ) (ii ) (iii) Positive or negative Simple or partial or multiple Linear or non-linear.
REGRESSION ANALYSIS
301
If the points plotted lie on a straight line rising from lower left to upper right, then there is a perfect positive correlation between the variables x and y (Fig. 1(a)). If all the points do not lie on a straight line, but their tendency is to rise from lower left to upper right then there is a positive correlation between the variable x and y (Fig. 1(b)). In these cases the two variables x and y are in the same direction and the association between the variables is direct.
y y
0 (a )
0 (b )
If the movements of the variables x and y are opposite in direction and the scatter diagram is a straight line, the correlation is said to be negative i.e., association between the variables is said to be indirect.
y y
(c )
(d )
11 15
13 17
15 19
302
NUMERICAL ANALYSIS
[( xi x ) ( yi y )] n x y
[( xi x ) ( yi y )] ( x x )2 ( y y )2
or simply where
r =
x = standard deviation of x1, x2, ..., xn y = standard deviation of y1, y2, ..., yn
x =
x =
xi yi r = n x y
xi yi
= If A and B denote the assumed means then
xi2 yi2
r =
( xi )( yi ) n 2 x ( ) ( yi ) 2 i xi2 yi2 n n xi yi
Karl Pearsons formula; is a direct method of computing r. It can be proved mathematically that 1 r 1. The Karl Pearsons coefficient of correlation r; is also denoted by P (rho) and is also called Karl Pearsons moment correlation coefficient.
14.6 REGRESSION
Correlation methods are used to know, how two or more variables are interrelated. Correlation; cannot be used to estimate or predict the most likely values of one variable for specified values of the other variable. The terms Regression was coined by Sir Francis Galton (while studying the linear relation between two variables).
REGRESSION ANALYSIS
303
Definition: 14.2. Regression is the measure of the average relationship between two or more variables in terms of the original units of data.
14.10 REGRESSION EQUATIONS (LINEAR FIT) 14.10.1 Linear Regression Equation of y on x In linear regression if we fit a straight line of the form y = a + bx to the given data by the method of least squares, we obtain the regression of y on x: Let (x1 y1), (x2, y2),...., (xn, yn) denote n pairs of observations and let the corresponding straight line to be fitted, to these data points be y = a + bx ...(1) applying the method of least squares, we get the following normal equations: ...(2) na + b xi = yi 2 ...(3) a xi + b xi = xi yi dividing equation (2) by n, we get
a+b
yi xi = n n
304
NUMERICAL ANALYSIS
or
...(4)
...(5)
multiplying (2) by xi and (3) by n and then subtracting, we get xi yi n xi yi = b(xi)2 nbxi2 or or b[nxi2 (xi)2] = nxi yi (xi)(yi) b =
n xi yi xi yi nxi2 ( xi ) 2
or
xi yi x y i. i n n n b = xi2 ( xi ) 2 n n
...(6)
...(7)
where
byx
Equation (7) is called regression equation of y on x, and is used to estimate the values of y for given values of n. byx is also given by
x and it is called the regression coefficient of y or x. y
byx = r
Solving (i) and (ii) for a and b and proceeding as before, we obtain the regression equation of x on y as follows
REGRESSION ANALYSIS
305
x x = bxy(y y )
xi yi x y i. i n n n = 2 yi ( y ) 2 n n x y
where
bxy
...( iii )
byx = r
and is called the regression coefficient of x on y. Since we have Note. (1) If xi = xi x , yi = yi y ; then byx = r
y x
and bxy = r
x y
byx . bxy = r2
byx
xi yi xi yi n = = 2 xi2 xi n xi yi yi2
(Q xi = 0, yi = 0)
b xy =
y y = byx (x x ) and x x = bxy (y y ) are identical if byx bxy = 1 or byx = i.e. the lines (iv) and (v) are identical if r2 = 1 i.e. r = 1
...( iv ) ...( v )
1 or r2 = 1 bxy
306
NUMERICAL ANALYSIS
( x x ) = bxy ( y y ) 1 y y = b ( x x) xy
y x
...(3)
Let be the angle between the regression lines, then, the slopes of the lines (1) and (3) are m 1 = byx = r
and
m2 =
y 1 = bxy r x
y m2 m1 = 1 + m2 m1 x r x = y r x 1+ r x y r y
we have
tan =
y x
F 1 rI Hr K
2 y 2 x
x y
1+
2
F 1 r I = G r J H K
2
y x
2 x = 2 2 + x y
LMF 1 r I MNGH r JK +
2 x
2 y
OP PQ
Since r 2 1 and x, y are positive, the positive sign gives the acute angle between the lines and the negative sign gives the obtuse angle between the lines. If 1 denotes acute angle and 2 denotes the obtuse angle between the regression lines, then
1 1 = tan
1 2 = tan
in this case x and y are uncorrelated and lines of 2 regression are perpendicular to each other.
If r = 1, then tan = 0, and = 0 or ; in this case there is a perfect correlation (positive or negative) between x and y. The two lines of regression coincide, but are not parallel since the lines pass through the point ( x , y ) .
LM 1 r . OP MN r + PQ LM r 1 . OP MN r + PQ
2 x y 2 x 2 y 2 x y 2 x 2 y
REGRESSION ANALYSIS
307
Note: If r = 0, then from the equation of lines of regression we have ( y, y ) = r i.e., and i.e., y x ( x x) = 0
( y , y ) = 0 or y = y x x x = r ( y y) = 0 y
x x = 0 or x = x
when r = 0, the equations of lines of regression are x = x and y = y which are the equations of the lines parallel to the axis.
Solution: We have
xi = 75, yi = 200, xi2 = 1375, yi2 = 9000, xi yi = 3400 Regression of y on x: The normal equations are na + bxi = y i xi yi + b xi2 = xi yi i.e., 5a + 75b = 200 75a + 1375b = 3400 ...(1) ...(2)
Solving these equations we get a = 16, and b = 1.6 The regression equation of y or x is y = 16 + 1.6x Regression of equation x on y: The normal equations are na + byi = x i ayi + b yi2 = xi yi
308
NUMERICAL ANALYSIS
5a + 200b 200a + 9000b Solving equations (3) and (4) we get a The regression equation of x on y is x The regression equations are y and x x y 1 9 2 8 3 10
i.e.,
...(3) ...(4)
Example 14.2 For the following data find the regression line of y on x
xi2
1 4 9 16 25 64 100
yi = 84 xi yi = 451 xi2 = 219 n = 7 xi 33 = = 4. 714 7 n yi 84 = = 12 n 7 n xi yi ( xi ) ( yi ) n xi2 ( xi )2 = 7.(451) (33) (84 ) 7(2119 ) ( 33) 2
x =
y =
and
byx =
= 0.867 The regression equation of y on x is: y y = byx (x x ) i.e., or y 12 = 0.867(x 4.714) y = 0.867x + 7.9129
Example. 14.3 From the following data, fit two regression equations by find actual means (of x and y.) i.e. by actual means method. x y 1 2 2 4 3 7 4 6 5 5 6 6 7 5
REGRESSION ANALYSIS
309
Solution. We change the origin and find the regression equations as follows: we have
x =
y =
xi 1 + 2 + 3 + 4 + 5 + 6 + 7 28 = = =4 n 7 7 yi 2 + 4 + 7 + 6 + 5 + 6 + 5 35 = = =5 n 7 7
X2 9 4 1 0 1 4 9 28 Y2 9 1 4 1 0 1 0 16 XY 9 2 2 0 0 2 0 11
x 1 2 3 4 5 6 7 Totals 28
y 2 4 7 6 5 6 5 35
X = x x 3 2 1 0 1 2 3 0
Y= y y 3 1 2 1 0 1 0 0
we have xi = 28, yi = 35, Xi = 0, Yi = 0; Xi2 = 28, Yi2 = 16, XiYi = 11 byx = Xi Yi Xi2 Xi Yi Xi2 = 11 = 0. 3928 = 0. 393 (approximately) 28 11 = 0. 6875 = 0. 688 (approximately) 28
bxy =
y y = byx (x x ) i.e. or and the regression equation of x on y is x x = bxy (y y ) i.e. or The required regression equations are y = 0.393x + 3.428 and x = 0.688y + 0.56 Example 14.4. From the following results obtain the two regression equations and estimate the yield of crops when the rainfall is 29 cms. and the rainfall when the yield is 600 Kg. Mean S.D. y (yield in kgs.) 508.4 36.8 (Rainfall in cms.) 26.7 4.6 x 4 = 0.688 (y 5) x = 0.688 y + 0.56 y 5 = 0.393 (x 4) y = 0.393x + 3.428
310
NUMERICAL ANALYSIS
Solution. We have x = 26.7, x = 4.6, and r = 0.52 byx = r y x = (0.52) 36.8 = 4.16 4. 6 y = 508.4
y = 36.8
y 508.4 = 4.16 (x 26.7) y = 397.328 + 4.16x y = 397.328 + 4.16 (29) = 517.968 kgs. x x = bxy ( y y )
x 26.7 = 0.065 (y 508.4) x = 6.346 + 0.065x x = 6.346 0.065 600 = 32.654 cms y = 397.328 + 4.16 x
and
x = 6.346 + 0.065 y
When the rain fall is 29 cms the yield of crops is 517.968 kg and when the yield is 600 kg the temperature is 32.654 cms. Example 14.5. Find the most likely price of a commodity in Bombay corresponding to the price of Rs.70. at Calcutta from the following Calcutta Average price Standard deviation 65 2.5 y = 67 y = 3.5 and r = 0.8 (x x) Bombay 67 3.5
Correlation coefficient between the price of commodity in the two cities is 0.8. Solution. We have x = 65, x = 2.5, yy = r y x
y 67 = ( 0.8) .
REGRESSION ANALYSIS
311
When
y = 67 + 1.12x 72.8 y = 1.12x y = 5.8 + 1.12x x = 70; y = 5.8 + 1.12 70 = 5.8 + 78.4 y = 72.60
The price of the commodity in Bombay corresponding to Rs. 70 at Calcutta is 72.60. Example 14.6. The regression equation calculated from a given set of observation x = 0.4y + 6.4 and Calculate x , y and rxy . Solution. We have and From (2), we have From (1) we have x = 0.4y + 6.4 y = 0.6x + 4.6 y = 0. 6 ( 0. 4 y + 6. 4) + 4. 6 (using (1)) y = 0.24y 3.84 + 4.6 0.76y = 0.76 y = 1 y = 0.4 1 + 6.4 = 6.0 ...(1) ...(2) y = 0.6x + 4.6
x = 1,
y = 6
Clearly, equation (1) in the regression equation x or y and equation (2) is the regression equation y on x. We have and bxy = 0.4 and byx = 0.6 r 2 = ( 0.4) ( 0.6) = 0.24 r = rxy = 0. 24 Since bxy and byx are both negative r = rxy is negative rxy = 0. 24 Example 14.7. Show that the coefficient of correlation is the Geometric mean (G.M.) of the coefficients of regression. y x Solution. The coefficients of regression are r and r y x Geometric mean of the regression coefficients is
y x .r y x
r 2 = r = coefficient of correlation.
312
NUMERICAL ANALYSIS
Example 14.8. In a partially destroyed laboratory record of an analysis of correlation data; the following results only are legible: variance of x = 9 Regression equations: 8x 10y + 66 = 0, 40x 18y = 214 What were (a) the mean values of x and y (b) the standard deviation of y (c) the coefficient of correlation between x and y. Solution. i.e., Solving the regression equations 8x 10y + 66 = 0 40x 18y = 214 We obtain x = 13, y = 17. ...(1) ...(2) Variance of x = 9 2 x = 9 x = 3
Since the point of intersection of the regression lines is ( x , y ) we have ( x , y ) = ( x , y ) = (13, 17 ) The regression (1) and (2) can written as y = 0.8x + 6.6 and The regression coefficient of y on x is r and the regression coefficient of x on y is r Multiplying (5) and (6), we get r 2 = 0.45 0.8 r 2 = 0.36 r = 0.6 y x y 3 x y = 0.45 ...(6) y x = 0.8 ...(5) x = 0.45y + 5.35 ...(3) ...(4)
x = 13,
y = 17
Putting the values of r and x in (5), we get the value of y as follows: r = 0.8
(0.6)
= 0.8
y =
0.8 =4 0.2
REGRESSION ANALYSIS
313
Example 14.9. If one of the regression coefficients is greater than unity. Show that the other regression coefficient is less than unity. Solution. Let one of regression coefficient; say byx > 1 Then Since, We have byx > 1 1 <1 byx
FQ 1 < 1I GH b JK
yx
Example 14.10. Show that the arithmetic mean of the regression coefficients is greater than the correlation coefficient. Solution. We have to show that Consider ( y x ) 2 Clearly
( y x )2 > 0
byx + bxy 2
>r
2 y y x
y x r y x
Hence proved.
+r
byx + bxy 2
> r
Example 14.11. Given that x = 4y + 5 and y = kx + 4 are two lines of regression. Show that 0 k If k =
1 . 4
314
NUMERICAL ANALYSIS
x = 4y + 5 y = kx + 4
bxy = 4 byx = k
1 4
r = 0.7071
1 ; 8
r2 = 4 .
1 1 = 8 2
y = kx + 4 y =
1 x+4 8
i.e.,
x = 42,
bxy byx 2 x 2 y r
y = 9. 25
x y x . x 4 = = 32 = = 1 . y y y r 8 x
FG IJ HK
= 32
REGRESSION ANALYSIS
315
is one of finding the equation of the plane which best fits in the sense of least squares a set of n points in (k + 1) dimension. The normal equations are:
na0 + a1x1 + a2 x2 + ... + ak xk = y
2 + a2 x1x2 + ... + ak x1 xk = x1 y a0 x1 + a1x1
M
2 ak xk
a0 xk + a1x1 xk + ... +
= xk y
If there are two independent variables say x1 and x2, the normal equations are
na0 + a1x1 + a2 x2 = y
2 + a2 x1x2 = x1 y a0 x1 + a1x1 2 = x2 y a0 x2 + a1x1 x2 + a2 x2
y = a0 + a1 x1 + a2 x2
Example. 1 From the table given below, find out (a) the least square regression equation of x0 and x1 and (b) determine x0 from the given values of x1 and x2 and (c) find the values of x0 when x1 = 54 and x2 = 9 given x0 x1 x2 64 57 8 71 59 10 53 49 6 67 62 11 55 51 8 58 50 7 77 55 10 57 48 9 56 52 6 51 42 6 76 61 12 68 57 9
Solution. (a) The regression equation of x0 on x1 and x2 is x0 = a0 + a1x1 + a2 x2 The normal equations to determine a0 , a1 , a2 are na0 + a1x1 + a2 x2 = x0
2 a0 x1 + a1x1 + a2 x1x2 = x0 x1 2 = x x a0 x2 + a1x1x2 + a2 x2 0 2
(b) x0 64 71 53 x1 57 59 49 x2 8 10 6
2 x1 2 x2
3249
64 100 36
3481 2401
316
NUMERICAL ANALYSIS
67 55 58 77 57 56 51 76 68 753
62 51 50 55 48 52 42 61 57 643
11 8 7 10 9 10 6 12 9 106
3844 2601 2500 3025 2304 2704 1764 3721 3249 38,843
4154 2805 2900 4235 2736 2912 2142 4638 3876 40,830
737 440 406 770 513 560 306 912 612 6,796
682 408 350 550 432 520 252 732 513 5,779
The normal equation are 12 a0 + 643a1 + 106a2 = 753 643a0 + 34843a1 + 577a2 = 40,830 106a0 + 5779 a1 + 976a2 = 6.796 Solving the equations (1), (2) and (3), we get a 0 = 3.6512, a1 = 0.8546, a2 = 1.5063 The regression equation is x0 = 3.6512 + 0.8546x1 + 1.5063x2 (c) When x1 = 54, x2 = 9, from equation (4), We get The regression equation is x0 = 3.6512 + (0.8546) (54) + (1.5063) (9) x0 = 63.356 x0 = 3.6512 + 0.8546x1 + 1.5063x2 ...(4) ...(1) ...(2) ...(3)
Exercise 4.1
1. Heights of fathers and sons are given below in inches Height of father Height of son 65 67 66 68 67 64 67 68 68 72 69 70 71 69 73 70
REGRESSION ANALYSIS
317
form the lines of regression and calculate the expected average height of the son when the height of the father is 67.5 inches. Hint: let 69 = x and 69 = y (assumed means), then we have x 65 66 67 67 68 69 71 73 y 67 68 64 68 72 70 69 70 u 4 3 2 2 1 0 2 4 6
x = x+ y = y+
v 2 1 5 1 3 1 0 1 4
u2 16 9 4 4 1 0 4 16 54
v2 4 1 25 1 9 1 0 1 42
uv 8 3 10 2 3 0 0 4 24
u 6 = 69 = 68.25 x 8 v 4 = 69 = 68.5 x 8
2
2 x
54 6 8 8
2 y =
FG IJ H K 42 F 4 I G J 8 H 8K
= 6.1875 x = 2. 49
2
42 1 8 2
FG IJ H K
= 5 y = 2. 23
r =
F 54 9 I (42 2) H 2K
24 3
= 0.47
When fathers height is 67.5. The sons age is 68.19 inches. 2. For the following data, determine the regression lines. x: y: 3. 6 9 2 11 10 5 4 8 8 7
Find the regression equations for the following data Age of husband : (x) Age of wife (y) : 36 29 23 18 27 20 28 22 28 27 29 21 30 29 31 27 33 29 35 28
318
NUMERICAL ANALYSIS
4.
By the method of least squares find the regression of y and x and find the value of y when x = 4. Also find the regression equation x on y and find the value of x when y = 24: Use the table given below x: y: 1 15 3 18 5 21 7 23 9 22
5.
Using the method of least squares find the two regression equation for the data given below x: y: 5 20 10 40 15 30 20 60 25 50
6.
7.
From the following data, obtain the two regression equations Sales (x) : Purchase (y) : 91 71 97 75 108 69 121 97 67 70 124 91 51 39
8.
Find the regression equations for the following data Age of Husband : (x) Age of wife (y) : 36 29 23 18 27 20 28 22 28 27 29 21 30 29 31 27 33 29 35 28
9. 10.
Find the equation of regression lines for the following pairs (x, y) for the variables x and y. (1, 2), (2, 5), (3, 3), (4, 8), (5, 7) From the following data find the yield of wheat in kg per unit area when the rain fall is 9 inches Means Yield of Wheat per unit (in kg) Annual rainfall (in inches) 10 8 S.D. 8 2
Show that regression coefficients are independent of the change of origin but not the change of scale. Given xi = 60, yi = 40, xi yi = 1,150, xi2 = 4,160, yi2 = 1, 720, x = 10. Find the regression equation of x or y also find r. Using the data given below find the demand when the price of the quantity is Rs. 12.50 Price (Rs.) Means Standard deviation Coefficient of correlation (r) = 0.8. 10 2 Demand (000 units) 35 5
14.
Find the mean of xi and yi ; also find the coefficient of correlation: given 2y x 50 = 0 2y 2x 10 = 0
REGRESSION ANALYSIS
319
15.
From the following data obtain the two regression equations and calculate the correlation coefficient: x: y: 1 9 2 8 3 10 4 12 5 11 6 13 7 14 8 16 9 15
16.
From the information given below find (a ) (b ) (c) the regression equation of y on x the regression equation of x on y the mostly likely value of y when x = 100
Answer
2. 3. 4. 5. 6. 7. 8. 9. 10. 12. 13. 14. 15. 16. y = 11.9 0.65x x = 16.4 1.3y y = 1.739 + 0.8913x x = 11.25 + 0.75y y = 15.05 + 0.95x, the value of y when x = 4 is 18.85 x = 12.58 + 0.888y and the value of x when y = 24 is 8.73. y = 16 + 1.6x and x = 1 + 0.4 y y = 4.16 0.3x y = 15.998 + 0.607x, x = 0.081 + 1.286y y = 1.739 + 0.8913x x = 11.25 + 0.75y y = 1.1 + 1.3x x = 0.5 + 0.5y 12 kg x = 3.68 + 0.58y, r = 0.37 y = 15 + 2x; demand = 40,000 units
BIBLIOGRAPHY
1. Ahlberg, J.H., Nilson, E.N., and Walsh, J.L., The Theory of Splines and their Applications, Academic Press, N.Y., 1967. 2. Ames, W.F., Numerical Methods for Partial Differential Equations, second edn., Academic Press, N.Y., 1977. 3. Atkinson, K.E., An Introduction to Numerical Analysis, John Wiley & Sons, N.Y., 1978. 4. Berndt, R. (Ed.), Ramanujans Note Books, Part I, Springer Verlag, N.Y., 1985. 5. Booth, A.D., Numerical Methods, Academic Press, N.Y., 1958. 6. Collatz, L., Numerical Treatment of Differential Equations, third edn., Springer Verlag, Berlin, 1966. 7. Conte, S.D., Elementary Numerical Analysis, McGraw Hill, 1965. 8. Datiquist, G., and A. Bjorek, Numerical Methods, Prentice-Hall, Englewood Cliffs, N.Y., 1974. 9. Davis, P.Y., Interpolation and Approximation, Blaisedell, N.Y., 1963. 10. Hildebrand, F.B., Introduction of Numerical Analysis, McGraw Hill, N.Y., London, 1956. 11. Householder, A.S., Principles of Numerical Analysis, McGraw Hill, N.Y., 1953. 12. Isascon, E., and H.B. Keller, Analysis of Numerical Methods, John Wiley, N.Y., 1966. 13. Jain, M.K., Numerical Solution of Differential Equations, second edn., John Wiley N.Y., 1977. 14. Mitchell, A.R., and D.F. Griffiths, The Finite Difference Method in Partial Differential Equations, John Wiley, N.Y., 1980. 15. Todd, Y., Survey of Numerical Analysis, McGraw Hill, N.Y., 1962. 16. Traub, J.F., Iterative Methods for the Solutions of Nonlinear Equations, Prentice-Hall, Englewood Cliffs, 1964. 17. Wachspress, E.L., Iterative Solution of Elliptic Systems, Prentice-Hall, Englewood Cliffs, N.Y., 1966. 18. Wait, R., The Numerical Solution of Algebraic Equations, John Wiley, N.Y., 1979. 19. Young, D.M., Iterative Solution of Large Linear Systems, Academic Press, N.Y., 1971. 20. Young, D.M., and R.T. Gregory, A Survey of Numerical Mathematics, 1,2, Addison-Wesley, Reading, Mass., 1972.
320
INDEX
321
INDEX
Absolute error 4 Adams BashMoulton method 230 Approximate numbers 1 Argument 62 Backward interpolation formula Newtons 104 Bessels formula 137 Bisection method 22 Booles rule 200, 201 Central difference formulae Table 134, 135 Characteristic equation 282 convergence of Newtons method 44 rate of 45 Cotes number 197 Graphical solution 20 Diagonal difference table 61 Difference(s), finite 60 first 60 second 60, 62 table 61, 62 Divided difference 116 properties 118 table 117 Gaussian interpolation formulae 134, 136 Gauss elimination method 250 GaussJacobis method 253, 254 GaussSeidal method 256, 257 General error formula 10 GaussainLegendre quadrature formula 1180 Factorial polynomial 76 Forward interpolation, Newtons 98 Eigen value(s) 282, 283 eigen vector(s) 282, 283 Everetts formula 139 Even digit rule 3 Errors 3 absolute 5 error, limiting relative 5, 7 general formula 10
Double (of higher order) integration 205, 206 Differencing interval 60 Differentiation numerical 164 Differential equation 212
321
322
NUMERICAL ANALYSIS
Iteration method 25 Newtons 33 Integration numerical 178 Inverse interpolation 151 Jacobis method 253, 254 Matrix inversion 248, 249 Milnes method 224, 225 Newton binomial expansion formula 96 NewtonCotes formula 195, 196, 197 Newton method 36 NewtonRaphson method 33 Numerical differentiation 164 Operator difference 60 backward 166 central difference 83 displacement (shift) 69 forward 60
Predictor corrector method 224-240 Picard method 242, 243 Regression analysis 300 Rounding off numbers 2 rule 2 RungeKutta method 233 Romberg integration 201-203 Separation of symbols 86 Significant digits 1 Simpsons one-third rule 181, 182 three-eighths rule 182, 183, 184 Stirlings formula 138 Taylors series 213, 214 Trapezoidal rule 180, 181 Weddles rule 184, 185