Gauss and Stokes
Compare independently computed integral pairs, analytic references and individual quadrature contributions.
About this tool
Compare two independently computed sides
Choose Stokes or Gauss, a vector field, radius 0.1–5, resolution n = 8–64 and orientation ε = +1 or −1. Calculate evaluates both sides separately and compares them with a common analytic reference. The probe selects one exact index from the left-hand quadrature without recomputing the integrals. Coordinates, fields and integral values are dimensionless examples.
Stokes: circle and disk
The disk D lies in the xy plane. Stokes' theorem compares ∮C F · dr with ∬D curl F · (0,0,ε) dA. For ε = +1, C₊ runs counterclockwise as seen from +z; for ε = −1, C₋ runs clockwise and the normal reverses with it.
The left approximation uses n oriented straight chords of an inscribed polygon. Each contribution is F at the chord midpoint dotted with the chord vector, equivalently F · t times chord length. This approximates the continuous circular integral; it is not exact circle integration. The right side uses n² equal-weight disk samples at r = R√((j + 1/2)/n), θ = 2π(k + 1/2)/n, each weighted by πR²/n². Polygon area is reported separately from disk area πR².
Gauss: closed sphere and ball
Gauss' divergence theorem normally uses the outward normal: ∯∂V F · n_out dS = ∭V div F dV. Here the chosen normal is εn_out. For inward orientation the comparison is therefore ∯∂V F · (−n_out) dS = −∭V div F dV. The minus sign applies to the volume integral as well.
The sphere has n² equal-area samples. With μ = z/R = −1 + 2(j + 1/2)/n and the same angular midpoints, each sample represents area 4πR²/n². The volume uses n equal-volume shells at r = R∛((j + 1/2)/n) with those angular samples: n³ points, each weighted by 4πR³/(3n³). Both sums use compensated summation. The selected cell is bounded by μ = −1 + 2j/n and −1 + 2(j + 1)/n, and θ = 2πk/n and 2π(k + 1)/n.
Fields and exact references
Swirl F = (−y,x,0) has curl (0,0,2). Twist F = (1+x²+y²)(−y,x,0) has curl (0,0,2+4(x²+y²)). Both have zero divergence. Radial F = (x,y,z), shear F = (x,0,0) and cubic F = (x³,y³,z³) have divergences 3, 1 and 3(x²+y²+z²), respectively, and zero curl. Uniform F = (0,0,1) has zero divergence and curl.
Stokes references are ε2πR² for swirl and ε2πR²(1+R²) for twist; the other original fields give zero. Gauss references are ε4πR³ for radial, ε4πR³/3 for shear and ε12πR⁵/5 for cubic; the other original fields give zero. The error columns give the absolute difference of each numerical side from its reference. Left minus right compares the two approximations directly.
For swirl at R = 1 and ε = +1, the reference is 2π. The chord approximation is n sin(2π/n), illustrating the polygon error as n increases. For radial Gauss at R = 1, both orientations give magnitude 4π with the chosen sign.
Read the drawing and probe
Both geometries can be rotated by dragging or using arrow keys on the focused drawing; xy, xz, yz and oblique views remain available. The sphere is transparent, not an opaque rendering. The selected point, field, unit direction, measure and contribution all refer to the same sample.
A single field scale s = 0.35R / max|F| over all model probes is used for every F arrow. It preserves differences in magnitude and limits the largest spatial arrow to 0.35R. Normal or tangent arrows have length 0.25R; the legend gives both actual factors. Projection can shorten an arrow or reduce it to a point. A field arrow is not independently normalized.
Choices update the result immediately; valid numeric edits update after a short delay or Enter. Animate integral sweeps the actual probes in eight seconds and plots their cumulative weighted contributions. The final sum approaches the numerical left side, not necessarily the exact continuous reference. Large or blocked browser storage shows a backup warning.
Sources
OpenStax: Stokes' theorem and OpenStax: the divergence theorem. The quadrature rules above are explicit numerical approximations.
The helix F=(−y+0.35x,x+0.35y,0.35z+0.7) combines rotation and expansion: divergence1.05, curl(0,0,2). Gauss reference ε1.4πR³; Stokes reference ε2πR². In the flux colour map blue means F·n>0 and pink F·n<0. Each display patch averages the underlying numerical probes; it does not change the quadrature or independently normalize arrows. Selected cells retain their exact numerical boundary. A uniform vertical field illustrates cancelling positive/negative sphere flux.
Only input values are remembered in this browser. Calculated results and experiment histories are not saved.