Expand description
Vector calculus: gradient, divergence, curl, laplacian. Vector calculus: gradient, divergence, curl, Laplacian (in Cartesian, cylindrical and spherical coordinates), directional derivatives, line integrals and scalar potentials.
Scalar fields are Ex; vector fields are n×1 column-vector
Matrix values whose components are expressed in the coordinate
basis of the chosen CoordinateSystem (e.g. (F_r, F_φ, F_z) for
cylindrical coordinates).
§Coordinate conventions
| System | vars order | Scale factors (h₁, h₂, h₃) |
|---|---|---|
Cartesian | (x, y, z) (any dimension) | (1, 1, 1) |
Cylindrical | (r, φ, z) | (1, r, 1) |
Spherical | (r, θ, φ) — physics convention: θ polar angle from +z, φ azimuth | (1, r, r·sin θ) |
The Cartesian functions (gradient, divergence, curl,
laplacian) work in any dimension (curl: 3-D only). The _in
variants take an explicit coordinate system; the curvilinear systems
are 3-D and require exactly three variables.
§Shape preconditions
Wrong field dimensions / variable counts are programming errors and
panic (like slice indexing), consistent with the rest of this
module. Mathematical failure (e.g. a non-conservative field passed to
scalar_potential) returns Err.
Enums§
- Coordinate
System - Orthogonal coordinate systems supported by the vector-calculus operators.
Functions§
- curl
- Curl of a 3-D vector field in Cartesian coordinates:
∇×F. - curl_in
- Curl in the given coordinate system:
- directional_
derivative - Directional derivative
∇f · doffalong the (Cartesian) direction vectord. - divergence
- Divergence of a vector field in Cartesian coordinates:
∇·F = Σᵢ ∂Fᵢ/∂xᵢ. - divergence_
in - Divergence in the given coordinate system:
∇·F = (1/(h₁h₂h₃)) Σᵢ ∂/∂qᵢ ( (h₁h₂h₃/hᵢ) Fᵢ ). - gradient
- Gradient of a scalar field in Cartesian coordinates:
∇f = [∂f/∂x₁, …, ∂f/∂xₙ]ᵀ(ann×1column vector). - gradient_
in - Gradient in the given coordinate system:
(∇f)ᵢ = (1/hᵢ) ∂f/∂qᵢ. - hessian
- Hessian matrix
H[i][j] = ∂²f / ∂vars[i] ∂vars[j]. - is_
conservative - Is the 3-D vector field conservative (curl-free)? Three-valued.
- is_
irrotational - Alias of
is_conservative(irrotational ⇔ curl-free). - is_
solenoidal - Is the vector field solenoidal (divergence-free)? Three-valued, like
is_conservative. - laplacian
- Laplacian of a scalar field in Cartesian coordinates:
∇²f = Σᵢ ∂²f/∂xᵢ². - laplacian_
in - Laplacian
∇²f = ∇·(∇f)in the given coordinate system. - line_
integral_ scalar - Scalar line integral
∫_C f ds = ∫ₐᵇ f(r(t)) ‖r′(t)‖ dt. - line_
integral_ vector - Vector line integral (work)
∫_C F·dr = ∫ₐᵇ F(r(t)) · r′(t) dt. - scalar_
potential - Scalar potential
φwith∇φ = Ffor a conservative Cartesian field.