FME7 Lecture 8 Secant Method
FME7 Lecture 8 Secant Method
So, in general:
Algorithm:
1. Decide the initial points: x1 and x2 and EPS.
2. Compute: f1 = f(x1) and f2 = f(x2)
3. Compute:
then: Set (x1 = x2, f1 = f2) and set (x2 = x3, f2 = f(x3)); go to step 3,
otherwise set root = x3.
5. Print root
6. Stop
Illustrative Example
Use Secant Method to estimate the root of the equation x2 –
4x -10 = 0, with initial estimate x1 = 4 and x2 = 2.
Solution:
x1 = 4, f(x1) = f1 = 42 – 4*4 – 10 = -10
x2 = 2, f(x1) = f1 = 22 – 4*2 – 10 = -14
Hence, the root is: 5.7225, which is less than EPS = 0.05
𝑥3 −𝑥2
Where EPS =| | and in each iteration:
𝑥2
x1 = x2, f1 = f2 and x2 = x3, f2 = f(x3).
(i)
And Secant Iterative Formula:
(ii)
Comparing equation (i) and (ii):
Similarly:
Lecture Worksheet 8
1. 𝑓 (𝑥 ) = 𝑥 3 + 2𝑥 2 − 3𝑥 − 1(𝑥𝑖−1 = 1) (𝑥𝑖 = 2)
2. 𝑓 (𝑥 ) = 𝑒 𝑥 − 𝑐𝑜𝑠𝑥 − 2 (𝑥𝑖−1 = 8)(𝑥𝑖 = 3)
2
𝑥
3. 𝑓 (𝑥 ) = 𝑒 3 − 𝑥2 − 1 (𝑥𝑖−1 = 8)(𝑥𝑖 = 5)