pub struct ManifoldIntegrator<const P: usize, const Q: usize, const R: usize> { /* private fields */ }Expand description
Integrator for scalar and multivector fields on manifolds
Uses adaptive quadrature and measure-theoretic methods for accurate integration.
Implementations§
Source§impl<const P: usize, const Q: usize, const R: usize> ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> ManifoldIntegrator<P, Q, R>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new manifold integrator
§Examples
use amari_calculus::ManifoldIntegrator;
let integrator = ManifoldIntegrator::<3, 0, 0>::new();Sourcepub fn with_tolerance(self, tolerance: f64) -> Self
pub fn with_tolerance(self, tolerance: f64) -> Self
Set tolerance for adaptive integration
Sourcepub fn integrate_scalar_1d(
&self,
f: &ScalarField<P, Q, R>,
a: f64,
b: f64,
n: usize,
) -> f64
pub fn integrate_scalar_1d( &self, f: &ScalarField<P, Q, R>, a: f64, b: f64, n: usize, ) -> f64
Integrate scalar field over 1D interval [a, b]
Uses adaptive Simpson’s rule for accurate integration.
§Arguments
f- Scalar field to integratea- Lower boundb- Upper boundn- Number of subdivisions (must be even)
§Returns
Approximation of ∫_a^b f(x) dx
§Examples
use amari_calculus::{ScalarField, ManifoldIntegrator};
// f(x) = x²
let f = ScalarField::<3, 0, 0>::with_dimension(
|coords| coords[0].powi(2),
1
);
let integrator = ManifoldIntegrator::<3, 0, 0>::new();
// ∫_0^1 x² dx = 1/3
let result = integrator.integrate_scalar_1d(&f, 0.0, 1.0, 100);
assert!((result - 1.0/3.0).abs() < 1e-4);Sourcepub fn integrate_scalar_2d(
&self,
f: &ScalarField<P, Q, R>,
x_range: (f64, f64),
y_range: (f64, f64),
n: usize,
) -> f64
pub fn integrate_scalar_2d( &self, f: &ScalarField<P, Q, R>, x_range: (f64, f64), y_range: (f64, f64), n: usize, ) -> f64
Integrate scalar field over 2D rectangular domain [x_min, x_max] × [y_min, y_max]
§Arguments
f- Scalar field to integratex_range- (x_min, x_max) boundsy_range- (y_min, y_max) boundsn- Number of subdivisions per dimension
§Returns
Approximation of ∫∫_R f(x,y) dx dy
§Examples
use amari_calculus::{ScalarField, ManifoldIntegrator};
// f(x, y) = x*y
let f = ScalarField::<3, 0, 0>::with_dimension(
|coords| coords[0] * coords[1],
2
);
let integrator = ManifoldIntegrator::<3, 0, 0>::new();
// ∫_0^1 ∫_0^1 x*y dx dy = 1/4
let result = integrator.integrate_scalar_2d(&f, (0.0, 1.0), (0.0, 1.0), 50);
assert!((result - 0.25).abs() < 1e-4);Sourcepub fn integrate_scalar_3d(
&self,
f: &ScalarField<P, Q, R>,
x_range: (f64, f64),
y_range: (f64, f64),
z_range: (f64, f64),
n: usize,
) -> f64
pub fn integrate_scalar_3d( &self, f: &ScalarField<P, Q, R>, x_range: (f64, f64), y_range: (f64, f64), z_range: (f64, f64), n: usize, ) -> f64
Sourcepub fn verify_fundamental_theorem_2d(
&self,
f: &VectorField<P, Q, R>,
x_range: (f64, f64),
y_range: (f64, f64),
n: usize,
) -> (f64, f64)
pub fn verify_fundamental_theorem_2d( &self, f: &VectorField<P, Q, R>, x_range: (f64, f64), y_range: (f64, f64), n: usize, ) -> (f64, f64)
Verify the fundamental theorem of geometric calculus: ∫V (∇F) dV = ∮∂V F dS
For a 2D rectangular domain, this reduces to checking: ∫∫R div(F) dx dy = ∮∂R F·n ds
where n is the outward normal to the boundary.
Trait Implementations§
Auto Trait Implementations§
impl<const P: usize, const Q: usize, const R: usize> Freeze for ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> RefUnwindSafe for ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Send for ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Sync for ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> Unpin for ManifoldIntegrator<P, Q, R>
impl<const P: usize, const Q: usize, const R: usize> UnwindSafe for ManifoldIntegrator<P, Q, R>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more