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

Lab Report On Secant Method

Uploaded by

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

Lab Report On Secant Method

Uploaded by

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

Dept.

of
Electrical & Electronic Engineering

Lab. Report on

EEE 2206: NUMERICAL METHODS &


STATISTICS IN ENGINEERING SESSIONAL

Student Name: Iftiar Rahman Emon

Student ID: 211136

Experiment No: 01
Experiment Name: Solution of non-linear equation using false position, fixed
point iteration and secant methods.

Date of Experiment: 22-09-2024


Date of Submission: 29-09-2024

Course Teacher: Md. Rabiul Islam


Lecturer, EEE, JUST
Comments:

JASHORE UNIVERSITY OF SCIENCE & TECHNOLOGY


Jashore-7408, Bangladesh
Experiment No: 03
Experiment Name: Solution of non-linear equation using false position, fixed point iteration
and secant methods.

1. Objectives:
• Implement and compare numerical methods (false position, fixed point iteration,
and secant) in MATLAB to find the roots of a non-linear equation.To compare
different numerical methods (false position, fixed point iteration, and secant
methods) in MATLAB for solving non-linear equations.
• Develop a MATLAB code capable of solving non-linear equations using the
aforementioned methods.
• Analyze the convergence properties and efficiency of each method for different
types of non-linear equations.

2. Theory:
False Position Method:
Consider an equation f(x) = 0, which contains only one variable, i.e., x. To find the real
root of the equation f(x) = 0, we consider a sufficiently small interval (a, b) where a < b
such that f(a) and f(b) will have opposite signs. According to the intermediate value
theorem, this implies a root lies between a and b.

Also, the curve y = f(x) will meet the x-axis at a certain point between A[a, f(a)] and B[b,
f(b)]. Also, the curve y = f(x) will meet the x-axis at a certain point between A[a, f(a)] and
B[b, f(b)].

Now, the equation of the chord joining A[a, f(a)] and B[b, f(b)] is given by: Now, the
equation of the chord joining A[a, f(a)] and B[b, f(b)] is given by:
𝑓(𝑏) − 𝑓(𝑎)
𝑦 − 𝑓(𝑎) = (𝑥 − 𝑎)
(𝑏 − 𝑎)
Let y = 0 be the point of intersection of the chord equation (given above) with the x-axis.
Then,
𝑓(𝑏) − 𝑓(𝑎)
−𝑓(𝑎) = (𝑥 − 𝑎)
(𝑏 − 𝑎)

This can be simplified as:

−𝑓(𝑎)(𝑏 − 𝑎)
= (𝑥 − 𝑎)
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑎) − 𝑏𝑓(𝑎)
⇒ +𝑎=𝑥
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑎) − 𝑏𝑓(𝑎) + 𝑎𝑓(𝑏) − 𝑎𝑓(𝑎)
⇒𝑥=
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑏) − 𝑏𝑓(𝑎)
⇒𝑥=
𝑓(𝑏) − 𝑓(𝑎)

Thus, the first approximation is x1 = [af(b) – bf(a)]/ [f(b) – f(a)] Also,


x1 is the root of f(x) if f(x1) = 0.
If f(x1) ≠ 0 and if f(x1) and f(a) have opposite signs, then we can write the second
approximation as:
x2 = [af(x1) – x1f(a)]/ [f(x1) – f(a)]
Similarly, we can estimate x3, x4, x5, and so on.
Geometrical representation of the roots of the equation f(x) = 0 can be shown as:
Figure 3.1 Geometrical representation of the roots of the equation f(x) = 0 using false
position method
Fixed Point Iteration:
The fixed point iteration method uses the concept of a fixed point in a repeated manner to
compute the solution of the given equation. A fixed point is a point in the domain of a
function g such that g(x) = x. In the fixed point iteration method, the given function is
algebraically converted in the form of g(x) = x.
Suppose we have an equation f(x) = 0, for which we have to find the solution. The
equation can be expressed as x = g(x). Choose g(x) such that |g’(x)| < 1 at x = xo where
x0, is some initial guess called fixed point iterative scheme. Then the iterative method is
applied by successive approximations given by xn = g(xn-1), that is, x1 = g(x0), x2 = g(x1)
and so on.

Secant Method:
The tangent line to the curve of y = f(x) with the point of tangency (x0, f(x0) was used in
Newton’s approach. The graph of the tangent line about x = α is essentially the same as
the graph of y = f(x) when x0 ≈ α. The root of the tangent line was used to approximate α.
Consider employing an approximating line based on ‘interpolation’. Let’s pretend we
have two root estimations of root α, say, x0 and x1. Then, we have a linear function q(x) =
a0 +a1x using q(x0) = f (x0), q(x1) = f (x1).
This line is also known as a secant line. Its formula is as follows:

(𝑥1 − 𝑥)𝑓(x0) + (𝑥 − 𝑥0)𝑓(𝑥1)


𝑞(𝑥) =
𝑥1 − 𝑥0

The linear equation q(x) = 0 is now solved, with the root denoted by x2. This results in
𝑥 1 − 𝑥0
𝑥2 = 𝑥1 − 𝑓(𝑥1). 𝑓 (𝑥1) − 𝑓(𝑥2)

3. Algorithms:

False Position Method


1) Start
2) Define
• Two initial guesses: xo and x1 where f(x0).f(x1)<0
• Tolerance level.

3) Repeat
• Compute: 𝑥2 = 𝑥1 − 𝑓 𝑓((𝑥𝑥11))(−𝑥𝑓1−(𝑥𝑥00))

• If f(x0).f(x1)<0 , set 𝑥1 = 𝑥2
• Else set 𝑥0 = 𝑥2
• Check: If | f(x1)| < tolerance, stop.
4) Display: Root approximation 𝑥2
5) End

Fixed Point Iteration Method


1) Start
2) Define
• Function Rearranged as 𝑥 = 𝑔(𝑥)
• Initial guess 𝑥0
• Tolerance level
3) Repeat

• Compute: 𝑥𝑛+1 = 𝑔(𝑥𝑛)


• Check if | 𝑥𝑛+1 − 𝑥𝑛| < tolerance , stop
4) Display: Root approximation 𝑥𝑛+1
5) End

Secant Method:
1) Start
2) Define
• Two initial guesses 𝑥0 and 𝑥1
• Tolerance level
3) Repeat


• Compute 𝑥𝑛+1 = 𝑥𝑛 𝑓 𝑓((𝑥𝑥𝑛𝑛))(−𝑥𝑛𝑓−(𝑥𝑥𝑛𝑛−−11))

• Check 𝑥𝑛+1 − 𝑥𝑛 < tolerance, stop


• Update 𝑥𝑛−1 = 𝑥𝑛, 𝑥𝑛 = 𝑥𝑛+1
4) Display: Root approximation 𝑥𝑛+1
5) End

4. MATLAB Script Code and Output:


False position Code:
Fixed Point Iteration Method:
:
Secant Method Code:
5. Discussion:

This experiment evaluated three numerical methods for finding roots of nonlinear equations:
False Position, Fixed Point Iteration, and Secant. Each method has distinct characteristics and
convergence properties.

The False Position method, a hybrid of Bisection and Secant, guarantees convergence when the
initial guesses bracket the root. However, it can be slow, particularly when the root is near an
endpoint.

Fixed Point Iteration involves rearranging the equation as x = g(x). Its effectiveness hinges on
the choice of g(x) and the initial guess. A poorly selected g(x) or initial guess can lead to non-
convergence or slow convergence.

The Secant Method, using two initial guesses, approximates the root through secant lines. It
generally converges faster than Fixed Point Iteration but may struggle if the initial guesses are not
sufficiently close.

6. In conclusion, the optimal method for a given nonlinear equation depends on the
function's behavior and the chosen initial conditions. A thorough understanding of each method's
strengths and weaknesses is essential for selecting the most effective approach in practical
applications.

You might also like