I have my code above using the Secant Method. If I want to do the Modified Secant Method. How can I change my algorithm? Can anyone give me some ideas, please?
I guess you probably meant this one. It's more like a modified Newton-Raphson method than a secant method, but hey-ho.
It's not guaranteed to converge (as I'm sure that you are aware).
x0 and f0 aren't actually needed in the modified method, but are in the original.
Enter first guess: 0
Enter second guess: 1
Enter tolerable error: 1e-6
Enter delta for modified method: 0.01
Enter maximum iteration: 20
*************
Secant Method
*************
Iteration-1: x = 6.999850 and f(x) = 323.978251
Iteration-2: x = 4.765421 and f(x) = 93.688204
Iteration-3: x = 3.348644 and f(x) = 25.852454
Iteration-4: x = 2.531570 and f(x) = 6.161301
Iteration-5: x = 2.173907 and f(x) = 0.925791
Iteration-6: x = 2.097883 and f(x) = 0.037256
Iteration-7: x = 2.094558 and f(x) = 0.000070
Iteration-8: x = 2.094551 and f(x) = 0.000000
Root is: 2.094551