Secant method is used for finding root of the function in given interval.

## Algorithm:

```IN:
Function f, which is continous function and interval [a,b]. Function must satisfy given equation: f(a) * f(b) < 0 - signs of that values are different, which means that given function in given interval has at least one root in interval [a,b].
OUT:
Root in given interval.
1. Make xn1 = a, xn = b, x = xn1.
2. Check if abs(f(x)) < precision.
3. If it is end algorithm and return x.
4. Make x = xn - ((f(xn) * (xn - xn1)) / (f(xn) - f(xn1))).
5. Make xn1 = xn and xn = x.
6. Go to step 2.```

## Sample Output:

```f(x) = x * (x + 2) -1
[-3, 0]

root: -2.414201183431953```

## Chord Method Step By Step

Iteration Numberabxn1xnxf(x)
1-3-1-3-1-32
2-3-1-1-2-2-1
3-3-1-2-3-32
4-3-1-3-3-2.333-0.2222
5-3-1-3-2.333-2.4-0.04
6-3-1-2.333-2.4-2.410.00118
7-3-1-2.4-2.41-2.414-6.007E-6

## Cons:

• has trouble with some functions.
• initial approximations are not accurate enough.

Secant Method Algorithm
Tagged on: