Batch 7 of expansion-v2. Extends the product across surfaces and adds an
analysis primitive. Deterministic/offline/std-only (Rust) or graceful-absence
(Python).
python/lawsynth analysis.py (new): Python client for the engine's stability,
control, and domains analyses — shells out to the lawsynth CLI (--json) and
parses to typed dataclasses. No numerics re-implemented in Python; the Rust
engine is the single source of truth. Locates the binary like the benchmarks,
raises MissingBinaryError/CliError honestly, and is fully parse-testable
offline. 20 tests; full SDK suite 114 passed.
crates/lawsynth-features: opt-in std::thread-parallel feature-library
evaluation, bit-identical to serial for ALL thread counts (row-chunked via
thread::scope, ordered assembly, no parallel float reduction). Verified via
f64::to_bits across {1,2,3,4,7,8} threads x 10 library variants x uneven row
counts. Measured 3.6x at 8 threads; honestly sublinear (allocation-bound,
~few-thousand-row crossover). 28 tests + benchmark.
crates/lawsynth-sensitivity (new): forward sensitivity analysis. Integrates the
variational equations Ṡ_j = J_x·S_j + f_θj (J_x from the analytic Jacobian, f_θ
by symbolic differentiation) on the augmented system with fixed-step RK4.
Analytic check to <1e-6; finite-difference cross-check at 1e-6 for every
parameter on logistic + Lotka-Volterra. 22 tests.
docs/guide (new): verified end-to-end guide — getting-started, workflow
(discover→simplify→stability→control→export→validate→uncertainty), and a
determinism demo. All 17 documented commands run exit-0 via run_all.sh; honest
about real behaviors (already-minimal law simplifies to 0 nodes saved, CLI
bootstrap doesn't surface per-coef intervals, center points are inconclusive).
README links the guide.
specs/{parallel-evaluation,sensitivity-analysis}: boundary specs.
21 lines
703 B
Rust
21 lines
703 B
Rust
use lawsynth_core::Identifier;
|
|
use lawsynth_data::{Dataset, NumericColumn, TimeAxis};
|
|
use lawsynth_features::FeatureLibrary;
|
|
|
|
#[test]
|
|
fn trigonometric_columns_satisfy_the_pythagorean_identity_per_sample() {
|
|
let angle = Identifier::new("angle").unwrap();
|
|
let data = Dataset::new(
|
|
TimeAxis::new(vec![0.0, 1.0, 2.0]).unwrap(),
|
|
[NumericColumn::new(
|
|
angle.clone(),
|
|
vec![0.0, std::f64::consts::FRAC_PI_4, std::f64::consts::PI],
|
|
)],
|
|
)
|
|
.unwrap();
|
|
let matrix = FeatureLibrary::trigonometric([angle]).unwrap().evaluate(&data).unwrap();
|
|
for row in matrix.rows {
|
|
assert!((row[0].powi(2) + row[1].powi(2) - 1.0).abs() < 1e-12);
|
|
}
|
|
}
|