0% found this document useful (0 votes)
12 views33 pages

2.3 FalsePosition+Secant

Uploaded by

swatineupane123
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)
12 views33 pages

2.3 FalsePosition+Secant

Uploaded by

swatineupane123
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/ 33

Numerical Methods

Solution of Non-Linear Equations


å Method of False Position (Regula Falsi Method)
å Secant Method

Jayandra Raj Shrestha


Nov 2021

Institute of Engineering,
Tribhuvan University, Nepal 1
Method of False Position
(Regula Falsi Method)
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
f(x)

f(b)

a c

f(a) b

x 2
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
f(x)

f(b)

a c

f(a) b

x 2
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f(b) f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

a c

f(a) b

x 2
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f(b) f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

• Determine new interval as in Bisection


Method:
a c If the sign of f (c) is same as f (a):
b move a to c
f(a)
Otherwise:
move b to c
x 2
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f(b) f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

• Determine new interval as in Bisection


Method:
a c If the sign of f (c) is same as f (a):
b move a to c
f(a)
Otherwise:
move b to c
x • Repeat until f (c) ≈ 0: 2
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

• Determine new interval as in Bisection


Method:
a c If the sign of f (c) is same as f (a):
b move a to c
Otherwise:
move b to c
x • Repeat until f (c) ≈ 0: 3
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

• Determine new interval as in Bisection


Method:
a c If the sign of f (c) is same as f (a):
b move a to c
Otherwise:
move b to c
x • Repeat until f (c) ≈ 0: 4
Method of False Position (Regula Falsi)

• Determine an interval (a, b) containing a


root using the Intermediate Value Theorem
• Instead of bisecting the interval, join the
points (a, f (a)) and (b, f (b)) by a secant
line.
• Determine the point (c), which is the point
of intersection between the secant line and
the x-axis.
f(x)

f (a) f (b) a · f (b) − b · f (a)


= ⇒ c=
a−c b−c f (b) − f (a)

• Determine new interval as in Bisection


Method:
ac If the sign of f (c) is same as f (a):
b move a to c
Otherwise:
move b to c
x • Repeat until f (c) ≈ 0: 5
Problem with False Position Method

• Despite of deciding the new sub-interval using the Intermediate Value Theorem, it
can be observed that one of the brackets might remain fixed mostly, resulting in
slow convergence.

6
Problem with False Position Method

• Despite of deciding the new sub-interval using the Intermediate Value Theorem, it
can be observed that one of the brackets might remain fixed mostly, resulting in
slow convergence.
• Convergence rate can be improved by taking the latest two x-values to compute
the next approximation, completely avoiding the intermediate value theorem - the
Secant method.

6
Problem with False Position Method

• Despite of deciding the new sub-interval using the Intermediate Value Theorem, it
can be observed that one of the brackets might remain fixed mostly, resulting in
slow convergence.
• Convergence rate can be improved by taking the latest two x-values to compute
the next approximation, completely avoiding the intermediate value theorem - the
Secant method.
• This improves the convergence rate, however, at the cost of reliability.

6
Secant Method
Secant Method

• Approximate the curve by a straight


line – secant line drawn on the curve
between two points very close to the
root x0 and x1 , which may or may
not bracket the root.
f(x)

x2 • Red line = Secant drawn on f (x)


between (x0 , f (x0 )) and (x1 , f (x1 ))
x0 x1
• x2 = First approximation of the root
• Next use x1 and x2 to approximate
x3 , and so on ...
x

7
Secant Method

• Purple line = Secant line drawn on


f (x) between (x1 , f (x1 )) and
(x2 , f (x2 ))
• x3 = Second approximation of the
root
f(x)

x2 x3
x0 x1

8
Secant Method

• Green line = Secant line drawn on


f (x) between (x2 , f (x2 )) and
(x3 , f (x3 ))
• x4 = Third approximation of the root
f(x)

x2 x3
x4 x0 x1

9
Secant Method

• Yellow line = Secant line drawn on


f (x) between (x3 , f (x3 )) and
(x4 , f (x4 ))
• Proceed until f (xi ) ≈ 0
f(x)

x2 x3
x4 x0 x1

10
Secant Method

f(x1)
f(x0)
f(x)

x2
x0 x1

x
Given x0 , x1 ⇒ x2 = ?
11
Secant Method

Slope of the secant line

f (x0 )
=
x0 − x2

f(x1) Also,
f (x1 )
f(x0) =
x1 − x2
f(x)

x2
x0 x1

x
Given x0 , x1 ⇒ x2 = ?
11
Secant Method

Slope of the secant line

f (x0 )
=
x0 − x2

f(x1) Also,
f (x1 )
f(x0) =
x1 − x2
f(x)

x2 f (x0 ) f (x1 )
i.e., =
x0 x1 x0 − x2 x1 − x2

x
Given x0 , x1 ⇒ x2 = ?
11
Secant Method

Slope of the secant line

f (x0 )
=
x0 − x2

f(x1) Also,
f (x1 )
f(x0) =
x1 − x2
f(x)

x2 f (x0 ) f (x1 )
i.e., =
x0 x1 x0 − x2 x1 − x2

x1 f (x0 )−x2 f (x0 ) = x0 f (x1 )−x2 f (x1 )


x2 [f (x1 )−f (x0 )] = x0 f (x1 )−x1 f (x0 )
x
Given x0 , x1 ⇒ x2 = ?
11
Secant Method

Slope of the secant line

f (x0 )
=
x0 − x2

f(x1) Also,
f (x1 )
f(x0) =
x1 − x2
f(x)

x2 f (x0 ) f (x1 )
i.e., =
x0 x1 x0 − x2 x1 − x2

x1 f (x0 )−x2 f (x0 ) = x0 f (x1 )−x2 f (x1 )


x2 [f (x1 )−f (x0 )] = x0 f (x1 )−x1 f (x0 )
x
Given x0 , x1 ⇒ x2 = ? x0 f (x1 ) − x1 f (x0 )
∴ x2 =
f (x1 ) − f (x0 ) 11
Secant Method

Similarly,

x1 f (x2 ) − x2 f (x1 )
x3 =
f (x2 ) − f (x1 )

f(x1) and so on ...


f(x)

In General,
x2 x3
xi−1 f (xi ) − xi f (xi−1 )
x0 x1 xi+1 =
f (xi ) − f (xi−1 )
f(x2) or,
af (b) − bf (a)
c=
f (b) − f (a)
x where,
a = xi−1 b = xi c = xi+1
12
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
Let the initial interval be
(x0 , x1 ) = (a, b) = (1.5, 1.7)
Secant formula:
af (b) − bf (a)
c=
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
(x0 , x1 ) = (a, b) = (1.5, 1.7)
Secant formula:
af (b) − bf (a)
c=
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
2 1.7 1.200093 1.143058 0.046251
(x0 , x1 ) = (a, b) = (1.5, 1.7)
Secant formula:
af (b) − bf (a)
c=
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
2 1.7 1.200093 1.143058 0.046251
(x0 , x1 ) = (a, b) = (1.5, 1.7)
3 1.200093 1.143058 1.130268 0.001013
Secant formula:
af (b) − bf (a)
c=
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
2 1.7 1.200093 1.143058 0.046251
(x0 , x1 ) = (a, b) = (1.5, 1.7)
3 1.200093 1.143058 1.130268 0.001013
Secant formula:
4 1.143058 1.130268 1.129982 5 × 10−6
af (b) − bf (a)
c=
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
2 1.7 1.200093 1.143058 0.046251
(x0 , x1 ) = (a, b) = (1.5, 1.7)
3 1.200093 1.143058 1.130268 0.001013
Secant formula:
4 1.143058 1.130268 1.129982 5 × 10−6
af (b) − bf (a)
c= 5 1.130268 1.129982 1.12998 −2 × 10−6
f (b) − f (a)

13
Example

Find a real root of ex + sin(x) − 4 = 0 correct to 5 decimals using the Secant Method.
Here, Calculation Table:
f (x) = ex + sin(x) − 4
i a b c f (c)
f (1) = −0.4402 (-ve)
[xi−1 ] [xi ] [xi+1 ]
f (2) = 4.2984 (+ve)
1 1.5 1.7 1.200093 0.252498
Let the initial interval be
2 1.7 1.200093 1.143058 0.046251
(x0 , x1 ) = (a, b) = (1.5, 1.7)
3 1.200093 1.143058 1.130268 0.001013
Secant formula:
4 1.143058 1.130268 1.129982 5 × 10−6
af (b) − bf (a)
c= 5 1.130268 1.129982 1.12998 −2 × 10−6
f (b) − f (a)
∵ |f (1.12998)| < 0.000005
∴ a root of the required accuracy = 1.12998
13
Rate of Convergence

εn+1 ∝ εnk

where, √
1+ 5
k= = 1.618 (Golden Ratio)
2

• Super-linear convergence
• Much more faster than Bisection Method (linear convergence)
• Almost comparable to that of Newton-Raphson Method (quadratic convergence)

14
Assignments

1. Show that the Secant method can be visualized as an approximation of the


Newton-Raphson method and hence derive the Secant formula from the Newton-Raphson
iteration formula.
2. Find a real root of x3 − 3x2 + 2x − 2 = 0 correct to 5 decimals, starting the iteration
from initial guess values with unit interval.
a) False Position Method
b) Secant Method
3. (Practical) Write algorithm/pseudocode and program code in C/C++ to determine a real
root of a non-linear equation using:
a) Secant method.
b) False Position method
Check your program for the following equations and show the corresponding outputs:
• x3 − 3x2 + 2x − 2 = 0
• x sin(x) + cos(x) = 0
15
• x2 + 4x + 5 = 0

You might also like