(* James Dean Palmer                                      jdp5462
Week Number 11                                         7.6.13
http://http.tamu.edu/~jdp5462/math/7.6.13.html

S is the sphere x^2 + y^2 + z^2 = 1, and A(x) = (x+z)i + (y+z)j + (x+y)k.
Calculate I := SurfaceIntegral (A dS). We can make short work of this in 
Mathematica. *)


Ax := x + z

Ay := y + z

Az := x + y

divergence = D[Ax, x] + D[Ay, y] + D[Az, z]

2

(* Now that we have the divergence, we can use Gauss's theorem to evaluate the 
desired integral,  SurfaceIntegral (A dS) = VolumeIntegral (divergence(A dV)). 
It is obviously more convenient to do this in sphereical coordinates.

We integrate on the bounds 0 to Pi for phi, 0 to 2Pi for theta 
and 0 to 1 for r,*)


Integrate [divergence * r^2 * Sin[phi], {r, 0, 1}, {theta, 0, 2Pi}, 
{phi, 0, Pi}]

8 Pi
----
 3