The secant method is used to find the root of an equation f(x) = 0. It is started from two distinct estimates x1 and x2 for the root. It is an iterative procedure involving linear interpolation to a root. The iteration stops if the difference between two intermediate values is less than convergence factor.Examples:Input: equation = x 3 + x - 1x1 = 0, x2 = 1, E = 0.0001Output: Root of the given equation = 0.682326No. Of iteration=5AlgorithmInitialize: x1, x2, E, n // E = convergence indicatorcalculate f(x1),f(x2)if(f(x1).
![](/uploads/1/2/6/2/126243275/937903808.jpg)
![Fortran program for secant method equations Fortran program for secant method equations](/uploads/1/2/6/2/126243275/162590621.jpg)
f(x2) = E); //repeat the loop until the convergenceprint 'x0' //value of the rootprint 'n' //number of iterationelseprint 'can not found a root in the given interval'. FilternoneOutput:Root of the given equation = 0.682326No. Of iterations = 5Time Complexity = O(1)ReferenceThis article is contributed by Niteesh Kumar. If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to [email protected]. See your article appearing on the GeeksforGeeks main page and help other Geeks.Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
The secant method 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. In comparing the rate of convergence of Bisection, Newton and Secant methods,4 used Cprogramming language to calculate the cube roots of numbers from 1 to 25, using the three methods. They observed that the rate of convergence is in the following order: Bisection method method Secant method.
![](/uploads/1/2/6/2/126243275/937903808.jpg)