# newton's method

## 2495 days ago by chrisphan

var('x') f = lambda x: x^5 - 5*x + 2 fp = lambda x: 5*x^4 - 5 t = 2.5 frm4 = plot(f, 1, 2.5) + point((t, 0), rgbcolor=(0.75, 0, 0), pointsize=30) frms = [frm4] for i in range(0, 4): nt = t - f(t)/fp(t) frm2 = frm4 + line([(t, 0), (t, f(t))], rgbcolor=(0.75, 0, 0)) frm3 = frm2 + plot(fp(t)*(x - t) + f(t), nt, 2.5, rgbcolor=(0, 0.75, 0)) t = nt frm4 = frm3 + point((t, 0), rgbcolor=(0.75, 0, 0), pointsize=30) frms.extend([frm2, frm3, frm4]) a = animate(frms) html("Animation of Newton's method for $f(x) = " + latex(f(x)) + "$ and $x_0 = 2.5$.") show(a, delay = 100)
 Animation of Newton's method for f(x) = x^{5} - 5 \, x + 2 and x_0 = 2.5. Animation of Newton's method for f(x) = x^{5} - 5 \, x + 2 and x_0 = 2.5.