@justinelliottcobb/amari-wasm 0.8.6 → 0.9.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 +81 -17
- package/amari_wasm.js +1 -1
- package/amari_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
# @justinelliottcobb/amari-wasm v0.
|
|
1
|
+
# @justinelliottcobb/amari-wasm v0.9.0
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Unified Mathematical Computing Library with High-Precision WebAssembly Support**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@justinelliottcobb/amari-wasm)
|
|
6
6
|
[](https://github.com/justinelliottcobb/Amari/actions/workflows/ci.yml)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
8
|
|
|
9
|
-
Amari is a comprehensive mathematical computing library that brings
|
|
9
|
+
Amari is a comprehensive mathematical computing library that brings advanced algebraic systems to JavaScript/TypeScript through WebAssembly, now with full high-precision arithmetic support for spacecraft orbital mechanics and relativistic physics calculations. Features pure Rust implementation with no native dependencies for universal deployment.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Features
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
- **📦 TypeScript Support**: Full TypeScript definitions included
|
|
13
|
+
### New in v0.9.0: High-Precision WebAssembly
|
|
14
|
+
- **Spacecraft Orbital Mechanics**: Full-precision trajectory calculations now available in browsers
|
|
15
|
+
- **Relativistic Physics**: Spacetime algebra (Cl(1,3)) with WebAssembly-compatible precision
|
|
16
|
+
- **Pure Rust Backend**: dashu-powered arithmetic with no native dependencies
|
|
17
|
+
- **Universal Deployment**: Same precision guarantees across desktop, web, and edge environments
|
|
18
|
+
- **WebAssembly 3.0 Ready**: Leverages latest WASM features for enhanced mathematical computing
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
### Core Mathematical Systems
|
|
21
|
+
- **Geometric Algebra (Clifford Algebra)**: Multivectors, rotors, and geometric products for 3D rotations and spatial transformations
|
|
22
|
+
- **Tropical Algebra**: Max-plus semiring operations for optimization and neural network applications
|
|
23
|
+
- **Automatic Differentiation**: Forward-mode AD with dual numbers for exact derivatives
|
|
24
|
+
- **Cellular Automata**: Geometric cellular automata with multivector states
|
|
25
|
+
- **WebGPU Acceleration**: Optional GPU acceleration for large-scale operations
|
|
26
|
+
- **Pure Rust Implementation**: Memory-safe, high-performance core with WASM bindings
|
|
27
|
+
- **TypeScript Support**: Full TypeScript definitions included
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
22
30
|
|
|
23
31
|
```bash
|
|
24
32
|
npm install @amari/core
|
|
@@ -30,7 +38,7 @@ Or with yarn:
|
|
|
30
38
|
yarn add @amari/core
|
|
31
39
|
```
|
|
32
40
|
|
|
33
|
-
##
|
|
41
|
+
## Quick Start
|
|
34
42
|
|
|
35
43
|
```typescript
|
|
36
44
|
import init, { WasmMultivector, WasmRotor } from '@amari/core';
|
|
@@ -71,7 +79,63 @@ async function main() {
|
|
|
71
79
|
main();
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
##
|
|
82
|
+
## High-Precision Orbital Mechanics (New in v0.9.0)
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import init, {
|
|
86
|
+
WasmSpacetimeVector,
|
|
87
|
+
WasmFourVelocity,
|
|
88
|
+
WasmRelativisticParticle,
|
|
89
|
+
WasmSchwarzschildMetric
|
|
90
|
+
} from '@amari/core';
|
|
91
|
+
|
|
92
|
+
async function spacecraftSimulation() {
|
|
93
|
+
await init();
|
|
94
|
+
|
|
95
|
+
// Create Earth's gravitational field
|
|
96
|
+
const earth = WasmSchwarzschildMetric.earth();
|
|
97
|
+
|
|
98
|
+
// Spacecraft at 400km altitude (ISS orbit)
|
|
99
|
+
const altitude = 400e3; // 400 km
|
|
100
|
+
const earthRadius = 6.371e6; // Earth radius in meters
|
|
101
|
+
const position = new Float64Array([earthRadius + altitude, 0.0, 0.0]);
|
|
102
|
+
const velocity = new Float64Array([0.0, 7.67e3, 0.0]); // ~7.67 km/s orbital velocity
|
|
103
|
+
|
|
104
|
+
// Create spacecraft with high-precision arithmetic
|
|
105
|
+
const spacecraft = WasmRelativisticParticle.new(
|
|
106
|
+
position,
|
|
107
|
+
velocity,
|
|
108
|
+
0.0, // No charge
|
|
109
|
+
1000.0, // 1000 kg spacecraft
|
|
110
|
+
0.0 // No magnetic charge
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
// Propagate orbit for one complete period with high precision
|
|
114
|
+
const orbitalPeriod = 5580.0; // ~93 minutes
|
|
115
|
+
const timeStep = 60.0; // 1-minute time steps
|
|
116
|
+
|
|
117
|
+
// High-precision geodesic integration using dashu backend
|
|
118
|
+
const trajectory = spacecraft.propagate_trajectory(
|
|
119
|
+
earth,
|
|
120
|
+
orbitalPeriod,
|
|
121
|
+
timeStep
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
console.log(`Orbital trajectory computed with ${trajectory.length} points`);
|
|
125
|
+
console.log(`Final position deviation: ${spacecraft.position_error()} meters`);
|
|
126
|
+
|
|
127
|
+
// WebAssembly precision matches native accuracy!
|
|
128
|
+
|
|
129
|
+
// Clean up WASM memory
|
|
130
|
+
earth.free();
|
|
131
|
+
spacecraft.free();
|
|
132
|
+
trajectory.forEach(point => point.free());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
spacecraftSimulation();
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Core Concepts
|
|
75
139
|
|
|
76
140
|
### Geometric Algebra
|
|
77
141
|
|
|
@@ -119,7 +183,7 @@ for (let i = 0; i < 100; i++) {
|
|
|
119
183
|
console.log(`Generation: ${ca.generation()}`);
|
|
120
184
|
```
|
|
121
185
|
|
|
122
|
-
##
|
|
186
|
+
## Use Cases
|
|
123
187
|
|
|
124
188
|
- **Computer Graphics**: 3D rotations and transformations using rotors
|
|
125
189
|
- **Physics Simulations**: Geometric algebra for electromagnetic fields
|
|
@@ -128,7 +192,7 @@ console.log(`Generation: ${ca.generation()}`);
|
|
|
128
192
|
- **Scientific Computing**: High-performance mathematical operations
|
|
129
193
|
- **Game Development**: Efficient spatial transformations and physics
|
|
130
194
|
|
|
131
|
-
##
|
|
195
|
+
## API Reference
|
|
132
196
|
|
|
133
197
|
### Multivector Operations
|
|
134
198
|
|
|
@@ -199,4 +263,4 @@ MIT License - see [LICENSE](https://github.com/justinelliottcobb/Amari/blob/mast
|
|
|
199
263
|
|
|
200
264
|
---
|
|
201
265
|
|
|
202
|
-
**Made with
|
|
266
|
+
**Made with Rust by the Amari team**
|
package/amari_wasm.js
CHANGED
|
@@ -554,7 +554,7 @@ async function __wbg_load(module, imports) {
|
|
|
554
554
|
function __wbg_get_imports() {
|
|
555
555
|
const imports = {};
|
|
556
556
|
imports.wbg = {};
|
|
557
|
-
imports.wbg.
|
|
557
|
+
imports.wbg.__wbg_log_6acc76af826c364a = function(arg0, arg1) {
|
|
558
558
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
559
559
|
};
|
|
560
560
|
imports.wbg.__wbg_wbindgenthrow_451ec1a8469d7eb6 = function(arg0, arg1) {
|
package/amari_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Amari Contributors"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for Amari mathematical computing library - geometric algebra, tropical algebra, automatic differentiation, fusion systems, and information geometry",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.9.0",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|