Vector Calculus
Vector calculus studies differentiation and integration of vector fields. It provides the language for electromagnetism, fluid dynamics, and many PDEs.
Key Points
- Divergence measures net outflow of a vector field.
- Curl measures local rotation or circulation.
- The classical integral theorems (Green, Stokes, Divergence) relate local and global behavior.
Formulas
Divergence
$$\nabla \cdot \mathbf{F} = \sum_{i=1}^n \frac{\partial F_i}{\partial x_i}$$
Curl
$$\nabla \times \mathbf{F}$$
Divergence theorem
$$\iiint_V (\nabla \cdot \mathbf{F}) \, dV = \iint_{\partial V} \mathbf{F} \cdot d\mathbf{S}$$
Code Example
import numpy as np
def divergence(F, x, y, z, eps=1e-5):
dFx_dx = (F(x+eps, y, z)[0] - F(x-eps, y, z)[0]) / (2*eps)
dFy_dy = (F(x, y+eps, z)[1] - F(x, y-eps, z)[1]) / (2*eps)
dFz_dz = (F(x, y, z+eps)[2] - F(x, y, z-eps)[2]) / (2*eps)
return dFx_dx + dFy_dy + dFz_dz