2.3 Algorithm
The steps of the Newton-Raphson method to find the root of an equation \(f(x)=0\) are
Evaluate \(f'(x)\) symbolically
Use an initial guess of the root, \(x_i\), to estimate the new value of the root, \(x_{i+1}\), as
\(x_{i+1} = x_i-\frac{f(x_i )}{f'(x_i )}\)
Find the absolute relative approximate error \(|∈_a |\) as
\(|∈_a | = |\frac{(x_{i+1}- x_i)}{x_{i+1}} |×100\)
Compare the absolute relative approximate error with the pre-specified relative error tolerance, \(∈_s\). If \(|∈_a|> ∈_s\), then go to Step 2, else stop the algorithm. Also, check if the number of iterations has exceeded the maximum number of iterations allowed. If so, one needs to terminate the algorithm and notify the user.