Thursday, September 24, 2015

Write an Algorithm for the Secant Method.

Step1:- Decide two initial points x1 & x2, & accuracy level required, E.
Step2:- Compute f ( x1 ) & f ( x2 )
Step3:- Compute
             x3 = x2 - ( (f 2 (x2-x1) ) / ( f 2 - f 1 ) )
Step4:- Test for accuracy of x3.
             If absolute value of (x3 – x2) / x3 > E, then
                  Set x1 = x2 & f1 = f2
                  Set x2 = x3 & f2 = f (x3)
                  Go to step 3
            otherwise,
                  set root = x3
            print results.
Step5:- Stop