This is a demonstration of oscillatory behavior of Newton-Raphson method. The example was borrowed from Wiki and modified a little bit.
First of all, create a line that lies on the x-axis. We will be taking the intersection of tangent to the curve and x-axis repeatedly, and this line will come in handy.
Now, define the polynomial
and
This is where we start to apply the method. We calculate the tangent at the point (x0,y0) and get the point i1 where it intersects with the x-axis.
of
The x-coordinate of this intersection point is the next (hopefully better) approximation of the root. Let's do a few more iterations: