0% found this document useful (0 votes)
26 views5 pages

Lecture 3

The document discusses various numerical methods for finding the roots or solutions of algebraic and transcendental equations, including graphical methods, bisection, Newton-Raphson, and secant methods. The graphical method involves plotting the functions and finding the x-values where they intersect. Bisection repeatedly bisects the interval where the sign of the function changes to narrow in on a root. Newton-Raphson and secant methods use derivatives or secants to take iterative steps toward finding roots. Examples are provided to illustrate each method.

Uploaded by

Debayan Biswas
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)
26 views5 pages

Lecture 3

The document discusses various numerical methods for finding the roots or solutions of algebraic and transcendental equations, including graphical methods, bisection, Newton-Raphson, and secant methods. The graphical method involves plotting the functions and finding the x-values where they intersect. Bisection repeatedly bisects the interval where the sign of the function changes to narrow in on a root. Newton-Raphson and secant methods use derivatives or secants to take iterative steps toward finding roots. Examples are provided to illustrate each method.

Uploaded by

Debayan Biswas
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

Computational Physics: Lecture – III

Graphical method

Finding the solutions of Algebraic and Transcendental equations

𝑓(𝑥) = 0 Algebraic equation

𝑓(𝑥) = 𝑔(𝑥) Transcendental equation

Algebraic equation

𝑓(𝑥) = (1 + 𝑥)! 𝑓(𝑥) = (1 + 𝑥)"

Root at 𝑥 = −1 Root at 𝑥 = −1

Transcendental equation

𝑥 " = 3𝑥 − 1 sin(𝑥) = 0.3 𝑥

The solutions to the equations are points where the two lines intersect.
Root finding (graphical method)

Consider the algebraic equation


𝑓(𝑥) = 𝑥 " − 2 𝑥 ! − 2 𝑥 + 2

For better estimation of the roots, the function should


be plotted in three different regions
𝑥# ± 𝜖, 𝑥! ± 𝜖, and 𝑥" ± 𝜖

One can do the same thing for transcendental


equations

Bisection method

Here, our aim is to find the roots of the function


𝑓(𝑥) in the interval [𝑥$ , 𝑥% ] with the following
conditions.

𝑥$ < 𝑥%

Either 𝑓(𝑥$ ) < 0 and 𝑓(𝑥% ) > 0


or
𝑓(𝑥$ ) > 0 and 𝑓(𝑥% ) < 0.

Such that 𝑓(𝑥$ )𝑓(𝑥% ) < 0

Find the midpoint between [𝑥$ , 𝑥% ]

𝑥$ + 𝑥%
𝑥& =
2

If 𝑓(𝑥$ )𝑓(𝑥& ) < 0 then the root is between [𝑥$ , 𝑥& ] otherwise the root is in between [𝑥& , 𝑥% ].

One need to continue this process, of finding the midpoints, until the condition |𝑓(𝑥& )| ≤ 𝜖,
where 𝜖 is user specified tolerance.
Example:

Consider the equation 𝑓(𝑥) = 𝑥 " − 𝑥 − 2.

First, we need to find the values of 𝑥$ and 𝑥% such that 𝑓(𝑥$ )𝑓(𝑥% ) < 0.

For the above function 𝑥$ = 1 and 𝑥% = 2 satisfy this criterion. 𝑓(1)𝑓(2) = −6 < 0

Since the above function is continuous, there must be a root within the interval [1, 2]
#' !
The midpoint is 𝑥& = !
= 1.5, and 𝑓(1.5)𝑓(2) < 0. So, the root is within the interval
[1.5, 2].

This process needs to be continued until |𝑓(𝑥& )| ≤ 𝜖.

Newtons – Raphson method (to speed up the Bisection method)

Let us say the function 𝑓(𝑥) has a root at 𝑥) . The Taylor expansion of the function is

𝑓(𝑥 + ∆) ≈ 𝑓(𝑥) + ∆ 𝑓 * (𝑥) + 𝑜(𝜀 ! )


where 𝑥 = 𝑥) − ∆

𝑓(𝑥) ) ≈ 𝑓(𝑥) + ∆ 𝑓 * (𝑥) + 𝑜(𝜀 ! )

Since 𝑓(𝑥) ) = 0, we get


𝑓(𝑥)
∆≈−
𝑓 * (𝑥)

For example, 𝑓(𝑥) = 𝐴 𝑥 − 𝐵

𝑓(𝑥) 𝐴𝑥−𝐵 𝐵
∆≈ − =− = − C𝑥 − D
𝑓 (𝑥)
* 𝐴 𝐴
𝐵
𝑥+∆=
𝐴

The function 𝑓(𝑥) has a root at


𝐵
𝑥) =
𝐴

The above example is simple.

Considers a nonlinear function, for example

𝑓(𝑥) = (𝑥 − 1)(𝑥 − 2)
"
To begin with, calculate ∆ at 𝑥 = +.
3
𝑓 E𝑥 = 4G 5/16
∆≈ − =
3 3/2
𝑓 * E𝑥 = G
4

5
∆≈ = 0.20833
24

However, the exact value 𝑥) = 1 (2 is also a root but focus on the first root which is 1)
"
So, ∆ = 𝑥) − 𝑥 = 1 − + = 0.25. The values 0.25 and 0.20833 are close but not the same!

Here, the idea is to start at some location 𝑥, and try to step towards the root using ∆ to guide
the choice of step size.

For a function 𝑓(𝑥), using a starting point 𝑥# , we update 𝑥 according to

𝑓(𝑥# )
𝑥! = 𝑥# + J− K
𝑓 * (𝑥# )

In this step ∆ = 𝑥! − 𝑥#
𝑓(𝑥! )
𝑥" = 𝑥! −
𝑓 * (𝑥! )

After 𝑛 + 1 steps
𝑓(𝑥, )
𝑥,'# = 𝑥, −
𝑓 * (𝑥, )

We can terminate this iteration when the condition |𝑓(𝑥,'# )| < 𝜀, where 𝜀 is the user defined
tolerance.
Secant method

In the Newton – Raphson’s method we used


𝑓(𝑥, )
𝑥,'# = 𝑥, −
𝑓 * (𝑥, )

In the Secant method, we replace 𝑓 * (𝑥, ) with the following

𝑓(𝑥, ) − 𝑓(𝑥, − ℎ)
𝑓 * (𝑥, ) = lim
-→) ℎ

𝑓(𝑥, ) − 𝑓(𝑥,/# )
𝑓 * (𝑥, ) ≈
𝑥, − 𝑥,/#

Thus, we get

𝑥, − 𝑥,/#
𝑥,'# = 𝑥, − P Q 𝑓(𝑥, )
𝑓(𝑥, ) − 𝑓(𝑥,/# )

You might also like