Imagine that you are trying to calculate the total amount of cream on a huge cake that is not coated evenly. Instead of guessing, you can divide the surface of the cake into tiny squares, check how much cream there is in each square, and add it all up – this is exactly a surface integral. And if it is a filled chocolate ball whose filling density changes from the center outward, you will not cut it into cubes crosswise. Instead, you will peel it in spherical layers, from the center to the shell, and sum up the filling in each layer, just as one does a volume integral in a spherical system so as not to miss a single crumb.
In physics, to find the total charge \(Q\) from a continuous charge distribution, we sum the charge density over the relevant region. For a two-dimensional surface with a surface charge density \(\sigma(x,y)\), we use a double integral in Cartesian coordinates: \[Q = \iint \sigma(x,y)\,dx\,dy,\] where the limits of integration are determined by the geometry of the surface.
However, when we deal with three-dimensional bodies with spherical symmetry (such as a charged ball), using Cartesian coordinates leads to complicated limits of calculation. Therefore, we switch to a spherical coordinate system \((r, \theta, \phi)\). The key to this switch is the differential volume element; in a spherical system it is not a simple cube like \(dx\,dy\,dz\), but a piece of volume that grows the farther we move from the origin, and it is defined as \[dV = r^2 \sin\theta\,dr\,d\theta\,d\phi.\] To find the total charge from a volume charge density \(\rho\), we solve the triple integral: \[Q = \iiint \rho(r, \theta, \phi)\, r^2 \sin\theta\,dr\,d\theta\,d\phi.\] For a full sphere, the integration runs along \(\phi\) from 0 to \(2\pi\), \(\theta\) from 0 to \(\pi\), and the radius \(r\) from zero to the edge of the ball \((R)\), which allows an elegant and precise calculation of physical quantities in curved spaces.
In triangle mode: a glowing coordinate grid, with a bright line every \(1\,\text{m}\) and a dim line every \(0.5\,\text{m}\). In ball mode: a holographic sphere of radius \(R = 2\,\text{m}\) with lines of longitude and latitude every \(15^\circ\), a vertical Z axis and a highlighted equator.
Each block is an area element \(\Delta A = \Delta x\,\Delta y\). Its color and brightness are the density \(\sigma(x,y) = xy\) at the center of the block: dim dark red for low charge, and dazzling yellow-white for high charge.
The cyan line is the triangle from the point \((0,0)\) to \((2,2)\): the diagonal line \(y = x\) and the right edge \(x = 2\). A block on the diagonal is counted in the sum in full, including the part of it that sticks out past the line.
To the right: the blocks split into smaller and smaller squares, from 3 large blocks up to 8,256. At the right end \((\infty)\) the blocks become a continuous glowing surface, and the sum is the exact integral.
"Scan \(dy\) first" scans columns, each from the bottom up. "Flip the scan" scans rows, each from the diagonal to the right. What the beam has already collected is lit, and what has not been collected yet is dim.
Each crystal is a volume element \(dV = r^2\sin\theta\,dr\,d\theta\,d\phi\). It is not a cube but a small slice of watermelon. Its color is \(\rho\) at its center, on the same color scale as the blocks.
The highlighted crystal labeled \(dV\) is the last one added: in the outer shell, in the last ring and at the last angle. Its volume is shown in the control column.
They are the upper limits of the triple integral. \(\phi\) copies the wedge into a ring around the Z axis, \(\theta\) copies the ring from the north pole \((\theta = 0)\) to the south pole \((\theta = \pi)\), and \(r\) adds shells from the inside out.
In the bottom left corner of the view: the total charge collected so far, that is, the sum of density times area (or volume) of everything that has been built or scanned.
In the top right corner: the integral with the limits of this moment. The term that the slider being moved changes lights up in gold: \(\Delta x\,\Delta y\), the scan limits, \(r^2\), \(\sin\theta\) or \(d\phi\).
\(\rho = 1.5\) uniform: the whole ball glows in the same color. \(\rho \propto r^2\) (here \(\rho = r^2\)): the center is dark and the outer shells blaze.
Dragging rotates the space through 360 degrees, the wheel zooms in and out, and dragging with the right button pans.
The speed slider only changes the pace of the animation (the scan and the growth of the wedges), and ⏸ freezes it. The sums themselves do not depend on time.
\(x\), \(y\) and \(r\) in meters. \(\sigma\) in units of \(\mu\text{C}\cdot\text{m}^{-2}\), \(\rho\) in units of \(\mu\text{C}\cdot\text{m}^{-3}\), and the charge \(Q\) in \(\mu\text{C}\).