ManifoldIntegrator

Struct ManifoldIntegrator 

Source
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>

Source

pub fn new() -> Self

Create new manifold integrator

§Examples
use amari_calculus::ManifoldIntegrator;

let integrator = ManifoldIntegrator::<3, 0, 0>::new();
Source

pub fn with_tolerance(self, tolerance: f64) -> Self

Set tolerance for adaptive integration

Source

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 integrate
  • a - Lower bound
  • b - Upper bound
  • n - 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);
Source

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 integrate
  • x_range - (x_min, x_max) bounds
  • y_range - (y_min, y_max) bounds
  • n - 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);
Source

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

Integrate scalar field over 3D rectangular domain

§Arguments
  • f - Scalar field to integrate
  • x_range - (x_min, x_max) bounds
  • y_range - (y_min, y_max) bounds
  • z_range - (z_min, z_max) bounds
  • n - Number of subdivisions per dimension
§Returns

Approximation of ∫∫∫_V f(x,y,z) dx dy dz

Source

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§

Source§

impl<const P: usize, const Q: usize, const R: usize> Default for ManifoldIntegrator<P, Q, R>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.