Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

feat(linear-algebra): chapters 2 and 3 reviewed, with playgrounds; registered

yzr37eab8ba5102
diff --git a/site/linear-algebra/ch01/index.html b/site/linear-algebra/ch01/index.html
index 0f61359..220edcd 100644
--- a/site/linear-algebra/ch01/index.html
+++ b/site/linear-algebra/ch01/index.html
@@ -15,7 +15,7 @@
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 1, title: 'One Equation, One Line', minutes: 10, language: 'en' };
+const CHAPTER = { number: 1, title: 'One Equation, One Line', minutes: 10, language: 'en', next: '../ch02/' };
/* ---------- chapter drawing helpers ---------- */
const LINE = LS_ROW[0]; // the one equation's line: blue, as row 1 everywhere in the book
diff --git a/site/linear-algebra/ch02/audio/en/between.mp3 b/site/linear-algebra/ch02/audio/en/between.mp3
index 84917ee..eb5dae3 100644
Binary files a/site/linear-algebra/ch02/audio/en/between.mp3 and b/site/linear-algebra/ch02/audio/en/between.mp3 differ
diff --git a/site/linear-algebra/ch02/audio/en/check.mp3 b/site/linear-algebra/ch02/audio/en/check.mp3
index cda021c..11353f2 100644
Binary files a/site/linear-algebra/ch02/audio/en/check.mp3 and b/site/linear-algebra/ch02/audio/en/check.mp3 differ
diff --git a/site/linear-algebra/ch02/audio/en/play.mp3 b/site/linear-algebra/ch02/audio/en/play.mp3
new file mode 100644
index 0000000..abe0b00
Binary files /dev/null and b/site/linear-algebra/ch02/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch02/audio/en/q1.mp3 b/site/linear-algebra/ch02/audio/en/q1.mp3
index 1f5edb5..8a06229 100644
Binary files a/site/linear-algebra/ch02/audio/en/q1.mp3 and b/site/linear-algebra/ch02/audio/en/q1.mp3 differ
diff --git a/site/linear-algebra/ch02/audio/en/timings.js b/site/linear-algebra/ch02/audio/en/timings.js
index 0ca1934..a0256bf 100644
--- a/site/linear-algebra/ch02/audio/en/timings.js
+++ b/site/linear-algebra/ch02/audio/en/timings.js
@@ -136,109 +136,109 @@ window.TIMINGS = {
]
},
"check": {
- "dur": 55.152,
+ "dur": 57.096,
"marks": {
- "eq": 1.484,
- "into": 8.359,
- "a": 10.56,
- "a1": 11.992,
- "a2": 17.904,
- "ano": 23.451,
- "b": 27.865,
- "b1": 29.583,
- "bno": 35.911,
- "b2": 41.641,
- "c": 44.31,
- "c1": 45.56,
- "c2": 47.812,
- "cok": 50.768
+ "eq": 1.51,
+ "into": 8.568,
+ "a": 10.547,
+ "a1": 11.966,
+ "a2": 17.812,
+ "ano": 23.88,
+ "b": 28.32,
+ "b1": 30.0,
+ "bno": 36.25,
+ "b2": 39.883,
+ "c": 46.237,
+ "c1": 47.565,
+ "c2": 49.831,
+ "cok": 52.747
},
"cues": [
[
- 0.117,
+ 0.13,
"Here's another system."
],
[
- 1.484,
+ 1.51,
"Two x minus y equals zero, and negative x plus two y equals three."
],
[
- 7.292,
+ 7.474,
"To check a pair, put it into both equations."
],
[
- 10.56,
+ 10.547,
"Try two, four."
],
[
- 11.992,
+ 11.966,
"First equation: two times two, minus four, is zero."
],
[
- 16.875,
+ 16.758,
"It works."
],
[
- 17.904,
+ 17.812,
"Second: negative two, plus two times four, is six."
],
[
- 22.396,
+ 22.773,
"Not three."
],
[
- 23.451,
+ 23.88,
"So two, four solves the first equation, but not the system."
],
[
- 27.865,
+ 28.32,
"Try negative one, one."
],
[
- 29.583,
+ 30.0,
"First: two times negative one, minus one, is negative three."
],
[
- 34.675,
+ 35.104,
"Not zero."
],
[
- 35.911,
- "One failed equation is enough: it's not a solution, even though the second equation does work, because one plus two is three."
+ 36.25,
+ "One failed equation is enough: it's not a solution, even though the second equation does work: negative x is one, and one plus two is three."
],
[
- 44.31,
+ 46.237,
"Try one, two."
],
[
- 45.56,
+ 47.565,
"Two minus two is zero."
],
[
- 47.812,
+ 49.831,
"Negative one plus four is three."
],
[
- 50.768,
+ 52.747,
"Both work."
],
[
- 51.849,
+ 53.802,
"One, two is the solution of this system."
]
]
},
"q1": {
- "dur": 3.936,
+ "dur": 5.88,
"marks": {},
"cues": [
[
- 0.104,
+ 0.091,
"Quick check."
],
[
- 1.107,
- "Which equations does each pair pass?"
+ 1.12,
+ "Does each pair pass both equations, only one, or neither?"
]
]
},
@@ -413,74 +413,78 @@ window.TIMINGS = {
]
},
"between": {
- "dur": 41.784,
+ "dur": 44.76,
"marks": {
- "eq": 2.63,
- "draw": 6.927,
- "meet": 8.451,
- "x": 10.872,
- "y": 15.547,
- "guess": 20.508,
- "c1": 24.492,
- "c2": 28.164,
- "ok": 32.057,
- "lesson": 36.458
+ "eq": 2.669,
+ "draw": 7.357,
+ "meet": 8.906,
+ "x": 11.302,
+ "y": 15.859,
+ "guess": 20.482,
+ "c1": 27.227,
+ "c2": 31.029,
+ "ok": 34.935,
+ "lesson": 39.479
},
"cues": [
[
- 0.104,
+ 0.078,
"Not every crossing lands on the grid."
],
[
- 2.63,
+ 2.669,
"Take x plus y equals two, and x minus y equals one."
],
[
- 6.927,
+ 7.357,
"Draw both lines."
],
[
- 8.451,
+ 8.906,
"They cross here, between the grid lines."
],
[
- 10.872,
+ 11.302,
"x is between one and two, about halfway: maybe one and a half."
],
[
- 15.547,
+ 15.859,
"y is between zero and one, about halfway: maybe one half."
],
[
- 20.508,
+ 20.482,
"A picture can only say about."
],
[
- 22.487,
+ 22.448,
"So let's check the guess exactly."
],
[
- 24.492,
+ 24.44,
+ "One and a half is three halves."
+ ],
+ [
+ 27.227,
"Three halves plus one half is four halves, and that's two."
],
[
- 28.164,
+ 31.029,
"Three halves minus one half is two halves, and that's one."
],
[
- 32.057,
+ 34.935,
"Both exactly right."
],
[
- 33.555,
+ 36.419,
"The crossing is three halves, one half."
],
[
- 36.458,
+ 39.479,
"The picture tells us where to look."
],
[
- 38.398,
+ 41.354,
"Putting the numbers back into the equations proves it."
]
]
@@ -809,6 +813,30 @@ window.TIMINGS = {
]
]
},
+ "play": {
+ "dur": 12.0,
+ "marks": {
+ "go": 3.984
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.055,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 3.984,
+ "Change any number, drag a line, draw on the board if you like, and watch where the two lines meet."
+ ],
+ [
+ 10.091,
+ "Press continue when you're done."
+ ]
+ ]
+ },
"finish": {
"dur": 12.312,
"marks": {},
diff --git a/site/linear-algebra/ch02/index.html b/site/linear-algebra/ch02/index.html
index 5aaab7c..b09b03e 100644
--- a/site/linear-algebra/ch02/index.html
+++ b/site/linear-algebra/ch02/index.html
@@ -11,10 +11,11 @@
<script src="../lib/engine.js"></script>
<script src="../lib/math.js"></script>
<script src="../lib/linsys.js"></script>
+<script src="../lib/play.js"></script>
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 2, title: 'Two Equations, One Point', minutes: 11, language: 'en' };
+const CHAPTER = { number: 2, title: 'Two Equations, One Point', minutes: 11, language: 'en', next: '../ch03/' };
/* ---------- chapter drawing helpers (the same as chapter 1's) ---------- */
const BLUE = LS_ROW[0], CORAL = LS_ROW[1]; // first equation and its line, second equation and its line
@@ -33,8 +34,36 @@ const twoLines = (p, A, b, { t0 = .1, lines = true, meet = true, readout = true,
if (!lines) sys.lines.forEach(({ l }) => put(l, { o: 0 }));
if (!meet) put(sys.meetBox, { o: 0 });
if (!readout) put(sys.readout, { o: 0 });
+ placeMeet(sys);
return sys;
};
+// The meeting point's label goes where the two lines and the axes leave it most room (the library always puts it up
+// and right, where a rising line runs through it). Each spot's text box is tested against both lines and both axes.
+const placeMeet = sys => {
+ const lab = sys.meet.lastChild, { PX, PY } = sys.P;
+ const spots = [[18, -16, 1], [18, 40, 1], [-18, -16, -1], [-18, 40, -1], [24, -4, 1], [-24, -4, -1], [24, 30, 1], [-24, 30, -1], [0, 72, 0], [0, -50, 0]]; // x, baseline, side (0: centred under or over the point)
+ const f = (v, s) => {
+ if (s.x === undefined) return;
+ const w = lab.textContent.length * 14 + 4, ox = PX(0) - PX(s.x), oy = PY(0) - PY(s.y);
+ const ds = [0, 1].map(i => [v[`a${i}1`], v[`a${i}0`]]).filter(([a, b]) => a || b).map(([a, b]) => [a / Math.hypot(a, b), b / Math.hypot(a, b)]); // each line's direction on screen
+ let best = spots[0], far = -1;
+ for (const sp of spots) {
+ let d = Infinity;
+ const x0 = sp[2] ? Math.min(sp[0], sp[0] + sp[2] * w) : -w / 2, x1 = sp[2] ? Math.max(sp[0], sp[0] + sp[2] * w) : w / 2, y0 = sp[1] - 22, y1 = sp[1];
+ ds.forEach(([ux, uy]) => { // a line through the point: 0 if it cuts the text box, else its distance from the nearest corner
+ const c = [[x0, y0], [x1, y0], [x0, y1], [x1, y1]].map(([x, y]) => x * uy - y * ux);
+ d = Math.min(d, Math.min(...c) < 0 && Math.max(...c) > 0 ? 0 : Math.min(...c.map(Math.abs)));
+ });
+ // an axis under the text is less bad than a line through it, but still to be avoided
+ const gap = (a0, a1, b0, b1) => Math.max(0, b0 - a1, a0 - b1); // between two ranges, 0 when they overlap
+ const ax = Math.min(gap(x0, x1, ox - 34, ox + 4), gap(y0, y1, oy - 4, oy + 30)); // each axis with its numbers (left of y, under x)
+ d = Math.min(d, ax + 8) + ax / 100; // between equals, the spot farther from the axes
+ if (d > far + 1e-6) { best = sp; far = d; }
+ }
+ put(lab, { x: best[0], y: best[1] }); lab.setAttribute('text-anchor', best[2] > 0 ? 'start' : best[2] < 0 ? 'end' : 'middle');
+ };
+ sys.onChange(f); f(sys.v, sys.solve());
+};
// A dashed guide from a point straight down (or across) to an axis.
const guide = (sys, x, y, toAxis, t0, into) => {
const { PX, PY } = sys.P, d = toAxis === 'x' ? `M${PX(x)} ${PY(y)}V${PY(0)}` : `M${PX(x)} ${PY(y)}H${PX(0)}`;
@@ -43,10 +72,10 @@ const guide = (sys, x, y, toAxis, t0, into) => {
return g;
};
// A dashed amber ring: the target a hands-on question asks for.
-const ring = (sys, x, y, into, label = pairStr(x, y)) => {
+const ring = (sys, x, y, into, [dx, dy, anchor] = [22, 30, 'start'], label = pairStr(x, y)) => {
const g = G(into, { x: sys.P.PX(x), y: sys.P.PY(y) });
mk('circle', { r: 17, fill: 'none', stroke: COL.task, 'stroke-width': 3.5, 'stroke-dasharray': '5 5' }, g);
- M(g, [label], { x: 22, y: 30, size: 26, fill: COL.task });
+ M(g, [label], { x: dx, y: dy, size: 26, fill: COL.task, anchor });
return g;
};
// Which equations of a 2 × 2 system does (x, y) pass? [first, second]
@@ -89,7 +118,7 @@ const MISSQ = [
{ parts: ['x + y = 3, 2x + y = 8: (', { box: '5' }, ', −2)'], why: '5 − 2 = 3 and 10 − 2 = 8: x = 5 passes both.', hint: 'The first equation says x − 2 = 3. Then check your x in the second.' },
];
const MAKEQ = [
- { start: { a00: 1, a01: 1, b0: 1, a10: 2, a11: -1, b1: 2 }, at: [-1, 3], only: ['b0', 'b1'],
+ { start: { a00: 1, a01: 1, b0: 1, a10: 2, a11: -1, b1: 2 }, at: [-1, 3], lab: [0, -28, 'middle'], only: ['b0', 'b1'],
prompt: ['Change only the right sides so the lines meet at ', $m('(−1, 3)'), '.'],
why: 'x + y = 2 and 2x − y = −5: −1 + 3 = 2, and −2 − 3 = −5.', hint: 'Put x = −1, y = 3 into each left side: that number must be the right side. Or drag each line through the ring.',
answer: { b0: 2, b1: -5 } },
@@ -194,7 +223,7 @@ const BEATS = [
text(p, verdict[0], cx[3], yy, t[3], { size: 32, fill: verdict[1], weight: 700, anchor: 'middle' });
};
row(0, '(2, 4)', '2·2 − 4 = 0', '−2 + 2·4 = 6', true, false, [m('a'), m('a1'), m('a2'), m('ano')], ['no', COL.bad]);
- row(1, '(−1, 1)', '2·(−1) − 1 = −3', '1 + 2·1 = 3', false, true, [m('b'), m('b1'), m('b2'), m('bno')], ['no', COL.bad]);
+ row(1, '(−1, 1)', '2·(−1) − 1 = −3', '−(−1) + 2·1 = 3', false, true, [m('b'), m('b1'), m('b2'), m('bno')], ['no', COL.bad]);
row(2, '(1, 2)', '2·1 − 2 = 0', '−1 + 2·2 = 3', true, true, [m('c'), m('c1'), m('c2'), m('cok')], ['yes: the solution', COL.good]);
const n1 = text(p, 'not 3', cx[2] + 175, hy + 80 + 40, m('a2') + 1.2, { size: 22, fill: COL.bad, anchor: 'middle' });
const n2 = text(p, 'not 0', cx[1] + 165, hy + 80 + rh + 40, m('b1') + 1.6, { size: 22, fill: COL.bad, anchor: 'middle' });
@@ -209,7 +238,7 @@ const BEATS = [
text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
twoLines(p, [[1, 1], [1, -1]], [6, 2], { readout: false, hidePlane: true });
}, { ask: done => quiz(RCARD, [{
- id: 'c-both', prompt: ['Which equations does each pair pass: ', $m('x + y = 6'), ' and ', $m('x − y = 2'), '?'],
+ id: 'c-both', prompt: ['Does each pair pass both ', $m('x + y = 6'), ' and ', $m('x − y = 2'), ', only one of them, or neither?'],
build: grid(BOTHQ.map(q => ({ parts: [$m(pairStr(...q.pair))], ans: q.ans, why: q.why })),
[['b', 'Both', COL.good, 'B'], ['o', 'Only one', COL.task, 'O'], ['n', 'Neither', COL.bad, 'N']], { multi: false, text: true }),
}], done) }],
@@ -229,7 +258,7 @@ const BEATS = [
say(p, ['(0, 0)'], sys.P.PX(0) - 16, sys.P.PY(0) - 14, m('o') + .8, { size: 26, fill: BLUE, anchor: 'end' });
say(p, ['x = 1: 2 − y = 0, y = 2'], 90, 525, m('p'), { size: 32, fill: BLUE });
drop(sys, 1, 2, m('p') + 2.5, BLUE, '');
- const l12 = say(p, ['(1, 2)'], sys.P.PX(1) - 18, sys.P.PY(2) - 8, m('p') + 2.7, { size: 26, fill: BLUE, anchor: 'end' });
+ const l12 = say(p, ['(1, 2)'], sys.P.PX(1) + 16, sys.P.PY(2) + 34, m('p') + 2.7, { size: 26, fill: BLUE });
hide(l12, m('meet'), .3);
show(l1, m('l1'), .9);
sys.focus(1, m('coral'));
@@ -238,7 +267,7 @@ const BEATS = [
const fr = say(p, ['x = 0 would give 2y = 3: a fraction'], 90, 660, m('frac'), { size: 28, fill: COL.dim });
hide(fr, m('q2') - .2, .3);
say(p, ['x = 3: −3 + 2y = 3, y = 3'], 90, 660, m('q2'), { size: 32, fill: CORAL });
- drop(sys, 3, 3, m('q2') + 3.5, CORAL, '(3, 3)', 16, -14);
+ drop(sys, 3, 3, m('q2') + 3.5, CORAL, '(3, 3)', 16, 34);
show(l2, m('l2'), .9);
// a probe walks the coral line: −x + 2y stays 3 all the way
const { PX, PY } = sys.P, pr = G(p, { o: 0 });
@@ -246,9 +275,9 @@ const BEATS = [
const prT = T(pr, '', { x: -18, y: -16, size: 24, fill: CORAL, font: MATH, weight: 600, anchor: 'end' });
show(pr, m('l2') + 2, .3);
prog(q => {
- const x = -5 + q * 9, y = (3 + x) / 2, f = n => { const r = Math.round(n * 10) / 10; return r < 0 ? `(${num(r)})` : num(r); };
- put(pr, { x: PX(x), y: PY(y) });
- const str = `−${f(x)} + 2·${f(y)} = 3`;
+ const x = -5 + q * 9, xs = Math.round(x * 5) / 5, f = n => { const r = Math.round(n * 10) / 10; return r < 0 ? `(${num(r)})` : num(r); };
+ put(pr, { x: PX(x), y: PY((3 + x) / 2) });
+ const str = `−${f(xs)} + 2·${f((3 + xs) / 2)} = 3`; // the label reads a point a hair away whose sum is exact
if (prT.textContent !== str) prT.textContent = str;
}, m('l2') + 2, m('meet') - m('l2') - 2.4, io);
hide(pr, m('meet') - .3, .3);
@@ -266,6 +295,7 @@ const BEATS = [
const p = panel(0);
text(p, 'The riddle as a picture', 60, 110, .2, { size: 40, weight: 600 });
const sys = S.sys = twoLines(p, [[1, 1], [1, -1]], [5, 1], { lines: false, meet: false, readout: false });
+ put(sys.meet.lastChild, { x: 0, y: 72 }); sys.meet.lastChild.setAttribute('text-anchor', 'middle'); // under the point: the failed pairs' labels sit above it
sys.focus(0, m('eq'));
say(p, ['y = 0: x = 5; x = 0: y = 5'], 90, 470, m('a'), { size: 32, fill: BLUE });
drop(sys, 5, 0, m('a') + .3, BLUE, '', 0, 0); drop(sys, 0, 5, m('a') + 1.2, BLUE, '', 0, 0);
@@ -314,7 +344,8 @@ const BEATS = [
guide(sys, 1.5, .5, 'y', m('y'), p);
say(p, ['y ≈ 0.5'], PX(0) - 70, PY(.5) - 18, m('y') + .5, { size: 30, fill: COL.task, anchor: 'end' });
text(p, 'guess:', 90, 470, m('guess'), { size: 30, fill: COL.dim });
- say(p, ['x = ', F(3, 2), ', y = ', F(1, 2)], 200, 470, m('guess') + .3, { size: 38 });
+ hide(say(p, ['x = 1.5, y = 0.5'], 200, 470, m('guess') + .3, { size: 38 }), m('c1') - 2.8, .3);
+ say(p, ['x = ', F(3, 2), ', y = ', F(1, 2)], 200, 470, m('c1') - 2.5, { size: 38 }); // "one and a half is three halves"
say(p, [F(3, 2), ' + ', F(1, 2), ' = ', F(4, 2), ' = 2'], 90, 570, m('c1'), { size: 38, fill: BLUE });
okMark(p, true, 470, 570, m('c1') + 3);
say(p, [F(3, 2), ' − ', F(1, 2), ' = ', F(2, 2), ' = 1'], 90, 670, m('c2'), { size: 38, fill: CORAL });
@@ -337,10 +368,23 @@ const BEATS = [
hide(say(p, ['guess: x = 1.3, y = 0.3'], 90, 396, m('guess') + .3, { size: 36, fill: COL.task }), m('read') - .3, .3);
tw(sys.lines[0].l, { 'a_stroke-width': 9 }, m('meet'), .3); tw(sys.lines[0].l, { 'a_stroke-width': 5 }, m('meet') + 1, .5);
say(p, ['2·1.3'], 90, 470, m('c1') + 1.5, { size: 36, fill: BLUE });
- say(p, ['= 2.6'], 185, 470, m('c1') + 3.4, { size: 36, fill: BLUE });
- say(p, ['+ 0.3'], 290, 470, m('c1') + 5, { size: 36, fill: BLUE });
- say(p, ['= 2.9'], 395, 470, m('c1') + 6.8, { size: 36, fill: BLUE });
+ say(p, ['= 2.6'], 177, 470, m('c1') + 3.4, { size: 36, fill: BLUE });
+ say(p, ['+ 0.3'], 275, 470, m('c1') + 5, { size: 36, fill: BLUE });
+ say(p, ['= 2.9'], 373, 470, m('c1') + 6.8, { size: 36, fill: BLUE });
text(p, 'not 3: close, but not on the line', 90, 520, m('no'), { size: 30, fill: COL.bad, weight: 600 });
+ // A magnifier, 25 times closer, in the empty top-left of the plane: the guess sits on the coral line but beside the blue one.
+ const { PX, PY } = sys.P, Z = 25 * sys.P.u, R = 95, zc = [PX(-3.8), PY(3.2)], A = [PX(4 / 3), PY(1 / 3)];
+ const zoom = G(p, { x: zc[0], y: zc[1], o: 0 });
+ mk('circle', { r: R, fill: COL.board, stroke: COL.dim, 'stroke-width': 2.5 }, zoom);
+ [[1, 2, BLUE], [1, -1, CORAL]].forEach(([dx, dy, c]) => { const k = (R - 4) / Math.hypot(dx, dy); path(zoom, `M${-dx * k} ${-dy * k}L${dx * k} ${dy * k}`, { stroke: c, 'stroke-width': 5 }); });
+ const zg = G(zoom, { x: -Z / 30, y: Z / 30 }); mk('circle', { r: 10, fill: COL.task, stroke: COL.board, 'stroke-width': 3 }, zg);
+ const zx = G(zoom, { o: 0 }); mk('circle', { r: 10, fill: COL.chalk, stroke: COL.board, 'stroke-width': 3 }, zx);
+ T(zoom, '25 times closer', { x: 0, y: R + 34, size: 24, fill: COL.dim, anchor: 'middle' });
+ const link = G(p, { o: 0 }); // a ring round the crossing, and a dashed elbow up and across to the magnifier (clear of the label)
+ mk('circle', { cx: A[0], cy: A[1], r: 16, fill: 'none', stroke: COL.dim, 'stroke-width': 2.5 }, link);
+ path(link, `M${A[0]} ${A[1] - 16}V${zc[1]}H${zc[0] + R}`, { stroke: COL.dim, 'stroke-width': 2, 'stroke-dasharray': '4 6', fill: 'none' });
+ show(link, m('no') + .4, .4); show(zoom, m('no') + .7, .5);
+ tw(zg, { o: .45 }, m('read'), .4); show(zx, m('read') + .3, .4);
tw(g, { o: .45 }, m('read'), .4);
show(sys.readout, m('read'));
show(sys.meetBox, m('read') + .3);
@@ -365,6 +409,7 @@ const BEATS = [
tw(sys.lines[1].l, { 'a_stroke-width': 9 }, m('slides') + .8, .3); tw(sys.lines[1].l, { 'a_stroke-width': 8 }, m('slides') + 2.5, .5);
sys.focus(1, m('b1'));
const t1 = sys.to({ b1: 6 }, m('b1') + .3, 2.2, io, { trail: true }); flash(sys, 'b1', m('b1') + .3);
+ sys.focus(null, m('along') - .5);
tw(sys.lines[0].l, { 'a_stroke-width': 9 }, m('along'), .3); tw(sys.lines[0].l, { 'a_stroke-width': 5 }, m('along') + 1.2, .5);
pulse(sys.meet, m('new'));
const w0 = say(p, ['before: −2 + 2·4 = 6, not 3'], 90, 470, m('rem') + 1.5, { size: 32, fill: COL.bad });
@@ -374,7 +419,7 @@ const BEATS = [
sys.to({ b1: 3 }, m('back'), 1.2); flash(sys, 'b1', m('back'));
sys.focus(null, m('back'));
const g2 = ghost(2, -1, 0, BLUE, m('b0'));
- sys.focus(0, m('b0'));
+ sys.focus(0, m('b0')); sys.focus(null, m('slides2') + .9);
sys.to({ b0: 3 }, m('b0') + .5, 2.2, io, { trail: true }); flash(sys, 'b0', m('b0') + .5);
tw(sys.lines[1].l, { 'a_stroke-width': 9 }, m('slides2') + 1.5, .3); tw(sys.lines[1].l, { 'a_stroke-width': 5 }, m('slides2') + 2.7, .5);
pulse(sys.meet, m('new2'));
@@ -397,6 +442,7 @@ const BEATS = [
sys.focus(0, m('a'));
const t1 = sys.to({ a00: 1 }, m('a') + .3, 2.4, io, { trail: true }); flash(sys, 'a00', m('a') + .3);
const pv = pivot(0, 0, m('turns') + 1.5, BLUE);
+ sys.focus(null, m('along') - .5);
tw(sys.lines[1].l, { 'a_stroke-width': 9 }, m('along'), .3); tw(sys.lines[1].l, { 'a_stroke-width': 5 }, m('along') + 1.2, .5);
pulse(sys.meet, m('new'));
const c0 = say(p, ['(0, 0): 2·0 − 0 = 0, 1·0 − 0 = 0'], 90, 470, m('turns') + 3.5, { size: 30, fill: BLUE });
@@ -408,6 +454,7 @@ const BEATS = [
sys.focus(1, m('c'));
const t2 = sys.to({ a10: 2 }, m('c') + .4, 2.4, io, { trail: true }); flash(sys, 'a10', m('c') + .4);
pivot(0, -1, m('turns2') + 1.2, CORAL);
+ sys.focus(null, m('along2') - .5);
tw(sys.lines[0].l, { 'a_stroke-width': 9 }, m('along2'), .3); tw(sys.lines[0].l, { 'a_stroke-width': 5 }, m('along2') + 1.2, .5);
pulse(sys.meet, m('new2') + 1);
say(p, ['2 + 3 = 5 ✓, 2·2 − 3 = 1 ✓'], 90, 470, m('chk2'), { size: 32 });
@@ -483,10 +530,16 @@ const BEATS = [
build: (body, api) => {
const sys = S.sys;
sys.set(q.start);
- ring(sys, ...q.at, qlayer());
+ ring(sys, ...q.at, qlayer(), q.lab);
return lsTask(sys, (v, s) => near(s, ...q.at), q.why, q.hint, () => sys.set(q.answer), { only: q.only, trail: true })(body, api);
},
})), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = twoLines(p, [[2, -1], [-1, 2]], [0, 3]);
+ text(p, 'try: make them meet at (0, 0), then at (4, 1)', 60, 800, m('go'), { size: 26, fill: COL.dim }); // under the card, beside nothing it could cover
+ }, { ask: playAsk(() => S.sys, { tip: 'Your two lines. Change any number, drag a line, or draw on the board. Nothing is marked.' }) }],
['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/linear-algebra/ch03/audio/en/play.mp3 b/site/linear-algebra/ch03/audio/en/play.mp3
new file mode 100644
index 0000000..001b183
Binary files /dev/null and b/site/linear-algebra/ch03/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch03/audio/en/same.mp3 b/site/linear-algebra/ch03/audio/en/same.mp3
index b6d9262..9163adf 100644
Binary files a/site/linear-algebra/ch03/audio/en/same.mp3 and b/site/linear-algebra/ch03/audio/en/same.mp3 differ
diff --git a/site/linear-algebra/ch03/audio/en/timings.js b/site/linear-algebra/ch03/audio/en/timings.js
index 43b2327..1d235ca 100644
--- a/site/linear-algebra/ch03/audio/en/timings.js
+++ b/site/linear-algebra/ch03/audio/en/timings.js
@@ -233,20 +233,21 @@ window.TIMINGS = {
]
},
"same": {
- "dur": 51.264,
+ "dur": 56.664,
"marks": {
- "eq": 1.55,
- "twice": 6.536,
- "six": 14.531,
- "half": 16.888,
- "after": 17.747,
- "draw": 22.852,
- "p1": 27.24,
- "p1b": 32.5,
- "p2": 35.99,
- "p2b": 39.74,
- "all": 42.943,
- "inf": 46.667
+ "eq": 1.523,
+ "twice": 6.562,
+ "six": 14.167,
+ "half": 16.419,
+ "after": 17.279,
+ "draw": 22.305,
+ "p1": 27.005,
+ "p1a": 32.031,
+ "p1b": 36.315,
+ "p2": 41.497,
+ "p2b": 45.208,
+ "all": 48.385,
+ "inf": 52.083
},
"cues": [
[
@@ -254,47 +255,47 @@ window.TIMINGS = {
"Now a different case."
],
[
- 1.55,
+ 1.523,
"x plus two y equals three, and two x plus four y equals six."
],
[
- 6.536,
+ 6.562,
"This time the whole second equation, both sides, is twice the first: two times x plus two y is two x plus four y, and two times three is six."
],
[
- 16.888,
+ 16.419,
"Halve it, and it's x plus two y equals three again: the very same equation."
],
[
- 22.852,
+ 22.305,
"In the picture, the coral line lies exactly on top of the blue line."
],
[
- 27.24,
- "Take any point on it."
+ 27.005,
+ "Take any point on it, and check it in both equations as they were first written."
],
[
- 28.568,
- "Three, zero: three plus zero is three, and six plus zero is six."
+ 32.031,
+ "Three, zero: three plus two times zero is three, and two times three, plus four times zero, is six."
],
[
- 34.922,
+ 40.43,
"Both work."
],
[
- 35.99,
+ 41.497,
"One, one: one plus two is three, and two plus four is six."
],
[
- 41.862,
+ 47.292,
"Both work."
],
[
- 42.943,
+ 48.385,
"Every point on this line solves both equations."
],
[
- 46.667,
+ 52.083,
"So this system has endlessly many solutions: the whole line."
]
]
@@ -641,6 +642,30 @@ window.TIMINGS = {
]
]
},
+ "play": {
+ "dur": 11.28,
+ "marks": {
+ "go": 3.75
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.107,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 3.75,
+ "Change any number, drag a line, and try to make the lines parallel, or one line."
+ ],
+ [
+ 9.675,
+ "Press continue when you're done."
+ ]
+ ]
+ },
"finish": {
"dur": 11.544,
"marks": {},
diff --git a/site/linear-algebra/ch03/index.html b/site/linear-algebra/ch03/index.html
index 3601ada..50822b2 100644
--- a/site/linear-algebra/ch03/index.html
+++ b/site/linear-algebra/ch03/index.html
@@ -11,6 +11,7 @@
<script src="../lib/engine.js"></script>
<script src="../lib/math.js"></script>
<script src="../lib/linsys.js"></script>
+<script src="../lib/play.js"></script>
<script src="audio/en/timings.js"></script>
<script>
'use strict';
@@ -50,7 +51,17 @@ const twoLines = (p, A, b, { t0 = .1, lines = true, meet = true, readout = true,
const out = offMark && s.x !== undefined && Math.max(Math.abs(s.x), Math.abs(s.y)) > x1;
put(mark, { o: out ? 1 : 0 });
if (!out) { arr.setAttribute('d', ''); lab.textContent = ''; put(lab, { x: 0, y: 0 }); return; } // nothing left over, so a seek shows the same page
- const k = x1 / Math.max(Math.abs(s.x), Math.abs(s.y)), ex = s.x * k, ey = s.y * k, n = Math.hypot(s.x, s.y), ux = s.x / n, uy = s.y / n;
+ // The arrow sits where a line leaves the picture nearest the meeting point, and points along that line toward it.
+ let ex, ey, best = Infinity;
+ for (const i of [0, 1]) {
+ const a = v[`a${i}0`], b = v[`a${i}1`], c = v[`b${i}`], ends = [];
+ if (b) [-x1, x1].forEach(x => ends.push([x, (c - a * x) / b]));
+ if (a) [-x1, x1].forEach(y => ends.push([(c - b * y) / a, y]));
+ ends.filter(([x, y]) => Math.abs(x) <= x1 + 1e-9 && Math.abs(y) <= x1 + 1e-9).forEach(([x, y]) => {
+ const d = Math.hypot(s.x - x, s.y - y); if (d < best) { best = d; ex = x; ey = y; }
+ });
+ }
+ const ux = (s.x - ex) / best, uy = (s.y - ey) / best;
const a = [PX(ex - ux * 1.1), PY(ey - uy * 1.1)], c = [PX(ex), PY(ey)];
arr.setAttribute('d', `M${a[0]} ${a[1]}L${c[0]} ${c[1]}M${c[0] - 16 * ux - 9 * uy} ${c[1] + 16 * uy - 9 * ux}L${c[0]} ${c[1]}L${c[0] - 16 * ux + 9 * uy} ${c[1] + 16 * uy + 9 * ux}Z`);
lab.textContent = `meets at (${fmt1(s.x)}, ${fmt1(s.y)})`;
@@ -59,8 +70,36 @@ const twoLines = (p, A, b, { t0 = .1, lines = true, meet = true, readout = true,
};
sys.onChange(onChange);
onChange(sys.v, sys.solve());
+ placeMeet(sys);
return sys;
};
+// The meeting point's label goes where the two lines and the axes leave it most room (the library always puts it up
+// and right, where a rising line runs through it). Each spot's text box is tested against both lines and both axes.
+const placeMeet = sys => {
+ const lab = sys.meet.lastChild, { PX, PY } = sys.P;
+ const spots = [[18, -16, 1], [18, 40, 1], [-18, -16, -1], [-18, 40, -1], [24, -4, 1], [-24, -4, -1], [24, 30, 1], [-24, 30, -1], [0, 72, 0], [0, -50, 0]]; // x, baseline, side (0: centred under or over the point)
+ const f = (v, s) => {
+ if (s.x === undefined) return;
+ const w = lab.textContent.length * 14 + 4, ox = PX(0) - PX(s.x), oy = PY(0) - PY(s.y);
+ const ds = [0, 1].map(i => [v[`a${i}1`], v[`a${i}0`]]).filter(([a, b]) => a || b).map(([a, b]) => [a / Math.hypot(a, b), b / Math.hypot(a, b)]); // each line's direction on screen
+ let best = spots[0], far = -1;
+ for (const sp of spots) {
+ let d = Infinity;
+ const x0 = sp[2] ? Math.min(sp[0], sp[0] + sp[2] * w) : -w / 2, x1 = sp[2] ? Math.max(sp[0], sp[0] + sp[2] * w) : w / 2, y0 = sp[1] - 22, y1 = sp[1];
+ ds.forEach(([ux, uy]) => { // a line through the point: 0 if it cuts the text box, else its distance from the nearest corner
+ const c = [[x0, y0], [x1, y0], [x0, y1], [x1, y1]].map(([x, y]) => x * uy - y * ux);
+ d = Math.min(d, Math.min(...c) < 0 && Math.max(...c) > 0 ? 0 : Math.min(...c.map(Math.abs)));
+ });
+ // an axis under the text is less bad than a line through it, but still to be avoided
+ const gap = (a0, a1, b0, b1) => Math.max(0, b0 - a1, a0 - b1); // between two ranges, 0 when they overlap
+ const ax = Math.min(gap(x0, x1, ox - 34, ox + 4), gap(y0, y1, oy - 4, oy + 30)); // each axis with its numbers (left of y, under x)
+ d = Math.min(d, ax + 8) + ax / 100; // between equals, the spot farther from the axes
+ if (d > far + 1e-6) { best = sp; far = d; }
+ }
+ put(lab, { x: best[0], y: best[1] }); lab.setAttribute('text-anchor', best[2] > 0 ? 'start' : best[2] < 0 ? 'end' : 'middle');
+ };
+ sys.onChange(f); f(sys.v, sys.solve());
+};
// A small framed picture of two lines, for comparing the three cases side by side.
const mini = (p, cx, cy, l1, l2, t0, caption, sub, tPlane = t0) => {
const P = plane(p, { cx, cy, u: 30, x0: -5, x1: 5, y0: -5, y1: 5, labels: false, t0: tPlane });
@@ -110,10 +149,10 @@ const THINKQ = [
{ prompt: ['Multiply both sides of ', $m('x − 2y = 4'), ' by 3. What happens to its line?'],
opts: ['It slides', 'It turns', 'It stays where it is'], right: 2,
why: '3x − 6y = 12 has exactly the same solutions, for example (4, 0) and (0, −2): the same line.',
- no: ['Only changing the right side alone slides it. Here every number is multiplied, so every solution still works.', 'Every point that solved x − 2y = 4 still solves 3x − 6y = 12. Check (4, 0).', ''] },
+ no: ['Changing only the right side slides a line. Here every number is multiplied, so every solution still works.', 'Every point that solved x − 2y = 4 still solves 3x − 6y = 12. Check (4, 0).', ''] },
];
const BUILDQ = [
- { start: { a00: 1, a01: -2, b0: 2, a10: 1, a11: 1, b1: 1 }, only: ['a10', 'a11'], test: s => !!s.none,
+ { start: { a00: 1, a01: -2, b0: 2, a10: 1, a11: 1, b1: 1 }, only: ['a10', 'a11'], test: (s, v) => !!s.none && !!(v.a10 || v.a11), // 0x + 0y = 1 is no line at all
prompt: ['Change only the ', $m('x'), ' and ', $m('y'), ' numbers of the second equation so the lines never meet.'],
why: 'For example x − 2y = 1: the same tilt as x − 2y = 2, with a different right side. Parallel, no solution.',
hint: 'Copy the tilt: make the second left side a multiple of x − 2y, such as x − 2y or 2x − 4y.', answer: { a10: 1, a11: -2 } },
@@ -124,7 +163,7 @@ const BUILDQ = [
{ start: { a00: 1, a01: 1, b0: 1, a10: 1, a11: 1, b1: 4 }, only: ['a10', 'a11'], test: s => near(s, -1, 2),
prompt: ['These lines are parallel. Change only the ', $m('x'), ' and ', $m('y'), ' numbers of the second equation so they cross at ', $m('(−1, 2)'), '.'],
why: 'For example 2y = 4 (0x + 2y), or 2x + 3y = 4: −1 times the x number plus 2 times the y number must make 4.',
- hint: '(−1, 2) is already on the blue line. The coral line turns about (0, 4) here; make −1·(x number) + 2·(y number) = 4.', answer: { a10: 0, a11: 2 } },
+ hint: '(−1, 2) is already on the blue line. Turn the coral line until it passes through (−1, 2) too: −1 times the x number plus 2 times the y number must make 4.', answer: { a10: 0, a11: 2 } },
];
/* ---------- beats ---------- */
@@ -153,7 +192,7 @@ const BEATS = [
const b = mini(p, 800, 420, [-4, -3, 4, 1], [-4, 0, 4, 4], m('par'), 'parallel', 'no solution', m('but') + .3);
const l2 = [-4, 4, 4, -4]; l2.dash = '18 14';
const c = mini(p, 1300, 420, [-4, 4, 4, -4], l2, m('same'), 'the same line', 'endlessly many', m('but') + .7);
- const d1 = a.P.dot(2, 1, COL.chalk, 2);
+ const d1 = a.P.dot(1, .5, COL.chalk, 2); // where y = x/2 and y = 1 − x/2 cross
pulse(d1, m('one')); pulse(d1, m('cross') + .3); show(a.sub, m('one') + .4);
pulse(d1, m('sizes')); show(b.sub, m('none')); show(c.sub, m('inf'));
const gap = G(p, {}), { PX, PY } = b.P;
@@ -177,12 +216,19 @@ const BEATS = [
const g = G(p, { o: 0 }); mk('circle', { r: 11, fill: LS_ROW[row], stroke: COL.board, 'stroke-width': 3 }, g);
const lb = T(g, '', { x: 18, y: -16, size: 24, fill: LS_ROW[row], font: MATH, weight: 600 });
show(g, t, .3);
- prog(q => { const x = -1 + q * 5, y = c - x; put(g, { x: PX(x), y: PY(y) }); const s = `${num(Math.round(x * 10) / 10)} + ${num(Math.round(y * 10) / 10)} = ${c}`; if (lb.textContent !== s) lb.textContent = s; }, t, dur, io);
+ prog(q => {
+ const x = -1 + q * 5, xs = Math.round(x * 10) / 10, ys = Math.round((c - xs) * 10) / 10; // the label reads a point a hair away whose sum is exact
+ put(g, { x: PX(x), y: PY(c - x) });
+ const s = `${num(xs)} + ${ys < 0 ? `(${num(ys)})` : num(ys)} = ${c}`; if (lb.textContent !== s) lb.textContent = s;
+ }, t, dur, io);
hide(g, t + dur + .3, .4);
};
probe(0, 2, m('l1') + .9, 3); probe(1, 5, m('l2') + .9, 3);
- const ghost = sys.P.line(0, 2, 2, 0, BLUE, m('slid'), { dash: '10 10', w: 3 }); tw(ghost, { o: .45 }, m('slid') + .6, .3);
- prog(q => { const s = q * 1.5; put(ghost, { x: s * sys.P.u, y: -s * sys.P.u }); }, m('slid') + .8, 2.2, io);
+ // a dashed copy of the blue line slides onto the coral one (x + y = c, c from 2 to 5), kept inside the grid
+ const gd = c => { const a = Math.max(-6, c - 6), b = Math.min(6, c + 6); return `M${PX(a)} ${PY(c - a)}L${PX(b)} ${PY(c - b)}`; };
+ const ghost = path(p, gd(2), { stroke: BLUE, 'stroke-width': 3, 'stroke-dasharray': '10 10', fill: 'none' }, { o: 0 });
+ tw(ghost, { o: .6 }, m('slid'), .5);
+ prog(q => ghost.setAttribute('d', gd(2 + 3 * q)), m('slid') + .8, 2.2, io);
hide(ghost, m('tilt') + 1.6, .4);
// the gap stays the same: two equal gaps marked
const gaps = G(p, { o: 0 });
@@ -205,11 +251,11 @@ const BEATS = [
flash(sys, 'a10', m('after')); flash(sys, 'a11', m('after')); flash(sys, 'b1', m('after'));
sys.to({ a10: 2, a11: 1, b1: 3 }, m('after'), 1.6);
tw(sys.lines[1].l, { 'a_stroke-width': 9 }, m('still'), .3); tw(sys.lines[1].l, { 'a_stroke-width': 5 }, m('still') + 1.2, .5);
- text(p, 'the coral line did not move', 90, 660, m('still') + .5, { size: 28, fill: CORAL, weight: 600 });
+ text(w, 'the coral line did not move', 90, 660, m('still') + .5, { size: 28, fill: CORAL, weight: 600 });
hide(w, m('now') - .3, .4);
- say(p, ['2x + y = 1'], 470, 470, m('now'), { size: 38, fill: BLUE });
- say(p, ['2x + y = 3'], 470, 535, m('and'), { size: 38, fill: CORAL });
- text(p, '1 or 3? impossible', 470, 600, m('no'), { size: 30, fill: COL.bad, weight: 600 });
+ say(p, ['2x + y = 1'], 90, 470, m('now'), { size: 38, fill: BLUE });
+ say(p, ['2x + y = 3'], 90, 535, m('and'), { size: 38, fill: CORAL });
+ text(p, '1 or 3? impossible', 90, 600, m('no'), { size: 30, fill: COL.bad, weight: 600 });
show(sys.readout, m('none'));
}],
@@ -236,12 +282,13 @@ const BEATS = [
['a10', 'a11', 'b1'].forEach(k => flash(sys, k, m('after')));
show(sys.lines[0].l, m('draw') - .6, .6); show(sys.lines[1].l, m('draw') + .4, .9);
hide(w, m('p1') - .3, .3);
- drop(sys, 3, 0, m('p1'), COL.task, '(3, 0)', 12, -18);
- say(p, ['3 + 0 = 3'], 90, 470, m('p1') + .6, { size: 34, fill: BLUE }); okMark(p, true, 290, 470, m('p1') + 2);
- say(p, ['6 + 0 = 6'], 360, 470, m('p1b'), { size: 34, fill: CORAL }); okMark(p, true, 560, 470, m('p1b') + 1);
+ sys.to({ a10: 2, a11: 4, b1: 6 }, m('p1') + .3, 1.2); ['a10', 'a11', 'b1'].forEach(k => flash(sys, k, m('p1') + .3)); // check in the equations as first written
+ drop(sys, 3, 0, m('p1a'), COL.task, '(3, 0)', 12, -18);
+ say(p, ['3 + 2·0 = 3'], 90, 470, m('p1a') + .4, { size: 34, fill: BLUE }); okMark(p, true, 310, 470, m('p1a') + 1.6);
+ say(p, ['2·3 + 4·0 = 6'], 370, 470, m('p1b'), { size: 34, fill: CORAL }); okMark(p, true, 620, 470, m('p1b') + 2.5);
drop(sys, 1, 1, m('p2'), COL.task, '(1, 1)');
- say(p, ['1 + 2 = 3'], 90, 535, m('p2') + .6, { size: 34, fill: BLUE }); okMark(p, true, 290, 535, m('p2') + 2);
- say(p, ['2 + 4 = 6'], 360, 535, m('p2b'), { size: 34, fill: CORAL }); okMark(p, true, 560, 535, m('p2b') + 1);
+ say(p, ['1 + 2·1 = 3'], 90, 535, m('p2') + .6, { size: 34, fill: BLUE }); okMark(p, true, 310, 535, m('p2') + 2);
+ say(p, ['2·1 + 4·1 = 6'], 370, 535, m('p2b'), { size: 34, fill: CORAL }); okMark(p, true, 620, 535, m('p2b') + 1);
[-5, -3, 5].forEach((x, i) => drop(sys, x, (3 - x) / 2, m('all') + i * .4, COL.task, ''));
show(sys.readout, m('inf'));
}],
@@ -325,13 +372,19 @@ const BEATS = [
const p = panel(0);
text(p, 'Turning toward parallel', 60, 110, .2, { size: 40, weight: 600 });
const sys = S.sys = twoLines(p, [[1, 1], [2, 1]], [2, 5], { t0: m('eq') - .3, offMark: true });
- put(sys.meet.lastChild, { x: -18, y: 42 }); sys.meet.lastChild.setAttribute('text-anchor', 'end'); // below left of the point, clear of the axis numbers and the lines
pulse(sys.meet, m('meet'));
sys.focus(1, m('turn'));
const steps = [['six', 1.5], ['off', 1.2], ['far', 1.1], ['gone', 1]];
const trails = [sys.to({ a10: 1.5 }, m('six') - 1.2, 1.4, io, { trail: true })];
steps.slice(1).forEach(([mk_, a]) => sys.to({ a10: a }, m(mk_) - .6, 1.2));
steps.forEach(([mk_]) => flash(sys, 'a10', m(mk_) - .6));
+ sys.focus(null, m('run') - .5);
+ // where they meet, step by step, under the readout
+ text(p, 'x number', 90, 470, m('meet'), { size: 26, fill: COL.dim }); text(p, 'they meet at', 260, 470, m('meet'), { size: 26, fill: COL.dim });
+ [['meet', '2', '(3, −1)'], ['six', '1.5', '(6, −4)'], ['off', '1.2', '(15, −13)'], ['far', '1.1', '(30, −28)']].forEach(([mk_, a, at], i) => {
+ say(p, [a], 90, 520 + i * 50, m(mk_), { size: 32, fill: CORAL }); say(p, [at], 260, 520 + i * 50, m(mk_) + .3, { size: 32 });
+ });
+ say(p, ['1'], 90, 720, m('gone'), { size: 32, fill: CORAL }); text(p, 'parallel: they never meet', 260, 720, m('gone') + .3, { size: 30, fill: COL.bad, weight: 600 });
tw(sys.lines[0].l, { 'a_stroke-width': 9 }, m('run'), .3); tw(sys.lines[0].l, { 'a_stroke-width': 5 }, m('run') + 1.2, .5);
trails.forEach(t => hide(t, m('back') - .2, .3));
sys.focus(null, m('back'));
@@ -389,8 +442,14 @@ const BEATS = [
S.sys = twoLines(p, [[1, -2], [1, 1]], [2, 1], { readout: false, offMark: true });
}, { ask: done => quiz(CARD, BUILDQ.map((q, k) => ({
id: 'p-build' + (k + 1), prompt: q.prompt,
- build: (body, api) => { S.sys.set(q.start); return lsTask(S.sys, (v, s) => q.test(s), q.why, q.hint, () => S.sys.set(q.answer), { only: q.only })(body, api); },
+ build: (body, api) => { S.sys.set(q.start); return lsTask(S.sys, (v, s) => q.test(s, v), q.why, q.hint, () => S.sys.set(q.answer), { only: q.only })(body, api); },
})), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = twoLines(p, [[1, 1], [2, 1]], [2, 5], { offMark: true });
+ text(p, 'try: make them parallel, then make them one line', 60, 800, m('go'), { size: 26, fill: COL.dim }); // under the card, beside nothing it could cover
+ }, { ask: playAsk(() => S.sys, { tip: 'Your two lines. Change any number, drag a line, or draw on the board. Nothing is marked.' }) }],
['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/linear-algebra/index.html b/site/linear-algebra/index.html
index 2f54447..15dc213 100644
--- a/site/linear-algebra/index.html
+++ b/site/linear-algebra/index.html
@@ -72,7 +72,7 @@
Contents.book({
start: { unit: 1, chapter: 1 },
units: [ // [unit title, [[chapter title, minutes], ...]]
- ['The Geometry of Linear Equations', [['One Equation, One Line', 10]]],
+ ['The Geometry of Linear Equations', [['One Equation, One Line', 10], ['Two Equations, One Point', 11], ['Crossing, Parallel or the Same Line', 10]]],
],
hues: ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'], // one colour per unit, cycling
});