Signaler

Rai UniversitySuivre

15 Mar 2015•0 j'aime•3,145 vues

15 Mar 2015•0 j'aime•3,145 vues

Signaler

Formation

Course: MCA Subject: Computer Oriented Numerical Statistical Methods Unit-1 Solution of Non-linear Equations RAI UNIVERSITY, AHMEDABAD

- 1. RAI UNIVERSITY, AHMEDABAD 1 Course: MCA Subject: Computer Oriented Numerical Statistical Methods Unit-1 RAI UNIVERSITY, AHMEDABAD
- 2. RAI UNIVERSITY, AHMEDABAD 2 Unit-I- Solution of Non-linear Equations Sr. No. Name of the Topic Page No. 1 Absolute, Relative and Percentage Error 1 2 Roots ofan equation, Linear and non-Linear equations (Definition and Difference), 4 3 Iterative Methods for finding roots of non-Linear equations : Bisection Method 5 4 Iterative Methods for finding roots of non-Linear equations : Newton-Raphson Method 14 5 Iterative Methods for finding roots of non-Linear equations : False Position Method 18 6 Iterative Methods for finding roots of non-Linear equations : secant Method 25 7 Exercise 29 8 References 30
- 3. RAI UNIVERSITY, AHMEDABAD 3 1.1 Errors In practice, all measurements are subject to errors and it is therefore of importance to find the total effect of small errors in the observed values of the variables, on a quantity which depends on these variables. If 𝛿𝑥 is an error in 𝑋 then | 𝛿𝑥| = | 𝑇𝑟𝑢𝑒 𝑣𝑎𝑙𝑢𝑒 − 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒 𝑣𝑎𝑙𝑢𝑒| is called an absolute error in 𝑋, 𝛿𝑥 𝑥 is called the relative error in 𝑋 and 𝛿𝑥 𝑥 × 100 is called the percentage error in 𝑋. Example— A circle of radius 𝒓 = 𝟓 cm having an error in radius 𝟏𝟎% ,then find percentage errorin its area. Solution: Area of circle 𝐴 = 𝜋𝑟2 ∴ 𝐴 = 𝜋𝑟2 ⇒ 𝛿𝐴 = 2𝜋𝑟𝛿𝑟 Now 𝛿𝐴 𝐴 = 2𝜋𝑟𝛿𝑟 𝜋 𝑟2 𝛿𝐴 𝐴 = 2𝛿𝑟 𝑟 ∴ 𝛿𝐴 𝐴 × 100 = 2( 𝛿𝑟 𝑟 × 100) ∴ 𝛿𝐴 𝐴 × 100 = 2(10) ∴ 𝛿𝐴 𝐴 × 100 = 20 Therefore percentage error in Area of circle is 20. Example—
- 4. RAI UNIVERSITY, AHMEDABAD 4 A cuboid having error in their sides equal to 𝟐%, 𝟓% 𝒂𝒏𝒅 𝟏%. Then find the corresponding error in its volume. Solution: Volume of cuboid is 𝑉 = 𝑙 × 𝑤 × ℎ 𝛿𝑉 = 𝑤ℎ𝛿𝑙 + 𝑙ℎ𝛿𝑤 + 𝑤𝑙𝛿ℎ Now we have to given that, 𝑙 = 2%, 𝑤 = 5%,ℎ = 1% 𝛿𝑉 𝑉 = 𝑤ℎ𝛿𝑙+𝑙ℎ𝛿𝑤+𝑤𝑙𝛿ℎ 𝑙×𝑤×ℎ 𝛿𝑉 𝑉 × 100 = ( 𝛿𝑙 𝑙 + 𝛿ℎ ℎ + 𝛿𝑤 𝑤 ) × 100 𝛿𝑉 𝑉 × 100 = ( 𝛿𝑙 𝑙 × 100)+ ( 𝛿ℎ ℎ × 100)+ ( 𝛿𝑤 𝑤 × 100) 𝛿𝑉 𝑉 × 100 = 2 + 5 + 1 𝛿𝑉 𝑉 × 100 = 8 Error in Volume of cuboid = 8% Example— A right circular cone of radius 𝒓 = 𝟏𝟎 𝒄𝒎 & ℎ = 20 𝑐𝑚 having percentage error in radius equal to 𝟏% and percentage errorin height equal to 𝟓% then find (i) Absolute error (ii) Relative error (iii) Percentageerror in the volume of right circular cone. Solution: Volume of right circular cone 𝑉 = 1 3 𝜋𝑟2 ℎ 𝛿𝑉 = 1 3 2𝑟𝛿𝑟ℎ + 1 3 𝜋𝑟2 𝛿ℎ
- 5. RAI UNIVERSITY, AHMEDABAD 5 Now we have to given that 𝑟 = 10 𝑐𝑚,ℎ = 20 𝑐𝑚 , 𝛿𝑟 𝑟 × 100 = 1, 𝛿ℎ ℎ × 100 = 5 𝛿𝑟 = 1×𝑟 100 & 𝛿ℎ = 5×ℎ 100 𝛿𝑉 = 1 3 𝜋 [2 × 𝑟 × ℎ × ( 1×𝑟 100 ) + 𝑟2 ( 5×ℎ 100 )] 𝛿𝑉 = 1 3 𝜋 [2 × 10 × 20 × 1×10 100 + 10×10×5×20 100 ] 𝛿𝑉 = 1 3 𝜋[40+ 100] 𝛿𝑉 = 1 3 𝜋[140] 𝛿𝑉 = 146.53 ∴Absolute error 𝛿𝑉 = 146.53 ⇒ 𝛿𝑉 𝑉 = 146.53 1 3 𝜋𝑟2ℎ = 3×146.53 𝜋×100×20 ∴ 𝛿𝑉 𝑉 = 439.59 6283 = 0.06996 ≅ 0.07 ∴ Relative error 𝛿𝑉 𝑉 = 0.07 𝛿𝑉 𝑉 × 100 = 0.07× 100 = 7 ∴ Percentage error = 7% 2.1 Linear equation— General form of a linear equation is— 𝑎𝑥 + 𝑏𝑦 = 𝑐, where 𝑎, 𝑏 and 𝑐 are constants. 2.2 Graph of a linear equation— An equation 𝑎𝑥 + 𝑏𝑦 = 𝑐 represents a straight line. 2.3 Solution of two linear equations— Solution of two linear equations 𝑎1 𝑥 + 𝑏1 𝑦 = 𝑐1 and 𝑎2 𝑥 + 𝑏2 𝑦 = 𝑐2 is given by— 𝑥 = 𝑐1 𝑏2−𝑐2 𝑏1 𝑎1 𝑏2−𝑎2 𝑏1 and 𝑦 = 𝑐2 𝑎1−𝑐1 𝑎2 𝑎1 𝑏2−𝑎2 𝑏1 . Graphically this solution gives the point of intersection of these straight lines.
- 6. RAI UNIVERSITY, AHMEDABAD 6 Example— Find the solution of the equations 𝒙 + 𝟐𝒚 = 𝟑 and 𝟑𝒙 + 𝒚 = 𝟒. Solution— given straight lines are 𝑥 + 2𝑦 = 3 and 3𝑥 + 𝑦 = 4. Here, 𝑎1 = 1, 𝑏1 = 2, 𝑐1 = 3, 𝑎2 = 3, 𝑏2 = 1, 𝑐2 = 4 Hence, 𝑥 = 𝑐1 𝑏2−𝑐2 𝑏1 𝑎1 𝑏2−𝑎2 𝑏1 = 3.1−4.2 1.1−3.2 = 3−8 1−6 = 1 and 𝑦 = 𝑐2 𝑎1−𝑐1 𝑎2 𝑎1 𝑏2−𝑎2 𝑏1 = 4.1−3.3 1.1−3.2 = 4−9 1−6 = 1 2.4 Definition: Non-linear equation: A polynomial of degree at least 2 is called non- linear equation. Graph of a non-linear equation is not a straight line. e.g.𝑥3 − 3𝑥 + 1 = 0, 𝑐𝑜𝑠𝑥 − 𝑥𝑒 𝑥 = 0. 2.5 Here we use Numerical Methods for solving Non-linear equations like Bisection Method Regula-Falsi Method Newton-Raphson Method Secant Method 3.1 Introduction— In the Applied mathematics and engineering the problem of determining the roots of an equation 𝑓(𝑥) = 0 has a great importance. If 𝑓(𝑥) is a polynomial of degree two or more , we have formulae to find solution. But, if f(x) is a transcendental function, we do not have formulae to obtain solutions. When such type of equations are there, we have some methods like Bisection method, Newton-Raphson Method and The method
- 7. RAI UNIVERSITY, AHMEDABAD 7 of false position. Thosemethods are solved by using a theorem in theory of equations, i.e., “If f(x) is continuous in the interval (𝑎, 𝑏) and if 𝑓(𝑎) and 𝑓(𝑏) are of opposite signs, then the equation 𝑓(𝑥) = 0 will have at least one real root between 𝑎and 𝑏”. 3.2 Definition— A number ξ is a solution of f(x) = 0 if f(ξ) = 0 . Such a solution ξ is a rootof f(x) = 0. 3.3 Iterative Method— This method is based on the idea of successiveapproximation.i.e. Starting with one or more initial approximations to the root, we obtain a sequence of approximations or iterates { 𝑥 𝑘 }, which in the limit converges to the root. Definition— A sequence of iterates { 𝑥 𝑘 } is said to converge to the root 𝜉, if lim 𝑘⟶∞ | 𝑥 𝑘 − ξ| = 0 𝑜𝑟 lim 𝑘⟶∞ 𝑥 𝑘 = ξ. 3.4 BisectionMethod— Let us supposewe have an equation of the form 𝑓(𝑥) = 0 in which solution lies between in the range (𝑎, 𝑏). Also 𝑓(𝑥) is continuous and it can be algebraic or transcendental. If 𝑓(𝑎) and 𝑓(𝑏)are oppositesigns, then there exist at least one real root between 𝑎and 𝑏.
- 8. RAI UNIVERSITY, AHMEDABAD 8 Let 𝑓(𝑎) be positive and 𝑓(𝑏) negative. Which implies at least one root exits between a and b. We assume that root to be 𝑥0 = (𝑎+𝑏) 2 . Check the sign of 𝑓(𝑥0). If 𝑓(𝑥0)is negative, the root lies between a and xo. If 𝑓( 𝑥0)is positive, the root lies between 𝑥0and b. Subsequently any one of this case occur. 𝑥1 = 𝑎+𝑥0 2 or𝑥1 = 𝑥0+𝑏 2 When 𝑓(𝑥1)is negative, the root lies between 𝑥0and 𝑥1 and let the root be 𝑥2 = 𝑥0+𝑥1 2 . Again𝑓(𝑥2)negative then the root lies between 𝑥0and 𝑥2, let 𝑥3 = 𝑥1+𝑥2 2 and so on. Repeat the process𝑥0,𝑥1, 𝑥2,…Whoselimit of convergence is the exact root. 3.5 Steps—
- 9. RAI UNIVERSITY, AHMEDABAD 9 1. Find a and b in which f(a) and f(b) are oppositesigns for the given equation using trial and error method. 2. Assume initial root as 𝑥0 = (𝑎 + 𝑏) 2 3. If 𝑓(𝑥0) is negative, the root lies between a and 𝑥0 . And takes the root as 𝑥1 = (𝑎 + 𝑥0) 2 4. If 𝑓(𝑥0)is positive, then the root lies between 𝑥0 and b.And takes the root as 𝑥1 = (𝑥0 + 𝑏) 2 5. If 𝑓(𝑥1) is negative, the root lies between 𝑥0and 𝑥1 . And takes the root as 𝑥2 = (𝑥0 + 𝑥1) 2 6. If 𝑓(𝑥1) is positive, the root lies between 𝑥0and 𝑥2 . And takes the root as 𝑥2 = (𝑥0 + 𝑥2) 2 7. Repeat the process until any two consecutive values are equal and hence the root.
- 10. RAI UNIVERSITY, AHMEDABAD 10 This method is simple to use and the sequence of approximations always converges to the root for any 𝑓(𝑥) which is continuous in the interval that contains the root. If the permissible error is𝜀, then the approximation number of iteratives required may be determined from the relation 𝑏0−𝑎0 2 𝑛 ≤ 𝜀. The minimum number of iterations required for converging to a root in the interval (0,1) for a given 𝜀 are listed as Number of iterations 𝜺 𝟏𝟎−𝟐 𝟏𝟎−𝟑 𝟏𝟎−𝟒 𝟏𝟎−𝟓 𝟏𝟎−𝟔 𝟏𝟎−𝟕 n 7 10 14 17 20 24 The bisection method requires a large number of iterations to achieve a reasonable degree of accuracy of the root. It requires one function at each iteration. Example— Find the positive root of 𝒙 𝟑 − 𝒙 = 𝟏correctto four decimal places by bisection method. Solution— Let 𝑓( 𝑥) = 𝑥3 − 𝑥 − 1 𝑓(0) = 03 − 0 − 1 = −1 = −𝑣𝑒 𝑓(1) = 13 − 1 − 1 = −1 = −𝑣𝑒 𝑓(2) = 23 − 2 − 1 = 5 = +𝑣𝑒 So the root lies between the 1 and 2. We can take 𝑥0 = 1+2 2 = 3 2 = 1.5 as initial root and proceed. i.e., 𝑓(1.5) = 0.8750 = +𝑣𝑒 and 𝑓(1) = −1 = −𝑣𝑒
- 11. RAI UNIVERSITY, AHMEDABAD 11 So the root lies between 1 and 1.5. 𝑥1 = 1 + 1.5 2 = 2.5 2 = 1.25 as initial root and proceed. 𝑓(1.25) = −0.2969 So the root 𝑥2lies between 1.25 and 1.5. Now 𝑥2 = 1.25+ 1.5 2 = 2.75 2 = 1.3750 𝑓(1.375) = 0.2246 = +𝑣𝑒 So the root 𝑥3lies between 1.25 and 1.375. Now 𝑥3 = 1.25+ 1.3750 2 = 2.6250 2 = 1.3125 𝑓(1.3125) = −0.051514 = −𝑣𝑒 Therefore, root lies between 1.375and 1.3125 Now 𝑥4 = ( 1.375 + 1.3125) / 2 = 1.3438 𝑓(1.3438) = 0.082832 = +𝑣𝑒 So root lies between 1.3125 and 1.3438 Now 𝑥5 = ( 1.3125 + 1.3438) / 2 = 1.3282
- 12. RAI UNIVERSITY, AHMEDABAD 12 𝑓(1.3282) = 0.014898 = +𝑣𝑒 So root lies between 1.3125 and 1.3282 Now 𝑥6 = ( 1.3125 + 1.3282) / 2 = 1.3204 𝑓(1.3204) = −0.018340 = −𝑣𝑒 So root lies between 1.3204 and 1.3282 Now 𝑥7 = ( 1.3204 + 1.3282) / 2 = 1.3243 𝑓(1.3243) = −𝑣𝑒 So root liesbetween 1.3243and 1.3282 Now 𝑥8 = ( 1.3243 + 1.3282) / 2 = 1.3263 𝑓(1.3263) = +𝑣𝑒 So root lies between 1.3243 and 1.3263 Now 𝑥9 = ( 1.3243 + 1.3263) / 2 = 1.3253 𝑓(1.3253) = +𝑣𝑒 So root lies between 1.3243 and 1.3253 Now 𝑥10 = ( 1.3243 + 1.3253) / 2 = 1.3248 𝑓(1.3248) = +𝑣𝑒 So root lies between 1.3243 and 1.3248 Now
- 13. RAI UNIVERSITY, AHMEDABAD 13 𝑥11 = ( 1.3243 + 1.3248) / 2 = 1.3246 𝑓(1.3246) = −𝑣𝑒 So root lies between 1.3248 and 1.3246 Now 𝑥12 = ( 1.3248 + 1.3246) / 2 = 1.3247 𝑓(1.3247) = −𝑣𝑒 So root lies between 1.3247 and 1.3248 Now 𝑥13 = ( 1.3247 + 1.3247) / 2 = 1.32475 Hence the approximate root is 1.32475 . Example— Find the positive root of 𝒙– 𝒄𝒐𝒔 𝒙 = 𝟎 by bisection method. Solution— Let 𝑓( 𝑥) = 𝑥– 𝑐𝑜𝑠 𝑥 , 𝑓(0) = 0 − 𝑐𝑜𝑠 (0) = 0 − 1 = −1 = −𝑣𝑒 𝑓(0.5) = 0.5 –𝑐𝑜𝑠 (0.5) = −0.37758 = −𝑣𝑒 𝑓(1) = 1 – 𝑐𝑜𝑠 (1) = 0.42970 = +𝑣𝑒 So root lies between 0.5 and 1 Let 𝑥0 = (0.5 + 1) 2 = 0.75 as initial root and proceed. 𝑓(0.75) = 0.75 – 𝑐𝑜𝑠 (0.75) = 0.018311 = +𝑣𝑒 So root lies between 0.5 and 0.75
- 14. RAI UNIVERSITY, AHMEDABAD 14 𝑥1 = (0.5 + 0.75)/2 = 0.62 𝑓(0.625) = 0.625 – 𝑐𝑜𝑠 (0.625) = −0.18596 So root lies between 0.625 and 0.750 𝑥2 = (0.625 + 0.750) /2 = 0.6875 𝑓(0.6875) = −0.085335 So root lies between 0.6875 and 0.750 𝑥3 = (0.6875 + 0.750) /2 = 0.71875 𝑓(0.71875) = 0.71875 − 𝑐𝑜𝑠(0.71875) = −0.033879 So root lies between 0.71875 and 0.750 𝑥4 = (0.71875 + 0.750) /2 = 0.73438 𝑓(0.73438) = −0.0078664 = −𝑣𝑒 So root lies between 0.73438 and 0.750 𝑥5 = 0.742190 𝑓(0.742190) = 0.0051999 = + 𝑣𝑒 𝑥6 = (0.73438 + 0.742190) /2 = 0.73829 𝑓(0.73829) = −0.0013305 So root lies between 0.73829 and 0.74219 𝑥7 = (0.73829+ 0.74219) = 0.7402 𝑓(0.7402) = 0.7402 𝑐𝑜𝑠(0.7402) = 0.0018663 So root lies between 0.73829 and 0.7402 𝑥8 = 0.73925 𝑓(0.73925) = 0.00027593
- 15. RAI UNIVERSITY, AHMEDABAD 15 𝑥9 = 0.7388 The rootis 0.7388. 3.6 Advantages of bisection method— a) The bisection method is always convergent. Since the method brackets the root, the method is guaranteed to converge. b) As iterations are conducted, the interval gets halved. So one can guarantee the error in the solution of the equation. 3.7 Drawbacksofbisectionmethod— a) The convergence of the bisection method is slow as it is simply based on halving the interval. b) If one of the initial guesses is closer to the root, it will take larger number of iterations to reach the root. 4.1 Newton-Raphsonmethod (or Newton’s method)— Supposewe have an equation of the form 𝑓(𝑥) = 0, whose solution lies between the range( 𝑎, 𝑏).Also 𝑓(𝑥)is continuous and it can be algebraic or transcendental. If 𝑓(𝑎)and 𝑓(𝑏)are oppositesigns, then there exist at least one real root between 𝑎and 𝑏.
- 16. RAI UNIVERSITY, AHMEDABAD 16 Let 𝑓(𝑎)be positive and 𝑓(𝑏)negative. Which implies at least one rootexits in between 𝑎and 𝑏. We assume that root to be either a or b, in which the value of 𝑓(𝑎)or𝑓(𝑏) is very close to zero. That number is assumed to be initial root. Then we iterate the process byusing the following formula until the value is converges. 𝑥 𝑛+1 = 𝑥 𝑛 − 𝑓(𝑥 𝑛) 𝑓′(𝑥 𝑛) 4.2 Steps— 1. Find 𝑎and 𝑏 in which 𝑓(𝑎)and 𝑓(𝑏) are opposite signs for the given equation using trial and error method. 2. Assume initial root as 𝑥0 = 𝑎 i.e., if 𝑓(𝑎)is very close to zero or 𝑥0 = 𝑏 if 𝑓(𝑎)is very close to zero. 3. Find 𝑥1 by using the formula 𝑥1 = 𝑥0 − 𝑓(𝑥0) 𝑓′(𝑥0) 4. Find x2 by using the following formula 𝑥2 = 𝑥1 − 𝑓( 𝑥1) 𝑓′( 𝑥1) 5. Find x3, x4, .. . xn until any two successivevalues are equal . Example 1— Find the positive root of 𝒇(𝒙) = 𝟐𝒙 𝟑 − 𝟑𝒙 − 𝟔 = 𝟎by Newton– Raphson method correctto five decimal places. Solution— Let 𝑓(𝑥) = 2𝑥3 − 3𝑥 – 6 ; 𝑓 ′(𝑥) = 6𝑥2 – 3
- 17. RAI UNIVERSITY, AHMEDABAD 17 𝑥 𝑛+1 = 𝑥 𝑛 − 𝑓( 𝑥 𝑛) 𝑓′( 𝑥 𝑛) = 𝑥 𝑛 − 2𝑥 𝑛 3 − 3𝑥 𝑛 – 6 6𝑥 𝑛 2 – 3 = (6𝑥 𝑛 3 − 3𝑥 𝑛)–(2𝑥 𝑛 3 − 3𝑥 𝑛 – 6) 6𝑥 𝑛 2 – 3 = 6𝑥 𝑛 3 − 3𝑥 𝑛–2𝑥 𝑛 3 + 3𝑥 𝑛 + 6 6𝑥 𝑛 2 – 3 = 4𝑥 𝑛 3 + 6 6𝑥 𝑛 2 – 3 𝑓(1) = 2 − 3 − 6 = −7 = −𝑣𝑒 𝑓(2) = 16 – 6 − 6 = 4 = +𝑣𝑒 So, a root between 1 and 2 . In which 4 is closer to 0. Hence we assume initial root as 2. Consider 𝑥0 = 2 So 𝑥1 = 4𝑥0 3 + 6 6𝑥0 2 – 3 = 4 × 23 + 6 6 × 22 − 3 = 38 21 = 1.809524 𝑥2 = (4(1.809524)3 + 6)/(6(1.809524)2 − 3) = 29.700256/16.646263 = 1.784200 𝑥3 = (4(1.784200)3 + 6)/(6(1.784200)2 − 3) = 28.719072/16.100218 = 1.783769 𝑥4 = (4(1.783769)3 + 6)/(6(1.783769)2 − 3) = 28.702612/16.090991 = 1.783769 Since 𝑥3 and 𝑥4 are equal, hence rootis 1.783769 .
- 18. RAI UNIVERSITY, AHMEDABAD 18 Example 2— Using Newton’s method, find the rootbetween0 and 1 of 𝒙 𝟑 = 𝟔𝒙 – 𝟒 correct to 5 decimal places. Solution— Let 𝑓( 𝑥) = 𝑥3 − 6𝑥 + 4 𝑥 𝑛+1 = 𝑥 𝑛 − 𝑓( 𝑥 𝑛) 𝑓′( 𝑥 𝑛) = 𝑥 𝑛 − 𝑥 𝑛 3 − 6𝑥 𝑛 + 4 3𝑥 𝑛 2 − 6 = (3𝑥 𝑛 3 − 6𝑥 𝑛) − ( 𝑥 𝑛 3 − 6𝑥 𝑛 + 4) 3𝑥 𝑛 2 − 6 = 3𝑥 𝑛 3 − 6𝑥 𝑛 − 𝑥 𝑛 3 + 6𝑥 𝑛 − 4 3𝑥 𝑛 2 − 6 = 2𝑥 𝑛 3 − 4 3𝑥 𝑛 2 − 6 𝑓(0) = 4 = +𝑣𝑒; 𝑓(1) = −1 = −𝑣𝑒 So a root lies between 0 and 1 𝑓(1)is nearer to 0. Therefore we take initial root as 𝑥0 = 1 𝑥1 = 2𝑥 𝑛 3 − 4 3𝑥 𝑛 2 − 6 = 2 × 13 − 4 3 × 12 − 6 = 2 − 4 3 − 6 = −2 −3 = 0.66666 𝑥2 = (2(0.66666)3 – 4 )/(3(0.66666)2 − 6) = 0.73016 𝑥3 = (2(0.73015873)3 – 4 )/(3(0.73015873)2 − 6) = (3.22145837/ 4.40060469) = 0.73205 𝑥4 = (2(0.73204903)3 – 4 )/(3(0.73204903)2 − 6) = (3.21539602/ 4.439231265) = 0.73205 The root is 0.73205 correct to 5 decimal places. 4.3 Advantages of NewtonRaphsonmethod—
- 19. RAI UNIVERSITY, AHMEDABAD 19 Fast convergence! 4.4 DisadvantagesofNewtonRaphsonmethod— a) May not producea root unless the starting value 𝑥0 is close to the actual root of the function. b) May not producea root if for instance the iterations get to a point 𝑥 𝑛−1such that 𝑓′( 𝑥 𝑛−1) = 0 . then the method is false. 5.1 Method of False Position ( or RegulaFalsi Method )— Let us consider the equation f(x) = 0and f(a) and f(b) are of oppositesigns. Also let a < 𝑏. The graph y = f(x) will meet the x-axis at some point between A(a, f(a)) and B (b,f(b)).The equation of the chord joining the two points A(a,f(a)) and B (b,f(b)) is 𝑦 – 𝑓(𝑎) 𝑥 − 𝑎 = 𝑓(𝑎) − 𝑓(𝑏) 𝑎 − 𝑏 The x- Coordinate of the point of intersection of this chord with the x-axis gives an approximate value for the of 𝑓(𝑥) = 0. Taking y = 0 in the chord equation, we get – 𝑓(𝑎) 𝑥 − 𝑎 = 𝑓(𝑎) − 𝑓(𝑏) 𝑎 − 𝑏 ⟹ 𝑥[𝑓(𝑎) − 𝑓(𝑏)] − 𝑎 𝑓(𝑎) + 𝑎 𝑓(𝑏) = −𝑎 𝑓(𝑎) + 𝑏 𝑓(𝑎) ⟹ 𝑥[ 𝑓( 𝑎) − 𝑓( 𝑏)] = 𝑏 𝑓( 𝑎) − 𝑎 𝑓( 𝑏) ⟹ 𝑥 = 𝑏 𝑓( 𝑎) − 𝑎 𝑓( 𝑏); 𝑓( 𝑎) − 𝑓( 𝑏) This 𝑥1gives an approximate value of the root (𝑥) = 0.(𝑎 < 𝑥1 < 𝑏) .
- 20. RAI UNIVERSITY, AHMEDABAD 20 Now 𝑓(𝑥1) and 𝑓(𝑎) are of opposite signs or 𝑓(𝑥1) and 𝑓(𝑏) are oppositesigns. If𝑓( 𝑥1).𝑓(𝑎) < 0 . Then 𝑥2 lies between 𝑥1 and a. 𝑥2 = 𝑎 𝑓( 𝑥1)– 𝑥1 𝑓( 𝑏) 𝑓( 𝑥1) − 𝑓( 𝑎) This process ofcalculation of 𝑥3, 𝑥4, 𝑥5 … is continued till any two successive values are equal and subsequently we get the solution of the given equation. 5.2 Steps— 1. Find a and b in which f(a) and f(b) are oppositesigns for the given equation using trial and error method. 2. Therefore root lies between 𝑎and 𝑏 if f(a)is very close to zero select and compute 𝑥1 by using the following formula: 𝑥1 = 𝑎𝑓( 𝑏) − 𝑏𝑓(𝑎) 𝑓( 𝑏) − 𝑓(𝑎)
- 21. RAI UNIVERSITY, AHMEDABAD 21 3. If (𝑥1 ),𝑓(𝑎) < 0 . then root lies between 𝑥1 and 𝑎 .Compute 𝑥2 by using the following formula: 𝑥2 = 𝑎𝑓( 𝑥1) − 𝑥1 𝑓(𝑏) 𝑓( 𝑥1) − 𝑓(𝑎) 4. Calculate the values of 𝑥3 , 𝑥4 , 𝑥5 , … by using the above formula until any two successivevalues are equal and subsequently we get the solution of the given equation. Example — Solve for a positive rootof 𝒙 𝟑 − 𝟒𝒙 + 𝟏 = 𝟎 by and Regula Falsimethod Solution— Let 𝑓(𝑥) = 𝑥3 − 4𝑥 + 1 = 0 𝑓(0) = 03 − 4 (0) + 1 = 1 = +𝑣𝑒 𝑓(1) = 13 − 4(1) + 1 = −2 = −𝑣𝑒 So a root lies between 0 and 1 We shall find the root that lies between 0 and 1. Here 𝑎 = 0, 𝑏 = 1 𝑥1 = 0 × 𝑓(1) − 1 × 𝑓(0) 𝑓(1) − 𝑓(0) = 0 × (−2) − 1 × 1 (−2) − 1 = 0 − 1 −3 = 1 3 = 0.333333 𝑓(𝑥1) = 𝑓(1/3) = (1/27) − (4/3) + 1 = −0.2963 Now 𝑓(0) and 𝑓(1/3) are oppositein sign. Hence the root lies between 0 and 1/3.
- 22. RAI UNIVERSITY, AHMEDABAD 22 𝑥2 = 0 × 𝑓 ( 1 3 ) − 1 3 𝑓(0) 𝑓 ( 1 3 ) − 𝑓(0) = −0.3333 −0.2963 − 1 = −0.3333 −1.2963 = 0.25714 Now 𝑓(𝑥2) = 𝑓(0.25714) = − 0.011558 = −𝑣𝑒 So the root lies between 0 and 0.25714 𝑥3 = 0 × 𝑓(0.25714) − 0.25714 × 𝑓(0) 𝑓(0.25714) – 𝑓(0) = − 0.25714 −1.011558 = 0.25420 𝑓(𝑥3) = 𝑓(0.25420) = −0.0003742 So the root lies between 0 and 0.25420 𝑥4 = 0 × 𝑓(0.25420) − 0.25420 × 𝑓(0) 𝑓(0.25420) – 𝑓(0) = −0.25420 / −1.0003742 = 0.25410 𝑓(𝑥4) = 𝑓(0.25410) = − 0.000012936 The rootlies between 0 and 0.25410 𝑥5 = 0 × 𝑓(0.25410) − 0.25410 × 𝑓(0) 𝑓(0.25410) – 𝑓(0) = −0.25410 / −1.000012936 = 0.25410 Hence the root is 0.25410. Example 2— Find an approximate root of x log 10𝑥 – 1.2 = 0 by False position method.
- 23. RAI UNIVERSITY, AHMEDABAD 23 Solution— Let 𝑓(𝑥) = 𝑥 𝑙𝑜𝑔10𝑥 – 1.2 𝑓(1) = −1.2 = −𝑣𝑒; 𝑓(2) = 2 × 0.30103 − 1.2 = − 0.597940 𝑓(3) = 3 × 0.47712 – 1.2 = 0.231364 = +𝑣𝑒 So, the rootlies between 2 and 3. 𝑥1 = 2𝑓(3) – 3𝑓(2) 𝑓(3) – 𝑓(2) = 2 × 0.23136 – 3 × (−0.59794) 0.23136 + 0.597 = 2.721014 𝑓( 𝑥1) = 𝑓(2.7210) = − 0.017104 = −𝑣𝑒 The rootlies between 𝑥1 and 3. 𝑥2 = 𝑥1 × f(3)– 3 × f( 𝑥1) f(3)– f( 𝑥1) = 2.721014 × 0.231364 – 3 × (−0.017104) 0.23136 + 0.017104 = 0.629544+ 0.051312 0.24846 = 0.680856 0.248464 = 2.740260 𝑓( 𝑥2) = 𝑓(2.7402) = 2.7402 × 𝑙𝑜𝑔(2.7402)– 1.2 = − 0.00038905 = −𝑣𝑒 So the root lies between 2.740260 and 3. 𝑥3 = 2.7402 × f(3) – 3 × f(2.7402) f(3) – f(2.7402) = 2.7402 x 0.231336 + 3 x (0.00038905) 0.23136 + 0.00038905 = 0.63514 0.23175 = 2.740627
- 24. RAI UNIVERSITY, AHMEDABAD 24 𝑓( 𝑥3) = 𝑓(2.7406) = 0.00011998 = +𝑣𝑒 So the root lies between 2.740260 and 2.740627 𝑥4 = 2.7402 x f(2.7406) – 2.7406 x f(2.7402) f(2.7406) – f(2.7402) = 2.7402 x 0.00011998 + 2.7406 x 0.00038905 0.00011998 + 0.00038905 = 0.0013950 0.00050903 = 2.7405 Hence the root is 2.7405. 5.3 Advantages of RegulaFalsiMethod— No need to calculate a complicated derivative (as in Newton's method). 5.4 Disadvantages of RegulaFalsi Method— a) May converge slowly for functions with big curvatures. b) Newton-Raphson may be still faster if we can apply it. 5.5 Rate Of Convergence — Here we discuss the rate at which the iteration method converges if the initial approximation to the root is sufficiently close to the desired root. 5.5.1Definition— An iterative method is said to be of order 𝑝 or has the rate of 𝑐𝑜𝑛𝑣𝑒𝑟𝑔𝑒𝑛𝑐𝑒 𝑝, if 𝑝 is the largest positive real number for which there exists a finite constant 𝐶 ≠ 0 such that
- 25. RAI UNIVERSITY, AHMEDABAD 25 | 𝜀 𝑘+1| ≤ 𝐶| 𝜀 𝑘 | 𝑝 Where 𝜀 𝑘 = 𝑥 𝑘 − 𝜉 is the error in the kth iteratation. The constant 𝐶 is called the asymptotic error constantand usually depends on the derivative of 𝑓(𝑥) at 𝑥 = 𝜉. 5.5.2 Newton-RaphsonsMethod— We know 𝑥 𝑘+1 = 𝑥 𝑘 − 𝑓(𝑥 𝑘) 𝑓′(𝑥 𝑘) , 𝑘 = 1,2,… On substituting 𝑥 𝑘 = 𝜉 + 𝜀 𝑘, expanding 𝑓( 𝜉 + 𝜀 𝑘), 𝑓′ (𝜉 + 𝜀 𝑘 ) in Taylor series about the point 𝜉, we get 𝜀 𝑘+1 = 𝜀 𝑘 − 𝜀 𝑘 𝑓′( 𝜉) + 1 2 𝜀 𝑘 2 𝑓′′( 𝜉) + ⋯ 𝑓′( 𝜉) + 𝜀 𝑘 𝑓′′( 𝜉) + ⋯ = 𝜀 𝑘 − [ 1 2 𝑓′′( 𝜉) 𝑓′( 𝜉) 𝜀 𝑘 2 + ⋯] [1 + 𝑓′′( 𝜉) 𝑓′( 𝜉) 𝜀 𝑘 + ⋯] −1 𝜀 𝑘+1 = 1 2 𝑓′′( 𝜉) 𝑓′( 𝜉) 𝜀 𝑘 2 + 𝑂( 𝜀 𝑘 3). On neglecting the 𝜀 𝑘 3 and higher power of 𝜀 𝑘 , we get 𝜀 𝑘+1 = 𝐶𝜀 𝑘 2 Where 𝐶 = 1 2 𝑓′′( 𝜉) 𝑓′( 𝜉) . Thus, the Newton-Raphsons Method has second order convergence. 5.5.3 Regula FalsiMethod— If the function 𝑓(𝑥) in the equation 𝑓( 𝑥) = 0 is convex in the interval (𝑥0, 𝑥1)that contains the root, then one of the points 𝑥0or𝑥1 is always fixed and the other point varies with 𝑘 . If the point 𝑥0is fixed , then the function 𝑓(𝑥) is approximated by the line passing through the points (𝑥0, 𝑓(𝑥0)) and (𝑥 𝑘 ,𝑓(𝑥 𝑘 )) , 𝑘 = 1,2,3,… the error of the equation becomes
- 26. RAI UNIVERSITY, AHMEDABAD 26 𝜀 𝑘+1 = 𝐶𝜀0 𝜀 𝑘 Where 𝐶 = 1 2 𝑓′′( 𝜉) 𝑓′( 𝜉) and 𝜀0 = 𝑥0 − ξ is independent of 𝑘. Therefore we can write 𝜀 𝑘+1 = 𝐶∗ 𝜀 𝑘 Where 𝐶∗ = 𝐶𝜀0 is the asymptotic error constant. Hence the Regula-Falsi method has linear rate of convergence. 6.1 SecantMethod Although the Newton-Raphson method is very power full to solve non-linear equations, evaluating of the function derivative is the major difficulty of this method. To overcome this deficiency, the secant method starts the iteration by employing two starting points and approximates the function derivative by evaluating of the slope of the line passing through these points. The secant method has been shown in Fig. 1. As it is illustrated in Fig. 1, the new guess of the root of the function f(x) can be found as follows:
- 27. RAI UNIVERSITY, AHMEDABAD 27 In the first glance, the secant method may be seemed similar to linear interpolation method, but there is a major difference between these two methods. In the secant method, it is not necessary that two starting points to be in opposite sign. Therefore, the secant method is not a kind of bracketing method but an open method. This major difference causes the secant method to be possibly divergent in some cases, but when this method is convergent, the convergent speed of this method is better than linear interpolation method in most of the problems. The algorithm of the secant method can be written as follows: 6.2 Steps— Step 1: Choose two starting points x0 and x1. Step 2: Let
- 28. RAI UNIVERSITY, AHMEDABAD 28 Step 3: if |x2-x1|<e then let root = x2, else x0 = x1 ; x1 = x2 ; go to step 2. Step 4: End. e: Acceptable approximated error. Example— A Real root of the equation 𝒇( 𝒙) = 𝒙 𝟑 − 𝟓𝒙 + 𝟏 = 𝟎 lies in the interval ( 𝟎, 𝟏). Perform four iterations of the secant method. Solution: We have 𝑥0 = 0, 𝑥1 = 1, 𝑓0 = 𝑓( 𝑥0) = 1, 𝑓1 = 𝑓( 𝑥1) = −3 𝑥2 = 𝑥1 − [ 𝑥0−𝑥1 𝑓0−𝑓1 ] 𝑓1 = 1 − [ 0−1 1+3 ] (−3) = 1 − 3 4 = 0.25 𝑓2 = 𝑓( 𝑥2) = 𝑓(0.25) = −0.234375 𝑥3 = 𝑥2 − [ 𝑥1−𝑥2 𝑓1−𝑓2 ] = 0.186441 ∴ 𝑓3 = 𝑓( 𝑥3) = 0.074276 𝑥4 = 𝑥3 − [ 𝑥3−𝑥2 𝑓3−𝑓2 ] 𝑓3 = 0.201736 ∴ 𝑓4 = 𝑓( 𝑥4) = −0.000470 𝑥5 = 𝑥4 − [ 𝑥4−𝑥3 𝑓4−𝑓3 ] 𝑓4 = 0.201640 6.3 Advantages of secantmethod: 1. It converges at faster than a linear rate, so that it is more rapidly convergent than the bisection method. 2. It does not require use of the derivative of the function, something that is not available in a number of applications. 3. It requires only one function evaluation per iteration,
- 29. RAI UNIVERSITY, AHMEDABAD 29 as compared with Newton’s method which requires two. 6.4 Disadvantagesofsecantmethod: 1. It may not converge. 2. There is no guaranteed error bound for the computed iterates. 3. It is likely to have difficulty if f 0(𝛼) = 0. This means the x-axis is tangent to the graph of 𝑦 = 𝑓 (𝑥) at 𝑥 = 𝛼. 4. Newton’s method generalizes more easily to new methods for solving simultaneous systems of nonlinear equations.
- 30. RAI UNIVERSITY, AHMEDABAD 30 EXERCISE Que—Solve the following Examples: 1. Find a positive rootof the following equation by bisection method : 𝑥3 − 4𝑥 − 9 (𝐴𝑛𝑠𝑤𝑒𝑟: 2.7065) 2. Solve the following by using Newton – RaphsonMethod :𝑥3 – 𝑥 − 1 (𝐴𝑛𝑠𝑤𝑒𝑟 ∶ 1.3247 ) 3. Solve the following by method of false position (RegulaFalsi Method) : 𝑥3 + 2𝑥2 + 10𝑥 – 20 (𝐴𝑛𝑠𝑤𝑒𝑟 ∶ 1.3688) 4. Solve the following equation by Secant Method up to four iteration. 𝑐𝑜𝑠𝑥 − 𝑥𝑒 𝑥 = 0 in interval (0,1). (𝐴𝑛𝑠𝑤𝑒𝑟: 0.5317058606) REFERENCES
- 31. RAI UNIVERSITY, AHMEDABAD 31 1. Numerical Method for Science and Computer science by M.K. Jain, S.R.K. Iyenger, R.K. Jain 2. http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&v ed=0CCMQFjAB&url=http%3A%2F%2Fwww.b- u.ac.in%2Fsde_book%2Fbca_numer.pdf&ei=uKenVMatGceduQTt9ILwBw &usg=AFQjCNH7oooXkwN7zusFPiJS7MksUkmZaw&bvm=bv.82001339, d.c2E&cad=rja 3. http://1.bp.blogspot.com/_BqwTAHDIq4E/TCqWRUqn7qI/AAAAAAAAA CE/oe-W-JZaQRI/s400/Dibujo.bmp 4. http://www.google.co.in/imgres?imgurl=http%3A%2F%2Fimage.tutorvista. com%2Fcms%2Fimages%2F39%2Fnewton%252513raphson- method.JPG&imgrefurl=http%3A%2F%2Fmath.tutorvista.com%2Fcalculus %2Fnewton-raphson-method.html&h=283&w=500&tbnid=VCvTr- sjzqmjDM%3A&zoom=1&docid=o_YQeEzCa1CVHM&ei=B6SnVMCED omlNqbsgaAN&tbm=isch&ved=0CB0QMygBMAE&iact=rc&uact=3&dur =4533&page=1&start=0&ndsp=17 5. http://www.google.co.in/url?sa=i&rct=j&q=&esrc=s&source=images&cd= &cad=rja&uact=8&ved=0CAcQjRw&url=http%3A%2F%2Fmathumatiks.c om%2Fsubpage-373-Regula-Falsi-Method.htm&ei=6aWnVK- 1Eo3muQSuqILABg&bvm=bv.82001339,d.eXY&psig=AFQjCNGE5QOy UayJysWeiBMOzx7QBybl_w&ust=1420359120049725 6. http://www.numericmethod.com/About-numerical-methods/roots-of- equations/secant-method 7. http://www.dummies.com/how-to/content/how-to-solve-nonlinear- systems0.html 8. http://studyhelpszone.blogspot.in/2009/07/advantages-and-disadvanteges-of- secant.html
- 32. RAI UNIVERSITY, AHMEDABAD 32 SECANT METHOD The Newton-Raphson algorithm requires the evaluation of two functions (the function and its derivative) per each iteration. If they are complicated expressions it will take considerable amount of effort to do hand calculations or large amount of CPU time for machine calculations. Hence it is desirable to have a method that converges (please see the section order of the numerical methods for theoretical details) as fast as Newton's method yet involves only the evaluation of the function. Let x0 and x1 are two initial approximations for the root 's' of f(x) = 0 and f(x0) & f(x1) respectively, are their function values. If x 2 is the point of intersection of x- axis and the line-joining the points (x0, f(x0)) and (x1, f(x1)) then x2 is closer to 's' than x0 and x1. The equation relating x0, x1 and x2 is found by considering the slope 'm' m = f(x1) - f(x0) f(x2) - f(x1) 0 - f(x1)
- 33. RAI UNIVERSITY, AHMEDABAD 33 = = x1 - x0 x2 - x1 x2 - x1 x2 - x1 = - f(x1) * (x1-x0) f(x1) - f(x0) x2 = x1 - f(x1) * (x1-x0) f(x1) - f(x0) or in general the iterative process can be written as xi+1= xi - f(xi) * (xi - xi-1 ) i = 1,2,3... f(xi) - f(xi-1) This formula is similar to Regula-falsi scheme of root bracketing methods but differs in the implementation. The Regula-falsi method begins with the two initial approximations 'a' and 'b' such that a < s < b where s is the root of f(x) = 0. It proceeds to the next iteration by calculating c(x2) using the above formula and then chooses one of the interval (a,c) or (c,h) depending on f(a) * f(c) < 0 or > 0 respectively. On the other hand secant method starts with two initial approximation x0 and x1 (they may not bracket the root) and then calculates the x2 by the same formula as in Regula-falsi method but proceeds to the next iteration without bothering about any root bracketing.