code wiki / _hdl_build / nx_dpendulum_gate.nx
nx_dpendulum_gate.nx
buildroot/runtime/_hdl_build/nx_dpendulum_gate.nx
about
nx_dpendulum_gate.nx -- the DOUBLE PENDULUM, the continuous chaotic system named as the sim
workstream's flagship "no-float determinism under chaos" vehicle (companion to the discrete
nx_chaos_logistic_gate). Pure integer/no-float fixed point (all quantities x1e6 = "q"); reuses the
Taylor sin/cos from nx_pendulum. Equal masses + lengths (m1=m2=1, l1=l2=1, g=9.8); full nonlinear
COUPLED equations of motion (myphysicslab form), denom = 3 - cos(2(th1-th2)) in [2,4] => no
singularity. Semi-implicit (symplectic-style) Euler: update omega from current theta, then theta
from the new omega -- energy-bounded enough to integrate the chaotic regime over a short horizon.
THREE measured properties + liar-kill (GREEN means it discriminates):
(1) SENSITIVE DEPENDENCE: at LARGE amplitude (th1=th2=2.5 rad) two runs whose th2 differ by 1
micro-rad DIVERGE to O(1 rad) -- deterministic chaos.
(2) DETERMINISM: the SAME integer run recomputed gives a BIT-IDENTICAL max-separation (no-float
=> exactly reproducible even under chaos = the Reproducibility-EXCEEDS property).
(3) NEGATIVE CONTROL: the SAME integrator at SMALL amplitude (th1=th2=0.05 rad) is quasi-linear
(two normal modes, NOT chaotic) -> the 1-micro-rad perturbation stays bounded/tiny. So the
gate cannot be fooled into calling regular motion "chaos". GREEN needs all three.
Sovereign: imports only nx_syscalls. Additive. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 20 | const SC: i64 = 1000000 // x1e6 fixed-point scale |
| 21 | const GQ: i64 = 9800000 // g = 9.8 in q |
| 22 | const DTDIV: i64 = 1000 // dt = 1ms: x += rate/1000 |
functions
| 24 | func dp_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: dp_p |
| 25 | func dp_p(s: *u8) -> i64 { let n: i64 = dp_len(s); sys_write(1, s, n); return 0 } |
| 26 | func dp_pn(v: i64) -> i64 |
| 37 | func sin_fixed(Xin: i64) -> i64 |
| 49 | func cos_fixed(X: i64) -> i64 { return sin_fixed(X + 1570796) } |
| 52 | func mulq(a: i64, b: i64) -> i64 { return a * b / SC } called by 1: dp_step |
| 55 | func dp_step(s: *i64) -> i64 |
| 86 | func dp_run_sep(th0: i64, pert: i64, n: i64) -> i64 |
| 104 | func main() -> i64 |