Copyright (c) <2021>, All rights reserved.
This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree.
An iterative method to find the root of mathematical functions
We draw a tangent line to the graph of f(x) at the point x = xn.
This line has slope f′(xn) and goes through the point (xn,f(xn)).
Therefore it has the equation y = f′(xn)(x−xn) + f(xn).
Now, we find the root of this tangent line by setting y = 0 and x = xn+1 for our new approximation.
Solving this equation gives us our new approximation, which is xn + 1 = xn − f′(xn)/f(xn).
Here is a picture to demonstrate what Newton's method actually does: