0% found this document useful (0 votes)
2 views

Lecture 5

The document discusses numerical methods, specifically Newton's Method and the Secant Method for finding roots of functions. It outlines the assumptions, procedures, and iterations involved in the Secant Method, including an example of finding the root of the equation f(x) = x² - 2. Additionally, it highlights the advantages and disadvantages of the Secant Method compared to other methods.

Uploaded by

Sheri Gaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lecture 5

The document discusses numerical methods, specifically Newton's Method and the Secant Method for finding roots of functions. It outlines the assumptions, procedures, and iterations involved in the Secant Method, including an example of finding the root of the equation f(x) = x² - 2. Additionally, it highlights the advantages and disadvantages of the Secant Method compared to other methods.

Uploaded by

Sheri Gaming
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Lecture 5

Numerical Methods
[MA-200]
Newton’s Method [Recall]
Assumptions: 𝑓(𝑥), 𝑓 ′ 𝑥 and 𝑥0 are available

𝑓′ 𝑥 ≠ 0

Newtons Method new Estimate

𝑓(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 − ′
𝑓 𝑥𝑖

Problem: 𝑓 ′ 𝑥 is not available or difficult to obtain analytically


Secant Method

𝑓 𝑥 + ℎ − 𝑓(𝑥)
𝑓 𝑥 ≈

If 𝑥𝑖 and 𝑥𝑖−1 are two initial guesses


𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
𝑓 𝑥 =
𝑥𝑖 − 𝑥𝑖−1

𝑓(𝑥𝑖 ) 𝑓(𝑥𝑖 )
𝑥𝑖+1 = 𝑥𝑖 − ′ = 𝑥𝑖 −
𝑓 𝑥𝑖 𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
𝑥𝑖 − 𝑥𝑖−1
𝑥𝑖 − 𝑥𝑖−1
𝑥𝑖+1 = 𝑥𝑖 − 𝑓 𝑥𝑖 .
𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
Secant Method
Assumptions:

Two initial points 𝑥𝑖 and 𝑥𝑖−1

Such that 𝑓(𝑥𝑖 ) ≠ 𝑓(𝑥𝑖−1 )

New estimate (Secant Method):

𝑥𝑖 − 𝑥𝑖−1
𝑥𝑖+1 = 𝑥𝑖 − 𝑓 𝑥𝑖 .
𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
Secant Method - Flowchart
Working Procedure
Step 1: Let a function 𝑓 𝑥 = 0
Step 2: Find 𝑥0 and 𝑥1 such that 𝑓 𝑥0 . 𝑓 𝑥1 < 0
Step 3: Estimate the new value of the root, 𝑥𝑖+1

𝑥𝑖 − 𝑥𝑖−1
𝑥𝑖+1 = 𝑥𝑖 − 𝑓 𝑥𝑖 .
𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
Step 4: Specify the stopping criteria.
For example: Calculate the “Relative or Absolute Approximate Error”

𝑥𝑖+1 − 𝑥𝑖
𝑅. 𝐸 = , 𝐴. 𝐸 = 𝑥𝑖+1 − 𝑥𝑖
𝑥𝑖
Example:
Find a root of the equation f(x)= 𝒙𝟐 -2 by using Secant Method in the interval [1, 2].
Solution:
Let
𝑓 𝑥 = 𝑥2 − 2
Assume initial guesses 𝑥0 = 1, 𝑥1 = 2
𝑥𝑖 − 𝑥𝑖−1
𝑥𝑖+1 = 𝑥𝑖 − 𝑓 𝑥𝑖 .
𝑓 𝑥𝑖 − 𝑓(𝑥𝑖−1 )
1st Iteration:
At i=1
𝑥1 − 𝑥0
𝑥2 = 𝑥1 − 𝑓 𝑥1 .
𝑓 𝑥1 − 𝑓(𝑥0 )
2
𝑓 𝑥0 = 𝑥0 − 2 = 12 − 2 = −1
𝑓 𝑥1 = 𝑥12 − 2 = 22 − 2 = 2
Cont.
2−1 2
𝑥2 = 2 − 2. = 2 − = 1.3333
2 − −1 3

𝑥2 = 1.3333
2nd Iteration:
At i=2
𝑥2 − 𝑥1
𝑥3 = 𝑥2 − 𝑓 𝑥2 .
𝑓 𝑥2 − 𝑓(𝑥1 )
𝑓 𝑥1 = 𝑥12 − 2 = 22 − 2 = 2
𝑓 𝑥2 = 𝑥22 − 2 = 1.33332 − 2 = −0.2223
Cont.
1.3333 − 2
𝑥3 = 1.3333 − (−0.2223). = 1.4
−0.2223 − 2

𝑥2 = 1.4
3rd Iteration:
At i=3

𝑥3 − 𝑥2
𝑥4 = 𝑥3 − 𝑓 𝑥3 .
𝑓 𝑥3 − 𝑓(𝑥2 )
𝑓 𝑥2 = 𝑥22 − 2 = 1.33332 − 2 = −0.2223
𝑓 𝑥3 = 𝑥32 − 2 = 1.42 − 2 = −0.04
Cont.
1.4 − 1.3333
𝑥4 = 1.4 − (−0.04). = 1.4102
−0.04 + 0.2223

𝑥4 = 1.4102
4th Iteration:
At i= 4
𝑥4 − 𝑥3
𝑥5 = 𝑥4 − 𝑓 𝑥4 .
𝑓 𝑥4 − 𝑓(𝑥3 )
𝑓 𝑥3 = 𝑥32 − 2 = 1.42 − 2 = −0.04
𝑓 𝑥4 = 𝑥42 − 2 = 1.41022 − 2 = −0.0114
Cont.
1.4102 − 1.4
𝑥5 = 1.4102 − (−0.0114). = 1.4143
−0.0114 + 0.04

𝑥5 = 1.4143
5th Iteration:
At i= 5

𝑥5 − 𝑥4
𝑥6 = 𝑥5 − 𝑓 𝑥5 .
𝑓 𝑥5 − 𝑓(𝑥4 )
𝑓 𝑥4 = 𝑥42 − 2 = 1.41022 − 2 = −0.0114
𝑓 𝑥5 = 𝑥52 − 2 = 1.41432 − 2 = 0.0001
Cont.
1.4143 − 1.4102
𝑥6 = 1.4143 − (0.0001). = 1.4143
0.0001 + 0.0114

𝑥6 = 1.4143
Absolute Error:
n=1, 𝑥1+1 − 𝑥1 = 𝑥2 − 𝑥1 = 1.3333 − 2 = 0.6667
n=2, 𝑥2+1 − 𝑥2 = 𝑥3 − 𝑥2 = 1.4 − 1.3333 = 0.0667
n=3, 𝑥1+1 − 𝑥1 = 𝑥4 − 𝑥3 = 1.4102 − 1.4 = 0.0102
n=4, 𝑥2+1 − 𝑥2 = 𝑥5 − 𝑥4 = 1.4143 − 1.4102 = 0.0041
n=5, 𝑥3+1 − 𝑥3 = 𝑥6 − 𝑥5 = 1.4143 − 1.4143 = 0 < 0.0001 = 10−4
Advantages of Secant Method

• Only one function evaluation is needed per step as compared Newton’s


Raphson Method

• It converges faster than bisection method

• It doesn’t require use of derivative of a given function


Disadvantages of Secant Method

• It may not converge.

• It requires two guesses.

• If 𝑓 𝑥𝑖 = 𝑓 𝑥𝑖−1 , then this method fails.


Homework

Exercise 2.3
Q3(a), Q4(a), Q7, Q8, Q11, Q12, Q13(b), Q14(c)
END OF SECTION

You might also like