Mathematical Principles for Scientific Computing and Visualization  
http://www.farinhansford.com/books/scv
by Gerald Farin and Dianne Hansford

This notebook demonstrates the tangent plane of a bivariate function at a given point.
The given function is f(x,y) = x^2 + y^2.
We take find the tangent plane at (1,1).  Following equation (11.3), we get l(x,y) = -2 + 2x + 2y.

Figure 11.4 was created with this notebook.

See Chapter 11: Computing with Multivariate Functionsfor details.

Updated May 2008

(* Set output folder *)
(SetDirectory[ToFileName[Extract["FileName"/.NotebookInformation[EvaluationNotebook[]],{1},FrontEnd`FileName]]];) 

(* Define a bivariate function *)
(f1[x_,y_]:=(x^2)+(y^2);) 

(* Define the tangent plane to f1 at (1,1) *)
(f2[x_,y_]:=-2+2 x+2 y;) 


(* Plot f1 over some domain *)plot1=Plot3D[f1[x,y],{x,-2,2},{y,-2,2},Mesh->False,ViewPoint->{-0.1`,-1,0.4`},PlotPoints->30,PlotStyle->Directive[Yellow,Specularity[White,20],Opacity[0.8]],BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11}, PlotRange->All];



plot2=Plot3D[f2[x,y],{x,-2,2},{y,-2,2},Mesh->False,ViewPoint->{-0.1`,-1,0.4`},PlotPoints->30,BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11}, PlotRange->All];

plotpoint=Graphics3D[{Point[{1,1,2}],Text["o",{1,1,3}]},ColorOutput->Red,BaseStyle->{"FontFamily"->"Helvetica","FontSize"->11}];

Picture=Show[{plot1,plotpoint,plot2},ViewPoint->{0,-2.3`,1.5`}]


(* Output to postscript files *)
(* Export["function1.eps",plot1]; *) 
(* Export["function2.eps",plot2]; *) 
(* Export["function_combo.eps",Picture] *)