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

Numerical Method (Secant Method)

This document summarizes a presentation on the secant method for solving non-linear equations. The secant method uses successive secant lines to approximate the root of a function f. It requires two initial guesses and does not require evaluating derivatives. The method converges faster than bisection or regula falsi. The rate of convergence is 1.618. Advantages are it is derivative-free and requires only one function evaluation per iteration. Limitations include requiring previous iterations and possible failure to converge if the function is flat.

Uploaded by

Bhuwan Dahal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
620 views

Numerical Method (Secant Method)

This document summarizes a presentation on the secant method for solving non-linear equations. The secant method uses successive secant lines to approximate the root of a function f. It requires two initial guesses and does not require evaluating derivatives. The method converges faster than bisection or regula falsi. The rate of convergence is 1.618. Advantages are it is derivative-free and requires only one function evaluation per iteration. Limitations include requiring previous iterations and possible failure to converge if the function is flat.

Uploaded by

Bhuwan Dahal
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Department of Automobile and Mechanical

Engineering
Numerical Methods
Presentation
on
Secant Method

Members: Anil Khadka (THA074BAM007)


Astitwa Mademba (THA074BAM008)
Babu Ram Khanal (THA074BAM009)
Bhawana Ghimire (THA074BAM010)
Bhuwaneshwar Dahal (THA074BAM011)
Bibek Paudel (THA074BAM012)
1
Secant Method
Introduction:
 The word Secant comes from the Latin secare, means to cut.
 It is used in solving Non-linear (Transcendental) Equations.
 It is also known as Chord Method.

 In numerical analysis, the secant method is a root-finding


algorithm that uses a succession of roots of secant lines to better
approximate a root of a function f.

 Newton- Raphson method requires the evaluation of derivatives of


function which is not always possible. So, the secant method can be
thought of as a finite-difference approximation of Newton's method
and being free from derivative it can be used as alternative to
Newton’s Method. However, the method was developed independently
of Newton's method and predates it by over 3000 years.
2
Features:

 It requires two initial guesses.


 It is an improvement over the method of false position as it
does not require the condition f(x0) f(x1)<0.
 It is not necessary that that the interval must contain the root
which makes it open bracket type(non bracketing).
 It’s rate of convergence is 1.618, which is quite high and the
convergence is referred to as superliner convergence.
 Accuracy : Good
 Approach : Interpolation
Geometrical Derivation:
3

f(x0)
f(x)
 Let f(x)=0 is a non-linear
equation

 x0, x1 = starting values


f(x1)

 Slope of secant line passing


through x0 and x1 :

x
x2 x1 x0
f(x0) = f(x1)
x0 - x2 x1 - x2
f(x2)
on solving,

4 f(x0) = f(x1)
x0 - x2 x1 - x2

We get,

x2 = x1 - x1 – x0 f(x1)
f(x1)- f(x0)

which is an approximation to the root

The general formula for successive approximation is therefore given by :

xn+1 = xn - xn – xn-1 f(xn)


f(xn)- f(xn-1)
where n≥1
Derivation From Newton Raphson:
5
Differentiation is the action of computing
a derivative. The derivative of
a function y = f(x) of a variable x is a
Newton Formula is: measure of the rate at which the value y
of the function changes with respect to
xn+1 = xn - f(xn) the change of the variable x. It is called
the derivative of f with respect to x.
f’(xn)

f(xn) - f(xn-1)
Replacing f’(xn) by a finite difference
xn – xn-1

We get,

xn+1 = xn-1 f(xn) – xn f(xn-1)


f(xn)- f(xn-1)
where n≥1

Hence there is no need for the evaluation of the


derivatives of the function in secant method.
Algorithm For Secant Method:
6

 1) Start

2) Read values of x0 , x1 and e


where x0 and x1 are two initial guesses
e is the desired degree of accuracy or stopping criteria

3) Compute f(x0) and f(x1)

4) Compute x2 = x1 - x1 – x0 f(x1)
f(x1)- f(x0)
5) Test for accuracy of x2
If [ l ] > e
then assign x0 = x1 and x1 = x2 and go to Step 4
Else, go to Step 6

6) Display the require root as x2

7) Stop
Pseudo-Code For Secant Method:
7

  Input function f(x), Tolerance E

 Input x0 and x1

 Repeat
x2 = x1 - x1 – x0 f(x1)
f(x1)- f(x0)

 Assign x0 = x1 and x1 = x2
Till [l] <E

• Print Root = x2
Flow Chart For Secant
Start
Method :
8   Define function

Declare variables a, b, c

Input a and b

 
C=
a=b
b=c

No   <0.00001

Yes

Print c as solution

Stop
Numerical Problem For Secant
9
Method:
 Example:

Q N. Find a root of the equation using secant method correct to the three
decimal place.
Solution,
Here,
Given function
Let the initial guesses be and

We calculate the root of the equation from tabular form as follows:


10

Hence the root is 1.587 correct to three decimal place.


C program Code For Secant Method :
11 #include<stdio.h>
float f(float x)
{
    return(x*x*x-2*x-5); // f(x)= x^3-2x-5
}
float main()
{
    float a,b,c,d,e;
    int count=1,n;
    printf("\n\nEnter the values of a and b:\n"); //(a,b) must contain the
solution.
    scanf("%f%f",&a,&b);
    printf("Enter the values of allowed error :\n");
    scanf("%f",&e);
    do
    {
        if(f(a)==f(b))
        {
            printf("\nSolution cannot be found as the values of a and b are
same.\n");
         }
C program Code For Secant Method :
12
        c=(a*f(b)-b*f(a))/(f(b)-f(a));
        a=b;
        b=c;
        printf("Iteration No-%d    x=%f\n",count,c);
        count++;
        if(count==n)
        {
        break;
        }
    }
while(fabs(f(c))>e);
    printf("\n The required solution is %f\n",c);
 
}
C program code Output For Secant Method :
13
Advantages:
14

• No need to check for sign.


• It converges faster than the bisection as well as regula - falsi
method.

• Requires two guesses that do not need to bracket the root.

• It doesn’t require use of derivative of a given function because


in some practical cases, derivatives become very hard to find.

• It requires only one function evaluation per iteration as


compared to Newton’s method which requires two.

• It is the most economical one giving definitely rapid rate of


convergence at low cost.
Limitations:
15

• It requires previous two iterations for estimating new one.


• Since the secant method does not bracket the root at each
iteration, convergence is not guaranteed.
• If at any iteration f(x n) = f(xn-1), it fails and shows that it does
not converge necessarily.
• If the function is very flat , the secant method can fail.
Division by zero:
16 In the below example, a zero slope is encountered. As the
secant line parallels the x-axis, convergence will not occur.
Notice that our first guesses has a zero slope, which causes
division by zero in the Secant formula, and hence an error in our
calculation.

2
2

f(x)
0
f(x) 0
f(x)

2 2
10 5 0 5 10
 10 10
x x guess1  x guess2
f(x

f  x  Sinx 
)prev. guess
new guess
1
7
Root Jumping:

2
2

f( x)

f( x)
0
f( x 0
)
secant( x)

f( x)

2 2
10 5 0 5 10
 10 x x 0  x 1'  x x 10
f(x)
x'1, (first guess) 1

x0, (previous guess)


Secant line
x1, (new guess)

In the Secant method, an initial guess close to one


root can jump to a location several roots away when a
function is oscillatory in nature.
1
8
Applications

1) Secant method is one of the analytical procedure


available to earthquake engineers for predicting
earthquake performance of structures.

2) Secant method is used to develop linear dynamic


analysis model to have the potential influence
to
behavior of the structure in non-linear range. the

3) It is used for non-linear push over analysis, which


defines the force-displacement relationship of the walls in
the building under lateral load.
1
0

THANKS/धन्यबाद्

You might also like