taylor polynomial convergence

2396 days ago by chrisphan

var('x') f = sin(x) background = plot(f, x, -10, 10) frames = [] for i in range(0, 10): tay = taylor(f,x, 0, 2*i+1) txt = "Graph of $y= T_{" + str(2*i+1) + "}(x)$ and $y = " + latex(f) + "$." formdisplayed = text(txt, (4.75, 1.5), rgbcolor=(0,0.25,0), fontsize=13) frames.extend([background + plot(tay, x, -10, 10, rgbcolor=(1, 0, 0)) + formdisplayed]*5) show(animate(frames, ymin = -2, ymax = 2, xmin=-10, xmax = 10, figsize=[8, 5])) 
       
var('x') f = exp(x) background = plot(f, x, -2, 3) frames = [] for i in range(1, 10): tay = taylor(f,x, 0, i) txt = "Graph of $y= T_{" + str(i) + "}(x)$ and $y = " + latex(f) + "$." formdisplayed = text(txt, (1.25, 10), rgbcolor=(0,0.25,0), fontsize=13) frames.extend([background + plot(tay, x, -2, 3, rgbcolor=(1, 0, 0)) + formdisplayed]) show(animate(frames, ymin = -1, ymax = exp(3), xmin=-2, xmax = 3, figsize=[8, 5]))