Secant Method
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Theory:
A potential problem in implementing the Newton-Raphson method is the evaluation of the derivative.
Although this is not inconvenient for polynomials and many other functions, there are certain functions whose
derivatives may be extremely difficult or inconvenient to evaluate. For these cases, the derivative can be
approximated by a backward finite divided
difference,
Formula of numerical
Advantages
Although the secant method may be divergent, when it converges it usually does so
at a quicker rate than the false-position method.
Using this gives an advantage in that it prevents divergence, is a shortcoming with
regard to the rate of con- vergence; it makes the finite-difference estimate a less-
accurate approximation of the derivative.
Application:
It is used when derivative of a function is complicated.
Flowsheet:
CHE3001 Computational Methods in Process Engineering
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
%Secant Method
clear all
close all
clc
syms x
f_x=input('Enter the function to be evaluated only in terms of x DO NOT
WRITE =0 while entering :');%Concerned polynomial to be evaluated
x_prev=input('enter the previous value:');%the previous value to start the
iteration
x_old=input('enter the old value:');%the old value to start the iteration
iter_max=input('enter the maximum iterations permitted for a converging
solution any valid guess:');
%x is in radian in case of trigonometric function
err_lim=input('enter the tolerance limit of the method:');%error limit
iter=1;
err=1;%initialising with the maximum possible relative error
disp([' S_No ' ' x_old ' ' x_prev ' ' x_new ' ' error ' ' error_percent
'])
x_new=0;x_old=0;
while(err>=err_lim && iter<=iter_max)
x=x_old;
b=eval(f_x);
x=x_prev;%dummy variable x introduced to falicitate evaluation
a=eval(f_x);
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
b) x^2-3x+6=1 with previous guess of 5 old guess 4 iteration limit 50
1.02.2017 error tolerance 0.0001
47 3.3363 0.912911 0.496334 0.456317 45.6317
Case 2:
error_percent 1 0 5 -2.5
1.5 150
2 5 -2.5 35 15 1500
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Case
3:
Enter the function to be evaluated only in terms of x DO NOT WRITE =0 while
root
Case 4:
Enter the function to be evaluated only in terms of x DO NOT WRITE =0 while
entering :x^2-x+1enter the previous value:4
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Secant Method
Experiment 2 a) x+exp(-x)=sin(x) with previous guess 10 and old guess 12 iteration limit 50
And error tolerance 0.0001
Result:
The code has been successfully validated to calculate root using secant
method
Various pitfalls have been rectified and validated like
When initial values are root itself,
When denominator becomes zero
When the solution does not exist and nature of equation is diverging.
Errors have been displayed and run time error has been considered too.
Thus a generic code has been successfully validated for the secant method .