Why does the secant method work




















Consider a function f x which has the following graph:. Suppose that we want to locate the root r which lies near the points x 0 and x 1. The main idea in secant method is to approximate the curve with a straight line for x between the values of x 0 and r. The straight line is assumed to be the secant which connects the two points x 0 , f x 0 and x 1 , f x 1. Graphically we can represent this with the picture below, where the secant line and the new root estimate x 2 are shown in red.

We can see that x 2 is closer to the root r than either x 1 or x 0. If we were to repeat the process we can very easily see that x 3 would be even closer to the root as it is shown below in green.

Analytically how can we obtain x 2 if we know x 0 and x 1? Its slope m is given by. Consequently we obtain:. As an example of the method consider the following table which illustrates the steps needed to find the positive root of. We now go to next line by shifting x1 to x0 and x2 to x1 follow the colors. We also shift f x1 to f x0 only one function evaluation per line. When to use the Secant Method of finding roots? Show older comments. Rachel on 5 Feb Vote 0.

Edited: Cedric Wannaz on 30 Sep Hello, everybody. I'm taking my first course in Matlab and our professor has been teaching us about the different processes used to find the roots of an equation.

He gave us a problem set which includes finding roots using the Newton-Raphson method, a hybrid of bisection and N-R, and a hybrid of bisection and Secant. The first two were simple, but the third one is tripping me up. I want to use an if-else statement so the program will decide when to use each method, but I can't find any quantitative explanation of when the Secant method should be used.

The N-R method had a nice inequality that worked perfectly but I don't see anything so straight forward for this. Does anybody have any insight regarding the Secant method and when exactly it should be used?

Thank you! Answers 2. Derek O'Connor on 5 Feb Vote 1. Cancel Copy to Clipboard. I would like to qualify what John says: "Methods like the secant method are rarely very good choices anyway. This is arguably true if the Secant Method is used alone. However, it is very useful when used in a "poly-algorithm" such as Matlab's fzero , which as they say is over 40 years old:. Use type fzero to see the code for fzero. An Algol 60 version,. Brent in "Algorithms for.

A Fortran. Here is the part of fzero pertinent to your question:. The Linear Interpolation above is the 2-point Secant Method. The Inverse Quadratic may be thought of as an Inverse 3-point Secant Method, which is a very clever idea that should be studied carefully.

As you can see, deciding which method to use at any point in the computation is a very delicate business. Take a look at Forsythe, Malcolm, and Moler , which is an old but excellent book.

Writing code for such a method is not for the faint-hearted or the amateur: Richard Brent has been, among other things, one of the best numerical analysts in the past 40 years, and still publishes great papers and software. None-the-less, trying to write such code is a good exercise that should help you appreciate how difficult it is to write robust and efficient numerical software.

This, I presume, is the reason your professor set you this exercise. Added Reference. John D'Errico on 5 Feb Methods like the secant method are rarely very good choices anyway.



0コメント

  • 1000 / 1000