Calculating a surface integral

How to calculate the following surface integral using MichaelE2's DoubleContourIntegral (How can I evaluate surface integral in Mathematica?),

$$\iint_{\Sigma} x^{2} \mathrm{~d} y \mathrm{~d} z+y^{2} \mathrm{~d} z \mathrm{~d} x+z^{2} \mathrm{~d} x \mathrm{~d} y$$

Where $$\Sigma$$ is the outside of the entire surface of the cuboid $$\Omega$$:

$$\{(x, y, z) \mid 0 \leqslant x \leqslant a, 0 \leqslant y \leqslant b, 0 \leqslant z\leqslant c\}$$

Result: $$(a+b+c) a b c$$

PS. MichaelE2's DoubleContourIntegral, e.g. $$\iint_{S^{+}} x^{3} d y d z$$

where $$S$$ is the bottom part of $$\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}+\frac{z^{2}}{c^{2}}=1\;$$ $$S_+$$ - outer side of $$S$$

$$\iint_{S^{+}} P(x, y, z) d y d z=\iint_{S} P \cos \alpha d S$$, normal $$: \vec{n}=(\cos \alpha, \cos \beta, \cos \gamma)$$

Clear[DoubleContourIntegral];
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}];

Clear[a, b, c];
S = {{x, y, z} -> {a Sin[u] Cos[v], b Sin[u] Sin[v], c Cos[u]}, {u,
Pi/2, Pi}, {v, 0, 2 Pi}};
F = {x^3, 0, 0};
\[DoubleContourIntegral]F \[DifferentialD]S

2/5 a^3 b c Pi


Updated:

Clear["Global*"];
F[x_, y_, z_] := {x^2, y^2, z^2};
reg = ImplicitRegion[
0 <= x <= a && 0 <= y <= b && 0 <= z <= c, {x, y, z}];
Integrate[Div[F[x, y, z], {x, y, z}], {x, y, z} \[Element] reg,
Assumptions -> a > 0 && b > 0 && c > 0] // Simplify

a b c (a + b + c)


In my textbook, it is called Gauss formula. $$\iiint_{\Omega}\left(\frac{\partial P}{\partial x}+\frac{\partial Q}{\partial y}+\frac{\partial R}{\partial z}\right) \mathrm{d} v=\iint_{\Sigma} P \mathrm{~d} y \mathrm{~d} z+Q \mathrm{~d} z \mathrm{~d} x+R \mathrm{~d} x \mathrm{~d} y$$

Can there be a general code for finding the unit vector of the normal outside the surface? So we can integrate directly. Especially for non closed surfaces.

• There are surface integrals of the first and second kind. See Encyclopedia of Mathematics for info. Mar 10, 2022 at 10:45
• Thanks. The surface integral in my question is second kind. I just want to find a way to integrate directly. Such as MichaelE2's method. @user64494 Mar 10, 2022 at 11:36

Using Stokes' theorem ($$\;\int_{\partial \Omega} \omega = \int_\Omega d\omega \;$$) this surface integral can be recast as an integral of exterior derivative of the given differential form over the given volume, here $$\Omega$$ is the cuboid, $$\partial \Omega$$ is its surface (boundary), $$\omega=x^2 dy \wedge dz+y^2 dz \wedge dx+ z^2 dx \wedge dy\;$$ and $$d\omega = d(x^2 dy \wedge dz+y^2 dz \wedge dx+ z^2 dx \wedge dy)= 2(x+y+z)\; dx \wedge dy \wedge dz$$ Now this could be calculated in mind, however if there must be a powerful technology let there be

Integrate[2 (x + y + z), {z, 0, c}, {y, 0, b}, {x, 0, a}]

 a b c (a + b + c)


There is (in Mathematica) a convention that in multiple integrals the outermost integral (here $$\int_0^a f\; d x\;$$)is calculated first. This is the simplest approach and it shouldn't be replaced by other more involved methods.

• Nothing wrong with what you say, but I have a different view of the convention, namely, that in Integrate[f[x, y, z], {z, 0, c}, {y, 0, b}, {x, 0, a}], the iterators proceed from outer to inner, so that $\int_0^a f \; dx$ is the innermost integral. One might view it as applying integration operators in the order $(\int_0^c dz)\left[(\int_0^b dy)\left[(\int_0^a dx)\left[f(x,y,z)\right]\right]\right]$, even the Integrate code is typeset as $\int _0^c\int _0^b\int _0^a f(x,y,z)\;dx\,dy\,dz$ Mar 9, 2022 at 15:37
• In my post the outermost term regarded the last one in Integrate[f, {z, 0, c}, {y, 0, b}, {x, 0, a}] i.e. {x, 0, a} and this is compatibile with your comment. Mar 9, 2022 at 16:57
• Thanks! I have updated my question. @Artes Mar 10, 2022 at 11:32

In v13.3 SurfaceIntegrate is introduced, so the problem can be solved as follows:

SurfaceIntegrate[{x^2, y^2, z^2}, {x, y, z} ∈ Cuboid[{0, 0, 0}, {a, b, c}]] // Simplify
(* a b c (a + b + c) *)
`