@justinelliottcobb/amari-wasm 0.12.3 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @justinelliottcobb/amari-wasm v0.9.10
1
+ # @justinelliottcobb/amari-wasm v0.13.0
2
2
 
3
3
  **Unified Mathematical Computing Library with High-Precision WebAssembly Support**
4
4
 
@@ -16,7 +16,8 @@ Amari is a comprehensive mathematical computing library that brings advanced alg
16
16
  - **Tropical Algebra**: Max-plus semiring operations for optimization and neural network applications
17
17
  - **Automatic Differentiation**: Forward-mode AD with dual numbers for exact derivatives
18
18
  - **Measure Theory** *(v0.10.0)*: Lebesgue integration, probability measures, and measure-theoretic foundations
19
- - **Holographic Memory** *(v0.12.2)*: Vector Symbolic Architecture for associative memory with binding and bundling operations
19
+ - **Holographic Memory** *(v0.12.3)*: Vector Symbolic Architecture for associative memory with binding and bundling operations
20
+ - **Probability Theory** *(v0.13.0)*: Distributions on multivector spaces, MCMC sampling, and Monte Carlo estimation
20
21
  - **Relativistic Physics**: Spacetime algebra (Cl(1,3)) with WebAssembly-compatible precision
21
22
  - **Spacecraft Orbital Mechanics**: Full-precision trajectory calculations in browsers
22
23
  - **Cellular Automata**: Geometric cellular automata with multivector states
@@ -275,6 +276,82 @@ async function holographicDemo() {
275
276
  holographicDemo();
276
277
  ```
277
278
 
279
+ ### Probability on Geometric Algebra *(v0.13.0)*
280
+
281
+ Sample from distributions on multivector spaces and perform Monte Carlo estimation:
282
+
283
+ ```typescript
284
+ import init, {
285
+ WasmGaussianMultivector,
286
+ WasmUniformMultivector,
287
+ WasmMonteCarloEstimator
288
+ } from '@justinelliottcobb/amari-wasm';
289
+
290
+ async function probabilisticDemo() {
291
+ await init();
292
+
293
+ // Create a standard Gaussian distribution on Cl(3,0,0)
294
+ const gaussian = WasmGaussianMultivector.standard();
295
+
296
+ // Draw samples
297
+ const samples = [];
298
+ for (let i = 0; i < 1000; i++) {
299
+ samples.push(gaussian.sample());
300
+ }
301
+ console.log(`Drew ${samples.length} Gaussian samples`);
302
+
303
+ // Compute log probability
304
+ const sample = gaussian.sample();
305
+ const logProb = gaussian.logProb(sample);
306
+ console.log(`Log probability: ${logProb}`);
307
+
308
+ // Grade-concentrated distribution (e.g., only on bivectors)
309
+ const bivectorDist = WasmGaussianMultivector.gradeConcentrated(2, 1.0);
310
+ const bivectorSample = bivectorDist.sample();
311
+
312
+ // Uniform distribution on unit multivectors
313
+ const uniform = WasmUniformMultivector.unitSphere();
314
+ const unitSample = uniform.sample();
315
+
316
+ // Monte Carlo estimation
317
+ const estimator = new WasmMonteCarloEstimator();
318
+
319
+ // Estimate expectation of a function
320
+ const estimate = estimator.estimate((mv) => mv.norm(), gaussian, 10000);
321
+ console.log(`Expected norm: ${estimate.mean} ± ${estimate.stdError}`);
322
+
323
+ // Clean up WASM memory
324
+ gaussian.free();
325
+ bivectorDist.free();
326
+ uniform.free();
327
+ sample.free();
328
+ bivectorSample.free();
329
+ unitSample.free();
330
+ estimator.free();
331
+ samples.forEach(s => s.free());
332
+ }
333
+
334
+ probabilisticDemo();
335
+ ```
336
+
337
+ #### Probability API
338
+
339
+ **WasmGaussianMultivector:**
340
+ - `standard()`: Create standard Gaussian on full multivector space
341
+ - `new(mean, covariance)`: Create with specified mean and covariance
342
+ - `gradeConcentrated(grade, scale)`: Gaussian concentrated on specific grade
343
+ - `sample()`: Draw a random sample
344
+ - `logProb(sample)`: Compute log probability density
345
+
346
+ **WasmUniformMultivector:**
347
+ - `unitSphere()`: Uniform distribution on unit multivectors
348
+ - `gradeSimplex(grade)`: Uniform on grade components summing to 1
349
+ - `sample()`: Draw a random sample
350
+
351
+ **WasmMonteCarloEstimator:**
352
+ - `estimate(fn, distribution, nSamples)`: Estimate expectation
353
+ - `estimateVariance(fn, distribution, nSamples)`: Estimate variance
354
+
278
355
  #### Holographic Memory API
279
356
 
280
357
  **TropicalDualClifford Operations:**
@@ -307,6 +384,8 @@ holographicDemo();
307
384
  - **Optimization**: Tropical algebra for shortest path and scheduling problems
308
385
  - **Scientific Computing**: High-performance mathematical operations with orbital-grade precision
309
386
  - **Probability & Statistics**: Measure theory and numerical integration for statistical computations
387
+ - **Bayesian Inference**: Probabilistic modeling on geometric algebra spaces
388
+ - **Uncertainty Quantification**: Monte Carlo methods for error propagation
310
389
  - **Game Development**: Efficient spatial transformations and physics
311
390
  - **Spacecraft Trajectory Planning**: High-precision orbital mechanics in web applications
312
391
  - **Symbolic AI**: Holographic memory for associative reasoning and concept binding
@@ -348,6 +427,16 @@ holographicDemo();
348
427
  - `WasmHolographicMemory.retrieve(key)`: Retrieve by key
349
428
  - `WasmResonator.cleanup(input)`: Clean up noisy input
350
429
 
430
+ ### Probabilistic Operations
431
+
432
+ - `WasmGaussianMultivector.standard()`: Standard Gaussian distribution
433
+ - `WasmGaussianMultivector.gradeConcentrated(grade, scale)`: Grade-specific Gaussian
434
+ - `WasmGaussianMultivector.sample()`: Draw random sample
435
+ - `WasmGaussianMultivector.logProb(sample)`: Log probability density
436
+ - `WasmUniformMultivector.unitSphere()`: Uniform on unit sphere
437
+ - `WasmUniformMultivector.sample()`: Draw random sample
438
+ - `WasmMonteCarloEstimator.estimate(fn, dist, n)`: Monte Carlo expectation
439
+
351
440
  ## Examples
352
441
 
353
442
  Check out the [examples directory](https://github.com/justinelliottcobb/Amari/tree/master/examples) for more detailed usage: