Classroom Example: Tangent Planes

Clear[x,y]
g[x_,y_]=((x^2)+3(y^2))(E^(-((x^2)+(y^2))));
gx[x_,y_]=D[g[x,y],x];
gy[x_,y_]=D[g[x,y],y];
L[a_,b_,x_,y_]:=g[a,b]+gx[a,b](x-a)+gy[a,b](y-b)
Manipulate[
Show[{Plot3D[g[x,y],{x,-3,3},{y,-3,3},AxesLabel->{x,y,z}],
ParametricPlot3D[{u,v,L[a,b,u,v]},{u,a-.5,a+.5},{v,b-.5,b+.5}]},PlotRange->{{-3,3},{-3,3},{-.11,1.1}}],
{{a,1},-3,3},{{b,2},-3,3}]

Classroom example:

Consider the piecewise defined function where f[x,y]=((((x-y))^2)/((x^2)+(y^2))) except at the origin where it equals 1.

Manipulate[
If[reset,{xMax,yMax,reset}={3,3,False}];

f[x_,y_]:=((((x-y))^2)/((x^2)+(y^2)));
FCT=Plot3D[f[x,y],{x,-3,xMax},{y,-3,yMax},AxesLabel->{x,y,z},Boxed->True];
yzplane=ParametricPlot3D[{0,u,v},{u,-3,3},{v,-3,3}];
xzplane=ParametricPlot3D[{u,0,v},{u,-3,3},{v,-3,3}];
xxplane=ParametricPlot3D[{u,u,v},{u,-3,3},{v,-3,3}];

PLOT:={FCT};
If[showyzplane,AppendTo[PLOT,yzplane]];
If[showxzplane,AppendTo[PLOT,xzplane]];
If[showxxplane,AppendTo[PLOT,xxplane]];
Show[PLOT,PlotRange->{{-3,3},{-3,3},{-2,2}}],
 
{{xMax,3,"max x value for f"},-3,3,0.1,Appearance->"Labeled",ImageSize->Small},
{{yMax,3,"max y value for f"},-3,3,0.1,Appearance->"Labeled",ImageSize->Small},
Delimiter,
{{showyzplane,False},{False,True}},
{{showxzplane,False},{False,True}},
{{showxxplane,False},{False,True}},
{{reset,False},{False,True}},
ControlPlacement->Left]