Surface Integrals

This notebook describes how to compute surface integrals in Mathematica.  In particular, you'll see how to:
- Compute a surface integral (once reduced to a double integral).
- Use Mathematica to help reduce the surface integral to double integral and evaluate it.
- Visualize a surface.

The functions in this notebook are set up to be easily cut-and-pasted so you can easily experiment with them.

TO SEE WHAT THIS NOTEBOOK PROVIDES:
- Select Kernel|Evaluation|Evaluate_Notebook to execute all the cell and produce the graphics.
- Then scroll through reading the commands and associated comments while you look at the commands' results.
- All input cells are set up such that they can be cut-and-pasted in their entirety for easy "re-use".

The material in this notebook was originally developed by Capt Rob Wolverton and was re-formatted into a tutorial by Lt Col Steve Hadfield, both of the USAF Academy, Dept of Mathematical Sciences.	
Filename: surface_integrals.nb

Compute Surface Integral

The code below is designed to compute a surface integral that accumulates function values f(x,y,z) across the surface given by z = S(x,y).  Here's how the code does it:
Line 1 - Clears any previous symbol definitions to avoid conflicts.
Line 2 - Define the function, f(x,y,z), to be accumulated across the surface (here, f(x,y,z) = x * y * z ).
Line 3 - Defines the surface z = S(x,y), here S(x,y) = 3 + x + 5y.
Line 4 - Evaluated the surface integral projected down to the region D in the xy-place of [0,1]X[0,1].

Clear[f, x, y, z, S]\(f[x_, y_, z_] = x*y*z; 
S[x_, y_] = 3 + x + 5  y; 

    ∫\_0\%1
        \(∫\_0\%1 f[x, y, S[x, y]]*
          Sqrt[1 + D[S[x, y], x]\^2 + D[S[x, y], y]\^2] \[DifferentialD]y 
          \[DifferentialD]x\)
\)

Compute Surface Integral including Finding the Region of Integration

The code below is designed to compute a surface integral that accumulates function values f(x,y,z) across the surface given by z = S(x,y).  However, this code also helps in defining the region in the xy-plane below the surface which can be one of the difficult steps in evaluating surface integrals.  Here's how the code does it for accumulating f(x,y,z)=x*y*z over the portion of the plane 3x+2y+z=12 in the first octant:
NOTE:  This example just shows how to employ Mathematica for this particular problem.  On other more complicated problems more and different commands may be necessary but at least you'll have some hints on how Mathematica can help.
Line 1 - Clears any previous symbol definitions to avoid conflicts.
Line 2 - Define the function, f(x,y,z), to be accumulated across the surface (here, f(x,y,z) = x * y * z ).
Line 3 - Converts an implicitly defined surface (in this case 3x+2y+z=12) and converts it to the form z = S(x,y).
Line 4 - Extracts the results of the Solve on Line 3 to define the surface function S(x,y).
Line 5 - Finds the equation of the line where the plane intersects the xy-plane by solving S(x,y)=0 for y.
Line 6 - Plots the line found in Line 5 to visualize the region of integration.
Line 7 - Uses the results of Line 5 to define the upper limit of integration for y.
Line 8 - Evaluated the surface integral projected down to the region D in the xy-place.

Clear[f, x, y, z, S, ylimit]\(f[x_, y_, z_] = x*y*z; 
Solve[3*x + 2*y + z == 12, z]\)\(S[x_, y_] = %[\([1, 1, 2]\)]; 
Solve[S[x, y] == 0, y]\)\(Plot[%[\([1, 1, 2]\)], {x, 0, 4}, \ PlotLabel -> "Region D", 
	
      DefaultFont -> {"Times", 16}]; 
ylimit[x_] = %[\([1, 1, 2]\)]; 

    ∫\_0\%4
        \(∫\_0\%\(ylimit[x]\)f[x, y, S[x, y]]*
          Sqrt[1 + D[S[x, y], x]\^2 + D[S[x, y], y]\^2] \[DifferentialD]y 
          \[DifferentialD]x\)
\)

Visualize a Surface

Sometimes it helps to visualize the surface over which the integration takes place, especially in trying to project the surface onto a coordinate plane.  Below is code to accomplish this.  Here's how the code goes:
Line 1 - Clears any previous definitions of the symbols used.
Line 2 - Defines the surface to be plotted as z = S(x,y).
Line 3 - Uses Plot3D to plot the surface over the x and y ranges defined in the next two parameters.  NOTE:  You can look up 'Plot3D' under built in functions in the Mathematica Help facility for more options on plotting.

Clear[S, x, y]\(S[x_, y_] := 3 + x + 5  y; 
Plot3D[S[x, y], {x, 0, 1}, {y, 0, 1}]\)