amari-calculus 0.12.1

Geometric calculus - unified differential and integral calculus using geometric algebra
Documentation

Amari Calculus

Geometric calculus - a unified framework for differential and integral calculus using geometric algebra.

Overview

This crate provides geometric calculus operations that unify:

  • Vector calculus (gradient, divergence, curl)
  • Differential forms
  • Tensor calculus
  • Covariant derivatives on manifolds

Mathematical Foundation

Geometric calculus is built on the vector derivative operator:

∇ = e^i ∂_i  (sum over basis vectors)

This operator combines:

  • Dot product → divergence (∇·F)
  • Wedge product → curl (∇∧F)
  • Full geometric product → complete derivative (∇F = ∇·F + ∇∧F)

Key Features

  • Vector Derivative Operator: The fundamental ∇ operator
  • Classical Operators: Gradient, divergence, curl, Laplacian
  • Manifold Calculus: Covariant derivatives, connections, geodesics
  • Lie Derivatives: Derivatives along vector fields
  • Integration: Integration on manifolds using amari-measure
  • Fundamental Theorem: ∫V (∇F) dV = ∮∂V F dS

Examples

Gradient of a scalar field

use amari_calculus::{ScalarField, VectorDerivative, CoordinateSystem};
use amari_core::Multivector;

// Define scalar field f(x, y) = x² + y²
let f = ScalarField::<3, 0, 0>::new(|coords| {
    coords[0].powi(2) + coords[1].powi(2)
});

// Create vector derivative operator
let nabla = VectorDerivative::<3, 0, 0>::new(CoordinateSystem::Cartesian);

// Compute gradient at point (1, 2)
let grad_f = nabla.gradient(&f, &[1.0, 2.0, 0.0]);

// Gradient should be approximately (2, 4, 0)

Divergence of a vector field

use amari_calculus::{VectorField, VectorDerivative, CoordinateSystem, vector_from_slice};

// Define vector field F(x, y, z) = (x, y, z)
let f = VectorField::<3, 0, 0>::new(|coords| {
    vector_from_slice(&[coords[0], coords[1], coords[2]])
});

let nabla = VectorDerivative::<3, 0, 0>::new(CoordinateSystem::Cartesian);

// Compute divergence (should be 3)
let div_f = nabla.divergence(&f, &[1.0, 1.0, 1.0]);

Curl of a vector field

use amari_calculus::{VectorField, VectorDerivative, CoordinateSystem, vector_from_slice};

// Define vector field F(x, y, z) = (-y, x, 0) (rotation around z-axis)
let f = VectorField::<3, 0, 0>::new(|coords| {
    vector_from_slice(&[-coords[1], coords[0], 0.0])
});

let nabla = VectorDerivative::<3, 0, 0>::new(CoordinateSystem::Cartesian);

// Compute curl (should be (0, 0, 2) bivector representing rotation)
let curl_f = nabla.curl(&f, &[0.0, 0.0, 0.0]);