An approximate root of
x³ − 2x² − 5 = 0
is x = 3. By using the Newton–Raphson technique repeatedly, determine the value of the root correct to two decimal places.
We have
\begin{array}{ll}x_1=3 & \\f(x)=x^3-2 x^2-5 & f\left(x_1\right)=4 \\f^{\prime}(x)=3 x^2-4 x & f^{\prime}\left(x_1\right)=15\end{array}
Hence
x_2=3-\frac{4}{15}=2.733
An improved estimate of the value of the root is 2.73 (2 d.p.). The method is used again, taking x_1 = 2.73 as the initial approximation:
\begin{aligned}& x_1=2.73 \quad f\left(x_1\right)=0.441 \quad f^{\prime}\left(x_1\right)=11.439 \\& x_2=2.73-\frac{0.441}{11.439}=2.691\end{aligned}
An improved estimate is x = 2.69 (2 d.p.). The method is used again:
x_1=2.69 \quad f\left(x_1\right)=-0.007 \quad f^{\prime}\left(x_1\right)=10.948
So
x_2=2.69-\frac{(-0.007)}{10.948}=2.691
There is no change in the value of the approximate root and so to two decimal places the root of f (x) = 0 is x = 2.69.
The calculation can be performed in MATLAB^{\circledR} using the roots function:
roots([1 -2 0 -5])
which will produce the real root of 2.69, agreeing with our numerical calculation using the Newton–Raphson method. The two complex roots of the equation will also be re-turned. Technical computing languages make use of a variety of numerical methods and to some extent the user has to take it on trust that they are correctly implemented and tested so that they always produce the correct result.