Skip to content

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

feat(linear-algebra): Unit 4 reviewed and on the contents

yzr669c4908720b
diff --git a/site/linear-algebra/ch28/index.html b/site/linear-algebra/ch28/index.html
index 84e038a..d1647ce 100644
--- a/site/linear-algebra/ch28/index.html
+++ b/site/linear-algebra/ch28/index.html
@@ -16,7 +16,7 @@
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 28, title: 'Matrices with No Inverse', minutes: 9, language: 'en' };
+const CHAPTER = { number: 28, title: 'Matrices with No Inverse', minutes: 9, language: 'en' , next: '../ch29/' };
/* ---------- layout and colours ---------- */
const COLC = [COL.irr, COL.real, COL.rat];
diff --git a/site/linear-algebra/ch29/audio/en/timings.js b/site/linear-algebra/ch29/audio/en/timings.js
index ee7f716..32bfee8 100644
--- a/site/linear-algebra/ch29/audio/en/timings.js
+++ b/site/linear-algebra/ch29/audio/en/timings.js
@@ -304,6 +304,93 @@ window.TIMINGS = {
]
]
},
+ "wrong": {
+ "dur": 67.056,
+ "marks": {
+ "sys": 2.891,
+ "g1": 11.562,
+ "w1": 15.195,
+ "res1": 22.057,
+ "past": 26.237,
+ "g2": 36.198,
+ "w2": 39.375,
+ "res2": 42.682,
+ "short": 47.031,
+ "g3": 53.229,
+ "res3": 57.839,
+ "home": 60.13
+ },
+ "cues": [
+ [
+ 0.104,
+ "Why change the sign?"
+ ],
+ [
+ 1.51,
+ "Why not some other number?"
+ ],
+ [
+ 2.891,
+ "Here is the flat line again, after row two minus three times row one."
+ ],
+ [
+ 8.607,
+ "The dashed line is where row two started."
+ ],
+ [
+ 11.562,
+ "Guess one: use E again, with minus three."
+ ],
+ [
+ 15.195,
+ "Minus three times row one is minus three, minus six, minus fifteen."
+ ],
+ [
+ 20.56,
+ "Add the new row two, and you get minus three, minus eight, minus nineteen."
+ ],
+ [
+ 26.237,
+ "The line turns, but it stops short of the dashed line, and the numbers are not the old row."
+ ],
+ [
+ 31.562,
+ "E again takes away three more of row one; it puts nothing back."
+ ],
+ [
+ 36.198,
+ "Guess two: divide, and use one third."
+ ],
+ [
+ 39.375,
+ "One third of row one, plus the new row two, gives one third, minus four thirds, minus seven thirds."
+ ],
+ [
+ 47.031,
+ "This time the line turns the wrong way."
+ ],
+ [
+ 49.453,
+ "One third of row one is not the three of row one we took away."
+ ],
+ [
+ 53.229,
+ "Guess three: plus three."
+ ],
+ [
+ 55.508,
+ "It puts back exactly what was taken."
+ ],
+ [
+ 57.839,
+ "Three, four, eleven, and the line lands on the dashed line."
+ ],
+ [
+ 62.305,
+ "Every guess kept the meeting point, but only plus three brings the line home."
+ ]
+ ]
+ },
"twice": {
"dur": 42.192,
"marks": {
diff --git a/site/linear-algebra/ch29/audio/en/wrong.mp3 b/site/linear-algebra/ch29/audio/en/wrong.mp3
new file mode 100644
index 0000000..c0cfde9
Binary files /dev/null and b/site/linear-algebra/ch29/audio/en/wrong.mp3 differ
diff --git a/site/linear-algebra/ch29/index.html b/site/linear-algebra/ch29/index.html
index b3a130f..6ed9ed2 100644
--- a/site/linear-algebra/ch29/index.html
+++ b/site/linear-algebra/ch29/index.html
@@ -18,7 +18,7 @@
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 29, title: 'Undoing Elimination', minutes: 10, language: 'en' };
+const CHAPTER = { number: 29, title: 'Undoing Elimination', minutes: 10, language: 'en' , next: '../ch30/' };
/* ---------- chapter drawing helpers ---------- */
const BLUE = LS_ROW[0], CORAL = LS_ROW[1], YELLOW = S3_ROW[2];
@@ -36,11 +36,11 @@ const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start',
const thick = (sys, i, t0) => { tw(sys.lines[i].l, { 'a_stroke-width': 10 }, t0, .35); tw(sys.lines[i].l, { 'a_stroke-width': 5 }, t0 + .9, .6); };
// 2D: the plane on the right, E · [A | b] = [EA | Eb] on the left (chapter 21's layout); the product is the system drawn
// (with E given, the lines start as E's answer).
-const two = (p, { A, b }, caption, { t0 = .1, E = null } = {}) => {
+const two = (p, { A, b }, caption, { t0 = .1, E = null, dens = [1, 2] } = {}) => {
const sys = linsys(p, { A, b, eq: [90, 200], mat: null, sol: false, plane: { cx: 1215, u: 50 }, t0 });
sys.E.style.visibility = 'hidden'; // hidden, yet measured (display: none measures as 0 and replays differ)
if (caption) say(p, [caption], 70, 175, t0 + .1, { size: 28, fill: COL.dim });
- const em = emat(p, sys, { A, b, E, at: AT2, size: 38, cw: 64, ecw: 56, rh: 62, gap: 66, t0 });
+ const em = emat(p, sys, { A, b, E, at: AT2, size: 38, cw: 64, ecw: 56, rh: 62, gap: 66, t0, dens });
return { sys, em };
};
// 3D: the space on the right, three 3 × 3 tables on the left.
@@ -123,9 +123,8 @@ const HANDS = [
why: '2 and −1: row 2 + 2 × row 1 and row 3 − row 1. Each number changes sign.' },
];
const handHint = h => (v, pr) => {
- const bad = [1, 2].filter(i => rowTxt(pr, i, 3) !== rowTxt(h.to, i, 3) && (i === 1 || h.to.A[i]));
- const i = bad[0] ?? 1;
- return `Row ${i + 1} is ${rowTxt(pr, i, 3)}, not ${rowTxt(h.to, i, 3)}. What did the step take away from it?`;
+ const to = keysOf(h.to), i = [1, 2].find(i => rowTxt(pr, i, 3) !== rowTxt(to, i, 3)) ?? 1;
+ return `Row ${i + 1} is ${rowTxt(pr, i, 3)}, not ${rowTxt(to, i, 3)}. What did the step do to it? Undo that.`;
};
/* ---------- beats ---------- */
@@ -142,8 +141,8 @@ const BEATS = [
const em = emat(lg, s, { A: [[1, 2], [3, 4]], b: [5, 11], at: [380, 640], size: 36, cw: 62, ecw: 54, rh: 56, t0: 0 });
show(lg, m('sub') + 1.2, .5);
em.ringE(1, 0, m('move'));
- em.to({ e10: -3 }, m('move') + .2, 1.2);
- em.to({ e10: 0 }, m('move') + 2.2, 1.2); // and back: the answer is A again
+ em.to({ e10: -3 }, m('move') + .1, 1);
+ em.to({ e10: 0 }, m('move') + 1.4, 1); // and back before the card fades: the answer is A again
tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(lg, D - .9, .8);
}],
@@ -180,7 +179,7 @@ const BEATS = [
text(p, 'row 1 is not touched: (1, 2 | 5)', 70, 700, m('kept'), { size: 28, fill: COL.dim, weight: 600 });
stepWords(p, 1, '+ 3 ×', 0, 70, 770, m('back'));
em.carry(m('carry'), 1.3, { names: ['EA', 'Eb', '', ''] });
- nameAt(em, '', m('carry') + 1.3);
+ nameAt(em, '?', m('carry') + 1.3);
em.ringE(1, 0, m('e'));
em.focusE(1, m('e')); em.Pt.focus(1, m('e'));
em.work(1, 0, { times: [m('w'), m('w') + 2.6, m('res')] });
@@ -238,7 +237,7 @@ const BEATS = [
['ex2', 'A plus sign', (m) => {
const p = panel(0);
text(p, 'Undoing a plus sign', 60, 110, .2, { size: 40, weight: 600 });
- const { sys, em } = two(p, CH17, 'x + 2y = 3, −2x + y = 4', { t0: m('sys') - .3 });
+ const { sys, em } = two(p, CH17, 'x + 2y = 3, −2x + y = 4', { t0: .3 });
em.setName('E₂₁');
pin(sys, -1, 2, m('sys') + 4); ghost(sys, -2, 1, -1, 2, m('go'));
em.ringE(1, 0, m('e') + 2);
@@ -260,6 +259,34 @@ const BEATS = [
say(p, ['−ℓ → +ℓ'], 70, 740, m('rule') + 3.4, { size: 36 });
}],
+ ['wrong', 'Why change the sign?', (m) => {
+ const p = panel(0);
+ text(p, 'Why change the sign?', 60, 110, .2, { size: 40, weight: 600 });
+ // the answer of row 2 − 3 × row 1 (chapter 16's system), and three guesses for the number that undoes it
+ const { sys, em } = two(p, { A: [[1, 2], [0, -2]], b: [5, -4] }, 'after row 2 − 3 × row 1: x + 2y = 5, −2y = −4', { dens: [1, 2, 3] });
+ em.setName('?'); em.names(['EA', 'Eb', '', '']);
+ const gl = ghost(sys, 3, 4, 1, 2, m('sys') + .4); pin(sys, 1, 2, m('sys') + .6);
+ thick(sys, 1, m('sys') + 2.6); em.B.flash(1, m('sys') + 3); // "the flat line again"
+ tw(gl, { o: 1 }, m('g1') - 2.8, .4); tw(gl, { o: .45 }, m('g1') - 1.4, .6); // "the dashed line is where row two started"
+ em.focusE(1, m('g1')); em.Pt.focus(1, m('g1'));
+ const guess = (k, v, row, verdict, ok) => {
+ const y = 650 + 58 * k, g = m(`g${k + 1}`), w = m(k < 2 ? `w${k + 1}` : `g${k + 1}`) + (k < 2 ? 0 : 1.2), r = m(`res${k + 1}`);
+ em.ringE(1, 0, g + .3);
+ if (k) em.work(null, g, .3);
+ em.work(1, 0, { times: [w, (w + r) / 2, r] });
+ em.to({ e10: v }, w + .2, Math.max(1.8, r - w - .2));
+ say(p, row, 70, y, r, { size: 30 });
+ text(p, verdict, 470, y - 2, r + 1.4, { size: 26, fill: ok ? COL.good : COL.bad, weight: 700 });
+ };
+ guess(0, -3, ['−3: (−3, −8 | −19)'], '✗ stops short: not the old row', false);
+ thick(sys, 1, m('past')); em.Pt.flash(1, m('past') + 3.4); // "the numbers are not the old row"
+ em.flashE(1, m('g2') - 4.4, 0); em.B.flash(0, m('g2') - 3.4); // "takes away three more of row one"
+ guess(1, 1 / 3, [F(1, 3), ': (', F(1, 3), ', −', F(4, 3), ' | −', F(7, 3), ')'], '✗ turns the wrong way', false);
+ thick(sys, 1, m('short')); em.flashE(1, m('short') + 2.8, 0); em.B.flash(0, m('short') + 3.6);
+ guess(2, 3, ['+3: (3, 4 | 11)'], '✓ back on the dashed line', true);
+ thick(sys, 1, m('home')); pulse(sys.meet, m('home') + 2.4);
+ }],
+
['twice', 'Either order', (m) => {
const p = panel(0);
text(p, 'The other order', 60, 110, .2, { size: 40, weight: 600 });
@@ -299,7 +326,7 @@ const BEATS = [
['three', 'Three equations', (m) => {
const p = panel(0);
text(p, 'Undo in three dimensions', 60, 110, .2, { size: 40, weight: 600 });
- const { sys, em, V } = three(p, LEC, 'x + 2y + z = 2, 3x + 8y + z = 12, 4y + z = 2', { t0: m('sys') - .3 });
+ const { sys, em, V } = three(p, LEC, 'x + 2y + z = 2, 3x + 8y + z = 12, 4y + z = 2', { t0: .3 });
em.setName('E₂₁');
[0, 1, 2].forEach(i => em.B.flash(i, m('sys') + .6 + 1.6 * i));
em.ringE(1, 0, m('e') + .6);
@@ -315,7 +342,7 @@ const BEATS = [
em.flashE(1, m('inv') + 3.2, 0); em.Pt.flash(1, m('inv') + 4.6);
V.turn({ yaw: -28, pitch: 26 }, m('inv'), 6);
em.work(1, 0, { times: [m('w') + 1.6, m('w') + 5.6, m('w') + 6.2, m('res')] });
- em.to({ e10: 3 }, m('w') + 1.4, Math.max(2, m('res') - m('w') - 1.4));
+ em.to({ e10: 3 }, m('w') - .2, 2.6); // at 3 by "three times row one, three, six, three, six"; the coral plane turns back with it
namesAt(em, ['EA', 'Eb', 'A', 'b'], m('res'));
em.Pt.flash(1, m('res') + .2);
hinge(sys, 0, m('back') + .2, 2);
@@ -424,7 +451,8 @@ const BEATS = [
ghost(t.sys, 3, 4, 1, 2, .3);
S.em = t.em;
t.em.work(1, .3);
- text(p, 'try: −3 in E makes the line flat; type the flat row into A | b, then find the E that turns it back', 70, 175, m('go'), { size: 24, fill: COL.dim });
+ text(p, 'try: put −3 in E, and the line goes flat;', 70, 168, m('go'), { size: 24, fill: COL.dim });
+ text(p, 'then scrub A | b to that flat row, and find the E that undoes it', 70, 200, m('go') + .3, { size: 24, fill: COL.dim });
}, { ask: playAsk(() => S.em, { pos: { x: 40, y: 586, w: 760, cls: 'side' }, tip: 'Your matrices. Change any number of E or of A | b, drag a line, or draw on the board. Nothing is marked.' }) }],
['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/linear-algebra/ch30/index.html b/site/linear-algebra/ch30/index.html
index f973b2d..fb058e2 100644
--- a/site/linear-algebra/ch30/index.html
+++ b/site/linear-algebra/ch30/index.html
@@ -18,7 +18,7 @@
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 30, title: 'A = LU', minutes: 10, language: 'en' };
+const CHAPTER = { number: 30, title: 'A = LU', minutes: 10, language: 'en' , next: '../ch31/' };
/* ---------- chapter drawing helpers ---------- */
const BLUE = LS_ROW[0], CORAL = LS_ROW[1], YELLOW = S3_ROW[2];
@@ -138,8 +138,8 @@ const HANDS = [
{ from: OWN3U, to: OWN3, ans: { e10: 1, e20: 2, e21: -1 } },
];
const handHint = h => (v, pr) => {
- const i = [1, 2].find(i => rowTxt(pr, i, 3) !== rowTxt(h.to, i, 3)) ?? 1;
- return `Row ${i + 1} is ${rowTxt(pr, i, 3)}, not ${rowTxt(h.to, i, 3)}. Row ${i + 1} of L says how much of each row of U to take.`;
+ const to = keysOf(h.to), i = [1, 2].find(i => rowTxt(pr, i, 3) !== rowTxt(to, i, 3)) ?? 1;
+ return `Row ${i + 1} is ${rowTxt(pr, i, 3)}, not ${rowTxt(to, i, 3)}. Row ${i + 1} of L says how much of each row of U to take.`;
};
/* ---------- beats ---------- */
@@ -154,9 +154,10 @@ const BEATS = [
const lg = G(scene, { o: 0 });
const em = emat(lg, bare(U2.A), { A: U2.A, b: [0, 0], at: [460, 640], size: 36, cw: 62, ecw: 54, rh: 56, t0: 0, noB: true, name: 'L', names: ['U', '', 'LU', ''] });
show(lg, m('sub') + 1.2, .5);
- em.ringE(1, 0, m('move'));
- em.to({ e10: 4 }, m('move') + .2, 1.4);
- namesAt(em, ['U', '', 'A', ''], m('move') + 1.6);
+ em.ringE(1, 0, m('sub') + 2.5); // "Run it backwards, and A becomes L times U": the product reads A in time to be seen
+ em.to({ e10: 4 }, m('sub') + 2.9, 1.4);
+ namesAt(em, ['U', '', 'A', ''], m('sub') + 4.4);
+ em.flashE(1, m('move') + .3, 0);
tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(lg, D - .9, .8);
}],
@@ -268,7 +269,7 @@ const BEATS = [
['ex2', 'Chapter 16’s matrix', (m) => {
const p = panel(0);
text(p, 'A second example', 60, 110, .2, { size: 40, weight: 600 });
- const { sys, em } = two(p, CH16, 'x + 2y = 5, 3x + 4y = 11', { t0: m('sys') - .3 });
+ const { sys, em } = two(p, CH16, 'x + 2y = 5, 3x + 4y = 11', { t0: .3 });
em.setName('E₂₁');
pin(sys, 1, 2, m('sys') + 3);
say(p, ['ℓ = 3 ÷ 1 = 3'], 70, 680, m('l'), { size: 34 });
@@ -293,7 +294,7 @@ const BEATS = [
['ex3', 'A minus sign', (m) => {
const p = panel(0);
text(p, 'A negative multiplier', 60, 110, .2, { size: 40, weight: 600 });
- const { sys, em } = two(p, NEGL, '2x + y = 3, −6x + y = −5', { t0: m('sys') - .3 });
+ const { sys, em } = two(p, NEGL, '2x + y = 3, −6x + y = −5', { t0: .3 });
em.setName('E₂₁');
pin(sys, 1, 1, m('sys') + 3);
say(p, ['ℓ = −6 ÷ 2 = −3'], 70, 680, m('l'), { size: 34 });
@@ -314,7 +315,7 @@ const BEATS = [
em.work(1, 0, { times: [m('w'), m('w') + 2, m('res')] });
namesAt(em, ['U', 'c', 'A', 'b'], m('res'));
em.Pt.flash(1, m('res') + .2);
- thick(sys, 1, m('back'));
+ thick(sys, 1, m('back') - .6); // within the voice: "A again" is the beat's last word
}],
['q2', 'Your turn', () => {
@@ -336,10 +337,10 @@ const BEATS = [
['three', 'L fills in', (m) => {
const p = panel(0);
text(p, 'Three equations: L fills in', 60, 110, .2, { size: 40, weight: 600 });
- const sys = lin3(p, { A: OWN.A, b: OWN.b, eq: [90, 190], mat: null, sol: false, space: { cx: 1250, size: 540, yaw: -35, pitch: 20 }, t0: m('sys') - .3 });
+ const sys = lin3(p, { A: OWN.A, b: OWN.b, eq: [90, 190], mat: null, sol: false, space: { cx: 1250, size: 540, yaw: -35, pitch: 20 }, t0: .3 });
sys.E.style.visibility = 'hidden'; // hidden, yet measured (display: none measures as 0 and replays differ)
say(p, ['x + y + z = 3, 2x + 3y + z = 6, −x + y + 2z = 2'], 90, 172, m('sys'), { size: 28, fill: COL.dim });
- const el = elim(p, sys, { at: [120, 260], size: 44, cw: 84, rh: 66, t0: m('sys') - .3, labelX: 520 });
+ const el = elim(p, sys, { at: [120, 260], size: 44, cw: 84, rh: 66, t0: .3, labelX: 520 });
const L = elL(p, el, { at: [150, 590], size: 38, cw: 60, rh: 56, t0: m('l') - .2 });
[0, 1, 2].forEach(i => el.flash(i, m('sys') + 1 + 2.2 * i));
el.ring(0, 0, m('s1'));
@@ -469,7 +470,8 @@ const BEATS = [
t.em.setName('L'); t.em.names(['U', 'c', 'A', 'b']);
S.em = t.em;
t.em.work(1, .3);
- text(p, 'try: put 0 in L (A becomes U: the line goes flat); change U’s pivot 3; drag a line', 70, 175, m('go'), { size: 24, fill: COL.dim });
+ text(p, 'try: put 0 in L, and A becomes U (the line goes flat);', 70, 168, m('go'), { size: 24, fill: COL.dim });
+ text(p, 'change U’s pivot 3, or drag a line, and watch U and A follow', 70, 200, m('go') + .3, { size: 24, fill: COL.dim });
}, { ask: playAsk(() => S.em, { pos: { x: 40, y: 586, w: 760, cls: 'side' }, tip: 'L, U and c are yours. Change any number, drag a line, or draw on the board. Nothing is marked.' }) }],
['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/linear-algebra/ch31/audio/en/ex2.mp3 b/site/linear-algebra/ch31/audio/en/ex2.mp3
index 5ca159c..d13c34c 100644
Binary files a/site/linear-algebra/ch31/audio/en/ex2.mp3 and b/site/linear-algebra/ch31/audio/en/ex2.mp3 differ
diff --git a/site/linear-algebra/ch31/audio/en/timings.js b/site/linear-algebra/ch31/audio/en/timings.js
index ad75c23..a62b107 100644
--- a/site/linear-algebra/ch31/audio/en/timings.js
+++ b/site/linear-algebra/ch31/audio/en/timings.js
@@ -391,18 +391,20 @@ window.TIMINGS = {
]
},
"ex2": {
- "dur": 59.496,
+ "dur": 70.968,
"marks": {
- "sys": 2.175,
- "l": 10.143,
- "e": 17.487,
- "rows": 20.833,
- "r3": 28.138,
- "then": 35.104,
- "res": 41.68,
- "five": 48.984,
- "go": 54.362,
- "back": 57.695
+ "sys": 2.344,
+ "l": 10.547,
+ "e": 17.891,
+ "rows": 21.289,
+ "r3": 28.568,
+ "then": 35.482,
+ "res": 41.654,
+ "five": 49.362,
+ "go": 54.792,
+ "back": 58.542,
+ "lin": 61.419,
+ "just": 65.625
},
"cues": [
[
@@ -410,44 +412,56 @@ window.TIMINGS = {
"One more, with all three steps."
],
[
- 2.175,
+ 2.344,
"Here the multipliers are two for row two, one for row three, and then three for row three, column two."
],
[
- 10.143,
+ 10.547,
"L is just these: one, zero, zero; two, one, zero; one, three, one."
],
[
- 17.487,
+ 17.891,
"Now E, the product of the three steps."
],
[
- 20.833,
+ 21.289,
"Rows one and two are easy: one, zero, zero, and minus two, one, zero."
],
[
- 28.138,
+ 28.568,
"For row three, the first step takes away one times row one: minus one, zero, one."
],
[
- 35.104,
+ 35.482,
"Then the last step takes away three times the new row two, which is minus two, one, zero."
],
[
- 41.68,
+ 41.654,
"Minus one, zero, one, minus three times minus two, one, zero, gives five, minus three, one."
],
[
- 48.984,
+ 49.362,
"A five: minus one, plus three times two."
],
[
- 52.917,
+ 53.307,
"The steps mixed again."
],
[
- 54.362,
- "On the planes, E does all three steps at once, and L brings them all back."
+ 54.792,
+ "On the planes, E does all three steps at once."
+ ],
+ [
+ 58.542,
+ "Now go back: start from U and c, and put L in front."
+ ],
+ [
+ 62.76,
+ "All three planes turn back to A and b."
+ ],
+ [
+ 65.625,
+ "And L's numbers are just the multipliers: two, one and three."
]
]
},
diff --git a/site/linear-algebra/ch31/index.html b/site/linear-algebra/ch31/index.html
index fa4f4c9..25dfa5e 100644
--- a/site/linear-algebra/ch31/index.html
+++ b/site/linear-algebra/ch31/index.html
@@ -18,7 +18,7 @@
<script src="audio/en/timings.js"></script>
<script>
'use strict';
-const CHAPTER = { number: 31, title: 'Why L Is Clean and E Is Not', minutes: 10, language: 'en' };
+const CHAPTER = { number: 31, title: 'Why L Is Clean and E Is Not', minutes: 10, language: 'en' , next: '../ch32/' };
/* ---------- chapter drawing helpers ---------- */
const BLUE = LS_ROW[0], CORAL = LS_ROW[1], YELLOW = S3_ROW[2];
@@ -88,17 +88,24 @@ const rowTxt = (pr, i, n) => `(${[...Array(n).keys()].map(j => r1(pr[`a${i}${j}`
// A matrix times a matrix with no picture (E₃₂E₂₁): emat on a bare system, the b columns hidden (chapter 21).
const mm3 = (p, Ebig, Bm, names, nameE, t0) => emat(p, bare(Bm), { A: Bm, b: [0, 0, 0], E: Ebig, at: AT3, size: 32, cw: 52, ecw: 44, rh: 54, gap: 64, t0, noB: true, names, name: nameE });
// A matrix of math parts (letters allowed); .ring(i, j, at) circles an entry. cws: one width per column.
-const symMat = (p, rows, x, y, t0, { size = 34, cws = null, rh = 50, name = '' } = {}) => {
+const symMat = (p, rows, x, y, t0, { size = 34, cws = null, rh = 50, name = '', fill = COL.chalk } = {}) => {
const g = G(p, { o: 0 }), n = rows.length, W = cws || rows[0].map(() => 56), w = W.reduce((a, b) => a + b, 0), top = y - size * .95, bot = y + (n - 1) * rh + size * .35;
const cx = j => x + W.slice(0, j).reduce((a, b) => a + b, 0) + W[j] / 2;
path(g, `M${x + 12} ${top}H${x}V${bot}H${x + 12}M${x + w - 12} ${top}H${x + w}V${bot}H${x + w - 12}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' });
- rows.forEach((r, i) => r.forEach((v, j) => M(g, [].concat(typeof v === 'number' ? num(v) : v), { x: cx(j), y: y + i * rh, size, fill: COL.chalk, anchor: 'middle' })));
+ rows.forEach((r, i) => r.forEach((v, j) => M(g, [].concat(typeof v === 'number' ? num(v) : v), { x: cx(j), y: y + i * rh, size, fill, anchor: 'middle' })));
if (name) M(g, [].concat(name), { x: x - 18, y: y + (n - 1) * rh / 2 + 10, size: size * 1.05, fill: COL.chalk, anchor: 'end' });
- show(g, t0, .5);
- g.ring = (i, j, at, { dash = false, color = COL.chalk } = {}) => { const e = mk('ellipse', { cx: cx(j), cy: y + i * rh - size * .32, rx: W[j] * .48, ry: size * .62, fill: 'none', stroke: color, 'stroke-width': 3, ...(dash ? { 'stroke-dasharray': '7 6' } : {}) }, p); put(e, { o: 0 }); show(e, at, .35); return e; };
+ if (t0 === null) put(g, { o: 1 }); else show(g, t0, .5); // null: at once (inside a question)
+ g.ring = (i, j, at, { dash = false, color = COL.chalk, rx = W[j] * .48, ry = size * .62 } = {}) => { const e = mk('ellipse', { cx: cx(j), cy: y + i * rh - size * .32, rx, ry, fill: 'none', stroke: color, 'stroke-width': 3, ...(dash ? { 'stroke-dasharray': '7 6' } : {}) }, p); put(e, { o: 0 }); show(e, at, .35); return e; };
return g;
};
const emL = Lm => { const o = {}; Lm.forEach((r, i) => r.forEach((x, j) => { o[`e${i}${j}`] = x; })); return o; };
+// A line of row algebra with "row 1/2/3" in the rows' colours.
+const RCOL = { 1: BLUE, 2: CORAL, 3: YELLOW };
+const rline = (p, str, x, y, t0, { size = 30, fill = COL.chalk } = {}) => {
+ const e = T(p, '', { x, y, size, fill, weight: 600, o: 0 });
+ str.split(/((?:new )?row [123])/).forEach(part => { if (!part) return; const t = mk('tspan', {}, e); t.textContent = part; const k = part.match(/row ([123])/); if (k) t.setAttribute('fill', RCOL[k[1]]); });
+ show(e, t0); return e;
+};
const upperOK = pr => [pr.a10, pr.a20, pr.a21].every(x => Math.abs(x) < 1e-9);
/* ---------- practice data (every answer worked twice: by multiplying the step matrices, and by −ℓ₃₁ + ℓ₃₂ℓ₂₁) ---------- */
@@ -127,13 +134,12 @@ const TFQ = [
];
const SYS3 = { A: [[1, 1, 1], [2, 3, 4], [0, 3, 7]], b: [3, 9, 10] };
const LEC = { A: [[1, 2, 1], [3, 8, 1], [0, 4, 1]], b: [2, 12, 2] }, LECU = { A: [[1, 2, 1], [0, 2, -2], [0, 0, 5]], b: [2, 6, -10] };
-const rowsTxt = s => s.A.map((r, i) => `(${r.map(num).join(', ')} | ${num(s.b[i])})`).join(', ');
const HANDS = [
- { kind: 'L', from: SYS2U, to: SYS2, ans: { e10: 2, e20: 1, e21: 3 }, prompt: `L in front of U | c: change L’s numbers below the diagonal until LU | Lc is ${rowsTxt(SYS2)}.`,
+ { kind: 'L', from: SYS2U, to: SYS2, ans: { e10: 2, e20: 1, e21: 3 }, prompt: 'L in front of U | c: change L’s numbers below the diagonal until LU | Lc is the amber target.',
why: 'L = (1, 0, 0), (2, 1, 0), (1, 3, 1): the three multipliers, untouched.' },
{ kind: 'E', from: SYS3, ans: { e10: -2, e20: 6, e21: -3 }, prompt: 'One E for all of elimination: change E’s numbers below the diagonal until EA is upper triangular (ℓ₂₁ = 2, ℓ₃₂ = 3).',
why: 'E = (1, 0, 0), (−2, 1, 0), (6, −3, 1): the 6 is 3 × 2, the mix.' },
- { kind: 'L', from: LECU, to: LEC, ans: { e10: 3, e20: 0, e21: 2 }, prompt: `Chapter 18’s system: change L’s numbers until LU | Lc is ${rowsTxt(LEC)}.`,
+ { kind: 'L', from: LECU, to: LEC, ans: { e10: 3, e20: 0, e21: 2 }, prompt: 'Chapter 18’s system after elimination: change L’s numbers until LU | Lc is the amber target, A | b.',
why: 'L = (1, 0, 0), (3, 1, 0), (0, 2, 1): ℓ₂₁ = 3, no step for row 3, column 1, ℓ₃₂ = 2.' },
];
const handTest = h => (v, pr) => h.kind === 'E' ? upperOK(pr) : same(pr, h.to);
@@ -210,8 +216,9 @@ const BEATS = [
const sys = lin3(p, { A: SYS1.A, b: SYS1.b, eq: [90, 190], mat: null, sol: false, space: { cx: 1262, size: 520, yaw: -30, pitch: 20 } });
sys.E.style.visibility = 'hidden';
sys.space.sway(4, 20);
- const line = (str, y, t0, { size = 30, fill = COL.chalk } = {}) => text(p, str, 64, y, t0, { size, fill, weight: 600 });
- symMat(p, [E1[2]], 330, 190, m('recipe') - .6, { size: 32, name: 'row 3 of E:' });
+ const line = (str, y, t0, { size = 30, fill = COL.chalk } = {}) => rline(p, str, 64, y, t0, { size, fill });
+ const e3 = symMat(p, [E1[2]], 330, 190, m('recipe') - .6, { size: 32, name: 'row 3 of E:' });
+ e3.ring(0, 0, m('ten'), { dash: true });
line('new row 3 = 10 × row 1 − 5 × row 2 + row 3', 260, m('recipe') + .4);
line('step 2: new row 3 = row 3 − 5 × (new row 2)', 370, m('step2') + .4);
sys.focus(2, m('step2'));
@@ -266,7 +273,7 @@ const BEATS = [
say(p, ['on: E₂₁ first, then E₃₂'], 64, 730, m('socks') + 3.5, { size: 30 });
const f = say(p, ['(E₃₂E₂₁)⁻¹ = E₂₁⁻¹E₃₂⁻¹'], 64, 800, m('inv') + .3, { size: 38 });
pulse(f, m('inv') + 5, 1.1);
- em.ringE(2, 1, m('first') + .6);
+ hide(em.ringE(2, 1, m('first') + .6), m('second') - .3, .3);
em.work(2, 0, { times: [m('first') + 1.5, m('first') + 2, m('first') + 2.5, m('p1')] });
em.to({ e21: 5 }, m('first') + 1.6, 2.6);
sys.focus(2, m('p1') - .5); sys.focus(null, m('second'));
@@ -295,6 +302,9 @@ const BEATS = [
em.focusE(null, m('clean'));
em.Pt.ring(1, 0, m('clean') + 4, { color: COL.good }); em.Pt.ring(2, 1, m('clean') + 4.6, { color: COL.good });
text(p, 'no 10: just the 2 and the 5, each in its own spot', 64, 700, m('clean') + 4, { size: 30, weight: 600 });
+ const Ec = symMat(p, E1, 1040, 300, m('clean') + 5.5, { size: 38, cws: [64, 64, 56], rh: 56, name: 'E =' });
+ Ec.ring(2, 0, m('clean') + 6.4, { dash: true });
+ text(p, 'E, for comparison: the 10', 1000, 470, m('clean') + 6, { size: 26, fill: COL.dim, weight: 600 });
}],
['why', 'Why nothing mixes', (m, D) => {
@@ -336,10 +346,12 @@ const BEATS = [
em.to({ e20: 5, e21: -3 }, m('res') + 4, 1.8);
hide(em.ringE(2, 0, m('five'), { dash: true }), m('back'), .3);
hinge(sys, 0, m('go') + .2, 1.4); hinge(sys, 2, m('go') + .2, 1.4);
- em.carry(m('back') + .1, .8, { names: ['U', 'c', '', ''] });
- nameAt(em, 'L', m('back') + .9);
- em.to(emL(L2), m('back') + 1, 1.8);
- namesAt(em, ['U', 'c', 'A', 'b'], m('back') + 2.8);
+ em.carry(m('back') + .1, 1, { names: ['U', 'c', '', ''] });
+ nameAt(em, 'L', m('lin') - .2);
+ em.to(emL(L2), m('lin'), 2.4);
+ hinge(sys, 1, m('lin') + .4, 1.4); hinge(sys, 2, m('lin') + .4, 1.4);
+ namesAt(em, ['U', 'c', 'A', 'b'], m('lin') + 2.6);
+ [[1, 0], [2, 0], [2, 1]].forEach(([i, j], k) => em.ringE(i, j, m('just') + .3 + .4 * k, { color: COL.good }));
V.turn({ yaw: 15, pitch: 26 }, 12, m('go') - 12); V.turn({ yaw: -15, pitch: 20 }, m('go'), Math.max(3, D - m('go')));
}],
@@ -352,7 +364,9 @@ const BEATS = [
}, { ask: done => quiz(CARD3, [{
id: 'c-oneE', prompt: ['Change E’s three numbers below the diagonal until EA is upper triangular: U in one step.'],
build: emTask(S.em, (v, pr) => upperOK(pr), 'E = (1, 0, 0), (−2, 1, 0), (5, −3, 1): the 5 is −1 + 3 × 2, the mix.',
- (v, pr) => `Below the diagonal the answer still has ${r1(pr.a10)}, ${r1(pr.a20)}, ${r1(pr.a21)}. Row 2 first; then row 3 must also undo what the new row 2 brings.`,
+ (v, pr) => `Below the diagonal the answer still has ${r1(pr.a10)}, ${r1(pr.a20)}, ${r1(pr.a21)}. ` + (v.e10 !== -2 ? 'Start with row 2: ℓ₂₁ = 2, so E has −2 in row 2, column 1.'
+ : v.e21 !== -3 ? 'Row 3, column 2: the last step takes 3 × the new row 2 away (ℓ₃₂ = 3).'
+ : 'Row 3, column 1 is not just −ℓ₃₁ = −1: taking away 3 × the new row 2 (which holds −2 × row 1) also adds back 3 × 2 = 6 of row 1. Count that in.'),
() => S.em.set(emL(E2)), { only: ['e10', 'e20', 'e21'] }),
}], done) }],
@@ -363,10 +377,11 @@ const BEATS = [
Lm.ring(1, 0, m('l') + 2.4); Lm.ring(2, 0, m('l') + 3); Lm.ring(2, 1, m('l') + 3.6);
text(p, 'ℓᵢⱼ: how much of row j was taken from row i', 100, 520, m('l') + 4, { size: 28, weight: 600 });
text(p, 'write each multiplier down as you go: L is done', 100, 580, m('no') + .5, { size: 28, fill: COL.dim, weight: 600 });
- const Em = symMat(p, [['1', '0', '0'], ['−ℓ₂₁', '1', '0'], ['−ℓ₃₁ + ℓ₃₂ℓ₂₁', '−ℓ₃₂', '1']], 900, 300, m('e'), { size: 40, cws: [250, 90, 70], rh: 64, name: 'E =' });
- Em.ring(2, 0, m('e') + 2.4, { dash: true });
- text(p, 'lecture: 0 + 5 × 2 = 10 all three steps: −1 + 3 × 2 = 5', 900, 520, m('e') + 5, { size: 26, fill: COL.dim, weight: 600 });
- text(p, 'bigger matrices: more mixing in E, none in L', 900, 580, m('big') + .5, { size: 28, weight: 600 });
+ const Em = symMat(p, [['1', '0', '0'], ['−ℓ₂₁', '1', '0'], ['−ℓ₃₁ + ℓ₃₂ℓ₂₁', '−ℓ₃₂', '1']], 900, 300, m('e'), { size: 40, cws: [290, 96, 70], rh: 64, name: 'E =' });
+ Em.ring(2, 0, m('e') + 2.4, { dash: true, rx: 132, ry: 34 });
+ text(p, 'lecture: 0 + 5 × 2 = 10', 900, 500, m('e') + 5, { size: 26, fill: COL.dim, weight: 600 });
+ text(p, 'all three steps: −1 + 3 × 2 = 5', 900, 540, m('e') + 6, { size: 26, fill: COL.dim, weight: 600 });
+ text(p, 'bigger matrices: more mixing in E, none in L', 900, 610, m('big') + .5, { size: 28, weight: 600 });
}],
['q3', 'Quick check', () => {
@@ -418,10 +433,13 @@ const BEATS = [
text(p, 'Build L and E', 60, 110, .2, { size: 40, weight: 600 });
const t = three(p, SYS2U, '');
S.em = t.em;
+ S.tg = G(p, {});
}, { ask: done => quiz(CARD3, HANDS.map((h, k) => ({
id: `p-hand${k + 1}`, prompt: [h.prompt],
build: (body, api) => {
- S.em.set(keysOf(h.from)); S.em.setName(h.kind);
+ S.em.set(keysOf(h.from)); S.em.setName(h.kind); S.tg.replaceChildren();
+ if (h.kind === 'L') symMat(S.tg, h.to.A.map((r, i) => [...r, h.to.b[i]]), 400, 450, null, { size: 30, cws: [48, 48, 48, 60], rh: 44, name: 'target LU | Lc =', fill: COL.task });
+ else T(S.tg, 'target: 0, 0, 0 below the diagonal of EA', { x: 64, y: 480, size: 30, fill: COL.task, weight: 600 });
S.em.names(h.kind === 'L' ? ['U', 'c', 'LU', 'Lc'] : ['A', 'b', 'EA', 'Eb']);
return emTask(S.em, handTest(h), h.why, handHint(h), () => S.em.set(h.ans), { only: ['e10', 'e20', 'e21'] })(body, api);
},
diff --git a/site/linear-algebra/ch32/audio/en/ex3.mp3 b/site/linear-algebra/ch32/audio/en/ex3.mp3
index 553916e..13b1704 100644
Binary files a/site/linear-algebra/ch32/audio/en/ex3.mp3 and b/site/linear-algebra/ch32/audio/en/ex3.mp3 differ
diff --git a/site/linear-algebra/ch32/audio/en/plane.mp3 b/site/linear-algebra/ch32/audio/en/plane.mp3
new file mode 100644
index 0000000..c4fea3d
Binary files /dev/null and b/site/linear-algebra/ch32/audio/en/plane.mp3 differ
diff --git a/site/linear-algebra/ch32/audio/en/timings.js b/site/linear-algebra/ch32/audio/en/timings.js
index fd4fe83..b1d2287 100644
--- a/site/linear-algebra/ch32/audio/en/timings.js
+++ b/site/linear-algebra/ch32/audio/en/timings.js
@@ -305,6 +305,71 @@ window.TIMINGS = {
]
]
},
+ "plane": {
+ "dur": 53.16,
+ "marks": {
+ "sq": 7.344,
+ "u": 18.581,
+ "d": 26.094,
+ "l": 32.461,
+ "a": 38.542,
+ "sum": 47.552
+ },
+ "cues": [
+ [
+ 0.104,
+ "There is one more way to see L, D and U: as moves of the whole plane, as in chapter twenty-six."
+ ],
+ [
+ 7.344,
+ "Here is the plane with its square."
+ ],
+ [
+ 9.987,
+ "A times a point is L times D times U times that point, so U moves it first, then D, then L."
+ ],
+ [
+ 18.581,
+ "First U."
+ ],
+ [
+ 19.531,
+ "The one half slides the square sideways: its top moves right by one half, and nothing gets bigger."
+ ],
+ [
+ 26.094,
+ "Then D."
+ ],
+ [
+ 27.031,
+ "The pivots stretch it: two times as wide, and three times as tall."
+ ],
+ [
+ 32.461,
+ "Then L."
+ ],
+ [
+ 33.333,
+ "The four slides it upward: every point rises by four times its x."
+ ],
+ [
+ 38.542,
+ "The result is exactly what A does."
+ ],
+ [
+ 41.107,
+ "One, zero lands on two, eight, and zero, one lands on one, seven: the columns of A."
+ ],
+ [
+ 47.552,
+ "So L and U only slide."
+ ],
+ [
+ 49.935,
+ "All the stretching is in D, the pivots."
+ ]
+ ]
+ },
"q1": {
"dur": 2.856,
"marks": {},
@@ -397,68 +462,81 @@ window.TIMINGS = {
]
},
"ex3": {
- "dur": 53.28,
+ "dur": 68.208,
"marks": {
- "A": 2.513,
- "U": 6.693,
- "piv": 15.43,
- "r1": 18.099,
- "r2": 22.409,
- "r3": 28.542,
- "still": 34.089,
- "D": 35.599,
- "go": 38.333,
- "L": 43.372,
- "ldu": 48.034
+ "A": 2.474,
+ "U": 6.615,
+ "piv": 15.273,
+ "r1": 18.021,
+ "r2": 22.383,
+ "r3": 28.438,
+ "still": 33.984,
+ "D": 35.482,
+ "go": 38.281,
+ "L": 43.503,
+ "ldu": 48.021,
+ "chk": 53.398
},
"cues": [
[
- 0.156,
+ 0.13,
"Three by three works the same way."
],
[
- 2.513,
+ 2.474,
"This is the lecture's system from chapters eighteen and twenty-one."
],
[
- 6.693,
+ 6.615,
"Elimination left U: one, two, one; zero, two, minus two; zero, zero, five."
],
[
- 15.43,
+ 15.273,
"Its pivots are one, two and five."
],
[
- 18.099,
+ 18.021,
"Row one's pivot is one: dividing by one changes nothing."
],
[
- 22.409,
+ 22.383,
"Row two divided by two: zero, one, minus one, and three on the right."
],
[
- 28.542,
+ 28.438,
"Row three divided by five: zero, zero, one, and minus two."
],
[
- 34.089,
+ 33.984,
"Not one plane moved."
],
[
- 35.599,
+ 35.482,
"D holds the pivots: one, two, five."
],
[
- 38.333,
+ 38.281,
"Grow D from the identity, and the table with ones turns back into the old U."
],
[
- 43.372,
+ 43.503,
"L holds the multipliers: three, zero and two."
],
[
- 48.034,
- "A equals L D U, and both L and U have ones down the diagonal."
+ 48.021,
+ "So A equals L D U, and both L and U have ones down the diagonal."
+ ],
+ [
+ 53.398,
+ "Check one row."
+ ],
+ [
+ 54.505,
+ "Row two of L is three, one, zero: three times row one of D U, which is three, six, three, plus row two, zero, two, minus two."
+ ],
+ [
+ 64.922,
+ "That's three, eight, one: row two of A."
]
]
},
diff --git a/site/linear-algebra/ch32/index.html b/site/linear-algebra/ch32/index.html
index 737298f..e4d56cd 100644
--- a/site/linear-algebra/ch32/index.html
+++ b/site/linear-algebra/ch32/index.html
@@ -14,6 +14,7 @@
<script src="../lib/space3.js"></script>
<script src="../lib/elim.js"></script>
<script src="../lib/emat.js"></script>
+<script src="../lib/grid2.js"></script>
<script src="../lib/play.js"></script>
<script src="audio/en/timings.js"></script>
<script>
@@ -166,16 +167,16 @@ const BEATS = [
['recall', 'A = LU, again', (m) => {
const p = panel(0);
text(p, 'A = LU, again', 60, 110, .2, { size: 40, weight: 600 });
- const [A, L, U] = chain(p, [[LECA, { name: 'A =' }], [L2, { under: 'L', at: m('L') }], [UOLD, { under: 'U', at: m('U') }]], 110, 260, .4, { size: 36, cw: 58, rh: 52, gap: 30 });
+ const [A, L, U] = chain(p, [[LECA, { name: 'A =' }], [L2, { name: '=', under: 'L', at: m('L') }], [UOLD, { under: 'U', at: m('U') }]], 110, 260, .4, { size: 36, cw: 58, rh: 52, gap: 30 });
text(p, 'row 2 − 4 × row 1', 110, 410, m('A'), { size: 28, fill: COL.dim, weight: 600 });
L.ring(1, 0, m('L') + .4, { dash: true });
A.glow(m('mult') + .2);
const o1 = L.ring(0, 0, m('ones')), o2 = L.ring(1, 1, m('ones') + .3);
const p1 = U.ring(0, 0, m('piv')), p2 = U.ring(1, 1, m('piv') + .3);
text(p, 'L: ones on the diagonal. U: the pivots.', 110, 470, m('lop'), { size: 30, weight: 600 });
- const sys = linsys(p, { A: LECA, b: LECB, eq: [90, 200], mat: null, sol: false, plane: { cx: 1215, u: 50 }, t0: m('sys') - .3 });
+ const sys = linsys(p, { A: LECA, b: LECB, eq: [90, 200], mat: null, sol: false, plane: { cx: 1215, u: 50 }, t0: m('A') - .3 });
sys.E.style.display = 'none';
- const c1 = say(p, ['2x + y = 3, 8x + 7y = 15'], 110, 580, m('sys'), { size: 32, fill: COL.dim });
+ const c1 = say(p, ['2x + y = 3, 8x + 7y = 15'], 110, 580, m('A') + .2, { size: 32, fill: COL.dim });
pin(sys, 1, 1, m('sys') + 4);
thick(sys, 0, m('sys') + 2); thick(sys, 1, m('sys') + 4.4); pulse(sys.meet, m('sys') + 7);
hide(c1, m('elim') + 2.4, .4);
@@ -255,7 +256,7 @@ const BEATS = [
const p = panel(0);
text(p, 'A = L D U', 60, 110, .2, { size: 40, weight: 600 });
text(p, 'A = L × (old U), old U = D × U', 70, 175, m('eq'), { size: 28, fill: COL.dim, weight: 600 });
- const [Am, L, Dm, U] = chain(p, [[LECA, { name: 'A =' }], [L2, { under: 'L' }], [D2, { under: 'D' }], [UNEW, { under: 'U', cw: 58 }]], 110, 250, m('ldu'), { size: 30, cw: 50, rh: 42, gap: 22, step: .5 });
+ const [Am, L, Dm, U] = chain(p, [[LECA, { name: 'A =' }], [L2, { name: '=', under: 'L' }], [D2, { under: 'D' }], [UNEW, { under: 'U', cw: 58 }]], 110, 250, m('ldu'), { size: 30, cw: 50, rh: 42, gap: 22, step: .5 });
L.glow(m('three')); Dm.glow(m('three') + 2.2); U.glow(m('three') + 4.6);
const sys = linsys(p, { A: UOLD, b: COLD, eq: [90, 200], mat: null, sol: false, plane: { cx: 1215, u: 50 }, t0: .4 });
sys.E.style.display = 'none';
@@ -278,6 +279,33 @@ const BEATS = [
pin(sys, 1, 1, m('pic') + 1);
}],
+ ['plane', 'Three moves', (m) => {
+ const p = panel(0);
+ text(p, 'Slide, stretch, slide', 60, 110, .2, { size: 40, weight: 600 });
+ const g = grid2(p, { A: [[1, 0], [0, 1]], pre: [[1, 0], [0, 1]], mat: null, units: false, grid: false, plane: { cx: 1150, cy: 790, u: 40, x0: -4, x1: 6, y0: -1, y1: 15.5 }, t0: .3 });
+ put(g.parts.cols, { o: 0 });
+ const [Am, L, Dm, U] = chain(p, [[LECA, { name: 'A =' }], [L2, { name: '=', under: 'L' }], [D2, { under: 'D' }], [UNEW, { under: 'U', cw: 58 }]], 110, 250, .4, { size: 34, cw: 54, rh: 46, gap: 22 });
+ L.glow(2.6, 1); Dm.glow(3.1, 1); U.glow(3.6, 1); // "L, D and U"
+ const sqP = g.parts.square; tw(sqP, { o: .35 }, m('sq') + .4, .3); tw(sqP, { o: 1 }, m('sq') + .9, .4); tw(sqP, { o: .35 }, m('sq') + 1.4, .3); tw(sqP, { o: 1 }, m('sq') + 1.9, .4);
+ text(p, 'A x = L (D (U x)): U first, then D, then L', 110, 400, m('sq') + 3, { size: 28, fill: COL.dim, weight: 600 });
+ U.glow(m('sq') + 7, 1); Dm.glow(m('sq') + 8.2, 1); L.glow(m('sq') + 9.2, 1);
+ U.glow(m('u'), 4); g.to({ p01: .5 }, m('u') + 1, 2.4);
+ text(p, 'U: the ½ slides it sideways', 110, 470, m('u') + .6, { size: 30, weight: 600 });
+ Dm.glow(m('d'), 4); g.to({ a00: 2, a11: 3 }, m('d') + .8, 2.6);
+ text(p, 'D: the pivots stretch it, × 2 wide, × 3 tall', 110, 530, m('d') + .4, { size: 30, weight: 600 });
+ g.to({ p00: 2, p01: 1, p11: 3, a00: 1, a11: 1 }, m('l') - .3, .05); // the same plane, now as I · (DU)
+ L.glow(m('l'), 4); g.to({ a10: 4 }, m('l') + .8, 2.6);
+ text(p, 'L: the 4 slides it up, by 4 times x', 110, 590, m('l') + .4, { size: 30, weight: 600 });
+ Am.glow(m('a'), 5);
+ [[2, 8, COL.irr, '(2, 8)', 'start', 14], [1, 7, COL.real, '(1, 7)', 'end', -14]].forEach(([x, y, c, s, anchor, dx], k) => {
+ const d = G(g.stage, { x: g.P.PX(x), y: g.P.PY(y), o: 0 });
+ mk('circle', { r: 9, fill: c }, d); T(d, s, { x: dx, y: 8, size: 26, fill: c, weight: 700, anchor });
+ show(d, m('a') + 1 + 3 * k, .4);
+ });
+ text(p, '(1, 0) lands on (2, 8), (0, 1) on (1, 7): A’s columns', 110, 670, m('a') + 1, { size: 28, fill: COL.dim, weight: 600 });
+ text(p, 'L and U only slide; all the stretching is in D', 110, 760, m('sum'), { size: 30, weight: 600 });
+ }],
+
['q1', 'Quick check', () => {
const p = panel(0);
text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
@@ -315,7 +343,7 @@ const BEATS = [
el.to({ a11: 1, b1: -1 }, m('div2') + .4, 1.6);
hide(r2, m('div2') + 2, .3);
hide(bot1, m('ldu') - .2, .3);
- const [Am, Lm, Dm, Um] = chain(p, [[[[3, 6], [6, 16]], { name: 'A =' }], [[[1, 0], [2, 1]], { under: 'L' }], [[[3, 0], [0, 4]], { under: 'D' }], [[[1, 2], [0, 1]], { under: 'U' }]], 110, 640, m('ldu'), { size: 32, cw: 52, rh: 46, gap: 24, step: .4 });
+ const [Am, Lm, Dm, Um] = chain(p, [[[[3, 6], [6, 16]], { name: 'A =' }], [[[1, 0], [2, 1]], { name: '=', under: 'L' }], [[[3, 0], [0, 4]], { under: 'D' }], [[[1, 2], [0, 1]], { under: 'U' }]], 110, 640, m('ldu'), { size: 32, cw: 52, rh: 46, gap: 24, step: .4 });
const rl = Lm.ring(1, 0, m('mirror'), { color: COL.chalk }), ru = Um.ring(0, 1, m('mirror') + .6, { color: COL.chalk });
pulse(rl, m('mirror') + 2.4); pulse(ru, m('mirror') + 2.4);
Lm.glow(m('ldu') + 2.2); Dm.glow(m('ldu') + 3.8); Um.glow(m('ldu') + 5.6);
@@ -345,7 +373,9 @@ const BEATS = [
em.Pt.flash(1, m('go') + 2.8); em.Pt.flash(2, m('go') + 2.8);
const Lm = mat(p, [[1, 0, 0], [3, 1, 0], [0, 2, 1]], 400, 500, m('L'), { size: 30, cw: 46, rh: 44, name: 'L =' });
[[1, 0], [2, 0], [2, 1]].forEach(([i, j], k) => Lm.ring(i, j, m('L') + .8 + .6 * k, { dash: true }));
- say(p, ['A = L D U'], 400, 700, m('ldu'), { size: 40 });
+ const [A3, L3m, D3m, U3m] = chain(p, [[LEC3.A, { name: 'A =' }], [[[1, 0, 0], [3, 1, 0], [0, 2, 1]], { name: '=', under: 'L' }], [[[1, 0, 0], [0, 2, 0], [0, 0, 5]], { under: 'D' }], [[[1, 2, 1], [0, 1, -1], [0, 0, 1]], { under: 'U' }]], 110, 660, m('ldu'), { size: 26, cw: 40, rh: 36, gap: 18, step: .4 });
+ L3m.glow(m('chk') + .3, 2.5); A3.glow(m('chk') + 9, 2.5);
+ say(p, ['row 2 of A: 3 × (1, 2, 1) + (0, 2, −2) = (3, 8, 1)'], 110, 830, m('chk') + 1, { size: 30 });
}],
['zero', 'A zero pivot', (m) => {
diff --git a/site/linear-algebra/ch33/audio/en/b4.mp3 b/site/linear-algebra/ch33/audio/en/b4.mp3
new file mode 100644
index 0000000..a23a7d0
Binary files /dev/null and b/site/linear-algebra/ch33/audio/en/b4.mp3 differ
diff --git a/site/linear-algebra/ch33/audio/en/double.mp3 b/site/linear-algebra/ch33/audio/en/double.mp3
index 35c0118..2090a27 100644
Binary files a/site/linear-algebra/ch33/audio/en/double.mp3 and b/site/linear-algebra/ch33/audio/en/double.mp3 differ
diff --git a/site/linear-algebra/ch33/audio/en/keep.mp3 b/site/linear-algebra/ch33/audio/en/keep.mp3
new file mode 100644
index 0000000..72b2c1f
Binary files /dev/null and b/site/linear-algebra/ch33/audio/en/keep.mp3 differ
diff --git a/site/linear-algebra/ch33/audio/en/pyr.mp3 b/site/linear-algebra/ch33/audio/en/pyr.mp3
index 96a91f4..ad31332 100644
Binary files a/site/linear-algebra/ch33/audio/en/pyr.mp3 and b/site/linear-algebra/ch33/audio/en/pyr.mp3 differ
diff --git a/site/linear-algebra/ch33/audio/en/right.mp3 b/site/linear-algebra/ch33/audio/en/right.mp3
index 53071a4..628d990 100644
Binary files a/site/linear-algebra/ch33/audio/en/right.mp3 and b/site/linear-algebra/ch33/audio/en/right.mp3 differ
diff --git a/site/linear-algebra/ch33/audio/en/timings.js b/site/linear-algebra/ch33/audio/en/timings.js
index 2319aa0..5f9c06f 100644
--- a/site/linear-algebra/ch33/audio/en/timings.js
+++ b/site/linear-algebra/ch33/audio/en/timings.js
@@ -294,16 +294,16 @@ window.TIMINGS = {
]
},
"pyr": {
- "dur": 41.712,
+ "dur": 47.184,
"marks": {
- "stack": 1.172,
- "l1": 5.495,
- "l2": 11.628,
- "all": 15.469,
- "box": 19.01,
- "cone": 23.307,
- "third": 28.62,
- "steps": 36.432
+ "stack": 1.211,
+ "l1": 5.534,
+ "l2": 11.393,
+ "all": 14.909,
+ "box": 18.672,
+ "cone": 22.799,
+ "third": 28.203,
+ "steps": 36.055
},
"cues": [
[
@@ -311,44 +311,48 @@ window.TIMINGS = {
"Why a third?"
],
[
- 1.172,
+ 1.211,
"Stack the steps on top of the matrix, one layer for each step."
],
[
- 5.495,
+ 5.534,
"The first layer covers the corner the first step works on."
],
[
- 9.102,
+ 8.971,
"Each square on it is one operation."
],
[
- 11.628,
+ 11.393,
"The second layer sits on top, one smaller each way."
],
[
- 15.469,
+ 14.909,
"Then the third, and so on, up to the last little step."
],
[
- 19.01,
+ 18.672,
"The layers build a staircase inside a box, n by n by n."
],
[
- 23.307,
+ 22.799,
"The staircase hugs a pyramid, with a base n by n and a height of n."
],
[
- 28.62,
+ 28.203,
"A pyramid holds one third of its box: base times height, divided by three."
],
[
- 34.206,
+ 33.724,
"That's n cubed over three."
],
[
- 36.432,
- "The steps leave out a sliver along the edges: that's the minus n over three."
+ 36.055,
+ "The steps stick out of the pyramid in some places and fall short in others."
+ ],
+ [
+ 40.82,
+ "All together they come to just n over three less: seventy, against seventy-two."
]
]
},
@@ -367,13 +371,17 @@ window.TIMINGS = {
]
},
"double": {
- "dur": 28.8,
+ "dur": 50.088,
"marks": {
- "ten": 3.151,
- "twenty": 6.458,
- "eight": 9.922,
- "big": 16.68,
- "huge": 24.518
+ "ten": 3.229,
+ "twenty": 6.523,
+ "eight": 9.909,
+ "five": 16.927,
+ "back": 20.898,
+ "triple": 25.247,
+ "thirty": 29.792,
+ "big": 38.086,
+ "huge": 45.99
},
"cues": [
[
@@ -381,48 +389,78 @@ window.TIMINGS = {
"What happens when the matrix gets twice as big?"
],
[
- 3.151,
+ 3.229,
"Ten by ten: three hundred thirty operations."
],
[
- 6.458,
+ 6.523,
"Twenty by twenty: two thousand six hundred sixty."
],
[
- 9.922,
+ 9.909,
"That's eight times as many, because two cubed is eight."
],
[
- 13.724,
+ 14.01,
"Twice the size, eight times the work."
],
[
- 16.68,
+ 16.927,
+ "Check it from a smaller start."
+ ],
+ [
+ 18.815,
+ "Five by five: forty."
+ ],
+ [
+ 20.898,
+ "Ten by ten: three hundred thirty."
+ ],
+ [
+ 23.568,
+ "About eight times again."
+ ],
+ [
+ 25.247,
+ "And three times the size?"
+ ],
+ [
+ 27.474,
+ "Three cubed is twenty-seven."
+ ],
+ [
+ 29.792,
+ "Thirty by thirty: eight thousand nine hundred ninety."
+ ],
+ [
+ 34.128,
+ "That's about twenty-seven times the three hundred thirty for ten."
+ ],
+ [
+ 38.086,
"A thousand by a thousand takes about three hundred thirty-three million operations."
],
[
- 21.589,
+ 43.099,
"A computer does that in well under a second."
],
[
- 24.518,
+ 45.99,
"But a million by a million would keep a fast computer busy for days."
]
]
},
"right": {
- "dur": 44.112,
+ "dur": 27.672,
"marks": {
- "b": 1.68,
- "f1": 6.836,
- "f2": 10.378,
- "back": 11.693,
- "r3": 14.349,
- "r2": 16.354,
- "r1": 20.169,
- "nine": 23.021,
- "cheap": 30.378,
- "lu": 36.745
+ "b": 1.745,
+ "f1": 6.615,
+ "f2": 10.182,
+ "back": 11.432,
+ "r3": 14.232,
+ "r2": 16.497,
+ "r1": 20.391,
+ "nine": 23.151
},
"cues": [
[
@@ -430,47 +468,129 @@ window.TIMINGS = {
"And the right side, b?"
],
[
- 1.68,
+ 1.745,
"Each step changes just one number of b in every row below the pivot."
],
[
- 6.836,
+ 6.615,
"For three by three: two numbers in the first step, one in the second."
],
[
- 11.693,
+ 11.432,
"Then back substitution, from the bottom up."
],
[
- 14.349,
+ 14.232,
"Row three: one division."
],
[
- 16.354,
+ 16.497,
"Row two: one multiply-subtract, and a division."
],
[
- 20.169,
+ 20.391,
"Row one: two, and a division."
],
[
- 23.021,
- "Three plus six: nine operations, three squared."
+ 23.151,
+ "Three plus six: nine operations."
],
[
- 27.253,
- "For any n, b costs n squared."
+ 26.068,
+ "That's three squared."
+ ]
+ ]
+ },
+ "b4": {
+ "dur": 22.272,
+ "marks": {
+ "f1": 2.018,
+ "f2": 5.208,
+ "f3": 6.862,
+ "back": 9.062,
+ "r4": 11.589,
+ "r3": 12.201,
+ "r2": 12.487,
+ "r1": 13.008,
+ "sum": 14.688,
+ "any": 18.398
+ },
+ "cues": [
+ [
+ 0.104,
+ "Check it on four by four."
],
[
- 30.378,
+ 2.018,
+ "Forward: three numbers of b change in the first step, two in the second, one in the third."
+ ],
+ [
+ 8.086,
+ "Six."
+ ],
+ [
+ 9.062,
+ "Back substitution, from the bottom up: one, two, three, four."
+ ],
+ [
+ 13.906,
+ "Ten."
+ ],
+ [
+ 14.688,
+ "Six plus ten is sixteen: four squared."
+ ],
+ [
+ 18.398,
+ "For any n, the right side costs n squared."
+ ]
+ ]
+ },
+ "keep": {
+ "dur": 38.136,
+ "marks": {
+ "cheap": 0.104,
+ "ex": 7.305,
+ "once": 11.849,
+ "tenb": 16.914,
+ "redo": 21.536,
+ "lu": 30.456
+ },
+ "cues": [
+ [
+ 0.104,
"So a new right side is cheap: n squared, against n cubed over three for A."
],
[
- 36.745,
+ 7.305,
+ "Say A is a hundred by a hundred, and ten different right sides arrive."
+ ],
+ [
+ 11.849,
+ "Factor A once: about three hundred thirty-three thousand operations."
+ ],
+ [
+ 16.914,
+ "Then each b costs ten thousand."
+ ],
+ [
+ 19.414,
+ "Ten of them: a hundred thousand."
+ ],
+ [
+ 21.536,
+ "Start from scratch for every b instead, and you pay for A ten times: about three point four million."
+ ],
+ [
+ 29.01,
+ "Eight times the work."
+ ],
+ [
+ 30.456,
"That's why we keep L and U."
],
[
- 38.32,
+ 32.24,
"We factor A once, the expensive part, and then every new b costs only n squared."
]
]
diff --git a/site/linear-algebra/ch33/index.html b/site/linear-algebra/ch33/index.html
index b8f90a5..8b10b2c 100644
--- a/site/linear-algebra/ch33/index.html
+++ b/site/linear-algebra/ch33/index.html
@@ -36,6 +36,28 @@ const cellGlow = (p, { x, y, w }, n, cells, at, len = 2) => {
show(g, at, .25); hide(g, at + len, .4);
return g;
};
+// [U | b] as cells (j = n is b); on(cells, at) lights cells like '13' (row 1, column 3) for a moment; count([[at, v]]) sets the counter
+const ubGrid = (p, U, x0, y0, cs, t0, { blank = false, cy = 590 } = {}) => {
+ const n = U.length, cell = (i, j) => [x0 + j * cs + (j === n ? 24 : 0), y0 + i * cs];
+ const g = G(p, { o: 0 }); show(g, t0, .5);
+ const lit = {};
+ for (let i = 0; i < n; i++) for (let j = 0; j <= n; j++) {
+ const [x, y] = cell(i, j);
+ mk('rect', { x, y, width: cs, height: cs, fill: COL.chalk, 'fill-opacity': j === n ? .14 : (i > j ? .03 : .08), stroke: COL.faint, 'stroke-width': 1.5 }, g);
+ const hl = mk('rect', { x: x + 4, y: y + 4, width: cs - 8, height: cs - 8, rx: 8, fill: COL.chalk, 'fill-opacity': .5 }, g);
+ put(hl, { o: 0 }); lit[`${i}${j}`] = hl;
+ const lab = j === n ? [`b${'₁₂₃₄'[i]}`] : (blank && i <= j ? null : [num(U[i][j])]);
+ if (lab) M(g, lab, { x: x + cs / 2, y: y + cs / 2 + 13, size: 36, fill: j === n ? COL.task : (i > j ? COL.faint : COL.chalk), anchor: 'middle' });
+ }
+ path(g, `M${x0 + n * cs + 12} ${y0 - 6}V${y0 + n * cs + 6}`, { stroke: COL.dim, 'stroke-width': 2.5, 'stroke-dasharray': '6 6' });
+ const on = (cells, at, len = 2.2) => cells.forEach(k => { tw(lit[k], { o: 1 }, at, .25); tw(lit[k], { o: .35 }, at + len, .5); });
+ const cnt = G(p, { o: 0 }); show(cnt, t0, .4);
+ T(cnt, 'operations on b:', { x: x0, y: cy, size: 30, weight: 600 });
+ const cv = G(cnt, {});
+ let shown = -1;
+ const count = list => [[0, 0], ...list].forEach(([t, v]) => prog(q => { if (q > 0 && shown !== v) { shown = v; cv.replaceChildren(); T(cv, String(v), { x: x0 + 260, y: cy, size: 34, fill: COL.task, weight: 700 }); } }, t, 0, lin));
+ return { on, count };
+};
const curveFlash = (ce, at) => { tw(ce.parts.curve, { 'a_stroke-width': 7 }, at, .3); tw(ce.parts.curve, { 'a_stroke-width': 3 }, at + 1.4, .5); };
/* ---------- practice data (every count done twice: step by step, and by (n³ − n)/3) ---------- */
@@ -127,11 +149,11 @@ const BEATS = [
const ce = cost(p, { n: 4, grid: { x: 130, y: 210, w: 320 }, chart: { ...CHART, N: 5 }, read: { x: 530, y: 260 }, t0: .3 });
quietRead(ce); ce.set({ c: 0 });
ce.count(1, m('s1') + .3, 3, lin);
- text(p, '3 rows × 4 numbers = 12', 530, 420, m('s1') + .5, { size: 30, weight: 600 });
+ text(p, 'step 1: 3 rows × 4 numbers = 12', 530, 420, m('s1') + .5, { size: 30, weight: 600 });
ce.count(2, m('s2') + .2, 2, lin);
- text(p, '2 rows × 3 numbers = 6', 530, 470, m('s2') + .4, { size: 30, weight: 600 });
+ text(p, 'step 2: 2 rows × 3 numbers = 6', 530, 470, m('s2') + .4, { size: 30, weight: 600 });
ce.count(3, m('s3') + .2, 1, lin);
- text(p, '1 row × 2 numbers = 2', 530, 520, m('s3') + .4, { size: 30, weight: 600 });
+ text(p, 'step 3: 1 row × 2 numbers = 2', 530, 520, m('s3') + .4, { size: 30, weight: 600 });
text(p, 'total: 12 + 6 + 2 = 20', 530, 580, m('tot'), { size: 30, weight: 600 });
say(p, ['a k × k corner: (k − 1) · k ≈ k²'], 130, 660, m('pat'), { size: 32 });
const GR4 = { x: 130, y: 210, w: 320 }, blk = (r0, c0) => { const o = []; for (let i = r0; i < 4; i++) for (let j = c0; j < 4; j++) o.push([i, j]); return o; };
@@ -205,41 +227,29 @@ const BEATS = [
['double', 'Twice the size', (m) => {
const p = panel(0);
- title(p, 'Twice the size');
+ title(p, 'Twice the size, and three times');
const ce = cost(p, { n: 10, chart: { x: 760, y: 780, w: 760, h: 560, N: 10 }, read: { x: 90, y: 260 }, t0: .3 });
quietRead(ce, ['n', 'ops', 'third']);
ce.to({ n: 20 }, m('twenty') + .2, 2.6, lin);
- say(p, ['2660 ÷ 330 ≈ 8 = 2³'], 90, 470, m('eight'), { size: 34 });
- say(p, ['twice n: × 8'], 90, 530, m('eight') + 4, { size: 34, fill: COL.chalk });
+ const r1 = say(p, ['2660 ÷ 330 ≈ 8 = 2³'], 90, 450, m('eight'), { size: 34 });
+ const r2 = say(p, ['twice n: × 8'], 90, 505, m('eight') + 4, { size: 34 });
+ ce.to({ n: 5 }, m('five') + 1.6, .4); ce.to({ n: 10 }, m('back') + .1, 1.4, lin);
+ const r3 = say(p, ['330 ÷ 40 ≈ 8'], 90, 570, m('back') + 2, { size: 34 });
+ ce.to({ n: 30 }, m('thirty') + .1, 2.8, lin);
+ const r4 = say(p, ['8990 ÷ 330 ≈ 27 = 3³'], 90, 650, m('thirty') + 3.2, { size: 34 });
+ const r5 = say(p, ['three times n: × 27'], 90, 705, m('thirty') + 5, { size: 34 });
+ [r1, r2, r3, r4, r5].forEach(e => hide(e, m('big') - .2, .5));
curveFlash(ce, m('ten') + .5);
- text(p, '1000 × 1000: about 333,333,333 operations', 90, 600, m('big') + .5, { size: 28, weight: 600 });
- text(p, 'well under a second on a computer', 90, 645, m('big') + 5, { size: 26, fill: COL.dim, weight: 600 });
- text(p, 'a million × a million: days', 90, 730, m('huge') + .5, { size: 28, weight: 600 });
+ text(p, '1000 × 1000: about 333 million operations', 90, 470, m('big') + .5, { size: 28, weight: 600 });
+ text(p, 'well under a second on a computer', 90, 515, m('big') + 5, { size: 26, fill: COL.dim, weight: 600 });
+ text(p, 'a million × a million: days', 90, 600, m('huge') + .5, { size: 28, weight: 600 });
}],
['right', 'And b?', (m) => {
const p = panel(0);
title(p, 'And the right side b?');
- const cs = 96, x0 = 140, y0 = 220, cell = (i, j) => [x0 + j * cs + (j === 3 ? 24 : 0), y0 + i * cs];
- const U = [[2, 1, 1], [0, 1, 1], [0, 0, 2]], bb = ['b₁', 'b₂', 'b₃'];
- const g = G(p, { o: 0 }); show(g, .4, .5);
- const lit = {};
- for (let i = 0; i < 3; i++) for (let j = 0; j < 4; j++) {
- const [x, y] = cell(i, j);
- const r = mk('rect', { x, y, width: cs, height: cs, fill: COL.chalk, 'fill-opacity': j === 3 ? .14 : .08, stroke: COL.faint, 'stroke-width': 1.5 }, g);
- const hl = mk('rect', { x: x + 4, y: y + 4, width: cs - 8, height: cs - 8, rx: 8, fill: COL.chalk, 'fill-opacity': .5 }, g);
- put(hl, { o: 0 }); lit[`${i}${j}`] = hl;
- M(g, j === 3 ? [bb[i]] : [num(U[i][j])], { x: x + cs / 2, y: y + cs / 2 + 13, size: 36, fill: j === 3 ? COL.task : (i > j ? COL.faint : COL.chalk), anchor: 'middle' });
- }
- path(g, `M${x0 + 3 * cs + 12} ${y0 - 6}V${y0 + 3 * cs + 6}`, { stroke: COL.dim, 'stroke-width': 2.5, 'stroke-dasharray': '6 6' });
- const on = (cells, at, len = 2.2) => cells.forEach(k => { tw(lit[k], { o: 1 }, at, .25); tw(lit[k], { o: .35 }, at + len, .5); });
- // the counter: 0 → 2 → 3 (forward), → 4 → 6 → 9 (back)
- const cnt = G(p, { o: 0 }); show(cnt, m('b'), .4);
- T(cnt, 'operations on b:', { x: 140, y: 590, size: 30, weight: 600 });
- const cv = G(cnt, {});
- let shown = -1;
- const counts = [[0, 0], [m('f1') + .6, 2], [m('f2') + .5, 3], [m('r3') + .6, 4], [m('r2') + .8, 6], [m('r1') + .8, 9]];
- counts.forEach(([t, v]) => prog(q => { if (q > 0 && shown !== v) { shown = v; cv.replaceChildren(); T(cv, String(v), { x: 400, y: 590, size: 34, fill: COL.task, weight: 700 }); } }, t, 0, lin));
+ const { on, count } = ubGrid(p, [[2, 1, 1], [0, 1, 1], [0, 0, 2]], 140, 220, 96, .4);
+ count([[m('f1') + .6, 2], [m('f2') + .5, 3], [m('r3') + .6, 4], [m('r2') + .8, 6], [m('r1') + .8, 9]]);
on(['13', '23'], m('f1') + .3);
on(['23'], m('f2') + .3);
text(p, 'forward: 2 + 1 = 3', 600, 300, m('f2') + 1.2, { size: 28, weight: 600 });
@@ -247,14 +257,52 @@ const BEATS = [
on(['11', '12', '13'], m('r2') + .3);
on(['00', '01', '02', '03'], m('r1') + .3);
text(p, 'back: 1 + 2 + 3 = 6', 600, 350, m('r1') + 1.5, { size: 28, weight: 600 });
- say(p, ['3 + 6 = 9 = 3²: b costs n²'], 600, 420, m('nine') + .5, { size: 32 });
- on(['03', '13', '23'], m('nine') + 2.4, 2.6);
- const tb = G(p, { o: 0 }); show(tb, m('cheap'), .5);
- const tbh = mk('rect', { x: 588, y: 612, width: 820, height: 44, rx: 10, fill: COL.chalk, 'fill-opacity': .13 }, tb); put(tbh, { o: 0 });
- tw(tbh, { o: 1 }, m('cheap') + 3.5, .3); tw(tbh, { o: 0 }, m('lu') + 4, .6);
- [['n', 'A: about n³/3', 'b: n²'], ['10', '330', '100'], ['1000', '333,333,000', '1,000,000']].forEach((row, i) => row.forEach((s, j) =>
- T(tb, s, { x: 600 + [0, 150, 480][j], y: 520 + i * 50, size: 28, fill: i ? COL.chalk : COL.dim, weight: 600 })));
- text(p, 'factor A = LU once; each new b: n² only', 140, 760, m('lu') + 1, { size: 30, weight: 600 });
+ say(p, ['3 + 6 = 9 = 3²'], 600, 420, m('nine') + .5, { size: 32 });
+ on(['03', '13', '23'], m('nine') + 1.6, 2.6);
+ }],
+
+ ['b4', 'b for 4 × 4', (m) => {
+ const p = panel(0);
+ title(p, 'The right side of a 4 × 4');
+ const { on, count } = ubGrid(p, [[1, 1, 1, 1], [0, 1, 1, 1], [0, 0, 1, 1], [0, 0, 0, 1]], 140, 200, 84, .3, { blank: true, cy: 600 });
+ count([[m('f1') + .6, 3], [m('f2') + .4, 5], [m('f3') + .4, 6], [m('r4') + .2, 7], [m('r3') + .2, 9], [m('r2') + .2, 12], [m('r1') + .2, 16]]);
+ on(['14', '24', '34'], m('f1') + .3, 1.6);
+ on(['24', '34'], m('f2') + .2, 1.2);
+ on(['34'], m('f3') + .2, 1.2);
+ text(p, 'forward: 3 + 2 + 1 = 6', 640, 280, m('f3') + 1, { size: 28, weight: 600 });
+ on(['33', '34'], m('r4'), 1.4);
+ on(['22', '23', '24'], m('r3'), 1.4);
+ on(['11', '12', '13', '14'], m('r2'), 1.4);
+ on(['00', '01', '02', '03', '04'], m('r1'), 1.6);
+ text(p, 'back: 1 + 2 + 3 + 4 = 10', 640, 330, m('r1') + .8, { size: 28, weight: 600 });
+ say(p, ['6 + 10 = 16 = 4²'], 640, 400, m('sum') + .3, { size: 32 });
+ say(p, ['n × n: b costs n²'], 640, 470, m('any') + .3, { size: 34 });
+ on(['04', '14', '24', '34'], m('any') + .6, 2.4);
+ }],
+
+ ['keep', 'Keep L and U', (m) => {
+ const p = panel(0);
+ title(p, 'Factor once, keep L and U');
+ const tb = G(p, { o: 0 }); show(tb, m('cheap') + .3, .5);
+ const tbh = mk('rect', { x: 128, y: 284, width: 900, height: 46, rx: 10, fill: COL.chalk, 'fill-opacity': .13 }, tb); put(tbh, { o: 0 });
+ tw(tbh, { o: 1 }, m('ex') + .3, .3);
+ // the voice compares the columns: b's n² first, then A's
+ [[688, m('cheap') + 1.2], [318, m('cheap') + 3.6]].forEach(([x, at]) => { const c = mk('rect', { x, y: 186, width: 300, height: 196, rx: 12, fill: 'none', stroke: COL.chalk, 'stroke-width': 3 }, p); put(c, { o: 0 }); show(c, at, .3); hide(c, at + 2.2, .4); });
+ [['n', 'A: (n³ − n)/3', 'b: n²'], ['10', '330', '100'], ['100', '333,300', '10,000'], ['1000', '333,333,000', '1,000,000']].forEach((row, i) => row.forEach((str, j) =>
+ T(tb, str, { x: 140 + [0, 190, 560][j], y: 220 + i * 50, size: 28, fill: i ? COL.chalk : COL.dim, weight: 600 })));
+ // two bars to scale: 1 × A + 10 × b, against 10 × (A + b)
+ const X = 140, W = 1320, k = W / 3433000, wA = 333300 * k, wb = 10000 * k, H = 56;
+ const blk = (g, x, w, fill, at, op = .55) => { const r = mk('rect', { x, y: 0, width: w, height: H, fill, 'fill-opacity': op, stroke: COL.board, 'stroke-width': 1 }, g); put(r, { o: 0 }); show(r, at, .2); return r; };
+ const b1 = G(p, { y: 500 }), b2 = G(p, { y: 670 });
+ const l1 = G(p, { o: 0 }); show(l1, m('once'), .4);
+ T(l1, 'factor A once, then 10 right sides:', { x: X, y: 482, size: 28, weight: 600 }); T(l1, '333,300', { x: X + 600, y: 482, size: 28, fill: COL.task, weight: 700 });
+ text(p, '+ 10 × 10,000 = 433,300', X + 722, 482, m('tenb') + .4, { size: 28, fill: COL.task, weight: 700 });
+ blk(b1, X, wA, COL.chalk, m('once') + .4);
+ for (let i = 0; i < 10; i++) blk(b1, X + wA + i * wb, wb, COL.task, m('tenb') + .4 + i * .25, .9);
+ const l2 = G(p, { o: 0 }); show(l2, m('redo'), .4);
+ T(l2, 'start over for every b:', { x: X, y: 652, size: 28, weight: 600 }); T(l2, '10 × 343,300 = 3,433,000', { x: X + 600, y: 652, size: 28, fill: COL.task, weight: 700 });
+ for (let i = 0; i < 10; i++) { const x = X + i * (wA + wb); blk(b2, x, wA, COL.chalk, m('redo') + .5 + i * .45); blk(b2, x + wA, wb, COL.task, m('redo') + .5 + i * .45, .9); }
+ text(p, 'factor A = LU once; each new b: n² only', 140, 820, m('lu') + 1, { size: 30, weight: 600 });
}],
['q3', 'Quick check', () => {
@@ -307,7 +355,7 @@ const BEATS = [
['play', 'Playground', (m) => {
const p = panel(0);
title(p, 'Playground');
- const ce = cost(p, { n: 5, grid: { x: 420, y: 170, w: 170 }, pyr: { x: 760, y: 780, size: 300 }, chart: { x: 1080, y: 780, w: 440, h: 480, N: 10 }, read: { x: 70, y: 200, gap: 46, size: 30 } });
+ const ce = cost(p, { n: 5, grid: { x: 420, y: 170, w: 170 }, pyr: { x: 725, y: 780, size: 280 }, chart: { x: 1120, y: 780, w: 420, h: 480, N: 10 }, read: { x: 70, y: 200, gap: 46, size: 30 } });
S.ce = ce;
const hint = text(p, 'try: n = 2; n = 20; n = 60', 300, 110, m('go'), { size: 24, fill: COL.dim });
hide(hint, m('go') + 7, .6);
diff --git a/site/linear-algebra/ch34/audio/en/both.mp3 b/site/linear-algebra/ch34/audio/en/both.mp3
index dbe1c3e..cbce200 100644
Binary files a/site/linear-algebra/ch34/audio/en/both.mp3 and b/site/linear-algebra/ch34/audio/en/both.mp3 differ
diff --git a/site/linear-algebra/ch34/audio/en/ex2.mp3 b/site/linear-algebra/ch34/audio/en/ex2.mp3
index 06ed014..1538623 100644
Binary files a/site/linear-algebra/ch34/audio/en/ex2.mp3 and b/site/linear-algebra/ch34/audio/en/ex2.mp3 differ
diff --git a/site/linear-algebra/ch34/audio/en/inv.mp3 b/site/linear-algebra/ch34/audio/en/inv.mp3
index afc52e0..a08947f 100644
Binary files a/site/linear-algebra/ch34/audio/en/inv.mp3 and b/site/linear-algebra/ch34/audio/en/inv.mp3 differ
diff --git a/site/linear-algebra/ch34/audio/en/stuck.mp3 b/site/linear-algebra/ch34/audio/en/stuck.mp3
new file mode 100644
index 0000000..2430fe1
Binary files /dev/null and b/site/linear-algebra/ch34/audio/en/stuck.mp3 differ
diff --git a/site/linear-algebra/ch34/audio/en/timings.js b/site/linear-algebra/ch34/audio/en/timings.js
index 6a44500..51b10d6 100644
--- a/site/linear-algebra/ch34/audio/en/timings.js
+++ b/site/linear-algebra/ch34/audio/en/timings.js
@@ -83,36 +83,70 @@ window.TIMINGS = {
]
},
"why": {
- "dur": 25.536,
+ "dur": 55.752,
"marks": {
- "row1": 3.932,
- "piv": 11.302,
- "zero": 14.388,
- "so": 18.008
+ "lu": 2.5,
+ "row1": 14.427,
+ "row2": 21.12,
+ "try": 29.375,
+ "fail": 36.797,
+ "so": 44.466
},
"cues": [
[
0.104,
- "Why not A equals L U, for A itself?"
+ "Why can't we factor A itself?"
],
[
- 3.932,
- "In L times U, row one of L is one, zero, zero, so row one of the product is row one of U."
+ 2.5,
+ "Take any L and U, two by two."
],
[
- 11.302,
- "That makes the top left number of A the first pivot."
+ 5.768,
+ "L has ones on its diagonal and a multiplier, ell, below them."
],
[
- 14.388,
- "Here it's zero, and a pivot is never zero."
+ 10.638,
+ "U has its first pivot p, then q, and r."
],
[
- 18.008,
+ 14.427,
+ "Row one of L is one, zero, so row one of L U is just row one of U: p, q."
+ ],
+ [
+ 21.12,
+ "Row two of L is ell, one: ell times p, q, plus zero, r."
+ ],
+ [
+ 26.536,
+ "So row two of L U starts with ell times p."
+ ],
+ [
+ 29.375,
+ "Now try to make our A."
+ ],
+ [
+ 31.042,
+ "Its row one is zero, two, so p must be zero, and q must be two."
+ ],
+ [
+ 36.797,
+ "Then row two of L U starts with ell times zero, which is zero, whatever ell is."
+ ],
+ [
+ 42.305,
+ "But row two of A starts with three."
+ ],
+ [
+ 44.466,
"So no L and U multiply to this A."
],
[
- 20.99,
+ 47.656,
+ "A zero in the first pivot spot rules it out."
+ ],
+ [
+ 51.068,
"We factor P A instead: the same rows, in a good order."
]
]
@@ -215,16 +249,17 @@ window.TIMINGS = {
]
},
"both": {
- "dur": 47.688,
+ "dur": 55.512,
"marks": {
- "left": 5.286,
- "pa": 9.766,
- "right": 14.87,
- "r1": 17.904,
- "r2": 23.086,
- "r3": 32.096,
- "eq": 40.573,
- "pic": 43.125
+ "left": 5.078,
+ "pa": 9.388,
+ "right": 14.245,
+ "r1": 17.279,
+ "r2": 22.786,
+ "r3": 31.471,
+ "eq": 39.896,
+ "pic": 42.448,
+ "c": 46.901
},
"cues": [
[
@@ -232,44 +267,48 @@ window.TIMINGS = {
"Now check P A equals L U, by multiplying out both sides."
],
[
- 5.286,
+ 5.078,
"The left side: P takes rows one, three and two of A."
],
[
- 9.766,
+ 9.388,
"One, two, one; three, seven, five; two, four, three."
],
[
- 14.87,
+ 14.245,
"The right side: L times U, row by row."
],
[
- 17.904,
+ 17.279,
"Row one of L is one, zero, zero: just row one of U, one, two, one."
],
[
- 23.086,
+ 22.786,
"Row two of L is three, one, zero: three times one, two, one, plus zero, one, two."
],
[
- 29.766,
+ 29.089,
"That's three, seven, five."
],
[
- 32.096,
+ 31.471,
"Row three is two, zero, one: two times one, two, one, plus zero, zero, one."
],
[
- 39.141,
+ 38.425,
"Two, four, three."
],
[
- 40.573,
+ 39.896,
"Both sides match, number by number."
],
[
- 43.125,
+ 42.448,
"And in the picture, L turns U's planes back into the planes of P A."
+ ],
+ [
+ 46.901,
+ "The right side follows too: L turns one, one, one, what elimination made of b, back into P b: one, four, three."
]
]
},
@@ -288,16 +327,16 @@ window.TIMINGS = {
]
},
"ex2": {
- "dur": 54.816,
+ "dur": 56.976,
"marks": {
- "A": 3.073,
- "zero": 8.268,
- "swap": 10.742,
- "l21": 16.419,
- "l31": 23.255,
- "l32": 28.737,
- "LU": 33.945,
- "check": 44.219
+ "A": 2.956,
+ "zero": 8.372,
+ "swap": 10.833,
+ "l21": 16.341,
+ "l31": 23.32,
+ "l32": 29.01,
+ "LU": 34.219,
+ "check": 44.349
},
"cues": [
[
@@ -305,48 +344,52 @@ window.TIMINGS = {
"Another one, with the zero right at the start."
],
[
- 3.073,
+ 2.956,
"A is zero, one, one; one, two, one; two, seven, nine."
],
[
- 8.268,
+ 8.372,
"The first pivot spot is zero."
],
[
- 10.742,
+ 10.833,
"Row two has a one there, so exchange rows one and two: P is P one two."
],
[
- 16.419,
+ 16.341,
"Now eliminate P A."
],
[
- 18.828,
+ 18.75,
"Row two already starts with zero: its multiplier is zero."
],
[
- 23.255,
+ 23.32,
"Row three minus two times row one: zero, three, seven."
],
[
- 28.737,
+ 29.01,
"Row three minus three times row two: zero, zero, four."
],
[
- 33.945,
+ 34.219,
"L has zero, two and three below its diagonal."
],
[
- 38.255,
+ 38.398,
"U is one, two, one; zero, one, one; zero, zero, four."
],
[
- 44.219,
+ 44.349,
"Check row three of L U: two times row one of U, plus three times row two, plus row three."
],
[
- 51.341,
+ 51.25,
"Two, seven, nine: row three of P A."
+ ],
+ [
+ 54.844,
+ "So P A equals L U."
]
]
},
@@ -364,6 +407,61 @@ window.TIMINGS = {
]
]
},
+ "stuck": {
+ "dur": 44.016,
+ "marks": {
+ "A": 1.471,
+ "c1": 11.341,
+ "zero": 18.49,
+ "below": 21.185,
+ "none": 25.846,
+ "line": 30.286,
+ "pts": 34.505,
+ "rule": 38.633
+ },
+ "cues": [
+ [
+ 0.104,
+ "Can a P always help?"
+ ],
+ [
+ 1.471,
+ "Take x plus two y plus z equals one, two x plus four y plus three z equals three, and three x plus six y plus five z equals five."
+ ],
+ [
+ 11.341,
+ "Column one: row two minus two times row one, and row three minus three times row one."
+ ],
+ [
+ 18.49,
+ "The second pivot spot holds a zero."
+ ],
+ [
+ 21.185,
+ "Look below it: zero again."
+ ],
+ [
+ 23.737,
+ "No row has a y left to give."
+ ],
+ [
+ 25.846,
+ "No exchange can bring a pivot into this column, so no P can help."
+ ],
+ [
+ 30.286,
+ "The picture says why: the three planes don't meet at one point."
+ ],
+ [
+ 34.505,
+ "They share a whole line, and every point on it is a solution."
+ ],
+ [
+ 38.633,
+ "A P can fix a zero pivot only when a number that is not zero sits below it."
+ ]
+ ]
+ },
"q3": {
"dur": 2.352,
"marks": {},
@@ -379,16 +477,22 @@ window.TIMINGS = {
]
},
"inv": {
- "dur": 51.264,
+ "dur": 68.856,
"marks": {
- "undo": 1.836,
- "cycle": 11.992,
- "back": 20.99,
- "flip": 28.828,
- "name": 35.091,
- "check": 39.779,
- "rule": 43.607,
- "next": 48.372
+ "undo": 1.81,
+ "cycle": 11.667,
+ "c1": 20.456,
+ "c2": 22.279,
+ "c3": 24.31,
+ "back": 26.589,
+ "b1": 30.039,
+ "b2": 36.706,
+ "b3": 41.576,
+ "flip": 46.042,
+ "name": 52.826,
+ "check": 57.383,
+ "rule": 61.133,
+ "next": 65.99
},
"cues": [
[
@@ -396,55 +500,71 @@ window.TIMINGS = {
"One more fact about P."
],
[
- 1.836,
+ 1.81,
"To undo P, put the rows back."
],
[
- 4.544,
+ 4.427,
"For one exchange, P undoes itself: P times P is the identity, as in chapter twenty-two."
],
[
- 11.992,
- "But take P that moves every row: zero, zero, one; one, zero, zero; zero, one, zero."
+ 11.667,
+ "But take a P that moves every row: zero, zero, one; one, zero, zero; zero, one, zero."
+ ],
+ [
+ 20.456,
+ "Row one takes row three, row two takes row one, and row three takes row two."
+ ],
+ [
+ 26.589,
+ "To undo it, fetch each row back from where P put it."
+ ],
+ [
+ 30.039,
+ "The old row one now sits in second place, so the undo's row one is zero, one, zero."
+ ],
+ [
+ 36.706,
+ "The old row two sits in third place: zero, zero, one."
],
[
- 20.99,
- "The matrix that undoes it is zero, one, zero; zero, zero, one; one, zero, zero."
+ 41.576,
+ "And the old row three sits on top: one, zero, zero."
],
[
- 28.828,
- "Look closely: it's P flipped across its diagonal."
+ 46.042,
+ "Now look: the undo is P flipped across its diagonal."
],
[
- 32.656,
+ 50.534,
"Row one of P becomes column one."
],
[
- 35.091,
+ 52.826,
"That flip is called the transpose, written P with a small T."
],
[
- 39.779,
+ 57.383,
"Multiply: P transpose times P is the identity."
],
[
- 43.607,
+ 61.133,
"For every permutation, P inverse is P transpose."
],
[
- 48.372,
+ 65.99,
"Transposes are the subject of the next chapter."
]
]
},
"wrap": {
- "dur": 32.52,
+ "dur": 33.624,
"marks": {
- "w1": 1.016,
- "w2": 9.805,
- "w3": 17.565,
- "w4": 23.997,
- "end": 30.404
+ "w1": 1.042,
+ "w2": 9.596,
+ "w3": 17.174,
+ "w4": 23.88,
+ "end": 31.406
},
"cues": [
[
@@ -452,27 +572,27 @@ window.TIMINGS = {
"Let's sum up."
],
[
- 1.016,
+ 1.042,
"A zero in a pivot spot is fixed by a row exchange, and a permutation P can make every exchange before elimination starts."
],
[
- 9.805,
+ 9.596,
"Then P A equals L U: L holds the multipliers, U the pivots, and no exchange is needed on the way."
],
[
- 17.565,
+ 17.174,
"Check it by multiplying out both sides: P reorders the rows of A, L mixes the rows of U."
],
[
- 23.997,
+ 23.88,
"P inverse is P transpose."
],
[
- 26.875,
- "If no row below has a number, no P can help."
+ 26.589,
+ "And if every number below a zero pivot is zero too, no P can help."
],
[
- 30.404,
+ 31.406,
"Now try the chapter practice."
]
]
diff --git a/site/linear-algebra/ch34/audio/en/why.mp3 b/site/linear-algebra/ch34/audio/en/why.mp3
index 162b73b..28b2ef6 100644
Binary files a/site/linear-algebra/ch34/audio/en/why.mp3 and b/site/linear-algebra/ch34/audio/en/why.mp3 differ
diff --git a/site/linear-algebra/ch34/audio/en/wrap.mp3 b/site/linear-algebra/ch34/audio/en/wrap.mp3
index a4aff59..e9529f7 100644
Binary files a/site/linear-algebra/ch34/audio/en/wrap.mp3 and b/site/linear-algebra/ch34/audio/en/wrap.mp3 differ
diff --git a/site/linear-algebra/ch34/index.html b/site/linear-algebra/ch34/index.html
index f41d462..11c5442 100644
--- a/site/linear-algebra/ch34/index.html
+++ b/site/linear-algebra/ch34/index.html
@@ -26,6 +26,7 @@ const Z3 = { A: [[1, 2, 1], [2, 4, 3], [3, 7, 5]], b: [1, 3, 4] };
const PZ3 = { A: [[1, 2, 1], [3, 7, 5], [2, 4, 3]], b: [1, 4, 3] }; // its rows in the order 1, 3, 2
const U3 = { A: [[1, 2, 1], [0, 1, 2], [0, 0, 1]], b: [1, 1, 1] };
const L3 = [[1, 0, 0], [3, 1, 0], [2, 0, 1]], P23 = [[1, 0, 0], [0, 0, 1], [0, 1, 0]];
+const STUCK = { A: [[1, 2, 1], [2, 4, 3], [3, 6, 5]], b: [1, 3, 5] }; // no P helps: the planes share the line (−2t, t, 1)
const EX2 = { A: [[0, 1, 1], [1, 2, 1], [2, 7, 9]], b: [2, 4, 18] }; // x = (1, 1, 1)
const CYC = [[0, 0, 1], [1, 0, 0], [0, 1, 0]], CYCT = [[0, 1, 0], [0, 0, 1], [1, 0, 0]];
const AT2 = [70, 290], AT3 = [64, 262];
@@ -69,19 +70,21 @@ const mat = (p, rows, x, y, t0, { size = 30, cw = 46, rh = 42, name = '', fill =
const hl = mk('rect', { x: x - 8, y: top - 6, width: w + 16, height: bot - top + 12, rx: 12, fill: COL.chalk, 'fill-opacity': .13 }, g);
put(hl, { o: 0 });
path(g, `M${x + 12} ${top}H${x}V${bot}H${x + 12}M${x + w - 12} ${top}H${x + w}V${bot}H${x + w - 12}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' });
- rows.forEach((r, i) => r.forEach((v, j) => v !== '' && M(g, [num(v)], { x: x + cw * (j + .5), y: y + i * rh, size, fill: fill(i, j), anchor: 'middle' })));
+ rows.forEach((r, i) => r.forEach((v, j) => v !== '' && M(g, [typeof v === 'string' ? v : num(v)], { x: x + cw * (j + .5), y: y + i * rh, size, fill: fill(i, j), anchor: 'middle' })));
if (name) M(g, [].concat(name), { x: x - 14, y: y + (n - 1) * rh / 2 + size * .3, size: size * 1.05, fill: COL.chalk, anchor: 'end' });
if (under) M(g, [under], { x: x + w / 2, y: bot + size * .95, size: 24, fill: COL.dim, anchor: 'middle' });
if (t0 !== null) show(g, t0, .5);
const cx = j => x + cw * (j + .5), ry = i => y + i * rh;
- const ring = (i, j, at, { color = COL.chalk, dash = false } = {}) => {
+ const ring = (i, j, at, { color = COL.chalk, dash = false, rx = cw * .46 } = {}) => {
const rg = G(p, { x: cx(j), y: ry(i) - size * .32, o: 0 });
- mk('ellipse', { rx: cw * .46, ry: size * .66, fill: 'none', stroke: color, 'stroke-width': 3.5, ...(dash ? { 'stroke-dasharray': '7 6' } : {}) }, rg);
+ mk('ellipse', { rx, ry: size * .66, fill: 'none', stroke: color, 'stroke-width': 3.5, ...(dash ? { 'stroke-dasharray': '7 6' } : {}) }, rg);
show(rg, at, .35);
return rg;
};
const glow = (at, len = 1.4) => { tw(hl, { o: 1 }, at, .25); tw(hl, { o: 0 }, at + len, .6); };
- return { g, cx, ry, w, x, ring, glow };
+ // one row lit for len seconds
+ const glowRow = (i, at, len = 2.4) => { const r = mk('rect', { x: x + 4, y: y + i * rh - size * .95, width: w - 8, height: size * 1.3, rx: 10, fill: COL.chalk, 'fill-opacity': .16 }, p); put(r, { o: 0 }); tw(r, { o: 1 }, at, .25); tw(r, { o: 0 }, at + len, .6); return r; };
+ return { g, cx, ry, w, x, ring, glow, glowRow };
};
const keysOf = ({ A, b }, E = null) => {
const o = {}, n = A.length;
@@ -91,6 +94,26 @@ const keysOf = ({ A, b }, E = null) => {
const isPerm = (v, n) => { const I = [...Array(n).keys()], ok = x => x === 0 || x === 1; return I.every(i => I.every(j => ok(v[`e${i}${j}`]))) && I.every(i => I.reduce((s, j) => s + v[`e${i}${j}`], 0) === 1) && I.every(j => I.reduce((s, i) => s + v[`e${i}${j}`], 0) === 1); };
// elimination on PA meets no zero pivot: the corners 1 × 1 and 2 × 2 of PA are not 0 (A itself can be undone)
const noSwap = pr => Math.abs(pr.a00) > 1e-9 && Math.abs(pr.a00 * pr.a11 - pr.a01 * pr.a10) > 1e-9;
+// PA's pivots, read live under the tables as P (or A) changes: the reader sees elimination run or stop
+const pfmt = v => { const r = Math.round(v); if (Math.abs(v - r) < 1e-9) return num(r); for (let d = 2; d <= 60; d++) { const k = Math.round(v * d); if (Math.abs(v * d - k) < 1e-9) { const g = gcd(Math.abs(k), d); return (k < 0 ? '−' : '') + Math.abs(k) / g + '/' + d / g; } } return num(Math.round(v * 100) / 100); };
+const pivRead = (p, em, x, y) => {
+ const g = G(p, {});
+ const draw = () => {
+ g.replaceChildren();
+ const v = em.v, pr = em.prod(), line = (parts, fill, dx = 0) => M(g, parts, { x: x + dx, y, size: 30, fill, anchor: 'start' });
+ if (!isPerm(v, 3)) { T(g, 'P is not a permutation yet: one 1 in every row and every column', { x, y, size: 26, fill: COL.dim, weight: 600 }); return; }
+ const p1 = pr.a00, d2 = pr.a00 * pr.a11 - pr.a01 * pr.a10, d3 = S3_det([0, 1, 2].map(i => [0, 1, 2].map(j => pr[`a${i}${j}`])));
+ const z = q => Math.abs(q) < 1e-9;
+ T(g, 'elimination on PA:', { x, y, size: 26, fill: COL.dim, weight: 600 });
+ if (z(p1)) { T(g, 'first pivot spot 0: stuck', { x: x + 230, y, size: 28, fill: COL.bad, weight: 600 }); return; }
+ const p2 = d2 / p1;
+ if (z(p2)) { line(['pivot ' + pfmt(p1) + ', then 0: stuck'], COL.bad, 230); return; }
+ line(['pivots ' + pfmt(p1) + ', ' + pfmt(p2) + ', ' + pfmt(d3 / d2)], COL.chalk, 230);
+ T(g, z(d3) ? 'last pivot 0: no inverse' : 'no exchange needed', { x: x + 520, y, size: 26, fill: z(d3) ? COL.bad : COL.dim, weight: 600 });
+ };
+ em.onChange(draw); draw();
+ return g;
+};
const permHint = (v, pr) => !isPerm(v, 3) ? 'P must be the identity with its rows in a new order: one 1 in every row and every column.'
: Math.abs(pr.a00) < 1e-9 ? 'PA still starts with 0: the first pivot spot needs a row whose first number is not 0.'
: 'After column 1 of PA, the second pivot spot is 0: try another row in second place.';
@@ -144,6 +167,7 @@ const BEATS = [
title(p, 'A zero in the pivot spot');
const { sys, em } = two(p, ZERO2, 'chapter 20: 2y = 4, 3x + y = 5', { t0: .4 });
pin(sys, 1, 2, m('sys') + 3);
+ thick(sys, 0, m('sys') + .2); thick(sys, 1, m('sys') + 2);
put(em.Eg, { o: 0 }); show(em.Eg, m('p'), .5);
put(em.eqSign, { o: 0 }); show(em.eqSign, m('p'), .4);
tw(em.Pt.g, { o: 0 }, 0, 0); show(em.Pt.g, m('p'), .5);
@@ -165,18 +189,40 @@ const BEATS = [
['why', 'Why not A = LU?', (m) => {
const p = panel(0);
title(p, 'Why not A = LU?');
- const e = emat(p, bare(U3.A), { A: U3.A, b: [0, 0, 0], E: L3, at: [64, 300], size: 34, cw: 56, ecw: 48, rh: 56, gap: 60, t0: .3, noB: true, name: 'L', names: ['U', '', 'LU', ''] });
- e.focusE(0, m('row1')); e.work(0, 0, { times: [m('row1') + 1.5, m('row1') + 2.5, m('row1') + 3, m('row1') + 4] });
- e.Pt.flash(0, m('row1') + 4.4);
- e.work(null, m('piv'));
- e.focusE(null, m('piv'));
- e.B.ring(0, 0, m('piv') + .2); e.Pt.ring(0, 0, m('piv') + .6);
- text(p, 'top-left of LU = the first pivot of U', 64, 620, m('piv') + 1, { size: 28, weight: 600 });
- const A = mat(p, ZERO2.A, 1120, 330, m('zero') - .2, { size: 40, cw: 64, rh: 58, name: 'A =' });
- A.ring(0, 0, m('zero') + .6, { color: COL.bad });
- text(p, 'a pivot is never 0', 1060, 500, m('zero') + 1.2, { size: 30, fill: COL.bad, weight: 600 });
- text(p, 'no L and U make this A', 1060, 560, m('so'), { size: 30, weight: 600 });
- say(p, ['so: factor PA'], 1060, 640, m('so') + 3, { size: 36 });
+ text(p, 'any L and U, two by two:', 70, 190, m('lu') - .3, { size: 28, fill: COL.dim, weight: 600 });
+ const o = { size: 40, rh: 62 };
+ const Lm = mat(p, [[1, 0], ['ℓ', 1]], 110, 300, m('lu') + .3, { ...o, cw: 62, under: 'L' });
+ const Um = mat(p, [['p', 'q'], [0, 'r']], 270, 300, m('lu') + 8.1, { ...o, cw: 62, under: 'U' });
+ // name the parts as they are said: L's ones and ℓ, then U's p, q, r
+ [[0, 0, 3.4], [1, 1, 3.4], [1, 0, 6]].forEach(([i, j, d]) => hide(Lm.ring(i, j, m('lu') + d), m('lu') + 8, .3));
+ [[0, 0, 9], [0, 1, 10.2], [1, 1, 11]].forEach(([i, j, d]) => hide(Um.ring(i, j, m('lu') + d), m('row1') - .2, .3));
+ say(p, ['='], 425, 330, m('row1'), { size: 44, anchor: 'middle' });
+ const LU = mat(p, [['', ''], ['', '']], 455, 300, m('row1'), { ...o, cw: 120, under: 'LU' });
+ const cell = (parts, i, j, at) => { const e = M(p, [].concat(parts), { x: LU.cx(j), y: LU.ry(i), size: 40, anchor: 'middle', o: 0 }); show(e, at, .4); return e; };
+ // row 1 of L is (1, 0): row 1 of LU is row 1 of U
+ Lm.glowRow(0, m('row1'), 3); Um.glowRow(0, m('row1') + .8, 2.6);
+ cell('p', 0, 0, m('row1') + 1.6); cell('q', 0, 1, m('row1') + 2);
+ // row 2 of L is (ℓ, 1): ℓ × (p, q) + (0, r)
+ Lm.glowRow(1, m('row2'), 5); Um.glowRow(0, m('row2') + 1.2, 1.8); Um.glowRow(1, m('row2') + 3, 1.8);
+ cell('ℓp', 1, 0, m('row2') + 2.2); cell('ℓq + r', 1, 1, m('row2') + 3.6);
+ hide(LU.ring(1, 0, m('row2') + 5.2, { rx: 40 }), m('try'), .3);
+ // try to make A
+ const A = mat(p, ZERO2.A, 960, 300, m('try') - .3, { ...o, cw: 66, name: 'A =' });
+ LU.glowRow(0, m('try') + .6, 3); A.glowRow(0, m('try') + .6, 3);
+ say(p, ['row 1: p = 0,'], 70, 540, m('try') + 3.4, { size: 34 });
+ say(p, ['q = 2'], 300, 540, m('try') + 5.2, { size: 34 });
+ LU.ring(0, 0, m('try') + 2.6, { color: COL.bad, rx: 32 });
+ say(p, ['row 2 starts with ℓ × 0 = 0'], 70, 610, m('fail') + .4, { size: 34 });
+ LU.ring(1, 0, m('fail') + .6, { color: COL.bad, rx: 40 });
+ Lm.glowRow(1, m('fail') + 2.4, 2.4);
+ A.ring(1, 0, m('fail') + 4.4, { color: COL.bad });
+ text(p, 'but A’s row 2 starts with 3', 520, 606, m('fail') + 4.4, { size: 30, fill: COL.bad, weight: 600 });
+ text(p, 'no L and U make this A', 70, 700, m('so'), { size: 34, weight: 600 });
+ A.ring(0, 0, m('so') + 3.4, { color: COL.bad, rx: 40 });
+ say(p, ['so: factor PA'], 960, 520, m('so') + 5, { size: 38 });
+ const PA = mat(p, [[3, 1], [0, 2]], 1010, 610, m('so') + 6, { size: 36, cw: 60, rh: 56, name: 'PA =' });
+ A.glowRow(1, m('so') + 7, 1.6); PA.glowRow(0, m('so') + 7.5, 1.6); // the same rows, in a good order
+ A.glowRow(0, m('so') + 9, 1.2); PA.glowRow(1, m('so') + 9.4, 1.2);
}],
['ex3', 'Three by three', (m) => {
@@ -211,7 +257,7 @@ const BEATS = [
el.op(2, 1, 0, m('l32') + .3);
triangle(el, m('u'));
[0, 1, 2].forEach(i => el.ring(i, i, m('u') + 1 + .4 * i));
- const Lm = mat(p, L3, 190, 600, m('L'), { size: 30, cw: 46, rh: 42, name: 'L =' });
+ const Lm = mat(p, L3, 150, 590, m('L'), { size: 30, cw: 58, rh: 50, name: 'L =' });
const r1 = Lm.ring(1, 0, m('L') + 1, { dash: true }), r2 = Lm.ring(2, 0, m('L') + 1.4, { dash: true });
Lm.ring(2, 1, m('L') + 3.2, { dash: true });
const bf = G(p, { o: 0 }); show(bf, m('look') + 2, .4);
@@ -242,6 +288,8 @@ const BEATS = [
e2.work(null, m('eq')); e2.focusE(null, m('eq'));
[0, 1, 2].forEach(i => { e1.Pt.flash(i, m('eq') + .4 + .9 * i); e2.Pt.flash(i, m('eq') + .4 + .9 * i); });
say(p, ['PA = LU ✓'], 64, 700, m('eq') + 2, { size: 40, fill: COL.good });
+ say(p, ['Lc = (1, 4, 3) = Pb'], 64, 780, m('c') + 1, { size: 34 });
+ [0, 1, 2].forEach(i => { e2.Pt.flash(i, m('c') + 1.5 + .5 * i); e1.Pt.flash(i, m('c') + 4 + .5 * i); });
}],
['q1', 'Quick check', () => {
@@ -269,15 +317,17 @@ const BEATS = [
el.swap(0, 1, m('swap') + .5, 1.6);
sys.planes[0].fade(1, m('swap') + 2.3, .5); sys.planes[1].fade(1, m('swap') + 2.3, .5);
el.ring(0, 0, m('swap') + 2.4, { color: COL.good });
+ mat(p, [[0, 1, 0], [1, 0, 0], [0, 0, 1]], 170, 600, m('swap') + 3, { size: 30, cw: 46, rh: 42, name: 'P₁₂ =' });
el.op(1, 0, 0, m('l21') + 2);
el.step(2, 0, 2, m('l31') + .2, 1.8);
el.step(2, 1, 3, m('l32') + .2, 1.8);
triangle(el, m('LU') - .4);
- const Lm = mat(p, [[1, 0, 0], [0, 1, 0], [2, 3, 1]], 160, 600, m('LU'), { size: 30, cw: 46, rh: 42, name: 'L =' });
- const Um = mat(p, [[1, 2, 1], [0, 1, 1], [0, 0, 4]], 440, 600, m('LU') + 2.4, { size: 30, cw: 46, rh: 42, name: 'U =' });
+ const Lm = mat(p, [[1, 0, 0], [0, 1, 0], [2, 3, 1]], 440, 600, m('LU'), { size: 30, cw: 46, rh: 42, name: 'L =' });
+ const Um = mat(p, [[1, 2, 1], [0, 1, 1], [0, 0, 4]], 700, 600, m('LU') + 2.4, { size: 30, cw: 46, rh: 42, name: 'U =' });
Lm.ring(2, 0, m('check') + .6); Lm.ring(2, 1, m('check') + .6);
Um.glow(m('check') + 1.6, 3);
say(p, ['2·(1, 2, 1) + 3·(0, 1, 1) + (0, 0, 4) = (2, 7, 9)'], 64, 790, m('check') + 4, { size: 30 });
+ text(p, '= row 3 of PA: PA = LU', 640, 786, m('check') + 7.5, { size: 28, fill: COL.good, weight: 600 });
}],
['q2', 'Your turn', () => {
@@ -285,12 +335,32 @@ const BEATS = [
title(p, 'Your turn');
const t = three(p, Z3, 'chapter 20: x + 2y + z = 1, 2x + 4y + 3z = 3, 3x + 7y + 5z = 4');
S.em = t.em;
+ pivRead(p, t.em, 70, 460);
}, { ask: done => quiz(CARD3, [{
id: 'c-perm', prompt: ['Change the numbers of P until elimination on PA meets no zero pivot.'],
build: emTask(S.em, (v, pr) => isPerm(v, 3) && noSwap(pr), 'Rows 1, 3, 2 (P₂₃) work, and so do three other orders. Only rows 1 and 2 on top fail: their 2 × 2 corner gives a 0 pivot.',
permHint, () => S.em.set(eKeys(P23)), { only: ['e00', 'e01', 'e02', 'e10', 'e11', 'e12', 'e20', 'e21', 'e22'] }),
}], done) }],
+ ['stuck', 'When no P helps', (m) => {
+ const p = panel(0);
+ title(p, 'When no P can help');
+ const { sys, el, V } = table3(p, STUCK, 'x + 2y + z = 1, 2x + 4y + 3z = 3, 3x + 6y + 5z = 5', { t0: .4 });
+ V.sway(5, 13);
+ [0, 1, 2].forEach(i => el.flash(i, m('A') + .3 + 2.3 * i));
+ el.step(1, 0, 2, m('c1') + .3, 1.8);
+ el.step(2, 0, 3, m('c1') + 3.2, 1.8);
+ hide(el.op_.lab.g, m('zero') - .2, .3);
+ el.ring(1, 1, m('zero'), { color: COL.bad });
+ el.ring(2, 1, m('below'), { color: COL.bad, dash: true });
+ text(p, 'every number below is 0 too', 90, 520, m('below') + 1, { size: 30, fill: COL.bad, weight: 600 });
+ text(p, 'no row to exchange with: no P helps', 90, 580, m('none'), { size: 30, fill: COL.bad, weight: 600 });
+ V.turn({ yaw: 35, pitch: 30 }, m('line') - .6, 3); // the shared line lies across the view
+ [[0, 0, 1], [-2, 1, 1], [2, -1, 1]].forEach((q, i) => { const pt = V.point(q, { label: `(${q.map(num).join(', ')})`, size: 24, halo: true, ...(i === 0 ? { dx: -20, dy: 34 } : {}) }); put(pt.e, { o: 0 }); show(pt.e, m('pts') + 1.2 * i, .4); });
+ text(p, 'one whole line of solutions, not one point', 90, 640, m('pts') + .5, { size: 30, weight: 600 });
+ text(p, 'P fixes a 0 pivot only when a number below it is not 0', 90, 740, m('rule'), { size: 30, fill: COL.good, weight: 600 });
+ }],
+
['q3', 'Quick check', () => {
const p = panel(0);
title(p, 'Quick check');
@@ -312,14 +382,22 @@ const BEATS = [
[0, 1, 2].forEach(i => { pp.flashE(i, m('undo') + 3.5 + 1.6 * i); pp.Pt.flash(i, m('undo') + 4 + 1.6 * i); });
const Pm = mat(p, CYC, 160, 330, m('cycle'), { size: 36, cw: 56, rh: 50, name: 'P =' });
text(p, 'moves every row', 110, 480, m('cycle') + .6, { size: 26, fill: COL.dim, weight: 600 });
- [[0, 2], [1, 0], [2, 1]].forEach(([i, j], k) => hide(Pm.ring(i, j, m('cycle') + 2.4 + 1.4 * k), m('flip') - .3, .3));
- const Pv = mat(p, CYCT, 500, 330, m('back'), { size: 36, cw: 56, rh: 50, name: 'P⁻¹ =' });
- [[0, 1], [1, 2], [2, 0]].forEach(([i, j], k) => hide(Pv.ring(i, j, m('back') + 2 + 1.3 * k), m('flip') - .3, .3));
- text(p, 'puts every row back', 450, 480, m('back') + 5, { size: 26, fill: COL.dim, weight: 600 });
+ [0, 1, 2].forEach(i => Pm.glowRow(i, m('cycle') + 2.6 + 2 * i, 1.8));
+ ['c1', 'c2', 'c3'].forEach((mk_, k) => { const [i, j] = [[0, 2], [1, 0], [2, 1]][k]; Pm.glowRow(i, m(mk_), 2); hide(Pm.ring(i, j, m(mk_) + .3), m('flip') - .3, .3); });
+ // the undo sits on the right; the gap between is where the flip lands
+ const Pv = mat(p, CYCT.map(r => r.map(() => '')), 880, 330, m('back'), { size: 36, cw: 56, rh: 50, name: 'P⁻¹ =' });
+ text(p, 'fetches every row back', 820, 480, m('back') + 1, { size: 26, fill: COL.dim, weight: 600 });
+ ['b1', 'b2', 'b3'].forEach((mk_, i) => {
+ const said = m(mk_) + .55 * (m(['b2', 'b3', 'flip'][i]) - m(mk_)); // the row's numbers, as they are read out
+ const r = G(p, { o: 0 }); CYCT[i].forEach((v, j) => M(r, [num(v)], { x: Pv.cx(j), y: Pv.ry(i), size: 36, anchor: 'middle' })); show(r, said, .4);
+ const j = CYCT[i].indexOf(1); hide(Pv.ring(i, j, said + .8), m('flip') - .3, .3);
+ Pm.glowRow(j, m(mk_), 2.2); // where P put the old row i + 1
+ });
// the flip: P's diagonal dashed, every number flies from (i, j) to (j, i) of a new matrix
const dg = path(p, `M${Pm.cx(0) - 20} ${Pm.ry(0) - 30}L${Pm.cx(2) + 20} ${Pm.ry(2) + 12}`, { stroke: COL.chalk, 'stroke-width': 2.5, 'stroke-dasharray': '8 7', fill: 'none' }, { d: 0 });
tw(dg, { d: 1 }, m('flip'), .8); hide(dg, m('name') + 1, .5);
- const Tm = mat(p, CYCT.map(r => r.map(() => '')), 880, 330, m('flip') + .4, { size: 36, cw: 56, rh: 50, name: 'Pᵀ =' });
+ Pm.glowRow(0, m('flip') + 4.6, 2.2);
+ const Tm = mat(p, CYCT.map(r => r.map(() => '')), 500, 330, m('flip') + .4, { size: 36, cw: 56, rh: 50, name: 'Pᵀ =' });
CYC.forEach((r, i) => r.forEach((v, j) => {
const t = G(p, { x: Pm.cx(j), y: Pm.ry(i), o: 0 });
M(t, [num(v)], { size: 36, fill: v ? COL.chalk : COL.dim, anchor: 'middle' });
@@ -327,7 +405,8 @@ const BEATS = [
show(t, at, .1);
tw(t, { x: Tm.cx(i), y: Tm.ry(j) }, at, 1.4);
}));
- say(p, ['P⁻¹ = Pᵀ'], 880, 520, m('name') + 2, { size: 40 });
+ say(p, ['P⁻¹ = Pᵀ'], 640, 540, m('name') + 2, { size: 40, anchor: 'middle' });
+ Tm.glow(m('name') + 2, 2); Pv.glow(m('name') + 2, 2);
const e = emat(p, bare(CYC), { A: CYC, b: [0, 0, 0], E: CYCT, at: [64, 690], size: 28, cw: 46, ecw: 40, rh: 44, gap: 56, t0: m('check') - .2, noB: true, name: 'Pᵀ', names: ['P', '', 'I', ''] });
[0, 1, 2].forEach(i => e.Pt.flash(i, m('check') + 1 + .7 * i));
text(p, 'every permutation: P⁻¹ = Pᵀ', 880, 600, m('rule'), { size: 30, weight: 600 });
@@ -337,7 +416,7 @@ const BEATS = [
['wrap', 'Summary', (m) => {
const p = panel(0);
[['A zero pivot is fixed by a row exchange; P can make every exchange first.', 'w1'], ['Then PA = LU: L holds the multipliers, U the pivots.', 'w2'],
- ['Check by multiplying out: P reorders the rows of A, L mixes the rows of U.', 'w3'], ['P⁻¹ = Pᵀ. If no row below has a number, no P can help.', 'w4']].forEach(([str, mark], i) => {
+ ['Check by multiplying out: P reorders the rows of A, L mixes the rows of U.', 'w3'], ['P⁻¹ = Pᵀ. If every number below a zero pivot is 0, no P helps.', 'w4']].forEach(([str, mark], i) => {
const g = G(p, { x: -16, y: 230 + i * 130, o: 0 });
mk('circle', { cx: 120, cy: -12, r: 26, fill: COL.chalk }, g);
T(g, String(i + 1), { x: 120, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });
@@ -362,6 +441,7 @@ const BEATS = [
title(p, 'Build P');
const t = three(p, HANDS[0].sys, '');
S.em = t.em;
+ pivRead(p, t.em, 70, 460);
}, { ask: done => quiz(CARD3, HANDS.map((h, k) => ({
id: `p-hand${k + 1}`, prompt: [h.prompt],
build: (body, api) => {
@@ -374,8 +454,8 @@ const BEATS = [
title(p, 'Playground');
const t = three(p, Z3, '', { E: P23 });
S.em = t.em;
- const hint = text(p, 'try: P = I; rows 2, 1, 3; a 0 in A’s first column', 64, 160, m('go'), { size: 24, fill: COL.dim });
- hide(hint, m('go') + 7, .6);
+ pivRead(p, t.em, 70, 432);
+ text(p, 'try: P = I; rows 2, 1, 3; a 0 in A’s first column; A’s row 3 = row 1 + row 2', 64, 160, m('go'), { size: 24, fill: COL.dim });
}, { ask: playAsk(() => S.em, { pos: { x: 40, y: 480, w: 820, cls: 'side' }, tip: 'Your matrices. Change any number of P or of A | b, turn the picture, or draw on the board. Nothing is marked.' }) }],
['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
diff --git a/site/linear-algebra/index.html b/site/linear-algebra/index.html
index 8da57a7..3191f51 100644
--- a/site/linear-algebra/index.html
+++ b/site/linear-algebra/index.html
@@ -75,6 +75,7 @@ Contents.book({
['The Geometry of Linear Equations', [['One Equation, One Line', 10], ['Two Equations, One Point', 11], ['Crossing, Parallel or the Same Line', 10], ['Vectors: Arrows and Columns of Numbers', 9], ['Adding and Stretching Vectors', 10], ['Linear Combinations', 10], ['The Column Picture', 10], ['Matrices and Ax = b', 10], ['Matrix Times Vector, Two Ways', 10], ['A Matrix Moves the Whole Plane', 10], ['Three Unknowns: A Plane in Space', 12], ['Three Planes, One Point', 14], ['Three Columns in Space', 13], ['Can We Solve for Every b?', 10], ['More Numbers Than Axes', 9]]],
['Elimination with Matrices', [['Elimination: Two Equations', 12], ['Pivots and Multipliers', 10], ['Elimination: Three Equations', 11], ['Back Substitution', 11], ['When Elimination Breaks Down', 11], ['Elimination Matrices', 11], ['Row Exchanges as Matrices', 10]]],
['Multiplication and Inverse Matrices', [['Matrix Times Matrix', 10], ['Four Ways to Multiply', 10], ['Rules for Matrix Arithmetic', 10], ['The Inverse: Undoing a Matrix', 12], ['Finding the Inverse: Gauss–Jordan', 11], ['Matrices with No Inverse', 11]]],
+ ['Factorization into A = LU', [['Undoing Elimination', 11], ['A = LU', 11], ['Why L Is Clean and E Is Not', 11], ['A = LDU', 11], ['How Much Work Is Elimination?', 10], ['PA = LU', 11]]],
],
hues: ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'], // one colour per unit, cycling
});
diff --git a/site/linear-algebra/lib/linsys.js b/site/linear-algebra/lib/linsys.js
index 807e8a3..4beae1e 100644
--- a/site/linear-algebra/lib/linsys.js
+++ b/site/linear-algebra/lib/linsys.js
@@ -311,6 +311,7 @@ function linsys(p, { A = [[2, -1], [-1, 2]], b = [0, 3], eq = [90, 250], mat = [
if (l.getAttribute('d') !== d) { l.setAttribute('d', d); hit.setAttribute('d', d); }
const kp = turning && turning.i === i ? (turning.k ? [turning.pivot, turning.at] : [turning.at, turning.pivot]) : knobsFor(i);
if (kp) { knobPos[i] = kp; kp.forEach(([x, y], k) => put(knobs[i][k], { x: PX(x), y: PY(y) })); }
+ knobs[i].forEach(h => { const want = kp ? '' : 'none'; if (h.style.display !== want) h.style.display = want; }); // no line (0 = 0, or off the grid): no handles
});
const s = solve(), inGrid = s.x !== undefined && s.x >= bx[0] && s.x <= bx[1] && s.y >= by[0] && s.y <= by[1];
put(meet, { x: inGrid ? PX(s.x) : 0, y: inGrid ? PY(s.y) : 0, o: inGrid ? 1 : 0 });