@justinelliottcobb/amari-wasm
v0.19.1
Published
WebAssembly bindings for Amari mathematical computing library - geometric algebra, tropical algebra, automatic differentiation, measure theory, fusion systems, and information geometry
Maintainers
Readme
@justinelliottcobb/amari-wasm v0.19.1
Unified Mathematical Computing Library with High-Precision WebAssembly Support
Amari is a comprehensive mathematical computing library that brings advanced algebraic systems to JavaScript/TypeScript through WebAssembly. Features high-precision arithmetic for spacecraft orbital mechanics and relativistic physics calculations with pure Rust implementation and no native dependencies for universal deployment.
Features
| Module | Crate | Since | Description | |--------|-------|-------|-------------| | Geometric Algebra | amari-core | v0.1 | Multivectors, rotors, geometric products for 3D rotations and spatial transformations | | Tropical Algebra | amari-tropical | v0.9.3 | Max-plus semiring operations for optimization and neural network applications | | Automatic Differentiation | amari-dual | v0.9.3 | Forward-mode AD with dual numbers for exact derivatives | | Cellular Automata | amari-automata | v0.9.4 | Geometric cellular automata with multivector states | | Holographic Memory | amari-fusion | v0.12.3 | Vector Symbolic Architecture for associative memory with binding and bundling | | Measure Theory | amari-measure | v0.10.0 | Lebesgue integration, probability measures, and measure-theoretic foundations | | Probability | amari-probabilistic | v0.13.0 | Distributions on multivector spaces, MCMC sampling, Monte Carlo estimation | | Functional Analysis | amari-functional | v0.15.0 | Hilbert spaces, linear operators, spectral decomposition, Sobolev spaces | | Optical Fields | amari-holographic | v0.15.1 | GA-native Lee hologram encoding for DMD displays and VSA-based optical processing | | Computational Topology | amari-topology | v0.16.0 | Simplicial complexes, homology, persistent homology, Morse theory | | Dynamical Systems | amari-calculus | v0.19.1 | ODE solvers, stability analysis, bifurcation diagrams, Lyapunov exponents | | Enumerative Geometry | amari-enumerative | v0.19.1 | WDVV curve counting, matroids, CSM classes, stability conditions | | Probabilistic Contracts | amari-flynn | v0.19.1 | SMT-LIB2 proof obligations, Monte Carlo verification, rare event tracking | | GF(2) Algebra | amari-core, amari-enumerative | v0.19.1 | GF(2) linear algebra, binary Clifford algebra, coding theory, matroid representability, Kazhdan-Lusztig polynomials | | Orbital Mechanics | amari-relativistic | v0.9.4 | Spacetime algebra (Cl(1,3)) with high-precision trajectory calculations |
Also includes bindings for: amari-network (geometric network analysis), amari-optimization (gradient descent, NSGA-II), amari-info-geom (Fisher metrics, statistical manifolds), amari-calculus (differential geometry, manifolds).
High-Precision Arithmetic
- Pure Rust Backend: dashu-powered arithmetic with no native dependencies
- Universal Deployment: Same precision guarantees across desktop, web, and edge environments
- Orbital-Grade Tolerance: Configurable precision for critical trajectory calculations
Installation
npm install @justinelliottcobb/amari-wasmOr with yarn:
yarn add @justinelliottcobb/amari-wasmQuick Start
import init, { WasmMultivector, WasmRotor } from '@justinelliottcobb/amari-wasm';
async function main() {
await init();
// Create basis vectors
const e1 = WasmMultivector.basis_vector(0);
const e2 = WasmMultivector.basis_vector(1);
// Compute geometric product
const product = e1.geometric_product(e2);
console.log(product.to_string()); // e12 (bivector)
// Create a rotor for 90-degree rotation
const rotor = WasmRotor.from_axis_angle(
WasmMultivector.basis_vector(2),
Math.PI / 2
);
// Rotate a vector
const vector = WasmMultivector.from_coefficients(
new Float64Array([1, 0, 0, 0, 0, 0, 0, 0])
);
const rotated = rotor.rotate_vector(vector);
// Clean up WASM memory
e1.free(); e2.free(); product.free();
rotor.free(); vector.free(); rotated.free();
}
main();See the docs/ directory for detailed guides and API references for each module.
Use Cases
- Computer Graphics: 3D rotations and transformations using rotors
- Physics Simulations: Geometric algebra for electromagnetic fields and relativistic calculations
- Machine Learning: Tropical neural networks and automatic differentiation
- Optimization: Tropical algebra for shortest path and scheduling problems
- Scientific Computing: High-performance mathematical operations with orbital-grade precision
- Probability & Statistics: Measure theory, numerical integration, and probabilistic modeling
- Formal Verification: SMT-LIB2 proof obligation generation for browser-based verification workflows
- Symbolic AI: Holographic memory for associative reasoning and concept binding
- Holographic Displays: Lee hologram encoding for DMD and SLM devices
- Topological Data Analysis: Persistent homology for shape and feature detection
- Chaos Theory: Lorenz attractors, bifurcation diagrams, Lyapunov exponents
- Algebraic Geometry: Rational curve counting, Schubert calculus, Gromov-Witten invariants
- Error-Correcting Codes: Binary linear codes (Hamming, Reed-Muller, Golay) for communication systems
- Finite Field Combinatorics: Grassmannian point counting, matroid representability, Kazhdan-Lusztig polynomials
- Spacecraft Trajectory Planning: High-precision orbital mechanics in web applications
Building from Source
# Clone the repository
git clone https://github.com/justinelliottcobb/Amari.git
cd Amari/amari-wasm
# Install dependencies
npm install
# Build WASM module
npm run build
# Run tests
npm testContributing
Contributions are welcome. Please see CONTRIBUTING.md for details.
License
MIT License - see LICENSE for details.
Acknowledgments
- Built with Rust and wasm-bindgen
- Inspired by geometric algebra libraries like GAViewer and Ganja.js
- Tropical algebra concepts from discrete mathematics
Contact
- GitHub: @justinelliottcobb
- NPM: @justinelliottcobb/amari-wasm
Made with Rust by the Amari team
