Method of the secant

In numerical Analysis, the method of the secant is an algorithm of search for roots of a function F .

Method

The method of the secant is a method derived from that of Newton where one replaces f' (x_n) \, by \ frac {F (x_n) - F (x_ {n-1})}{x_n-x_{n-1}} One obtains the relation of Récurrence
x_ {n+1} = x_n - \ frac {x_n-x_ {n-1}} {F (x_n) - F (x_ {n-1})} F (x_n).

Initialization requires 2 points X 0 and X 1, close relations, if possible, of the required solution.

Demonstration

Being given has and B , one builds the segment connecting ( has , F ( has )) and ( B , F ( B )). The line can be as follows defined:

there - F (b) = \ frac {F (B) - F (a)} {Ba} (x-b).

C is chosen so that C is the root of this line (i.e., F ( C ) =0).

F (b) + \ frac {F (B) - F (a)} {Ba} (c-b) = 0.

If one extracts C from this equation, one finds the relation of recurrence referred to above.

Convergence

If the initial values of X 0 and X 1 are sufficiently close to the solution, the method will have a Ordre of convergence of
\ varphi = \ frac {1+ \ sqrt {5}} {2} \ simeq 1,618 which is the Golden section.

However, the function F must be 2 times continuement differentiable and it must be a simple root.

Example of implementation

This program in C solves the problem F ( X ) = cos ( X ) - X 3 = 0. The tests of stops are the following:
  • |x_ {n+1} - x_n| < E
  • N > m
m and E being given.

# include # include   double F ( double X) { return cos (X) - x*x*x; }   double SecantMethod ( double xn_1, double xn, double E, int m) { int N; double D; for (N = 1; N <= m; n++) { D = (xn - xn_1)/(F (xn) - F (xn_1)) * F (xn); yew (fabs (d) < E) return xn; xn_1 = xn; xn = xn - D; } return xn; }   int hand ( void ) { printf (" %0.15f \ n" , SecantMethod (0, 1,5E-11, 100)); return 0; }

The following results are obtained:

x_0 = 0 \, \!

x_1 = 1 \, \!
x_2 = 0,685073357326045 \, \!
x_3 = 0,841355125665652 \, \!
x_4 = 0,870353470875526 \, \!
x_5 = 0,865358300319342 \, \!
x_6 = 0,865473486654304 \, \!
x_7 = 0,865474033163012 \, \!
x_8 = 0,865474033101614 \, \!

See too

Random links:Paul Cohen | Suger of Saint-Denis | Something Else by the Kinks | William Witney | Tomuya |

_de_Clementina_Sobieski