Numerical Method (Secant Method)
Numerical Method (Secant Method)
Engineering
Numerical Methods
Presentation
on
Secant Method
f(x0)
f(x)
Let f(x)=0 is a non-linear
equation
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)
f(xn) - f(xn-1)
Replacing f’(xn) by a finite difference
xn – xn-1
We get,
1) Start
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
7) Stop
Pseudo-Code For Secant Method:
7
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
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
THANKS/धन्यबाद्