As systems of nonlinear equations becomes more complex, it will be harder to obtain solutions by substitutions or graphing. Newton’s method allows us to quickly solve for the system. It is also the method that we will implement in solving using NMdev.
What is Newton’s Method?
The newton’s method, also known as the Newton–Raphson method, is a root-finding algorithm which produces successively closer approximations to the actual roots of a real-valued function. The basic concept is to start with an initial guess which is close to the true root, , then to approximate the function by its tangents, and then compute the x-intercept of this tangent line. Suppose we need to find the roots this function , where the equation of the graph is
From the graph, a good close initial guess would be -4. With that, we can draw the tangent line and find the x-intercept of the tangent. This x-intercept will typically be a better approximation to the original function’s root than the first guess. By Taylor series expansion,
. . .
We can substitute in as the solution and as the guess, .
. . .
If is sufficiently close to , is small, and higher powers of can be ignored. We can then rewrite the equation, substituting x as x1 which is the value of x which is closer to the solution, and let f(x)=0 since we are finding the roots where y=0.
Solving for x1 gives
The equation can be rewritten in a general form as a iterative equation,
where xn+1 is a value that is more accurate than xn, provided this initial guess is close enough to the unknown zero, and that f ′(x0) ≠ 0.Using this equation of the graph, we are now able to deduce the value of x1
The idea behind Newton’s system is that each x-intercept that we find with our tangent will be closer to the root than our initial guess. Graphically, when we plot the values and the tangent of x0 on the graph, we will find that the new x-intercept, x1, of this tangent is closer to the root than the initial value of x that we guessed.
We can then continue to repeat this process iteratively until we arrive at a value that is precise enough. Continuing with the process using x1, we can obtain the value x2.
Graphically, we can show that x2 is closer to x1 by plotting the tangent at x=x1.
We will keep iterating Newton’s method until the precision threshold is satisfied or the maximum number of iterations is reached. The difference of x to the actual root by the time the precision threshold is satisfied should be negligible, and hence with Newton’s root method, we are able to find the roots of a nonlinear equation. In the next chapter, we will look at how to apply Newton’s method to a system of non-linear equations, as well as how use the NewtonSystemRoot class in NMdev to implement a solver for systems of non-linera equations.