# Regula Falsi Method For Easily Finding Root 2020

This code solves the non-linear equations using **Regula Falsi Method** or false position method with number of iterations as a stop measure. Function takes 3 arguments that is, x1 and x2 the bracket values and n is the number of iterations. The code is written in a very simple way and can be easily understood. It is the function where you can write the desired equations whose roots are ought to be found.

False position method and secant method are Something similar.

## ACTUAL APPLICATION OF THIS METHOD:

By the 1900s this method appeared only in elementary education in mathematics textbooks. When using algebra notation, simplification and ease of understanding of the underlying relationship and its use no longer exist. While there are still issues where the false position truncates algebraic methods, the difference is an extra step or two, so it doesn’t seem to have any need for ancient pre-algebra practice.

It is currently used to find functions zeroes or extremes. In the case of the slower than the Newton’s method or the second method, it can find zero and extremer in an action that is not detectable, such as the inclusion of a corner with a gap or cusp. They can find the extremer at the end points. ** Regula Falsi Method **can be slow, and significantly so when the function quickly reaches zero.

## Derivation of Method:

Consider a curve having function f(x)=0 as shown in the figure below:

False position method for finding the real root of an equation. When choose two points (x0) and (x1) such that f(x0) and f(x1) are of different sign. Now, the equation of the chord joining the two points, {(x0), f(x0) and (x1), f(x1)} is,

From the principle of similar triangle, we get,

This method consists in replacing the part of the curve between the points {(x0), f(x0) and (x1),f(x1)} by means of the chord joining the two points, the point of intersection of the chord with the x-axis an approximation to the root. Let y=0, we get,

If now f(x2) and f(x0) are of opposite signs, the root lies between x0 and x2, and replace (x1) by (x2).Otherwise, we replace (x0) by (x2) and generate the next approximation.

If now f(x2) and f(x0) are of opposite signs, the root lies between x0 and x2, and replace (x1) by (x2).Otherwise, we replace (x1) by (x2) and generate the next approximation.

Similarly, we can get the next assumptions like the equations above. After a certain time estimate {when two consecutive values are approximately the same} we will get the final answer.

Let’s solve a common problem for a clearer understanding:

**Example:**

** **Find a real root of the equation, Xe^x-1=0 by using method.

### Formula:

**Solve:**

Let, f(x) = Xe^x-1

X0 = 1, f(x0) = 1.7182 [positive]

X1= 0, f(x1) = -1 [negative]

Iterative | x0 | x1 | f(x0) | f(x1) | x(k+1) | fx(k+1) |

1 | 1 | 0 | 1.7182 | -1 | 0.3678 | -0.4687 |

2 | 1 | 0.3678 | 1.7182 | -0.4687 | 0.5032 | -0.1677 |

3 | 1 | 0.5032 | 1.7182 | -0.1677 | 0.5473 | -0.0539 |

4 | 1 | 0.5473 | 1.7182 | -0.0539 | 0.5610 | -0.0168 |

5 | 1 | 0.5610 | 1.7182 | -0.0168 | 0.5652 | -0.0053 |

6 | 1 | 0.5652 | 1.7182 | -0.0053 | 0.5665 | -0.0017 |

7 | 1 | 0.5665 | 1.7182 | -0.0017 | 0.5669 | -0.0006 |

8 | 1 | 0.5669 | 1.7182 | -0.0006 | 0.5671 | -0.0003 |

9 | 1 | 0.5671 | 1.7182 | -0.0003 | 0.5671 | -0.0003 |

**This final root=0.5671**

*We will see how to write a matlab program for false positioning.

**MATLAB PROGRAM:**

Write a MATLAB program to solve the equation described in problem Xe^x-1=0 by using ** regula falsi method** 9 iteration.

**Output:**

Here the values of x and f are shown:

Find the root of Xe^x-1=0 by using method: