Lab Report On Secant Method
Lab Report On Secant Method
of
Electrical & Electronic Engineering
Lab. Report on
Experiment No: 01
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,
𝑓(𝑏) − 𝑓(𝑎)
−𝑓(𝑎) = (𝑥 − 𝑎)
(𝑏 − 𝑎)
−𝑓(𝑎)(𝑏 − 𝑎)
= (𝑥 − 𝑎)
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑎) − 𝑏𝑓(𝑎)
⇒ +𝑎=𝑥
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑎) − 𝑏𝑓(𝑎) + 𝑎𝑓(𝑏) − 𝑎𝑓(𝑎)
⇒𝑥=
𝑓(𝑏) − 𝑓(𝑎)
𝑎𝑓(𝑏) − 𝑏𝑓(𝑎)
⇒𝑥=
𝑓(𝑏) − 𝑓(𝑎)
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:
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:
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
Secant Method:
1) Start
2) Define
• Two initial guesses 𝑥0 and 𝑥1
• Tolerance level
3) Repeat
−
• Compute 𝑥𝑛+1 = 𝑥𝑛 𝑓 𝑓((𝑥𝑥𝑛𝑛))(−𝑥𝑛𝑓−(𝑥𝑥𝑛𝑛−−11))
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.