Quadratic Approximations and Critical Points
Discovery Project, p. 980
Andy Long, Fall, 2015

Clear[a,b]
f[x_,y_]:=E^(-(x^2+y^2))
a=0
b=0
Dx=1
Dy=1

dfdx[x_,y_]=D[f[x,y],x];
dfdy[x_,y_]=D[f[x,y],y];
d2fdxx[x_,y_]=D[f[x,y],{x,2}];
d2fdxdy[a_,b_]=D[D[f[x,y],x],y]
d2fdyy[x_,y_]=D[f[x,y],{y,2}];

xmin=a-Dx;
xmax=a+Dx;
ymin=b-Dy;
ymax=b+Dy
fx=dfdx[a,b]
fy=dfdy[a,b]
fxx=d2fdxx[a,b]
fxy=d2fdxdy[a,b]
fyy=d2fdyy[a,b]

L[x_,y_]:=f[a,b]+fx(x-a)+fy(y-b)
Plot3D[{f[x,y],L[x,y]},{x,xmin,xmax},{y,ymin,ymax},AxesLabel->{"x","y","f(x,y) and Tangent Plane L(x,y)"}]

Q[x_,y_]:=L[x,y]+0.5(fxx(x-a)^2+2fxy(x-a)(y-b)+fyy(y-b)^2)
Plot3D[{L[x,y],Q[x,y]},{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[{f[x,y],L[x,y],Q[x,y]},{x,xmin,xmax},{y,ymin,ymax},AxesLabel->{"x","y","f(x,y) and Tangent Plane and Bowl"}]

Plot3D[dfdx[x,y],{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[dfdy[x,y],{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[d2fdxx[x,y],{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[d2fdxdy[x,y],{x,xmin,xmax},{y,ymin,ymax}]
Plot3D[d2fdyy[x,y],{x,xmin,xmax},{y,ymin,ymax}]