# How to calculate this surface integral

$$\Sigma$$ is the upper side of the surface $$x^{2}+y^{2}+4 z^{2}=4(z \geq 0)$$, now we need to calculate the value of $$\iint_{\Sigma} \sqrt{4-x^{2}-4 z^{2}} d x d y$$ (second-kind surface integral).

When I use the following code to calculate directly, the result is incorrect :

reg = Region[
ImplicitRegion[x^2 + y^2 + 4 z^2 == 4 && z >= 0, {x, y, z}]]
Integrate[Sqrt[4 - x^2 - 4z^2], {x, y, z} ∈ reg]


When I refer to the code in this post for calculation, I can't get the correct result(the answer should be $$\frac{32} {3}$$). In addition, I want to know why this method can't get the right results, and what's wrong with my thinking.

region = Region[
ImplicitRegion[x^2 + y^2 + 4 z^2 == 4 && z >= 0, {x, y, z}]];

Integrate[#, {x, y, z} ∈ region] & /@ ({0, 0, Sqrt[
4 - x^2 - 4 z^2]}.Normalize[{x, y, 4 z}])


But when I use the code of this post, I can get the result of $$\frac{32}{3}$$.

DoubleContourIntegral[field_?VectorQ,
surface : {changeOfVars : ({x_, y_, z_} ->
param : {xuv_, yuv_, zuv_}), {u_, u1_, u2_}, {v_, v1_, v2_}}] :=
Integrate[
Cross[D[param, u], D[param, v]]], {u, u1, u2}, {v, v1,
v2}];
DoubleContourIntegral[{0, 0,
Sqrt[4 - x^2 -
4 z^2]}, {({x, y, z} -> {u, v, Sqrt[4 - u^2 - v^2]/2}), {u, -2,
2}, {v, -Sqrt[4 - u^2], Sqrt[4 - u^2]}}]


What should I do?

Analysis process for reference:

The projection area of surface $$\Sigma$$ on xOy plane is $$D_{x y}=\left\{(x, y) \mid x^{2}+y^{2} \leq 4\right\}$$.

$$\iint_{\Sigma} \sqrt{4-x^{2}-4 z^{2}} \mathrm{d} \mathrm{x} \mathrm{dy}=\iint_{\Sigma}|y| \mathrm{d} \mathrm{x} \mathrm{dy}=\iint_{x^{2}+y^{2} \leq 4}|y| \mathrm{d} \mathrm{x} \mathrm{dy}\\ = 2 \int_{0}^{\pi} d \theta \int_{0}^{2} r^{2} \sin \theta d r =\frac{32}{3}$$

There are the following conversion formulas in the textbook:

$$\iint_{\Sigma} R(x, y, z) d x d y=\pm \iint_{D_{x y}} R[x, y, z(x, y)] d x d y$$

$$\iint_{\Sigma} P(x, y, z) d y d z=\pm \iint_{D_{y z}} P[x(y, z), y, z] d y d z$$

$$\iint_{\Sigma} Q(x, y, z) d x d z=\pm \iint_{D_{x z}} Q[x, y(x, z), z] d x d z$$

$$\begin{array}{l} \iint_{x} P(x, y, z) \mathrm{d} y \mathrm{d} z+Q(x, y, z) \mathrm{d} z \mathrm{d} x+R(x, y, z) \mathrm{d} x \mathrm{d} y \\ =\iint[P(x, y, z) \cos \alpha+Q(x, y, z) \cos \beta+R(x, y, z) \cos \gamma] \mathrm{d} S \\ =\pm \iint_{D}\left[P(x(u, v), y(u, v), z(u, v)) \frac{\partial(y, z)}{\partial(u, v)}+Q(x(u, v), y(u, v)\right. \\ \left.z(u, v)) \frac{\partial(z, x)}{\partial(u, v)}+R(x(u, v), y(u, v), z(u, v)) \frac{\partial(x, y)}{\partial(u, v)}\right] \mathrm{d} u \mathrm{d} v\\ \overset{In particular, when z=z(x,y)}{\Longrightarrow} \pm \iint_{D}\left [-P(x, y, z(x, y)) \frac{\partial z(x,y)}{\partial(x)}-Q(x, y\right. \\ \left.z(x,y)) \frac{\partial z(x,y)}{\partial y}+R(x, y, z(x,y)) \right] \mathrm{d} x \mathrm{d} y \end{array}$$

In particular, when $$z=z(x,y)$$:

DForm[f_] :=
f /. {Derivative[inds__][g_][vars__] :> Which[Length[{vars}] >= 2,
Apply[Defer[D[g[vars], ##]] &,
Transpose[{{vars}, {inds}}] /. {{v_, 1} :> {v}, {v_, 0} :>
Nothing}], Length[{vars}] == 1,
Apply[Defer[Dt[g[vars], #]] &,
Transpose[{{vars, inds}}] /. {{v_, 1} :> {v}}]]} //
jacobian[u_, v_, {x_, y_}] := Det[( {
{D[u, x], D[u, y]},
{D[v, x], D[v, y]}
} )] // DForm
(*In particular,when z=z(x,y)*)
jacobian[y, z[x, y], {x, y}]
jacobian[z[x, y], x, {x, y}]
jacobian[x, y, {x, y}](*Inner side of surface ∑*)
-jacobian[x, y, {x, y}](*Outside of surface ∑*)


$$\begin{array}{c} \vec{n}=(\cos \alpha, \cos \beta, \cos \gamma)=\frac{1}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}}\left(-z_{x},-z_{y}, 1\right) \\ \therefore \cos \gamma=\frac{1}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}} \\ \frac{d x d y}{d s}=\cos \gamma=\frac{1}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}} \\ \frac{d y d z}{d s}=\cos\alpha=-\frac{z_{x}}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}} \\ \frac{d z d x}{d s}=\cos \beta=-\frac{z_{y}}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}}\\ \therefore \iint_{\Sigma} R(x, y, z) d x d y=\iint_{\Sigma} R(x, y, z) \cos \gamma d S \\ =\iint_{\Sigma} R[x, y, z(x, y)] \cdot \frac{1}{\sqrt{1+z_{x}^{2}+z y^{2}}} d S \\ =\iint_{D_{x y}} R[x, y, z(x, y)] \cdot \frac{1}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}} \cdot \sqrt{1+z_{x}^{2}+z_{y}^{2}} d x d y \\ =\iint_{D_{xy}} R[x, y, z(x, y)] d x d y \end{array}$$

$$\begin{array}{c} \iint_{\Sigma} Q(x, y, z) d y d z=\iint_{\Sigma} Q(x, y, z) \cos \beta d S \\ =\iint_{\Sigma} Q[x, y, z(x, y)] \cdot \frac{-z_{x}}{\sqrt{1+z_{x}^{2}+z y^{2}}} d S \\ =\iint_{D_{xy}} Q[x, y, z(x, y)] \cdot \frac{-z_{x}}{\sqrt{1+z_{x}^{2}+z_{y}^{2}}} \cdot \sqrt{1+z_{x}^{2}+z_{y}^{2}} d x d y \\ =\iint_{D_{xy}} -Q[x, y, z(x, y)]z_{x} d x d y \end{array}$$

• okay I think my now deleted answer was talking about the surface area, but I forgot you were integrating Sqrt[4 - x^2 - 4z^2] over that surface. However, my point still stands - you need to integrate over the Disk[{0,0},2] and multiply by the area element - I will update my answer. Jul 30, 2020 at 2:06
• I think you should post the integral on Mathematics stack exchange, because I do not believe 32/3 is the correct answer - see my revised answer for why. I believe Mathematica gives the correct answer when it does Integrate[Sqrt[4 - x^2 - 4z^2], {x, y, z} ∈ reg] Jul 30, 2020 at 13:29
• I think the reason you get 32/3 with DoubleContourIntegral is because you're integrating a vector field that's pointing directly up: DoubleContourIntegral[{0, 0, Sqrt[4 - x^2 - 4 z^2]},... and you have a dot product with the normal that measures the flux of the field. So in that sense it's correct that it's 32/3, however, the other surface integral that you're having problems with is scalar - it accumulates a scalar field over infinitesimal surface patches, and the dot product doesn't make sense in this context. Jul 30, 2020 at 14:26
• I can illustrate the above discrepancy very simply. Let's take the curved surface of a cylinder and the function z=1. There is obviously no flux over the boundary because the normals are all perpendicular. Using DoubleContourIntegral[{0, 0, 1}, {({x, y, z} -> {Sqrt[1 - v^2], Sqrt[1 - u^2], z}), {u, -1, 1}, {v, -Sqrt[1 - u^2], Sqrt[1 - u^2]}}] we get zero. However, a scalar surface integral of 1 would give the true surface area (z Pi). Jul 30, 2020 at 14:43

I've been back and forth trying to work out why Mathematica was getting the surface integral 'wrong'. But Mathematica can do surface integrals properly. See this answer. It turns out your original calculation with the region is correct after all:

reg = ImplicitRegion[x^2 + y^2 + 4 z^2 == 4 && z >= 0, {x, y, z}];
Integrate[Sqrt[4 - x^2 - 4z^2], {x, y, z} ∈ reg]

(* result: 32/9 (2 EllipticE[3/4] + EllipticK[3/4]) *)

N[%]

(* 16.2796 *)


Note: My answer before of 32/3 was wrong because an incorrect usage of nested With and the derivative was giving the wrong surface element of 1.

All that remains is to show that your integrals are incorrect and that the surface integrals are a lot more complicated:

$$\iint_{\Sigma} \sqrt{4-x^{2}-4 z^{2}} \mathrm{d}\Sigma=\iint_{\Sigma}|y| \mathrm{d} \Sigma$$

We substitute $$x=r\cos(\theta)$$, $$y=r\sin(\theta)$$ and $$z=\frac{1}{2} \sqrt{4-x^2-y^2}=\frac{1}{2} \sqrt{4-r^2}$$. The element of area for cylindrical coordinates is $$r\ \mathrm{d}r\ \mathrm{d}\theta$$ (see $$S_z$$ here). This means that:

$$\mathrm{d}\Sigma=\left\|\frac{\partial{\Sigma}}{\partial{r}}\times\frac{\partial{\Sigma}}{\partial{\theta}}\right\|\cdot r\ \mathrm{d}r\mathrm{d}\theta=r \sqrt{\frac{1}{4} \left| \frac{r}{\sqrt{4-r^2}}\right| ^2+1}$$

$$\iint_{\Sigma} \sqrt{4-x^{2}-4 z^{2}} \mathrm{d}\Sigma=\int_{0}^{2}\int_{0}^{2\pi}|r\sin(\theta)|\cdot r \sqrt{\frac{1}{4} \left| \frac{r}{\sqrt{4-r^2}}\right| ^2+1}\ \mathrm{d}\theta\ \mathrm{d}r$$

The result of this integral is quite messy, involving elliptical functions.

I will show how to calculate it in both cartesian and cylindrical:

Cartesian:

With[{z2 = (4 - x^2 - y^2)/4},
With[{z = Sqrt[z2]},
Integrate[
Sqrt[4 - x^2 - 4 z2] Sqrt[1 + D[z, x]^2 + D[z, y]^2], {x,
y} \[Element] Disk[{0, 0}, 2]]
]
] // FullSimplify

(* 8/27 (-24 - 24 I Sqrt[2] 3^(1/4) EllipticE[1/2 - 7/(8 Sqrt[3])] -
12 (-2 + Sqrt[3]) EllipticE[-8 (12 + 7 Sqrt[3])] +
12 (-2 + Sqrt[3]) EllipticE[
I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] -
60 (2 + Sqrt[3]) EllipticF[
I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] +
I Sqrt[6 (168 + 97 Sqrt[3])] EllipticK[1/2 - 7/(8 Sqrt[3])] +
60 I (2 + Sqrt[3]) EllipticK[97 + 56 Sqrt[3]]) *)

N[%]

(* 16.2796 *)


Cylindrical:

z = Sqrt[4 - r^2]/2;
sz[r_, \[Theta]_] := {r, \[Theta], z}
el = Norm[Cross[D[sz[r, \[Theta]], r], D[sz[r, \[Theta]], \[Theta]]]];
Integrate[Abs[r Sin[\[Theta]]]*el*r, {\[Theta], 0, 2 \[Pi]}, {r, 0, 2}]

(* 8/27 (-24 - 24 I Sqrt[2] 3^(1/4) EllipticE[1/2 - 7/(8 Sqrt[3])] +
24 EllipticE[-8 (12 + 7 Sqrt[3])] -
12 Sqrt[3] EllipticE[-8 (12 + 7 Sqrt[3])] -
24 EllipticE[I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] +
12 Sqrt[3]
EllipticE[I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] -
120 EllipticF[I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] -
60 Sqrt[3]
EllipticF[I ArcCsch[3^(1/4) + 3^(3/4)], -8 (12 + 7 Sqrt[3])] +
I Sqrt[6 (168 + 97 Sqrt[3])] EllipticK[1/2 - 7/(8 Sqrt[3])] +
120 I EllipticK[97 + 56 Sqrt[3]] +
60 I Sqrt[3] EllipticK[97 + 56 Sqrt[3]]) *)

N[%]//Chop

(* 16.2796 *)


Both of these numerical results agree with the result from integrating over the ImplicitRegion except the expressions weren't as simple. Presumably there are some different coordinate transformations going on internally which leads to the nicer expression 32/9 (2 EllipticE[3/4] + EllipticK[3/4]).

• I refer to the code of this post. The result of this code is $\frac{32}{3}$: DoubleContourIntegral[field_?VectorQ, surface : {changeOfVars : ({x_, y_, z_} -> param : {xuv_, yuv_, zuv_}), {u_, u1_, u2_}, {v_, v1_, v2_}}] := Integrate[ Dot[field /. Thread[changeOfVars], Cross[D[param, u], D[param, v]]], {u, u1, u2}, {v, v1, v2}]; DoubleContourIntegral[{0, 0, Sqrt[ 4 - x^2 - 4 z^2]}, {({x, y, z} -> {u, v, Sqrt[4 - u^2 - v^2]/2}), {u, -2, 2}, {v, -Sqrt[4 - u^2], Sqrt[4 - u^2]}}]. Jul 30, 2020 at 1:38
• Thank you very much for your reply. I have added some knowledge points to the post. Jul 31, 2020 at 0:29