Taylor Series

This code produces plots of a user-supplied function and a specified number of approximating Taylor polynomials about a user-given point.  The Input lines in the code are in separate cells so individual changes can be made more easily.

f[x_] = Input["Enter a function in terms of x:"];

p       = Input["Enter the point about which to approximate:"];

{{x1,x2},{y1,y2}} = Input["Enter the window size in the form {{xmin,xmax},{ymin,ymax}}."];

i       = Input["Enter the number of iterations to perform:"];
t        = i - 1;

ts[x_,a_]=0;
pt = Graphics[{RGBColor[0,0,1], PointSize[.02],Point[{p,f[p]}]}];

Do[ts[x_,a_]=ts[x,a] + (D[f[a],{a,n}] (x - a)^n)/n!;
   
   Show[Plot[{f[x],ts[x,p]},{x,x1,x2},
             PlotStyle->{Thickness[.0075], RGBColor[1,0,0]},
             DisplayFunction->Identity],
        
        pt, PlotRange->{{x1,x2},{y1,y2}},AspectRatio->1/GoldenRatio,
            Axes->{0,0}, DisplayFunction->$DisplayFunction],
        
   {n, 0, t}]

Here is f[x] = Cos[Cosh[x]] and its first five Taylor polynimials expanded about x = 2.  These have been merged into one plot - the command above gives a separate cell for each polynomial.