====== The Newton-Raphson Method for Root-finding ====== Newton's method (also known as the Newton-Raphson method or the Newton-Fourier method) is an efficient algorithm for finding approximations to the zeros (or roots) of a real-valued function $f(x)$. The iteration goes on in this way: $$x_{k+1} = x_k - \frac{f(x_k)}{f(x_k)}$$ From the starting value $x_0$, vertical lines and points are plotted to show the location of the sequence of iteration values $x_1$, $x_2$, …; tangent lines are drawn to illustrate the relationship between successive iterations; the iteration values are in the right margin of the plot. ===== Animation ===== Go along with the tangent lines and iterate. ===== R code =====
library(animation)
saveHTML({
    ani.options(nmax = 100, interval = 1)
    par(mar = c(3, 3, 1, 1.5), mgp = c(1.5, 0.5, 0), pch = 19)
    newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 * x + 100, 
        7.15, c(-6.2, 7.1), main = "")
}, img.name = "newton_method", htmlfile = "newton_method.html", 
    ani.height = 500, ani.width = 500, outdir = getwd(), title = "Demonstration of the Newton-Raphson Method", 
    description = c("Go along with the tangent lines and iterate."))
===== Further Reading ===== - [[wp>Newton%27s_method|Newton's method on Wikipedia]]