nx_arrhenius_crosscheck_test.nx
buildroot/runtime/nx_arrhenius_crosscheck_test.nx
about
nx_arrhenius_crosscheck_test.nx -- do the ecosystem's TWO independent
Arrhenius implementations agree?
===== WHY THIS EXISTS INSTEAD OF A REFACTOR =====================
nx_arrhenius.nx (seed-storage / soil-respiration lane) and nx_stability.nx
(food + pharma stability lane) both compute how much faster a reaction runs
when it gets warmer. Two implementations of one physical law is normally
drift waiting to happen -- it is exactly what nx_pow10 was extracted to
prevent -- so the obvious move is to collapse them into one.
THAT WOULD DESTROY EVIDENCE. These two do not merely differ in style:
- nx_arrhenius works in the NATURAL base, via nx_exp_q10
- nx_stability works in BASE TEN, via ipow10_q3
- nx_arrhenius uses Q10 fixed point (1024 = 1.0)
- nx_stability uses Q3 fixed point (1000 = 1.0)
- the reciprocal-temperature step is scaled completely differently
Nothing is shared between them but the physics. So if they AGREE, that
agreement is an independent cross-validation of both -- the same reason
nx_icecream_balance is gated against nx_icecream rather than merged into
it, and the same reason nx_peptide_formula's atom-count path is kept
separate from the residue-sum path. Merging turns evidence into a
tautology: one implementation can only ever agree with itself.
So this gate MEASURES the agreement and keeps both. The DRY debt is
answered by proving the copies converge, not by deleting one of them.
The comparison: for the same Ea and the same temperature pair,
nx_arrhenius: ratio_q10 = exp((-Ea/R)(1/T2 - 1/T1)) [1024 = 1.0]
nx_stability: ratio_q3 = 10^(E10/T1 - E10/T2), E10 = Ea/(R ln10)
which are the same number in two bases. Rescaled to a common Q3 they must
land on top of each other.
expect_exit: 0 license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_pow10.nxnx_stability.nxnx_arrhenius.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 40 | func t_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 41 | func t_putn(v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { m = 0 - m; sys_write(1, "-" as *u8, 1) } let t: *u8 = sys_mmap(28); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, bb, k); return 0 } |
| 42 | func iabs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: main |
| 47 | func stab_rate_ratio_q3(ea_j: i64, t1_c: i64, t2_c: i64) -> i64 called by 1: main calls 4: stab_e10_milli_kelvinstab_e10_over_t_millistab_c_to_centi_kelvinipow10_q3 |
| 59 | func arrh_rate_ratio_as_q3(ea_j: i64, t1_c: i64, t2_c: i64) -> i64 |
| 71 | func main() -> i64 |