An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(linear-algebra): chapters 8-10 reviewed
yzrbd24672f3559
diff --git a/site/linear-algebra/ch08/audio/en/timings.js b/site/linear-algebra/ch08/audio/en/timings.jsindex e837837..7c0cc53 100644--- a/site/linear-algebra/ch08/audio/en/timings.js+++ b/site/linear-algebra/ch08/audio/en/timings.js@@ -653,13 +653,13 @@ window.TIMINGS = {]},"wrap": {- "dur": 34.776,+ "dur": 35.688,"marks": {- "w1": 1.003,- "w2": 10.391,- "w3": 15.794,- "w4": 22.057,- "end": 32.513+ "w1": 1.029,+ "w2": 10.352,+ "w3": 15.859,+ "w4": 23.164,+ "end": 33.529},"cues": [[@@ -667,35 +667,35 @@ window.TIMINGS = {"To sum up."],[- 1.003,+ 1.029,"A system can be written as A x equals b: A holds the numbers in front of the unknowns, x the unknowns, b the right sides."],[- 10.391,+ 10.352,"Each row of A is one equation."],[- 12.669,+ 12.643,"Each column of A belongs to one unknown."],[- 15.794,+ 15.859,"Size: rows first, then columns."],[- 18.841,- "Three rows and two columns is three by two."+ 18.984,+ "This one has two rows and two columns: two by two."],[- 22.057,+ 23.164,"The entry in row two, column one is the number in the second equation, in front of the first unknown."],[- 29.245,+ 30.26,"Change it in one place, and it changes in the other."],[- 32.513,+ 33.529,"Now try the chapter practice."]]diff --git a/site/linear-algebra/ch08/audio/en/wrap.mp3 b/site/linear-algebra/ch08/audio/en/wrap.mp3index df99e43..d7acca7 100644Binary files a/site/linear-algebra/ch08/audio/en/wrap.mp3 and b/site/linear-algebra/ch08/audio/en/wrap.mp3 differdiff --git a/site/linear-algebra/ch08/index.html b/site/linear-algebra/ch08/index.htmlindex e47eed9..aeb4144 100644--- a/site/linear-algebra/ch08/index.html+++ b/site/linear-algebra/ch08/index.html@@ -55,7 +55,7 @@ function rings(sys, key, into, t0, t1, { tag = true } = {}) {const [ax, ay, aw, ah] = boxOf(matText(sys, key)), [ex, ey, ew, eh] = termBox(sys, key);const set = (r, x, y, w, hh) => { for (const [k, v] of Object.entries({ x: x - 10, y: y - 6, width: w + 20, height: hh + 12 })) r.setAttribute(k, v); };set(r1, ax - Math.max(0, 40 - aw) / 2, ay, Math.max(aw, 40), ah); set(r2, ex, ey, ew, eh);- if (lab) put(lab, { x: ax + aw / 2, y: key[1] === '0' ? ay - 18 : MX.row[1] + 124 });+ if (lab) put(lab, { x: ax + aw / 2, y: MX.row[1] + 124 }); // under the matrix: above it sit the column names};fit();if (t0 !== undefined) { sys.onChange(fit); prog(fit, t0, Math.max(.1, (t1 ?? t0 + 3) - t0), lin); show(g, t0, .3); if (t1 !== undefined) hide(g, t1, .3); }@@ -212,6 +212,8 @@ const BEATS = [frame(p, 214, 572, 168, 96, COLC[1], m('c2'), m('c3')); thick(sys.cols[1], m('c2') + .3);frame(p, 428, 572, 98, 96, COL.task, m('c3'), m('mix')); thick(sys.bArrow, m('c3') + .3);say(p, ['1·col 1 + 2·col 2 = b'], 90, 760, m('mix') + .3, { size: 34, fill: COL.task });+ sys.combo.forEach((c, i) => { put(c, { o: 0 }); show(c, m('mix') + .4 + i * 1.2, .5); }); // tip to tail on "one of the first … two of the second"+ thick(sys.bArrow, m('mix') + 2.6);// the letters, again and again; then only the numbers matterconst letters = [...sys.E.querySelectorAll('text')].filter(t => /^[xy]$/.test(t.textContent));letters.forEach((t, i) => { tw(t, { c_fill: COL.task }, m('letters') + 1 + i * .25, .25); tw(t, { c_fill: COL.chalk }, m('numbers') - .2, .4); });@@ -238,10 +240,11 @@ const BEATS = [frame(p, ...(([x, y, w, hh]) => [x - 8, y - 6, w + 16, hh + 12])(termBox(sys, 'a01')), COL.task, m('one'), m('r2'));fly('a01', '−1', [mid('a01'), EQ[1]], m('one') + 2.6, COLC[1]);text(p, '−x = −1·x', 590, EQ[1] + 92, m('r2') + .4, { size: 30, fill: COL.task, weight: 600 });+ frame(p, ...(([x, y, w, hh]) => [x - 8, y - 6, w + 16, hh + 12])(termBox(sys, 'a10')), COL.task, m('r2'), m('r2') + 2.6);fly('a10', '−1', [mid('a10'), EQ[1] + 92], m('r2') + 2, COLC[0]);fly('a11', '2', [mid('a11') - 10, EQ[1] + 92], m('r2') + 4.2, COLC[1]);show(parts.A, m('box'), .5);- pulse(parts.A, m('box') + 3.5);+ ['a00', 'a01', 'a10', 'a11'].forEach((k, i) => pulse(matText(sys, k), m('box') + 3.5 + i * .15, 1.3));const nm = text(p, 'a matrix', MX.col[0] + 46, 620, m('box') + 2.5, { size: 28, fill: COL.chalk, anchor: 'middle', weight: 600 });hide(nm, m('read') - .3, .3);// the letters go down into their own column@@ -255,7 +258,7 @@ const BEATS = [fly('b1', '3', [mid('b1'), EQ[1] + 92], m('bcol') + 1, COL.task);show(parts.eq, m('bcol') + 2, .4); show(parts.b, m('bcol') + 2, .4);const big = say(p, ['Ax = b'], 90, 700, m('read'), { size: 60 });- say(p, ['the whole system in one line'], 290, 700, m('read') + 1.4, { size: 28, fill: COL.dim });+ text(p, 'the whole system in one line', 290, 698, m('read') + 1.4, { size: 28, fill: COL.dim });keys.forEach((k, i) => flash(sys, k, m('same') + .6 + i * .25));sys.lines.forEach((l, i) => { tw(l.l, { 'a_stroke-width': 9 }, m('same') + 2 + i * .4, .3); tw(l.l, { 'a_stroke-width': 5 }, m('same') + 2.8 + i * .4, .5); });}],@@ -264,24 +267,24 @@ const BEATS = [const p = panel(0);text(p, 'Ax = b: three pieces', 60, 110, .2, { size: 40, weight: 600 });const sys = S.sys = sysOf(p, [[2, -1], [-1, 2]], [0, 3]);- frame(p, MAT[0] - 10, MAT[1] - 56, 224, 200, COL.chalk, m('A'), m('x'));+ frame(p, MAT[0] - 10, MAT[1] - 60, 224, 236, COL.chalk, m('A'), m('x'));text(p, 'the matrix', MAT[0] + 102, 620, m('A') + .4, { size: 26, fill: COL.chalk, anchor: 'middle', weight: 600 });['a00', 'a01', 'a10', 'a11'].forEach((k, i) => flash(sys, k, m('A') + 2.6 + i * .5));- frame(p, MX.xcol - 44, MAT[1] - 56, 88, 200, COL.chalk, m('x'), m('b'));+ frame(p, MX.xcol - 50, MAT[1] - 60, 100, 236, COL.chalk, m('x'), m('b'));text(p, 'the unknowns', MX.xcol, 660, m('x') + .4, { size: 26, fill: COL.chalk, anchor: 'middle', weight: 600 });- frame(p, MX.bcol - 58, MAT[1] - 56, 116, 200, COL.task, m('b'), m('r1'));+ frame(p, MX.bcol - 58, MAT[1] - 60, 116, 236, COL.task, m('b'), m('r1'));text(p, 'the right sides', MX.bcol + 20, 620, m('b') + .4, { size: 26, fill: COL.task, anchor: 'middle', weight: 600 });[0, 1].forEach(i => {const t = m(`r${i + 1}`), t1 = i ? m('next') : m('r2');rowBand(p, i, t, t1, { b: true });- frame(p, MX.xcol - 44, MAT[1] - 56, 88, 200, COL.chalk, t + 1.4, t1);+ frame(p, MX.xcol - 50, MAT[1] - 60, 100, 236, COL.chalk, t + 1.4, t1);tw(sys.lines[i].l, { 'a_stroke-width': 10 }, t + 3, .35); tw(sys.lines[i].l, { 'a_stroke-width': 5 }, t + 4.2, .6);});text(p, 'how A times x works: chapter 9', 90, 760, m('next') + .5, { size: 28, fill: COL.dim });frame(p, EQ[0] - 50, EQ[1] - 56, 540, 160, COL.task, m('short') + .6);- frame(p, MAT[0] - 14, MAT[1] - 60, 500, 200, COL.task, m('short') + 1.6);- text(p, '=', 600, 340, m('short') + 2.4, { size: 54, fill: COL.task, anchor: 'middle' });- ['a00', 'a01', 'a10', 'a11', 'b0', 'b1'].forEach((k, i) => flash(sys, k, m('short') + 3 + i * .35));+ frame(p, MAT[0] - 14, MAT[1] - 64, 500, 244, COL.task, m('short') + 1.6);+ text(p, 'the same system', 330, 338, m('short') + 2.4, { size: 28, fill: COL.task, anchor: 'middle', weight: 600 });+ ['a00', 'a01', 'a10', 'a11', 'b0', 'b1'].forEach((k, i) => flash(sys, k, m('short') + 2.2 + i * .2));}],['rowscols', 'Rows and columns', (m) => {@@ -304,7 +307,7 @@ const BEATS = [tw(sys.cols[1], { 'a_stroke-width': 10 }, m('arrows') + 5.4, .3); tw(sys.cols[1], { 'a_stroke-width': 5 }, m('arrows') + 6.8, .5);text(p, 'one column = one unknown = one arrow', 90, 730, m('arrows') + .3, { size: 30, weight: 600, fill: COLC[0] });const sz = G(p, { o: 0 });- M(sz, ['2 by 2'], { x: 90, y: 810, size: 44, fill: COL.task });+ M(sz, ['2 by 2'], { x: 90, y: 810, size: 44, fill: COL.task, anchor: 'start' });T(sz, '2 rows, 2 columns', { x: 260, y: 808, size: 28, fill: COL.dim });show(sz, m('size') + .4);text(p, 'rows first', 520, 808, m('first') + .2, { size: 28, fill: COL.task, weight: 600 });@@ -342,7 +345,7 @@ const BEATS = [rowBand(p, 1, m('rule') + .3, m('rule') + 3);colBand(p, 0, m('rule') + 2.2, m('sub'));const sub = G(p, { o: 0 });- M(sub, ['a₂₁ = −1'], { x: 90, y: 815, size: 40, fill: COL.task });+ M(sub, ['a₂₁ = −1'], { x: 90, y: 815, size: 40, fill: COL.task, anchor: 'start' });T(sub, 'row 2, column 1', { x: 290, y: 812, size: 28, fill: COL.dim });show(sub, m('sub') + 1);rings(sys, 'a10', p, m('sub') + 1, m('try'));@@ -353,9 +356,9 @@ const BEATS = [path(ptr, 'M0 0L0 30L8 22L14 36L20 33L14 20L25 20Z', { fill: COL.chalk, stroke: COL.board, 'stroke-width': 2 });put(ptr, { x: 640, y: 600 });show(ptr, m('try') + 1, .3);- tw(ptr, { x: MX.col[1] + 6, y: MX.row[0] - 10 }, m('try') + 1.2, .9);+ tw(ptr, { x: MX.col[1] + 26, y: MX.row[0] + 4 }, m('try') + 1.2, .9);rings(sys, 'a01', p, m('try') + 2.1, m('try') + 3.4);- tw(ptr, { x: MX.bcol + 6, y: MX.row[1] - 10 }, m('try') + 3.4, .9);+ tw(ptr, { x: MX.bcol + 30, y: MX.row[1] + 4 }, m('try') + 3.4, .9);rings(sys, 'b1', p, m('try') + 4.3, m('try') + 5.6);hide(ptr, m('try') + 5.6, .3);}],@@ -386,15 +389,16 @@ const BEATS = [const ghost = sys.P.line(0, 1.5, 3, 3, LS_ROW[1], m('flip'), { dash: '10 10', w: 3, into: p }); tw(ghost, { o: .35 }, m('flip') + .6, .4);sys.to({ a10: 1 }, m('flip'), 1.2);flash(sys, 'a10', m('both'));- text(p, '−x becomes +x', 590, EQ[1] + 92, m('both') + .4, { size: 30, fill: COL.task, weight: 600 });+ const bx_ = text(p, '−x becomes +x', 90, EQ[1] + 150, m('both') + .4, { size: 30, fill: COL.task, weight: 600 }); hide(bx_, m('b'), .3);+ { const gh = sys.P.arrow(0, 0, 2, -1, LS_COLS[0], m('col'), { into: p }); gh.setAttribute('stroke-dasharray', '8 8'); tw(gh, { o: .5 }, m('col') + .5, .3); hide(gh, m('b'), .4); }tw(sys.lines[1].l, { 'a_stroke-width': 10 }, m('turn') + .3, .35); tw(sys.lines[1].l, { 'a_stroke-width': 5 }, m('turn') + 1.5, .6);tw(sys.cols[0], { 'a_stroke-width': 10 }, m('col') + .4, .35); tw(sys.cols[0], { 'a_stroke-width': 5 }, m('col') + 1.8, .6);colBand(p, 0, m('col') + .2, m('b'));rings(sys, 'b1', p, m('b'), m('meet'));const ghost2 = sys.P.line(-3, 3, 3, 0, LS_ROW[1], m('b') + .2, { dash: '10 10', w: 3, into: p }); tw(ghost2, { o: .3 }, m('b') + .8, .4);hide(ghost, m('b') + .2, .4);- sys.to({ b1: 5 }, m('b') + .6, 1.4);- flash(sys, 'b1', m('b') + .8);+ sys.to({ b1: 5 }, m('b') + 2.3, 1.6); // on "to five", sliding into "The second line slides"+ flash(sys, 'b1', m('b') + 2.4);pulse(sys.meet, m('meet') + 1.4); pulse(sys.meet, m('meet') + 2.6);say(p, ['1 + 2·2 = 5'], 90, 690, m('meet') + 3, { size: 36 });text(p, '✓', 300, 690, m('meet') + 4.6, { size: 34, fill: COL.good, weight: 700 });@@ -429,14 +433,14 @@ const BEATS = [});const A = mtx(A1, [[1, 1], [1, -1], [2, 1]], 150, 440, { o: 0 });show(A.g, m('rows3'));- [0, 1, 2].forEach(i => band(A1, 156, 440 + i * 62 - 42, 156, 58, ROWC[i], m('rows3') + .2 + i * .4, m('cols2')));+ [0, 1, 2].forEach(i => { band(A1, 156, 440 + i * 62 - 42, 156, 58, ROWC[i], m('rows3') + .2 + i * .4, m('cols2')); band(A1, 70, 190 + i * 70 - 44, 340, 60, ROWC[i], m('rows3') + .2 + i * .4, m('cols2')); });[0, 1].forEach(j => band(A1, 160 + 78 * j + 3, 395, 72, 186, COLC[j], m('cols2') + .2 + j * .4, m('lines3')));- const sz = G(A1, { o: 0 }); M(sz, ['3 by 2'], { x: 150, y: 640, size: 40, fill: COL.task }); T(sz, '3 rows, 2 columns', { x: 150, y: 690, size: 26, fill: COL.dim }); show(sz, m('cols2') + 1.5);- const xv = mtx(A1, [['x'], ['y']], 350, 471, { o: 0 }), eqs = M(A1, ['='], { x: 470, y: 516, size: 42, o: 0 }), bv = mtx(A1, [[3], [1], [5]], 505, 440, { o: 0 });+ const sz = G(A1, { o: 0 }); M(sz, ['3 by 2'], { x: 150, y: 640, size: 40, fill: COL.task, anchor: 'start' }); T(sz, '3 rows, 2 columns', { x: 150, y: 690, size: 26, fill: COL.dim }); show(sz, m('cols2') + 1.5);+ const xv = mtx(A1, [['x'], ['y']], 350, 471, { o: 0 }), eqs = M(A1, ['='], { x: 488, y: 516, size: 42, o: 0 }), bv = mtx(A1, [[3], [1], [5]], 520, 440, { o: 0 });bv.cells.flat().forEach(c => c.setAttribute('fill', COL.task));show(xv.g, m('xb') + .2); show(eqs, m('xb') + .2); show(bv.g, m('xb') + 1.6);text(A1, '2 entries', 389, 590, m('xb') + .6, { size: 22, fill: COL.dim, anchor: 'middle' });- text(A1, '3 entries', 554, 640, m('xb') + 2, { size: 22, fill: COL.dim, anchor: 'middle' });+ text(A1, '3 entries', 569, 640, m('xb') + 2, { size: 22, fill: COL.dim, anchor: 'middle' });[[0, 3, 3, 0], [1, 0, 3, 2], [0, 5, 2, 1]].forEach(([xa, ya, xb, yb], i) => P2.line(xa, ya, xb, yb, ROWC[i], m('lines3') + .2 + i * .6, { into: A1 }));P2.dot(2, 1, COL.chalk, m('lines3') + 3, { label: '(2, 1)', into: A1 });// two equations, three unknowns@@ -450,8 +454,8 @@ const BEATS = [show(B.g, m('A23'));[0, 1].forEach(i => band(A2, 156, 440 + i * 62 - 42, 234, 58, ROWC[i], m('A23') + .2 + i * .4, m('A23') + 3));[0, 1, 2].forEach(j => band(A2, 160 + 78 * j + 3, 395, 72, 124, COLC[j], m('A23') + 3 + j * .4, m('x3')));- const sz2 = G(A2, { o: 0 }); M(sz2, ['2 by 3'], { x: 150, y: 640, size: 40, fill: COL.task }); T(sz2, '2 rows, 3 columns', { x: 150, y: 690, size: 26, fill: COL.dim }); show(sz2, m('A23') + 4);- const xv2 = mtx(A2, [['x'], ['y'], ['z']], 430, 409, { o: 0 }), eq2 = M(A2, ['='], { x: 550, y: 485, size: 42, o: 0 }), bv2 = mtx(A2, [[4], [1]], 585, 440, { o: 0 });+ const sz2 = G(A2, { o: 0 }); M(sz2, ['2 by 3'], { x: 150, y: 640, size: 40, fill: COL.task, anchor: 'start' }); T(sz2, '2 rows, 3 columns', { x: 150, y: 690, size: 26, fill: COL.dim }); show(sz2, m('A23') + 4);+ const xv2 = mtx(A2, [['x'], ['y'], ['z']], 430, 409, { o: 0 }), eq2 = M(A2, ['='], { x: 568, y: 485, size: 42, o: 0 }), bv2 = mtx(A2, [[4], [1]], 600, 440, { o: 0 });bv2.cells.flat().forEach(c => c.setAttribute('fill', COL.task));show(xv2.g, m('x3')); show(eq2, m('x3')); show(bv2.g, m('x3') + 1.5);text(A2, 'three unknowns live in space: chapter 11', 1160, 450, m('two3') + 2, { size: 28, fill: COL.dim, anchor: 'middle' });@@ -487,18 +491,27 @@ const BEATS = [put(sys.ROWV, { o: 0 });// row 1 read with x and y, written out in full firstrowBand(p, 0, m('r1'), m('r2'), { eq: false, b: true });- frame(p, MX.xcol - 44, MAT[1] - 56, 88, 200, COL.chalk, m('r1') + 1.2, m('r2'));+ frame(p, MX.xcol - 50, MAT[1] - 60, 100, 236, COL.chalk, m('r1') + 1.2, m('r2'));[['a00', 'a01'], ['a10', 'a11'], ['b0', 'b1']].forEach((ks, i) => ks.forEach(k => flash(sys, k, m('given') + 1.2 + i * 2.2)));rowBand(p, 0, m('given') + 1, m('given') + 3, { eq: false }); rowBand(p, 1, m('given') + 3.2, m('given') + 5.2, { eq: false });frame(p, MX.bcol - 50, MAT[1] - 56, 100, 140, COL.task, m('given') + 5.4, m('r1'));- const full1 = say(p, ['1·x + 4·y = 9'], EQ[0], EQ[1], m('r1') + 1, { size: 54 });+ // a row read out loud: each number flies from A, each letter from x, the right side from b, on its word+ const readRow = (i, nums, times) => {+ const [a, c, r] = nums, row = tokens(p, [{ t: String(a), fill: COLC[0] }, '·', 'x', ' + ', { t: String(c), fill: COLC[1] }, '·', 'y', ' = ', { t: String(r), fill: COL.task }], { x: EQ[0], y: EQ[1] + i * 92, size: 54 });+ const at = el => { const [x, y, w, hh] = boxOf(el); return [x + w / 2, y + hh * .8]; };+ const from = [at(matText(sys, `a${i}0`)), null, [MX.xcol, MX.row[0]], null, at(matText(sys, `a${i}1`)), null, [MX.xcol, MX.row[1]], null, at(matText(sys, `b${i}`))];+ const when = [times[0], times[0] + .3, times[1], times[2], times[2], times[2] + .3, times[3], times[4], times[4] + .2];+ row.forEach((e, k) => { put(e, { o: 0 }); if (from[k]) { const y = st(e).y; put(e, { x: from[k][0], y: from[k][1] }); tw(e, { x: e._px, y }, when[k], .8, io); } show(e, when[k], .25); });+ return row;+ };+ const full1 = G(p, {}); readRow(0, [1, 4, 9], [m('r1') + 3.2, m('r1') + 3.6, m('r1') + 4.8, m('r1') + 5.2, m('r1') + 6.6]).forEach(e => full1.append(e));hide(full1, m('r1b'), .4); show(g0, m('r1b') + .2);text(p, 'the 1 is not written', 590, EQ[1], m('r1b') + .6, { size: 26, fill: COL.dim });rowBand(p, 1, m('r2'), m('lines'), { eq: false, b: true });- frame(p, MX.xcol - 44, MAT[1] - 56, 88, 200, COL.chalk, m('r2') + 1, m('lines'));- const full2 = say(p, ['2·x + 0·y = 2'], EQ[0], EQ[1] + 92, m('r2') + .8, { size: 54 });+ frame(p, MX.xcol - 50, MAT[1] - 60, 100, 236, COL.chalk, m('r2') + 1, m('lines'));+ const full2 = G(p, {}); readRow(1, [2, 0, 2], [m('r2') + 1.4, m('r2') + 1.8, m('r2') + 2.8, m('r2') + 3.2, m('r2') + 4.2]).forEach(e => full2.append(e));hide(full2, m('zero') - .2, .4); show(g1, m('zero'));- text(p, '0y is nothing: 2x = 2', 590, EQ[1] + 92, m('zero') + 1.4, { size: 28, fill: COL.task, weight: 600 });+ text(p, '0y is nothing: 2x = 2', 90, EQ[1] + 150, m('zero') + 1.4, { size: 28, fill: COL.task, weight: 600 });rings(sys, 'a11', p, m('zero') + .3, m('zero') + 3, { tag: false });{ const [x, y, w, hh] = termBox(sys, 'a11'); const k = path(p, `M${x - 6} ${y + hh * .55}L${x + w + 6} ${y + hh * .45}`, { stroke: COL.task, 'stroke-width': 4 }, { d: 0 }); tw(k, { d: 1 }, m('zero') + 3.4, .5); }show(sys.ROWV, m('lines'), .8);@@ -512,16 +525,29 @@ const BEATS = [['tidy', 'Line it up first', (m) => {const p = panel(0);text(p, 'Line it up first', 60, 110, .2, { size: 40, weight: 600 });+ // the two lines, drawn from the untidy equations: tidying them never moves them+ const P0 = plane(p, { cx: 1160, cy: 450, u: 52, t0: m('eq') });+ P0.line(-3, 6, 6, -3, ROWC[0], m('eq') + .6, { into: P0.g }); P0.line(-3, -6, 3, 6, ROWC[1], m('eq') + 2.8, { into: P0.g });+ hide(P0.g, m('mat') + .6, .4);const steps = G(p, {});say(steps, ['y = 3 − x'], 90, 200, m('eq') + .2, { size: 48 });say(steps, ['2x = y'], 470, 200, m('eq') + 2.4, { size: 48 });const rule = G(steps, { o: 0 });- [['x term', COLC[0]], ['y term', COLC[1]], ['=', COL.chalk], ['number', COL.task]].forEach(([s, c], i) => text(rule, s, 90 + [0, 150, 300, 360][i], 300, m('rule') + 1.4 + i * 1.3, { size: 28, fill: c, weight: 600 }));+ [['x term', COLC[0]], ['y term', COLC[1]], ['=', COL.chalk], ['number', COL.task]].forEach(([s, c], i) => text(rule, s, 90 + [0, 150, 300, 360][i], 300, m('rule') + 2.2 + i * 1.9, { size: 28, fill: c, weight: 600 }));put(rule, { o: 1 });- text(steps, '+ x on both sides', 90, 380, m('e1'), { size: 26, fill: COL.dim });- say(steps, ['x + y = 3'], 90, 440, m('e1b'), { size: 48, fill: COL.task });- text(steps, '− y on both sides', 470, 380, m('e2'), { size: 26, fill: COL.dim });- say(steps, ['2x − y = 0'], 470, 440, m('e2b'), { size: 48, fill: COL.task });+ // one move per equation, done in the equation itself: the same thing added to both sides, then what cancels struck out+ const move = (items, x, t, tStrike, from, to) => {+ const row = tokens(steps, items, { x, y: 390, size: 40 });+ row.forEach((e, i) => { put(e, { o: 0 }); show(e, t + (items[i].fill ? .5 : 0), .4); });+ const a = row[from], b = row[to], k = path(steps, `M${a._px - a._w / 2} 378L${b._px + b._w / 2} 378`, { stroke: COL.bad, 'stroke-width': 4 }, { d: 0 });+ tw(k, { d: 1 }, tStrike, .5);+ return row;+ };+ const add = { fill: COL.irr };+ move(['y ', { t: '+ x', ...add }, ' = 3 ', '− x ', { t: '+ x', ...add }], 90, m('e1') + 1.8, m('e1b') - .6, 3, 4);+ say(steps, ['x + y = 3'], 90, 470, m('e1b'), { size: 48 });+ move(['2x ', { t: '− y', ...add }, ' = ', 'y ', { t: '− y', ...add }], 470, m('e2') + 1.6, m('e2b') - .6, 3, 4);+ say(steps, ['2x − y = 0'], 470, 470, m('e2b'), { size: 48 });hide(steps, m('mat') - .2, .4);const sys = S.sys = sysOf(p, [[1, 1], [2, -1]], [3, 0], { t0: m('mat') });['a00', 'a01', 'a10', 'a11', 'b0', 'b1'].forEach((k, i) => flash(sys, k, m('mat') + 1.5 + i * .5));@@ -546,7 +572,7 @@ const BEATS = [['wrap', 'Summary', (m) => {const p = panel(0);[['Ax = b is the system: A the numbers, x the unknowns, b the right sides.', 'w1'], ['Each row of A is one equation; each column belongs to one unknown.', 'w2'],- ['Size: rows first, then columns. 3 rows, 2 columns: 3 by 2.', 'w3'], ['Row 2, column 1: the second equation, in front of x. One number, two places.', 'w4']].forEach(([str, mark], i) => {+ ['Size: rows first, then columns. 2 rows, 2 columns: 2 by 2.', 'w3'], ['Row 2, column 1: the second equation, in front of x. One number, two places.', 'w4']].forEach(([str, mark], i) => {const g = G(p, { x: -16, y: 150 + i * 105, o: 0 });mk('circle', { cx: 150, cy: -12, r: 26, fill: COL.task }, g);T(g, String(i + 1), { x: 150, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });@@ -630,7 +656,7 @@ const BEATS = [['play', 'Playground', (m, D) => {const p = panel(0);text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });- S.sys = sysOf(p, [[2, -1], [-1, 2]], [0, 3], { view: 'both', plane: { cx: 1180, cy: 590, u: 36 } }); // a smaller plane under the card+ S.sys = sysOf(p, [[2, -1], [-1, 2]], [0, 3], { view: 'both', plane: { cx: 1150, cy: 604, u: 42, x0: -5, x1: 5, y0: -5, y1: 5 } }); // a smaller plane under the cardS.sys.labels(['col 1', 'col 2', 'b']);const hint = text(p, 'try: row 2 = 2 × row 1 · a 0 in row 1, column 2 · meet at (2, 1)', 400, 700, m('go'), { size: 24, fill: COL.dim, anchor: 'middle' });hide(hint, Math.min(m('go') + 9, D - .7), .6);diff --git a/site/linear-algebra/ch09/audio/en/system2.mp3 b/site/linear-algebra/ch09/audio/en/system2.mp3new file mode 100644index 0000000..2af6a6aBinary files /dev/null and b/site/linear-algebra/ch09/audio/en/system2.mp3 differdiff --git a/site/linear-algebra/ch09/audio/en/tall.mp3 b/site/linear-algebra/ch09/audio/en/tall.mp3index adb8aa1..eb488b1 100644Binary files a/site/linear-algebra/ch09/audio/en/tall.mp3 and b/site/linear-algebra/ch09/audio/en/tall.mp3 differdiff --git a/site/linear-algebra/ch09/audio/en/timings.js b/site/linear-algebra/ch09/audio/en/timings.jsindex d400a8e..3f83d47 100644--- a/site/linear-algebra/ch09/audio/en/timings.js+++ b/site/linear-algebra/ch09/audio/en/timings.js@@ -412,6 +412,64 @@ window.TIMINGS = {]]},+ "system2": {+ "dur": 42.24,+ "marks": {+ "A": 0.99,+ "r": 8.62,+ "lines": 19.167,+ "c": 22.214,+ "mix": 27.695,+ "land": 34.076,+ "same": 37.214+ },+ "cues": [+ [+ 0.104,+ "One more."+ ],+ [+ 0.99,+ "A is one, one in the first row, and one, minus one in the second, and b is five, one."+ ],+ [+ 8.62,+ "By rows, A x is x plus y, and x minus y."+ ],+ [+ 13.242,+ "So A x equals b says: x plus y equals five, and x minus y equals one."+ ],+ [+ 19.167,+ "Two lines, and they meet at three, two."+ ],+ [+ 22.214,+ "By columns, A x is x times column one, plus y times column two."+ ],+ [+ 27.695,+ "Three of one, one is three, three."+ ],+ [+ 30.547,+ "Two of one, minus one is two, minus two."+ ],+ [+ 34.076,+ "Together: five, one."+ ],+ [+ 36.237,+ "That's b."+ ],+ [+ 37.214,+ "The meeting point of the rows, three, two, is the mix of the columns."+ ]+ ]+ },"q2": {"dur": 4.176,"marks": {},@@ -493,13 +551,15 @@ window.TIMINGS = {]},"tall": {- "dur": 34.368,+ "dur": 46.032,"marks": {- "A": 2.188,- "x": 6.771,- "rows": 11.263,- "cols": 18.268,- "sizes": 25.938+ "A": 2.253,+ "x": 6.901,+ "rows": 11.471,+ "r2": 18.763,+ "r3": 23.698,+ "cols": 30.56,+ "sizes": 37.865},"cues": [[@@ -507,39 +567,51 @@ window.TIMINGS = {"Now a matrix that isn't square."],[- 2.188,+ 2.253,"This A is three by two: three rows, two columns."],[- 6.771,+ 6.901,"So x has two numbers, one for each column: four and one."],[- 11.263,- "By rows: four plus two is six."+ 11.471,+ "By rows."+ ],+ [+ 12.539,+ "Row one: one times four, plus two times one."+ ],+ [+ 16.576,+ "Four plus two is six."+ ],+ [+ 18.763,+ "Row two: zero times four, plus one times one, is one."],[- 14.154,- "Zero plus one is one."+ 23.698,+ "Row three: three times four, plus minus one times one."],[- 15.911,+ 28.086,"Twelve minus one is eleven."],[- 18.268,+ 30.56,"By columns: four times column one, plus one times column two, gives the same: six, one, eleven."],[- 25.938,+ 37.865,"Notice the sizes."],[- 27.5,+ 39.44,"Two columns in A, so x has two numbers."],[- 30.82,+ 42.734,"Three rows in A, so A x has three numbers."]]@@ -588,6 +660,69 @@ window.TIMINGS = {]]},+ "wide": {+ "dur": 50.784,+ "marks": {+ "A": 2.839,+ "x": 7.5,+ "r1": 13.281,+ "r2": 23.516,+ "ans": 32.018,+ "c": 36.927,+ "sum": 42.669,+ "rule": 48.503+ },+ "cues": [+ [+ 0.104,+ "One more shape: a wide matrix."+ ],+ [+ 2.839,+ "This A is two by three: two rows, three columns."+ ],+ [+ 7.5,+ "So x needs three numbers, one for each column: two, one, one."+ ],+ [+ 13.281,+ "By rows."+ ],+ [+ 14.362,+ "Row one: one times two, plus two times one, plus zero times one."+ ],+ [+ 20.182,+ "Two plus two plus zero is four."+ ],+ [+ 23.516,+ "Row two: three times two, plus minus one times one, plus one times one."+ ],+ [+ 29.258,+ "Six minus one plus one is six."+ ],+ [+ 32.018,+ "A x is four, six: two numbers, one for each row."+ ],+ [+ 36.927,+ "By columns: two of column one, plus one of column two, plus one of column three."+ ],+ [+ 42.669,+ "Two, six, plus two, minus one, plus zero, one: four, six again."+ ],+ [+ 48.503,+ "Three numbers go in, two come out."+ ]+ ]+ },"q3": {"dur": 3.12,"marks": {},diff --git a/site/linear-algebra/ch09/audio/en/wide.mp3 b/site/linear-algebra/ch09/audio/en/wide.mp3new file mode 100644index 0000000..b61fd10Binary files /dev/null and b/site/linear-algebra/ch09/audio/en/wide.mp3 differdiff --git a/site/linear-algebra/ch09/index.html b/site/linear-algebra/ch09/index.htmlindex 04f93ae..122ca1d 100644--- a/site/linear-algebra/ch09/index.html+++ b/site/linear-algebra/ch09/index.html@@ -16,7 +16,7 @@<script src="audio/en/timings.js"></script><script>'use strict';-const CHAPTER = { number: 9, title: 'Matrix Times Vector, Two Ways', minutes: 9, language: 'en' };+const CHAPTER = { number: 9, title: 'Matrix Times Vector, Two Ways', minutes: 10, language: 'en' };/* ---------- layout and colours ---------- */const DISP = [90, 230]; // A x = Ax in brackets, top left@@ -90,11 +90,12 @@ function rowWork(p, a, xs, x0, y, { from = null, xFrom = null, tm, ts, tr = ts +return { row, r };}// A grid2 in this chapter's layout (no moved grid: the columns, x·col 1 + y·col 2 and Ax only).-const g2Of = (p, A, x, o = {}) => grid2(p, { A, x, mat: DISP, grid: false, square: false, units: false, ...o });+const g2Of = (p, A, x, o = {}) => grid2(p, { A, x, mat: DISP, grid: false, square: false, units: false, brackets: true, ...o });const hideX = g => { put(g.xRing, { o: 0 }); put(g.xLab, { o: 0 }); };// Hide the product Ax (numbers in the brackets) behind question marks until t, or for good.function hideRes(g, p, t) {- const q = [0, 1].map(i => { const e = g.res(i), s = st(e); put(e, { o: 0 }); return T(p, '?', { x: s.x, y: s.y, size: 54, fill: COL.task, font: MATH, anchor: 'middle' }); });+ const q = [0, 1].map(i => { const e = g.res(i), s = st(e); put(e, { o: 0 }); return T(g.M, '?', { // inside the matrix group: it shows with the brackets+ x: s.x, y: s.y, size: 54, fill: COL.task, font: MATH, anchor: 'middle' }); });if (t !== undefined) { q.forEach(e => hide(e, t, .3)); [0, 1].forEach(i => show(g.res(i), t + .2, .4)); }return q;}@@ -110,7 +111,7 @@ const target = (P2, [x, y], into, t0 = .3) => {show(g, t0, .4);return g;};-const vecStr = v => `(${v.map(num).join(', ')})`;+const vecStr = v => `[${v.map(num).join(', ')}]`; // a vector, as chapters 4–7 write it// Inline matrix for a card prompt.function matEl(rows, { size = 30, fill = null } = {}) {const n = rows[0].length, cw = size * 1.8, rh = size * 1.3, w = cw * n + 16, hh = rh * rows.length + size * .3;@@ -125,8 +126,8 @@ const prodEl = (A, x) => { const s = h('span', '', [rich([$m('A'), ' = ']), matE/* ---------- practice data ---------- */const COLQ = [{ A: [[1, 2], [3, 1]], x: [2, 3] },- { A: [[4, -1], [0, 2]], x: [1, -2], note: 'A minus number of a column: go backwards along it.' },- { A: [[2, 0], [1, 5]], x: [3, 0], note: 'x = (3, 0) takes 3 of column 1 and none of column 2.' },+ { A: [[4, -1], [0, 2]], x: [1, -2], note: 'A minus number in x: go backwards along that column. [4, 0] + [2, −4] = [6, −4].' },+ { A: [[2, 0], [1, 5]], x: [3, 0], note: 'x = [3, 0] takes 3 of column 1 and none of column 2: [6, 3] + [0, 0] = [6, 3].' },{ A: [[-1, 3], [2, 2]], x: [-2, 1] },];const ROWQ = [@@ -139,9 +140,9 @@ const mul = (A, x) => A.map(r => r.reduce((s, v, j) => s + v * x[j], 0));const colRows = ({ A, x, note }) => {const c = j => A.map(r => r[j]), pr = j => c(j).map(v => v * x[j]), ax = mul(A, x);return [- { parts: [`${num(x[0])} · column 1 = (`, { box: String(pr(0)[0]) }, ', ', { box: String(pr(0)[1]) }, ')'], why: `${num(x[0])}·${vecStr(c(0))} = ${vecStr(pr(0))}`, hint: `Multiply both numbers of column 1, ${vecStr(c(0))}, by ${num(x[0])}.` },- { parts: [`${num(x[1])} · column 2 = (`, { box: String(pr(1)[0]) }, ', ', { box: String(pr(1)[1]) }, ')'], why: `${num(x[1])}·${vecStr(c(1))} = ${vecStr(pr(1))}`, hint: `Multiply both numbers of column 2, ${vecStr(c(1))}, by ${num(x[1])}.` },- { parts: ['Ax = (', { box: String(ax[0]) }, ', ', { box: String(ax[1]) }, ')'], why: note || `${vecStr(pr(0))} + ${vecStr(pr(1))} = ${vecStr(ax)}`, hint: 'Add the two vectors: top with top, bottom with bottom.' },+ { parts: [`${num(x[0])} · column 1 = [`, { box: String(pr(0)[0]) }, ', ', { box: String(pr(0)[1]) }, ']'], why: `${num(x[0])}·${vecStr(c(0))} = ${vecStr(pr(0))}`, hint: `Multiply both numbers of column 1, ${vecStr(c(0))}, by ${num(x[0])}.` },+ { parts: [`${num(x[1])} · column 2 = [`, { box: String(pr(1)[0]) }, ', ', { box: String(pr(1)[1]) }, ']'], why: `${num(x[1])}·${vecStr(c(1))} = ${vecStr(pr(1))}`, hint: `Multiply both numbers of column 2, ${vecStr(c(1))}, by ${num(x[1])}.` },+ { parts: ['Ax = [', { box: String(ax[0]) }, ', ', { box: String(ax[1]) }, ']'], why: note || `${vecStr(pr(0))} + ${vecStr(pr(1))} = ${vecStr(ax)}`, hint: 'Add the two vectors: top with top, bottom with bottom.' },];};const rowRows = ({ A, x }) => A.map((r, i) => ({@@ -210,29 +211,34 @@ const BEATS = [g.labels(['col 1', 'col 2']);put(g.parts.cols, { o: 0 }); show(g.parts.cols, m('c1') - .2, .4);put(g.cols[1], { o: 0 }); show(g.cols[1], m('c2'), .5);+ put(g.tipLabels[1], { o: 0 }); show(g.tipLabels[1], m('c2'), .5);// x's first number goes with column 1, its second with column 2band(p, g.lay.A[0][0] - 40, DISP[1] - 52, 80, 140, COLC[0], m('c1'), m('c2'));g.num('x0').forEach(e => flashEl(e, m('c1') + .2));band(p, g.lay.A[0][1] - 40, DISP[1] - 52, 80, 140, COLC[1], m('c2'), m('add'));g.num('x1').forEach(e => flashEl(e, m('c2') + .2));colWork(p, [1, 2], [[2, 1], [5, 3]], 70, 500, { terms: [m('c1') + 1.5, m('c2') + 1.5], prod: m('c2') + 4.5, sum: m('add') + 3 });- show(g.combo[0], m('pic') + .2, .5); show(g.combo[1], m('pic') + 1.8, .6);+ // tip to tail, one column step on each word: the columns step back so the steps read+ tw(g.parts.cols, { o: .3 }, m('pic'), .4);+ const steps = G(p, {});+ [[0, 0, 2, 1, COLC[0], .2], [2, 1, 7, 4, COLC[1], 1.4], [7, 4, 12, 7, COLC[1], 2.4]].forEach(([a, b, c, d, col, dt]) => g.P.arrow(a, b, c, d, col, m('pic') + dt, { into: steps }).setAttribute('stroke-width', 6));+ text(p, '1·col 1', g.P.PX(1) - 14, g.P.PY(.5) - 14, m('pic') + .5, { size: 24, fill: COLC[0], weight: 600, anchor: 'end' });+ text(p, '2·col 2', g.P.PX(7) - 14, g.P.PY(4) - 14, m('pic') + 1.8, { size: 24, fill: COLC[1], weight: 600, anchor: 'end' });+ g.axArrow.setAttribute('stroke-dasharray', '10 8'); g.axArrow.setAttribute('stroke-width', 3); g.axArrow.setAttribute('fill-opacity', .5);[g.axArrow, g.axDot, g.axLab].forEach(e => show(e, m('land'), .5));pulse(g.axDot, m('land') + .6);const lc = G(p, { o: 0 });M(lc, ['c·v + d·w'], { x: 90, y: 690, size: 38, anchor: 'start' });T(lc, 'chapter 6, with c = 1 and d = 2', { x: 300, y: 688, size: 28, fill: COL.dim });show(lc, m('same') + 1);- [['c', 'x0', 0], ['d', 'x1', 1]].forEach(([n, k, i]) => {- const [x, y] = xAt(g, i), t = text(p, `= ${n}`, x + 40, y, m('same') + 3 + i * 1.4, { size: 34, fill: COL.task, weight: 600 });- pulse(g.num(k)[0], m('same') + 3 + i * 1.4);- });+ text(p, 'c = 1, d = 2', g.lay.x, 425, m('same') + 3, { size: 30, fill: COL.task, weight: 600, anchor: 'middle' });+ pulse(g.num('x0')[0], m('same') + 3); pulse(g.num('x1')[0], m('same') + 4.4);}],['cols2', 'By columns, with a minus', (m) => {const p = panel(0);text(p, 'By columns: a minus sign goes backwards', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = g2Of(p, [[1, -1], [2, 1]], [2, -1], { t0: m('A') - .4 });+ const g = S.g = g2Of(p, [[1, -1], [2, 1]], [2, -1], { t0: m('A') - .4, plane: { cx: 1100, cy: 560, u: 80, x0: -2, x1: 5, y0: -2, y1: 5 } });hideX(g); hideAx(g); hideRes(g, p, m('ans'));g.labels(['col 1', 'col 2']);put(g.M, { o: 0 }); show(g.M, m('A') - .2, .4);@@ -243,8 +249,14 @@ const BEATS = [band(p, g.lay.A[0][1] - 40, DISP[1] - 52, 80, 140, COLC[1], m('c2'), m('add'));colWork(p, [2, -1], [[1, 2], [-1, 1]], 70, 500, { terms: [m('c1') + .5, m('c2') + .5], prod: m('c2') + 3.5, sum: m('add') + 2.5 });text(p, '−1 of column 2: backwards along it', 90, 650, m('c2') + 6, { size: 28, fill: COLC[1], weight: 600 });- show(g.combo[0], m('pic') + .2, .5); show(g.combo[1], m('pic') + 1.6, .6);- [g.axArrow, g.axDot, g.axLab].forEach(e => show(e, m('pic') + 2.6, .5));+ const back = G(p, {}); // −1·col 2: the violet arrow turned round, when "go backwards" is said+ const bk = g.P.arrow(0, 0, 1, -1, COLC[1], m('c2') + 6, { into: back }); bk.setAttribute('stroke-dasharray', '10 8');+ text(back, '−1·col 2', g.P.PX(1) + 14, g.P.PY(-1) + 30, m('c2') + 6.3, { size: 24, fill: COLC[1], weight: 600 });+ hide(back, m('pic'), .3);+ tw(g.parts.cols, { o: .3 }, m('pic'), .4);+ const steps = G(p, {});+ [[0, 0, 1, 2, COLC[0], .2], [1, 2, 2, 4, COLC[0], .9], [2, 4, 3, 3, COLC[1], 1.8]].forEach(([a, b, c, d, col, dt]) => g.P.arrow(a, b, c, d, col, m('pic') + dt, { into: steps }).setAttribute('stroke-width', 6));+ [g.axDot, g.axLab].forEach(e => show(e, m('pic') + 2.6, .5));// the backwards step: the violet arrow, flipped, from the tip of 2·col 1pulse(g.axDot, m('pic') + 3.2);}],@@ -274,7 +286,7 @@ const BEATS = [const r = m(`r${i + 1}`), mm = m(`m${i + 1}`), s = m(`s${i + 1}`);rowBandA(p, g, i, r, i ? m('same') : m('r2'));xBand(p, g, r + .8, i ? m('same') : m('r2'));- const w = rowWork(p, i ? [1, 3] : [2, 5], [1, 2], 70, 500 + i * 80, { from: [aAt(g, i, 0), aAt(g, i, 1)], xFrom: [xAt(g, 0), xAt(g, 1)], tm: mm - .4, ts: s, tr: s + 1.2 });+ const w = rowWork(p, i ? [1, 3] : [2, 5], [1, 2], 70, 500 + i * 80, { from: [aAt(g, i, 0), aAt(g, i, 1)], xFrom: [xAt(g, 0), xAt(g, 1)], tm: i ? r + 2 : r + 3, ts: s, tr: s + 1.2 });const res = w.row[w.row.length - 1];const fl = M(p, [String(w.r)], { x: res._px, y: 500 + i * 80, size: 40, fill: COL.task, o: 0 });show(fl, s + 1.8, .1); tw(fl, { x: rAt(g, i)[0], y: rAt(g, i)[1], s: 1.3 }, s + 1.9, .8); hide(fl, s + 2.7, .1);@@ -286,9 +298,9 @@ const BEATS = [T(dot, 'dot product', { x: 90, y: 700, size: 32, weight: 600, fill: COL.task });T(dot, 'a row times a column: multiply, then add', { x: 90, y: 745, size: 28, fill: COL.dim });show(dot, m('dot') + 1);- say(p, ['(2, 5) · (1, 2) = 12'], 90, 800, m('dot') + 5, { size: 34, fill: ROWC[0] });+ say(p, ['[2, 5] · [1, 2] = 12'], 90, 800, m('dot') + 5, { size: 34, fill: ROWC[0] });rowBandA(p, g, 0, m('dot') + 5, m('dot') + 8);- say(p, ['(1, 3) · (1, 2) = 7'], 450, 800, m('dot') + 8, { size: 34, fill: ROWC[1] });+ say(p, ['[1, 3] · [1, 2] = 7'], 450, 800, m('dot') + 8, { size: 34, fill: ROWC[1] });rowBandA(p, g, 1, m('dot') + 8, m('dot') + 11);}],@@ -365,30 +377,62 @@ const BEATS = [lineRow(0, [2, -1], 470, m('r1') + .2, '2x − y');lineRow(1, [-1, 2], 545, m('r2') + .2, '−x + 2y');// the rows: our two lines (linsys draws the equations and the row picture), then the columns- const sys = S.sys = linsys(p, { eq: [90, 660], mat: null, size: 44, sol: false, t0: m('b') + 1 });+ const sys = S.sys = linsys(p, { eq: [90, 636], mat: null, size: 44, sol: false, t0: m('A') + .5 }); // the plane from the start+ const eg = G(p, { o: 0 }); eg.append(sys.E); show(eg, m('b') + 1, .5); // the equations wait for their words (linsys shows E at t0)+ sys.lines.forEach((l, i) => { tw(l.l, { 'a_stroke-width': 9 }, m('b') + 1.4 + i * 3.4, .3); tw(l.l, { 'a_stroke-width': 5 }, m('b') + 2.8 + i * 3.4, .5); });sys.view('both', m('c') + .5, .8);sys.labels(['col 1', 'col 2', 'b']);- text(p, 'row picture', 560, 690, m('b') + 4, { size: 26, fill: ROWC[0], weight: 600 });- const cw = lineUp(p, ['x', { v: [2, -1], fill: COLC[0] }, '+ y', { v: [-1, 2], fill: COLC[1] }, '=', { v: [0, 3], fill: COL.task }], 90, 845, { size: 34, rh: 40 });+ text(p, 'row picture', 560, 670, m('b') + 4, { size: 26, fill: ROWC[0], weight: 600 });+ const cw = lineUp(p, ['x', { v: [2, -1], fill: COLC[0] }, '+ y', { v: [-1, 2], fill: COLC[1] }, '=', { v: [0, 3], fill: COL.task }], 90, 815, { size: 34, rh: 40 });cw.forEach((r, k) => show(r.e, m('c') + 1 + k * .4, .4));- text(p, 'column picture', 560, 840, m('c') + 4, { size: 26, fill: COLC[0], weight: 600 });+ text(p, 'column picture', 560, 810, m('c') + 4, { size: 26, fill: COLC[0], weight: 600 });pulse(sys.meet, m('one') + 1);- frame(p, 50, 610, 470, 160, ROWC[0], m('one') + .3, m('one') + 2.6);+ frame(p, 50, 586, 470, 160, ROWC[0], m('one') + .3, m('one') + 2.6);sys.lines.forEach(l => { tw(l.l, { 'a_stroke-width': 9 }, m('one') + .4, .3); tw(l.l, { 'a_stroke-width': 5 }, m('one') + 2, .5); });- frame(p, 70, 790, 400, 100, COLC[0], m('one') + 2.8);- sys.cols.forEach(c => { tw(c, { 'a_stroke-width': 9 }, m('one') + 3, .3); tw(c, { 'a_stroke-width': 5 }, m('one') + 4.6, .5); });+ frame(p, 70, 766, 400, 96, COLC[0], m('one') + 2.8);+ sys.cols.forEach(c => { tw(c, { 'a_stroke-width': 9 }, m('one') + 2.6, .3); tw(c, { 'a_stroke-width': 5 }, m('one') + 3.6, .4); });+ }],++ ['system2', 'Ax = b again', (m) => {+ const p = panel(0);+ text(p, 'One more: rows and columns', 60, 110, .2, { size: 40, weight: 600 });+ const A = mtx(p, [[1, 1], [1, -1]], 90, 230, { size: 50, cw: 90, rh: 68, o: 0 });+ const X = mtx(p, [['x'], ['y']], 310, 230, { size: 50, cw: 60, rh: 68, o: 0 });+ const eq = M(p, ['='], { x: 420, y: 280, size: 50, o: 0 });+ const B = mtx(p, [[5], [1]], 460, 230, { size: 50, cw: 70, rh: 68, fill: COL.task, o: 0 });+ [A.g, X.g, eq].forEach(e => show(e, m('A') + .3, .5)); show(B.g, m('A') + 4, .5);+ pulseAll(A.cells.flat(), m('A') + 1, .5);+ // by rows: each row of A with (x, y)+ [0, 1].forEach(i => band(p, 96, A.at(i, 0)[1] - 50, 196, 68, ROWC[i], m('r') + .3 + i * 3, m('r') + 3 + i * 3));+ say(p, ['row 1: x + y = 5'], 70, 470, m('r') + .6, { size: 38, fill: ROWC[0] });+ say(p, ['row 2: x − y = 1'], 70, 530, m('r') + 3.6, { size: 38, fill: ROWC[1] });+ const sys = S.sys = linsys(p, { A: [[1, 1], [1, -1]], b: [5, 1], eq: [90, 636], mat: null, size: 44, sol: false, t0: m('A') + .5 });+ const eg = G(p, { o: 0 }); eg.append(sys.E); show(eg, m('r') + 6, .5);+ pulse(sys.meet, m('lines') + .6); pulse(sys.meet, m('lines') + 1.8);+ text(p, 'they meet at (3, 2)', 560, 670, m('lines') + .6, { size: 26, fill: ROWC[0], weight: 600 });+ // by columns: 3 of column 1, 2 of column 2+ sys.view('both', m('c') + .4, .8);+ sys.labels(['col 1', 'col 2', 'b']);+ [0, 1].forEach(j => band(p, 90 + 10 + 90 * j + 6, 176, 78, 140, COLC[j], m('c') + .4 + j * 1.2, m('mix')));+ const cw = lineUp(p, ['3', { v: [1, 1], fill: COLC[0] }, '+ 2', { v: [1, -1], fill: COLC[1] }, '=', { v: [3, 3], fill: COLC[0] }, '+', { v: [2, -2], fill: COLC[1] }, '=', { v: [5, 1], fill: COL.task }], 90, 815, { size: 34, rh: 40 });+ const at = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3].map((k, i) => m(['mix', 'mix', 'mix', 'mix', 'mix', 'mix', 'mix', 'mix', 'land', 'land'][i]) + [.2, .2, 1, 1, 2.4, 2.4, 3.6, 4.2, .2, .4][i]);+ cw.forEach((r, k) => show(r.e, at[k], .4));+ tw(sys.bArrow, { 'a_stroke-width': 10 }, m('land') + .6, .3); tw(sys.bArrow, { 'a_stroke-width': 5 }, m('land') + 2, .5);+ frame(p, 50, 586, 470, 160, ROWC[0], m('same') + .3, m('same') + 3);+ frame(p, 70, 766, 760, 96, COLC[0], m('same') + 2);+ pulse(sys.meet, m('same') + 1);}],['q2', 'Your turn', () => {const p = panel(0);text(p, 'Your turn', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = g2Of(p, [[1, 1], [1, -1]], [1, 0]);+ const g = S.g = g2Of(p, [[1, 1], [1, -1]], [1, 2]);g.labels(['col 1', 'col 2']);target(g.P, [4, 2], p);}, { ask: done => quiz(LOW, [{- id: 'c-land', prompt: ['Drag the point ', $m('x'), ' (or change its numbers) until ', $m('Ax'), ' lands on ', $m('(4, 2)'), '.'],- build: g2Task(S.g, v => v.x0 + v.x1 === 4 && v.x0 - v.x1 === 2, 'x = (3, 1): 3·(1, 1) + 1·(1, −1) = (4, 2). By rows: 3 + 1 = 4 and 3 − 1 = 2.',- 'By rows: the first row says x₁ + x₂ = 4, the second x₁ − x₂ = 2. Which two numbers add to 4 and differ by 2?', () => S.g.set({ x0: 3, x1: 1 }), ['x']),+ id: 'c-land', prompt: ['Drag the point ', $m('x'), ' (or change its numbers) until ', $m('Ax'), ' lands on the target ', $m('(4, 2)'), '.'],+ build: g2Task(S.g, v => v.x0 + v.x1 === 4 && v.x0 - v.x1 === 2, 'x = [3, 1]: 3·[1, 1] + 1·[1, −1] = [4, 2]. By rows: 3 + 1 = 4 and 3 − 1 = 2.',+ 'By rows: the first number plus the second must make 4, and the first minus the second must make 2. Which two numbers add to 4 and differ by 2?', () => S.g.set({ x0: 3, x1: 1 }), ['x']),}], done) }],['bigger', 'A 3 by 3 matrix', (m) => {@@ -424,17 +468,20 @@ const BEATS = [const res = [6, 1, 11].map((v, i) => T(p, String(v), { x: 490, y: 230 + 64 * i, size: 46, fill: COL.task, font: MATH, anchor: 'middle', o: 0 }));const R = mtx(p, [[''], [''], ['']], 440, 230, { size: 46, cw: 80, rh: 64, o: 0 }); show(R.g, m('rows'));[0, 1].forEach(j => band(p, 104 + 76 * j, 186, 68, 186, COLC[j], m('A') + 2 + j * .6, m('x') + 3));+ text(p, 'by rows', 70, 430, m('rows'), { size: 28, fill: ROWC[0], weight: 600 });+ text(p, 'by columns', 830, 200, m('cols'), { size: 28, fill: COLC[0], weight: 600 });[[1, 2], [0, 1], [3, -1]].forEach((r, i) => {- const t = m('rows') + i * 2.3;- rowWork(p, r, [4, 1], 70, 480 + i * 70, { from: [A.at(i, 0), A.at(i, 1)], xFrom: [X.at(0, 0), X.at(1, 0)], tm: t, ts: t + 1.2, tr: t + 1.8, size: 36 });- show(res[i], t + 2.2, .3);+ const t = m(['rows', 'r2', 'r3'][i]) + (i ? .2 : .8), t1 = [m('r2'), m('r3'), m('cols')][i];+ band(p, 96, 230 + 64 * i - 44, 168, 60, ROWC[i], t - .2, t1);+ rowWork(p, r, [4, 1], 70, 480 + i * 70, { from: [A.at(i, 0), A.at(i, 1)], xFrom: [X.at(0, 0), X.at(1, 0)], tm: t, ts: t + 2, tr: t + 2.8, size: 36 });+ show(res[i], t + 3.2, .3);});colWork(p, [4, 1], [[1, 0, 3], [2, 1, -1]], 830, 300, { terms: [m('cols') + .3, m('cols') + 1.4], prod: m('cols') + 2.6, sum: m('cols') + 4.6 }, { size: 34 });// sizes: 2 columns ↔ 2 numbers in x; 3 rows ↔ 3 numbers in Ax- frame(p, 96, 180, 168, 190, COLC[0], m('sizes') + .3, m('sizes') + 4.5);- frame(p, 284, 214, 72, 124, COLC[0], m('sizes') + 1.2, m('sizes') + 4.5);- frame(p, 90, 180, 186, 190, ROWC[0], m('sizes') + 4.6);- frame(p, 438, 180, 102, 190, ROWC[0], m('sizes') + 5.4);+ frame(p, 92, 176, 176, 232, COLC[0], m('sizes') + .3, m('sizes') + 4.5);+ frame(p, 280, 208, 80, 136, COLC[0], m('sizes') + 1.2, m('sizes') + 4.5);+ frame(p, 84, 176, 202, 232, ROWC[0], m('sizes') + 4.6);+ frame(p, 432, 176, 114, 232, ROWC[0], m('sizes') + 5.4);const note = G(p, { o: 0 });T(note, '2 columns → x has 2 numbers', { x: 830, y: 640, size: 32, weight: 600, fill: COLC[0] });T(note, '3 rows → Ax has 3 numbers', { x: 830, y: 690, size: 32, weight: 600, fill: ROWC[0] });@@ -455,7 +502,7 @@ const BEATS = [T(pairs, s, { x: 875, y: 258 + i * 60, size: 32, fill: c, weight: 600 });});show(pairs, m('cols') + .5);- frame(p, 284, 154 + 128, 72, 64, COL.bad, m('cols') + 2);+ frame(p, 284, 314, 72, 62, COL.bad, m('cols') + 2);text(p, 'by columns', 860, 200, m('cols'), { size: 28, fill: COLC[0], weight: 600 });// by rows: row 1 has two numbers, x has threetext(p, 'by rows', 860, 470, m('rows'), { size: 28, fill: ROWC[0], weight: 600 });@@ -474,6 +521,39 @@ const BEATS = [tw(X.cells[2][0], { c_fill: COL.bad }, m('cols') + 2, .4);}],+ ['wide', 'A 2 by 3 matrix', (m) => {+ const p = panel(0);+ text(p, 'A wide matrix: three in, two out', 60, 110, .2, { size: 40, weight: 600 });+ const A = mtx(p, [[1, 2, 0], [3, -1, 1]], 90, 230, { size: 46, cw: 76, rh: 64, o: 0 });+ show(A.g, m('A') + .2, .5);+ [0, 1, 2].forEach(j => band(p, 104 + 76 * j, 186, 68, 122, COLC[j], m('A') + 2.4 + j * .5, m('x')));+ [0, 1].forEach(i => band(p, 96, 230 + 64 * i - 44, 236, 60, ROWC[i], m('A') + 1.2 + i * .5, m('A') + 2.4));+ const X = mtx(p, [[2], [1], [1]], 360, 198, { size: 46, cw: 60, rh: 64, fill: COL.chalk, o: 0 });+ show(X.g, m('x') + .3, .5); pulseAll(X.cells.flat(), m('x') + 2, .6);+ show(M(p, ['='], { x: 470, y: 278, size: 46, o: 0 }), m('r1'));+ const R = mtx(p, [[''], ['']], 510, 230, { size: 46, cw: 80, rh: 64, o: 0 }); show(R.g, m('r1'));+ const res = [4, 6].map((v, i) => T(p, String(v), { x: 560, y: 230 + 64 * i, size: 46, fill: COL.task, font: MATH, anchor: 'middle', o: 0 }));+ text(p, 'by rows', 70, 430, m('r1'), { size: 28, fill: ROWC[0], weight: 600 });+ [[1, 2, 0], [3, -1, 1]].forEach((r, i) => {+ const t = m(`r${i + 1}`);+ band(p, 96, 230 + 64 * i - 44, 236, 60, ROWC[i], t, i ? m('ans') : m('r2'));+ rowWork(p, r, [2, 1, 1], 70, 490 + i * 72, { from: [0, 1, 2].map(j => A.at(i, j)), xFrom: [0, 1, 2].map(j => X.at(j, 0)), tm: t + .4, ts: t + 4.6, tr: t + 6, size: 36 });+ show(res[i], t + 6.6, .4);+ });+ pulseAll(res, m('ans') + .4, .6);+ text(p, 'by columns', 830, 200, m('c'), { size: 28, fill: COLC[0], weight: 600 });+ [0, 1, 2].forEach(j => band(p, 104 + 76 * j, 186, 68, 122, COLC[j], m('c') + .4 + j * .9, m('rule')));+ colWork(p, [2, 1, 1], [[1, 3], [2, -1], [0, 1]], 830, 300, { terms: [m('c') + .4, m('c') + 1.3, m('c') + 2.2], prod: m('sum') + .3, sum: m('sum') + 4 }, { size: 34, wrap: true });+ // three columns ↔ three numbers in x; two rows ↔ two numbers in Ax+ frame(p, 92, 176, 256, 142, COLC[0], m('rule') + .2, m('rule') + 1.6);+ frame(p, 352, 144, 96, 206, COLC[0], m('rule') + .4, m('rule') + 1.6);+ const note = G(p, { o: 0 });+ T(note, '3 columns → x has 3 numbers', { x: 830, y: 660, size: 30, weight: 600, fill: COLC[0] });+ T(note, '2 rows → Ax has 2 numbers', { x: 830, y: 705, size: 30, weight: 600, fill: ROWC[0] });+ show(note, m('rule') + .4);+ frame(p, 502, 176, 116, 142, ROWC[0], m('rule') + 1.2);+ }],+['q3', 'Quick check', () => {const p = panel(0);text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });@@ -499,7 +579,7 @@ const BEATS = [['wrap', 'Summary', (m) => {const p = panel(0);- [['By columns: Ax = x₁·(column 1) + x₂·(column 2) + …', 'w1'], ['By rows: each number of Ax is a row of A times x (a dot product).', 'w2'],+ [['By columns: Ax = (first number of x)·column 1 + (second)·column 2 + …', 'w1'], ['By rows: each number of Ax is a row of A times x (a dot product).', 'w2'],['Both ways use the same products, so they always agree.', 'w3'], ['x: one number per column of A. Ax: one number per row.', 'w4']].forEach(([str, mark], i) => {const g = G(p, { x: -16, y: 160 + i * 105, o: 0 });mk('circle', { cx: 150, cy: -12, r: 26, fill: COL.task }, g);@@ -515,7 +595,7 @@ const BEATS = [[A.g, X.g, R.g, e].forEach(x => show(x, m('w1') + .5));[0, 1].forEach(j => band(p, 300 + 10 + 66 * j + 3, 616, 60, 112, COLC[j], m('w1') + 1.5 + j * .7, m('w2')));[0, 1].forEach(i => band(p, 306, 660 + 56 * i - 38, 136, 52, ROWC[i], m('w2') + .6 + i * .7, m('w3')));- say(p, ['1·(2, 1) + 2·(5, 3) = (12, 7)'], 800, 680, m('w1') + 2.5, { size: 34, fill: COLC[0] });+ say(p, ['1·[2, 1] + 2·[5, 3] = [12, 7]'], 800, 680, m('w1') + 2.5, { size: 34, fill: COLC[0] });say(p, ['2·1 + 5·2 = 12, 1·1 + 3·2 = 7'], 800, 740, m('w2') + 1.5, { size: 34, fill: ROWC[0] });frame(p, 780, 630, 560, 140, COL.task, m('w3') + .5, m('w4'));[0, 1].forEach(j => band(p, 300 + 10 + 66 * j + 3, 616, 60, 112, COLC[j], m('w4') + .5, m('w4') + 2.5)); band(p, 462, 616, 72, 112, COLC[0], m('w4') + 1, m('w4') + 2.5, .15);@@ -548,17 +628,17 @@ const BEATS = [const from = (A, x, tgt, f) => (body, api) => { S.g.set({ a00: A[0][0], a01: A[0][1], a10: A[1][0], a11: A[1][1], x0: x[0], x1: x[1] }); S.tg.replaceChildren(); target(S.g.P, tgt, S.tg, 0); put(S.tg.lastChild, { o: 1 }); return f(body, api); };const at = (v, [a, b]) => { const [p, q] = [v.a00 * v.x0 + v.a01 * v.x1, v.a10 * v.x0 + v.a11 * v.x1]; return p === a && q === b; };quiz(LOW, [{- id: 'p-land1', prompt: ['Move ', $m('x'), ' until ', $m('Ax'), ' lands on ', $m('(5, 3)'), '.'],- build: from([[2, 1], [1, 1]], [0, 0], [5, 3], g2Task(S.g, v => at(v, [5, 3]), 'x = (2, 1): 2·(2, 1) + 1·(1, 1) = (5, 3).',- 'Rows: 2x₁ + x₂ = 5 and x₁ + x₂ = 3. Subtract: x₁ = 2.', () => S.g.set({ x0: 2, x1: 1 }), ['x'])),+ id: 'p-land1', prompt: ['Move ', $m('x'), ' until ', $m('Ax'), ' lands on the target ', $m('(5, 3)'), '.'],+ build: from([[2, 1], [1, 1]], [0, 0], [5, 3], g2Task(S.g, v => at(v, [5, 3]), 'x = [2, 1]: 2·[2, 1] + 1·[1, 1] = [5, 3].',+ 'By rows: 2·(first) + (second) = 5 and (first) + (second) = 3. The difference is the first number: 2.', () => S.g.set({ x0: 2, x1: 1 }), ['x'])),}, {- id: 'p-land2', prompt: ['Now ', $m('x = (1, 1)'), ' stays. Change ', $m('A'), ' (drag a column, or its numbers) so that ', $m('Ax = (3, 1)'), '.'],- build: from([[1, 0], [0, 1]], [1, 1], [3, 1], g2Task(S.g, v => at(v, [3, 1]), 'x = (1, 1) means one of each column: column 1 + column 2 = (3, 1). Many matrices do it, for example columns (2, 0) and (1, 1).',- 'With x = (1, 1), Ax is column 1 + column 2. Make the two columns add up to (3, 1).', () => S.g.set({ a00: 2, a01: 1, a10: 0, a11: 1 }), ['A', 'cols'])),+ id: 'p-land2', prompt: ['Now ', $m('x = [1, 1]'), ' stays. Change ', $m('A'), ' (drag a column, or its numbers) so that ', $m('Ax = [3, 1]'), '.'],+ build: from([[1, 0], [0, 1]], [1, 1], [3, 1], g2Task(S.g, v => at(v, [3, 1]), 'x = [1, 1] means one of each column: column 1 + column 2 = [3, 1]. Many matrices do it, for example columns [2, 0] and [1, 1].',+ 'With x = [1, 1], Ax is column 1 + column 2. Make the two columns add up to [3, 1].', () => S.g.set({ a00: 2, a01: 1, a10: 0, a11: 1 }), ['A', 'cols'])),}, {- id: 'p-land3', prompt: ['Now ', $m('x = (0, 2)'), '. Change ', $m('A'), ' so that ', $m('Ax = (−2, 4)'), '.'],- build: from([[1, 0], [0, 1]], [0, 2], [-2, 4], g2Task(S.g, v => at(v, [-2, 4]), 'x = (0, 2) takes no column 1 and two of column 2: column 2 must be (−1, 2). Column 1 can be anything.',- 'x = (0, 2) means 0 of column 1 plus 2 of column 2. So 2 · column 2 = (−2, 4).', () => S.g.set({ a01: -1, a11: 2 }), ['A', 'cols'])),+ id: 'p-land3', prompt: ['Now ', $m('x = [0, 2]'), '. Change ', $m('A'), ' so that ', $m('Ax = [−2, 4]'), '.'],+ build: from([[1, 0], [0, 1]], [0, 2], [-2, 4], g2Task(S.g, v => at(v, [-2, 4]), 'x = [0, 2] takes none of column 1 and two of column 2: column 2 must be [−1, 2]. Column 1 can be anything.',+ 'x = [0, 2] means 0 of column 1 plus 2 of column 2. So 2 · column 2 = [−2, 4].', () => S.g.set({ a01: -1, a11: 2 }), ['A', 'cols'])),}], done, 'Chapter practice · set 4 of 4');} }],['play', 'Playground', (m, D) => {@@ -566,7 +646,7 @@ const BEATS = [text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });S.sys = g2Of(p, [[2, 1], [1, 3]], [1, 1]);S.sys.labels(['col 1', 'col 2']);- const hint = text(p, 'try: x = (1, 0) gives column 1 · x = (0, 1) gives column 2 · a negative number in x', 1160, 860, m('go'), { size: 24, fill: COL.dim, anchor: 'middle' });+ const hint = text(p, 'try: x = [1, 0] · x = [0, 1] · a minus number in x', 90, 830, m('go'), { size: 24, fill: COL.dim });hide(hint, Math.min(m('go') + 9, D - .7), .6);}, { ask: playAsk(() => S.sys, { tip: 'A times x, live. Change A or x, drag the point x or a column tip, or draw on the board. Nothing is marked.' }) }],['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],diff --git a/site/linear-algebra/ch10/audio/en/count.mp3 b/site/linear-algebra/ch10/audio/en/count.mp3index bd6ce0d..d248fa4 100644Binary files a/site/linear-algebra/ch10/audio/en/count.mp3 and b/site/linear-algebra/ch10/audio/en/count.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/flip.mp3 b/site/linear-algebra/ch10/audio/en/flip.mp3index a71037f..485eb35 100644Binary files a/site/linear-algebra/ch10/audio/en/flip.mp3 and b/site/linear-algebra/ch10/audio/en/flip.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/readit.mp3 b/site/linear-algebra/ch10/audio/en/readit.mp3new file mode 100644index 0000000..1172f0dBinary files /dev/null and b/site/linear-algebra/ch10/audio/en/readit.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/shear.mp3 b/site/linear-algebra/ch10/audio/en/shear.mp3index 0c3304c..c5079a1 100644Binary files a/site/linear-algebra/ch10/audio/en/shear.mp3 and b/site/linear-algebra/ch10/audio/en/shear.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/squash.mp3 b/site/linear-algebra/ch10/audio/en/squash.mp3index 8e1f1fd..03624a8 100644Binary files a/site/linear-algebra/ch10/audio/en/squash.mp3 and b/site/linear-algebra/ch10/audio/en/squash.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/stretch.mp3 b/site/linear-algebra/ch10/audio/en/stretch.mp3index 7deb425..a2dddbc 100644Binary files a/site/linear-algebra/ch10/audio/en/stretch.mp3 and b/site/linear-algebra/ch10/audio/en/stretch.mp3 differdiff --git a/site/linear-algebra/ch10/audio/en/timings.js b/site/linear-algebra/ch10/audio/en/timings.jsindex 1d4177e..603078f 100644--- a/site/linear-algebra/ch10/audio/en/timings.js+++ b/site/linear-algebra/ch10/audio/en/timings.js@@ -195,19 +195,19 @@ window.TIMINGS = {]},"count": {- "dur": 45.696,+ "dur": 46.704,"marks": {- "q": 1.146,- "s1": 2.656,- "s2": 7.083,- "land": 11.172,- "grid": 17.148,- "rows": 22.539,- "q2": 29.297,- "t1": 31.615,- "t2": 35.951,- "land2": 39.336,- "back": 41.602+ "q": 1.159,+ "s1": 2.852,+ "s2": 8.151,+ "land": 11.602,+ "grid": 17.357,+ "rows": 22.93,+ "q2": 30.013,+ "t1": 32.318,+ "t2": 36.628,+ "land2": 40.078,+ "back": 42.565},"cues": [[@@ -215,47 +215,47 @@ window.TIMINGS = {"Let's use it."],[- 1.146,- "Where does two, one go?"+ 1.159,+ "Where does three, one go?"],[- 2.656,- "Two steps of column one: two times two, one is four, two."+ 2.852,+ "Three steps of column one: three times two, one is six, three."],[- 7.083,- "Then one step of column two: plus minus one, one."+ 8.151,+ "Then one step of column two: minus one, one."],[- 11.172,- "Four minus one is three, two plus one is three: it lands on three, three."+ 11.602,+ "Six minus one is five, three plus one is four: it lands on five, four."],[- 17.148,- "On the moved grid, you can count it: two green steps, then one violet step."+ 17.357,+ "On the moved grid, you can count it: three green steps, then one violet step."],[- 22.539,- "Check by rows: two times two, minus one, is three, and two plus one is three."+ 22.93,+ "Check by rows: two times three, minus one, is five, and three plus one is four."],[- 29.297,+ 30.013,"One more: minus one, two."],[- 31.615,+ 32.318,"Minus one step of column one is minus two, minus one."],[- 35.951,+ 36.628,"Two steps of column two is minus two, two."],[- 39.336,+ 40.078,"Together: minus four, one."],[- 41.602,+ 42.565,"One green step backwards, two violet steps forwards."]]@@ -323,13 +323,13 @@ window.TIMINGS = {]},"stretch": {- "dur": 28.752,+ "dur": 30.984,"marks": {- "A": 2.63,- "c": 5.247,- "see": 14.479,- "flag": 19.609,- "both": 22.747+ "A": 2.721,+ "c": 7.8,+ "see": 17.227,+ "flag": 22.161,+ "both": 25.208},"cues": [[@@ -337,138 +337,255 @@ window.TIMINGS = {"Now some matrices with a clear meaning."],[- 2.63,- "Two, zero, zero, one."+ 2.721,+ "A is two, zero in the first row, and zero, one in the second."],[- 5.247,+ 7.8,"Column one is two, zero: one, zero goes twice as far."],[- 10.911,+ 13.164,"Column two is zero, one: it stays."],[- 14.479,+ 17.227,"So the plane is stretched sideways to twice its width, and heights don't change."],[- 19.609,+ 22.161,"Watch the little flag: it gets twice as wide."],[- 22.747,+ 25.208,"Two, zero, zero, two stretches both ways: everything twice as big."]]},"flip": {- "dur": 16.296,+ "dur": 37.104,"marks": {- "A": 0.091,- "c": 3.073,- "see": 8.763,- "flag": 13.255+ "A": 0.104,+ "c": 4.857,+ "see": 10.234,+ "flag": 15.013,+ "flip2": 17.956,+ "see2": 29.766},"cues": [[- 0.091,- "Minus one, zero, zero, one."+ 0.104,+ "Minus one, zero in the first row, zero, one in the second."],[- 3.073,+ 4.857,"Column one is minus one, zero: one, zero lands on the other side."],[- 8.763,+ 10.234,"Every point goes to its mirror image across the up and down axis."],[- 13.255,+ 15.013,"The flag now points left."],[- 15.234,+ 16.914,"This is a flip."+ ],+ [+ 17.956,+ "Now one, zero in the first row, and zero, minus one in the second."+ ],+ [+ 23.438,+ "One, zero stays where it is, and zero, one goes down to zero, minus one."+ ],+ [+ 29.766,+ "This time the plane flips upside down, across the left and right axis, and the flag hangs below the line."]]},"shear": {- "dur": 17.664,+ "dur": 35.88,"marks": {- "A": 0.117,- "c": 1.953,- "see": 7.018,- "flag": 14.805+ "A": 0.104,+ "c": 4.219,+ "see": 9.414,+ "flag": 16.745,+ "up": 19.479,+ "see2": 30.247},"cues": [[- 0.117,- "One, one, zero, one."+ 0.104,+ "One, one in the first row, zero, one in the second."],[- 1.953,+ 4.219,"Column one stays at one, zero."],[- 4.401,+ 6.693,"Column two leans over, to one, one."],[- 7.018,+ 9.414,"The bottom line stays put, and every line above it slides sideways: the higher it is, the further it slides."],[- 14.805,+ 16.745,"The flag leans."],[- 16.302,+ 18.164,"This is called a shear."+ ],+ [+ 19.479,+ "Now swap the roles: one, zero in the first row, one, one in the second."+ ],+ [+ 25.417,+ "Zero, one stays put, and one, zero tips up to one, one."+ ],+ [+ 30.247,+ "Every upright line slides up: the further right it is, the higher it goes."]]},"turn": {- "dur": 30.456,+ "dur": 48.36,"marks": {- "A": 0.091,- "c": 2.513,- "see": 10.573,- "flag": 16.562,- "half": 21.875+ "A": 0.078,+ "c": 5.039,+ "see": 12.982,+ "flag": 19.115,+ "half": 24.518,+ "cw": 33.255,+ "cwm": 42.175},"cues": [[- 0.091,- "Zero, minus one, one, zero."+ 0.078,+ "Zero, minus one in the first row, one, zero in the second."],[- 2.513,+ 5.039,"One, zero lands on zero, one: straight up."],[- 5.938,+ 8.438,"And zero, one lands on minus one, zero: to the left."],[- 10.573,+ 12.982,"Both arrows have turned a quarter turn, counterclockwise, and the whole plane turns with them."],[- 16.562,+ 19.115,"The flag stands up."],[- 18.021,+ 20.677,"Nothing is stretched, nothing is flipped: it's a turn."],[- 21.875,+ 24.518,"Turn twice, and you get minus one, zero, zero, minus one: a half turn."],[- 28.62,+ 31.198,"The flag hangs upside down."+ ],+ [+ 33.255,+ "And to turn the other way, clockwise: one, zero goes down to zero, minus one, and zero, one goes right, to one, zero."+ ],+ [+ 42.175,+ "So the matrix is zero, one in the first row, and minus one, zero in the second."+ ]+ ]+ },+ "readit": {+ "dur": 53.4,+ "marks": {+ "hide": 1.536,+ "c1": 5.104,+ "c2": 12.643,+ "show": 18.138,+ "check": 23.607,+ "on": 34.466,+ "two": 36.914,+ "show2": 43.516+ },+ "cues": [+ [+ 0.091,+ "Now the other way round."+ ],+ [+ 1.536,+ "Here the plane has been moved, and the matrix is hidden."+ ],+ [+ 5.104,+ "Where did one, zero land?"+ ],+ [+ 7.331,+ "Follow the green arrow to its tip: one, minus one."+ ],+ [+ 11.367,+ "That's column one."+ ],+ [+ 12.643,+ "Where did zero, one land?"+ ],+ [+ 14.544,+ "The violet tip is at two, one."+ ],+ [+ 16.81,+ "That's column two."+ ],+ [+ 18.138,+ "So A is one, two in the first row, and minus one, one in the second."+ ],+ [+ 23.607,+ "Check one point."+ ],+ [+ 24.714,+ "One, one lands on column one plus column two: one plus two is three, and minus one plus one is zero."+ ],+ [+ 33.06,+ "Three, zero."+ ],+ [+ 34.466,+ "And on the moved grid, it does."+ ],+ [+ 36.914,+ "One more."+ ],+ [+ 37.826,+ "The green tip is at zero, two, and the violet tip at minus two, zero."+ ],+ [+ 43.516,+ "So A is zero, minus two in the first row, and two, zero in the second: a quarter turn that also makes everything twice as big."]]},@@ -487,14 +604,15 @@ window.TIMINGS = {]},"squash": {- "dur": 44.712,+ "dur": 54.552,"marks": {- "A": 1.862,- "c": 3.737,- "see": 12.161,- "lost": 16.888,- "miss": 25.234,- "zero": 37.878+ "A": 2.161,+ "c": 5.755,+ "see": 14.297,+ "lost": 18.932,+ "lost2": 27.344,+ "miss": 35.443,+ "zero": 48.151},"cues": [[@@ -502,51 +620,55 @@ window.TIMINGS = {"One more, and it's strange."],[- 1.862,- "One, two, two, four."+ 2.161,+ "One, two in the first row, two, four in the second."],[- 3.737,+ 5.755,"Column one is one, two."],[- 5.534,+ 7.578,"Column two is two, four: exactly twice column one."],[- 10.104,+ 12.279,"Both columns point the same way."],[- 12.161,+ 14.297,"So the whole plane gets squashed onto one line, the line through one, two."],[- 16.888,+ 18.932,"Many points land on the same point."],[- 19.232,+ 21.12,"Two, minus one goes to two minus two, and four minus four: zero, zero."],[- 25.234,+ 27.344,+ "So do minus two, one and four, minus two: the whole line through two, minus one falls onto the origin."+ ],+ [+ 35.443,"And a point off that line, like one, zero, can never be reached."],[- 29.883,+ 39.883,"Can A x equal b for every b?"],[- 33.372,+ 43.425,"For this matrix, no."],[- 34.935,+ 45.039,"That's the big question of chapter fourteen."],[- 37.878,+ 48.151,"And the matrix of all zeros squashes everything into one single point: the origin."]]@@ -626,6 +748,11 @@ window.TIMINGS = {"w2": 5.677,"w3": 11.315,"w4": 20.951,+ "k2": 21.562,+ "k3": 22.201,+ "k4": 22.956,+ "k5": 23.633,+ "sol": 26.536,"end": 30.69},"cues": [diff --git a/site/linear-algebra/ch10/audio/en/turn.mp3 b/site/linear-algebra/ch10/audio/en/turn.mp3index 835a3f5..5a9c0c3 100644Binary files a/site/linear-algebra/ch10/audio/en/turn.mp3 and b/site/linear-algebra/ch10/audio/en/turn.mp3 differdiff --git a/site/linear-algebra/ch10/index.html b/site/linear-algebra/ch10/index.htmlindex 37d994c..df9a4cd 100644--- a/site/linear-algebra/ch10/index.html+++ b/site/linear-algebra/ch10/index.html@@ -15,7 +15,7 @@<script src="audio/en/timings.js"></script><script>'use strict';-const CHAPTER = { number: 10, title: 'A Matrix Moves the Whole Plane', minutes: 9, language: 'en' };+const CHAPTER = { number: 10, title: 'A Matrix Moves the Whole Plane', minutes: 10, language: 'en' };/* ---------- layout and colours ---------- */const DISP = [90, 230]; // the matrix in brackets, top left@@ -24,6 +24,7 @@ const LEFT = { x: 40, y: 420, w: 720, cls: 'side' }; // question card uconst TOPL = { x: 40, y: 190, w: 720, cls: 'side' }; // question card at the top left (matrix hidden)const A1 = [[2, -1], [1, 1]]; // the chapter's first matrixconst I2 = [[1, 0], [0, 1]];+const ZOOM = { u: 68, x0: -5, x1: 5, y0: -5, y1: 5 }; // a closer plane for the named moves: the square and flag read/* ---------- chapter drawing helpers ---------- */const say = (p, parts, x, y, t0, { size = 40, fill = COL.chalk, anchor = 'start' } = {}) => { const e = M(p, [].concat(parts), { x, y, size, fill, anchor, o: 0 }); show(e, t0); return e; };@@ -114,15 +115,16 @@ const BEATS = [[0, 1].forEach(i => put(g.res(i), { o: 0 }));put(g.parts.cols, { o: 0 });put(g.parts.x, { o: 0 }); show(g.parts.x, m('x'), .4);+ ['x0', 'x1'].forEach(k => g.num(k).forEach(e => { put(e, { o: 0 }); show(e, m('x') + .2, .4); })); // x's numbers come with "take the point"// by rows, then the answer appears in the brackets and in the plane[0, 1].forEach(i => band(p, DISP[0] + 6, g.lay.A[1][i] - 48, 192, 64, ROWC[i], m('rows') + i * 2.4, m('land')));- say(p, ['2·1 − 1 = 1, 1 + 1 = 2'], 90, 480, m('rows') + .4, { size: 36 });+ say(p, ['2·1 − 1 = 1,'], 90, 480, m('rows') + .4, { size: 36 }); say(p, ['1 + 1 = 2'], 300, 480, m('rows') + 2.4, { size: 36 });[0, 1].forEach(i => { tw(g.res(i), { o: 1 }, m('land'), .4); tw(g.res(i), { o: 0 }, m('x2'), .3); tw(g.res(i), { o: 1 }, m('land2'), .4); });- [g.axDot, g.axLab].forEach(e => { show(e, m('land') + .2, .4); hide(e, m('x2'), .3); show(e, m('land2') + .2, .4); });- show(g.axArrow, m('land') + .2, .4); hide(g.axArrow, m('many'), .3); hide(g.axDot, m('many'), .3); hide(g.axLab, m('many'), .3); hide(g.parts.x, m('many'), .3);- const trail = G(p, {});- const tr = (from, to, t) => g.P.arrow(...from, ...to, COL.dim, t, { into: trail });- tr([1, 1], [1, 2], m('land'));+ [g.axDot, g.axLab, g.axArrow].forEach(e => { show(e, m('land') + .2, .4); hide(e, m('x2'), .3); show(e, m('land2') + .2, .4); });+ hide(g.axArrow, m('many'), .3); hide(g.axDot, m('many'), .3); hide(g.axLab, m('many'), .3); hide(g.parts.x, m('many'), .3);+ const trail = G(p, {}), trail1 = G(trail, {});+ const tr = (from, to, t, into = trail) => g.P.arrow(...from, ...to, COL.dim, t, { into });+ tr([1, 1], [1, 2], m('land'), trail1); hide(trail1, m('x2'), .3);g.to({ x0: 2, x1: 0 }, m('x2'), .9);say(p, ['2·2 − 0 = 4, 2 + 0 = 2'], 90, 540, m('x2') + 1.6, { size: 36 });tr([2, 0], [4, 2], m('land2'));@@ -132,7 +134,15 @@ const BEATS = [const pts = [];for (let x = -2; x <= 2; x++) for (let y = -2; y <= 2; y++) pts.push([x, y]);// they appear where they are, then all slide together on "Watch"- pts.forEach((q, i) => { const special = (q[0] === 1 && q[1] === 1) || (q[0] === 2 && q[1] === 0); carry(g, q, dots, m('many') + .3 + i * .08, { color: special ? COL.task : COL.chalk, dur: 2.4, r: special ? 10 : 7, move: m('go') + .2 }); });+ const ghosts = G(p, { o: 0 }); // where the dots were: faint rings left behind+ pts.forEach((q, i) => {+ const special = (q[0] === 1 && q[1] === 1) || (q[0] === 2 && q[1] === 0);+ mk('circle', { cx: g.P.PX(q[0]), cy: g.P.PY(q[1]), r: 6, fill: 'none', stroke: COL.chalk, 'stroke-opacity': .45, 'stroke-width': 2 }, ghosts);+ const d = carry(g, q, dots, m('many') + .3 + i * .08, { color: special ? COL.task : COL.chalk, dur: 2.4, r: special ? 10 : 7, move: m('go') + .2 });+ if (special) pulse(d, m('check') + (q[0] === 1 ? .3 : 2.2), 1.5);+ });+ show(ghosts, m('go') + .2, .4);+ text(p, 'rings: where the dots started', 90, 760, m('go') + 1.4, { size: 26, fill: COL.dim });text(p, '(1, 1) → (1, 2)', 90, 640, m('check') + .3, { size: 32, fill: COL.task, weight: 600 });text(p, '(2, 0) → (4, 2)', 90, 690, m('check') + 2.2, { size: 32, fill: COL.task, weight: 600 });}],@@ -140,12 +150,12 @@ const BEATS = [['grid', 'The grid moves', (m) => {const p = panel(0);text(p, 'The whole grid moves', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2, { units: false });+ const g = S.g = planeOf(p, I2, { units: false, shape: false });put(g.M, { o: 0 }); show(g.M, m('go') + 3, .5);g.to(keysOf(A1), m('go') + .3, 2.6);// one line of the grid, and its neighbour: still straight, still parallel, evenly spacedconst L = G(g.P.g, {});- [1, 2, 3].forEach((k, i) => { const l = g.P.line(...mul(A1, [0, k]), ...mul(A1, [1, k]), COL.task, (i ? m('par') : m('straight')) + .3 + Math.max(0, i - 1) * .6, { into: L }); hide(l, m('faint'), .4); });+ [1, 2, 3].forEach((k, i) => { const l = g.P.line(...mul(A1, [0, k]), ...mul(A1, [1, k]), COL.chalk, (i ? m('par') : m('straight')) + .3 + Math.max(0, i - 1) * .6, { into: L }); hide(l, m('faint'), .4); });const gp = g.P.g.querySelector('path'); tw(gp, { 'a_stroke-opacity': .45 }, m('faint') + .3, .4); tw(gp, { 'a_stroke-opacity': .1 }, m('faint') + 2.6, .6);text(p, 'straight lines stay straight', 90, 480, m('straight') + .4, { size: 30, weight: 600, fill: COL.task });text(p, 'parallel lines stay parallel,', 90, 530, m('par') + .4, { size: 30, weight: 600, fill: COL.task });@@ -161,23 +171,27 @@ const BEATS = [const g = S.g = planeOf(p, A1, { shape: false });g.labels(['col 1', 'col 2']);put(g.parts.cols, { o: 0 });- carry(g, [1, 0], p, m('e1'), { color: COL.irr, dur: 1.4, r: 10 });- say(p, ['A·(1, 0) = (2, 1)'], 90, 480, m('e1') + 1.6, { size: 36, fill: COLC[0] });+ // (1, 0) by rows, row 1 then row 2 while they are said; it lands as "it lands on two, one" is said+ [0, 1].forEach(i => band(p, DISP[0] + 6, g.lay.A[1][i] - 48, 192, 64, ROWC[i], m('e1') + 2 + i * 1.6, m('e1') + 5.6));+ carry(g, [1, 0], p, m('e1'), { color: COL.irr, dur: 1.4, r: 10, move: m('e1') + 4.4 });+ say(p, ['A·(1, 0) = (2, 1)'], 90, 480, m('e1') + 5.6, { size: 36, fill: COLC[0] });show(g.parts.cols, m('c1'), .4); put(g.cols[1], { o: 0 });colFrame(p, g, 0, m('c1'), m('why'));- carry(g, [0, 1], p, m('e2'), { color: COL.real, dur: 1.4, r: 10 });+ put(g.tipLabels[1], { o: 0 }); show(g.tipLabels[1], m('e2') + 1.8, .4); // "col 2" comes with its arrow+ carry(g, [0, 1], p, m('e2'), { color: COL.real, dur: 1.4, r: 10, move: m('e2') + .9 });say(p, ['A·(0, 1) = (−1, 1)'], 90, 535, m('e2') + 1.6, { size: 36, fill: COLC[1] });show(g.cols[1], m('e2') + 1.8, .4);colFrame(p, g, 1, m('e2') + 1.8, m('why'));say(p, ['(1, 0) → 1·col 1 + 0·col 2'], 90, 610, m('why') + 2.5, { size: 32 });say(p, ['(x, y) → x·col 1 + y·col 2'], 90, 680, m('all') + 4, { size: 36, fill: COL.task });const st1 = G(p, {});- [[0, 0, 1, 0], [1, 0, 2, 0], [2, 0, 2, 1]].forEach(([a, b, c, d], i) => g.P.arrow(a, b, c, d, COL.chalk, m('all') + 1 + i * .6, { into: st1 }));+ [[0, 0, 1, 0], [1, 0, 2, 0], [2, 0, 2, 1]].forEach(([a, b, c, d], i) => g.P.arrow(a, b, c, d, COL.chalk, m('all') + 1 + i * .6, { into: st1 }).setAttribute('stroke-width', 6));+ tw(g.parts.square, { o: .25 }, m('all') + .6, .4); tw(g.parts.square, { o: 1 }, m('read'), .4); // the slanted box steps back while the steps are walkedthick(g.cols[0], m('why') + 4.5);hide(st1, m('grid') - .3, .3);// the moved grid is steps of the two columns: walk a few of themconst steps = G(p, {});- [[0, 0, 2, 1, COLC[0]], [2, 1, 4, 2, COLC[0]], [4, 2, 3, 3, COLC[1]], [3, 3, 2, 4, COLC[1]]].forEach(([a, b, c, d, col], i) => g.P.arrow(a, b, c, d, col, m('grid') + .4 + i * .7, { into: steps }));+ [[0, 0, 2, 1, COLC[0]], [2, 1, 4, 2, COLC[0]], [4, 2, 3, 3, COLC[1]]].forEach(([a, b, c, d, col], i) => g.P.arrow(a, b, c, d, col, m('grid') + .4 + i * .7, { into: steps }));hide(steps, m('read') - .2, .4);thick(g.cols[0], m('read') + 1.8); colFrame(p, g, 0, m('read') + 1.8, m('read') + 4);thick(g.cols[1], m('read') + 4.2); colFrame(p, g, 1, m('read') + 4.2);@@ -191,17 +205,17 @@ const BEATS = [const g = S.g = planeOf(p, A1, { shape: false });g.labels(['col 1', 'col 2']);const P2 = g.P, w1 = G(p, {}), w2 = G(p, {});- ring(P2, [2, 1], COL.chalk, w1, m('q'), '');- say(w1, ['(2, 1):'], 90, 480, m('q') + .2, { size: 36 });- const cs = [P2.arrow(0, 0, 2, 1, COLC[0], m('s1') + .2, { into: w1 }), P2.arrow(2, 1, 4, 2, COLC[0], m('s1') + .9, { into: w1 })];- say(w1, ['2·(2, 1) = (4, 2)'], 220, 480, m('s1') + .4, { size: 36, fill: COLC[0] });- cs.push(P2.arrow(4, 2, 3, 3, COLC[1], m('s2') + .3, { into: w1 }));+ ring(P2, [3, 1], COL.chalk, w1, m('q'), '(3, 1)', { dx: 16, dy: 34 });+ say(w1, ['(3, 1):'], 90, 480, m('q') + .2, { size: 36 });+ const cs = [P2.arrow(0, 0, 2, 1, COLC[0], m('s1') + .2, { into: w1 }), P2.arrow(2, 1, 4, 2, COLC[0], m('s1') + .9, { into: w1 }), P2.arrow(4, 2, 6, 3, COLC[0], m('s1') + 1.6, { into: w1 })];+ say(w1, ['3·(2, 1) = (6, 3)'], 220, 480, m('s1') + .4, { size: 36, fill: COLC[0] });+ cs.push(P2.arrow(6, 3, 5, 4, COLC[1], m('s2') + .3, { into: w1 }));cs.forEach((a, i) => thick(a, m('grid') + 2.4 + i * 1.1, 4));say(w1, ['+ 1·(−1, 1)'], 220, 535, m('s2') + .4, { size: 36, fill: COLC[1] });- pulse(P2.dot(3, 3, COL.task, m('land') + .3, { label: '(3, 3)', into: w1 }), m('land') + 3);- say(w1, ['= (3, 3)'], 220, 590, m('land') + .5, { size: 36, fill: COL.task });- carry(g, [2, 1], w1, m('grid') + .2, { color: COL.task, dur: 1.6, r: 9 });- say(w1, ['rows: 4 − 1 = 3, 2 + 1 = 3 ✓'], 90, 650, m('rows') + .4, { size: 32 });+ pulse(P2.dot(5, 4, COL.chalk, m('land') + .3, { label: '(5, 4)', dx: -14, anchor: 'end', into: w1 }), m('land') + 3);+ say(w1, ['= (5, 4)'], 220, 590, m('land') + .5, { size: 36 });+ carry(g, [3, 1], w1, m('grid') + .2, { color: COL.chalk, dur: 1.6, r: 9 });+ say(w1, ['rows: 6 − 1 = 5, 3 + 1 = 4 ✓'], 90, 650, m('rows') + .4, { size: 32 });hide(w1, m('q2') - .3, .4);ring(P2, [-1, 2], COL.chalk, w2, m('q2'), '');say(w2, ['(−1, 2):'], 90, 480, m('q2') + .2, { size: 36 });@@ -247,70 +261,144 @@ const BEATS = [ring(g.P, [-2, 1], COLC[1], p, undefined, 'column 2 here', { dx: -20, anchor: 'end' });}, { ask: done => quiz(LEFT, [{id: 'c-cols', prompt: ['Drag the green tip onto ', $m('(1, 2)'), ' and the violet tip onto ', $m('(−2, 1)'), '. What does the matrix say?'],- build: g2Task(S.g, v => v.a00 === 1 && v.a10 === 2 && v.a01 === -2 && v.a11 === 1, 'A = [1 −2; 2 1]: column 1 is (1, 2), column 2 is (−2, 1). The plane turns and grows.',+ build: g2Task(S.g, v => v.a00 === 1 && v.a10 === 2 && v.a01 === -2 && v.a11 === 1, 'Column 1 is (1, 2) and column 2 is (−2, 1), so A has rows 1, −2 and 2, 1. The plane turns and grows.','Column 1 is where (1, 0) lands: its tip goes on (1, 2). Column 2 goes on (−2, 1). You can also type the numbers into the matrix.', () => S.g.set({ a00: 1, a10: 2, a01: -2, a11: 1 }), ['A', 'cols']),}], done) }],['stretch', 'Stretch', (m) => {const p = panel(0);text(p, 'Stretch', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2);+ const g = S.g = planeOf(p, I2, { plane: ZOOM });g.labels(['col 1', 'col 2']);- g.to({ a00: 2 }, m('A') + .3, 1.6);+ g.to({ a00: 2 }, m('A') + .3, 1.6); // the number changes as it is read, and the plane with itcolFrame(p, g, 0, m('c'), m('c') + 4); thick(g.cols[0], m('c') + .3);colFrame(p, g, 1, m('c') + 4, m('see')); thick(g.cols[1], m('c') + 4.3);+ g.to({ a00: 1 }, m('see'), .7); g.to({ a00: 2 }, m('see') + 1, 2); // once more, slowly, as it is describedtext(p, 'twice as wide, same height', 90, 480, m('see') + .4, { size: 30, weight: 600, fill: COL.task });- pulse(g.parts.shape.firstChild, m('flag') + .3, 1.08);- tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .55 }, m('flag') + 2, .5);+ tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .45 }, m('flag') + 3.4, .5);+ g.to({ a00: 1 }, m('flag') + .2, .6); g.to({ a00: 2 }, m('flag') + 1, 1.6); // the flag widens while it is watchedg.to({ a11: 2 }, m('both') + 1, 1.4);- text(p, 'two, zero, zero, two: twice as big', 90, 540, m('both') + 1.4, { size: 30, weight: 600, fill: COL.task });+ text(p, '2, 0 and 0, 2: twice as big', 90, 540, m('both') + 1.4, { size: 30, weight: 600, fill: COL.task });}],['flip', 'Flip', (m) => {const p = panel(0);text(p, 'Flip', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2);+ const g = S.g = planeOf(p, I2, { plane: ZOOM });g.labels(['col 1', 'col 2']);g.to({ a00: -1 }, m('A') + .4, 2);colFrame(p, g, 0, m('c'), m('see')); thick(g.cols[0], m('c') + .3);- text(p, 'a mirror image across the y-axis', 90, 480, m('see') + .4, { size: 30, weight: 600, fill: COL.task });- const mir = path(p, `M${g.P.PX(0)} ${g.P.PY(6.4)}V${g.P.PY(-6.4)}`, { stroke: COL.task, 'stroke-width': 3, 'stroke-dasharray': '8 8' }, { o: 0 });- show(mir, m('see') + .3, .4);- tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .55 }, m('flag') + 2, .5);- text(p, 'the flag points left', 90, 540, m('flag') + .4, { size: 30, fill: COL.task });+ const mir = path(p, `M${g.P.PX(0)} ${g.P.PY(5.4)}V${g.P.PY(-5.4)}`, { stroke: COL.chalk, 'stroke-width': 3, 'stroke-dasharray': '8 8' }, { o: 0 });+ show(mir, m('see') + .2, .4); hide(mir, m('flip2'), .3);+ g.to({ a00: 1 }, m('see') + .3, .8); g.to({ a00: -1 }, m('see') + 1.4, 2.2); // over the mirror line, slowly, as it is said+ const cap1 = [text(p, 'a mirror image across the y-axis', 90, 480, m('see') + .4, { size: 30, weight: 600, fill: COL.task })];+ tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .45 }, m('flag') + 2, .5);+ cap1.push(text(p, 'the flag points left', 90, 540, m('flag') + .4, { size: 30, fill: COL.task }));+ cap1.forEach(e => hide(e, m('flip2'), .3));+ // the second flip: upside down (back through the plain plane, not through the zero matrix)+ g.to({ a00: 1 }, m('flip2') + .2, .9);+ g.to({ a11: -1 }, m('flip2') + 2, 2);+ colFrame(p, g, 1, m('flip2') + 4.5, m('see2')); thick(g.cols[1], m('flip2') + 4.8);+ const mir2 = path(p, `M${g.P.PX(-5.4)} ${g.P.PY(0)}H${g.P.PX(5.4)}`, { stroke: COL.chalk, 'stroke-width': 3, 'stroke-dasharray': '8 8' }, { o: 0 });+ show(mir2, m('see2') + .2, .4);+ g.to({ a11: 1 }, m('see2') + .3, .8); g.to({ a11: -1 }, m('see2') + 1.4, 2.2);+ text(p, 'upside down: a mirror across the x-axis', 90, 480, m('see2') + .4, { size: 30, weight: 600, fill: COL.task });}],['shear', 'Shear', (m) => {const p = panel(0);text(p, 'Shear', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2);+ const g = S.g = planeOf(p, I2, { plane: ZOOM });g.labels(['col 1', 'col 2']);g.to({ a01: 1 }, m('A') + .4, 2);colFrame(p, g, 1, m('c') + 1.6, m('see')); thick(g.cols[1], m('c') + 1.9);- const { PX, PY } = g.P;+ g.to({ a01: 0 }, m('see'), .7); g.to({ a01: 1 }, m('see') + 1, 2.2);// the bottom line stays, higher lines slide further: arrows show how farconst sl = G(p, {});- [1, 2, 3].forEach((k, i) => { g.P.arrow(-3, k, -3 + k, k, COL.task, m('see') + 2 + i * .6, { into: sl }); });- text(p, 'higher lines slide further', 90, 480, m('see') + 1, { size: 30, weight: 600, fill: COL.task });- tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .55 }, m('flag') + 2, .5);+ [1, 2, 3].forEach((k, i) => { g.P.arrow(-4, k, -4 + k, k, COL.chalk, m('see') + 2.4 + i * .6, { into: sl }); });+ hide(sl, m('up'), .3);+ hide(text(p, 'higher lines slide further', 90, 480, m('see') + 1, { size: 30, weight: 600, fill: COL.task }), m('up'), .3);+ tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .45 }, m('flag') + 2, .5);+ // the other shear: upright lines slide up+ g.to({ a01: 0 }, m('up') + .2, .9);+ g.to({ a10: 1 }, m('up') + 2.2, 2);+ colFrame(p, g, 0, m('up') + 5, m('see2')); thick(g.cols[0], m('up') + 5.3);+ g.to({ a10: 0 }, m('see2'), .7); g.to({ a10: 1 }, m('see2') + 1, 2.2);+ const su = G(p, {});+ [1, 2, 3].forEach((k, i) => { g.P.arrow(k, -4, k, -4 + k, COL.chalk, m('see2') + 2.4 + i * .6, { into: su }); });+ text(p, 'further right, further up', 90, 480, m('see2') + 1, { size: 30, weight: 600, fill: COL.task });}],['turn', 'Turn', (m) => {const p = panel(0);text(p, 'Turn', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2);+ const g = S.g = planeOf(p, I2, { plane: ZOOM });g.labels(['col 1', 'col 2']);g.turn(0, 90, m('A') + .3, 2.2);colFrame(p, g, 0, m('c'), m('c') + 4); thick(g.cols[0], m('c') + .3);colFrame(p, g, 1, m('c') + 4, m('see')); thick(g.cols[1], m('c') + 4.3);text(p, 'a quarter turn, counterclockwise', 90, 480, m('see') + .4, { size: 30, weight: 600, fill: COL.task });- const { PX, PY } = g.P;- const arc = path(p, `M${PX(2.5)} ${PY(0)}A${2.5 * g.P.u} ${2.5 * g.P.u} 0 0 0 ${PX(0)} ${PY(2.5)}`, { stroke: COL.task, 'stroke-width': 3, fill: 'none' }, { d: 0 });- tw(arc, { d: 1 }, m('see') + 1, 1);+ const { PX, PY } = g.P, R = 3.4 * g.P.u;+ // the arc grows with the turn, and its head shows which way+ const arc = G(p, { o: 0 });+ const ap = path(arc, `M${PX(3.4)} ${PY(0)}A${R} ${R} 0 0 0 ${PX(0)} ${PY(3.4)}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' }, { d: 0 });+ path(arc, `M${PX(0) + 14} ${PY(3.4) - 9}L${PX(0)} ${PY(3.4)}L${PX(0) + 14} ${PY(3.4) + 9}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' });+ g.turn(90, 0, m('see'), .7); g.turn(0, 90, m('see') + 1, 2.2);+ show(arc, m('see') + 1, .2); tw(ap, { d: 1 }, m('see') + 1, 2.2, io);hide(arc, m('half'), .3);- tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .55 }, m('flag') + 2, .5);+ tw(g.parts.shape.firstChild, { 'a_fill-opacity': .9 }, m('flag'), .3); tw(g.parts.shape.firstChild, { 'a_fill-opacity': .45 }, m('flag') + 2, .5);g.turn(90, 180, m('half') + 1.5, 2.2);- text(p, 'minus one, zero, zero, minus one: a half turn', 90, 540, m('half') + 2, { size: 28, weight: 600, fill: COL.task });+ text(p, 'half turn: rows −1, 0 and 0, −1', 90, 540, m('half') + 2, { size: 28, weight: 600, fill: COL.task });+ // the other way: a quarter turn clockwise+ g.turn(180, 360, m('cw') + .2, .8); // on round to the start (never backwards through the quarter turn)+ g.turn(0, -90, m('cw') + 2, 2.4);+ colFrame(p, g, 0, m('cw') + 2.8, m('cwm')); colFrame(p, g, 1, m('cw') + 4.6, m('cwm'));+ const arc2 = G(p, { o: 0 });+ const ap2 = path(arc2, `M${PX(3.4)} ${PY(0)}A${R} ${R} 0 0 1 ${PX(0)} ${PY(-3.4)}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' }, { d: 0 });+ path(arc2, `M${PX(0) + 14} ${PY(-3.4) - 9}L${PX(0)} ${PY(-3.4)}L${PX(0) + 14} ${PY(-3.4) + 9}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' });+ show(arc2, m('cw') + 2, .2); tw(ap2, { d: 1 }, m('cw') + 2, 2.4, io);+ ['a00', 'a01', 'a10', 'a11'].forEach((k, i) => flash(g, k, m('cwm') + .4 + i * .5));+ text(p, 'clockwise: rows 0, 1 and −1, 0', 90, 600, m('cwm') + .4, { size: 28, weight: 600, fill: COL.task });+ }],++ ['readit', 'Read the matrix off', (m) => {+ const p = panel(0);+ text(p, 'Read the matrix off the picture', 60, 110, .2, { size: 40, weight: 600 });+ const g = S.g = planeOf(p, [[1, 2], [-1, 1]], { shape: false, showMat: false });+ g.labels(['col 1', 'col 2']);+ const q = G(p, { o: 0 }); show(q, .4, .4); // the hidden matrix: brackets with "?"+ [[0, 0], [0, 1], [1, 0], [1, 1]].forEach(([i, j]) => T(q, '?', { x: g.lay.A[0][j], y: g.lay.A[1][i], size: 54, fill: COL.dim, font: MATH, anchor: 'middle' }));+ const bx = mk('path', { d: `M104 ${DISP[1] - 51}H90V${DISP[1] + 92}H104M${90 + 54 * 3.4 + 6} ${DISP[1] - 51}H${90 + 54 * 3.4 + 20}V${DISP[1] + 92}H${90 + 54 * 3.4 + 6}`, stroke: COL.chalk, 'stroke-width': 3, fill: 'none' }, q);+ hide(q, m('show'), .3);+ const { PX, PY } = g.P;+ const first = G(p, {}); // the first picture's notes, gone when the second picture comes+ ring(g.P, [1, -1], COLC[0], first, m('c1') + 2, '', {}); thick(g.cols[0], m('c1') + 1.4);+ say(first, ['column 1 = (1, −1)'], 90, 480, m('c1') + 4, { size: 34, fill: COLC[0] });+ ring(g.P, [2, 1], COLC[1], first, m('c2') + 2, '', {}); thick(g.cols[1], m('c2') + 1.4);+ say(first, ['column 2 = (2, 1)'], 90, 535, m('c2') + 3.4, { size: 34, fill: COLC[1] });+ hide(first, m('two') - .5, .4);+ show(g.M, m('show') + .2, .5);+ ['a00', 'a01'].forEach((k, i) => flash(g, k, m('show') + .8 + i * .5)); ['a10', 'a11'].forEach((k, i) => flash(g, k, m('show') + 2.8 + i * .5)); // read as rows, as it is said+ // the check: (1, 1) is one step of each column+ const ck = G(p, {});+ ring(g.P, [1, 1], COL.chalk, ck, m('check') + 1.2, '(1, 1)', { dx: -20, dy: -16, anchor: 'end' });+ g.P.arrow(0, 0, 1, -1, COLC[0], m('check') + 3, { into: ck }); g.P.arrow(1, -1, 3, 0, COLC[1], m('check') + 4.3, { into: ck });+ say(ck, ['(1, 1) → (1, −1) + (2, 1)'], 90, 600, m('check') + 3, { size: 32 });+ ['a00', 'a01'].forEach(k => flash(g, k, m('check') + 5.4)); say(ck, ['1 + 2 = 3'], 90, 655, m('check') + 5.4, { size: 32 });+ ['a10', 'a11'].forEach(k => flash(g, k, m('check') + 7.4)); say(ck, ['−1 + 1 = 0'], 290, 655, m('check') + 7.4, { size: 32 });+ say(ck, ['= (3, 0)'], 470, 600, m('check') + 9.5, { size: 32, fill: COL.chalk });+ carry(g, [1, 1], ck, m('on') - .2, { dur: 1.4, r: 9, move: m('on') + .3 });+ hide(ck, m('two') - .2, .4);+ // a second picture: a turn that also doubles+ g.to({ a00: 0, a01: -2, a10: 2, a11: 0 }, m('two') - .4, 1.8);+ tw(g.M, { o: 0 }, m('two') - .5, .3);+ const q2 = G(p, { o: 0 }); [[0, 0], [0, 1], [1, 0], [1, 1]].forEach(([i, j]) => T(q2, '?', { x: g.lay.A[0][j], y: g.lay.A[1][i], size: 54, fill: COL.dim, font: MATH, anchor: 'middle' }));+ q2.append(bx.cloneNode());+ show(q2, m('two') - .2, .3); hide(q2, m('show2'), .3); tw(g.M, { o: 1 }, m('show2') + .2, .5);+ thick(g.cols[0], m('two') + 1.6); thick(g.cols[1], m('two') + 3.4);+ say(p, ['column 1 = (0, 2), column 2 = (−2, 0)'], 90, 480, m('two') + 2, { size: 32 });+ text(p, 'a quarter turn, twice as big', 90, 540, m('show2') + 4.6, { size: 30, weight: 600, fill: COL.task });+ g.to({ a00: 1, a01: 0, a10: 0, a11: 1 }, m('show2') + 4.4, .6); g.to({ a00: 0, a01: -2, a10: 2, a11: 0 }, m('show2') + 5.2, 2.4); // once more from the plain plane: it turns and grows}],['q2', 'Quick check', () => {@@ -322,41 +410,60 @@ const BEATS = [id: 'c-read', prompt: ['Which matrix moved the plane like this? Read the columns off the picture.'],build: blanks([{ parts: ['column 1 = (', { box: '2' }, ', ', { box: '-1' }, ')'], why: 'The green arrow: where (1, 0) lands.', hint: 'Column 1 is the green arrow. Where is its tip?' },- { parts: ['column 2 = (', { box: '1' }, ', ', { box: '1' }, ')'], why: 'The violet arrow: where (0, 1) lands. So A = [2 1; −1 1].', hint: 'Column 2 is the violet arrow. Where is its tip?', fx: () => fx(S.g.M, { o: 1 }, 0, .5) },+ { parts: ['column 2 = (', { box: '1' }, ', ', { box: '1' }, ')'], why: 'The violet arrow: where (0, 1) lands. So A has rows 2, 1 and −1, 1.', hint: 'Column 2 is the violet arrow. Where is its tip?', fx: () => fx(S.g.M, { o: 1 }, 0, .5) },]),}], done) }],['squash', 'Squash', (m) => {const p = panel(0);text(p, 'Squash: the plane falls onto a line', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, I2);+ const g = S.g = planeOf(p, I2, { plane: { u: 46, x0: -7, x1: 7, y0: -7, y1: 7 } });g.labels(['col 1', 'col 2']);g.to({ a01: 2, a10: 2, a11: 4 }, m('A') + .4, 2.6);+ // at "squashed onto one line": back to the plain plane, dots on it, and all of it falls onto the line together+ g.to({ a01: 0, a10: 0, a11: 1 }, m('see') - .2, .6);+ const dots = G(p, { o: 0 }), { PX: QX, PY: QY } = g.P;+ for (let a = -2; a <= 2; a++) for (let b = -2; b <= 2; b++) {+ if (Math.abs(a + 2 * b) > 3) continue; // only the dots that land inside the picture+ const d = G(dots, { x: QX(a), y: QY(b) }); mk('circle', { r: 6, fill: COL.chalk, stroke: COL.board, 'stroke-width': 2 }, d);+ tw(d, { x: QX(a + 2 * b), y: QY(2 * a + 4 * b) }, m('see') + 1.2, 2.4);+ }+ show(dots, m('see') + .4, .3); hide(dots, m('lost'), .4);+ g.to({ a01: 2, a10: 2, a11: 4 }, m('see') + 1.2, 2.4);+ const ln = path(p, `M${QX(-3.5)} ${QY(-7)}L${QX(3.5)} ${QY(7)}`, { stroke: COL.chalk, 'stroke-width': 2, 'stroke-dasharray': '6 8' }, { o: 0 });+ show(ln, m('see') + 3.8, .4);+ text(p, 'the line through (1, 2)', 90, 580, m('see') + 4, { size: 26, fill: COL.dim });colFrame(p, g, 0, m('c'), m('c') + 3.5); colFrame(p, g, 1, m('c') + 3.5, m('see'));text(p, 'column 2 = 2 × column 1', 90, 480, m('c') + 4.5, { size: 30, weight: 600, fill: COLC[1] });- text(p, 'everything lands on one line', 90, 530, m('see') + .4, { size: 30, weight: 600, fill: COL.task });+ text(p, 'everything lands on one line', 90, 530, m('see') + 1, { size: 30, weight: 600, fill: COL.task });const { PX, PY } = g.P;const d = G(p, { x: PX(2), y: PY(-1), o: 0 });mk('circle', { r: 9, fill: COL.task, stroke: COL.board, 'stroke-width': 2 }, d);const dl = T(d, '(2, −1)', { x: 14, y: 24, size: 22, fill: COL.task, font: MATH });- show(d, m('lost') + 1.5, .3); hide(dl, m('lost') + 3, .3); tw(d, { x: PX(0), y: PY(0) }, m('lost') + 3, 1.4);- say(p, ['(2, −1) → (2 − 2, 4 − 4) = (0, 0)'], 90, 590, m('lost') + 3, { size: 30 });+ show(d, m('lost') + 2.2, .3); hide(dl, m('lost') + 5.6, .3); tw(d, { x: PX(0), y: PY(0) }, m('lost') + 5.6, 1.2);+ say(p, ['(2, −1) → (2 − 2, 4 − 4) = (0, 0)'], 90, 620, m('lost') + 3.2, { size: 30 });+ [[-2, 1], [4, -2]].forEach(([a, b], i) => {+ const e = G(p, { x: QX(a), y: QY(b), o: 0 }); mk('circle', { r: 9, fill: COL.task, stroke: COL.board, 'stroke-width': 2 }, e);+ show(e, m('lost2') + .3 + i * .5, .3); tw(e, { x: QX(0), y: QY(0) }, m('lost2') + 2, 1.4);+ });ring(g.P, [1, 0], COL.bad, p, m('miss') + .5, '(1, 0): never reached');- text(p, 'Ax = (1, 0): no solution', 90, 650, m('miss') + 4, { size: 30, weight: 600, fill: COL.bad });+ text(p, 'Ax = (1, 0): no solution', 90, 680, m('miss') + 4, { size: 30, weight: 600, fill: COL.bad });thick(g.cols[0], m('miss') + 6); thick(g.cols[1], m('miss') + 6.6);- text(p, 'every b? chapter 14', 90, 700, m('miss') + 8.5, { size: 28, fill: COL.dim });+ text(p, 'every b? chapter 14', 90, 725, m('miss') + 8.5, { size: 28, fill: COL.dim });g.to({ a00: 0, a01: 0, a10: 0, a11: 0 }, m('zero') + 1, 1.8);hide(g.parts.cols, m('zero') + 2.4, .4);- text(p, 'all zeros: one single point', 90, 760, m('zero') + 1.4, { size: 30, weight: 600, fill: COL.task });+ text(p, 'all zeros: one single point', 90, 790, m('zero') + 1.4, { size: 30, weight: 600, fill: COL.task });}],['solve', 'Solving Ax = b', (m) => {const p = panel(0);text(p, 'Solving Ax = b: which point lands on b?', 60, 110, .2, { size: 40, weight: 600 });- const g = S.g = planeOf(p, [[2, -1], [-1, 2]], { x: [0, 0], shape: false, units: false, t0: m('A') - .4 });+ const g = S.g = planeOf(p, [[2, -1], [-1, 2]], { x: [0, 0], shape: false, units: false, t0: .3 });g.labels(['col 1', 'col 2']);g.combo.forEach(e => put(e, { o: 0 }));- ring(g.P, [0, 3], COL.task, p, m('A') + 6.5, 'b = (0, 3)', { dx: 22, dy: 32 });+ put(g.xLab, { o: 0 }); // x is in the brackets; its label would sit on the other labels+ ring(g.P, [0, 3], COL.task, p, m('A') + 6.5, 'b = (0, 3)', { dx: -22, dy: -14, anchor: 'end' });+ say(p, ['want: Ax = b = (0, 3)'], 90, 420, m('A') + 6.5, { size: 32, fill: COL.task });['a00', 'a01', 'a10', 'a11'].forEach((k, i) => flash(g, k, m('A') + 1.6 + i * 1.1));pulse(g.axDot, m('q') + .3); pulse(g.xRing, m('q') + 1.2);g.to({ x0: 2, x1: 1 }, m('try') + .3, 1.4);@@ -368,7 +475,9 @@ const BEATS = [show(g.combo[0], m('found') + 2, .4); show(g.combo[1], m('found') + 2.6, .4);text(p, 'the solution from chapter 2', 90, 600, m('same') + .5, { size: 28, fill: COL.dim });thick(g.combo[0], m('same') + 2.5, 4); thick(g.combo[1], m('same') + 3.6, 4); pulse(g.xRing, m('same') + 5);- ring(g.P, [3, 0], COL.task, p, m('other') + .4, 'b = (3, 0)');+ ring(g.P, [3, 0], COL.task, p, m('other') + .4, 'b = (3, 0)', { dx: -18, dy: -18, anchor: 'end' });+ g.to({ x0: 2, x1: 1 }, m('other') + 1.4, 1.4); // and (2, 1) lands in the new ring+ show(g.combo[0], m('other') + 1.4, .3); show(g.combo[1], m('other') + 1.4, .3);text(p, 'b = (3, 0) → x = (2, 1)', 90, 660, m('other') + 1.2, { size: 30, fill: COL.task, weight: 600 });}],@@ -400,11 +509,16 @@ const BEATS = [k.to(keysOf(A1), m('w1') + 1, 2);k.to({ a00: 3, a10: 0 }, m('w3') + 3.6, 1.2); k.to(keysOf(A1), m('w3') + 6.4, 1.2);thick(k.cols[0], m('w3') + .4); thick(k.cols[1], m('w3') + 1.6);- k.to(keysOf([[2, 0], [0, 1]]), m('w4'), 1);- k.to(keysOf([[-1, 0], [0, 1]]), m('w4') + 1.6, 1);- k.to(keysOf([[1, 1], [0, 1]]), m('w4') + 3.2, 1);- k.turn(0, 90, m('w4') + 4.8, 1.2);- k.to(keysOf([[1, 2], [2, 4]]), m('w4') + 6.4, 1.2);+ k.to(keysOf([[2, 0], [0, 1]]), m('w4'), .8);+ k.to(keysOf([[1, 0], [0, 1]]), m('k2') - .1, .3); k.to(keysOf([[-1, 0], [0, 1]]), m('k2') + .2, .7);+ k.to(keysOf([[1, 0], [0, 1]]), m('k3') - .1, .3); k.to(keysOf([[1, 1], [0, 1]]), m('k3') + .2, .7);+ k.to(keysOf([[1, 0], [0, 1]]), m('k4') - .1, .3); k.turn(0, 90, m('k4') + .2, .8);+ k.to(keysOf([[1, 2], [2, 4]]), m('k5'), 1);+ const cap = G(sm, {});+ [['stretch', 'w4'], ['flip', 'k2'], ['shear', 'k3'], ['turn', 'k4'], ['squash', 'k5']].forEach(([w, mk_], i, arr) => {+ const c = text(cap, w, 1390, 708, m(mk_), { size: 30, weight: 600, fill: COL.chalk });+ hide(c, i < arr.length - 1 ? m(arr[i + 1][1]) - .1 : m('sol'), .2);+ });k.to(keysOf(A1), m('end') - 1, 1.2);}],['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, LANDQ.map((q, k) => ({diff --git a/site/linear-algebra/lib/grid2.js b/site/linear-algebra/lib/grid2.jsindex 0afa6c5..7e21fa7 100644--- a/site/linear-algebra/lib/grid2.js+++ b/site/linear-algebra/lib/grid2.js@@ -6,10 +6,11 @@// Loads after engine.js and math.js (it uses plane()).const G2_COLS = [COL.irr, COL.real], G2_AX = COL.task;// A small flag: a pole and a pennant pointing right, so a flip or a turn shows at once.-const G2_FLAG = [[.3, .25], [.45, .25], [.45, 1.05], [1.2, 1.3], [.45, 1.55], [.45, 1.75], [.3, 1.75]];+// It stands beside the unit square (x 1.4 … 2.3), not on it, so the square and the flag never hide each other.+const G2_FLAG = [[1.4, .25], [1.55, .25], [1.55, 1.05], [2.3, 1.3], [1.55, 1.55], [1.55, 1.75], [1.4, 1.75]];function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54, plane: po = {}, grid = true, square = true, shape = false,- units = true, pts = [], t0 = .1, hidePlane = false, result = true, showMat = true } = {}) {+ units = true, pts = [], t0 = .1, hidePlane = false, result = true, showMat = true, brackets = false } = {}) {const v = { a00: A[0][0], a01: A[0][1], a10: A[1][0], a11: A[1][1], x0: x ? x[0] : 0, x1: x ? x[1] : 0 };const RANGE = { a00: 9, a01: 9, a10: 9, a11: 9, x0: 9, x1: 9 }, K = 14; // grid lines k = −K … Kconst holder = G(p, { o: hidePlane ? 0 : 1 });@@ -31,7 +32,7 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,const t = T(g, '', { x, y, size, fill, font: MATH, anchor: 'middle' });t.style.pointerEvents = 'none';bx.setAttribute('aria-label', key);- const s = { key, t, box: bx, set: () => setText(t, fmt(v[key])) };+ const s = { key, t, box: bx, set: () => { const str = fmt(v[key]); setText(t, str); const fs = String(str.length > 2 ? Math.round(size * .74) : size); if (t.getAttribute('font-size') !== fs) t.setAttribute('font-size', fs); } };let drag = null;bx.addEventListener('pointerdown', e => { if (!live || !s.on) return; e.preventDefault(); drag = { x: e.clientX, from: Math.round(v[key]) }; bx.setPointerCapture(e.pointerId); });bx.addEventListener('pointermove', e => { if (!drag) return; const k = svg.getScreenCTM().a; edit({ [key]: clamp(key, drag.from + Math.round((e.clientX - drag.x) / k / 22)) }); });@@ -88,7 +89,7 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,const sq = path(sqG, '', { fill: COL.chalk, 'fill-opacity': .12, stroke: COL.chalk, 'stroke-opacity': .7, 'stroke-width': 2.5 });const sh = path(shG, '', { fill: COL.chalk, 'fill-opacity': .45, stroke: COL.chalk, 'stroke-width': 2, 'stroke-linejoin': 'round' });path(unG, `M${PX(0)} ${PY(0)}H${PX(1)}M${PX(0)} ${PY(0)}V${PY(1)}`, { stroke: COL.chalk, 'stroke-opacity': .45, 'stroke-width': 3, 'stroke-dasharray': '5 6' });- [[.5, 0, '[1, 0]', 0, -12, 'middle'], [0, .5, '[0, 1]', -10, 7, 'end']].forEach(([a, b, s, dx, dy, anchor]) => T(unG, s, { x: PX(a) + dx, y: PY(b) + dy, size: 20, fill: COL.dim, font: MATH, anchor })); // beside the dashed arrows, clear of the axis numbers+ [[.5, 0, '(1, 0)', 0, -12, 'middle'], [0, .5, '(0, 1)', -10, 7, 'end']].forEach(([a, b, s, dx, dy, anchor]) => T(unG, s, { x: PX(a) + dx, y: PY(b) + dy, size: 20, fill: COL.dim, font: MATH, anchor })); // beside the dashed arrows, clear of the axis numbersconst arrowD = (a, c, hl0 = 18) => {const A1 = [PX(a[0]), PY(a[1])], C = [PX(c[0]), PY(c[1])], L = Math.hypot(C[0] - A1[0], C[1] - A1[1]);if (L < 1) return '';@@ -107,7 +108,7 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,const xRing = G(xG, {});mk('circle', { r: 22, fill: 'transparent' }, xRing);mk('circle', { r: 9, fill: COL.board, stroke: COL.chalk, 'stroke-width': 3 }, xRing);- const xLab = T(xG, '', { size: 24, fill: COL.chalk, font: MATH, anchor: 'end' });+ const xLab = T(xG, '', { size: 24, fill: COL.chalk, font: MATH, anchor: 'start' });const axDot = G(xG, {});mk('circle', { r: 10, fill: G2_AX, stroke: COL.board, 'stroke-width': 3 }, axDot);const axLab = T(xG, '', { size: 26, fill: G2_AX, font: MATH, weight: 600 });@@ -161,6 +162,47 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,}return 'M' + pts.map(XY).join('L') + 'Z';};+ // The labels beside the tips (col 1, col 2, Ax, x) go where they cover least: each tries eight places around its+ // point and takes the one over the fewest arrow and axis pixels and clear of the labels already placed, preferring+ // the side the arrow points to. A function of the state alone, so seeking and playing give the same frame.+ const unitBoxes = units ? [[PX(.5) - 28, PY(0) - 30, 56, 22], [PX(0) - 64, PY(.5) - 10, 56, 22]] : [];+ const tickBoxes = po.labels === false ? [] : [[PX(P2.x0) - 10, P2.cy + 8, PX(P2.x1) - PX(P2.x0) + 20, 22], [P2.cx - 36, PY(P2.y1) - 10, 30, PY(P2.y0) - PY(P2.y1) + 20]];+ const widthOf = (e, n, size) => { let w = 0; try { w = e.getBBox().width; } catch (_) {} return w || n * size * .55; };+ function placeLabels(c0, c1, ax) {+ const pts = [], seg = (a, b, wt = 1) => {+ const A1 = [PX(a[0]), PY(a[1])], B = [PX(b[0]), PY(b[1])], n = Math.max(1, Math.ceil(Math.hypot(B[0] - A1[0], B[1] - A1[1]) / 10));+ for (let i = 0; i <= n; i++) pts.push([A1[0] + (B[0] - A1[0]) * i / n, A1[1] + (B[1] - A1[1]) * i / n, wt]);+ };+ seg([P2.x0, 0], [P2.x1, 0], .5); seg([0, P2.y0], [0, P2.y1], .5);+ seg([0, 0], c0); seg([0, 0], c1);+ if (x) { const m1 = [v.x0 * c0[0], v.x0 * c0[1]]; seg([0, 0], m1); seg(m1, ax); seg([0, 0], ax); }+ if (shape) { const F = G2_FLAG.map(map); F.forEach((q, i) => seg(q, F[(i + 1) % F.length], 1.5)); seg(F[1], F[3], 1.5); seg(F[0], F[5], 1.5); } // the flag, outline and body+ // the dots and handles themselves weigh most+ for (const q of x ? [c0, c1, ax, [v.x0, v.x1]] : [c0, c1]) for (const [ox, oy] of [[0, 0], [-12, 0], [12, 0], [0, -12], [0, 12]]) pts.push([PX(q[0]) + ox, PY(q[1]) + oy, 4]);+ const placed = [...unitBoxes.map(b => [...b, 120]), ...tickBoxes.map(b => [...b, 120])];+ const over = (a, b) => Math.max(0, Math.min(a[0] + a[2], b[0] + b[2]) - Math.max(a[0], b[0])) * Math.max(0, Math.min(a[1] + a[3], b[1] + b[3]) - Math.max(a[1], b[1]));+ const place = (e, tip, dir, w, hh, baseline) => {+ const [X, Y] = [PX(tip[0]), PY(tip[1])], gp = 14, n = Math.hypot(...dir) || 1, d = [dir[0] / n, -dir[1] / n];+ const near = [[gp, -hh - 4], [gp, 6], [-w - gp, -hh - 4], [-w - gp, 6], [-w / 2, -hh - gp - 4], [-w / 2, gp + 6], [gp + 6, -hh / 2], [-w - gp - 6, -hh / 2]];+ const cands = [...near.map(c => [...c, 0]), ...near.map(([dx, dy]) => [dx + (dx > 0 ? 26 : dx < -w / 2 ? -26 : 0), dy + (dy > 0 ? 22 : -22), 1.5])]; // a farther ring, a little dearer+ let best = null;+ for (const [dx, dy, extra] of cands) {+ const b = [X + dx, Y + dy, w, hh], cx = dx + w / 2, cy = dy + hh / 2, cn = Math.hypot(cx, cy) || 1;+ let cost = extra + (1 - (cx * d[0] + cy * d[1]) / cn) * .6; // 0 straight ahead of the arrow … 1.2 behind it+ for (const [px, py, wt] of pts) if (px > b[0] - 3 && px < b[0] + w + 3 && py > b[1] - 3 && py < b[1] + hh + 3) cost += wt;+ for (const q of placed) cost += over(b, q) / (w * hh) * (q[4] || 200);+ if (b[0] < 10 || b[0] + w > 1590 || b[1] < 10 || b[1] + hh > 890) cost += 100;+ if (!best || cost < best[0] - 1e-9) best = [cost, b];+ }+ placed.push(best[1]);+ put(e, { x: best[1][0], y: best[1][1] + baseline });+ };+ [c0, c1].forEach((c, j) => { const L = tipLabels[j]; if (L.firstChild) place(L, c, c, widthOf(L, 5, 28), 32, 23); });+ if (x) {+ place(axLab, ax, ax, widthOf(axLab, axLab.textContent.length, 26), 30, 22);+ place(xLab, [v.x0, v.x1], [v.x0, v.x1], widthOf(xLab, xLab.textContent.length, 24), 28, 21);+ }+ }function draw() {slots.forEach(s => s.set());const c0 = [v.a00, v.a10], c1 = [v.a01, v.a11], ax = map([v.x0, v.x1]);@@ -185,8 +227,6 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,[c0, c1].forEach((c, j) => {setD(cols[j], arrowD([0, 0], c));put(tips[j], { x: PX(c[0]), y: PY(c[1]) });- const n = Math.hypot(...c) || 1;- put(tipLabels[j], { x: PX(c[0]) + c[0] / n * 30, y: PY(c[1]) - c[1] / n * 30 + 10 });});if (x) {const m1 = [v.x0 * c0[0], v.x0 * c0[1]];@@ -194,15 +234,12 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,setD(combo[1], arrowD(m1, ax, 14));setD(axArrow, arrowD([0, 0], ax));put(xRing, { x: PX(v.x0), y: PY(v.x1) });- put(xLab, { x: PX(v.x0) - 14, y: PY(v.x1) + 30 });- setText(xLab, `x = (${fmt(v.x0)}, ${fmt(v.x1)})`);+ const br = brackets ? ['[', ']'] : ['(', ')']; // brackets: x and Ax read as vectors, else as points+ setText(xLab, `x = ${br[0]}${fmt(v.x0)}, ${fmt(v.x1)}${br[1]}`);put(axDot, { x: PX(ax[0]), y: PY(ax[1]) });- const n = Math.hypot(...ax) || 1;- let lx = PX(ax[0]) + ax[0] / n * 26 + (ax[0] < 0 ? -150 : 8);- if (lx + 170 > 1590) lx = PX(ax[0]) - 180; // near the right edge: put the label on the left- put(axLab, { x: lx, y: PY(ax[1]) - ax[1] / n * 26 + (ax[1] < 0 ? 24 : -8) });- setText(axLab, `Ax = (${fmt(ax[0])}, ${fmt(ax[1])})`);+ setText(axLab, `Ax = ${br[0]}${fmt(ax[0])}, ${fmt(ax[1])}${br[1]}`);}+ placeLabels(c0, c1, ax);listeners.forEach(f => f(v));}function edit(to) {@@ -252,7 +289,8 @@ function grid2(p, { A = [[1, 0], [0, 1]], x = null, mat = [90, 300], size = 54,col: j => j ? [v.a01, v.a11] : [v.a00, v.a10],Ax: () => map([v.x0, v.x1]),map,- labels(names) { names.forEach((n, i) => { tipLabels[i].replaceChildren(); M(tipLabels[i], [n], { size: 28, fill: G2_COLS[i] }); }); },+ labels(names) { names.forEach((n, i) => { tipLabels[i].replaceChildren(); M(tipLabels[i], [n], { size: 28, fill: G2_COLS[i], anchor: 'start' }); }); draw(); },+ tipLabels, // the groups that hold the column names (to show or hide one on its own)};return api;}