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

Open Methods Secant Method: Algorithm

The document describes the secant method algorithm for numerically finding the root of a non-linear function. It provides an example of using the secant method to find the real root of f(x) = 3x + sinx - ex to within a tolerance of 10-6, obtaining a root of 0.360420. It also gives another example of using the bisection method and secant method to solve other non-linear equations within specified tolerances.

Uploaded by

beena saleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views

Open Methods Secant Method: Algorithm

The document describes the secant method algorithm for numerically finding the root of a non-linear function. It provides an example of using the secant method to find the real root of f(x) = 3x + sinx - ex to within a tolerance of 10-6, obtaining a root of 0.360420. It also gives another example of using the bisection method and secant method to solve other non-linear equations within specified tolerances.

Uploaded by

beena saleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Numerical solution of non-linear equations Secant method Instructor: Miss Urooj

Open Methods
Secant Method
Algorithm
To determine the value of 𝑓 (𝑥 ) = 0, given two values 𝑥𝑜 and 𝑥1 that are near the
root.
Repeat
𝑥𝑜 −𝑥1
𝑥2 = 𝑥1 − 𝑓 (𝑥1 ) ∗
𝑓(𝑥𝑜 )− 𝑓(𝑥1 )

Set 𝑥𝑜 = 𝑥1
Else 𝑥1 = 𝑥2
Until |𝑓(𝑥2 )| < tolerance level

1
Numerical solution of non-linear equations Secant method Instructor: Miss Urooj

Question: Use secant Method to determine a real root of


𝑓 (𝑥 ) = 3𝑥 + 𝑠𝑖𝑛𝑥 − 𝑒 𝑥 . Using the tolerance value of 10−6 .
Solution: (convert the mode of calculator in radians)
Let 𝑥𝑜 = −1 𝑎𝑛𝑑 𝑥1 = 0
At, 𝑥𝑜 = −1 , 𝑓(𝑥𝑜 ) = −4.209350
And at, 𝑥1 = 0, 𝑓 (𝑥1 ) = −1
𝑥𝑜 − 𝑥1
𝑥2 = 𝑥1 − 𝑓 (𝑥1 ) ∗
𝑓 (𝑥𝑜 ) − 𝑓 (𝑥1 )
𝑥2𝑛𝑒𝑤 − 𝑥2𝑜𝑙𝑑
𝜀𝑎 = | | ∗ 100
𝑥2𝑛𝑒𝑤
−1−0
𝑥2 = 0 − (−1) ∗
−4.209350−(−1)

0−0.3115896
𝑥2 = 0.3115896 − (−0.124253) ∗
−1−(−0.124253 )

𝜺𝒂
Iterations 𝒙𝒐 𝒙𝟏 𝒙𝟐 f(𝒙𝟐 )

0 -1 0 0.3115896 -0.124253 --

1 0 0.3115896 0.346503 -0.0349940 10.0659%

2 0.3115896 0.346503 0.360161 -6.5229∗ 10−4 3.7922%

3 0.346503 0.360161 0.360420 -4.2605∗ 10−6 0.0719%

A real root of given equation is 0.360420 with tolerance 0.000001.

2
Numerical solution of non-linear equations Secant method Instructor: Miss Urooj

Question: Use bisection method to find solutions accurate to within 10−2 for the
following problem
1. 𝑥 3 − 2𝑥 2 − 5 = 0, [1, 4]
Solution (1):
At, 𝑥𝑜 = 1 , 𝑓 (𝑥𝑜 ) = −6
And at, 𝑥1 = 4, 𝑓 (𝑥1 ) = 27
𝑥𝑜 − 𝑥1
𝑥2 = 𝑥1 − 𝑓 (𝑥1 ) ∗
𝑓 (𝑥𝑜 ) − 𝑓 (𝑥1 )
𝑥2𝑛𝑒𝑤 − 𝑥2𝑜𝑙𝑑
𝜀𝑎 = | | ∗ 100
𝑥2𝑛𝑒𝑤

Iterations 𝒙𝒐 𝒙𝟏 𝒙𝟐 f(𝒙𝟐 ) 𝜺𝒂

0 1 4 1.545455 -6.08565 --

1 4 1.545455 1.996934 -5.012225 22.608609%

2 1.545455 1.996934 4.105063 30.473574 51.354364%

3 1.996934 4.105063 2.294699 -3.44822 78.89331%

4 4.105063 2.294699 2.478726 -2.058665 7.4242575%

5 2.294699 2.478726 2.751368 0.687876 9.9093251%

6 2.478726 2.751368 2.683084 -0.082514 2.5449818%

A real root of given equation is 2.683084, accurate up to two decimal places.

3
Numerical solution of non-linear equations Secant method Instructor: Miss Urooj

Question: Use secant method to find solutions accurate to within 10−6 for the
following problems. Also calculate absolute and percentage relative error.
𝐥𝐧(𝒙 − 𝟏) + 𝐜𝐨𝐬(𝒙 − 𝟏) = 𝟎, 𝟏. 𝟑 ≤ 𝒙 ≤ 𝟐
Solution: (convert the mode of calculator in radians)
At, 𝑥𝑜 = 1.3 , 𝑓 (𝑥𝑜 ) = -0.2486363
And at, 𝑥1 = 2, 𝑓 (𝑥1 ) =0.54030231
𝑥𝑜 − 𝑥1
𝑥2 = 𝑥1 − 𝑓 (𝑥1 ) ∗
𝑓 (𝑥𝑜 ) − 𝑓 (𝑥1 )
If 𝑓(𝑥2 ) is of opposite sign to 𝑓 (𝑥𝑜 ) Then
Set 𝑥0 = 𝑥1
Else 𝑥1 = 𝑥2
Absolute Error 𝜀𝑎′ = |𝑥2𝑛𝑒𝑤 − 𝑥2𝑜𝑙𝑑 |
𝑥2𝑛𝑒𝑤 −𝑥2𝑜𝑙𝑑
Percentage Relative Error 𝜀𝑎 = | | ∗ 100
𝑥2𝑛𝑒𝑤
1.3−2
𝑥2 = 2 − 0.54030231 ∗ −0.2486363−0.54030231

2 − 1.520607
𝑥2 = 1.520607 − 0.2147576 ∗
0.54030231 − 0.2147576
1.204358−1.520607
𝜀𝑎 = | 1.204358
| ∗ 100

𝜀𝑎′ = |1.204358 − 1.520607|

Iterations 𝒙𝒐 𝒙𝟏 𝒙𝟐 f(𝒙𝟐 ) 𝜺′𝒂 𝜺𝒂

0 1.3 2 1.520607 0.2147576 --- ---

1 2 1.520607 1.204358 -0.6086920 0.3162494 26.25872%

2 1.520607 1.204358 1.438128 0.0803041 0.2337708 16.255159%

3 1.204358 1.438128 1.410882 0.0273195 0.0272465 1.9311324%

4
Numerical solution of non-linear equations Secant method Instructor: Miss Urooj

4 1.438128 1.410882 1.396833 -0.0019495 0.0140487 1.0057752%

5 1.410882 1.396833 1.397769 0.0000437 0.0009357 0.0669639%

6 1.396833 1.397769 1.397749 0.0000001= 0.0000205 0.0014309%

You might also like