Shunyaya Symbolic Mathematical Hardware – Software Reference: Minimal API & Quickstart (9.1–9.3)

9.1 — Data type and invariants
Pair type. x := (m, a) with a in (-1,+1).
Collapse parity. phi((m,a)) = m.
Clamp discipline. Always a := clamp(a, -1+eps_a, +1-eps_a) before any atanh(a), and re-clamp after any tanh(u).
Streaming invariance. Batch, stream, and shuffled fusions match (via {U,W} accumulators).
Canonical zero. Display (0,+1) when m == 0 (value lane unchanged; lane is bounded).


9.2 — Minimal API (language-agnostic pseudocode)
a_clamped := clamp_a(a, eps_a)
u := atanh(a_clamped)
a := tanh(u) ; inverse map

a_mul(a1, a2) :=
 tanh( atanh(clamp_a(a1,eps_a)) + atanh(clamp_a(a2,eps_a)) )

a_div(af, ag) :=
 tanh( atanh(clamp_a(af,eps_a)) – atanh(clamp_a(ag,eps_a)) )

uw_accum!(U, W, a, w) :=
 ( U + w * atanh(clamp_a(a,eps_a)), W + w )

uw_flush(U, W, eps_w) :=
 tanh( U / max(W, eps_w) )

a_env(a_op, g_t, eps_a) :=
 clamp_a( g_t * a_op, eps_a )

collapse((m,a)) := m ; phi((m,a)) = m


9.3 — One-minute quickstart (spreadsheet or REPL)

  1. Choose eps_a = 1e-6, eps_w = 1e-12.
  2. Paste three cells a1=0.2, a2=0.5, a3=-0.3.
  3. Compute u_i = ATANH(a_i), then U = SUM(u_i), W = 3, a_out = TANH( U / MAX(W, 1e-12) ).
  4. Reorder rows; confirm a_out does not change.
  5. Check multiply identity: A_MUL = TANH(ATANH(0.8)+ATANH(0.2)) equals (0.8+0.2)/(1+0.8*0.2).

Spreadsheet cells (ready to paste).
U_cell = SUM(ATANH(A2:A4))
W_cell = COUNTA(A2:A4)
A_OUT = TANH( U_cell / MAX(W_cell, 1e-12) )
A_MUL = TANH(ATANH(0.8)+ATANH(0.2))
A_MUL_CF = (0.8+0.2)/(1+0.8*0.2)


Navigation
Back: Shunyaya Symbolic Mathematical Hardware – Readiness: Pilot Packet, Safety Case, Audit & Go/No-Go (8.7–8.10)
Next: Shunyaya Symbolic Mathematical Hardware – Reference Knobs, Error Budgeting & Python (9.4–9.6)


Directory of Pages
SSMH – Table of Contents


Explore Further
https://github.com/OMPSHUNYAYA/Symbolic-Mathematical-Hardware


Disclaimer
The contents in the Shunyaya Symbolic Mathematical Hardware (SSMH) materials are research/observation material. They are not engineering advice, not a safety standard or certification, and not operational guidance. Do not use for safety-critical, medical, legal, or financial decisions. Use at your own discretion; no warranties are provided; results depend on correct implementation and inputs.