Given a function (specified in the box labeled "$f(x)=$") and specified initial guess "$x_0$", this demo computes the $N^\mathrm{th}$ iteration of Newton's approximation of a solution of $f(x)=0$.
Recall that Newton's method takes an approximate solution $x=a$ and (hopefully) improves it by replacing $x=a$. with the $x$-intercept of the tangent line based at $x=a$ (which can be found as long as the tangent is not horizontal - i.e. as long as $f'(a) \not=0$). Essentially, we assume that $f(x)$ is well approximated by its tangents so that a root of a tangent line should be approximately the root of the function.
The tangent at $x=a$ is given by $y=f(a)+f'(a)(x-a)$, so this line's $x$-intercept is found by solving $0=f(a)+f'(a)(x-a)$ which gives us $x=a-f(a)/f'(a)$. Thus, assuming $f'(x_n) \not=0$, Newton's method computes the $(n+1)^{\mathrm{st}}$ approximation from the $n^{\mathrm{th}}$ approximation using the formula: $$x_{n+1} = x_n - \dfrac{f(x_n)}{f'(x_n)}$$
We note that Newton's method is not guaranteed to work with every function and every initial guess. The best we can guarantee is that if $f(x)$ has a root at $x=r$, $f'(r) \not=0$, and $f'(x)$ is continuous on an interval about $x=r$, then Newton's method will converge for any initial guess drawn from that interval. However, we have no way to determine what this interval is - we just know one exists if $f(x)$ is nice enough.
Several built in demos (with preset function, $a$ value, and plot domain) are provided in a drop down list. If you change a box entry, simply click outside that box to automatically recompute. If the "Show plot?" box is checked a visualization of Newton's method will be displayed. The drop down box "Plot or animation?" determines whether a static plot or an animation is displayed.
Warning: If you choose an animation with a relatively large value of $N$, the animation can take a while to render. If the page hangs and won't update, then refresh the webpage and try again.
The computation above is powered by SageMath. The Sage code is embedded in this webpage's html file. To view the code instruct your browser to show you this page's source. For example, in Chrome, right-click and choose "View page source".