Programming in C and Numerical Methods Topic Regula

  • Slides: 9
Download presentation
Programming in C and Numerical Methods Topic: Regula Falsi Method Dr. Reetu Assistant Professor

Programming in C and Numerical Methods Topic: Regula Falsi Method Dr. Reetu Assistant Professor of Mathematics Vaish College, Rohtak

Regula Falsi Method � Regula Falsi method or the method of false position is

Regula Falsi Method � Regula Falsi method or the method of false position is a numerical method for solving an equation in one unknown. It is quite similar to bisection method algorithm and is one of the oldest approaches. It was developed because the bisection method converges at a fairly slow speed as it depends only on the choice of end points of the interval [a, b]. The function f(x) does not have any role in finding the point c (which is just the mid-point of a and b). It is used only to decide the next smaller interval [a, c] or [c, b]. � On the other hand, Regula Falsi method states that a better approximation to c can be obtained by taking the straight line L joining the point (a, f(a)) and (b, f(b)) intersecting the x-axis.

Working Rules Follow the below procedure to get the solution for the continuous function:

Working Rules Follow the below procedure to get the solution for the continuous function: � For any continuous function f(x), Find two points, say a and b such that a < b and f(a)* f(b) < 0, i. e. , f(a) and f(b) are of opposite signs � Find the point c using above formula. � If f (a) and f (c) have opposite signs, the root lies in [a, c]. � If f (c) and f (b) have opposite signs, the root lies in [c, b]. � If f (c) = 0, then the root is c. � Repeat above three steps until f(c) = 0.

Example Question: Find the root of x 3 - 2 x - 5 =

Example Question: Find the root of x 3 - 2 x - 5 = 0, by using regular falsi method. Solution. Given f(x) = x 3 - 2 x -5. Now, f(1) = 13 - 2 (1) - 5 = -6 (negative) f(2) = 23 - 2 (2) - 5 = -1 (negative) f(3) = 33 - 2 (3) - 5 = 16 (positive) Thus, the root lies between 2 and 3. Let us take a = 2 and b= 3. The first approximation to root is x 1 and is given by x 1 = (a f(b) - b f(a))/(f(b)-f(a)) =(2 f(3)- 3 f(2))/(f(3) - f(2)) =(2. 16 - 3 (-1))/ (16 - (-1)) = (32 + 3)/(16+1) =35/17 = 2. 058

Now, f(2. 058) = 2. 0583 - 2(2. 058) – 5 = - 0.

Now, f(2. 058) = 2. 0583 - 2(2. 058) – 5 = - 0. 4 (negative) Thus, the root lies between 2. 058 and 3. Taking a = 2. 058 and b = 3. we have the second approximation to the root given by x 2 = (a f(b) - b f(a))/(f(b)-f(a)) = (2. 058 f(3) - 3 f(2. 058)) /(f(3) - f(2. 058)) = (2. 058(16) -3(-0. 4)) / (16 - (-0. 4)) = 2. 081 Now f(2. 081) = 2. 0813 - 2 (2. 081) - 5 = -0. 15 (negative) Thus, the root lies between 2. 081 and 3.

Take a = 2. 081 and b = 3 The third approximation to the

Take a = 2. 081 and b = 3 The third approximation to the root is given by x 3 = (a f(b) - b f(a))/(f(b)-f(a)) = (2. 089(16) - 3(-0. 062))/ (16 - (-0. 062)) = 2. 093. Now f(2. 093) = 2. 093 3 - 2 (2. 093) - 5 = -0. 017 (zero approx. ) Hence, the root is 2. 093.

Secant. Method � The Regula falsi method is based on the condition f(a)* f(b)

Secant. Method � The Regula falsi method is based on the condition f(a)* f(b) < 0, i. e. the roots of the equation f(x) = 0 lies in the interval (a, b). On the other hand, in secant method, we omit the condition f(a)* f(b) < 0, but a and b are chosen reasonably close to the exact root. In this method, we proceed to the next iteration without bothering about any root bracketing and calculate the next iteration by the same formula as in Regula-falsi method. � The secant method is faster but may not converge at all. Regula falsi is slower but as long as the initial interval contains a root, the last interval will also do.

Thank You

Thank You