f[x_]:= x ^3-x;(*Defining a function f*)

Manipulate[Plot[{f[x],(f[1+h]-f[1])/(h) (x-1)+f[1]},{x,0,3},PlotRange->{{0,3},{-5,25}},ImageSize->600],{h,2,.01}](*Manipulate, over the increment h, Plots of the function f[x] and its secant line from (1,f[1]) to (1+h, f[1+h]), over the interval 0 ≤ x ≤ 3. This particular f[x] is defined above to be x^3-x. *)

Manipulate[Plot[{Cos[x],Sum[(-1)^(k)/((2k)!) x^(2k),{k,0,n}]},{x,-3π,3π},PlotRange->{{-3π,3π},{-1.5,1.5}},ImageSize->600],{n,1,15,1}](*Manipulate, over the value n, the plots of Cos x and the nth partial sum of the Taylor series for Cos x centered at 0, in steps of n = 1*)

Manipulate[NMaximize[{Abs[Cos[x]-Sum[(-1)^(k)/((2k)!) x^(2k),{k,0,n}]],-3π≤x≤3π},x],{n,1,15,1}](*Manipulate, over n,  the numerically computed maximum error of the nth Taylor polynomial of Cos x over the interval [-3 π, 3π]. Result is a pair: the maximum value, and the x providing the max value*)

Manipulate[Plot3D[ a x^2 + b y^2,{x,-3,3},{y,-3,3}],{a,1,9},{b,1,-1}](*Manipulating a plot of a quadratic surface a x^2 + b y^2 as a varies along some positive values and b varies along positive and negative values*)

colors2[z_]:=RGBColor[ z,.9(1-z),  (1-z)];

Manipulate[ContourPlot[ a x^2 + b y^2,{x,-3,3},{y,-3,3},ColorFunction->colors2],{a,1,9},{b,1,-1}](*Manipulating a plot of level sets of the quadratic surface z = a x^2 + b y^2 as a and b vary as above*)

Manipulate[Plot3D[ Sqrt[a x^2 + b y^2],{x,-3,3},{y,-3,3}],{a,1,9},{b,1,9}]

g[x_,y_]:=-(x^2 + 2 y^2);
D[g[x,y],{x,1}]/.{x->a,y->b} 
D[g[x,y],{y,1}]/.{x->a,y->b}
tang[x_,y_,a_,b_]:=D[g[x,y],{x,1}]/.{x->a,y->b} (x-a) + D[g[x,y],{y,1}]/.{x->a,y->b} (y-b) + g[a,b];

Manipulate[Show[{Plot3D[-2a(x-a) - 4b(y-b) +  g[a,b],{x,-1,1},{y,-1,1},ColorFunction->"TemperatureMap",PlotStyle->Opacity[.2],PlotRange->{{-1,1},{-1,1},{-1.5,1.5}},ImageSize->600],Plot3D[g[x,y],{x,-1,1},{y,-1,1},PlotRange->{{-1,1},{-1,1},{-1.5,1.5}}, ImageSize->600]}],{a,-.5,.5},{b,-.1,.5}]

v[x_,y_]:={-y/Sqrt[x^2+y^2],x/Sqrt[x^2+y^2]};(*Defining a vector field*)

vPlot=VectorPlot[v[x,y],{x,-2,2},{y,-2,2},VectorScale->0.05];(*defining the object vPlot to be a vector field plot of the above vector field v. The symbol ';' suppresses the output.*)

circR[t_]:={a Cos[t], a Sin[t]};

Manipulate[Show[vPlot,ParametricPlot[circR[t]/.{a->R},{t,0,2π},PlotRange->{{-3,3},{-3,3}},PlotStyle->{Orange,Thick}]],{R,1,3}](*Manipulating a plot of the vector field v together with a circle of radius R, as R goes from 1 to 3*)

Manipulate[NIntegrate[v[R Cos[t],R Sin[t]].(D[{R Cos[t],R Sin[t]},{t,1}]),{t,0,2π}],{R,1,3}](*values of the line integral of v along the curve in the above plot*)

Div[v[x,y],{x,y}](*divergence of v is zero*)