\documentclass[11pt]{article}
\usepackage[margin=22mm]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{siunitx}
\title{Gauss's Law and Electric Flux}
\author{}\date{}
\begin{document}
\maketitle

\section{Gauss's Law}
Gauss's law relates the total electric flux through a closed surface to the net enclosed charge:
\[
\boxed{\oint_S \mathbf{E}\cdot d\mathbf{A}=\frac{Q_{\rm enc}}{\varepsilon_0}}.
\]
For a point charge \(Q\) at the center of a spherical Gaussian surface, spherical symmetry gives
\[
E(4\pi r^2)=\frac{Q}{\varepsilon_0},
\qquad
\boxed{E(r)=\frac{Q}{4\pi\varepsilon_0r^2}}.
\]
Thus \(E\propto r^{-2}\), while the sphere area is \(A=4\pi r^2\). Their product remains constant:
\[
\Phi_E=E(4\pi r^2)=\frac{Q}{\varepsilon_0}.
\]

\section{Differential Form}
For a volume charge density \(\rho\),
\[
Q_{\rm enc}=\iiint_V \rho\,dV.
\]
Using the divergence theorem gives
\[
\boxed{\nabla\cdot\mathbf{E}=\frac{\rho}{\varepsilon_0}}.
\]

\section{Physical Interpretation}
A Gaussian surface is an imaginary closed surface used to calculate electric flux.
For a positive point charge the field points radially outward; for a negative charge it points inward.
A charge outside the Gaussian surface may affect the local electric field, but contributes zero net flux
through the complete closed surface.

\section{Symmetry}
For a point charge, a spherical Gaussian surface is convenient. For an infinitely long line charge,
a coaxial cylindrical surface is convenient. For an infinite plane charge, a pillbox surface is convenient.

\section{ANITEX Interactive Visualization}
The following block is interpreted by the NEXMASON Science Viewer.

\begin{scienceanimation}
{
  "version":"1.0",
  "id":"gauss-law-001",
  "type":"electromagnetism",
  "subtype":"gauss-law",
  "title":"Gauss's Law: Electric Flux Through a Closed Surface",
  "duration":14,
  "educationalModel":true,

  "parameters":{
    "epsilon0":8.8541878128e-12,
    "chargeC":1.0e-9,
    "initialRadiusM":0.10,
    "minimumRadiusM":0.05,
    "maximumRadiusM":0.50
  },

  "scene":{
    "coordinateSystem":"cartesian-3d-projected",
    "showAxes":true,
    "objects":[
      {"id":"Q1","type":"point-charge","charge":1.0e-9,
       "position":[0,0,0],"label":"+Q"},
      {"id":"GS1","type":"gaussian-sphere","center":[0,0,0],
       "radius":0.10,"transparent":true,"showSurfaceGrid":true,
       "label":"Gaussian Surface"}
    ]
  },

  "field":{
    "type":"electric-field",
    "source":"Q1",
    "equation":"E=Q/(4*pi*epsilon0*r^2)",
    "direction":"radial",
    "showVectors":true,
    "showFieldLines":true,
    "animateFieldLines":true,
    "vectorMagnitudeScaling":"normalized"
  },

  "gaussianSurface":{
    "id":"GS1",
    "interactiveRadius":true,
    "radiusRange":[0.05,0.50],
    "showAreaVectors":true,
    "showNormalVectors":true,
    "showFluxParticles":true,
    "calculateEnclosedCharge":true,
    "calculateFlux":true
  },

  "simulation":{
    "masterClock":true,
    "models":{
      "electricFieldMagnitude":"abs(Q)/(4*pi*epsilon0*r^2)",
      "sphereArea":"4*pi*r^2",
      "electricFlux":"Q_enclosed/epsilon0"
    },
    "radiusAnimation":{
      "enabled":true,
      "mode":"smooth-cycle",
      "minimum":0.05,
      "maximum":0.50,
      "period":8.0
    }
  },

  "display":{
    "showFieldVectors":true,
    "showFieldLines":true,
    "showGaussianSurface":true,
    "showAreaVectors":true,
    "showMeasurements":true,
    "showEquations":true,
    "showGraphs":true,
    "showTimeline":true,
    "controls":["play","pause","restart","seek","speed"],
    "speeds":[0.25,0.5,1,2,4]
  },

  "measurements":[
    {"id":"RADIUS","label":"Gaussian Radius","source":"GS1.radius","unit":"m"},
    {"id":"FIELD","label":"Electric Field Magnitude",
     "expression":"abs(Q)/(4*pi*epsilon0*r^2)","unit":"N/C"},
    {"id":"AREA","label":"Gaussian Surface Area",
     "expression":"4*pi*r^2","unit":"m^2"},
    {"id":"QENC","label":"Enclosed Charge","expression":"Q_enclosed","unit":"C"},
    {"id":"FLUX","label":"Electric Flux",
     "expression":"Q_enclosed/epsilon0","unit":"N m^2/C"}
  ],

  "graphs":[
    {"id":"graph-electric-field",
     "title":"Electric Field Magnitude vs Radius",
     "x":"radius","y":"abs(Q)/(4*pi*epsilon0*radius^2)",
     "xLabel":"r","xUnit":"m","yLabel":"E","yUnit":"N/C",
     "cursor":true,"followSimulation":true},
    {"id":"graph-flux",
     "title":"Electric Flux vs Gaussian Radius",
     "x":"radius","y":"Q_enclosed/epsilon0",
     "xLabel":"r","xUnit":"m","yLabel":"Electric Flux",
     "yUnit":"N m^2/C","cursor":true,"followSimulation":true}
  ],

  "animationTracks":[
    {"id":"surface-expansion","target":"GS1","property":"radius",
     "mode":"oscillate","from":0.05,"to":0.50,"start":2.0,"end":12.0},
    {"id":"field-vector-response","target":"electric-field-vectors",
     "property":"magnitude","expression":"abs(Q)/(4*pi*epsilon0*r^2)",
     "synchronized":true},
    {"id":"flux-response","target":"flux-display","property":"value",
     "expression":"Q_enclosed/epsilon0","synchronized":true}
  ],

  "steps":[
    {"time":0.0,"title":"Point Charge",
     "description":"A positive point charge is placed at the center. Electric-field vectors point radially outward."},
    {"time":2.0,"title":"Gaussian Surface",
     "description":"A spherical Gaussian surface surrounds the charge. Area vectors are normal to the surface."},
    {"time":4.0,"title":"Surface Expansion",
     "description":"The Gaussian sphere expands and its area increases as 4*pi*r^2."},
    {"time":6.0,"title":"Field Decreases",
     "description":"As radius increases, electric-field magnitude decreases as 1/r^2. The arrows become shorter."},
    {"time":8.0,"title":"Flux Remains Constant",
     "description":"The increase in area compensates for the weaker field, so total flux remains Q/epsilon0."},
    {"time":10.0,"title":"E and dA",
     "description":"For the centered point charge, E and the outward area vector dA are parallel everywhere."},
    {"time":12.0,"title":"Gauss's Law",
     "description":"Total electric flux through a closed surface depends on the net enclosed charge."}
  ],

  "interaction":{
    "radiusSlider":{
      "enabled":true,"target":"GS1.radius",
      "minimum":0.05,"maximum":0.50,"step":0.01,
      "label":"Gaussian Surface Radius"
    },
    "chargeSignToggle":{
      "enabled":true,"values":["positive","negative"],
      "description":"Reverse charge sign to reverse the electric-field direction."
    },
    "showFieldLinesToggle":true,
    "showAreaVectorsToggle":true
  },

  "analysis":{
    "equations":[
      "Phi_E=integral_closed(E dot dA)",
      "Phi_E=Q_enclosed/epsilon0",
      "A_sphere=4*pi*r^2",
      "E=Q/(4*pi*epsilon0*r^2)",
      "div(E)=rho/epsilon0"
    ],
    "keyIdeas":[
      "Electric flux is a surface integral.",
      "Only net enclosed charge determines total closed-surface flux.",
      "For spherical symmetry E has constant magnitude on the Gaussian sphere.",
      "For a point charge E decreases as 1/r^2 while sphere area increases as r^2.",
      "Total flux is independent of radius while enclosed charge remains unchanged."
    ],
    "notes":[
      "Animated field lines and particles are educational visualizations; field lines are not moving physical objects.",
      "The point-charge example assumes electrostatics in vacuum.",
      "The 3D Gaussian sphere may be displayed as a projected SVG representation."
    ]
  }
}
\end{scienceanimation}

\section{What to Observe}
During playback, the Gaussian sphere expands and contracts. The electric-field arrows should become shorter
as the radius increases, while the displayed surface area increases. The total flux remains constant because
the enclosed charge remains unchanged. Reversing the sign of \(Q\) reverses the field direction and the sign
of the electric flux.

\end{document}
