False Position Method, also known as Regula Falsi, is a numerical method for finding the roots of a function. This method uses iterative approximation techniques.
In this code, we've utilized a simple polynomial function, like
Basically, in this method, we examine two points and the value of the function at these points. If the multiplication of these function values is negative, we can determine that a root exists between these points. Afterwards, we generate a new point. We then consider these three points and select two of them where the multiplication of the function values is negative. This process constitutes one iteration. With more iterations, the results get closer to the actual root value.
You can also examine the root of this function between 1 and 5 without changing anything in the program.