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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
| 6 |
+
<title>Entanglement Reference Sheet — E(Δ) = −V·cos Δ</title>
|
| 7 |
+
<style>
|
| 8 |
+
:root{--bg:#0b1220;--card:#0f172a;--ink:#e5e7eb;--muted:#94a3b8;--accent:#22d3ee;--ok:#34d399;--warn:#f59e0b;--err:#ef4444;}
|
| 9 |
+
*{box-sizing:border-box}
|
| 10 |
+
body{margin:0;font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Ubuntu,Arial;background:linear-gradient(180deg,#050a16,#0b1220);color:var(--ink)}
|
| 11 |
+
header{padding:22px 16px;text-align:center}
|
| 12 |
+
header h1{margin:0;font-size:1.4rem}
|
| 13 |
+
header p{margin:6px 0 0;color:var(--muted)}
|
| 14 |
+
main{max-width:1100px;margin:0 auto;padding:16px;display:grid;gap:16px}
|
| 15 |
+
@media(min-width:960px){main{grid-template-columns:360px 1fr}}
|
| 16 |
+
.card{background:var(--card);border:1px solid #1f2937;border-radius:16px;padding:16px}
|
| 17 |
+
h2{margin:0 0 10px;font-size:1.05rem}
|
| 18 |
+
label{display:block;margin:10px 0 4px;color:var(--muted)}
|
| 19 |
+
input[type=range]{width:100%}
|
| 20 |
+
input[type=number]{width:100%;padding:8px;border-radius:8px;border:1px solid #1f2937;background:#0a1220;color:var(--ink)}
|
| 21 |
+
.row{display:flex;gap:10px;flex-wrap:wrap}
|
| 22 |
+
.pill{padding:6px 10px;border-radius:999px;background:#0a1220;border:1px solid #1f2937;color:var(--muted)}
|
| 23 |
+
.btn{background:#0a1727;border:1px solid #1f2937;color:var(--ink);padding:10px 12px;border-radius:10px;cursor:pointer}
|
| 24 |
+
.btn.primary{background:var(--accent);border-color:#0891b2;color:#001018;font-weight:700}
|
| 25 |
+
.kpi{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
|
| 26 |
+
.kpi .box{background:#0a1220;border:1px solid #1f2937;border-radius:12px;padding:10px;text-align:center}
|
| 27 |
+
.val{font-size:1.05rem;font-weight:700;color:var(--accent)}
|
| 28 |
+
.small{font-size:.9rem;color:var(--muted)}
|
| 29 |
+
canvas{width:100%;height:240px;background:#07101d;border:1px solid #1f2937;border-radius:12px}
|
| 30 |
+
.ok{color:var(--ok)} .warn{color:var(--warn)} .err{color:var(--err)}
|
| 31 |
+
table{width:100%;border-collapse:collapse}
|
| 32 |
+
th,td{border:1px solid #1f2937;padding:8px;text-align:center}
|
| 33 |
+
th{background:#0a1220;color:#cbd5e1}
|
| 34 |
+
footer{color:var(--muted);text-align:center;margin:18px 0}
|
| 35 |
+
code{background:#091324;padding:2px 6px;border-radius:6px;border:1px solid #1f2937}
|
| 36 |
+
.badge{display:inline-block;padding:4px 8px;border-radius:999px;font-size:12px;border:1px solid #1f2937;margin-left:6px}
|
| 37 |
+
.badge.ok{background:rgba(52,211,153,0.15);color:var(--ok)}
|
| 38 |
+
.badge.warn{background:rgba(245,158,11,0.15);color:var(--warn)}
|
| 39 |
+
.badge.err{background:rgba(239,68,68,0.15);color:var(--err)}
|
| 40 |
+
</style>
|
| 41 |
+
</head>
|
| 42 |
+
<body>
|
| 43 |
+
<header>
|
| 44 |
+
<h1>Entanglement Reference Sheet — <code>E(Δ) = − V·cos Δ</code></h1>
|
| 45 |
+
<p>No-signaling + rotational symmetry + information causality → quantum (Tsirelson) correlations</p>
|
| 46 |
+
</header>
|
| 47 |
+
|
| 48 |
+
<main>
|
| 49 |
+
<!-- Controls -->
|
| 50 |
+
<section class="card">
|
| 51 |
+
<h2>🎛 Controls</h2>
|
| 52 |
+
<label>Visibility V (0…1): <span id="Vlab">1.00</span></label>
|
| 53 |
+
<input type="range" id="V" min="0" max="1" step="0.01" value="1">
|
| 54 |
+
|
| 55 |
+
<div class="row">
|
| 56 |
+
<div style="flex:1">
|
| 57 |
+
<label>A0 (°): <span id="A0lab">0.0</span></label>
|
| 58 |
+
<input type="range" id="A0" min="0" max="180" step="0.1" value="0">
|
| 59 |
+
</div>
|
| 60 |
+
<div style="flex:1">
|
| 61 |
+
<label>A1 (°): <span id="A1lab">45.0</span></label>
|
| 62 |
+
<input type="range" id="A1" min="0" max="180" step="0.1" value="45">
|
| 63 |
+
</div>
|
| 64 |
+
</div>
|
| 65 |
+
<div class="row">
|
| 66 |
+
<div style="flex:1">
|
| 67 |
+
<label>B0 (°): <span id="B0lab">22.5</span></label>
|
| 68 |
+
<input type="range" id="B0" min="0" max="180" step="0.1" value="22.5">
|
| 69 |
+
</div>
|
| 70 |
+
<div style="flex:1">
|
| 71 |
+
<label>B1 (°): <span id="B1lab">67.5</span></label>
|
| 72 |
+
<input type="range" id="B1" min="0" max="180" step="0.1" value="67.5">
|
| 73 |
+
</div>
|
| 74 |
+
</div>
|
| 75 |
+
|
| 76 |
+
<div class="row" style="margin-top:10px">
|
| 77 |
+
<button class="btn" id="setOpt">Set CHSH-optimal angles</button>
|
| 78 |
+
<button class="btn primary" id="recalc">Recalculate</button>
|
| 79 |
+
<span class="pill">Δ = <span id="DeltaLab">A0–B0 = 22.5°</span></span>
|
| 80 |
+
<span id="violBadge" class="badge warn">status</span>
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div class="kpi" style="margin-top:10px">
|
| 84 |
+
<div class="box">
|
| 85 |
+
<div class="small">Correlation E(A0,B0)</div>
|
| 86 |
+
<div id="E00" class="val">–</div>
|
| 87 |
+
</div>
|
| 88 |
+
<div class="box">
|
| 89 |
+
<div class="small">S (CHSH)</div>
|
| 90 |
+
<div id="Sval" class="val">–</div>
|
| 91 |
+
</div>
|
| 92 |
+
<div class="box">
|
| 93 |
+
<div class="small">CHSH game win prob</div>
|
| 94 |
+
<div id="pwin" class="val">–</div>
|
| 95 |
+
</div>
|
| 96 |
+
</div>
|
| 97 |
+
|
| 98 |
+
<div class="row" style="margin-top:10px">
|
| 99 |
+
<span class="pill">Regime: <b id="regime">–</b></span>
|
| 100 |
+
<span class="pill">Local ≤ 2 • Quantum ≤ 2√2 • PR = 4</span>
|
| 101 |
+
</div>
|
| 102 |
+
</section>
|
| 103 |
+
|
| 104 |
+
<!-- Results & Plots -->
|
| 105 |
+
<section class="card">
|
| 106 |
+
<h2>📊 Joint Distribution & Fisher Information</h2>
|
| 107 |
+
|
| 108 |
+
<div class="row">
|
| 109 |
+
<div style="flex:1">
|
| 110 |
+
<label>Single-pair angle Δ (°) for E & P(a,b): <span id="Dlab">22.5</span></label>
|
| 111 |
+
<input type="range" id="D" min="0" max="180" step="0.1" value="22.5">
|
| 112 |
+
</div>
|
| 113 |
+
<div style="width:180px">
|
| 114 |
+
<label>Δ direct input (°)</label>
|
| 115 |
+
<input type="number" id="Dnum" min="0" max="180" step="0.1" value="22.5">
|
| 116 |
+
</div>
|
| 117 |
+
</div>
|
| 118 |
+
|
| 119 |
+
<div class="kpi" style="margin-top:10px">
|
| 120 |
+
<div class="box">
|
| 121 |
+
<div class="small">E(Δ)</div>
|
| 122 |
+
<div id="Edelta" class="val">–</div>
|
| 123 |
+
</div>
|
| 124 |
+
<div class="box">
|
| 125 |
+
<div class="small">Fisher 𝓕(Δ)</div>
|
| 126 |
+
<div id="Fdelta" class="val">–</div>
|
| 127 |
+
</div>
|
| 128 |
+
<div class="box">
|
| 129 |
+
<div class="small">Max 𝓕 over Δ</div>
|
| 130 |
+
<div id="Fmax" class="val">–</div>
|
| 131 |
+
</div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<canvas id="bars"></canvas>
|
| 135 |
+
<div class="small">Bars show joint probabilities P(++), P(+−), P(−+), P(−−) with fair marginals (no-signaling). Computed via <code>P(a,b)=¼(1+a b·E)</code>. Marginals: P(a=+1)=<span id="PaPlus">0.5000</span>, P(b=+1)=<span id="PbPlus">0.5000</span>.</div>
|
| 136 |
+
</section>
|
| 137 |
+
|
| 138 |
+
<!-- Monogamy -->
|
| 139 |
+
<section class="card">
|
| 140 |
+
<h2>🔗 Monogamy Check (Toner–Verstraete)</h2>
|
| 141 |
+
<div class="row">
|
| 142 |
+
<div style="flex:1">
|
| 143 |
+
<label>Enter candidate S_AC</label>
|
| 144 |
+
<input type="number" id="SAC" value="2.0" min="0" max="4" step="0.01">
|
| 145 |
+
</div>
|
| 146 |
+
<div style="flex:1;display:flex;align-items:flex-end">
|
| 147 |
+
<button class="btn" id="monoCheck">Check S_AB² + S_AC² ≤ 8</button>
|
| 148 |
+
</div>
|
| 149 |
+
</div>
|
| 150 |
+
<div class="row" style="margin-top:10px">
|
| 151 |
+
<span class="pill">S_AB = <b id="SABpill">–</b></span>
|
| 152 |
+
<span class="pill">S_AC = <b id="SACpill">–</b></span>
|
| 153 |
+
<span class="pill">Sum = <b id="sumMono">–</b></span>
|
| 154 |
+
<span class="pill">Status: <b id="monoStatus">–</b></span>
|
| 155 |
+
</div>
|
| 156 |
+
</section>
|
| 157 |
+
|
| 158 |
+
<!-- Comparison -->
|
| 159 |
+
<section class="card">
|
| 160 |
+
<h2>📚 Comparison Table</h2>
|
| 161 |
+
<table>
|
| 162 |
+
<thead>
|
| 163 |
+
<tr><th>Model</th><th>Max CHSH S</th><th>Correlation form</th><th>Signaling?</th></tr>
|
| 164 |
+
</thead>
|
| 165 |
+
<tbody>
|
| 166 |
+
<tr><td>Local Hidden Variables</td><td>≤ 2</td><td>Piecewise linear</td><td>No</td></tr>
|
| 167 |
+
<tr><td>Quantum (this work)</td><td>≤ 2√2 ≈ 2.828</td><td><code>E(Δ)=−V cos Δ</code></td><td>No</td></tr>
|
| 168 |
+
<tr><td>PR-Box (supra-quantum)</td><td>4</td><td>±1 (discontinuous)</td><td>No</td></tr>
|
| 169 |
+
</tbody>
|
| 170 |
+
</table>
|
| 171 |
+
<p class="small" style="margin-top:8px">Information causality rules out PR-box correlations; rotational symmetry fixes the cosine form; maximum entropy selects the unique joint distribution.</p>
|
| 172 |
+
</section>
|
| 173 |
+
</main>
|
| 174 |
+
|
| 175 |
+
<footer>
|
| 176 |
+
Interactive reference for entanglement correlations • © 2025 Daniel Süß • DOI: <a href="https://doi.org/10.5281/zenodo.16937966" target="_blank" rel="noopener">10.5281/zenodo.16937966</a>
|
| 177 |
+
</footer>
|
| 178 |
+
|
| 179 |
+
<script>
|
| 180 |
+
const V = document.getElementById('V');
|
| 181 |
+
const Vlab = document.getElementById('Vlab');
|
| 182 |
+
|
| 183 |
+
const A0 = document.getElementById('A0'), A1 = document.getElementById('A1'),
|
| 184 |
+
B0 = document.getElementById('B0'), B1 = document.getElementById('B1');
|
| 185 |
+
const A0lab = document.getElementById('A0lab'), A1lab = document.getElementById('A1lab'),
|
| 186 |
+
B0lab = document.getElementById('B0lab'), B1lab = document.getElementById('B1lab');
|
| 187 |
+
|
| 188 |
+
const E00 = document.getElementById('E00'), Sval = document.getElementById('Sval'), pwin = document.getElementById('pwin');
|
| 189 |
+
const regime = document.getElementById('regime');
|
| 190 |
+
const DeltaLab = document.getElementById('DeltaLab');
|
| 191 |
+
const violBadge = document.getElementById('violBadge');
|
| 192 |
+
|
| 193 |
+
const D = document.getElementById('D'), Dnum = document.getElementById('Dnum');
|
| 194 |
+
const Dlab = document.getElementById('Dlab');
|
| 195 |
+
const Edelta = document.getElementById('Edelta'), Fdelta = document.getElementById('Fdelta'), Fmax = document.getElementById('Fmax');
|
| 196 |
+
|
| 197 |
+
const PaPlus = document.getElementById('PaPlus'), PbPlus = document.getElementById('PbPlus');
|
| 198 |
+
const bars = document.getElementById('bars');
|
| 199 |
+
|
| 200 |
+
const setOpt = document.getElementById('setOpt'), recalc = document.getElementById('recalc');
|
| 201 |
+
|
| 202 |
+
const SACin = document.getElementById('SAC'), SABpill = document.getElementById('SABpill'),
|
| 203 |
+
SACpill = document.getElementById('SACpill'), sumMono = document.getElementById('sumMono'), monoStatus = document.getElementById('monoStatus');
|
| 204 |
+
|
| 205 |
+
function deg2rad(x){ return x*Math.PI/180; }
|
| 206 |
+
function cosd(x){ return Math.cos(deg2rad(x)); }
|
| 207 |
+
function sind(x){ return Math.sin(deg2rad(x)); }
|
| 208 |
+
function wrap180(d){ return ((d % 180) + 180) % 180; }
|
| 209 |
+
|
| 210 |
+
// correlation law
|
| 211 |
+
function E_of(V, ddeg){ return - V * cosd(wrap180(ddeg)); }
|
| 212 |
+
|
| 213 |
+
// CHSH
|
| 214 |
+
function S_from(V, a0,a1,b0,b1){
|
| 215 |
+
const E00 = E_of(V, a0-b0);
|
| 216 |
+
const E01 = E_of(V, a0-b1);
|
| 217 |
+
const E10 = E_of(V, a1-b0);
|
| 218 |
+
const E11 = E_of(V, a1-b1);
|
| 219 |
+
const S = Math.abs(E00 + E01 + E10 - E11);
|
| 220 |
+
return {S,E00,E01,E10,E11};
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
// CHSH game win probability
|
| 224 |
+
function pwin_from_S(S){ return 0.5 + S/8; }
|
| 225 |
+
|
| 226 |
+
// joint distribution with fair marginals: P(a,b) = 1/4 (1 + a b E); here E = -V cos Δ
|
| 227 |
+
function joint_from_E(E){
|
| 228 |
+
const Ppp = 0.25*(1 + E);
|
| 229 |
+
const Ppm = 0.25*(1 - E);
|
| 230 |
+
const Pmp = 0.25*(1 - E);
|
| 231 |
+
const Pmm = 0.25*(1 + E);
|
| 232 |
+
return [Ppp,Ppm,Pmp,Pmm];
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
// draw bars
|
| 236 |
+
function drawBars(probs){
|
| 237 |
+
const ctx = bars.getContext('2d');
|
| 238 |
+
const w = bars.width = bars.clientWidth*2, h = bars.height = bars.clientHeight*2;
|
| 239 |
+
ctx.clearRect(0,0,w,h);
|
| 240 |
+
ctx.fillStyle="#0a1220"; ctx.fillRect(0,0,w,h);
|
| 241 |
+
ctx.strokeStyle="#1f2937"; ctx.strokeRect(0,0,w,h);
|
| 242 |
+
const labels = ["++","+−","−+","−−"];
|
| 243 |
+
const maxH = h*0.7, barW = w*0.15, gap = w*0.06; let x = w*0.12;
|
| 244 |
+
for(let i=0;i<4;i++){
|
| 245 |
+
const ph = Math.max(0,probs[i])*maxH;
|
| 246 |
+
ctx.fillStyle = i%2? "#22d3ee" : "#38bdf8";
|
| 247 |
+
ctx.fillRect(x, h-40-ph, barW, ph);
|
| 248 |
+
ctx.fillStyle="#cbd5e1"; ctx.font="28px system-ui"; ctx.fillText(labels[i], x+barW*0.22, h-10);
|
| 249 |
+
ctx.fillStyle="#94a3b8"; ctx.font="22px system-ui"; ctx.fillText(probs[i].toFixed(4), x+8, h-50-ph);
|
| 250 |
+
x += barW + gap;
|
| 251 |
+
}
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
// Fisher information (Δ in radians physically, but we input degrees; derivative uses sin(Δ) correctly)
|
| 255 |
+
function fisher(V, ddeg){
|
| 256 |
+
const mu = -V * cosd(ddeg);
|
| 257 |
+
const dmu = V * sind(ddeg); // dμ/dΔ(rad) = V sin(Δ)
|
| 258 |
+
const denom = 1 - mu*mu;
|
| 259 |
+
if(denom <= 1e-12) return NaN;
|
| 260 |
+
return (dmu*dmu)/denom;
|
| 261 |
+
}
|
| 262 |
+
function fisher_max(V){
|
| 263 |
+
let bestF = 0, bestD = 90;
|
| 264 |
+
for(let d=0; d<=180; d+=0.1){
|
| 265 |
+
const F = fisher(V, d);
|
| 266 |
+
if(!isNaN(F) && F > bestF){ bestF = F; bestD = d; }
|
| 267 |
+
}
|
| 268 |
+
return {F:bestF, D:bestD};
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
function classify_regime(S){
|
| 272 |
+
const eps=1e-6, ts = 2*Math.SQRT2;
|
| 273 |
+
if(S <= 2+eps) return {txt:"local (≤2)", cls:"ok"};
|
| 274 |
+
if(S <= ts+eps) return {txt:"quantum-admissible (≤2√2)", cls:"warn"};
|
| 275 |
+
return {txt:"super-quantum (violates IC)", cls:"err"};
|
| 276 |
+
}
|
| 277 |
+
|
| 278 |
+
function updateBadge(S, Vv){
|
| 279 |
+
// Use S for current geometry and also V-threshold info
|
| 280 |
+
if(S > 2 + 1e-6){ violBadge.textContent = "violates CHSH"; violBadge.className = "badge ok"; return; }
|
| 281 |
+
if(Math.abs(S-2) <= 1e-6){ violBadge.textContent = "saturates local bound"; violBadge.className = "badge warn"; return; }
|
| 282 |
+
violBadge.textContent = "no violation"; violBadge.className = "badge err";
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
function updateMarginals(E){
|
| 286 |
+
// From joint_from_E
|
| 287 |
+
const [Ppp,Ppm,Pmp,Pmm] = joint_from_E(E);
|
| 288 |
+
const Pa = Ppp + Ppm; // a=+1
|
| 289 |
+
const Pb = Ppp + Pmp; // b=+1
|
| 290 |
+
PaPlus.textContent = Pa.toFixed(4);
|
| 291 |
+
PbPlus.textContent = Pb.toFixed(4);
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
function updateAll(){
|
| 295 |
+
Vlab.textContent = Number(V.value).toFixed(2);
|
| 296 |
+
A0lab.textContent = Number(A0.value).toFixed(1);
|
| 297 |
+
A1lab.textContent = Number(A1.value).toFixed(1);
|
| 298 |
+
B0lab.textContent = Number(B0.value).toFixed(1);
|
| 299 |
+
B1lab.textContent = Number(B1.value).toFixed(1);
|
| 300 |
+
|
| 301 |
+
const Vv = Number(V.value);
|
| 302 |
+
const a0 = Number(A0.value), a1 = Number(A1.value), b0 = Number(B0.value), b1 = Number(B1.value);
|
| 303 |
+
DeltaLab.textContent = `A0–B0 = ${wrap180(a0-b0).toFixed(1)}°`;
|
| 304 |
+
|
| 305 |
+
const {S,E00:EE00,E01,E10,E11} = S_from(Vv, a0,a1,b0,b1);
|
| 306 |
+
E00.textContent = EE00.toFixed(4);
|
| 307 |
+
Sval.textContent = S.toFixed(4);
|
| 308 |
+
pwin.textContent = pwin_from_S(S).toFixed(4);
|
| 309 |
+
updateBadge(S, Vv);
|
| 310 |
+
|
| 311 |
+
const reg = classify_regime(S);
|
| 312 |
+
regime.textContent = reg.txt;
|
| 313 |
+
regime.className = reg.cls;
|
| 314 |
+
|
| 315 |
+
// single Δ block
|
| 316 |
+
const Dv = Number(D.value);
|
| 317 |
+
Dlab.textContent = D.value;
|
| 318 |
+
Dnum.value = D.value;
|
| 319 |
+
|
| 320 |
+
const EΔ = E_of(Vv, Dv);
|
| 321 |
+
Edelta.textContent = EΔ.toFixed(6);
|
| 322 |
+
updateMarginals(EΔ);
|
| 323 |
+
|
| 324 |
+
const FΔ = fisher(Vv, Dv);
|
| 325 |
+
Fdelta.textContent = isNaN(FΔ)? "undefined" : FΔ.toFixed(6);
|
| 326 |
+
|
| 327 |
+
const Fm = fisher_max(Vv);
|
| 328 |
+
Fmax.textContent = `${Fm.F.toFixed(6)} @ Δ≈${Fm.D.toFixed(1)}°`;
|
| 329 |
+
|
| 330 |
+
drawBars(joint_from_E(EΔ));
|
| 331 |
+
|
| 332 |
+
SABpill.textContent = S.toFixed(4);
|
| 333 |
+
}
|
| 334 |
+
|
| 335 |
+
function monoCheck(){
|
| 336 |
+
const SAB = Number(Sval.textContent);
|
| 337 |
+
const SAC = Number(SACin.value);
|
| 338 |
+
SACpill.textContent = SAC.toFixed(4);
|
| 339 |
+
const sum = SAB*SAB + SAC*SAC;
|
| 340 |
+
sumMono.textContent = sum.toFixed(4);
|
| 341 |
+
const ok = sum <= 8 + 1e-6;
|
| 342 |
+
monoStatus.textContent = ok ? "satisfied" : "violated";
|
| 343 |
+
monoStatus.className = ok ? "ok" : "err";
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
function setCHSHopt(){
|
| 347 |
+
A0.value = 0; A1.value = 45; B0.value = 22.5; B1.value = 67.5;
|
| 348 |
+
updateAll();
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
// Sync Δ number/range
|
| 352 |
+
D.addEventListener('input', ()=>{ Dlab.textContent=D.value; Dnum.value=D.value; updateAll(); });
|
| 353 |
+
Dnum.addEventListener('input', ()=>{ let v=Number(Dnum.value); if(isNaN(v)) v=0; v=Math.max(0,Math.min(180,v)); D.value=v; Dlab.textContent=D.value; updateAll(); });
|
| 354 |
+
|
| 355 |
+
[V,A0,A1,B0,B1].forEach(el=>el.addEventListener('input', updateAll));
|
| 356 |
+
document.getElementById('recalc').addEventListener('click', updateAll);
|
| 357 |
+
document.getElementById('monoCheck').addEventListener('click', monoCheck);
|
| 358 |
+
document.getElementById('setOpt').addEventListener('click', setCHSHopt);
|
| 359 |
+
|
| 360 |
+
// init
|
| 361 |
+
updateAll();
|
| 362 |
+
</script>
|
| 363 |
+
</body>
|
| 364 |
+
</html>
|