eyeling 1.15.11 → 1.15.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/follows-from/artifacts/ackermann.html +678 -0
- package/follows-from/artifacts/auroracare.html +1297 -0
- package/follows-from/artifacts/bike-trip.html +752 -0
- package/follows-from/artifacts/binomial-theorem.html +631 -0
- package/follows-from/artifacts/bmi.html +511 -0
- package/follows-from/artifacts/building-performance.html +750 -0
- package/follows-from/artifacts/clinical-care.html +726 -0
- package/follows-from/artifacts/collatz.html +403 -0
- package/follows-from/artifacts/complex.html +321 -0
- package/follows-from/artifacts/control-system.html +482 -0
- package/follows-from/artifacts/delfour.html +849 -0
- package/follows-from/artifacts/earthquake-epicenter.html +982 -0
- package/follows-from/artifacts/eco-route.html +662 -0
- package/follows-from/artifacts/euclid-infinitude.html +564 -0
- package/follows-from/artifacts/euler-identity.html +667 -0
- package/follows-from/artifacts/exoplanet-transit.html +1000 -0
- package/follows-from/artifacts/faltings-theorem.html +1046 -0
- package/follows-from/artifacts/fibonacci.html +299 -0
- package/follows-from/artifacts/fundamental-theorem-arithmetic.html +398 -0
- package/follows-from/artifacts/godel-numbering.html +743 -0
- package/follows-from/artifacts/gps-bike.html +759 -0
- package/follows-from/artifacts/gps-clinical-bench.html +792 -0
- package/follows-from/artifacts/graph-french.html +449 -0
- package/follows-from/artifacts/grass-molecular.html +592 -0
- package/follows-from/artifacts/group-theory.html +740 -0
- package/follows-from/artifacts/health-info.html +833 -0
- package/follows-from/artifacts/kaprekar-constant.html +576 -0
- package/follows-from/artifacts/lee.html +805 -0
- package/follows-from/artifacts/linked-lists.html +502 -0
- package/follows-from/artifacts/lldm.html +612 -0
- package/follows-from/artifacts/matrix-multiplication.html +502 -0
- package/follows-from/artifacts/matrix.html +651 -0
- package/follows-from/artifacts/newton-raphson.html +944 -0
- package/follows-from/artifacts/peano-factorial.html +456 -0
- package/follows-from/artifacts/pi.html +363 -0
- package/follows-from/artifacts/polynomial.html +646 -0
- package/follows-from/artifacts/prime.html +366 -0
- package/follows-from/artifacts/pythagorean-theorem.html +468 -0
- package/follows-from/artifacts/rest-path.html +469 -0
- package/follows-from/artifacts/roots-of-unity.html +363 -0
- package/follows-from/artifacts/turing.html +409 -0
- package/follows-from/artifacts/wind-turbines.html +726 -0
- package/follows-from/index.html +549 -0
- package/follows-from/library/index.md +22 -0
- package/follows-from/logo.svg +12 -0
- package/follows-from/manifesto.md +48 -0
- package/follows-from/method/index.md +30 -0
- package/follows-from/path/index.md +20 -0
- package/package.json +4 -3
|
@@ -0,0 +1,468 @@
|
|
|
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>Pythagorean Theorem</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--bg: #ffffff;
|
|
10
|
+
--ink: #111827;
|
|
11
|
+
--muted: #6b7280;
|
|
12
|
+
--panel: #f8fafc;
|
|
13
|
+
--border: #e5e7eb;
|
|
14
|
+
--accent: #0ea5e9;
|
|
15
|
+
--good: #16a34a;
|
|
16
|
+
--amber: #f59e0b;
|
|
17
|
+
--blue: #3b82f6;
|
|
18
|
+
--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
|
|
19
|
+
--ui:
|
|
20
|
+
system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji',
|
|
21
|
+
'Segoe UI Emoji';
|
|
22
|
+
}
|
|
23
|
+
body {
|
|
24
|
+
margin: 0;
|
|
25
|
+
background: var(--bg);
|
|
26
|
+
color: var(--ink);
|
|
27
|
+
font: 15px/1.6 var(--ui);
|
|
28
|
+
}
|
|
29
|
+
.wrap {
|
|
30
|
+
max-width: 980px;
|
|
31
|
+
margin: 36px auto;
|
|
32
|
+
padding: 0 16px;
|
|
33
|
+
}
|
|
34
|
+
header {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: space-between;
|
|
38
|
+
margin-bottom: 16px;
|
|
39
|
+
}
|
|
40
|
+
h1 {
|
|
41
|
+
font-size: 22px;
|
|
42
|
+
margin: 0;
|
|
43
|
+
letter-spacing: 0.2px;
|
|
44
|
+
}
|
|
45
|
+
.pill {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
padding: 6px 10px;
|
|
50
|
+
border: 1px solid var(--border);
|
|
51
|
+
border-radius: 999px;
|
|
52
|
+
color: var(--muted);
|
|
53
|
+
background: #fff;
|
|
54
|
+
}
|
|
55
|
+
.row {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
gap: 16px;
|
|
59
|
+
}
|
|
60
|
+
.card {
|
|
61
|
+
background: var(--panel);
|
|
62
|
+
border: 1px solid var(--border);
|
|
63
|
+
border-radius: 14px;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
}
|
|
66
|
+
.head {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: space-between;
|
|
70
|
+
padding: 10px 12px;
|
|
71
|
+
border-bottom: 1px solid var(--border);
|
|
72
|
+
}
|
|
73
|
+
.head h2 {
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
text-transform: uppercase;
|
|
76
|
+
letter-spacing: 0.08em;
|
|
77
|
+
color: var(--muted);
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
.body {
|
|
81
|
+
padding: 12px;
|
|
82
|
+
}
|
|
83
|
+
pre {
|
|
84
|
+
white-space: pre-wrap;
|
|
85
|
+
background: #fff;
|
|
86
|
+
border: 1px solid var(--border);
|
|
87
|
+
border-radius: 10px;
|
|
88
|
+
padding: 12px;
|
|
89
|
+
overflow: auto;
|
|
90
|
+
font-family: var(--mono);
|
|
91
|
+
font-size: 13.25px;
|
|
92
|
+
}
|
|
93
|
+
.arc-grid {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
gap: 12px;
|
|
97
|
+
}
|
|
98
|
+
.arc-card {
|
|
99
|
+
background: #fff;
|
|
100
|
+
border: 1px solid var(--border);
|
|
101
|
+
border-radius: 14px;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
}
|
|
104
|
+
.arc-card .ac-head {
|
|
105
|
+
display: flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
gap: 8px;
|
|
108
|
+
padding: 10px 12px;
|
|
109
|
+
border-bottom: 1px solid var(--border);
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
letter-spacing: 0.08em;
|
|
112
|
+
text-transform: uppercase;
|
|
113
|
+
color: var(--muted);
|
|
114
|
+
}
|
|
115
|
+
.arc-card .ac-body {
|
|
116
|
+
padding: 12px;
|
|
117
|
+
}
|
|
118
|
+
.arc-card.answer {
|
|
119
|
+
border-left: 4px solid var(--good);
|
|
120
|
+
}
|
|
121
|
+
.arc-card.reason {
|
|
122
|
+
border-left: 4px solid var(--blue);
|
|
123
|
+
}
|
|
124
|
+
.arc-card.check {
|
|
125
|
+
border-left: 4px solid var(--amber);
|
|
126
|
+
}
|
|
127
|
+
.btn {
|
|
128
|
+
all: unset;
|
|
129
|
+
background: #fff;
|
|
130
|
+
border: 1px solid var(--border);
|
|
131
|
+
padding: 8px 12px;
|
|
132
|
+
border-radius: 10px;
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
}
|
|
135
|
+
.btn:hover {
|
|
136
|
+
border-color: #cbd5e1;
|
|
137
|
+
}
|
|
138
|
+
code {
|
|
139
|
+
background: #fff;
|
|
140
|
+
border: 1px solid var(--border);
|
|
141
|
+
border-radius: 6px;
|
|
142
|
+
padding: 0 6px;
|
|
143
|
+
}
|
|
144
|
+
ul {
|
|
145
|
+
margin: 8px 0 0 20px;
|
|
146
|
+
padding: 0;
|
|
147
|
+
}
|
|
148
|
+
li {
|
|
149
|
+
margin: 4px 0;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
</head>
|
|
153
|
+
<body>
|
|
154
|
+
<div class="wrap">
|
|
155
|
+
<header>
|
|
156
|
+
<h1>Pythagorean Theorem</h1>
|
|
157
|
+
<div class="pill" id="status">Ready</div>
|
|
158
|
+
</header>
|
|
159
|
+
|
|
160
|
+
<div class="card" style="margin-bottom: 16px">
|
|
161
|
+
<div class="body">
|
|
162
|
+
<p>
|
|
163
|
+
<strong>What this is?</strong> A self‑contained, browser‑only rendition of the Pythagorean Theorem proof by
|
|
164
|
+
triangle similarity (altitude to hypotenuse). It mirrors the structure of the reference case and includes a
|
|
165
|
+
silent numeric harness.
|
|
166
|
+
</p>
|
|
167
|
+
<ul>
|
|
168
|
+
<li><em>Answer</em>: states the theorem for legs <code>a,b</code> and hypotenuse <code>c</code>.</li>
|
|
169
|
+
<li>
|
|
170
|
+
<em>Reason why</em>: uses similarity to show <code>p=b²/c</code>, <code>q=a²/c</code>,
|
|
171
|
+
<code>p+q=c</code> and concludes <code>a²+b²=c²</code>. Also notes <code>h=(ab)/c</code> and
|
|
172
|
+
<code>h²=pq</code>.
|
|
173
|
+
</li>
|
|
174
|
+
<li>
|
|
175
|
+
<em>Check</em>: runs many triangles across scales to verify all identities within a tight tolerance.
|
|
176
|
+
</li>
|
|
177
|
+
</ul>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div class="row">
|
|
182
|
+
<div class="card">
|
|
183
|
+
<div class="head">
|
|
184
|
+
<h2>Controls</h2>
|
|
185
|
+
<div style="display: flex; gap: 8px; align-items: center">
|
|
186
|
+
<button class="btn" onclick="run()">▶ Run</button>
|
|
187
|
+
<button class="btn" onclick="downloadARC()">⬇ Export .txt</button>
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
<div class="body">Deterministic run (no inputs). Auto‑runs on load.</div>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<div class="card">
|
|
194
|
+
<div class="head"><h2>ARC Output</h2></div>
|
|
195
|
+
<div class="body">
|
|
196
|
+
<div class="arc-grid">
|
|
197
|
+
<div class="arc-card answer">
|
|
198
|
+
<div class="ac-head">Answer</div>
|
|
199
|
+
<div class="ac-body"><pre id="ans">(no run yet)</pre></div>
|
|
200
|
+
<figure class="pythagoras-figure" style="max-width: 760px; margin: 1rem auto">
|
|
201
|
+
<svg
|
|
202
|
+
id="pythagoras-svg"
|
|
203
|
+
viewBox="-140 -180 500 520"
|
|
204
|
+
role="img"
|
|
205
|
+
aria-labelledby="pythagoras-title pythagoras-desc"
|
|
206
|
+
width="100%">
|
|
207
|
+
<title id="pythagoras-title">Colored SVG illustrating the Pythagorean theorem</title>
|
|
208
|
+
<desc id="pythagoras-desc">
|
|
209
|
+
A 3–4–5 right triangle with colored squares on each side: red on the vertical leg a (length 3×),
|
|
210
|
+
blue on the horizontal leg b (length 4×), and green on the hypotenuse c (length 5×). It shows that
|
|
211
|
+
the combined area of the two small squares equals the big one.
|
|
212
|
+
</desc>
|
|
213
|
+
|
|
214
|
+
<style>
|
|
215
|
+
#pythagoras-svg .sqA {
|
|
216
|
+
fill: #ff6b6b;
|
|
217
|
+
fill-opacity: 0.35;
|
|
218
|
+
stroke: #c0392b;
|
|
219
|
+
stroke-width: 2;
|
|
220
|
+
}
|
|
221
|
+
#pythagoras-svg .sqB {
|
|
222
|
+
fill: #4da3ff;
|
|
223
|
+
fill-opacity: 0.35;
|
|
224
|
+
stroke: #1b6fd1;
|
|
225
|
+
stroke-width: 2;
|
|
226
|
+
}
|
|
227
|
+
#pythagoras-svg .sqC {
|
|
228
|
+
fill: #6bd66b;
|
|
229
|
+
fill-opacity: 0.35;
|
|
230
|
+
stroke: #238823;
|
|
231
|
+
stroke-width: 2;
|
|
232
|
+
}
|
|
233
|
+
#pythagoras-svg .tri {
|
|
234
|
+
fill: none;
|
|
235
|
+
stroke: #222;
|
|
236
|
+
stroke-width: 2.5;
|
|
237
|
+
}
|
|
238
|
+
#pythagoras-svg .right-angle {
|
|
239
|
+
fill: none;
|
|
240
|
+
stroke: #222;
|
|
241
|
+
stroke-width: 2;
|
|
242
|
+
}
|
|
243
|
+
#pythagoras-svg .label {
|
|
244
|
+
font:
|
|
245
|
+
600 18px system-ui,
|
|
246
|
+
-apple-system,
|
|
247
|
+
'Segoe UI',
|
|
248
|
+
Roboto,
|
|
249
|
+
Helvetica,
|
|
250
|
+
Arial,
|
|
251
|
+
sans-serif;
|
|
252
|
+
fill: #111;
|
|
253
|
+
}
|
|
254
|
+
#pythagoras-svg .caption {
|
|
255
|
+
font:
|
|
256
|
+
600 20px system-ui,
|
|
257
|
+
-apple-system,
|
|
258
|
+
'Segoe UI',
|
|
259
|
+
Roboto,
|
|
260
|
+
Helvetica,
|
|
261
|
+
Arial,
|
|
262
|
+
sans-serif;
|
|
263
|
+
fill: #111;
|
|
264
|
+
}
|
|
265
|
+
#pythagoras-svg .note {
|
|
266
|
+
font:
|
|
267
|
+
14px system-ui,
|
|
268
|
+
-apple-system,
|
|
269
|
+
'Segoe UI',
|
|
270
|
+
Roboto,
|
|
271
|
+
Helvetica,
|
|
272
|
+
Arial,
|
|
273
|
+
sans-serif;
|
|
274
|
+
fill: #333;
|
|
275
|
+
}
|
|
276
|
+
</style>
|
|
277
|
+
|
|
278
|
+
<!-- Coordinates use a 3–4–5 triangle scaled by 40: A(0,0), B(160,0), C(0,120); c = 200. -->
|
|
279
|
+
<!-- Squares on each side (a: vertical AC, b: horizontal AB, c: hypotenuse BC). -->
|
|
280
|
+
<polygon class="sqB" points="0,0 160,0 160,-160 0,-160" />
|
|
281
|
+
<polygon class="sqA" points="0,0 0,120 -120,120 -120,0" />
|
|
282
|
+
<polygon class="sqC" points="160,0 0,120 120,280 280,160" />
|
|
283
|
+
|
|
284
|
+
<!-- Right triangle -->
|
|
285
|
+
<polygon class="tri" points="0,0 160,0 0,120" />
|
|
286
|
+
|
|
287
|
+
<!-- Right-angle tick at A -->
|
|
288
|
+
<path class="right-angle" d="M0 0 h20 v20" />
|
|
289
|
+
|
|
290
|
+
<!-- Side labels -->
|
|
291
|
+
<text class="label" x="80" y="18" text-anchor="middle">b</text>
|
|
292
|
+
<text class="label" x="-8" y="64" text-anchor="end">a</text>
|
|
293
|
+
<text class="label" x="88" y="64" text-anchor="start">c</text>
|
|
294
|
+
|
|
295
|
+
<!-- Square area labels -->
|
|
296
|
+
<text class="label" x="80" y="-80" text-anchor="middle">b²</text>
|
|
297
|
+
<text class="label" x="-60" y="60" text-anchor="middle">a²</text>
|
|
298
|
+
<text class="label" x="140" y="140" text-anchor="middle">c²</text>
|
|
299
|
+
|
|
300
|
+
<!-- Formula caption -->
|
|
301
|
+
<text class="caption" x="-120" y="310">a² + b² = c²</text>
|
|
302
|
+
<text class="note" x="-120" y="330">(Areas add: red + blue = green)</text>
|
|
303
|
+
</svg>
|
|
304
|
+
<figcaption
|
|
305
|
+
style="
|
|
306
|
+
text-align: center;
|
|
307
|
+
margin-top: 0.25rem;
|
|
308
|
+
color: #444;
|
|
309
|
+
font:
|
|
310
|
+
14px/1.4 system-ui,
|
|
311
|
+
-apple-system,
|
|
312
|
+
'Segoe UI',
|
|
313
|
+
Roboto,
|
|
314
|
+
Helvetica,
|
|
315
|
+
Arial,
|
|
316
|
+
sans-serif;
|
|
317
|
+
">
|
|
318
|
+
Pythagorean theorem visual: squares on the legs (a, b) match the square on the hypotenuse (c).
|
|
319
|
+
</figcaption>
|
|
320
|
+
</figure>
|
|
321
|
+
</div>
|
|
322
|
+
<div class="arc-card reason">
|
|
323
|
+
<div class="ac-head">Reason why</div>
|
|
324
|
+
<div class="ac-body"><pre id="why">(no run yet)</pre></div>
|
|
325
|
+
</div>
|
|
326
|
+
<div class="arc-card check">
|
|
327
|
+
<div class="ac-head">Check (harness)</div>
|
|
328
|
+
<div class="ac-body"><pre id="chk">(no run yet)</pre></div>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
</div>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
335
|
+
|
|
336
|
+
<script>
|
|
337
|
+
// Minimal numeric toolbox (no imports)
|
|
338
|
+
function sqrtNR(x) {
|
|
339
|
+
if (x === 0) return 0;
|
|
340
|
+
let g = x >= 1 ? x : 1;
|
|
341
|
+
for (let i = 0; i < 25; i++) {
|
|
342
|
+
g = 0.5 * (g + x / g);
|
|
343
|
+
}
|
|
344
|
+
return g;
|
|
345
|
+
}
|
|
346
|
+
function absf(x) {
|
|
347
|
+
return x < 0 ? -x : x;
|
|
348
|
+
}
|
|
349
|
+
function fmtExp(x) {
|
|
350
|
+
return x.toExponential(3);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Geometry helpers
|
|
354
|
+
function hypotenuse(a, b) {
|
|
355
|
+
return sqrtNR(a * a + b * b);
|
|
356
|
+
}
|
|
357
|
+
function derive_p_q(a, b) {
|
|
358
|
+
const c = hypotenuse(a, b);
|
|
359
|
+
if (c === 0) throw new Error('Degenerate triangle (a=b=0) is not allowed.');
|
|
360
|
+
return { p: (b * b) / c, q: (a * a) / c, c };
|
|
361
|
+
}
|
|
362
|
+
function altitude(a, b, c) {
|
|
363
|
+
return (a * b) / c;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
function check_all(a, b, tol) {
|
|
367
|
+
if (!(a > 0 && b > 0)) throw new Error('Leg lengths must be positive.');
|
|
368
|
+
const { p, q, c } = derive_p_q(a, b);
|
|
369
|
+
const h = altitude(a, b, c);
|
|
370
|
+
const res = [];
|
|
371
|
+
// 1) Core similarity equalities
|
|
372
|
+
res.push(absf(b * b - c * p)); // b^2 = c p
|
|
373
|
+
res.push(absf(a * a - c * q)); // a^2 = c q
|
|
374
|
+
// 2) Partition
|
|
375
|
+
res.push(absf(p + q - c)); // p + q = c
|
|
376
|
+
// 3) Ratio forms
|
|
377
|
+
res.push(absf(p / b - b / c)); // p/b = b/c
|
|
378
|
+
res.push(absf(q / a - a / c)); // q/a = a/c
|
|
379
|
+
// 4) Altitude & geometric mean
|
|
380
|
+
res.push(absf(h * h - p * q)); // h^2 = p q
|
|
381
|
+
// 5) Area consistency
|
|
382
|
+
res.push(absf(0.5 * a * b - 0.5 * c * h)); // ½ab = ½ch
|
|
383
|
+
// 6) Pythagoras
|
|
384
|
+
res.push(absf(a * a + b * b - c * c)); // a^2 + b^2 = c^2
|
|
385
|
+
const worst = res.reduce((m, v) => (v > m ? v : m), 0);
|
|
386
|
+
const ok = res.every((r) => r <= tol);
|
|
387
|
+
return { worst, c, ok };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function run_harness() {
|
|
391
|
+
const max_leg = 12;
|
|
392
|
+
const scales = [0.5, 1.0, 1.7, 3.0];
|
|
393
|
+
const tol = 1e-11;
|
|
394
|
+
let tested = 0,
|
|
395
|
+
worst = 0;
|
|
396
|
+
for (const s of scales) {
|
|
397
|
+
for (let A = 1; A <= max_leg; A++) {
|
|
398
|
+
for (let B = 1; B <= max_leg; B++) {
|
|
399
|
+
const a = s * A,
|
|
400
|
+
b = s * B;
|
|
401
|
+
const r = check_all(a, b, tol);
|
|
402
|
+
tested++;
|
|
403
|
+
if (r.worst > worst) worst = r.worst;
|
|
404
|
+
if (!r.ok) {
|
|
405
|
+
throw new Error('Identity residual exceeded tolerance');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return { tested, scales: scales.length, worst };
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// ARC sections
|
|
414
|
+
function arc_answer() {
|
|
415
|
+
return [
|
|
416
|
+
'For any right triangle with legs a, b and hypotenuse c,',
|
|
417
|
+
'the Pythagorean Theorem holds: a² + b² = c².',
|
|
418
|
+
].join('\n');
|
|
419
|
+
}
|
|
420
|
+
function arc_reason() {
|
|
421
|
+
return [
|
|
422
|
+
'Drop the altitude from the right angle to the hypotenuse, splitting it into',
|
|
423
|
+
'segments of lengths p and q. By AA similarity:',
|
|
424
|
+
' p/b = b/c ⇒ p = b²/c, q/a = a/c ⇒ q = a²/c, and p + q = c.',
|
|
425
|
+
'Adding c·p and c·q gives b² + a² = c(p+q) = c².',
|
|
426
|
+
'The altitude satisfies h = (ab)/c and h² = pq, consistent with the similarity.',
|
|
427
|
+
].join('\n');
|
|
428
|
+
}
|
|
429
|
+
function arc_check(summary) {
|
|
430
|
+
return [
|
|
431
|
+
'Cases tested: ' + summary.tested + ' across ' + summary.scales + ' scale factors.',
|
|
432
|
+
'Worst absolute residual among all identities: ' + fmtExp(summary.worst),
|
|
433
|
+
'All similarity relations and Pythagoras verified. ✔',
|
|
434
|
+
].join('\n');
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Runner + UI
|
|
438
|
+
function run() {
|
|
439
|
+
const summary = run_harness();
|
|
440
|
+
document.getElementById('ans').textContent = arc_answer();
|
|
441
|
+
document.getElementById('why').textContent = arc_reason();
|
|
442
|
+
document.getElementById('chk').textContent = arc_check(summary);
|
|
443
|
+
document.getElementById('status').textContent = 'Computed';
|
|
444
|
+
}
|
|
445
|
+
function downloadARC() {
|
|
446
|
+
const blob = new Blob(
|
|
447
|
+
[
|
|
448
|
+
'Answer\n------\n',
|
|
449
|
+
arc_answer(),
|
|
450
|
+
'\n\n',
|
|
451
|
+
'Reason why\n----------\n',
|
|
452
|
+
arc_reason(),
|
|
453
|
+
'\n\n',
|
|
454
|
+
'Check (harness)\n---------------\n',
|
|
455
|
+
document.getElementById('chk').textContent,
|
|
456
|
+
],
|
|
457
|
+
{ type: 'text/plain' },
|
|
458
|
+
);
|
|
459
|
+
const a = document.createElement('a');
|
|
460
|
+
a.href = URL.createObjectURL(blob);
|
|
461
|
+
a.download = 'pythagorean_theorem_output.txt';
|
|
462
|
+
a.click();
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
window.addEventListener('DOMContentLoaded', run);
|
|
466
|
+
</script>
|
|
467
|
+
</body>
|
|
468
|
+
</html>
|