Skip to main content

qualia_core_db/solvers/vector_calculus/
mod.rs

1//! **Vector calculus** (Calculus plan §4.3) — the differential operators (grad, div,
2//! curl, Laplacian) symbolically over the CAS, and the integral side (line integrals,
3//! surface flux) numerically, with the divergence/Green theorems as validation.
4//!
5//! * [`differential`] — symbolic `∇f`, `∇·F`, `∇×F`, `∇²f` built on the CAS
6//!   [`differentiate`](crate::specialized_libs::symbolic_algebra::differentiate);
7//!   provenance-bearing operators, not numeric finite differences.
8//! * [`integrals`] — numeric line integral / work and surface flux by quadrature over
9//!   parametric curves/surfaces given as closures.
10//!
11//! Fail-closed on dimension mismatch (curl needs exactly 3 components/vars).
12
13pub mod differential;
14pub mod integrals;
15
16pub use differential::{curl, divergence, gradient, laplacian};
17pub use integrals::{line_integral_scalar, line_integral_work, surface_flux};
18
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub enum VecCalcError {
21    /// The number of field components and variables disagree, or curl was given a
22    /// non-3-D field.
23    DimensionMismatch,
24}
25
26impl core::fmt::Display for VecCalcError {
27    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
28        write!(f, "vector-calculus dimension mismatch")
29    }
30}
31impl std::error::Error for VecCalcError {}