Skip to content

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

feat(linear-algebra): Unit 2 begins: elim.js, chapters 16-19

yzrc5f46e9d0564
diff --git a/site/linear-algebra/ch16/audio/en/easy.mp3 b/site/linear-algebra/ch16/audio/en/easy.mp3
new file mode 100644
index 0000000..9900d11
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/easy.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/ex2.mp3 b/site/linear-algebra/ch16/audio/en/ex2.mp3
new file mode 100644
index 0000000..f2dc199
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/ex2.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/ex3.mp3 b/site/linear-algebra/ch16/audio/en/ex3.mp3
new file mode 100644
index 0000000..658540d
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/ex3.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/final1.mp3 b/site/linear-algebra/ch16/audio/en/final1.mp3
new file mode 100644
index 0000000..ee572c7
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/final1.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/final2.mp3 b/site/linear-algebra/ch16/audio/en/final2.mp3
new file mode 100644
index 0000000..74ff9ea
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/final2.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/final3.mp3 b/site/linear-algebra/ch16/audio/en/final3.mp3
new file mode 100644
index 0000000..eb64726
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/final3.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/final4.mp3 b/site/linear-algebra/ch16/audio/en/final4.mp3
new file mode 100644
index 0000000..db081c1
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/final4.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/finish.mp3 b/site/linear-algebra/ch16/audio/en/finish.mp3
new file mode 100644
index 0000000..3313592
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/finish.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/goal.mp3 b/site/linear-algebra/ch16/audio/en/goal.mp3
new file mode 100644
index 0000000..a667bf9
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/goal.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/intro.mp3 b/site/linear-algebra/ch16/audio/en/intro.mp3
new file mode 100644
index 0000000..d5b85b7
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/intro.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/matrix.mp3 b/site/linear-algebra/ch16/audio/en/matrix.mp3
new file mode 100644
index 0000000..496d12f
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/matrix.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/play.mp3 b/site/linear-algebra/ch16/audio/en/play.mp3
new file mode 100644
index 0000000..1c3c1bd
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/q1.mp3 b/site/linear-algebra/ch16/audio/en/q1.mp3
new file mode 100644
index 0000000..34daa1b
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/q1.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/q2.mp3 b/site/linear-algebra/ch16/audio/en/q2.mp3
new file mode 100644
index 0000000..3435106
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/q2.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/q3.mp3 b/site/linear-algebra/ch16/audio/en/q3.mp3
new file mode 100644
index 0000000..0f6f22f
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/q3.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/subtract.mp3 b/site/linear-algebra/ch16/audio/en/subtract.mp3
new file mode 100644
index 0000000..9ec4be0
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/subtract.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/swing.mp3 b/site/linear-algebra/ch16/audio/en/swing.mp3
new file mode 100644
index 0000000..a7a8915
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/swing.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/timings.js b/site/linear-algebra/ch16/audio/en/timings.js
new file mode 100644
index 0000000..058e7b9
--- /dev/null
+++ b/site/linear-algebra/ch16/audio/en/timings.js
@@ -0,0 +1,831 @@
+window.TIMINGS = {
+ "intro": {
+ "dur": 13.296,
+ "marks": {
+ "sub": 4.01,
+ "move": 10.195
+ },
+ "cues": [
+ [
+ 0.104,
+ "Chapter sixteen."
+ ],
+ [
+ 1.55,
+ "Elimination: two equations."
+ ],
+ [
+ 4.01,
+ "In this chapter you'll solve two equations by hand, exactly, without drawing anything."
+ ],
+ [
+ 10.195,
+ "The trick is to make one of the two lines lie flat."
+ ]
+ ]
+ },
+ "easy": {
+ "dur": 44.136,
+ "marks": {
+ "eq": 3.073,
+ "flat": 7.109,
+ "y": 14.349,
+ "put": 19.648,
+ "x": 25.768,
+ "meet": 29.531,
+ "lesson": 34.401
+ },
+ "cues": [
+ [
+ 0.104,
+ "Let's start with a system that is easy to solve."
+ ],
+ [
+ 3.073,
+ "x plus two y equals five, and two y equals four."
+ ],
+ [
+ 7.109,
+ "The second equation has no x."
+ ],
+ [
+ 9.648,
+ "In chapter one we saw what that means: x is free, so its line is flat."
+ ],
+ [
+ 14.349,
+ "And it tells us y straight away."
+ ],
+ [
+ 16.393,
+ "Two y equals four, so y equals two."
+ ],
+ [
+ 19.648,
+ "Now put two in place of y in the first equation."
+ ],
+ [
+ 22.891,
+ "x plus two times two equals five."
+ ],
+ [
+ 25.768,
+ "x plus four equals five, so x equals one."
+ ],
+ [
+ 29.531,
+ "The answer is one, two, and there it is, where the two lines meet."
+ ],
+ [
+ 34.401,
+ "So a system is easy when one equation has lost its x."
+ ],
+ [
+ 38.464,
+ "That's our plan for every system: make the second equation lose its x."
+ ]
+ ]
+ },
+ "goal": {
+ "dur": 51.072,
+ "marks": {
+ "eq": 2.812,
+ "meet": 8.346,
+ "three": 18.359,
+ "times": 22.721,
+ "t1": 25.417,
+ "t2": 28.112,
+ "t3": 30.378,
+ "new": 33.32,
+ "both": 36.042,
+ "chk": 40.143,
+ "same": 44.714
+ },
+ "cues": [
+ [
+ 0.117,
+ "Here is a system that is not so easy."
+ ],
+ [
+ 2.812,
+ "x plus two y equals five, and three x plus four y equals eleven."
+ ],
+ [
+ 8.346,
+ "The picture says the lines meet at one, two."
+ ],
+ [
+ 11.367,
+ "But as we saw in chapter two, a picture can't always be read exactly."
+ ],
+ [
+ 15.807,
+ "We want a way that works with the numbers alone."
+ ],
+ [
+ 18.359,
+ "The second equation has three x."
+ ],
+ [
+ 21.016,
+ "The first has just one x."
+ ],
+ [
+ 22.721,
+ "So take three times the first equation."
+ ],
+ [
+ 25.417,
+ "Three times x is three x."
+ ],
+ [
+ 28.112,
+ "Three times two y is six y."
+ ],
+ [
+ 30.378,
+ "And three times five is fifteen."
+ ],
+ [
+ 33.32,
+ "Three x plus six y equals fifteen."
+ ],
+ [
+ 36.042,
+ "We multiplied both sides by three, so it's still true."
+ ],
+ [
+ 40.143,
+ "Check it with one, two: three plus twelve is fifteen."
+ ],
+ [
+ 44.714,
+ "In fact its line is the first line itself."
+ ],
+ [
+ 48.008,
+ "Every pair that solves one solves the other."
+ ]
+ ]
+ },
+ "subtract": {
+ "dur": 44.688,
+ "marks": {
+ "x": 4.349,
+ "sub": 6.302,
+ "c1": 9.74,
+ "c2": 14.297,
+ "c3": 17.07,
+ "res": 20.221,
+ "y": 23.216,
+ "back": 27.018,
+ "x2": 32.24,
+ "row": 33.906,
+ "flat": 39.661
+ },
+ "cues": [
+ [
+ 0.104,
+ "Now write the second equation, and three times the first under it."
+ ],
+ [
+ 4.349,
+ "Both start with three x."
+ ],
+ [
+ 6.302,
+ "Subtract the bottom from the top, piece by piece."
+ ],
+ [
+ 9.74,
+ "Three x minus three x is zero x."
+ ],
+ [
+ 12.982,
+ "The x is gone."
+ ],
+ [
+ 14.297,
+ "Four y minus six y is minus two y."
+ ],
+ [
+ 17.07,
+ "And eleven minus fifteen is minus four."
+ ],
+ [
+ 20.221,
+ "So minus two y equals minus four."
+ ],
+ [
+ 23.216,
+ "Divide both sides by minus two, and y equals two."
+ ],
+ [
+ 27.018,
+ "Put y equals two back into the first equation."
+ ],
+ [
+ 30.378,
+ "x plus four equals five, so x equals one."
+ ],
+ [
+ 33.906,
+ "In the picture, the second equation is now minus two y equals minus four."
+ ],
+ [
+ 39.661,
+ "Its line has turned and lies flat."
+ ],
+ [
+ 42.292,
+ "And the lines still meet at one, two."
+ ]
+ ]
+ },
+ "why": {
+ "dur": 56.544,
+ "marks": {
+ "r2": 3.672,
+ "r1": 9.57,
+ "take": 15.169,
+ "test": 24.167,
+ "n1": 26.406,
+ "n2": 30.352,
+ "n3": 34.544,
+ "on": 40.807,
+ "back": 44.909,
+ "same": 51.927
+ },
+ "cues": [
+ [
+ 0.104,
+ "Why are we allowed to subtract one equation from another?"
+ ],
+ [
+ 3.672,
+ "The second equation says: three x plus four y is the same number as eleven."
+ ],
+ [
+ 9.57,
+ "Three times the first says: three x plus six y is the same number as fifteen."
+ ],
+ [
+ 15.169,
+ "Take equal amounts away from equal amounts, and what's left is still equal."
+ ],
+ [
+ 20.195,
+ "The left minus the left equals the right minus the right."
+ ],
+ [
+ 24.167,
+ "Try it with the meeting point, one, two."
+ ],
+ [
+ 26.406,
+ "The second equation gives three plus eight, eleven."
+ ],
+ [
+ 30.352,
+ "Three times the first gives three plus twelve, fifteen."
+ ],
+ [
+ 34.544,
+ "Eleven minus fifteen is minus four, and minus two times two is minus four too."
+ ],
+ [
+ 40.807,
+ "So the meeting point solves the new equation."
+ ],
+ [
+ 43.737,
+ "It's on the new line."
+ ],
+ [
+ 44.909,
+ "And nothing is lost: add three times the first equation back, and the old second equation returns."
+ ],
+ [
+ 51.927,
+ "Same solutions before and after."
+ ],
+ [
+ 54.271,
+ "That's why the meeting point never moves."
+ ]
+ ]
+ },
+ "q1": {
+ "dur": 4.704,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.146,
+ "Take two times the first equation away from the second."
+ ]
+ ]
+ },
+ "matrix": {
+ "dur": 67.128,
+ "marks": {
+ "eq": 7.852,
+ "a": 9.31,
+ "b": 14.206,
+ "aug": 16.159,
+ "row": 27.448,
+ "row2": 33.984,
+ "step": 36.784,
+ "piv": 41.94,
+ "rem": 45.039,
+ "three": 47.93,
+ "go": 51.393,
+ "e1": 56.094,
+ "e2": 58.451,
+ "e3": 60.768,
+ "same": 63.698
+ },
+ "cues": [
+ [
+ 0.091,
+ "Writing x, y and equals over and over is slow."
+ ],
+ [
+ 4.128,
+ "The numbers do all the work, so let's keep only the numbers."
+ ],
+ [
+ 7.852,
+ "Here's our system again."
+ ],
+ [
+ 9.31,
+ "In chapter eight, the numbers in front of x and y made the matrix A."
+ ],
+ [
+ 14.206,
+ "The right sides made b."
+ ],
+ [
+ 16.159,
+ "Put b beside A, with a dashed line between them, and we get one table: A, then b."
+ ],
+ [
+ 23.086,
+ "It's called the augmented matrix."
+ ],
+ [
+ 25.156,
+ "Augmented just means made bigger."
+ ],
+ [
+ 27.448,
+ "Each row is one equation."
+ ],
+ [
+ 29.219,
+ "Row one is one, two, five: x plus two y equals five."
+ ],
+ [
+ 33.984,
+ "Row two is three, four, eleven."
+ ],
+ [
+ 36.784,
+ "Now our step, written short: row two minus three times row one."
+ ],
+ [
+ 41.94,
+ "Here is the one in row one that we multiply, and the three in row two that we want to remove."
+ ],
+ [
+ 47.93,
+ "Three times row one is three, six, fifteen."
+ ],
+ [
+ 51.393,
+ "Subtract, and each number in row two changes where it stands."
+ ],
+ [
+ 56.094,
+ "Three minus three is zero."
+ ],
+ [
+ 58.451,
+ "Four minus six is minus two."
+ ],
+ [
+ 60.768,
+ "Eleven minus fifteen is minus four."
+ ],
+ [
+ 63.698,
+ "The same numbers as before, and the same flat line."
+ ]
+ ]
+ },
+ "swing": {
+ "dur": 45.888,
+ "marks": {
+ "l0": 6.029,
+ "l1": 8.984,
+ "turn1": 12.904,
+ "l2": 16.497,
+ "up": 20.443,
+ "l3": 24.609,
+ "flat": 28.802,
+ "l4": 30.951,
+ "back3": 33.646,
+ "pin": 38.906
+ },
+ "cues": [
+ [
+ 0.104,
+ "Let's watch that step slowly."
+ ],
+ [
+ 1.94,
+ "We take row one away a little at a time, and watch the coral line."
+ ],
+ [
+ 6.029,
+ "Times zero: nothing has changed yet."
+ ],
+ [
+ 8.984,
+ "Times one: row two becomes two, two, six."
+ ],
+ [
+ 12.904,
+ "The line has turned, but it still goes through one, two."
+ ],
+ [
+ 16.497,
+ "Times two: one, zero, one."
+ ],
+ [
+ 18.568,
+ "That's x equals one."
+ ],
+ [
+ 20.443,
+ "The line stands straight up."
+ ],
+ [
+ 22.109,
+ "This time y is gone, not x."
+ ],
+ [
+ 24.609,
+ "Times three: zero, minus two, minus four."
+ ],
+ [
+ 28.802,
+ "Now it's flat."
+ ],
+ [
+ 29.935,
+ "x is gone."
+ ],
+ [
+ 30.951,
+ "Go on to four, and it tips the other way."
+ ],
+ [
+ 33.646,
+ "Only three makes it flat, because three minus three times one is zero."
+ ],
+ [
+ 38.906,
+ "And through all of it, the meeting point never moved."
+ ],
+ [
+ 42.37,
+ "Each step changes the equations, but not their answer."
+ ]
+ ]
+ },
+ "ex2": {
+ "dur": 53.352,
+ "marks": {
+ "eq": 1.12,
+ "mat": 6.849,
+ "which": 12.409,
+ "l": 15.586,
+ "three": 22.904,
+ "go": 25.924,
+ "e1": 27.018,
+ "e2": 29.518,
+ "e3": 31.641,
+ "flat": 34.193,
+ "y": 35.833,
+ "x": 41.289,
+ "x2": 47.539,
+ "pt": 49.206
+ },
+ "cues": [
+ [
+ 0.104,
+ "Another one."
+ ],
+ [
+ 1.12,
+ "Two x plus y equals three, and six x plus five y equals seven."
+ ],
+ [
+ 6.849,
+ "As a table: two, one, three, and six, five, seven."
+ ],
+ [
+ 12.409,
+ "Which multiple of row one removes the six?"
+ ],
+ [
+ 15.586,
+ "Six is three times two, so the multiplier is three: row two minus three times row one."
+ ],
+ [
+ 22.904,
+ "Three times row one is six, three, nine."
+ ],
+ [
+ 25.924,
+ "Subtract."
+ ],
+ [
+ 27.018,
+ "Six minus six is zero."
+ ],
+ [
+ 29.518,
+ "Five minus three is two."
+ ],
+ [
+ 31.641,
+ "Seven minus nine is minus two."
+ ],
+ [
+ 34.193,
+ "The line lies flat."
+ ],
+ [
+ 35.833,
+ "Row two now says two y equals minus two, so y equals minus one."
+ ],
+ [
+ 41.289,
+ "Back in row one: two x minus one equals three, so two x equals four, and x equals two."
+ ],
+ [
+ 49.206,
+ "The answer is two, minus one, right where the lines meet."
+ ]
+ ]
+ },
+ "q2": {
+ "dur": 5.4,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Your turn."
+ ],
+ [
+ 1.068,
+ "Drag the boxed multiplier until the second line lies flat."
+ ]
+ ]
+ },
+ "ex3": {
+ "dur": 52.176,
+ "marks": {
+ "eq": 2.552,
+ "l": 7.591,
+ "two": 11.497,
+ "go": 14.635,
+ "e1": 15.729,
+ "e2": 18.203,
+ "e3": 23.477,
+ "y": 26.445,
+ "x": 30.69,
+ "x2": 35.664,
+ "chk": 37.266,
+ "c1": 42.474,
+ "c2": 45.651,
+ "ok": 48.854
+ },
+ "cues": [
+ [
+ 0.117,
+ "One more, with a minus sign in it."
+ ],
+ [
+ 2.552,
+ "Three x plus y equals seven, and six x minus y equals eleven."
+ ],
+ [
+ 7.591,
+ "Six is two times three, so the multiplier is two."
+ ],
+ [
+ 11.497,
+ "Two times row one is six, two, fourteen."
+ ],
+ [
+ 14.635,
+ "Subtract."
+ ],
+ [
+ 15.729,
+ "Six minus six is zero."
+ ],
+ [
+ 18.203,
+ "Careful with the y numbers: minus one, minus two, is minus three."
+ ],
+ [
+ 23.477,
+ "Eleven minus fourteen is minus three."
+ ],
+ [
+ 26.445,
+ "Minus three y equals minus three, so y equals one."
+ ],
+ [
+ 30.69,
+ "Then three x plus one equals seven."
+ ],
+ [
+ 33.971,
+ "Three x equals six, so x equals two."
+ ],
+ [
+ 37.266,
+ "Now check two, one in the original equations, not in the new one."
+ ],
+ [
+ 42.474,
+ "Three times two, plus one, is seven."
+ ],
+ [
+ 45.651,
+ "Six times two, minus one, is eleven."
+ ],
+ [
+ 48.854,
+ "Both are true, so two, one is the answer."
+ ]
+ ]
+ },
+ "q3": {
+ "dur": 3.144,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.068,
+ "Which new second equation is right?"
+ ]
+ ]
+ },
+ "wrap": {
+ "dur": 31.656,
+ "marks": {
+ "w1": 1.029,
+ "w2": 5.768,
+ "w3": 12.643,
+ "w4": 20.859,
+ "end": 29.714
+ },
+ "cues": [
+ [
+ 0.104,
+ "To sum up."
+ ],
+ [
+ 1.029,
+ "To eliminate x, subtract a multiple of row one from row two."
+ ],
+ [
+ 5.768,
+ "Choose the multiple that makes the x numbers match: under one x and three x, take three."
+ ],
+ [
+ 12.643,
+ "Taking equal amounts from equal amounts keeps every solution, so the line turns about the meeting point, which never moves."
+ ],
+ [
+ 20.859,
+ "Row two is left with y alone."
+ ],
+ [
+ 23.294,
+ "Find y, put it back into row one for x, and check both in the original equations."
+ ],
+ [
+ 29.714,
+ "Now try the chapter practice."
+ ]
+ ]
+ },
+ "final1": {
+ "dur": 3.288,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice."
+ ],
+ [
+ 1.55,
+ "Work out the new second row."
+ ]
+ ]
+ },
+ "final2": {
+ "dur": 2.28,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Next, find the multiplier."
+ ]
+ ]
+ },
+ "final3": {
+ "dur": 3.024,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Now solve each system from start to finish."
+ ]
+ ]
+ },
+ "final4": {
+ "dur": 3.984,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Last set."
+ ],
+ [
+ 1.25,
+ "Find each multiplier with your hands."
+ ]
+ ]
+ },
+ "play": {
+ "dur": 13.272,
+ "marks": {
+ "go": 3.984
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.081,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 3.984,
+ "Change the system, drag the multiplier, draw on the board if you like, and watch the second line swing about the meeting point."
+ ],
+ [
+ 11.562,
+ "Press continue when you're done."
+ ]
+ ]
+ },
+ "finish": {
+ "dur": 14.112,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Well done."
+ ],
+ [
+ 1.159,
+ "That's the end of chapter sixteen, elimination: two equations."
+ ],
+ [
+ 6.055,
+ "Next: pivots and multipliers."
+ ],
+ [
+ 8.789,
+ "We'll name the numbers we just used, and see what to do when they're negative, or fractions."
+ ]
+ ]
+ }
+};
diff --git a/site/linear-algebra/ch16/audio/en/why.mp3 b/site/linear-algebra/ch16/audio/en/why.mp3
new file mode 100644
index 0000000..5234e9c
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/why.mp3 differ
diff --git a/site/linear-algebra/ch16/audio/en/wrap.mp3 b/site/linear-algebra/ch16/audio/en/wrap.mp3
new file mode 100644
index 0000000..fc37fca
Binary files /dev/null and b/site/linear-algebra/ch16/audio/en/wrap.mp3 differ
diff --git a/site/linear-algebra/ch16/index.html b/site/linear-algebra/ch16/index.html
new file mode 100644
index 0000000..f8cea2e
--- /dev/null
+++ b/site/linear-algebra/ch16/index.html
@@ -0,0 +1,433 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Elimination: Two Equations</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run -->
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../lib/math.js"></script>
+<script src="../lib/linsys.js"></script>
+<script src="../lib/elim.js"></script>
+<script src="../lib/play.js"></script>
+<script src="audio/en/timings.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 16, title: 'Elimination: Two Equations', minutes: 11, language: 'en', next: '../ch17/' };
+
+/* ---------- chapter drawing helpers (chapter 2's, plus the working lines of elimination) ---------- */
+const BLUE = LS_ROW[0], CORAL = LS_ROW[1];
+const CARD = { x: 40, y: 345, w: 720, cls: 'side' }; // question card under the two equations, beside the plane
+const LOW = { x: 40, y: 610, w: 720, cls: 'side' }; // under the equations and the matrix
+const MAT = [108, 450]; // where [A | b] sits: its row bars line up with the equations'
+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; };
+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500 } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, o: 0 }); show(e, t0); return e; };
+const flash = (sys, key, t0) => sys.num(key).forEach(e => { tw(e, { c_fill: COL.task }, t0, .25); tw(e, { c_fill: COL.chalk }, t0 + 1.2, .6); });
+const pairStr = (x, y) => `(${num(x)}, ${num(y)})`;
+const okMark = (p, x, y, t0, size = 34) => text(p, '✓', x, y, t0, { size, fill: COL.good, weight: 700 });
+// Two equations in the top left, the plane on the right; no x = …, y = … readout (elimination finds it).
+const twoLines = (p, A, b, { t0 = .1, lines = true, meet = true, hidePlane = false } = {}) => {
+ const sys = linsys(p, { A, b, eq: [90, 200], mat: null, sol: false, t0, hidePlane });
+ if (!lines) sys.lines.forEach(({ l }) => put(l, { o: 0 }));
+ if (!meet) put(sys.meetBox, { o: 0 });
+ return sys;
+};
+// The old line of row 2, dashed, through the meeting point (sx, sy): a·x + b·y = c runs along (b, −a).
+const ghost = (sys, a, b, sx, sy, t0, color = CORAL) => {
+ const l = sys.P.line(sx, sy, sx + b, sy - a, color, t0, { dash: '10 10', w: 3, into: sys.stage });
+ tw(l, { o: .45 }, t0 + .6, .4);
+ return l;
+};
+// A dashed ring round the point that never moves.
+const pin = (sys, x, y, t0, into = sys.stage) => {
+ const g = G(into, { x: sys.P.PX(x), y: sys.P.PY(y), o: 0 });
+ mk('circle', { r: 20, fill: 'none', stroke: COL.task, 'stroke-width': 3.5, 'stroke-dasharray': '6 5' }, g);
+ show(g, t0, .4);
+ return g;
+};
+// One line of working, aligned on its = sign at xEq.
+const wl = (p, lhs, rhs, y, t0, { xEq = 380, size = 40, fill = COL.chalk } = {}) => {
+ const g = G(p, { o: 0 });
+ M(g, [].concat(lhs), { x: xEq - 22, y, size, fill, anchor: 'end' });
+ M(g, ['='], { x: xEq, y, size, fill, anchor: 'middle' });
+ M(g, [].concat(rhs), { x: xEq + 22, y, size, fill, anchor: 'start' });
+ show(g, t0);
+ return g;
+};
+// A box round part of an equation (stage coordinates), shown from t0 for a while.
+const hl = (p, x, y, w, h, t0, t1, color = COL.task) => {
+ const r = mk('rect', { x, y, width: w, height: h, rx: 10, fill: 'none', stroke: color, 'stroke-width': 3 }, p);
+ put(r, { o: 0 }); show(r, t0, .3); if (t1) hide(r, t1, .4);
+ return r;
+};
+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); };
+// Each number of row 2 lit as the voice names its subtraction.
+const lightCells = (el, ts) => ts.forEach((t, j) => el.flash(1, t, j));
+// The x, y and b of a system after "row 2 − l × row 1".
+const after = (A, b, l) => ({ a10: A[1][0] - l * A[0][0], a11: A[1][1] - l * A[0][1], b1: b[1] - l * b[0] });
+
+/* ---------- practice data (every answer worked twice: by the step, and by putting the solution back) ---------- */
+const NEWQ = [
+ { parts: ['x + 2y = 4', ', ', '3x + 5y = 11', ', row 2 − 3 × row 1: ', { box: '-1' }, 'y = ', { box: '-1' }], why: '5 − 3·2 = −1 and 11 − 3·4 = −1: −y = −1.', hint: '3 × row 1 is 3x + 6y = 12. Take it away: 5 − 6 and 11 − 12.' },
+ { parts: ['x − y = 1', ', ', '2x + 3y = 12', ', row 2 − 2 × row 1: ', { box: '5' }, 'y = ', { box: '10' }], why: '3 − 2·(−1) = 5 and 12 − 2·1 = 10: 5y = 10.', hint: '2 × row 1 is 2x − 2y = 2. Then 3 − (−2) = 5.' },
+ { parts: ['2x + y = 5', ', ', '4x + 5y = 13', ', row 2 − 2 × row 1: ', { box: '3' }, 'y = ', { box: '3' }], why: '5 − 2·1 = 3 and 13 − 2·5 = 3: 3y = 3.', hint: '2 × row 1 is 4x + 2y = 10.' },
+ { parts: ['x + 4y = 6', ', ', '5x + 2y = 12', ', row 2 − 5 × row 1: ', { box: '-18' }, 'y = ', { box: '-18' }], why: '2 − 5·4 = −18 and 12 − 5·6 = −18: −18y = −18.', hint: '5 × row 1 is 5x + 20y = 30.' },
+ { parts: ['3x − 2y = 1', ', ', '6x + y = 17', ', row 2 − 2 × row 1: ', { box: '5' }, 'y = ', { box: '15' }], why: '1 − 2·(−2) = 5 and 17 − 2·1 = 15: 5y = 15.', hint: '2 × row 1 is 6x − 4y = 2. Then 1 − (−4) = 5.' },
+];
+const MULTQ = [
+ { parts: ['x + y = 2', ', ', '4x − y = 3', ': multiplier ', { box: '4' }], why: '4x is 4 times x.', hint: 'What times 1 gives 4?' },
+ { parts: ['2x + y = 1', ', ', '6x + 2y = 0', ': multiplier ', { box: '3' }], why: '6 = 3 · 2.', hint: 'What times 2 gives 6?' },
+ { parts: ['3x − y = 2', ', ', '6x + 5y = 4', ': multiplier ', { box: '2' }], why: '6 = 2 · 3.', hint: 'What times 3 gives 6?' },
+ { parts: ['5x + 2y = 1', ', ', '5x − y = 7', ': multiplier ', { box: '1' }], why: 'The x numbers already match: take row 1 away once.', hint: 'Both rows have 5x already.' },
+ { parts: ['2x + 7y = 3', ', ', '10x + y = 1', ': multiplier ', { box: '5' }], why: '10 = 5 · 2.', hint: 'What times 2 gives 10?' },
+ { parts: ['x − 3y = 0', ', ', '7x + 2y = 5', ': multiplier ', { box: '7' }], why: '7x is 7 times x.', hint: 'What times 1 gives 7?' },
+];
+const SOLVEQ = [
+ { parts: ['x + y = 5', ', ', '2x + 3y = 12', ': x = ', { box: '3' }, ', y = ', { box: '2' }], why: 'Row 2 − 2 × row 1: y = 2. Then x + 2 = 5, x = 3. Check: 6 + 6 = 12.', hint: 'Take 2 × row 1 (2x + 2y = 10) from row 2: that leaves y alone.' },
+ { parts: ['x + 2y = 3', ', ', '4x + 5y = 6', ': x = ', { box: '-1' }, ', y = ', { box: '2' }], why: 'Row 2 − 4 × row 1: −3y = −6, y = 2. Then x + 4 = 3, x = −1. Check: −4 + 10 = 6.', hint: '4 × row 1 is 4x + 8y = 12. Then 5 − 8 = −3 and 6 − 12 = −6.' },
+ { parts: ['2x + y = 5', ', ', '6x + 4y = 16', ': x = ', { box: '2' }, ', y = ', { box: '1' }], why: 'Row 2 − 3 × row 1: y = 1. Then 2x + 1 = 5, x = 2. Check: 12 + 4 = 16.', hint: '3 × row 1 is 6x + 3y = 15. Then 4 − 3 = 1 and 16 − 15 = 1.' },
+ { parts: ['3x − y = 4', ', ', '9x + 2y = 7', ': x = ', { box: '1' }, ', y = ', { box: '-1' }], why: 'Row 2 − 3 × row 1: 5y = −5, y = −1. Then 3x + 1 = 4, x = 1. Check: 9 − 2 = 7.', hint: '3 × row 1 is 9x − 3y = 12. Then 2 − (−3) = 5 and 7 − 12 = −5.' },
+];
+// Hands-on systems (A, b, the multiplier, the solution), each with its meeting point inside the grid.
+const HANDS = [
+ { A: [[1, 1], [3, -1]], b: [1, 7], l: 3, sol: [2, -1] },
+ { A: [[2, 1], [8, 3]], b: [0, -2], l: 4, sol: [-1, 2] },
+ { A: [[3, 2], [6, 7]], b: [5, 4], l: 2, sol: [3, -2] },
+];
+const handTask = h => {
+ const [a, c] = [h.A[0][0], h.A[1][0]], r = after(h.A, h.b, h.l);
+ return elTask(S.el, v => v.a10 === 0,
+ `Times ${h.l}: ${c} − ${h.l}·${a} = 0. Row 2 is ${num(r.a11)}y = ${num(r.b1)}, so y = ${num(h.sol[1])}, and then x = ${num(h.sol[0])}.`,
+ (v, l) => `Row 2 still has ${num(v.a10)}x: ${l < h.l ? 'take away more of row 1' : 'that is too much, go back'}. What times ${a} gives ${c}?`,
+ () => S.el.set({ l: h.l }));
+};
+
+/* ---------- beats: [id, title, run(m, D), { ask }?] ---------- */
+const BEATS = [
+ ['intro', 'Elimination: two equations', (m, D) => {
+ const g = G(scene, { o: 0, y: 24 });
+ T(g, 'Unit 2, Chapter 16', { x: 800, y: 320, size: 28, fill: COL.dim, anchor: 'middle' });
+ T(g, 'Elimination: Two Equations', { x: 800, y: 430, size: 88, weight: 600, anchor: 'middle' });
+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);
+ const r = text(scene, 'take x out of one equation, and the system solves itself', 800, 560, m('sub'), { size: 36, fill: COL.dim, anchor: 'middle' });
+ // two lines cross; the coral one swings about the crossing until it lies flat
+ const lg = G(scene, { x: 800, y: 700, o: 0 });
+ path(lg, 'M-190 70L190 -70', { stroke: BLUE, 'stroke-width': 6, 'stroke-linecap': 'round' });
+ const c = G(lg, { r: -55 });
+ path(c, 'M-170 0H170', { stroke: CORAL, 'stroke-width': 6, 'stroke-linecap': 'round' });
+ mk('circle', { r: 10, fill: COL.chalk, stroke: COL.board, 'stroke-width': 3 }, lg);
+ show(lg, m('sub') + 1, .5); tw(c, { r: 0 }, m('move') + 1.4, 2.2);
+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(lg, D - .9, .8);
+ }],
+
+ ['easy', 'An easy system', (m) => {
+ const p = panel(0);
+ text(p, 'An easy system', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = twoLines(p, [[1, 2], [0, 2]], [5, 4], { t0: m('eq') - .3, lines: false, meet: false });
+ show(sys.lines[0].l, m('eq') + 1, .8);
+ show(sys.lines[1].l, m('flat') + 2.4, .8);
+ flash(sys, 'a10', m('flat'));
+ hl(p, 128, 252, 110, 58, m('flat'), m('y') - .3);
+ text(p, 'no x: a flat line', 520, 300, m('flat') + 2.4, { size: 28, fill: CORAL, weight: 600 });
+ wl(p, '2y', '4', 420, m('y') + 1);
+ wl(p, 'y', '2', 420, m('y') + 3, { xEq: 610, fill: COL.task });
+ say(p, ['→'], 500, 420, m('y') + 3, { size: 40, fill: COL.dim });
+ wl(p, ['x + 2·2'], '5', 500, m('put') + 2.2);
+ wl(p, ['x + 4'], '5', 570, m('x'));
+ wl(p, 'x', '1', 570, m('x') + 2.2, { xEq: 610, fill: COL.task });
+ say(p, ['→'], 500, 570, m('x') + 2.2, { size: 40, fill: COL.dim });
+ show(sys.meetBox, m('meet'), .5);
+ pulse(sys.meet, m('meet') + .3);
+ text(p, 'easy: one equation has lost its x', 90, 680, m('lesson'), { size: 32, fill: COL.task, weight: 600 });
+ flash(sys, 'a10', m('lesson') + 3); thick(sys, 1, m('lesson') + 3.4);
+ text(p, 'the plan: make row 2 lose its x', 90, 740, m('lesson') + 5.5, { size: 32, fill: CORAL, weight: 600 });
+ }],
+
+ ['goal', 'Remove the x', (m) => {
+ const p = S.p = panel(0);
+ text(p, 'Not so easy', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = S.sys = twoLines(p, [[1, 2], [3, 4]], [5, 11], { t0: m('eq') - .3, meet: false });
+ show(sys.meetBox, m('meet'), .5); pulse(sys.meet, m('meet') + .3);
+ const pic = text(p, 'a picture: only about right (chapter 2)', 90, 400, m('meet') + 3.2, { size: 28, fill: COL.dim, weight: 600 });
+ const nums = text(p, 'we want: the numbers alone', 90, 450, m('meet') + 7, { size: 28, fill: COL.task, weight: 600 });
+ [pic, nums].forEach(e => hide(e, m('times') - .3, .3));
+ hl(p, 166, 160, 76, 58, m('three') + 1.7, m('times') + .5); // the x of row 1
+ hl(p, 128, 252, 114, 58, m('three'), m('times') + .5); // the 3x of row 2
+ text(p, '3 × row 1:', 90, 400, m('times'), { size: 30, fill: COL.dim, weight: 600 });
+ say(p, ['3x'], 90, 470, m('t1'), { size: 50, fill: BLUE });
+ say(p, ['+ 6y'], 170, 470, m('t2'), { size: 50, fill: BLUE });
+ say(p, ['= 15'], 310, 470, m('t3'), { size: 50, fill: BLUE });
+ text(p, 'both sides times 3: still true', 90, 540, m('both'), { size: 28, fill: COL.dim });
+ say(p, ['(1, 2): 3·1 + 6·2 = 3 + 12 = 15'], 90, 610, m('chk'), { size: 34, fill: COL.task });
+ okMark(p, 600, 610, m('chk') + 2.6);
+ thick(sys, 0, m('same')); thick(sys, 0, m('same') + 2.2);
+ text(p, 'same line as row 1', 90, 680, m('same') + .4, { size: 28, fill: BLUE, weight: 600 });
+ }],
+
+ ['subtract', 'Subtract', (m) => {
+ const p = panel(0);
+ text(p, 'Take 3 × row 1 away from row 2', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [3, 4]], b = [5, 11];
+ const sys = twoLines(p, A, b, { t0: .2 });
+ // the column sum: row 2, minus 3 × row 1, under a rule, the new row 2
+ const c1 = 220, sg = 262, c2 = 370, eqx = 420, rx = 452, y1 = 420, y2 = 490, y3 = 580;
+ const row = (y, cells, fill, t0s) => cells.map((s, k) => say(p, [s], [c1, sg, c2, eqx, rx][k], y, t0s[k], { size: 46, fill, anchor: ['end', 'middle', 'end', 'middle', 'start'][k] }));
+ row(y1, ['3x', '+', '4y', '=', '11'], CORAL, Array(5).fill(.5));
+ row(y2, ['3x', '+', '6y', '=', '15'], BLUE, Array(5).fill(.7));
+ say(p, ['−'], 108, y2, .7, { size: 46, anchor: 'middle' });
+ text(p, 'row 2', 560, y1 - 6, .5, { size: 28, fill: CORAL, weight: 600 });
+ text(p, '3 × row 1', 560, y2 - 6, .7, { size: 28, fill: BLUE, weight: 600 });
+ hl(p, 140, y1 - 46, 92, 128, m('x'), m('c1') + 1.5);
+ draw(path(p, `M90 ${y2 + 26}H520`, { stroke: COL.chalk, 'stroke-width': 3 }, { d: 0 }), m('sub'), .6);
+ row(y3, ['0x', '−', '2y', '=', '−4'], COL.chalk, [m('c1'), m('c2'), m('c2'), m('c3'), m('c3')]);
+ text(p, 'x is gone', 560, y3 - 6, m('c1') + 1.4, { size: 28, fill: COL.task, weight: 600 });
+ hl(p, 80, y3 - 50, 440, 66, m('res'), m('y') - .2);
+ wl(p, '−2y', '−4', 660, m('y'), { xEq: 200, size: 38 });
+ say(p, ['→'], 320, 660, m('y') + 1.6, { size: 38, fill: COL.dim });
+ wl(p, 'y', '2', 660, m('y') + 1.6, { xEq: 420, size: 38, fill: COL.task });
+ wl(p, 'x + 2·2', '5', 730, m('back') + 1.6, { xEq: 200, size: 38 });
+ say(p, ['→'], 320, 730, m('x2'), { size: 38, fill: COL.dim });
+ wl(p, 'x', '1', 730, m('x2'), { xEq: 420, size: 38, fill: COL.task });
+ // the picture: row 2 becomes −2y = −4 and its line turns flat about (1, 2)
+ ghost(sys, 3, 4, 1, 2, m('row'));
+ sys.to(after(A, b, 3), m('row') + .4, 2);
+ ['a10', 'a11', 'b1'].forEach(k => flash(sys, k, m('row') + 2.4));
+ pin(sys, 1, 2, m('flat'));
+ thick(sys, 1, m('flat') + .2);
+ }],
+
+ ['why', 'Why it is allowed', (m) => {
+ const p = panel(0);
+ text(p, 'Why may we subtract?', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [3, 4]], b = [5, 11];
+ const sys = twoLines(p, A, b, { t0: .2 });
+ wl(p, '3x + 4y', '11', 410, m('r2'), { xEq: 330, fill: CORAL });
+ text(p, 'row 2', 60, 404, m('r2'), { size: 24, fill: CORAL, weight: 600 });
+ wl(p, '3x + 6y', '15', 480, m('r1'), { xEq: 330, fill: BLUE });
+ text(p, '3 × row 1', 30, 474, m('r1'), { size: 24, fill: BLUE, weight: 600 });
+ wl(p, '(3x + 4y) − (3x + 6y)', '11 − 15', 570, m('take'), { xEq: 470, size: 36 });
+ text(p, 'equal minus equal: still equal', 90, 625, m('take') + 2.5, { size: 28, fill: COL.dim });
+ hl(p, 70, 535, 380, 50, m('take') + 4, m('test') - .2); hl(p, 480, 535, 160, 50, m('take') + 5.5, m('test') - .2);
+ pulse(sys.meet, m('test')); pulse(sys.meet, m('test') + 1);
+ say(p, ['(1, 2): 3 + 8 = 11'], 470, 410, m('n1'), { size: 30, fill: COL.task });
+ say(p, ['(1, 2): 3 + 12 = 15'], 470, 480, m('n2'), { size: 30, fill: COL.task });
+ say(p, ['11 − 15 = −4, −2·2 = −4'], 90, 690, m('n3'), { size: 34, fill: COL.task });
+ okMark(p, 520, 690, m('n3') + 3.5);
+ ghost(sys, 3, 4, 1, 2, m('on') - .4);
+ sys.to(after(A, b, 3), m('on'), 1.8);
+ pin(sys, 1, 2, m('on') + .4);
+ text(p, 'add 3 × row 1 back: row 2 returns', 90, 760, m('back'), { size: 28, fill: COL.dim, weight: 600 });
+ sys.to({ a10: 3, a11: 4, b1: 11 }, m('back') + 1.2, 1.8);
+ sys.to(after(A, b, 3), m('same'), 1.8);
+ }],
+
+ ['q1', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = twoLines(p, [[1, 3], [2, 5]], [5, 8], { meet: false });
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-new', prompt: ['Row 2 − 2 × row 1, one piece at a time.'],
+ build: blanks([
+ { parts: ['2 × row 1: 2x + ', { box: '6' }, 'y = ', { box: '10' }], why: '2·3 = 6 and 2·5 = 10: both sides times 2.', hint: 'Multiply every number of x + 3y = 5 by 2, the right side too.' },
+ { parts: ['row 2 − 2 × row 1: ', { box: '-1' }, 'y = ', { box: '-2' }], why: '2x − 2x = 0; 5y − 6y = −y; 8 − 10 = −2.', hint: 'Take 2x + 6y = 10 away from 2x + 5y = 8: 5 − 6, and 8 − 10.',
+ fx: () => { const s = S.sys, f = { ...s.v }; fxp(q => s.set({ a10: f.a10 * (1 - q), a11: f.a11 + (-1 - f.a11) * q, b1: f.b1 + (-2 - f.b1) * q }), 0, 1.6); } },
+ { parts: ['so y = ', { box: '2' }, ', x = ', { box: '-1' }], why: '−y = −2 gives y = 2; then x + 6 = 5, so x = −1.', hint: '−y = −2 means y = 2. Put 2 into x + 3y = 5.',
+ fx: () => fx(S.sys.meetBox, { o: 1 }, .2, .5) },
+ ]),
+ }], done) }],
+
+ ['matrix', 'Only the numbers', (m) => {
+ const p = panel(0);
+ text(p, 'Keep only the numbers', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [3, 4]], b = [5, 11];
+ const sys = twoLines(p, A, b, { t0: m('eq') - .3 });
+ const el = elim(p, sys, { at: MAT, t0: 0 });
+ put(el.g, { o: 1 });
+ // the numbers fly from the equations into the table: A's at 'a', b's at 'b'
+ el.cells.forEach((row, i) => row.forEach((cl, j) => put(cl.c, { o: 0 })));
+ put(el.g.firstChild, { o: 0 }); put(el.divider, { o: 0 });
+ show(el.g.firstChild, m('a') + 1, .4); show(el.names, m('a') + 1, .4);
+ const fly = (val, x, y, i, j, t0) => {
+ const f = say(p, [num(val)], x, y, t0, { size: 50, anchor: 'middle', fill: j === 2 ? COL.task : COL.chalk });
+ tw(f, { x: el.cx(j), y: el.ry(i), s: .92 }, t0 + .1, .9);
+ hide(f, t0 + 1, .1); show(el.cells[i][j].c, t0 + .95, .1);
+ };
+ [0, 1].forEach(i => {
+ fly(A[i][0], 185, 200 + 92 * i, i, 0, m('a') + .2 * i);
+ fly(A[i][1], 345, 200 + 92 * i, i, 1, m('a') + .3 + .2 * i);
+ fly(b[i], 492, 200 + 92 * i, i, 2, m('b') + .2 * i);
+ });
+ show(el.divider, m('aug'), .5);
+ pulse(el.g.firstChild, m('aug') + 2.5, 1.06);
+ hide(text(p, 'augmented = made bigger', 480, 548, m('aug') + 5, { size: 26, fill: COL.dim, weight: 600 }), m('step') - .3, .3);
+ el.flash(0, m('row') + 2); el.flash(1, m('row2') + .6);
+ hide(text(p, '[ A | b ]', 480, 488, m('aug') + 1, { size: 34, fill: COL.dim, weight: 600 }), m('step') - .3, .3);
+ el.focus(0, m('row')); sys.focus(0, m('row'));
+ el.focus(1, m('row2')); sys.focus(1, m('row2'));
+ el.focus(null, m('step')); sys.focus(null, m('step'));
+ el.op(1, 0, 3, m('step'));
+ el.ring(0, 0, m('piv'));
+ el.ring(1, 0, m('rem'), { dash: true });
+ el.line([3, 6, 15], 2, m('three'), { label: '3 × row 1', color: BLUE });
+ ghost(sys, 3, 4, 1, 2, m('go'));
+ el.mult(3, m('go') + .3, 2.4, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ thick(sys, 1, m('same') + 1.5);
+ }],
+
+ ['swing', 'A little at a time', (m) => {
+ const p = panel(0);
+ text(p, 'Row 2 − ℓ × row 1, a little at a time', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [3, 4]], b = [5, 11];
+ const sys = twoLines(p, A, b, { t0: .2 });
+ const el = elim(p, sys, { at: MAT, t0: .2 });
+ ghost(sys, 3, 4, 1, 2, .6);
+ el.op(1, 0, 0, m('l0'));
+ el.mult(1, m('l1'), 1.4);
+ el.mult(2, m('l2'), 1.4);
+ const up = text(p, 'y is gone, not x', 90, 640, m('up'), { size: 30, fill: COL.task, weight: 600 });
+ hide(up, m('l3') - .2, .3);
+ el.mult(3, m('l3'), 1.4);
+ const fl = text(p, 'flat: x is gone', 90, 640, m('flat'), { size: 30, fill: COL.task, weight: 600 });
+ hide(fl, m('l4') - .2, .3);
+ el.mult(4, m('l4'), 1.2);
+ el.mult(3, m('back3'), 1.2);
+ say(p, ['3 − 3·1 = 0'], 90, 640, m('back3') + 1.6, { size: 36, fill: COL.task });
+ const pn = pin(sys, 1, 2, m('pin'));
+ pulse(pn, m('pin') + 2.5, 1.4); pulse(pn, m('pin') + 4.5, 1.4);
+ text(p, 'the meeting point never moves', 90, 710, m('pin') + .5, { size: 30, fill: COL.task, weight: 600 });
+ }],
+
+ ['ex2', 'Another one', (m) => {
+ const p = panel(0);
+ text(p, 'Another one', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[2, 1], [6, 5]], b = [3, 7];
+ const sys = twoLines(p, A, b, { t0: m('eq') - .3, meet: false });
+ const el = elim(p, sys, { at: MAT, t0: m('mat') - .2 });
+ el.ring(1, 0, m('which'), { dash: true }); el.ring(0, 0, m('which') + .5);
+ hide(say(p, ['6 = 3 · 2'], 480, 650, m('l') + .2, { size: 34, fill: COL.task }), m('y') - .3, .3);
+ el.op(1, 0, 3, m('l') + 1.6);
+ const w = el.line([6, 3, 9], 2, m('three'), { label: '3 × row 1', color: BLUE });
+ ghost(sys, 6, 5, 2, -1, m('go'));
+ el.mult(3, m('go') + .2, 2.2, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ thick(sys, 1, m('flat'));
+ hide(w, m('y') - .3, .3);
+ wl(p, '2y', '−2', 600, m('y') + .6, { xEq: 200, size: 38 });
+ say(p, ['→'], 320, 600, m('y') + 2.4, { size: 38, fill: COL.dim });
+ wl(p, 'y', '−1', 600, m('y') + 2.4, { xEq: 420, size: 38, fill: COL.task });
+ wl(p, '2x − 1', '3', 670, m('x'), { xEq: 200, size: 38 });
+ say(p, ['→'], 320, 670, m('x') + 2.2, { size: 38, fill: COL.dim });
+ wl(p, '2x', '4', 670, m('x') + 2.2, { xEq: 420, size: 38 });
+ wl(p, 'x', '2', 740, m('x2'), { xEq: 420, size: 38, fill: COL.task });
+ show(sys.meetBox, m('pt'), .5); pulse(sys.meet, m('pt') + .3);
+ }],
+
+ ['q2', 'Your turn', () => {
+ const p = panel(0);
+ text(p, 'Your turn', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = S.sys = twoLines(p, [[1, 1], [4, 2]], [3, 10]);
+ S.el = elim(p, sys, { at: MAT });
+ S.el.op(1, 0, 0, .3);
+ }, { ask: done => quiz(LOW, [{
+ id: 'c-flat', prompt: ['Find the multiplier that makes the coral line flat.'],
+ build: handTask({ A: [[1, 1], [4, 2]], b: [3, 10], l: 4, sol: [2, 1] }),
+ }], done) }],
+
+ ['ex3', 'With a minus sign', (m) => {
+ const p = panel(0);
+ text(p, 'With a minus sign', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[3, 1], [6, -1]], b = [7, 11];
+ const sys = twoLines(p, A, b, { t0: m('eq') - .3, meet: false });
+ const el = elim(p, sys, { at: MAT, t0: m('eq') });
+ el.ring(1, 0, m('l'), { dash: true }); el.ring(0, 0, m('l') + .5);
+ el.op(1, 0, 2, m('l') + 2);
+ const w = el.line([6, 2, 14], 2, m('two'), { label: '2 × row 1', color: BLUE });
+ ghost(sys, 6, -1, 2, 1, m('go'));
+ el.mult(2, m('go') + .2, 2, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ const sgn = say(p, ['−1 − 2 = −3'], 470, 680, m('e2') + 1, { size: 34, fill: COL.task });
+ hide(sgn, m('y') - .3, .3);
+ hide(w, m('y') - .3, .3);
+ const wg = G(p, {});
+ wl(wg, '−3y', '−3', 600, m('y') + .4, { xEq: 200, size: 38 });
+ say(wg, ['→'], 320, 600, m('y') + 2.4, { size: 38, fill: COL.dim });
+ wl(wg, 'y', '1', 600, m('y') + 2.4, { xEq: 420, size: 38, fill: COL.task });
+ wl(wg, '3x + 1', '7', 660, m('x'), { xEq: 200, size: 38 });
+ say(wg, ['→'], 320, 660, m('x') + 2.4, { size: 38, fill: COL.dim });
+ wl(wg, '3x', '6', 660, m('x') + 2.4, { xEq: 420, size: 38 });
+ say(wg, ['→'], 500, 660, m('x2'), { size: 38, fill: COL.dim });
+ wl(wg, 'x', '2', 660, m('x2'), { xEq: 610, size: 38, fill: COL.task });
+ tw(wg, { o: 0 }, m('chk') - .4, .4);
+ text(p, 'check (2, 1) in the original equations:', 90, 600, m('chk'), { size: 28, fill: COL.dim, weight: 600 });
+ say(p, ['3x + y = 7: 3·2 + 1 = 7'], 90, 665, m('c1'), { size: 36, fill: BLUE });
+ okMark(p, 560, 665, m('c1') + 2.2);
+ say(p, ['6x − y = 11: 6·2 − 1 = 11'], 90, 730, m('c2'), { size: 36, fill: CORAL });
+ okMark(p, 560, 730, m('c2') + 2.4);
+ show(sys.meetBox, m('ok'), .5); pulse(sys.meet, m('ok') + .3);
+ }],
+
+ ['q3', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = twoLines(p, [[1, 1], [2, 3]], [4, 11]);
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-which', prompt: ['Row 2 − 2 × row 1 gives which new row 2?'],
+ build: choice([[$m('y = 3')], [$m('y = 7')], [$m('2y = 3')], [$m('4x + 5y = 19')]], 0,
+ '2 × row 1 is 2x + 2y = 8. Take it away: 3y − 2y = y and 11 − 8 = 3.',
+ [null, 'The right side was not multiplied: take away 2 × 4 = 8, not 4.', 'Only the x number was doubled: 2 × row 1 is 2x + 2y, so 3y − 2y = y.', 'That adds 2 × row 1. Subtract it, so the x numbers cancel.'],
+ () => { const s = S.sys; fxp(q => s.set({ a10: 2 - 2 * q, a11: 3 - 2 * q, b1: 11 - 8 * q }), 0, 1.6); }),
+ }], done) }],
+
+ ['wrap', 'Summary', (m) => {
+ const p = panel(0);
+ [['To eliminate x: subtract a multiple of row 1 from row 2.', 'w1'], ['Choose the multiple that makes the x numbers match.', 'w2'],
+ ['Equal minus equal stays equal: the line turns about the meeting point.', 'w3'], ['Row 2 gives y; put it into row 1 for x; check the original equations.', 'w4']].forEach(([str, mark], i) => {
+ const g = G(p, { x: -16, y: 230 + i * 130, 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' });
+ T(g, str, { x: 210, size: 36, weight: 600 });
+ tw(g, { o: 1, x: 0 }, m(mark), .6);
+ });
+ }],
+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{
+ id: 'p-new', prompt: ['Work out the new row 2. The x is gone, so only y and the right side are left.'],
+ build: blanks(NEWQ),
+ }], done, 'Chapter practice · set 1 of 4') }],
+ ['final2', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-mult', prompt: ['Which multiple of row 1 removes the x from row 2?'],
+ build: blanks(MULTQ),
+ }], done, 'Chapter practice · set 2 of 4') }],
+ ['final3', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-solve', prompt: ['Solve by elimination, then check in both equations.'],
+ build: blanks(SOLVEQ),
+ }], done, 'Chapter practice · set 3 of 4') }],
+ ['final4', 'Chapter practice', () => {
+ const p = panel(0);
+ text(p, 'Make it flat', 60, 110, .2, { size: 40, weight: 600 });
+ const h = HANDS[0], sys = S.sys = twoLines(p, h.A, h.b);
+ S.el = elim(p, sys, { at: MAT });
+ S.el.op(1, 0, 0, .3);
+ }, { ask: done => quiz(LOW, HANDS.map((h, k) => ({
+ id: `p-flat${k + 1}`, prompt: ['Find the multiplier that makes the coral line flat.'],
+ build: (body, api) => { S.el.load({ a00: h.A[0][0], a01: h.A[0][1], a10: h.A[1][0], a11: h.A[1][1], b0: h.b[0], b1: h.b[1] }); return handTask(h)(body, api); },
+ })), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = S.sys = twoLines(p, [[1, 2], [3, 4]], [5, 11]);
+ S.el = elim(p, sys, { at: MAT });
+ S.el.op(1, 0, 0, .3);
+ const hint = text(p, 'try: make it flat, make it stand up, change row 1 and find the new multiplier', 90, 340, m('go'), { size: 24, fill: COL.dim });
+ hide(hint, m('go') + 8, .6);
+ }, { ask: playAsk(() => S.el, { pos: { x: 40, y: 556, w: 720, cls: 'side' }, tip: 'Your system. Drag the multiplier, 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 }));
+
+boot();
+</script>
+</body>
+</html>
diff --git a/site/linear-algebra/ch17/audio/en/drill.mp3 b/site/linear-algebra/ch17/audio/en/drill.mp3
new file mode 100644
index 0000000..bc4bd99
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/drill.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/final1.mp3 b/site/linear-algebra/ch17/audio/en/final1.mp3
new file mode 100644
index 0000000..2d56933
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/final1.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/final2.mp3 b/site/linear-algebra/ch17/audio/en/final2.mp3
new file mode 100644
index 0000000..bc511a2
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/final2.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/final3.mp3 b/site/linear-algebra/ch17/audio/en/final3.mp3
new file mode 100644
index 0000000..dbdd265
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/final3.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/final4.mp3 b/site/linear-algebra/ch17/audio/en/final4.mp3
new file mode 100644
index 0000000..2c5539d
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/final4.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/finish.mp3 b/site/linear-algebra/ch17/audio/en/finish.mp3
new file mode 100644
index 0000000..3a64826
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/finish.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/fraction.mp3 b/site/linear-algebra/ch17/audio/en/fraction.mp3
new file mode 100644
index 0000000..251734a
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/fraction.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/intro.mp3 b/site/linear-algebra/ch17/audio/en/intro.mp3
new file mode 100644
index 0000000..dc84068
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/intro.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/names.mp3 b/site/linear-algebra/ch17/audio/en/names.mp3
new file mode 100644
index 0000000..594fa30
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/names.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/negative.mp3 b/site/linear-algebra/ch17/audio/en/negative.mp3
new file mode 100644
index 0000000..ccc48da
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/negative.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/play.mp3 b/site/linear-algebra/ch17/audio/en/play.mp3
new file mode 100644
index 0000000..09efedd
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/q1.mp3 b/site/linear-algebra/ch17/audio/en/q1.mp3
new file mode 100644
index 0000000..ecfedc5
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/q1.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/q2.mp3 b/site/linear-algebra/ch17/audio/en/q2.mp3
new file mode 100644
index 0000000..6ee9d78
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/q2.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/q3.mp3 b/site/linear-algebra/ch17/audio/en/q3.mp3
new file mode 100644
index 0000000..5365144
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/q3.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/rule.mp3 b/site/linear-algebra/ch17/audio/en/rule.mp3
new file mode 100644
index 0000000..2964034
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/rule.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/timings.js b/site/linear-algebra/ch17/audio/en/timings.js
new file mode 100644
index 0000000..56a2cc1
--- /dev/null
+++ b/site/linear-algebra/ch17/audio/en/timings.js
@@ -0,0 +1,629 @@
+window.TIMINGS = {
+ "intro": {
+ "dur": 14.712,
+ "marks": {
+ "sub": 3.88,
+ "move": 11.25
+ },
+ "cues": [
+ [
+ 0.091,
+ "Chapter seventeen."
+ ],
+ [
+ 1.667,
+ "Pivots and multipliers."
+ ],
+ [
+ 3.88,
+ "Every step of elimination is driven by two numbers."
+ ],
+ [
+ 7.331,
+ "Today they get their names: the pivot, and the multiplier."
+ ],
+ [
+ 11.25,
+ "Once you know them, you can find any step with one division."
+ ]
+ ]
+ },
+ "names": {
+ "dur": 43.992,
+ "marks": {
+ "sys": 3.659,
+ "step": 9.102,
+ "piv": 12.578,
+ "rem": 20.951,
+ "mult": 23.958,
+ "go": 31.706,
+ "zero": 32.956,
+ "second": 35.273
+ },
+ "cues": [
+ [
+ 0.117,
+ "Here's the system from chapter sixteen, as a table."
+ ],
+ [
+ 3.659,
+ "x plus two y equals five, and three x plus four y equals eleven."
+ ],
+ [
+ 9.102,
+ "We took three times row one away from row two."
+ ],
+ [
+ 12.578,
+ "The one we used, at the start of row one, is called the pivot."
+ ],
+ [
+ 16.484,
+ "It's the number that does the eliminating, and its row is the pivot row."
+ ],
+ [
+ 20.951,
+ "The three below it is the number we want to remove."
+ ],
+ [
+ 23.958,
+ "And three, how many times we take the pivot row away, is called the multiplier."
+ ],
+ [
+ 29.961,
+ "We write it with the letter l."
+ ],
+ [
+ 31.706,
+ "Here's the step again."
+ ],
+ [
+ 32.956,
+ "Now a zero sits under the pivot."
+ ],
+ [
+ 35.273,
+ "And look at the new row two."
+ ],
+ [
+ 37.083,
+ "It starts with minus two."
+ ],
+ [
+ 38.789,
+ "That's the second pivot: the number we'd use next, if there were more rows below."
+ ]
+ ]
+ },
+ "rule": {
+ "dur": 52.656,
+ "marks": {
+ "sys": 1.888,
+ "piv": 6.901,
+ "rem": 8.464,
+ "wrong": 10.651,
+ "bad": 13.425,
+ "ask": 18.698,
+ "div": 22.526,
+ "rule": 28.281,
+ "go": 33.346,
+ "e1": 36.276,
+ "e2": 38.789,
+ "e3": 41.406,
+ "y": 44.01,
+ "x": 48.086
+ },
+ "cues": [
+ [
+ 0.117,
+ "So how do you find the multiplier?"
+ ],
+ [
+ 1.888,
+ "Take four x minus y equals five, and eight x plus y equals seven."
+ ],
+ [
+ 6.901,
+ "The pivot is four."
+ ],
+ [
+ 8.464,
+ "The number to remove is eight."
+ ],
+ [
+ 10.651,
+ "It's tempting to take eight times row one."
+ ],
+ [
+ 13.425,
+ "But eight times four is thirty-two, and eight minus thirty-two isn't zero."
+ ],
+ [
+ 18.698,
+ "We need eight minus l times four to be zero."
+ ],
+ [
+ 22.526,
+ "So l times four must be eight, and l is eight divided by four, which is two."
+ ],
+ [
+ 28.281,
+ "That's the rule."
+ ],
+ [
+ 29.362,
+ "The multiplier is the number to remove, divided by the pivot."
+ ],
+ [
+ 33.346,
+ "Row two minus two times row one."
+ ],
+ [
+ 36.276,
+ "Eight minus eight is zero."
+ ],
+ [
+ 38.789,
+ "One minus minus two is three."
+ ],
+ [
+ 41.406,
+ "Seven minus ten is minus three."
+ ],
+ [
+ 44.01,
+ "Three y equals minus three, so y equals minus one."
+ ],
+ [
+ 48.086,
+ "Then four x plus one equals five, so x equals one."
+ ]
+ ]
+ },
+ "q1": {
+ "dur": 6.072,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.172,
+ "Find each multiplier: the number to remove, divided by the pivot."
+ ]
+ ]
+ },
+ "negative": {
+ "dur": 47.016,
+ "marks": {
+ "sys": 2.188,
+ "div": 7.552,
+ "op": 14.57,
+ "plus": 19.01,
+ "two": 24.036,
+ "go": 26.979,
+ "e1": 28.333,
+ "e2": 31.289,
+ "e3": 33.086,
+ "turn": 35.247,
+ "y": 39.557,
+ "x": 42.643
+ },
+ "cues": [
+ [
+ 0.078,
+ "A multiplier can be negative."
+ ],
+ [
+ 2.188,
+ "x plus two y equals three, and minus two x plus y equals four."
+ ],
+ [
+ 7.552,
+ "The number to remove is minus two."
+ ],
+ [
+ 10.169,
+ "The pivot is one."
+ ],
+ [
+ 11.55,
+ "Minus two divided by one is minus two."
+ ],
+ [
+ 14.57,
+ "So the step is row two minus, minus two, times row one."
+ ],
+ [
+ 19.01,
+ "Taking away minus two rows is the same as adding two rows."
+ ],
+ [
+ 24.036,
+ "Two times row one is two, four, six."
+ ],
+ [
+ 26.979,
+ "Add it to row two."
+ ],
+ [
+ 28.333,
+ "Minus two plus two is zero."
+ ],
+ [
+ 31.289,
+ "One plus four is five."
+ ],
+ [
+ 33.086,
+ "Four plus six is ten."
+ ],
+ [
+ 35.247,
+ "This time the line swings the other way, but still about the meeting point."
+ ],
+ [
+ 39.557,
+ "Five y equals ten, so y equals two."
+ ],
+ [
+ 42.643,
+ "x plus four equals three, so x equals minus one."
+ ]
+ ]
+ },
+ "fraction": {
+ "dur": 46.92,
+ "marks": {
+ "sys": 2.552,
+ "div": 7.37,
+ "op": 10.911,
+ "h1": 13.88,
+ "h2": 16.367,
+ "h3": 18.945,
+ "go": 22.057,
+ "e1": 23.216,
+ "e2": 25.586,
+ "e3": 28.464,
+ "piv2": 32.214,
+ "y": 35.195,
+ "x": 40.247
+ },
+ "cues": [
+ [
+ 0.065,
+ "A multiplier can be a fraction too."
+ ],
+ [
+ 2.552,
+ "Two x plus y equals three, and three x plus four y equals two."
+ ],
+ [
+ 7.37,
+ "Three divided by the pivot, two, is three halves."
+ ],
+ [
+ 10.911,
+ "Row two minus three halves times row one."
+ ],
+ [
+ 13.88,
+ "Three halves times two is three."
+ ],
+ [
+ 16.367,
+ "Three halves times one is three halves."
+ ],
+ [
+ 18.945,
+ "Three halves times three is nine halves."
+ ],
+ [
+ 22.057,
+ "Subtract."
+ ],
+ [
+ 23.216,
+ "Three minus three is zero."
+ ],
+ [
+ 25.586,
+ "Four minus three halves is five halves."
+ ],
+ [
+ 28.464,
+ "Two minus nine halves is minus five halves."
+ ],
+ [
+ 32.214,
+ "The second pivot is five halves."
+ ],
+ [
+ 35.195,
+ "Five halves y equals minus five halves, so y equals minus one."
+ ],
+ [
+ 40.247,
+ "Then two x minus one equals three."
+ ],
+ [
+ 43.542,
+ "Two x equals four, and x equals two."
+ ]
+ ]
+ },
+ "drill": {
+ "dur": 29.304,
+ "marks": {
+ "a": 3.268,
+ "b": 9.154,
+ "c": 17.096,
+ "same": 23.763
+ },
+ "cues": [
+ [
+ 0.143,
+ "Three quick ones."
+ ],
+ [
+ 1.393,
+ "Watch the two numbers in each."
+ ],
+ [
+ 3.268,
+ "The pivot is five, and the number to remove is ten."
+ ],
+ [
+ 7.005,
+ "Ten divided by five is two."
+ ],
+ [
+ 9.154,
+ "The pivot is minus three, and the number to remove is six."
+ ],
+ [
+ 13.854,
+ "Six divided by minus three is minus two."
+ ],
+ [
+ 17.096,
+ "The pivot is four, and the number to remove is two."
+ ],
+ [
+ 21.068,
+ "Two divided by four is one half."
+ ],
+ [
+ 23.763,
+ "Every time, the same division: the number to remove on top, the pivot underneath."
+ ]
+ ]
+ },
+ "q2": {
+ "dur": 6.576,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Your turn."
+ ],
+ [
+ 1.094,
+ "This multiplier is a fraction."
+ ],
+ [
+ 3.451,
+ "Drag it in halves until the line lies flat."
+ ]
+ ]
+ },
+ "triangle": {
+ "dur": 36.792,
+ "marks": {
+ "diag": 2.175,
+ "below": 8.229,
+ "tri": 11.146,
+ "why": 18.88,
+ "never": 27.943
+ },
+ "cues": [
+ [
+ 0.091,
+ "Look at the table after the step."
+ ],
+ [
+ 2.175,
+ "The pivots sit on a slanting line from the top left."
+ ],
+ [
+ 5.833,
+ "That line is called the diagonal."
+ ],
+ [
+ 8.229,
+ "Below the diagonal there are only zeros."
+ ],
+ [
+ 11.146,
+ "The other numbers make a triangle, in the upper right."
+ ],
+ [
+ 14.323,
+ "So the result has a name: an upper triangular matrix, written U."
+ ],
+ [
+ 18.88,
+ "A triangle is just what we want, because its bottom row has only one unknown."
+ ],
+ [
+ 24.583,
+ "You solve it from the bottom up."
+ ],
+ [
+ 26.224,
+ "That's chapter nineteen."
+ ],
+ [
+ 27.943,
+ "One warning."
+ ],
+ [
+ 29.023,
+ "The pivot is the number we divide by, so a pivot can never be zero."
+ ],
+ [
+ 33.49,
+ "What to do when a zero lands there is chapter twenty."
+ ]
+ ]
+ },
+ "q3": {
+ "dur": 3.6,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.094,
+ "Name the pivots and the multiplier."
+ ]
+ ]
+ },
+ "wrap": {
+ "dur": 25.296,
+ "marks": {
+ "w1": 1.029,
+ "w2": 7.201,
+ "w3": 11.237,
+ "w4": 15.781,
+ "end": 22.93
+ },
+ "cues": [
+ [
+ 0.104,
+ "To sum up."
+ ],
+ [
+ 1.029,
+ "The pivot is the first number of the row we use."
+ ],
+ [
+ 3.776,
+ "The multiplier is how many times we take that row away."
+ ],
+ [
+ 7.201,
+ "The multiplier is the number to remove, divided by the pivot."
+ ],
+ [
+ 11.237,
+ "A multiplier can be negative, which means adding, or a fraction."
+ ],
+ [
+ 15.781,
+ "After elimination the pivots sit on the diagonal, with zeros below: an upper triangular matrix, U."
+ ],
+ [
+ 22.93,
+ "Now try the chapter practice."
+ ]
+ ]
+ },
+ "final1": {
+ "dur": 3.336,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice."
+ ],
+ [
+ 1.589,
+ "Find each multiplier."
+ ]
+ ]
+ },
+ "final2": {
+ "dur": 2.112,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Next, find both pivots."
+ ]
+ ]
+ },
+ "final3": {
+ "dur": 2.376,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Now work out the new row two."
+ ]
+ ]
+ },
+ "final4": {
+ "dur": 3.648,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Last set."
+ ],
+ [
+ 1.25,
+ "Make each line flat with your hands."
+ ]
+ ]
+ },
+ "play": {
+ "dur": 14.184,
+ "marks": {
+ "go": 4.102
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.107,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 4.102,
+ "The multiplier moves in halves here."
+ ],
+ [
+ 6.458,
+ "Change the pivot, change the number to remove, and find the multiplier that makes the line flat."
+ ],
+ [
+ 12.474,
+ "Press continue when you're done."
+ ]
+ ]
+ },
+ "finish": {
+ "dur": 12.12,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Well done."
+ ],
+ [
+ 1.12,
+ "That's the end of chapter seventeen, pivots and multipliers."
+ ],
+ [
+ 5.664,
+ "Next: elimination with three equations, where every step turns a plane in space."
+ ]
+ ]
+ }
+};
diff --git a/site/linear-algebra/ch17/audio/en/triangle.mp3 b/site/linear-algebra/ch17/audio/en/triangle.mp3
new file mode 100644
index 0000000..0fd1e3b
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/triangle.mp3 differ
diff --git a/site/linear-algebra/ch17/audio/en/wrap.mp3 b/site/linear-algebra/ch17/audio/en/wrap.mp3
new file mode 100644
index 0000000..c47e4d9
Binary files /dev/null and b/site/linear-algebra/ch17/audio/en/wrap.mp3 differ
diff --git a/site/linear-algebra/ch17/index.html b/site/linear-algebra/ch17/index.html
new file mode 100644
index 0000000..e493f27
--- /dev/null
+++ b/site/linear-algebra/ch17/index.html
@@ -0,0 +1,362 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Pivots and Multipliers</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run -->
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../lib/math.js"></script>
+<script src="../lib/linsys.js"></script>
+<script src="../lib/elim.js"></script>
+<script src="../lib/play.js"></script>
+<script src="audio/en/timings.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 17, title: 'Pivots and Multipliers', minutes: 10, language: 'en', next: '../ch18/' };
+
+/* ---------- chapter drawing helpers ---------- */
+// This chapter works on [A | b] alone: the table sits where the equations were (linsys shows fractions as decimals,
+// and here the multipliers are fractions), with the system written once above it.
+const BLUE = LS_ROW[0], CORAL = LS_ROW[1];
+const TOP = [120, 280]; // [A | b]: rows at 280 and 358
+const CARD = { x: 40, y: 410, w: 720, cls: 'side' }; // under the table, beside the plane
+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; };
+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500 } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, o: 0 }); show(e, t0); return e; };
+const okMark = (p, x, y, t0, size = 34) => text(p, '✓', x, y, t0, { size, fill: COL.good, weight: 700 });
+// The system as a table with its plane: the equations written once (dim) above [A | b]; the meeting point labelled.
+const table = (p, A, b, caption, { t0 = .1, meet = true, dens = [1, 2], step = 1 } = {}) => {
+ const sys = linsys(p, { A, b, eq: [90, 200], mat: null, sol: false, t0 });
+ sys.E.style.display = 'none';
+ if (!meet) put(sys.meetBox, { o: 0 });
+ const cap = say(p, [caption], 90, 182, t0 + .1, { size: 32, fill: COL.dim });
+ const el = elim(p, sys, { at: TOP, size: 50, cw: 92, rh: 78, t0, dens, step, labelX: 494 });
+ return { sys, el, cap };
+};
+// The old line of row 2, dashed, through the meeting point (sx, sy).
+const ghost = (sys, a, b, sx, sy, t0) => {
+ const l = sys.P.line(sx, sy, sx + b, sy - a, CORAL, t0, { dash: '10 10', w: 3, into: sys.stage });
+ tw(l, { o: .45 }, t0 + .6, .4);
+ return l;
+};
+const pin = (sys, x, y, t0) => {
+ const g = G(sys.stage, { x: sys.P.PX(x), y: sys.P.PY(y), o: 0 });
+ mk('circle', { r: 20, fill: 'none', stroke: COL.task, 'stroke-width': 3.5, 'stroke-dasharray': '6 5' }, g);
+ show(g, t0, .4);
+ return g;
+};
+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); };
+const lightCells = (el, ts) => ts.forEach((t, j) => el.flash(1, t, j));
+// A small ring or dashed ring beside a legend line, the same marks as in the table.
+const legend = (p, dash, parts, y, t0, fill = COL.chalk) => {
+ const g = G(p, { o: 0 });
+ mk('ellipse', { cx: 108, cy: y - 12, rx: 18, ry: 16, fill: 'none', stroke: COL.chalk, 'stroke-width': 3, ...(dash ? { 'stroke-dasharray': '6 5' } : {}) }, g);
+ M(g, [].concat(parts), { x: 140, y, size: 34, fill, anchor: 'start' });
+ show(g, t0);
+ return g;
+};
+// A system with no picture behind it, for the small tables of the drill and the 3 × 3 preview: the same .v, .to,
+// .set and .onChange that elim uses.
+const bare = (A, b) => {
+ const v = {}, fs = [];
+ A.forEach((r, i) => { r.forEach((x, j) => { v[`a${i}${j}`] = x; }); v[`b${i}`] = b[i]; });
+ let plan = { ...v };
+ const set = to => { Object.assign(v, to); fs.forEach(f => f(v)); };
+ return { v, set, onChange: f => fs.push(f), solve: () => ({}), live() {},
+ to(next, at, dur = 1.2, ease = io) { const from = { ...plan }; plan = { ...plan, ...next }; const goal = { ...plan };
+ prog(q => set(Object.fromEntries(Object.keys(next).map(k => [k, from[k] + (goal[k] - from[k]) * q]))), at, dur, ease); } };
+};
+const keysOf2 = (A, b) => ({ a00: A[0][0], a01: A[0][1], a10: A[1][0], a11: A[1][1], b0: b[0], b1: b[1] });
+
+/* ---------- practice data (every answer worked twice) ---------- */
+const MULTQ = [
+ { parts: ['2x + y = 3', ', ', '8x + 5y = 1', ': ℓ = ', { box: '4' }], why: '8 ÷ 2 = 4.', hint: 'The number to remove is 8, the pivot is 2.' },
+ { parts: ['3x − y = 2', ', ', '−9x + 4y = 1', ': ℓ = ', { box: '-3' }], why: '−9 ÷ 3 = −3.', hint: 'The number to remove is −9: the multiplier is negative.' },
+ { parts: ['−x + 2y = 5', ', ', '4x + y = 0', ': ℓ = ', { box: '-4' }], why: '4 ÷ (−1) = −4.', hint: 'The pivot is −1. Dividing by −1 changes the sign.' },
+ { parts: ['4x + y = 1', ', ', '2x − 3y = 5', ': ℓ = ', { box: '1/2' }], why: '2 ÷ 4 = 1/2.', hint: 'The number to remove, 2, is smaller than the pivot, 4: a fraction.' },
+ { parts: ['2x + 5y = 1', ', ', '3x + y = 4', ': ℓ = ', { box: '3/2' }], why: '3 ÷ 2 = 3/2.', hint: '3 divided by 2. A fraction is fine.' },
+ { parts: ['−2x + y = 3', ', ', '−6x + 2y = 1', ': ℓ = ', { box: '3' }], why: '−6 ÷ (−2) = 3: two minus signs make a plus.', hint: 'Both numbers are negative.' },
+ { parts: ['6x − y = 2', ', ', '4x + 3y = 0', ': ℓ = ', { box: '2/3' }], why: '4 ÷ 6 = 2/3.', hint: '4 divided by 6, in lowest terms or not.' },
+ { parts: ['5x + 2y = 1', ', ', '3y = 6', ': ℓ = ', { box: '0' }], why: 'Row 2 has no x: 0 ÷ 5 = 0, nothing to remove.', hint: 'How many x does row 2 have?' },
+];
+const PIVQ = [
+ { parts: ['x + 2y = 5', ', ', '3x + 4y = 11', ': pivots ', { box: '1' }, ' and ', { box: '-2' }], why: 'ℓ = 3: 4 − 3·2 = −2.', hint: 'The first pivot starts row 1. For the second, take 3 × row 1 away and read the new row 2.' },
+ { parts: ['2x + y = 3', ', ', '4x + 5y = 9', ': pivots ', { box: '2' }, ' and ', { box: '3' }], why: 'ℓ = 2: 5 − 2·1 = 3.', hint: 'ℓ = 4 ÷ 2. Then 5 − ℓ·1.' },
+ { parts: ['3x + 2y = 1', ', ', '6x + y = 4', ': pivots ', { box: '3' }, ' and ', { box: '-3' }], why: 'ℓ = 2: 1 − 2·2 = −3.', hint: 'ℓ = 6 ÷ 3. Then 1 − ℓ·2.' },
+ { parts: ['−x + y = 2', ', ', '3x + 2y = 1', ': pivots ', { box: '-1' }, ' and ', { box: '5' }], why: 'ℓ = −3: 2 − (−3)·1 = 5.', hint: 'ℓ = 3 ÷ (−1) = −3. Taking away −3 rows adds 3 rows.' },
+ { parts: ['2x + 3y = 1', ', ', 'x + 4y = 2', ': pivots ', { box: '2' }, ' and ', { box: '5/2' }], why: 'ℓ = 1/2: 4 − ½·3 = 5/2.', hint: 'ℓ = 1 ÷ 2 = ½. Then 4 − ½·3.' },
+ { parts: ['4x − 2y = 0', ', ', '2x + y = 3', ': pivots ', { box: '4' }, ' and ', { box: '2' }], why: 'ℓ = 1/2: 1 − ½·(−2) = 2.', hint: 'ℓ = 2 ÷ 4 = ½. Then 1 − ½·(−2).' },
+];
+const NEWQ = [
+ { parts: ['x − y = 2', ', ', '−3x + 5y = 0', ': new row 2: ', { box: '2' }, 'y = ', { box: '6' }], why: 'ℓ = −3: add 3 × row 1. 5 − 3 = 2, 0 + 6 = 6.', hint: 'ℓ = −3, so add 3x − 3y = 6 to row 2.' },
+ { parts: ['2x + y = 4', ', ', '3x + 2y = 7', ': new row 2: ', { box: '1/2' }, 'y = ', { box: '1' }], why: 'ℓ = 3/2: 2 − 3/2 = 1/2, 7 − 6 = 1.', hint: 'ℓ = 3/2. 3/2 × row 1 is 3x + 3/2 y = 6.' },
+ { parts: ['−2x + 3y = 1', ', ', '4x − y = 3', ': new row 2: ', { box: '5' }, 'y = ', { box: '5' }], why: 'ℓ = −2: add 2 × row 1. −1 + 6 = 5, 3 + 2 = 5.', hint: 'ℓ = 4 ÷ (−2) = −2, so add −4x + 6y = 2.' },
+ { parts: ['4x + 2y = 6', ', ', '3x + 5y = 1', ': new row 2: ', { box: '7/2' }, 'y = ', { box: '-7/2' }], why: 'ℓ = 3/4: 5 − 3/2 = 7/2, 1 − 9/2 = −7/2.', hint: 'ℓ = 3/4. 3/4 × row 1 is 3x + 3/2 y = 9/2.' },
+ { parts: ['3x − 3y = 3', ', ', 'x + y = 5', ': new row 2: ', { box: '2' }, 'y = ', { box: '4' }], why: 'ℓ = 1/3: 1 + 1 = 2, 5 − 1 = 4.', hint: 'ℓ = 1/3. 1/3 × row 1 is x − y = 1.' },
+];
+const HANDS = [
+ { A: [[2, -1], [-4, 3]], b: [1, 1], l: -2, sol: [2, 3] },
+ { A: [[2, 1], [1, 2]], b: [4, 5], l: .5, sol: [1, 2] },
+ { A: [[-2, 1], [3, 1]], b: [-1, 4], l: -1.5, sol: [1, 1] },
+];
+const lStr = l => Number.isInteger(l) ? num(l) : `${l < 0 ? '−' : ''}${Math.abs(l * 2)}/2`;
+const handTask = (el, h) => elTask(el, v => v.a10 === 0,
+ `ℓ = ${num(h.A[1][0])} ÷ ${num(h.A[0][0])} = ${lStr(h.l)}: row 2 is now flat, and the lines meet at (${num(h.sol[0])}, ${num(h.sol[1])}).`,
+ (v, l) => `Row 2 still starts with ${num(Math.round(v.a10 * 10) / 10)}. The multiplier is the number to remove, ${num(h.A[1][0])}, divided by the pivot, ${num(h.A[0][0])}.`,
+ () => el.set({ l: h.l }));
+
+/* ---------- beats ---------- */
+const BEATS = [
+ ['intro', 'Pivots and multipliers', (m, D) => {
+ const g = G(scene, { o: 0, y: 24 });
+ T(g, 'Unit 2, Chapter 17', { x: 800, y: 320, size: 28, fill: COL.dim, anchor: 'middle' });
+ T(g, 'Pivots and Multipliers', { x: 800, y: 430, size: 88, weight: 600, anchor: 'middle' });
+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);
+ const r = text(scene, 'the multiplier is the number to remove, divided by the pivot', 800, 560, m('sub'), { size: 36, fill: COL.dim, anchor: 'middle' });
+ const q = say(scene, ['ℓ = ', F('to remove', 'pivot')], 800, 700, m('move'), { size: 50, fill: COL.task, anchor: 'middle' });
+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(q, D - .9, .8);
+ }],
+
+ ['names', 'Two names', (m) => {
+ const p = S.p = panel(0);
+ text(p, 'The pivot and the multiplier', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [3, 4]], b = [5, 11];
+ const { sys, el } = table(p, A, b, 'x + 2y = 5, 3x + 4y = 11', { t0: m('sys') - .3 });
+ el.op(1, 0, 3, m('step'));
+ el.ring(0, 0, m('piv'));
+ text(p, 'pivot row', 494, 268, m('piv') + 2.5, { size: 28, fill: BLUE, weight: 600 });
+ legend(p, false, ['pivot: 1'], 500, m('piv'));
+ el.ring(1, 0, m('rem'), { dash: true });
+ legend(p, true, ['to remove: 3'], 560, m('rem'));
+ say(p, ['multiplier ℓ = 3'], 90, 630, m('mult'), { size: 34, fill: COL.task });
+ pulse(el.op_.lab.mult, m('mult') + 1, 1.35); pulse(el.op_.lab.mult, m('mult') + 3.5, 1.35);
+ ghost(sys, 3, 4, 1, 2, m('go'));
+ el.mult(3, m('go') + .3, 2, { count: false });
+ el.flash(1, m('zero'), 0);
+ text(p, 'a zero under the pivot', 90, 690, m('zero'), { size: 28, fill: COL.dim, weight: 600 });
+ el.ring(1, 1, m('second'));
+ say(p, ['second pivot: −2'], 90, 750, m('second') + .8, { size: 34 });
+ el.flash(1, m('second') + 3, 1); el.flash(1, m('second') + 5.5, 1);
+ }],
+
+ ['rule', 'The rule', (m) => {
+ const p = panel(0);
+ text(p, 'Finding the multiplier', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[4, -1], [8, 1]], b = [5, 7];
+ const { sys, el } = table(p, A, b, '4x − y = 5, 8x + y = 7', { t0: m('sys') - .3 });
+ el.ring(0, 0, m('piv'));
+ legend(p, false, ['pivot: 4'], 500, m('piv'));
+ el.ring(1, 0, m('rem'), { dash: true });
+ legend(p, true, ['to remove: 8'], 560, m('rem'));
+ // the tempting mistake, played out: 8 × row 1 swings the line too far
+ const wrongOp = el.op(1, 0, 8, m('wrong'));
+ ghost(sys, 8, 1, 1, -1, m('wrong'));
+ el.mult(8, m('bad'), 1.4, { count: false });
+ const bad = say(p, ['8 − 8·4 = 8 − 32 = −24'], 90, 630, m('bad') + .6, { size: 34, fill: COL.bad });
+ const no = text(p, 'not 0', 520, 630, m('bad') + 3.2, { size: 30, fill: COL.bad, weight: 700 });
+ el.mult(0, m('ask') - .2, 1, { count: false });
+ hide(wrongOp.g, m('ask') - .3, .3);
+ [bad, no].forEach(e => hide(e, m('ask') - .3, .3));
+ say(p, ['8 − ℓ·4 = 0'], 90, 630, m('ask'), { size: 34, fill: COL.task });
+ say(p, ['ℓ = 8 ÷ 4 = 2'], 340, 630, m('div') + 1.4, { size: 34, fill: COL.task });
+ const box = G(p, { o: 0 });
+ mk('rect', { x: 76, y: 664, width: 520, height: 76, rx: 14, fill: 'none', stroke: COL.task, 'stroke-width': 3 }, box);
+ M(box, ['multiplier ℓ = ', F('number to remove', 'pivot')], { x: 96, y: 712, size: 32, fill: COL.task, anchor: 'start' });
+ show(box, m('rule'));
+ el.op(1, 0, 2, m('go'));
+ el.mult(2, m('go') + .6, 1.8, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ hide(box, m('y') - .3, .3);
+ say(p, ['3y = −3, y = −1'], 90, 712, m('y'), { size: 36, fill: COL.task });
+ say(p, ['4x + 1 = 5, x = 1'], 90, 772, m('x'), { size: 36, fill: COL.task });
+ pin(sys, 1, -1, m('y') + 1);
+ }],
+
+ ['q1', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ const g = G(p, { o: 0 }); show(g, .3);
+ M(g, ['ℓ = ', F('number to remove', 'pivot')], { x: 1160, y: 450, size: 44, fill: COL.task, anchor: 'middle' });
+ }, { ask: done => quiz({ x: 40, y: 170, w: 760, cls: 'side' }, [{
+ id: 'c-mult', prompt: ['Find the multiplier for each system.'],
+ build: blanks([
+ { parts: ['2x + y = 5', ', ', '6x − y = 3', ': ℓ = ', { box: '3' }], why: '6 ÷ 2 = 3.', hint: 'Divide 6 by the pivot, 2.' },
+ { parts: ['3x − 2y = 1', ', ', '12x + y = 0', ': ℓ = ', { box: '4' }], why: '12 ÷ 3 = 4.', hint: 'Divide 12 by the pivot, 3.' },
+ { parts: ['5x + 4y = 2', ', ', '5x − y = 9', ': ℓ = ', { box: '1' }], why: '5 ÷ 5 = 1: take row 1 away once.', hint: 'The two x numbers are the same.' },
+ { parts: ['4x + 3y = 7', ', ', '8x + y = 1', ': ℓ = ', { box: '2' }], why: '8 ÷ 4 = 2.', hint: 'Not 8: divide 8 by the pivot, 4.' },
+ ]),
+ }], done) }],
+
+ ['negative', 'A negative multiplier', (m) => {
+ const p = panel(0);
+ text(p, 'A negative multiplier', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[1, 2], [-2, 1]], b = [3, 4];
+ const { sys, el } = table(p, A, b, 'x + 2y = 3, −2x + y = 4', { t0: m('sys') - .3, meet: false });
+ el.ring(1, 0, m('div'), { dash: true }); el.ring(0, 0, m('div') + 1.8);
+ say(p, ['ℓ = −2 ÷ 1 = −2'], 90, 500, m('div') + 3, { size: 34, fill: COL.task });
+ el.op(1, 0, -2, m('op'));
+ say(p, ['row 2 − (−2) × row 1 = row 2 + 2 × row 1'], 90, 560, m('plus'), { size: 30, fill: COL.task });
+ el.line([2, 4, 6], 2, m('two'), { label: '2 × row 1', color: BLUE, sign: '+' });
+ ghost(sys, -2, 1, -1, 2, m('go'));
+ el.mult(-2, m('go') + .2, 2, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ pin(sys, -1, 2, m('turn'));
+ say(p, ['5y = 10, y = 2'], 90, 650, m('y'), { size: 36, fill: COL.task });
+ say(p, ['x + 4 = 3, x = −1'], 90, 710, m('x'), { size: 36, fill: COL.task });
+ show(sys.meetBox, m('x') + 2, .5);
+ }],
+
+ ['fraction', 'A fraction', (m) => {
+ const p = panel(0);
+ text(p, 'A fraction for a multiplier', 60, 110, .2, { size: 40, weight: 600 });
+ const A = [[2, 1], [3, 4]], b = [3, 2];
+ const { sys, el } = table(p, A, b, '2x + y = 3, 3x + 4y = 2', { t0: m('sys') - .3, meet: false });
+ el.ring(1, 0, m('div'), { dash: true }); el.ring(0, 0, m('div') + 1.6);
+ say(p, ['ℓ = 3 ÷ 2 = ', F(3, 2)], 90, 520, m('div') + 1.8, { size: 36, fill: COL.task });
+ el.op(1, 0, 1.5, m('op'));
+ el.line([3, null, null], 2, m('h1'), { label: [F(3, 2), ' × row 1'], color: BLUE });
+ el.line([null, 1.5, null], 2, m('h2'));
+ el.line([null, null, 4.5], 2, m('h3'));
+ ghost(sys, 3, 4, 2, -1, m('go'));
+ el.mult(1.5, m('go') + .2, 2, { count: false });
+ lightCells(el, [m('e1'), m('e2'), m('e3')]);
+ el.ring(1, 1, m('piv2'));
+ say(p, ['second pivot: ', F(5, 2)], 90, 600, m('piv2') + .5, { size: 36 });
+ say(p, [F(5, 2), 'y = −', F(5, 2), ', y = −1'], 90, 680, m('y'), { size: 36, fill: COL.task });
+ say(p, ['2x − 1 = 3, 2x = 4, x = 2'], 90, 760, m('x'), { size: 36, fill: COL.task });
+ show(sys.meetBox, m('x') + 3, .5);
+ }],
+
+ ['drill', 'Three quick ones', (m) => {
+ const p = panel(0);
+ text(p, 'Three quick ones', 60, 110, .2, { size: 40, weight: 600 });
+ const ex = [
+ { A: [[5, 2], [10, 1]], b: [1, 5], l: 2, t: 'a', parts: ['ℓ = 10 ÷ 5 = 2'] },
+ { A: [[-3, 1], [6, 2]], b: [2, 1], l: -2, t: 'b', parts: ['ℓ = 6 ÷ (−3) = −2'] },
+ { A: [[4, 2], [2, 3]], b: [6, 5], l: .5, t: 'c', parts: ['ℓ = 2 ÷ 4 = ', F(1, 2)] },
+ ];
+ ex.forEach(({ A, b, l, t, parts }, k) => {
+ const x0 = 150 + k * 500, y0 = 330, s = bare(A, b);
+ const el = elim(p, s, { at: [x0, y0], size: 42, cw: 76, rh: 66, t0: m(t) - .3, dens: [2] });
+ el.ring(0, 0, m(t) + .4); el.ring(1, 0, m(t) + 1.6, { dash: true });
+ say(p, parts, x0 - 40, 520, m(t) + 3, { size: 32, fill: COL.task });
+ el.op(1, 0, l, m(t) + 3.4, { place: [x0 - 40, 600] });
+ el.mult(l, m(t) + 4.2, 1.6, { count: false });
+ });
+ const q = say(p, ['ℓ = ', F('number to remove', 'pivot')], 800, 760, m('same'), { size: 44, fill: COL.task, anchor: 'middle' });
+ pulse(q, m('same') + 2.5, 1.15);
+ }],
+
+ ['q2', 'Your turn', () => {
+ const p = panel(0);
+ text(p, 'Your turn', 60, 110, .2, { size: 40, weight: 600 });
+ const t = table(p, [[2, 1], [5, 3]], [1, 4], '2x + y = 1, 5x + 3y = 4', { step: .5 });
+ S.sys = t.sys; S.el = t.el;
+ S.el.op(1, 0, 0, .3);
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-half', prompt: ['Drag the multiplier, in halves, until the coral line is flat.'],
+ build: handTask(S.el, { A: [[2, 1], [5, 3]], b: [1, 4], l: 2.5, sol: [-1, 3] }),
+ }], done) }],
+
+ ['triangle', 'Upper triangular', (m) => {
+ const p = panel(0);
+ text(p, 'After the step: a triangle', 60, 110, .2, { size: 40, weight: 600 });
+ const s = bare([[1, 2], [0, -2]], [5, -4]);
+ const el = elim(p, s, { at: TOP, size: 50, cw: 92, rh: 78, t0: .2 });
+ say(p, ['x + 2y = 5, −2y = −4'], 90, 182, .3, { size: 32, fill: COL.dim });
+ // the diagonal through the pivots, the zero under it, the triangle above it
+ const d = path(p, `M${el.cx(0) - 40} ${el.ry(0) - 60}L${el.cx(1) + 40} ${el.ry(1) + 20}`, { stroke: COL.task, 'stroke-width': 4, 'stroke-dasharray': '10 8', fill: 'none' }, { o: 0 });
+ show(d, m('diag'), .5);
+ el.ring(0, 0, m('diag') + .4); el.ring(1, 1, m('diag') + 1);
+ el.flash(1, m('below'), 0); el.flash(1, m('below') + 1.4, 0);
+ const tri = path(p, `M${el.cx(0) - 44} ${el.ry(0) - 56}L${el.cx(1) + 46} ${el.ry(0) - 56}L${el.cx(1) + 46} ${el.ry(1) + 26}Z`, { fill: COL.task, stroke: COL.task, 'stroke-width': 2, 'fill-opacity': .14 }, { o: 0 });
+ show(tri, m('tri'), .6);
+ say(p, ['U'], el.cx(0) + 46, el.ry(1) + 120, m('tri') + 3, { size: 54, fill: COL.task, anchor: 'middle' });
+ text(p, 'upper triangular', el.cx(0) + 90, el.ry(1) + 112, m('tri') + 3, { size: 30, fill: COL.task, weight: 600 });
+ el.focus(1, m('why')); el.focus(null, m('why') + 4);
+ text(p, 'bottom row: one unknown, y', 90, 600, m('why') + .4, { size: 30, fill: COL.dim, weight: 600 });
+ say(p, ['a pivot is never 0: ÷ 0 ✗'], 90, 700, m('never') + 1.6, { size: 34, fill: COL.bad });
+ el.flash(0, m('never') + 3.5, 0); el.flash(1, m('never') + 3.5, 1);
+ text(p, 'a zero in a pivot spot: chapter 20', 90, 760, m('never') + 5, { size: 28, fill: COL.dim, weight: 600 });
+ // three equations make a bigger triangle (chapter 18)
+ const s3 = bare([[1, 2, 1], [0, 2, -2], [0, 0, 5]], [2, 6, -10]);
+ const e3 = elim(p, s3, { at: [980, 330], size: 44, cw: 80, rh: 70, t0: m('tri') + 4.5 });
+ const tri3 = path(p, `M${e3.cx(0) - 38} ${e3.ry(0) - 50}L${e3.cx(2) + 40} ${e3.ry(0) - 50}L${e3.cx(2) + 40} ${e3.ry(2) + 22}Z`, { fill: COL.task, stroke: COL.task, 'stroke-width': 2, 'fill-opacity': .12 }, { o: 0 });
+ show(tri3, m('tri') + 5, .6);
+ text(p, 'three equations: a bigger triangle (chapter 18)', 1120, 630, m('tri') + 5, { size: 26, fill: COL.dim, weight: 600, anchor: 'middle' });
+ }],
+
+ ['q3', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ const t = table(p, [[2, 1], [4, 5]], [3, 9], '2x + y = 3, 4x + 5y = 9');
+ S.sys = t.sys; S.el = t.el;
+ S.el.op(1, 0, 2, .3, { shown: 0 });
+ put(S.el.op_.lab.mult, { o: 0 });
+ S.r0 = G(S.el.g, { x: S.el.cx(0), y: S.el.ry(0) - 16, o: 0 }); // the pivot's ring, shown by the first answer
+ mk('ellipse', { rx: 40, ry: 31, fill: 'none', stroke: COL.chalk, 'stroke-width': 3.5 }, S.r0);
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-names', prompt: ['Name the numbers of this step.'],
+ build: blanks([
+ { parts: ['first pivot: ', { box: '2' }], why: 'Row 1 starts with 2.', hint: 'The pivot is the first number of row 1.', fx: () => fx(S.r0, { o: 1 }, 0, .3) },
+ { parts: ['multiplier: ℓ = ', { box: '2' }], why: '4 ÷ 2 = 2.', hint: 'The number to remove, 4, divided by the pivot, 2.',
+ fx: () => { const el = S.el; fx(el.op_.lab.mult, { o: 1 }, 0, .3); el.op_.lab.lay(2); const s = S.sys, f = { ...s.v }; fxp(q => s.set({ a10: f.a10 * (1 - q), a11: f.a11 - 2 * q, b1: f.b1 - 6 * q }), .3, 1.6); } },
+ { parts: ['second pivot: ', { box: '3' }], why: '5 − 2·1 = 3.', hint: 'Row 2 − 2 × row 1: the y number becomes 5 − 2·1.' },
+ ]),
+ }], done) }],
+
+ ['wrap', 'Summary', (m) => {
+ const p = panel(0);
+ [['The pivot starts the row we use; the multiplier ℓ says how many times we take it away.', 'w1'], ['ℓ = (number to remove) ÷ (pivot).', 'w2'],
+ ['ℓ can be negative (that adds) or a fraction.', 'w3'], ['After elimination: pivots on the diagonal, zeros below — upper triangular, U.', '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.task }, g);
+ T(g, String(i + 1), { x: 120, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });
+ T(g, str, { x: 170, size: 33, weight: 600 });
+ tw(g, { o: 1, x: 0 }, m(mark), .6);
+ });
+ }],
+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{
+ id: 'p-mult1', prompt: ['Find each multiplier ℓ: the number to remove, divided by the pivot. Fractions are fine.'],
+ build: blanks(MULTQ.slice(0, 4)),
+ }, {
+ id: 'p-mult2', prompt: ['Find each multiplier ℓ: the number to remove, divided by the pivot. Fractions are fine.'],
+ build: blanks(MULTQ.slice(4)),
+ }], done, 'Chapter practice · set 1 of 4') }],
+ ['final2', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-piv', prompt: ['Find both pivots: the first, and the one row 2 starts with after the step.'],
+ build: blanks(PIVQ),
+ }], done, 'Chapter practice · set 2 of 4') }],
+ ['final3', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-new', prompt: ['Work out the new row 2 (its x is gone).'],
+ build: blanks(NEWQ),
+ }], done, 'Chapter practice · set 3 of 4') }],
+ ['final4', 'Chapter practice', () => {
+ const p = panel(0);
+ text(p, 'Make it flat', 60, 110, .2, { size: 40, weight: 600 });
+ const h = HANDS[0], t = table(p, h.A, h.b, '', { step: .5 });
+ S.sys = t.sys; S.el = t.el; S.cap = t.cap;
+ S.el.op(1, 0, 0, .3);
+ }, { ask: done => quiz(CARD, HANDS.map((h, k) => ({
+ id: `p-flat${k + 1}`, prompt: ['Drag the multiplier until the coral line is flat.'],
+ build: (body, api) => { S.el.load(keysOf2(h.A, h.b)); return handTask(S.el, h)(body, api); },
+ })), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ const t = table(p, [[2, 1], [3, 4]], [3, 2], 'every number of the table can be dragged', { step: .5 });
+ S.sys = t.sys; S.el = t.el;
+ S.el.op(1, 0, 0, .3);
+ const hint = text(p, 'try: change the pivot, change the number to remove, then find ℓ', 90, 450, m('go'), { size: 24, fill: COL.dim });
+ hide(hint, m('go') + 8, .6);
+ }, { ask: playAsk(() => S.el, { pos: CARD, tip: 'Your table. Drag any number, the multiplier, or a line; draw on the board. Nothing is marked.' }) }],
+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+boot();
+</script>
+</body>
+</html>
diff --git a/site/linear-algebra/ch18/audio/en/ex2.mp3 b/site/linear-algebra/ch18/audio/en/ex2.mp3
new file mode 100644
index 0000000..981a955
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/ex2.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/final1.mp3 b/site/linear-algebra/ch18/audio/en/final1.mp3
new file mode 100644
index 0000000..7db19e4
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/final1.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/final2.mp3 b/site/linear-algebra/ch18/audio/en/final2.mp3
new file mode 100644
index 0000000..dde3801
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/final2.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/final3.mp3 b/site/linear-algebra/ch18/audio/en/final3.mp3
new file mode 100644
index 0000000..64bf78c
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/final3.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/final4.mp3 b/site/linear-algebra/ch18/audio/en/final4.mp3
new file mode 100644
index 0000000..699786a
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/final4.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/finish.mp3 b/site/linear-algebra/ch18/audio/en/finish.mp3
new file mode 100644
index 0000000..32b316b
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/finish.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/intro.mp3 b/site/linear-algebra/ch18/audio/en/intro.mp3
new file mode 100644
index 0000000..f47c31b
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/intro.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/play.mp3 b/site/linear-algebra/ch18/audio/en/play.mp3
new file mode 100644
index 0000000..69c2c69
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/q1.mp3 b/site/linear-algebra/ch18/audio/en/q1.mp3
new file mode 100644
index 0000000..786b856
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/q1.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/q2.mp3 b/site/linear-algebra/ch18/audio/en/q2.mp3
new file mode 100644
index 0000000..09bcc59
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/q2.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/q3.mp3 b/site/linear-algebra/ch18/audio/en/q3.mp3
new file mode 100644
index 0000000..d079949
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/q3.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/result.mp3 b/site/linear-algebra/ch18/audio/en/result.mp3
new file mode 100644
index 0000000..5cee88b
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/result.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/step1.mp3 b/site/linear-algebra/ch18/audio/en/step1.mp3
new file mode 100644
index 0000000..0802673
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/step1.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/step1b.mp3 b/site/linear-algebra/ch18/audio/en/step1b.mp3
new file mode 100644
index 0000000..1921512
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/step1b.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/step2.mp3 b/site/linear-algebra/ch18/audio/en/step2.mp3
new file mode 100644
index 0000000..48e36f8
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/step2.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/system.mp3 b/site/linear-algebra/ch18/audio/en/system.mp3
new file mode 100644
index 0000000..d41ba42
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/system.mp3 differ
diff --git a/site/linear-algebra/ch18/audio/en/timings.js b/site/linear-algebra/ch18/audio/en/timings.js
new file mode 100644
index 0000000..f0ede47
--- /dev/null
+++ b/site/linear-algebra/ch18/audio/en/timings.js
@@ -0,0 +1,591 @@
+window.TIMINGS = {
+ "intro": {
+ "dur": 15.792,
+ "marks": {
+ "sub": 4.297,
+ "move": 12.227
+ },
+ "cues": [
+ [
+ 0.091,
+ "Chapter eighteen."
+ ],
+ [
+ 1.393,
+ "Elimination: three equations."
+ ],
+ [
+ 4.297,
+ "The same step as before, now with three equations, three unknowns, and three planes in space."
+ ],
+ [
+ 12.227,
+ "Two columns of steps, and the numbers make a triangle."
+ ]
+ ]
+ },
+ "system": {
+ "dur": 40.344,
+ "marks": {
+ "eq1": 2.24,
+ "eq2": 5.221,
+ "eq3": 9.141,
+ "planes": 11.654,
+ "table": 16.419,
+ "goal": 22.044,
+ "z1": 26.094,
+ "z2": 30.781,
+ "order": 34.544
+ },
+ "cues": [
+ [
+ 0.104,
+ "This is the system from the lecture."
+ ],
+ [
+ 2.24,
+ "x plus two y plus z equals two."
+ ],
+ [
+ 5.221,
+ "Three x plus eight y plus z equals twelve."
+ ],
+ [
+ 9.141,
+ "And four y plus z equals two."
+ ],
+ [
+ 11.654,
+ "Each equation is a plane, and the three planes meet at one point."
+ ],
+ [
+ 16.419,
+ "As a table: three rows of numbers, and the right sides after the dashed line."
+ ],
+ [
+ 22.044,
+ "Our goal is a triangle, with zeros below the pivots."
+ ],
+ [
+ 26.094,
+ "First we make zeros under the first pivot, in rows two and three."
+ ],
+ [
+ 30.781,
+ "Then one zero under the second pivot, in row three."
+ ],
+ [
+ 34.544,
+ "Column one first, then column two."
+ ],
+ [
+ 37.448,
+ "We always use a row above to clean a row below it."
+ ]
+ ]
+ },
+ "step1": {
+ "dur": 43.56,
+ "marks": {
+ "piv": 1.081,
+ "rem": 3.06,
+ "l": 5.482,
+ "three": 9.089,
+ "go": 12.839,
+ "turn": 17.747,
+ "hinge": 19.87,
+ "nums": 27.083,
+ "e1": 29.023,
+ "e2": 31.38,
+ "e3": 33.411,
+ "e4": 35.859,
+ "nox": 38.268
+ },
+ "cues": [
+ [
+ 0.091,
+ "Column one."
+ ],
+ [
+ 1.081,
+ "The pivot is the one at the top."
+ ],
+ [
+ 3.06,
+ "Row two has three x to remove."
+ ],
+ [
+ 5.482,
+ "The multiplier is three divided by one: three."
+ ],
+ [
+ 9.089,
+ "Three times row one is three, six, three, six."
+ ],
+ [
+ 12.839,
+ "Take it away from row two, and watch the coral plane while the numbers change."
+ ],
+ [
+ 17.747,
+ "It turns, like a door on a hinge."
+ ],
+ [
+ 19.87,
+ "The hinge is the line where it meets the blue plane."
+ ],
+ [
+ 23.464,
+ "That line doesn't move, so the meeting point doesn't either."
+ ],
+ [
+ 27.083,
+ "Now read the new row two."
+ ],
+ [
+ 29.023,
+ "Three minus three is zero."
+ ],
+ [
+ 31.38,
+ "Eight minus six is two."
+ ],
+ [
+ 33.411,
+ "One minus three is minus two."
+ ],
+ [
+ 35.859,
+ "Twelve minus six is six."
+ ],
+ [
+ 38.268,
+ "Row two has no x now, so its plane runs straight along the x direction."
+ ]
+ ]
+ },
+ "step1b": {
+ "dur": 20.472,
+ "marks": {
+ "rem": 1.641,
+ "l": 6.576,
+ "nothing": 10.885,
+ "done": 16.979
+ },
+ "cues": [
+ [
+ 0.104,
+ "Now row three."
+ ],
+ [
+ 1.641,
+ "How much x does it have?"
+ ],
+ [
+ 3.307,
+ "None."
+ ],
+ [
+ 4.076,
+ "Its first number is already zero."
+ ],
+ [
+ 6.576,
+ "So the multiplier is zero divided by one, which is zero."
+ ],
+ [
+ 10.885,
+ "Taking away zero rows changes nothing, and the yellow plane stays where it is."
+ ],
+ [
+ 16.979,
+ "Column one is done: zeros under the first pivot."
+ ]
+ ]
+ },
+ "q1": {
+ "dur": 7.608,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.159,
+ "Column two is next."
+ ],
+ [
+ 3.281,
+ "Find the pivot, the number to remove, and the multiplier."
+ ]
+ ]
+ },
+ "step2": {
+ "dur": 41.76,
+ "marks": {
+ "piv": 1.224,
+ "rem": 4.193,
+ "l": 7.122,
+ "two": 9.466,
+ "go": 14.219,
+ "turn": 17.826,
+ "nums": 22.552,
+ "e1": 24.01,
+ "e2": 26.732,
+ "e3": 28.867,
+ "e4": 31.38,
+ "flat": 34.193
+ },
+ "cues": [
+ [
+ 0.104,
+ "Column two."
+ ],
+ [
+ 1.224,
+ "The second pivot is the two in row two."
+ ],
+ [
+ 4.193,
+ "Under it, row three has a four."
+ ],
+ [
+ 7.122,
+ "Four divided by two is two."
+ ],
+ [
+ 9.466,
+ "Two times row two is zero, four, minus four, twelve."
+ ],
+ [
+ 14.219,
+ "Take it away from row three, and watch the yellow plane."
+ ],
+ [
+ 17.826,
+ "It swings on its own hinge, the line where it meets the coral plane."
+ ],
+ [
+ 22.552,
+ "The new row three."
+ ],
+ [
+ 24.01,
+ "Zero minus zero is zero."
+ ],
+ [
+ 26.732,
+ "Four minus four is zero."
+ ],
+ [
+ 28.867,
+ "One minus minus four is five."
+ ],
+ [
+ 31.38,
+ "And two minus twelve is minus ten."
+ ],
+ [
+ 34.193,
+ "Five z equals minus ten."
+ ],
+ [
+ 36.576,
+ "No x and no y: the plane lies flat, at height minus two."
+ ]
+ ]
+ },
+ "result": {
+ "dur": 27.264,
+ "marks": {
+ "tri": 1.432,
+ "pivots": 5.039,
+ "c": 8.229,
+ "same": 14.154,
+ "z": 17.396
+ },
+ "cues": [
+ [
+ 0.117,
+ "Here's where we arrived."
+ ],
+ [
+ 1.432,
+ "Zeros below the diagonal: the triangle, U."
+ ],
+ [
+ 5.039,
+ "The pivots are one, two and five."
+ ],
+ [
+ 8.229,
+ "The right sides changed too."
+ ],
+ [
+ 10.065,
+ "We call the new ones c: two, six, minus ten."
+ ],
+ [
+ 14.154,
+ "And the three planes still meet at the same point."
+ ],
+ [
+ 17.396,
+ "The bottom row already gives z."
+ ],
+ [
+ 19.896,
+ "Five z is minus ten, so z is minus two."
+ ],
+ [
+ 23.958,
+ "Finding y and x from there is the next chapter."
+ ]
+ ]
+ },
+ "ex2": {
+ "dur": 58.68,
+ "marks": {
+ "eq": 1.693,
+ "c1": 13.268,
+ "l21": 15.885,
+ "s21": 19.401,
+ "l31": 25.768,
+ "s31": 30.443,
+ "c2": 37.24,
+ "l32": 40.521,
+ "s32": 43.594,
+ "u": 49.896,
+ "z": 54.453
+ },
+ "cues": [
+ [
+ 0.091,
+ "Now a system of our own."
+ ],
+ [
+ 1.693,
+ "Two x plus y plus z equals three."
+ ],
+ [
+ 4.883,
+ "Four x plus y plus three z equals three."
+ ],
+ [
+ 8.32,
+ "And minus two x plus two y plus z equals one."
+ ],
+ [
+ 13.268,
+ "Column one."
+ ],
+ [
+ 14.271,
+ "The pivot is two."
+ ],
+ [
+ 15.885,
+ "For row two: four divided by two is two."
+ ],
+ [
+ 19.401,
+ "Row two minus two times row one: zero, minus one, one, minus three."
+ ],
+ [
+ 25.768,
+ "For row three: minus two divided by two is minus one."
+ ],
+ [
+ 30.443,
+ "Taking away minus one row means adding row one: zero, three, two, four."
+ ],
+ [
+ 37.24,
+ "Column two."
+ ],
+ [
+ 38.346,
+ "The pivot is now minus one."
+ ],
+ [
+ 40.521,
+ "Three divided by minus one is minus three."
+ ],
+ [
+ 43.594,
+ "So we add three times row two to row three: zero, zero, five, minus five."
+ ],
+ [
+ 49.896,
+ "The triangle again, with pivots two, minus one and five."
+ ],
+ [
+ 54.453,
+ "Five z equals minus five, so z equals minus one."
+ ]
+ ]
+ },
+ "q2": {
+ "dur": 4.608,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Your turn."
+ ],
+ [
+ 1.042,
+ "Find the multiplier that makes the yellow plane lie flat."
+ ]
+ ]
+ },
+ "q3": {
+ "dur": 4.728,
+ "marks": {},
+ "cues": [
+ [
+ 0.091,
+ "Quick check."
+ ],
+ [
+ 1.12,
+ "Find all three multipliers, and the last pivot."
+ ]
+ ]
+ },
+ "wrap": {
+ "dur": 30.648,
+ "marks": {
+ "w1": 0.99,
+ "w2": 8.411,
+ "w3": 13.19,
+ "w4": 22.161,
+ "end": 28.477
+ },
+ "cues": [
+ [
+ 0.091,
+ "To sum up."
+ ],
+ [
+ 0.99,
+ "With three equations, clear column one first: use row one to remove x from rows two and three."
+ ],
+ [
+ 8.411,
+ "Then clear column two: use row two to remove y from row three."
+ ],
+ [
+ 13.19,
+ "Each multiplier is the number to remove, divided by its pivot."
+ ],
+ [
+ 17.409,
+ "Each step turns one plane on a hinge, and the meeting point stays put."
+ ],
+ [
+ 22.161,
+ "The result is a triangle, U, with the pivots on its diagonal, and new right sides, c."
+ ],
+ [
+ 28.477,
+ "Now try the chapter practice."
+ ]
+ ]
+ },
+ "final1": {
+ "dur": 3.816,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice."
+ ],
+ [
+ 1.589,
+ "Find the multipliers for column one."
+ ]
+ ]
+ },
+ "final2": {
+ "dur": 2.064,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Next, work out one new row."
+ ]
+ ]
+ },
+ "final3": {
+ "dur": 5.28,
+ "marks": {},
+ "cues": [
+ [
+ 0.091,
+ "Now take each matrix all the way to the triangle, and read off its pivots."
+ ]
+ ]
+ },
+ "final4": {
+ "dur": 4.728,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Last set."
+ ],
+ [
+ 1.237,
+ "Make the zeros with your hands, one step at a time."
+ ]
+ ]
+ },
+ "play": {
+ "dur": 13.368,
+ "marks": {
+ "go": 3.763
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.12,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 3.763,
+ "Drag the multiplier and watch the coral plane swing on its hinge."
+ ],
+ [
+ 8.255,
+ "Turn the space, or change any number in the table."
+ ],
+ [
+ 11.654,
+ "Press continue when you're done."
+ ]
+ ]
+ },
+ "finish": {
+ "dur": 11.376,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Well done."
+ ],
+ [
+ 1.107,
+ "That's the end of chapter eighteen, elimination: three equations."
+ ],
+ [
+ 6.029,
+ "Next: back substitution, how the triangle gives up its answer, from the bottom up."
+ ]
+ ]
+ }
+};
diff --git a/site/linear-algebra/ch18/audio/en/wrap.mp3 b/site/linear-algebra/ch18/audio/en/wrap.mp3
new file mode 100644
index 0000000..e3b0ae1
Binary files /dev/null and b/site/linear-algebra/ch18/audio/en/wrap.mp3 differ
diff --git a/site/linear-algebra/ch18/index.html b/site/linear-algebra/ch18/index.html
new file mode 100644
index 0000000..7e38cb8
--- /dev/null
+++ b/site/linear-algebra/ch18/index.html
@@ -0,0 +1,310 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Elimination: Three Equations</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run -->
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../lib/math.js"></script>
+<script src="../lib/linsys.js"></script>
+<script src="../lib/space3.js"></script>
+<script src="../lib/elim.js"></script>
+<script src="../lib/play.js"></script>
+<script src="audio/en/timings.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 18, title: 'Elimination: Three Equations', minutes: 11, language: 'en', next: '../ch19/' };
+
+/* ---------- chapter drawing helpers ---------- */
+const LEC = { A: [[1, 2, 1], [3, 8, 1], [0, 4, 1]], b: [2, 12, 2] }; // the lecture's system (OCW 18.06, lecture 2)
+const AFTER1 = { A: [[1, 2, 1], [0, 2, -2], [0, 4, 1]], b: [2, 6, 2] }; // after column 1
+const U_ = { A: [[1, 2, 1], [0, 2, -2], [0, 0, 5]], b: [2, 6, -10] }; // the triangle U and c
+const VIEW = { yaw: -40, pitch: 20 };
+const TBL = [120, 240]; // [A | b]: rows at 240, 306, 372
+const CARD = { x: 40, y: 420, w: 720, cls: 'side' }; // under the table, beside the space
+const BLUE = S3_ROW[0], CORAL = S3_ROW[1], YELLOW = S3_ROW[2];
+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; };
+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500 } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, o: 0 }); show(e, t0); return e; };
+// The system as planes on the right and [A | b] top left, the equations written once above the table.
+// eqs: true shows lin3's own equations instead (the first beat, before the table).
+const three = (p, { A, b }, caption, { t0 = .1, view = VIEW, eqs = false, table = true } = {}) => {
+ const sys = lin3(p, { A, b, eq: [90, 190], mat: null, sol: false, space: { cx: 1185, size: 600, ...view }, t0 });
+ if (!eqs) sys.E.style.display = 'none';
+ const cap = caption ? say(p, [caption], 90, 160, t0 + .1, { size: 28, fill: COL.dim }) : null;
+ const el = table ? elim(p, sys, { at: TBL, size: 44, cw: 84, rh: 66, t0, labelX: 530 }) : null;
+ return { sys, el, cap, V: sys.space };
+};
+const CAP_LEC = 'x + 2y + z = 2, 3x + 8y + z = 12, 4y + z = 2';
+// The hinge: a meeting line of two planes (0: planes 1 and 2, 1: planes 1 and 3, 2: planes 2 and 3), thickened.
+const hinge = (sys, n, t0, dur = 1.6) => prog(q => sys.lines[n].e.setAttribute('stroke-width', 2.5 + 5 * Math.sin(Math.PI * q)), t0, dur, lin);
+const lightRow = (el, i, ts) => ts.forEach((t, j) => el.flash(i, t, j));
+// A light triangle over the entries on and above the diagonal of a 3 × 3 table.
+const triangle = (p, el, t0) => {
+ const e = path(p, `M${el.cx(0) - 40} ${el.ry(0) - 48}L${el.cx(2) + 42} ${el.ry(0) - 48}L${el.cx(2) + 42} ${el.ry(2) + 20}Z`, { fill: COL.task, stroke: COL.task, 'stroke-width': 2, 'fill-opacity': .13 }, { o: 0 });
+ show(e, t0, .6);
+ return e;
+};
+// A small 3 × 3 system with no picture, for the title card: the same .v, .to, .set, .onChange elim uses.
+const bare = (A, b) => {
+ const v = {}, fs = [];
+ A.forEach((r, i) => { r.forEach((x, j) => { v[`a${i}${j}`] = x; }); v[`b${i}`] = b[i]; });
+ let plan = { ...v };
+ const set = to => { Object.assign(v, to); fs.forEach(f => f(v)); };
+ return { v, set, onChange: f => fs.push(f), solve: () => ({}), live() {},
+ to(next, at, dur = 1.2, ease = io) { const from = { ...plan }; plan = { ...plan, ...next }; const goal = { ...plan };
+ prog(q => set(Object.fromEntries(Object.keys(next).map(k => [k, from[k] + (goal[k] - from[k]) * q]))), at, dur, ease); } };
+};
+const keys3 = ({ A, b }) => Object.fromEntries([...A.flatMap((r, i) => r.map((x, j) => [`a${i}${j}`, x])), ...b.map((x, i) => [`b${i}`, x])]);
+
+/* ---------- practice data (every answer worked twice) ---------- */
+const COL1Q = [
+ { parts: ['2x + y − z = 1, 6x + 2y + z = 3, −4x + y + 2z = 0: row 2: ℓ = ', { box: '3' }, ', row 3: ℓ = ', { box: '-2' }], why: '6 ÷ 2 = 3 and −4 ÷ 2 = −2.', hint: 'Divide each first number by the pivot, 2.' },
+ { parts: ['x + 2y + 3z = 4, 5x + y = 2, 2x − y + z = 1: row 2: ℓ = ', { box: '5' }, ', row 3: ℓ = ', { box: '2' }], why: '5 ÷ 1 = 5 and 2 ÷ 1 = 2.', hint: 'The pivot is 1: the multipliers are the first numbers of rows 2 and 3.' },
+ { parts: ['3x − y + z = 2, x + y + z = 3, 9x + 2z = 1: row 2: ℓ = ', { box: '1/3' }, ', row 3: ℓ = ', { box: '3' }], why: '1 ÷ 3 = 1/3 and 9 ÷ 3 = 3.', hint: 'The pivot is 3. Row 2 starts with 1: 1 ÷ 3.' },
+ { parts: ['−x + y + z = 0, 2x + y = 5, 4y − z = 3: row 2: ℓ = ', { box: '-2' }, ', row 3: ℓ = ', { box: '0' }], why: '2 ÷ (−1) = −2; row 3 has no x, so 0.', hint: 'The pivot is −1. Row 3 has no x at all.' },
+];
+const ROWQ = [
+ { parts: ['(2, 1, −1 | 1), (6, 2, 1 | 3): row 2 − 3 × row 1 = (0, ', { box: '-1' }, ', ', { box: '4' }, ' | ', { box: '0' }, ')'], why: '2 − 3 = −1, 1 + 3 = 4, 3 − 3 = 0.', hint: '3 × row 1 is (6, 3, −3 | 3). Subtract it number by number.' },
+ { parts: ['(1, 2, 3 | 4), (2, −1, 1 | 1): row 3 − 2 × row 1 = (0, ', { box: '-5' }, ', ', { box: '-5' }, ' | ', { box: '-7' }, ')'], why: '−1 − 4 = −5, 1 − 6 = −5, 1 − 8 = −7.', hint: '2 × row 1 is (2, 4, 6 | 8).' },
+ { parts: ['(2, 1, −1 | 1), (−4, 1, 2 | 0): row 3 + 2 × row 1 = (0, ', { box: '3' }, ', ', { box: '0' }, ' | ', { box: '2' }, ')'], why: 'ℓ = −2, so add: 1 + 2 = 3, 2 − 2 = 0, 0 + 2 = 2.', hint: '2 × row 1 is (4, 2, −2 | 2). Add it this time.' },
+ { parts: ['(0, 1, −1 | 2), (0, 2, 3 | 9): row 3 − 2 × row 2 = (0, 0, ', { box: '5' }, ' | ', { box: '5' }, ')'], why: '3 − (−2) = 5 and 9 − 4 = 5.', hint: '2 × row 2 is (0, 2, −2 | 4). Then 3 − (−2).' },
+];
+const PIVQ = [
+ { parts: ['(1, 2, 1), (2, 6, 4), (1, 4, 5): pivots ', { box: '1' }, ', ', { box: '2' }, ', ', { box: '2' }], why: 'ℓ = 2 and 1 give (0, 2, 2) and (0, 2, 4); then ℓ = 1 gives (0, 0, 2).', hint: 'Column 1: take 2 × row 1 from row 2 and 1 × row 1 from row 3. Then column 2.' },
+ { parts: ['(2, 1, 1), (4, 3, 3), (8, 7, 9): pivots ', { box: '2' }, ', ', { box: '1' }, ', ', { box: '2' }], why: 'ℓ = 2 and 4 give (0, 1, 1) and (0, 3, 5); then ℓ = 3 gives (0, 0, 2).', hint: 'The multipliers for column 1 are 4 ÷ 2 and 8 ÷ 2.' },
+ { parts: ['(1, −1, 2), (−2, 3, −1), (3, −1, 9): pivots ', { box: '1' }, ', ', { box: '1' }, ', ', { box: '-3' }], why: 'ℓ = −2 and 3 give (0, 1, 3) and (0, 2, 3); then ℓ = 2 gives (0, 0, −3).', hint: 'Row 2: ℓ = −2, so add 2 × row 1. Row 3: ℓ = 3.' },
+ { parts: ['(3, 0, 1), (6, 2, 4), (−3, 4, 5): pivots ', { box: '3' }, ', ', { box: '2' }, ', ', { box: '2' }], why: 'ℓ = 2 and −1 give (0, 2, 2) and (0, 4, 6); then ℓ = 2 gives (0, 0, 2).', hint: 'Row 3: ℓ = −3 ÷ 3 = −1, so add row 1.' },
+];
+// The hands-on walk: one system, three steps in turn (the system keeps what the reader did).
+const WALK = { A: [[1, 1, 2], [2, 3, 5], [-1, 1, 1]], b: [2, 4, -1] };
+const WALK_STEPS = [[1, 0, 2, 'a10'], [2, 0, -1, 'a20'], [2, 1, 2, 'a21']];
+const stepTask = ([i, j, l, k]) => (body, api) => {
+ S.el.opNow(i, j);
+ return elTask(S.el, v => Math.abs(v[k]) < 1e-9, `ℓ = ${num(l)}: the ${k === 'a21' ? 'y' : 'x'} of row ${i + 1} is gone.`,
+ (v, L) => `Row ${i + 1} still has ${num(Math.round(v[k] * 10) / 10)} there. Divide that number (before the step) by the pivot of row ${j + 1}.`,
+ () => S.el.set({ l }))(body, api);
+};
+
+/* ---------- beats ---------- */
+const BEATS = [
+ ['intro', 'Elimination: three equations', (m, D) => {
+ const g = G(scene, { o: 0, y: 24 });
+ T(g, 'Unit 2, Chapter 18', { x: 800, y: 280, size: 28, fill: COL.dim, anchor: 'middle' });
+ T(g, 'Elimination: Three Equations', { x: 800, y: 390, size: 88, weight: 600, anchor: 'middle' });
+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);
+ const r = text(scene, 'two columns of steps, and the numbers make a triangle', 800, 500, m('sub'), { size: 36, fill: COL.dim, anchor: 'middle' });
+ const lg = G(scene, { o: 0 });
+ const s = bare(LEC.A, LEC.b), el = elim(lg, s, { at: [620, 620], size: 36, cw: 70, rh: 56, t0: 0 });
+ show(lg, m('sub') + 1.5, .5);
+ el.ring(0, 0, m('sub') + 3); el.ring(1, 1, m('sub') + 3.6); el.ring(2, 2, m('sub') + 4.2);
+ el.step(1, 0, 3, m('move') + .6, 1.2, { lead: .2, place: [980, 676] });
+ el.step(2, 1, 2, m('move') + 2.4, 1.2, { lead: .2, place: [980, 732] });
+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(lg, D - .9, .8);
+ }],
+
+ ['system', 'Three planes', (m) => {
+ const p = panel(0);
+ text(p, 'The lecture’s system', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, V } = three(p, LEC, '', { eqs: true, table: false, t0: m('eq1') - .3 });
+ V.sway(5, 13);
+ sys.planes.forEach(pl => pl.fade(0, 0, 0)); tw(sys.meet.e, { o: 0 }, 0, 0);
+ [0, 1, 2].forEach(i => { tw(sys.rows[i], { o: 0 }, 0, 0); show(sys.rows[i], m(`eq${i + 1}`), .4); sys.planes[i].fade(1, m(`eq${i + 1}`) + .3, .8); });
+ show(sys.meet.e, m('planes') + 1, .4); pulse(sys.meet.e, m('planes') + 1.4);
+ V.turn({ yaw: VIEW.yaw + 25 }, m('planes'), 4);
+ // the table takes the equations' place
+ tw(sys.E, { o: 0 }, m('table') - .2, .4);
+ say(p, [CAP_LEC], 90, 160, m('table'), { size: 28, fill: COL.dim });
+ const el = elim(p, sys, { at: TBL, size: 44, cw: 84, rh: 66, t0: m('table'), labelX: 530 });
+ const d = path(p, `M${el.cx(0) - 40} ${el.ry(0) - 50}L${el.cx(2) + 40} ${el.ry(2) + 20}`, { stroke: COL.task, 'stroke-width': 3, 'stroke-dasharray': '10 8', fill: 'none' }, { o: 0 });
+ show(d, m('goal'), .5);
+ text(p, 'goal: zeros below the pivots', 90, 470, m('goal') + .5, { size: 30, fill: COL.task, weight: 600 });
+ el.ring(1, 0, m('z1'), { dash: true, color: COL.task }); el.ring(2, 0, m('z1') + .5, { dash: true, color: COL.task });
+ el.ring(2, 1, m('z2'), { dash: true, color: COL.task });
+ text(p, 'column 1 first, then column 2', 90, 530, m('order'), { size: 30, fill: COL.chalk, weight: 600 });
+ text(p, 'a row above cleans a row below', 90, 585, m('order') + 3.5, { size: 28, fill: COL.dim, weight: 600 });
+ V.turn({ yaw: VIEW.yaw }, m('order'), 3);
+ }],
+
+ ['step1', 'Column one: row 2', (m) => {
+ const p = panel(0);
+ text(p, 'Column 1: row 2 − 3 × row 1', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, el, V } = three(p, LEC, CAP_LEC);
+ el.ring(0, 0, m('piv'));
+ el.ring(1, 0, m('rem'), { dash: true });
+ say(p, ['ℓ = 3 ÷ 1 = 3'], 90, 500, m('l'), { size: 34, fill: COL.task });
+ el.op(1, 0, 3, m('l') + 1.4);
+ el.line([3, 6, 3, 6], 3, m('three'), { label: '3 × row 1', color: BLUE });
+ sys.focus(1, m('go'));
+ el.mult(3, m('go') + .6, 4, { count: false });
+ V.turn({ yaw: VIEW.yaw + 30 }, m('go'), 11);
+ hinge(sys, 0, m('hinge'), 2); hinge(sys, 0, m('hinge') + 2.4, 2);
+ sys.focus(null, m('nums'));
+ lightRow(el, 1, [m('e1'), m('e2'), m('e3'), m('e4')]);
+ text(p, 'row 2 has no x: its plane runs along x', 90, 570, m('nox'), { size: 30, fill: CORAL, weight: 600 });
+ V.turn({ yaw: VIEW.yaw + 75, pitch: 14 }, m('nox') + .3, 3); // look along x: the coral plane stands edge-on
+ }],
+
+ ['step1b', 'Column one: row 3', (m) => {
+ const p = panel(0);
+ text(p, 'Column 1: row 3', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, el, V } = three(p, AFTER1, CAP_LEC);
+ V.sway(5, 13);
+ el.ring(2, 0, m('rem'), { dash: true });
+ say(p, ['ℓ = 0 ÷ 1 = 0'], 90, 500, m('l'), { size: 34, fill: COL.task });
+ el.op(2, 0, 0, m('l') + 1.4);
+ sys.focus(2, m('nothing')); sys.focus(null, m('done'));
+ text(p, 'nothing to remove: nothing moves', 90, 560, m('nothing') + 1, { size: 30, fill: YELLOW, weight: 600 });
+ el.ring(1, 0, m('done'), { color: COL.good }); el.ring(2, 0, m('done') + .3, { color: COL.good });
+ text(p, 'column 1 done', 90, 620, m('done') + .8, { size: 30, fill: COL.good, weight: 600 });
+ }],
+
+ ['q1', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ const t = three(p, AFTER1, CAP_LEC);
+ S.sys = t.sys; S.el = t.el;
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-col2', prompt: ['Column 2: remove the y from row 3, using row 2.'],
+ build: blanks([
+ { parts: ['second pivot: ', { box: '2' }], why: 'Row 2 is (0, 2, −2 | 6): its first number that is not 0 is 2.', hint: 'Look at row 2 now. Its x is gone: which number comes first?' },
+ { parts: ['number to remove: ', { box: '4' }], why: 'Row 3 has 4 under the 2.', hint: 'Which number of row 3 sits under the second pivot?' },
+ { parts: ['ℓ = ', { box: '2' }], why: '4 ÷ 2 = 2.', hint: 'Divide the number to remove by the pivot.' },
+ ]),
+ }], done) }],
+
+ ['step2', 'Column two', (m) => {
+ const p = panel(0);
+ text(p, 'Column 2: row 3 − 2 × row 2', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, el, V } = three(p, AFTER1, CAP_LEC);
+ el.ring(1, 1, m('piv'));
+ el.ring(2, 1, m('rem'), { dash: true });
+ say(p, ['ℓ = 4 ÷ 2 = 2'], 90, 500, m('l'), { size: 34, fill: COL.task });
+ el.op(2, 1, 2, m('l') + 1.2);
+ el.line([0, 4, -4, 12], 3, m('two'), { label: '2 × row 2', color: CORAL });
+ sys.focus(2, m('go'));
+ el.mult(2, m('go') + .6, 4, { count: false });
+ V.turn({ yaw: VIEW.yaw - 25 }, m('go'), 6);
+ hinge(sys, 2, m('turn') + .3, 2); hinge(sys, 2, m('turn') + 2.6, 2);
+ sys.focus(null, m('nums'));
+ lightRow(el, 2, [m('e1'), m('e2'), m('e3'), m('e4')]);
+ say(p, ['5z = −10, z = −2'], 90, 570, m('flat'), { size: 34, fill: YELLOW });
+ text(p, 'no x, no y: a flat plane at height −2', 90, 630, m('flat') + 2.5, { size: 30, fill: YELLOW, weight: 600 });
+ V.turn({ yaw: VIEW.yaw - 10, pitch: 34 }, m('flat') + 1, 3);
+ }],
+
+ ['result', 'The triangle', (m) => {
+ const p = panel(0);
+ text(p, 'The triangle U, and c', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, el, V } = three(p, U_, 'x + 2y + z = 2, 2y − 2z = 6, 5z = −10', { view: { yaw: VIEW.yaw - 10, pitch: 30 } });
+ V.sway(5, 13);
+ triangle(p, el, m('tri'));
+ say(p, ['U'], el.cx(1), el.ry(2) + 78, m('tri') + .6, { size: 48, fill: COL.task, anchor: 'middle' });
+ [0, 1, 2].forEach(i => el.ring(i, i, m('pivots') + .7 * i));
+ [0, 1, 2].forEach(i => el.flash(i, m('c') + .5, 3));
+ say(p, ['c'], el.cx(3), el.ry(2) + 78, m('c') + .5, { size: 48, fill: COL.task, anchor: 'middle' });
+ show(sys.meet.e, 0, 0); pulse(sys.meet.e, m('same') + .3); pulse(sys.meet.e, m('same') + 1.5);
+ V.turn({ yaw: VIEW.yaw + 20 }, m('same'), 4);
+ el.focus(2, m('z')); el.focus(null, m('z') + 6);
+ say(p, ['5z = −10, z = −2'], 90, 560, m('z') + 1.2, { size: 36, fill: COL.task });
+ text(p, 'y and x: next chapter', 90, 620, m('z') + 4.5, { size: 28, fill: COL.dim, weight: 600 });
+ }],
+
+ ['ex2', 'A system of our own', (m) => {
+ const p = panel(0);
+ text(p, 'A system of our own', 60, 110, .2, { size: 40, weight: 600 });
+ const { sys, el, V } = three(p, { A: [[2, 1, 1], [4, 1, 3], [-2, 2, 1]], b: [3, 3, 1] }, '2x + y + z = 3, 4x + y + 3z = 3, −2x + 2y + z = 1', { t0: m('eq') - .3, view: { yaw: -20, pitch: 22 } });
+ el.ring(0, 0, m('c1'));
+ say(p, ['row 2: ℓ = 4 ÷ 2 = 2'], 90, 470, m('l21'), { size: 32, fill: COL.task });
+ el.op(1, 0, 2, m('l21') + 1.5);
+ el.mult(2, m('s21'), 1.8, { count: false });
+ say(p, ['row 3: ℓ = −2 ÷ 2 = −1'], 90, 525, m('l31'), { size: 32, fill: COL.task });
+ el.op(2, 0, -1, m('l31') + 1.5);
+ el.mult(-1, m('s31') + 1.2, 1.8, { count: false });
+ el.ring(1, 1, m('c2'));
+ say(p, ['row 3: ℓ = 3 ÷ (−1) = −3'], 90, 580, m('l32'), { size: 32, fill: COL.task });
+ el.op(2, 1, -3, m('l32') + 1.5);
+ el.mult(-3, m('s32') + .8, 1.8, { count: false });
+ V.turn({ yaw: -45, pitch: 24 }, m('eq'), 9);
+ V.turn({ yaw: 25, pitch: 26 }, m('s21'), 14);
+ triangle(p, el, m('u'));
+ [0, 1, 2].forEach(i => el.ring(i, i, m('u') + 1.5 + .5 * i, { color: COL.task }));
+ say(p, ['5z = −5, z = −1'], 90, 650, m('z'), { size: 34, fill: COL.task });
+ }],
+
+ ['q2', 'Your turn', () => {
+ const p = panel(0);
+ text(p, 'Your turn', 60, 110, .2, { size: 40, weight: 600 });
+ const t = three(p, { A: [[1, 1, 1], [0, 1, 2], [0, 3, 1]], b: [1, -1, 2] }, 'x + y + z = 1, y + 2z = −1, 3y + z = 2');
+ S.sys = t.sys; S.el = t.el;
+ S.el.op(2, 1, 0, .3);
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-flat3', prompt: ['Drag the multiplier until the yellow plane lies flat (row 3 loses its y).'],
+ build: elTask(S.el, v => v.a21 === 0, 'ℓ = 3 ÷ 1 = 3: row 3 becomes (0, 0, −5 | 5), so z = −1, a flat plane.',
+ (v, l) => `Row 3 still has ${num(v.a21)}y. The pivot of row 2 is 1; the number to remove is 3.`, () => S.el.set({ l: 3 })),
+ }], done) }],
+
+ ['q3', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ const t = three(p, { A: [[1, 1, 1], [2, 3, 1], [1, 3, 4]], b: [6, 11, 19] }, 'x + y + z = 6, 2x + 3y + z = 11, x + 3y + 4z = 19');
+ S.sys = t.sys; S.el = t.el;
+ }, { ask: done => quiz({ x: 40, y: 400, w: 720, cls: 'side' }, [{
+ id: 'c-three', prompt: ['Find the three multipliers, in order, and the last pivot.'],
+ build: blanks([
+ { parts: ['row 2 − ', { box: '2' }, ' × row 1, row 3 − ', { box: '1' }, ' × row 1'], why: '2 ÷ 1 = 2 and 1 ÷ 1 = 1: rows 2 and 3 become (0, 1, −1 | −1) and (0, 2, 3 | 13).', hint: 'The pivot is 1, so each multiplier is the row’s first number.' },
+ { parts: ['row 3 − ', { box: '2' }, ' × row 2, third pivot ', { box: '5' }], why: 'Row 2 is now (0, 1, −1), row 3 (0, 2, 3): ℓ = 2 ÷ 1 = 2, and 3 − 2·(−1) = 5.', hint: 'After column 1, row 2 is (0, 1, −1) and row 3 is (0, 2, 3).' },
+ ]),
+ }], done) }],
+
+ ['wrap', 'Summary', (m) => {
+ const p = panel(0);
+ [['Column 1: row 1 removes x from rows 2 and 3.', 'w1'], ['Column 2: row 2 removes y from row 3.', 'w2'],
+ ['ℓ = (number to remove) ÷ (pivot); each step turns one plane on a hinge.', 'w3'], ['The result: a triangle U with the pivots on its diagonal, and new right sides c.', '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.task }, g);
+ T(g, String(i + 1), { x: 120, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });
+ T(g, str, { x: 170, size: 34, weight: 600 });
+ tw(g, { o: 1, x: 0 }, m(mark), .6);
+ });
+ }],
+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{
+ id: 'p-col1', prompt: ['Find the multipliers that clear column 1 (rows 2 and 3).'],
+ build: blanks(COL1Q),
+ }], done, 'Chapter practice · set 1 of 4') }],
+ ['final2', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-row', prompt: ['Rows are written as (numbers in A | right side). Work out the new row.'],
+ build: blanks(ROWQ),
+ }], done, 'Chapter practice · set 2 of 4') }],
+ ['final3', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-piv', prompt: ['Eliminate down to the triangle (rows of A only) and give the three pivots.'],
+ build: blanks(PIVQ),
+ }], done, 'Chapter practice · set 3 of 4') }],
+ ['final4', 'Chapter practice', () => {
+ const p = panel(0);
+ text(p, 'Three steps', 60, 110, .2, { size: 40, weight: 600 });
+ const t = three(p, WALK, 'x + y + 2z = 2, 2x + 3y + 5z = 4, −x + y + z = −1');
+ S.sys = t.sys; S.el = t.el;
+ }, { ask: done => quiz(CARD, WALK_STEPS.map((st, k) => ({
+ id: `p-walk${k + 1}`, prompt: [['Column 1, row 2.', 'Column 1, row 3.', 'Column 2, row 3.'][k], ' Drag the multiplier until the number under the pivot is 0.'],
+ build: stepTask(st),
+ })), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ const t = three(p, LEC, CAP_LEC);
+ S.sys = t.sys; S.el = t.el;
+ S.el.op(1, 0, 0, .3);
+ const hint = text(p, 'try: make row 2 lose its x; drag the space to look along the hinge', 90, 470, m('go'), { size: 24, fill: COL.dim });
+ hide(hint, m('go') + 8, .6);
+ }, { ask: playAsk(() => S.el, { pos: CARD, tip: 'Your system. Drag the multiplier or any number in the table, turn the space, or draw on the board. Nothing is marked.' }) }],
+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+boot();
+</script>
+</body>
+</html>
diff --git a/site/linear-algebra/ch19/audio/en/bottom.mp3 b/site/linear-algebra/ch19/audio/en/bottom.mp3
new file mode 100644
index 0000000..816e204
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/bottom.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/check.mp3 b/site/linear-algebra/ch19/audio/en/check.mp3
new file mode 100644
index 0000000..ed5dad2
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/check.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/ex2.mp3 b/site/linear-algebra/ch19/audio/en/ex2.mp3
new file mode 100644
index 0000000..de2129e
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/ex2.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/final1.mp3 b/site/linear-algebra/ch19/audio/en/final1.mp3
new file mode 100644
index 0000000..e255e43
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/final1.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/final2.mp3 b/site/linear-algebra/ch19/audio/en/final2.mp3
new file mode 100644
index 0000000..e8e435e
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/final2.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/final3.mp3 b/site/linear-algebra/ch19/audio/en/final3.mp3
new file mode 100644
index 0000000..779ef38
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/final3.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/final4.mp3 b/site/linear-algebra/ch19/audio/en/final4.mp3
new file mode 100644
index 0000000..00104c2
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/final4.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/finish.mp3 b/site/linear-algebra/ch19/audio/en/finish.mp3
new file mode 100644
index 0000000..11ec7dc
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/finish.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/frac.mp3 b/site/linear-algebra/ch19/audio/en/frac.mp3
new file mode 100644
index 0000000..3985739
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/frac.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/intro.mp3 b/site/linear-algebra/ch19/audio/en/intro.mp3
new file mode 100644
index 0000000..73aa76a
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/intro.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/middle.mp3 b/site/linear-algebra/ch19/audio/en/middle.mp3
new file mode 100644
index 0000000..b1c0729
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/middle.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/play.mp3 b/site/linear-algebra/ch19/audio/en/play.mp3
new file mode 100644
index 0000000..960b06a
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/play.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/q1.mp3 b/site/linear-algebra/ch19/audio/en/q1.mp3
new file mode 100644
index 0000000..6d1d15d
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/q1.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/q2.mp3 b/site/linear-algebra/ch19/audio/en/q2.mp3
new file mode 100644
index 0000000..d466681
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/q2.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/q3.mp3 b/site/linear-algebra/ch19/audio/en/q3.mp3
new file mode 100644
index 0000000..05201e0
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/q3.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/timings.js b/site/linear-algebra/ch19/audio/en/timings.js
new file mode 100644
index 0000000..84f4dc6
--- /dev/null
+++ b/site/linear-algebra/ch19/audio/en/timings.js
@@ -0,0 +1,628 @@
+window.TIMINGS = {
+ "intro": {
+ "dur": 14.856,
+ "marks": {
+ "sub": 2.956,
+ "move": 12.24
+ },
+ "cues": [
+ [
+ 0.104,
+ "Chapter nineteen."
+ ],
+ [
+ 1.484,
+ "Back substitution."
+ ],
+ [
+ 2.956,
+ "Elimination left us a triangle."
+ ],
+ [
+ 6.185,
+ "Now the triangle gives us the answer, one unknown at a time, from the bottom row up."
+ ],
+ [
+ 12.24,
+ "First z, then y, then x."
+ ]
+ ]
+ },
+ "two": {
+ "dur": 41.832,
+ "marks": {
+ "eq": 3.776,
+ "y": 12.422,
+ "flat": 18.776,
+ "up": 22.969,
+ "x": 28.151,
+ "pt": 29.818,
+ "name": 34.453
+ },
+ "cues": [
+ [
+ 0.091,
+ "You've done this once already, in chapter sixteen."
+ ],
+ [
+ 3.776,
+ "After elimination, the two equations were x plus two y equals five, and minus two y equals minus four."
+ ],
+ [
+ 12.422,
+ "The bottom row has only y."
+ ],
+ [
+ 14.857,
+ "Minus two y equals minus four, so y equals two."
+ ],
+ [
+ 18.776,
+ "In the picture, that's the flat line: every point at height two."
+ ],
+ [
+ 22.969,
+ "Now go up to the top row, and put in y equals two."
+ ],
+ [
+ 26.146,
+ "x plus four equals five, so x equals one."
+ ],
+ [
+ 29.818,
+ "On the flat line, the top equation picks out one point: one, two."
+ ],
+ [
+ 34.453,
+ "Solving from the bottom up like this is called back substitution."
+ ],
+ [
+ 38.438,
+ "Substitution means putting a number in place of a letter."
+ ]
+ ]
+ },
+ "bottom": {
+ "dur": 33.768,
+ "marks": {
+ "eq": 4.154,
+ "row": 12.878,
+ "div": 17.695,
+ "floor": 24.948
+ },
+ "cues": [
+ [
+ 0.104,
+ "Now three equations: the triangle from chapter eighteen."
+ ],
+ [
+ 4.154,
+ "x plus two y plus z equals two."
+ ],
+ [
+ 7.305,
+ "Two y minus two z equals six."
+ ],
+ [
+ 10.352,
+ "And five z equals minus ten."
+ ],
+ [
+ 12.878,
+ "Start at the bottom."
+ ],
+ [
+ 14.102,
+ "This row has only one unknown, z."
+ ],
+ [
+ 17.695,
+ "Five z equals minus ten."
+ ],
+ [
+ 20.169,
+ "Divide both sides by the pivot, five, and z equals minus two."
+ ],
+ [
+ 24.948,
+ "In space, this row is the flat yellow plane, at height minus two."
+ ],
+ [
+ 30.117,
+ "Every point on it has z equal to minus two."
+ ]
+ ]
+ },
+ "middle": {
+ "dur": 34.92,
+ "marks": {
+ "eq": 1.315,
+ "put": 4.375,
+ "sign": 11.38,
+ "sub4": 17.357,
+ "div": 20.638,
+ "line": 24.271
+ },
+ "cues": [
+ [
+ 0.104,
+ "Go up one row."
+ ],
+ [
+ 1.315,
+ "Two y minus two z equals six."
+ ],
+ [
+ 4.375,
+ "We know z now, so put in minus two."
+ ],
+ [
+ 7.044,
+ "Two y minus two times minus two equals six."
+ ],
+ [
+ 11.38,
+ "Minus two times minus two is plus four."
+ ],
+ [
+ 14.766,
+ "So two y plus four equals six."
+ ],
+ [
+ 17.357,
+ "Take four from both sides: two y equals two."
+ ],
+ [
+ 20.638,
+ "Divide by the pivot, two, and y equals one."
+ ],
+ [
+ 24.271,
+ "In space: on the flat plane, this row leaves only a line, where y is one and z is minus two."
+ ],
+ [
+ 32.266,
+ "That's where the coral plane cuts the floor."
+ ]
+ ]
+ },
+ "top": {
+ "dur": 20.736,
+ "marks": {
+ "eq": 1.289,
+ "put": 4.622,
+ "x": 11.354,
+ "pt": 12.812,
+ "ans": 18.503
+ },
+ "cues": [
+ [
+ 0.104,
+ "Now the top row."
+ ],
+ [
+ 1.289,
+ "x plus two y plus z equals two."
+ ],
+ [
+ 4.622,
+ "Put in y equals one and z equals minus two."
+ ],
+ [
+ 8.359,
+ "x plus two minus two equals two."
+ ],
+ [
+ 11.354,
+ "So x equals two."
+ ],
+ [
+ 12.812,
+ "Along that line, the blue plane picks out one point: two, one, minus two."
+ ],
+ [
+ 18.503,
+ "That's the answer to the whole system."
+ ]
+ ]
+ },
+ "why": {
+ "dur": 33.216,
+ "marks": {
+ "look": 1.693,
+ "r3": 2.982,
+ "r2": 5.938,
+ "r1": 9.492,
+ "new": 12.76,
+ "zero": 19.089,
+ "orig": 21.953
+ },
+ "cues": [
+ [
+ 0.104,
+ "Why is this so easy?"
+ ],
+ [
+ 1.693,
+ "Look at the triangle."
+ ],
+ [
+ 2.982,
+ "The bottom row has one unknown."
+ ],
+ [
+ 5.938,
+ "The next row up has two, but one of them we already know."
+ ],
+ [
+ 9.492,
+ "And the top row has three, but two are already known."
+ ],
+ [
+ 12.76,
+ "Every row brings just one new unknown, and we find it by dividing by its pivot."
+ ],
+ [
+ 19.089,
+ "That's one more reason a pivot can't be zero."
+ ],
+ [
+ 21.953,
+ "Compare an original row, three x plus eight y plus z equals twelve: three unknowns at once, and none known."
+ ],
+ [
+ 30.885,
+ "The triangle is what makes it easy."
+ ]
+ ]
+ },
+ "q1": {
+ "dur": 3.168,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.094,
+ "Solve the triangle from the bottom up."
+ ]
+ ]
+ },
+ "check": {
+ "dur": 36.6,
+ "marks": {
+ "orig": 1.914,
+ "why": 6.263,
+ "c1": 16.263,
+ "c2": 21.406,
+ "c3": 27.396,
+ "ok": 30.807
+ },
+ "cues": [
+ [
+ 0.104,
+ "One more step, and it matters."
+ ],
+ [
+ 1.914,
+ "Check the answer in the original equations, not in the triangle."
+ ],
+ [
+ 6.263,
+ "Elimination was a lot of arithmetic."
+ ],
+ [
+ 9.062,
+ "If we slipped there, the triangle would be wrong, and its answer would fit the triangle, but not the system we started with."
+ ],
+ [
+ 16.263,
+ "x plus two y plus z: two plus two minus two is two."
+ ],
+ [
+ 21.406,
+ "Three x plus eight y plus z: six plus eight minus two is twelve."
+ ],
+ [
+ 27.396,
+ "Four y plus z: four minus two is two."
+ ],
+ [
+ 30.807,
+ "All three are true."
+ ],
+ [
+ 32.227,
+ "So two, one, minus two really solves the system."
+ ]
+ ]
+ },
+ "ex2": {
+ "dur": 52.152,
+ "marks": {
+ "eq": 2.643,
+ "z": 12.526,
+ "y": 17.643,
+ "y2": 25.026,
+ "x": 26.602,
+ "x2": 34.987,
+ "chk": 36.81,
+ "c1": 38.958,
+ "c2": 41.81,
+ "c3": 44.74,
+ "ok": 48.32
+ },
+ "cues": [
+ [
+ 0.104,
+ "Now our own system from chapter eighteen."
+ ],
+ [
+ 2.643,
+ "Its triangle was: two x plus y plus z equals three, minus y plus z equals minus three, and five z equals minus five."
+ ],
+ [
+ 12.526,
+ "Bottom: five z equals minus five, so z equals minus one."
+ ],
+ [
+ 17.643,
+ "Middle: minus y, minus one, equals minus three."
+ ],
+ [
+ 22.721,
+ "So minus y equals minus two, and y equals two."
+ ],
+ [
+ 26.602,
+ "Top: two x plus two minus one equals three."
+ ],
+ [
+ 30.768,
+ "Two x plus one equals three, so two x equals two, and x equals one."
+ ],
+ [
+ 36.81,
+ "Check in the original equations."
+ ],
+ [
+ 38.958,
+ "Two plus two minus one is three."
+ ],
+ [
+ 41.81,
+ "Four plus two minus three is three."
+ ],
+ [
+ 44.74,
+ "Minus two plus four minus one is one."
+ ],
+ [
+ 48.32,
+ "All true."
+ ],
+ [
+ 49.219,
+ "The answer is one, two, minus one."
+ ]
+ ]
+ },
+ "frac": {
+ "dur": 35.64,
+ "marks": {
+ "eq": 2.24,
+ "z": 9.505,
+ "y": 13.151,
+ "y2": 21.497,
+ "x": 24.518,
+ "x2": 31.315,
+ "pt": 32.943
+ },
+ "cues": [
+ [
+ 0.143,
+ "Fractions don't change anything."
+ ],
+ [
+ 2.24,
+ "x plus y plus two z equals four, two y plus four z equals four, and four z equals two."
+ ],
+ [
+ 9.505,
+ "Four z equals two, so z equals one half."
+ ],
+ [
+ 13.151,
+ "Then two y plus four times one half equals four."
+ ],
+ [
+ 16.836,
+ "Four times one half is two, so two y plus two equals four."
+ ],
+ [
+ 21.497,
+ "Two y equals two, and y equals one."
+ ],
+ [
+ 24.518,
+ "Top: x plus one plus two times one half equals four."
+ ],
+ [
+ 29.036,
+ "That's x plus two equals four, so x equals two."
+ ],
+ [
+ 32.943,
+ "The answer is two, one, one half."
+ ]
+ ]
+ },
+ "q2": {
+ "dur": 6.792,
+ "marks": {},
+ "cues": [
+ [
+ 0.078,
+ "Your turn, backwards."
+ ],
+ [
+ 1.979,
+ "Change only the right sides, so that the three planes meet at the ring."
+ ]
+ ]
+ },
+ "q3": {
+ "dur": 2.832,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.133,
+ "Watch the minus signs."
+ ]
+ ]
+ },
+ "wrap": {
+ "dur": 24.408,
+ "marks": {
+ "w1": 0.99,
+ "w2": 5.885,
+ "w3": 11.237,
+ "w4": 19.089,
+ "end": 22.201
+ },
+ "cues": [
+ [
+ 0.104,
+ "To sum up."
+ ],
+ [
+ 0.99,
+ "After elimination, solve from the bottom row up."
+ ],
+ [
+ 4.193,
+ "That's back substitution."
+ ],
+ [
+ 5.885,
+ "Each row brings one new unknown."
+ ],
+ [
+ 8.49,
+ "Put in what you know, then divide by the pivot."
+ ],
+ [
+ 11.237,
+ "In the picture, the bottom row is a flat plane, the next row cuts it in a line, and the top row picks out the point."
+ ],
+ [
+ 19.089,
+ "Always check the answer in the original equations."
+ ],
+ [
+ 22.201,
+ "Now try the chapter practice."
+ ]
+ ]
+ },
+ "final1": {
+ "dur": 4.08,
+ "marks": {},
+ "cues": [
+ [
+ 0.091,
+ "Chapter practice."
+ ],
+ [
+ 1.536,
+ "Two equations, from the bottom up."
+ ]
+ ]
+ },
+ "final2": {
+ "dur": 3.048,
+ "marks": {},
+ "cues": [
+ [
+ 0.091,
+ "Next, three equations in a triangle."
+ ]
+ ]
+ },
+ "final3": {
+ "dur": 4.536,
+ "marks": {},
+ "cues": [
+ [
+ 0.091,
+ "Now the whole way: eliminate, substitute back, and check."
+ ]
+ ]
+ },
+ "final4": {
+ "dur": 4.632,
+ "marks": {},
+ "cues": [
+ [
+ 0.078,
+ "Last set."
+ ],
+ [
+ 1.133,
+ "Choose the right sides that put the meeting point on the ring."
+ ]
+ ]
+ },
+ "play": {
+ "dur": 12.864,
+ "marks": {
+ "go": 3.763
+ },
+ "cues": [
+ [
+ 0.104,
+ "Playground."
+ ],
+ [
+ 1.133,
+ "Nothing here is marked right or wrong."
+ ],
+ [
+ 3.763,
+ "Change the triangle's numbers, and watch the floor, the line and the point move."
+ ],
+ [
+ 8.698,
+ "Turn the space to look along the line."
+ ],
+ [
+ 11.185,
+ "Press continue when you're done."
+ ]
+ ]
+ },
+ "finish": {
+ "dur": 11.232,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "Well done."
+ ],
+ [
+ 1.055,
+ "That's the end of chapter nineteen, back substitution."
+ ],
+ [
+ 4.818,
+ "Next: what happens when elimination breaks down, because a zero lands where a pivot should be."
+ ]
+ ]
+ }
+};
diff --git a/site/linear-algebra/ch19/audio/en/top.mp3 b/site/linear-algebra/ch19/audio/en/top.mp3
new file mode 100644
index 0000000..9e0fe48
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/top.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/two.mp3 b/site/linear-algebra/ch19/audio/en/two.mp3
new file mode 100644
index 0000000..3d27424
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/two.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/why.mp3 b/site/linear-algebra/ch19/audio/en/why.mp3
new file mode 100644
index 0000000..1809e32
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/why.mp3 differ
diff --git a/site/linear-algebra/ch19/audio/en/wrap.mp3 b/site/linear-algebra/ch19/audio/en/wrap.mp3
new file mode 100644
index 0000000..2b0231b
Binary files /dev/null and b/site/linear-algebra/ch19/audio/en/wrap.mp3 differ
diff --git a/site/linear-algebra/ch19/index.html b/site/linear-algebra/ch19/index.html
new file mode 100644
index 0000000..0edbd79
--- /dev/null
+++ b/site/linear-algebra/ch19/index.html
@@ -0,0 +1,327 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Back Substitution</title>
+<link rel="stylesheet" href="../lib/engine.css">
+<link rel="expect" href="#bar" blocking="render"><!-- hold the first frame until the player exists, so the page transition can run -->
+</head>
+<body>
+<script src="../lib/engine.js"></script>
+<script src="../lib/math.js"></script>
+<script src="../lib/linsys.js"></script>
+<script src="../lib/space3.js"></script>
+<script src="../lib/play.js"></script>
+<script src="audio/en/timings.js"></script>
+<script>
+'use strict';
+const CHAPTER = { number: 19, title: 'Back Substitution', minutes: 11, language: 'en', next: '../ch20/' };
+
+/* ---------- chapter drawing helpers ---------- */
+const LEC = { A: [[1, 2, 1], [3, 8, 1], [0, 4, 1]], b: [2, 12, 2] }; // the lecture's system (OCW 18.06, lecture 2)
+const U_ = { A: [[1, 2, 1], [0, 2, -2], [0, 0, 5]], b: [2, 6, -10] }; // its triangle U and c (chapter 18)
+const VIEW = { yaw: -30, pitch: 24 };
+const CARD = { x: 40, y: 390, w: 720, cls: 'side' }; // under the three equations, beside the space
+const BLUE = S3_ROW[0], CORAL = S3_ROW[1], YELLOW = S3_ROW[2];
+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; };
+const text = (p, str, x, y, t0, { size = 30, fill = COL.chalk, anchor = 'start', weight = 500 } = {}) => { const e = T(p, str, { x, y, size, fill, anchor, weight, o: 0 }); show(e, t0); return e; };
+const okMark = (p, x, y, t0, size = 32) => text(p, '✓', x, y, t0, { size, fill: COL.good, weight: 700 });
+// Three equations top left, their planes on the right; the meeting point hidden until a beat finds it.
+const three = (p, { A, b }, { t0 = .1, view = VIEW, meet = false } = {}) => {
+ const sys = lin3(p, { A, b, eq: [90, 190], mat: null, sol: false, space: { cx: 1185, size: 600, ...view }, t0 });
+ if (!meet) tw(sys.meet.e, { o: 0 }, 0, 0);
+ return sys;
+};
+// The meeting line of planes 2 and 3 (lin3's lines[2]), thickened for a moment.
+const lineOf23 = (sys, t0, dur = 1.6) => prog(q => sys.lines[2].e.setAttribute('stroke-width', 2.5 + 6 * Math.sin(Math.PI * q)), t0, dur, lin);
+// A box round a term of lin3's equations: row i (0–2), term j (0: x, 1: y, 2: z).
+const termBox = (p, i, j, t0, t1, color = COL.task) => {
+ const r = mk('rect', { x: 128 + 135 * j, y: 190 + 70 * i - 42, width: 92, height: 56, rx: 10, fill: 'none', stroke: color, 'stroke-width': 3 }, p);
+ put(r, { o: 0 }); show(r, t0, .3); if (t1) hide(r, t1, .3);
+ return r;
+};
+// A dashed ring in space: the target of a hands-on question.
+const ring3 = (V, q, label) => {
+ const d = V.point(q, { color: COL.task, r: 15, label, size: 24 });
+ const c = d.e.firstChild; c.setAttribute('fill', 'none'); c.setAttribute('stroke', COL.task); c.setAttribute('stroke-dasharray', '4 4'); c.setAttribute('stroke-width', 3);
+ return d;
+};
+const thick2 = (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); };
+const tri = q => `(${q.map(num).join(', ')})`;
+const at3 = (s, q) => s.x !== undefined && Math.abs(s.x - q[0]) < 1e-9 && Math.abs(s.y - q[1]) < 1e-9 && Math.abs(s.z - q[2]) < 1e-9;
+
+/* ---------- practice data (every answer worked twice: back substitution, then the original rows) ---------- */
+const TWOQ = [
+ { parts: ['x + 3y = 7, 2y = 4: y = ', { box: '2' }, ', x = ', { box: '1' }], why: 'y = 4 ÷ 2 = 2; x + 6 = 7, x = 1.', hint: 'Bottom first: 2y = 4. Then put y into x + 3y = 7.' },
+ { parts: ['2x − y = 5, 3y = −3: y = ', { box: '-1' }, ', x = ', { box: '2' }], why: 'y = −1; 2x + 1 = 5, 2x = 4, x = 2.', hint: 'y = −1, so −y = +1.' },
+ { parts: ['x + 4y = 2, −y = 1: y = ', { box: '-1' }, ', x = ', { box: '6' }], why: 'y = −1; x − 4 = 2, x = 6.', hint: '−y = 1 means y = −1.' },
+ { parts: ['3x + 2y = 1, 5y = 10: y = ', { box: '2' }, ', x = ', { box: '-1' }], why: 'y = 2; 3x + 4 = 1, 3x = −3, x = −1.', hint: 'After y = 2: 3x + 4 = 1.' },
+ { parts: ['4x − 3y = 2, 2y = 2: y = ', { box: '1' }, ', x = ', { box: '5/4' }], why: 'y = 1; 4x − 3 = 2, 4x = 5, x = 5/4.', hint: 'After y = 1: 4x − 3 = 2, so 4x = 5.' },
+];
+const TRIQ = [
+ { parts: ['x + y + z = 6, y + 2z = 7, 3z = 9: z = ', { box: '3' }, ', y = ', { box: '1' }, ', x = ', { box: '2' }], why: 'z = 3; y + 6 = 7, y = 1; x + 1 + 3 = 6, x = 2.', hint: 'Bottom: 3z = 9. Middle: y + 2·3 = 7.' },
+ { parts: ['2x − y + z = 3, 3y − z = 7, 2z = −2: z = ', { box: '-1' }, ', y = ', { box: '2' }, ', x = ', { box: '3' }], why: 'z = −1; 3y + 1 = 7, y = 2; 2x − 2 − 1 = 3, x = 3.', hint: 'z = −1, so −z = +1: 3y + 1 = 7.' },
+ { parts: ['x + 2y − z = 0, −y + 4z = 9, −2z = −4: z = ', { box: '2' }, ', y = ', { box: '-1' }, ', x = ', { box: '4' }], why: 'z = 2; −y + 8 = 9, y = −1; x − 2 − 2 = 0, x = 4.', hint: '−y + 8 = 9 gives −y = 1.' },
+ { parts: ['5x + z = 4, 2y + z = 1, 4z = −4: z = ', { box: '-1' }, ', y = ', { box: '1' }, ', x = ', { box: '1' }], why: 'z = −1; 2y − 1 = 1, y = 1; 5x − 1 = 4, x = 1.', hint: 'Row 1 has no y: 5x + z = 4.' },
+];
+const FULLQ = [
+ { parts: ['x + y + z = 6, 2x + 3y + z = 11, x + 3y + 4z = 19: x = ', { box: '1' }, ', y = ', { box: '2' }, ', z = ', { box: '3' }], why: 'U: (1, 1, 1 | 6), (0, 1, −1 | −1), (0, 0, 5 | 15). z = 3, y = 2, x = 1. Check: 2 + 6 + 3 = 11, 1 + 6 + 12 = 19.', hint: 'ℓ = 2 and 1 for column 1, then ℓ = 2 for column 2; 5z = 15.' },
+ { parts: ['x + y + 2z = 2, 2x + 3y + 5z = 4, −x + y + z = −1: x = ', { box: '1' }, ', y = ', { box: '-1' }, ', z = ', { box: '1' }], why: 'U: (0, 1, 1 | 0), (0, 0, 1 | 1) under row 1. z = 1, y = −1, x = 1. Check: 2 − 3 + 5 = 4, −1 − 1 + 1 = −1.', hint: 'ℓ = 2 and −1 for column 1, then ℓ = 2: z = 1.' },
+ { parts: ['2x + y + z = 5, 4x + 3y + 3z = 13, 2x + 3y + 4z = 13: x = ', { box: '1' }, ', y = ', { box: '1' }, ', z = ', { box: '2' }], why: 'U: (0, 1, 1 | 3), (0, 0, 1 | 2). z = 2, y = 1, x = 1. Check: 4 + 3 + 6 = 13, 2 + 3 + 8 = 13.', hint: 'ℓ = 2 and 1, then ℓ = 2: the last row is z = 2.' },
+];
+// Hands-on: the triangle stays, the reader picks c so that the planes meet on the ring.
+const AIMS = [
+ { A: U_.A, b: [0, 0, 0], q: [1, 1, 1], c: [4, 0, 5] },
+ { A: [[2, 1, 1], [0, -1, 1], [0, 0, 5]], b: [0, 0, 0], q: [1, -1, 2], c: [3, 3, 10] },
+ { A: [[1, 1, 2], [0, 2, 4], [0, 0, 4]], b: [0, 0, 0], q: [0, 2, -1], c: [0, 0, -4] },
+];
+const keys3 = ({ A, b }) => Object.fromEntries([...A.flatMap((r, i) => r.map((x, j) => [`a${i}${j}`, x])), ...b.map((x, i) => [`b${i}`, x])]);
+const aimTask = h => (body, api) => {
+ const sys = S.sys;
+ sys.set(keys3(h));
+ S.ring?.set(null);
+ S.ring = ring3(sys.space, h.q, tri(h.q));
+ return lin3Task(sys, (v, s) => at3(s, h.q), `Right sides ${tri(h.c)}: from the bottom, z = ${num(h.q[2])}, then y, then x land on the ring.`,
+ 'Work from the bottom row up: put the ring’s z into row 3 to get its right side, then y and z into row 2, then all three into row 1.',
+ () => sys.set({ b0: h.c[0], b1: h.c[1], b2: h.c[2] }), ['b0', 'b1', 'b2'])(body, api);
+};
+
+/* ---------- beats ---------- */
+const BEATS = [
+ ['intro', 'Back substitution', (m, D) => {
+ const g = G(scene, { o: 0, y: 24 });
+ T(g, 'Unit 2, Chapter 19', { x: 800, y: 300, size: 28, fill: COL.dim, anchor: 'middle' });
+ T(g, 'Back Substitution', { x: 800, y: 410, size: 88, weight: 600, anchor: 'middle' });
+ tw(g, { o: 1, y: 0 }, .2, 1.1, out);
+ const r = text(scene, 'the triangle gives the answer, from the bottom row up', 800, 520, m('sub'), { size: 36, fill: COL.dim, anchor: 'middle' });
+ const steps = G(scene, { o: 0 });
+ ['z', 'y', 'x'].forEach((n, i) => {
+ const s = say(steps, [n], 700 + 100 * i, 760 - 70 * i, m('sub') + 2 + 1.4 * i, { size: 56, fill: COL.task, anchor: 'middle' });
+ pulse(s, m('move') + .2 + .7 * i, 1.4);
+ if (i) say(steps, ['↗'], 650 + 100 * i, 800 - 70 * i, m('sub') + 1.8 + 1.4 * i, { size: 40, fill: COL.dim, anchor: 'middle' });
+ });
+ show(steps, m('sub') + 1.5, .3);
+ tw(g, { o: 0, y: -24 }, D - .9, .8); hide(r, D - .9, .8); hide(steps, D - .9, .8);
+ }],
+
+ ['two', 'Two equations again', (m) => {
+ const p = panel(0);
+ text(p, 'Two equations, from the bottom up', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = linsys(p, { A: [[1, 2], [0, -2]], b: [5, -4], eq: [90, 200], mat: null, sol: false, t0: m('eq') - .3 });
+ sys.lines.forEach(({ l }) => put(l, { o: 0 })); put(sys.meetBox, { o: 0 });
+ sys.focus(0, m('eq') + 1.2); sys.focus(1, m('eq') + 4.5);
+ sys.focus(1, m('y'));
+ say(p, ['−2y = −4, y = 2'], 90, 420, m('y') + 1, { size: 40, fill: COL.task });
+ show(sys.lines[1].l, m('flat'), .8);
+ sys.focus(0, m('up'));
+ say(p, ['x + 2·2 = 5'], 90, 500, m('up') + 2, { size: 40 });
+ say(p, ['x + 4 = 5, x = 1'], 90, 570, m('x'), { size: 40, fill: COL.task });
+ show(sys.lines[0].l, m('pt') - .5, .8);
+ sys.focus(null, m('pt'));
+ show(sys.meetBox, m('pt') + 1.5, .5); pulse(sys.meet, m('pt') + 1.8);
+ text(p, 'back substitution:', 90, 680, m('name'), { size: 32, fill: COL.chalk, weight: 600 });
+ text(p, 'solve the bottom row, put it in the row above', 90, 730, m('name') + 1, { size: 30, fill: COL.dim, weight: 600 });
+ thick2(sys, 1, m('name') + 3); thick2(sys, 0, m('name') + 5);
+ }],
+
+ ['bottom', 'The bottom row', (m) => {
+ const p = S.p = panel(0);
+ text(p, 'Three equations: start at the bottom', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = S.sys = three(p, U_, { t0: m('eq') - .3 });
+ const V = sys.space;
+ V.sway(5, 13);
+ sys.focus(2, m('row'));
+ termBox(p, 2, 2, m('row') + .8, m('div') + 3);
+ say(p, ['5z = −10'], 90, 450, m('div'), { size: 40, fill: YELLOW });
+ say(p, ['z = −10 ÷ 5 = −2'], 330, 450, m('div') + 2.6, { size: 40, fill: COL.task });
+ V.turn({ yaw: VIEW.yaw + 15, pitch: 34 }, m('floor'), 2.5);
+ text(p, 'every point on the yellow plane has z = −2', 90, 790, m('floor') + 1, { size: 26, fill: YELLOW, weight: 600 });
+ }],
+
+ ['middle', 'The middle row', (m) => {
+ const sys = S.sys, p = S.p, V = sys.space;
+ V.sway(5, 13);
+ const w = G(p, {});
+ sys.focus([1, 2], m('eq'));
+ termBox(p, 1, 1, m('eq') + .5, m('div') + 3);
+ say(w, ['2y − 2·(−2) = 6'], 90, 520, m('put') + 1.4, { size: 38 });
+ say(w, ['2y + 4 = 6'], 90, 580, m('sign') + 2.4, { size: 38 });
+ say(w, ['2y = 2'], 90, 640, m('sub4'), { size: 38 });
+ say(w, ['y = 1'], 330, 640, m('div') + 1.4, { size: 38, fill: COL.task });
+ lineOf23(sys, m('line') + .4, 2); lineOf23(sys, m('line') + 3, 2);
+ V.turn({ yaw: VIEW.yaw - 10, pitch: 28 }, m('line'), 3);
+ S.w = w;
+ }],
+
+ ['top', 'The top row', (m) => {
+ const sys = S.sys, p = S.p, V = sys.space;
+ V.sway(5, 13);
+ sys.focus(null, m('eq'));
+ termBox(p, 0, 0, m('eq') + .5, m('pt'));
+ say(p, ['x + 2·1 + (−2) = 2'], 90, 720, m('put') + 1.6, { size: 38 });
+ say(p, ['x = 2'], 470, 720, m('x'), { size: 38, fill: COL.task });
+ show(sys.meet.e, m('pt'), .4); pulse(sys.meet.e, m('pt') + .4); pulse(sys.meet.e, m('pt') + 1.6);
+ V.turn({ yaw: VIEW.yaw + 20 }, m('pt'), 4);
+ const a = chip(p, ['(2, 1, −2)'], COL.task, { x: 640, y: 628, size: 34 });
+ put(a, { o: 0, s: .6 }); tw(a, { o: 1, s: 1 }, m('ans'), .5, back);
+ }],
+
+ ['why', 'Why it is easy', (m) => {
+ const p = panel(0);
+ text(p, 'One new unknown in each row', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = three(p, U_, { meet: true });
+ sys.space.sway(5, 13);
+ const sh = path(p, 'M120 140L640 140L640 345Z', { fill: COL.task, 'fill-opacity': .1, stroke: COL.task, 'stroke-width': 2 }, { o: 0 });
+ show(sh, m('look'), .5); hide(sh, m('r3') + .5, .4);
+ termBox(p, 2, 2, m('r3'));
+ termBox(p, 1, 1, m('r2')); termBox(p, 1, 2, m('r2') + 1.2, null, COL.dim);
+ termBox(p, 0, 0, m('r1')); termBox(p, 0, 1, m('r1') + 1.2, null, COL.dim); termBox(p, 0, 2, m('r1') + 1.2, null, COL.dim);
+ text(p, 'amber: the new unknown grey: already known', 90, 420, m('r1') + 2.2, { size: 26, fill: COL.dim, weight: 600 });
+ say(p, ['new unknown = (what is left) ÷ (pivot)'], 90, 490, m('new'), { size: 34, fill: COL.task });
+ say(p, ['pivot 0: ÷ 0 ✗'], 90, 560, m('zero'), { size: 34, fill: COL.bad });
+ say(p, ['3x + 8y + z = 12'], 90, 660, m('orig'), { size: 40, fill: CORAL });
+ text(p, 'three unknowns at once, none known', 90, 720, m('orig') + 2.5, { size: 28, fill: COL.dim, weight: 600 });
+ const ob = mk('rect', { x: 80, y: 618, width: mathW(['3x + 8y + z'], 40) + 20, height: 58, rx: 10, fill: 'none', stroke: COL.bad, 'stroke-width': 3 }, p);
+ put(ob, { o: 0 }); show(ob, m('orig') + 4, .3); pulse(ob, m('orig') + 5, 1.08);
+ }],
+
+ ['q1', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = three(p, { A: [[1, 1, 1], [0, 2, 1], [0, 0, 3]], b: [6, 7, 9] });
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-back', prompt: ['Bottom row first.'],
+ build: blanks([
+ { parts: ['3z = 9: z = ', { box: '3' }], why: 'z = 9 ÷ 3 = 3.', hint: 'Divide by the pivot, 3.', fx: () => fxp(q => S.sys.planes[2].width(3 + 5 * Math.sin(Math.PI * q)), 0, 1.6, lin) },
+ { parts: ['2y + z = 7: y = ', { box: '2' }], why: '2y + 3 = 7, 2y = 4, y = 2.', hint: 'Put z = 3 in: 2y + 3 = 7.',
+ fx: () => { fxp(q => S.sys.lines[2].e.setAttribute('stroke-width', 2.5 + 6 * Math.sin(Math.PI * q)), 0, 1.6, lin); } },
+ { parts: ['x + y + z = 6: x = ', { box: '1' }], why: 'x + 2 + 3 = 6, x = 1. The planes meet at (1, 2, 3).', hint: 'Put y = 2 and z = 3 in: x + 5 = 6.', fx: () => fx(S.sys.meet.e, { o: 1 }, 0, .4) },
+ ]),
+ }], done) }],
+
+ ['check', 'Check the originals', (m) => {
+ const p = panel(0);
+ text(p, 'Check in the original equations', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = three(p, LEC, { meet: true, t0: m('orig') - .3 });
+ sys.space.sway(5, 13);
+ text(p, 'not in the triangle', 90, 420, m('orig') + 2, { size: 30, fill: COL.task, weight: 600 });
+ text(p, 'a slip in elimination gives a wrong triangle', 90, 470, m('why') + 2, { size: 26, fill: COL.dim, weight: 600 });
+ const rows = [['2 + 2 − 2 = 2', 'c1'], ['6 + 8 − 2 = 12', 'c2'], ['4 − 2 = 2', 'c3']];
+ rows.forEach(([s, k], i) => { sys.focus(i, m(k)); say(p, [`row ${i + 1}: ${s}`], 90, 560 + 64 * i, m(k) + .4, { size: 36, fill: S3_ROW[i] }); okMark(p, 440, 560 + 64 * i, m(k) + 2.4); });
+ sys.focus(null, m('ok'));
+ pulse(sys.meet.e, m('ok') + .3); pulse(sys.meet.e, m('ok') + 1.4);
+ sys.space.turn({ yaw: VIEW.yaw + 25 }, m('c1'), 10);
+ }],
+
+ ['ex2', 'Our own system', (m) => {
+ const p = panel(0);
+ text(p, 'Our own system from chapter 18', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = three(p, { A: [[2, 1, 1], [0, -1, 1], [0, 0, 5]], b: [3, -3, -5] }, { t0: m('eq') - .3, view: { yaw: -15, pitch: 26 } });
+ sys.space.sway(5, 13);
+ sys.focus(0, m('eq') + 1); sys.focus(1, m('eq') + 4); sys.focus(2, m('eq') + 7);
+ sys.focus(2, m('z'));
+ say(p, ['5z = −5, z = −1'], 90, 430, m('z') + .4, { size: 36, fill: COL.task });
+ sys.focus([1, 2], m('y'));
+ say(p, ['−y − 1 = −3, −y = −2'], 90, 490, m('y') + .4, { size: 36 });
+ say(p, ['y = 2'], 520, 490, m('y2'), { size: 36, fill: COL.task });
+ lineOf23(sys, m('y2') + .4);
+ sys.focus(null, m('x'));
+ say(p, ['2x + 2 − 1 = 3, 2x = 2'], 90, 550, m('x') + .4, { size: 36 });
+ say(p, ['x = 1'], 520, 550, m('x2'), { size: 36, fill: COL.task });
+ show(sys.meet.e, m('x2') + .4, .4);
+ text(p, 'check in the original equations:', 90, 620, m('chk'), { size: 26, fill: COL.dim, weight: 600 });
+ [['2x + y + z = 3: 2 + 2 − 1 = 3', 'c1'], ['4x + y + 3z = 3: 4 + 2 − 3 = 3', 'c2'], ['−2x + 2y + z = 1: −2 + 4 − 1 = 1', 'c3']].forEach(([s, k], i) => {
+ say(p, [s], 90, 670 + 50 * i, m(k), { size: 30, fill: S3_ROW[i] }); okMark(p, 620, 670 + 50 * i, m(k) + 2, 28);
+ });
+ pulse(sys.meet.e, m('ok') + .3);
+ sys.space.turn({ yaw: 25 }, m('y'), 12);
+ }],
+
+ ['frac', 'A fraction', (m) => {
+ const p = panel(0);
+ text(p, 'Fractions change nothing', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = three(p, { A: [[1, 1, 2], [0, 2, 4], [0, 0, 4]], b: [4, 4, 2] }, { t0: m('eq') - .3 });
+ sys.meet.label('(2, 1, ½)');
+ sys.space.sway(5, 13);
+ sys.focus(0, m('eq') + .8); sys.focus(1, m('eq') + 3); sys.focus(2, m('eq') + 5.4);
+ sys.focus(2, m('z'));
+ say(p, ['4z = 2, z = ', F(1, 2)], 90, 440, m('z') + .4, { size: 38, fill: COL.task });
+ sys.focus([1, 2], m('y'));
+ say(p, ['2y + 4·', F(1, 2), ' = 4, 2y + 2 = 4'], 90, 520, m('y') + .6, { size: 38 });
+ say(p, ['2y = 2, y = 1'], 90, 600, m('y2'), { size: 38, fill: COL.task });
+ sys.focus(null, m('x'));
+ say(p, ['x + 1 + 2·', F(1, 2), ' = 4, x + 2 = 4'], 90, 680, m('x') + .6, { size: 38 });
+ say(p, ['x = 2'], 90, 760, m('x2'), { size: 38, fill: COL.task });
+ show(sys.meet.e, m('pt'), .4); pulse(sys.meet.e, m('pt') + .4);
+ sys.space.turn({ yaw: VIEW.yaw + 30 }, m('z'), 14);
+ }],
+
+ ['q2', 'Your turn', () => {
+ const p = panel(0);
+ text(p, 'Your turn', 60, 110, .2, { size: 40, weight: 600 });
+ const sys = S.sys = three(p, U_, { meet: true });
+ S.ring = ring3(sys.space, [0, 2, 1], '(0, 2, 1)');
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-aim', prompt: ['Change only the right sides so the planes meet on the ring ', $m('(0, 2, 1)'), '.'],
+ build: lin3Task(S.sys, (v, s) => at3(s, [0, 2, 1]), 'Right sides 5, 2, 5: z = 1 gives 5z = 5; y = 2, z = 1 give 2·2 − 2·1 = 2; then 0 + 4 + 1 = 5.',
+ 'Bottom row first: with z = 1, 5z is 5. Then 2y − 2z with y = 2, z = 1. Then x + 2y + z with all three.',
+ () => S.sys.set({ b0: 5, b1: 2, b2: 5 }), ['b0', 'b1', 'b2']),
+ }], done) }],
+
+ ['q3', 'Quick check', () => {
+ const p = panel(0);
+ text(p, 'Quick check', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = three(p, { A: [[1, -1, 1], [0, 3, 2], [0, 0, 1]], b: [1, 1, 2] });
+ }, { ask: done => quiz(CARD, [{
+ id: 'c-sign', prompt: ['z = 2. Then row 2, ', $m('3y + 2z = 1'), ', gives:'],
+ build: choice([[$m('y = −1')], [$m('y = 5/3')], [$m('y = −3')], [$m('y = 1')]], 0, '3y + 4 = 1, so 3y = −3 and y = −1.',
+ [null, 'That adds 4 to the right side. Take it away: 3y = 1 − 4.', '3y = −3: now divide by the pivot, 3.', 'Check the sign: 1 − 4 is −3, not 3.'],
+ () => fx(S.sys.meet.e, { o: 1 }, 0, .4)),
+ }], done) }],
+
+ ['wrap', 'Summary', (m) => {
+ const p = panel(0);
+ [['Back substitution: solve the bottom row first, then go up.', 'w1'], ['Each row has one new unknown: put in what you know, divide by the pivot.', 'w2'],
+ ['Picture: the bottom row is a flat plane, the next cuts it in a line, the top picks the point.', 'w3'], ['Check the answer in the original equations.', '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.task }, g);
+ T(g, String(i + 1), { x: 120, y: -1, size: 30, fill: COL.board, weight: 700, anchor: 'middle' });
+ T(g, str, { x: 170, size: 33, weight: 600 });
+ tw(g, { o: 1, x: 0 }, m(mark), .6);
+ });
+ }],
+ ['final1', 'Chapter practice', () => { panel(0); }, { ask: done => quiz(SCREEN, [{
+ id: 'p-two', prompt: ['Bottom row first: y, then x.'],
+ build: blanks(TWOQ),
+ }], done, 'Chapter practice · set 1 of 4') }],
+ ['final2', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-tri', prompt: ['Solve each triangle from the bottom up: z, then y, then x.'],
+ build: blanks(TRIQ),
+ }], done, 'Chapter practice · set 2 of 4') }],
+ ['final3', 'Chapter practice', () => {}, { ask: done => quiz(SCREEN, [{
+ id: 'p-full', prompt: ['Eliminate to a triangle, substitute back, and check in the original equations.'],
+ build: blanks(FULLQ),
+ }], done, 'Chapter practice · set 3 of 4') }],
+ ['final4', 'Chapter practice', () => {
+ const p = panel(0);
+ text(p, 'Aim the planes', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = three(p, AIMS[0], { meet: true });
+ }, { ask: done => quiz(CARD, AIMS.map((h, k) => ({
+ id: `p-aim${k + 1}`, prompt: ['Change only the right sides so the planes meet on the ring ', $m(tri(h.q)), '.'],
+ build: aimTask(h),
+ })), done, 'Chapter practice · set 4 of 4') }],
+ ['play', 'Playground', (m) => {
+ const p = panel(0);
+ text(p, 'Playground', 60, 110, .2, { size: 40, weight: 600 });
+ S.sys = three(p, U_, { meet: true });
+ const hint = text(p, 'try: move the bottom right side and watch the floor; then row 2', 90, 400, m('go'), { size: 24, fill: COL.dim });
+ hide(hint, m('go') + 8, .6);
+ }, { ask: playAsk(() => S.sys, { pos: { x: 40, y: 440, w: 720, cls: 'side' }, tip: 'Your triangle. Change any number, drag a plane by its edge, turn the space, or draw on the board. Nothing is marked.' }) }],
+ ['finish', 'Finished', () => { panel(0); }, { ask: finishCard }],
+].map(([id, title, run, extra]) => ({ id, title, run, ...extra }));
+
+boot();
+</script>
+</body>
+</html>
diff --git a/site/linear-algebra/lib/elim.js b/site/linear-algebra/lib/elim.js
new file mode 100644
index 0000000..23f836d
--- /dev/null
+++ b/site/linear-algebra/lib/elim.js
@@ -0,0 +1,337 @@
+// Elimination on the augmented matrix [A | b] of a linsys (2 × 2) or lin3 (3 × 3) system, linked to its picture.
+// The matrix is drawn from the system's own numbers, so every entry changes in place while the system moves; a row
+// operation "row 2 − 3 × row 1" is a label beside the row it changes, with its multiplier boxed, and the step itself is
+// a continuous change: row 2 → row 2 − q·ℓ·row 1, q from 0 to 1. Every stage of that change is still true of the
+// solution, so the line (or plane) of row 2 turns about the meeting point, which never moves.
+//
+// const el = elim(p, sys, { at: [x, y] }); // sys: linsys(…) or lin3(…); rows at y, y + rh, …
+// el.op(1, 0, 3, at) // the label "row 2 − 3 × row 1" beside row 2 (rows count from 0)
+// el.step(1, 0, 3, at, dur) // the label and the step: row 2 − 3 × row 1, on the beat clock
+// el.mult(2, at, dur) // the open operation with another multiplier (its label counts)
+// el.ring(0, 0, at) // a circle round an entry: the pivot
+// el.opNow(2, 1) // inside a question: open "row 3 − ℓ × row 2" at once
+//
+// While elim is attached, move the system through el.to(next, at, dur) (or el.step, el.mult): elim keeps the plan
+// that the next step starts from. Hands on: el.scrub(true) makes the open operation's multiplier a number to drag
+// sideways (or Tab to it and press ↑/↓); el.v, el.set and el.live make it a component for playAsk; elTask is the
+// question type ("find the multiplier that makes it flat").
+// Loads after engine.js (and linsys.js or space3.js).
+const EL_ROW = [COL.whole, COL.nat, COL.int];
+
+function elim(p, sys, { at: [x0, y0] = [130, 450], size = 46, cw = 96, rh = 70, t0 = .1, dens = [1], step: lStep = 1, o = 0, labelX = null } = {}) {
+ const n = 'a22' in sys.v ? 3 : 2, I = [...Array(n).keys()], svg = $('stage');
+ const keysOf = i => [...I.map(j => `a${i}${j}`), `b${i}`];
+ const g = G(p, { o });
+ show(g, t0 + .2);
+ const W = n * cw + 24 + cw; // A, the divider, b
+ const cx = j => j < n ? x0 + cw * (j + .5) : x0 + n * cw + 24 + cw / 2;
+ const ry = i => y0 + i * rh;
+ let plan = { ...sys.v };
+
+ // exact where the number is: whole, or a fraction whose denominator is in dens; one decimal while it moves
+ const parts = (v, paren = false) => {
+ const r = Math.round(v);
+ if (Math.abs(v - r) < 1e-9) return [(paren && r < 0) ? `(−${-r})` : num(r)];
+ for (const d of dens) {
+ const k = Math.round(v * d);
+ if (d > 1 && Math.abs(v * d - k) < 1e-9) {
+ const gg = gcd(Math.abs(k), d), nn = Math.abs(k) / gg, dd = d / gg;
+ return k < 0 ? (paren ? ['(−', F(nn, dd), ')'] : ['−', F(nn, dd)]) : [F(nn, dd)];
+ }
+ }
+ const s = num(Math.round(v * 10) / 10);
+ return [paren && v < 0 ? `(${s})` : s];
+ };
+ const key = ps => ps.map(q => typeof q === 'string' ? q : q.f.join('/')).join('');
+
+ /* ---------- the matrix ---------- */
+ const top = y0 - size * .95, bot = y0 + (n - 1) * rh + size * .35;
+ path(g, `M${x0 - 2} ${top}H${x0 - 16}V${bot}H${x0 - 2}M${x0 + W + 2} ${top}H${x0 + W + 16}V${bot}H${x0 + W + 2}`, { stroke: COL.chalk, 'stroke-width': 3, fill: 'none' });
+ const divider = path(g, `M${x0 + n * cw + 12} ${top + 6}V${bot - 6}`, { stroke: COL.dim, 'stroke-width': 2.5, 'stroke-dasharray': '6 6', fill: 'none' });
+ const rowG = I.map(i => G(g, {}));
+ const bars = I.map(i => mk('rect', { x: x0 - 52, y: ry(i) - size * .7, width: 8, height: size * .8, rx: 4, fill: EL_ROW[i] }, rowG[i]));
+ const cells = I.map(i => keysOf(i).map((k, j) => {
+ const c = G(rowG[i], { x: cx(j), y: ry(i) });
+ const glow = mk('rect', { x: -cw / 2 + 6, y: -size * .9, width: cw - 12, height: size * 1.2, rx: 12, fill: COL.task }, c);
+ put(glow, { o: 0 });
+ const holder = G(c, {});
+ holder.style.pointerEvents = 'none'; // the box under the number takes the drag
+ const box = mk('rect', { x: -cw / 2 + 4, y: -size * .92, width: cw - 8, height: size * 1.24, rx: 10, fill: 'transparent', 'stroke-dasharray': '4 6' }, c);
+ box.setAttribute('aria-label', k);
+ return { k, c, glow, holder, box, txt: null, fill: j === n ? COL.task : COL.chalk };
+ }));
+ const names = G(g, {}); // "A" over the numbers in front of the letters, "b" over the right sides
+ T(names, 'A', { x: x0 + n * cw / 2, y: top - 16, size: 28, fill: COL.dim, font: MATH, weight: 700, anchor: 'middle' });
+ T(names, 'b', { x: cx(n), y: top - 16, size: 28, fill: COL.dim, font: MATH, weight: 700, anchor: 'middle' });
+ put(names, { o: 0 });
+
+ function draw() {
+ const v = sys.v;
+ cells.forEach(row => row.forEach(cl => {
+ const ps = parts(v[cl.k]), s = key(ps);
+ if (s === cl.txt) return;
+ cl.txt = s;
+ cl.holder.replaceChildren();
+ M(cl.holder, ps, { size, fill: cl.fill, anchor: 'middle' });
+ }));
+ }
+
+ /* ---------- the row operation: label, multiplier, the step ---------- */
+ let cur = null; // the open operation: { i, j, base (row i before it), l (planned), shown, lab }
+ const fs = 34;
+ function label(i, j, at, place) {
+ const [lx, ly] = place || [labelX ?? x0 + W + 60, ry(i) - 4];
+ const lg = G(g, { x: lx, y: ly, o: 0 });
+ const t1 = T(lg, `row ${i + 1}`, { size: fs, fill: EL_ROW[i], weight: 600 });
+ const t2 = T(lg, '−', { size: fs, fill: COL.chalk, weight: 600 });
+ const mg = G(lg, {}), mbox = mk('rect', { rx: 10, fill: 'none', stroke: COL.chalk, 'stroke-width': 2.5 }, mg), mh = G(mg, {});
+ const t3 = T(lg, '×', { size: fs, fill: COL.chalk, weight: 600 });
+ const t4 = T(lg, `row ${j + 1}`, { size: fs, fill: EL_ROW[j], weight: 600 });
+ const hit = mk('rect', { rx: 10, fill: 'transparent' }, lg);
+ [t1, t2, t3, t4].forEach(t => { t.style.pointerEvents = 'none'; });
+ mg.style.pointerEvents = 'none';
+ let shownKey = null;
+ const lay = l => { // the multiplier as math, boxed; the words after it move along when it grows
+ const ps = parts(l, true), s = key(ps);
+ if (s === shownKey) return;
+ shownKey = s;
+ mh.replaceChildren();
+ const m = M(mh, ps, { size: fs + 2, fill: COL.chalk, anchor: 'start' });
+ const w1 = t1.getComputedTextLength() || 80, w2 = t2.getComputedTextLength() || 14, mw = m._w || 20, frac = ps.some(q => q.f);
+ put(t2, { x: w1 + 14 });
+ const mx = w1 + 14 + w2 + 16;
+ put(mg, { x: mx });
+ const hgt = frac ? fs * 1.75 : fs * 1.3, ytop = frac ? -fs * 1.12 : -fs * .98;
+ for (const [a, b] of Object.entries({ x: -9, y: ytop, width: mw + 18, height: hgt })) mbox.setAttribute(a, b);
+ for (const [a, b] of Object.entries({ x: mx - 14, y: ytop - 6, width: mw + 28, height: hgt + 12 })) hit.setAttribute(a, b);
+ put(t3, { x: mx + mw + 22 });
+ put(t4, { x: mx + mw + 22 + (t3.getComputedTextLength() || 18) + 14 });
+ };
+ lay(0);
+ if (at === null) put(lg, { o: 1 }); else show(lg, at, .5); // null: at once (a question's build)
+ return { g: lg, i, j, lay, mbox, hit, words: [t1, t2, t3, t4], mult: mg };
+ }
+ const rowOf = (s, i) => Object.fromEntries(keysOf(i).map(k => [k, s[k]]));
+ const minus = (base, i, j, l, s) => Object.fromEntries(keysOf(i).map((k, c) => [k, base[k] - l * s[keysOf(j)[c]]]));
+
+ // Open the operation "row i − l × row j" (shown at `at`); the rows do not change until step or mult.
+ // place: [x, y] puts the label elsewhere than beside row i (under a small matrix, say).
+ function op(i, j, l, at, { shown = l, place = null } = {}) {
+ if (cur?.lab && cur.lab.g.parentNode) hide(cur.lab.g, at, .3);
+ const lab = label(i, j, at, place);
+ cur = { i, j, base: rowOf(plan, i), l: 0, shown, lab };
+ prog(() => lab.lay(shown), at, 0, lin);
+ return lab;
+ }
+ // Open "row i − ℓ × row j" at once, from the system as it is now (inside a question: several steps in turn).
+ function opNow(i, j) {
+ if (cur?.lab) put(cur.lab.g, { o: 0 });
+ const lab = label(i, j, null);
+ plan = { ...sys.v };
+ cur = { i, j, base: rowOf(plan, i), l: 0, shown: 0, lab };
+ lNow = 0;
+ return lab;
+ }
+ // Row i of the open operation becomes base − l × row j, over dur seconds; with count the boxed multiplier runs
+ // from the last value shown to l along with it.
+ function mult(l, at, dur = 1.6, { count = true, ease = io } = {}) {
+ const c = cur, next = minus(c.base, c.i, c.j, l, plan), from = c.shown;
+ plan = { ...plan, ...next };
+ sys.to(next, at, dur, ease);
+ if (count && from !== l) prog(q => c.lab.lay(Math.abs(q - 1) < 1e-9 ? l : from + (l - from) * q), at, dur, ease);
+ else prog(() => c.lab.lay(l), at, 0, lin);
+ c.l = c.shown = l;
+ return at + dur;
+ }
+ // The whole step: label at `at`, the change from at + lead.
+ function step(i, j, l, at, dur = 1.8, { lead = .8, count = false, place = null } = {}) {
+ op(i, j, l, at, { shown: count ? 0 : l, place });
+ return mult(l, at + lead, dur, { count });
+ }
+
+ /* ---------- marks on the matrix ---------- */
+ // A circle round entry (i, j) (j = n is the right side): the pivot, solid; { dash: true } for the number to remove.
+ function ring(i, j, at, { color = COL.chalk, dash = false, label: words = '', below = true } = {}) {
+ const rg = G(g, { x: cx(j), y: ry(i) - size * .32, o: 0 });
+ mk('ellipse', { rx: cw * .44, ry: size * .62, fill: 'none', stroke: color, 'stroke-width': 3.5, ...(dash ? { 'stroke-dasharray': '7 6' } : {}) }, rg);
+ if (words) T(rg, words, { x: 0, y: below ? size * 1.15 : -size * .8, size: 22, fill: color, weight: 700, anchor: 'middle' });
+ show(rg, at, .35);
+ return rg;
+ }
+ // A row of numbers in the matrix's columns at row position r (r = n, n + 1, … are under the matrix), with a label
+ // after it: a line of working such as "3 × row 1".
+ function line(vals, r, at, { label: words = '', color = COL.dim, fill = COL.chalk, sign = '' } = {}) {
+ const lg = G(g, { o: 0 }), y = y0 + r * rh;
+ vals.forEach((v, j) => { if (v !== null) M(lg, parts(v), { x: cx(j), y, size: size * .9, fill: j === n ? COL.task : fill, anchor: 'middle' }); }); // null: an empty place
+ if (sign) M(lg, [sign], { x: x0 - 30, y, size: size * .9, fill, anchor: 'middle' });
+ if (Array.isArray(words)) M(lg, words, { x: labelX ?? x0 + W + 60, y: y - 4, size: 30, fill: color, anchor: 'start' }); // math parts: F(3, 2), …
+ else if (words) T(lg, words, { x: labelX ?? x0 + W + 60, y: y - 4, size: 30, fill: color, weight: 600 });
+ show(lg, at, .4);
+ return lg;
+ }
+ // A rule under row r (for working written as a sum), across the matrix.
+ function rule(r, at) {
+ const e = path(g, `M${x0 - 40} ${y0 + r * rh + size * .45}H${x0 + W}`, { stroke: COL.chalk, 'stroke-width': 2.5 }, { d: 0 });
+ draw_(e, at, .5);
+ return e;
+ }
+ const draw_ = (e, at, dur) => tw(e, { d: 1 }, at, dur);
+ // Light the entries of row i (one entry with j) for a moment.
+ function flash(i, at, j = null) {
+ cells[i].forEach((cl, c) => { if (j === null || j === c) { tw(cl.glow, { o: .32 }, at, .25); tw(cl.glow, { o: 0 }, at + 1.1, .6); } });
+ }
+ // Bring some rows forward (an index, a list, or null for all) and dim the rest.
+ function focus(which, at, dur = .5) {
+ const on = which === null ? I : [].concat(which);
+ I.forEach(i => tw(rowG[i], { o: on.includes(i) ? 1 : .3 }, at, dur));
+ }
+ // Move the system (the picture and the matrix) and keep the plan.
+ function to(next, at, dur = 1.2, ease = io) {
+ plan = { ...plan, ...next };
+ sys.to(next, at, dur, ease);
+ if (cur) keysOf(cur.i).forEach(k => { if (k in next) cur.base[k] = next[k]; });
+ }
+ // At once, outside the beat clock (a question that sets up a new system): the system takes the numbers, and the open
+ // operation starts again from multiplier 0 on the new rows.
+ function load(next) {
+ sys.set(next);
+ plan = { ...sys.v };
+ if (!cur) return;
+ cur.base = rowOf(plan, cur.i); cur.l = cur.shown = 0; lNow = 0;
+ if (scrubOn) base = { ...cur.base };
+ cur.lab.lay(0);
+ }
+
+ /* ---------- hands on: the multiplier as a number to drag ---------- */
+ let live = false, scrubOn = false, lNow = 0, bound = false;
+ const RANGE = 9;
+ // The reader's state: the system's numbers and the multiplier. Row i of the open operation is always
+ // base − l × row j; base follows whatever the reader changes in the system itself.
+ let base = null, quiet = false;
+ const apply = () => { quiet = true; sys.set(minus(base, cur.i, cur.j, lNow, sys.v)); quiet = false; cur.lab.lay(lNow); };
+ const bind = () => {
+ if (bound || !cur) return;
+ bound = true;
+ sys.onChange(v => { if (!quiet && cur && scrubOn) base = Object.fromEntries(keysOf(cur.i).map((k, c) => [k, v[k] + lNow * v[keysOf(cur.j)[c]]])); });
+ };
+ const setL = l => { lNow = Math.max(-RANGE, Math.min(RANGE, Math.round(l / lStep) * lStep)); if (base) apply(); };
+ function scrub(on) {
+ if (!cur) return;
+ scrubOn = on;
+ if (on) {
+ bind();
+ lNow = cur.l;
+ base = Object.fromEntries(keysOf(cur.i).map((k, c) => [k, sys.v[k] + lNow * sys.v[keysOf(cur.j)[c]]]));
+ }
+ const h = cur.lab.hit;
+ h.style.cursor = on ? 'ew-resize' : '';
+ cur.lab.mbox.setAttribute('stroke-dasharray', on ? '5 5' : '');
+ cur.lab.mbox.setAttribute('stroke', on ? COL.task : COL.chalk);
+ if (on) h.setAttribute('tabindex', 0); else h.removeAttribute('tabindex');
+ h.setAttribute('aria-label', 'multiplier');
+ if (h._wired) return;
+ h._wired = true;
+ let drag = null;
+ h.addEventListener('pointerdown', e => {
+ if (!scrubOn) return;
+ e.preventDefault();
+ drag = { x: e.clientX, from: lNow };
+ h.setPointerCapture(e.pointerId);
+ });
+ h.addEventListener('pointermove', e => {
+ if (!drag) return;
+ const k = svg.getScreenCTM().a;
+ setL(drag.from + Math.round((e.clientX - drag.x) / k / 26) * lStep);
+ });
+ const end = () => { drag = null; };
+ h.addEventListener('pointerup', end);
+ h.addEventListener('lostpointercapture', end);
+ h.addEventListener('keydown', e => {
+ if (!scrubOn) return;
+ if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); h.blur(); P.keys?.(e); return; }
+ const d = { ArrowUp: 1, ArrowRight: 1, ArrowDown: -1, ArrowLeft: -1 }[e.key];
+ if (!d) return;
+ e.preventDefault(); e.stopPropagation();
+ setL(lNow + d * lStep);
+ });
+ }
+
+ // Every entry can be scrubbed while the matrix is live (only the keys allowed): whole steps, as in linsys.
+ let allowed = null;
+ const canCell = k => live && (!allowed || allowed.has(k));
+ cells.flat().forEach(cl => {
+ let drag = null;
+ cl.box.addEventListener('pointerdown', e => {
+ if (!canCell(cl.k)) return;
+ e.preventDefault();
+ drag = { x: e.clientX, from: Math.round(sys.v[cl.k]) };
+ cl.box.setPointerCapture(e.pointerId);
+ });
+ cl.box.addEventListener('pointermove', e => {
+ if (!drag) return;
+ const k = svg.getScreenCTM().a, R = cl.k[0] === 'b' ? 30 : 9;
+ sys.set({ [cl.k]: Math.max(-R, Math.min(R, drag.from + Math.round((e.clientX - drag.x) / k / 22))) });
+ });
+ const end = () => { drag = null; };
+ cl.box.addEventListener('pointerup', end);
+ cl.box.addEventListener('lostpointercapture', end);
+ cl.box.addEventListener('keydown', e => {
+ if (!canCell(cl.k)) return;
+ if (e.key === 'Enter') { e.preventDefault(); e.stopPropagation(); cl.box.blur(); P.keys?.(e); return; }
+ const d = { ArrowUp: 1, ArrowRight: 1, ArrowDown: -1, ArrowLeft: -1 }[e.key];
+ if (!d) return;
+ e.preventDefault(); e.stopPropagation();
+ const R = cl.k[0] === 'b' ? 30 : 9;
+ sys.set({ [cl.k]: Math.max(-R, Math.min(R, Math.round(sys.v[cl.k]) + d)) });
+ });
+ });
+ const cellsLive = () => cells.flat().forEach(cl => {
+ const ok = canCell(cl.k);
+ cl.box.style.cursor = ok ? 'ew-resize' : '';
+ cl.box.setAttribute('stroke', ok ? COL.faint : 'none');
+ if (ok) cl.box.setAttribute('tabindex', 0); else cl.box.removeAttribute('tabindex');
+ });
+
+ draw();
+ sys.onChange(draw);
+ return {
+ g, n, cells, rowG, bars, names, divider, W, cx, ry, size, rh,
+ get plan() { return plan; },
+ get l() { return lNow; },
+ get op_() { return cur; },
+ op, opNow, mult, step, ring, line, rule, flash, focus, to, load,
+ scrub,
+ // playAsk and elTask: the system's numbers plus the multiplier l
+ get v() { return { ...sys.v, l: lNow }; },
+ set(vals) {
+ const { l, ...rest } = vals, has = Object.keys(rest).length > 0;
+ if (l === undefined || !cur || !scrubOn) { if (has) sys.set(rest); return; }
+ if (!has) { setL(l); return; } // the multiplier alone: row i follows it
+ lNow = l; // the whole state (a reset): the numbers as given, and base read back from them
+ sys.set(rest);
+ base = Object.fromEntries(keysOf(cur.i).map((k, c) => [k, sys.v[k] + lNow * sys.v[keysOf(cur.j)[c]]]));
+ cur.lab.lay(lNow);
+ },
+ setL,
+ // only: the system's numbers the reader may change besides the multiplier ([] for none; null for all)
+ live(on, { only = null } = {}) {
+ live = on;
+ allowed = on && only ? new Set(only) : null;
+ cellsLive();
+ if (sys.lock) { sys.lock(only); sys.live(on); } else sys.live(on, only ? { only } : {});
+ scrub(on);
+ },
+ solve: () => sys.solve(),
+ };
+}
+
+// A question on the multiplier: the reader scrubs it (and, with only, some of the system's numbers) until test holds.
+const elTask = (el, test, why, hint, reveal, { only = [] } = {}) => (body, api) => {
+ el.live(true, { only });
+ return {
+ check: () => { const v = el.v, ok = test(v, el.l); api.grade(ok, ok ? why : typeof hint === 'function' ? hint(v, el.l) : hint); },
+ reveal: () => { reveal?.(); return why; },
+ lock: () => el.live(false),
+ hint: ['drag the boxed number sideways, or ', kbd('Tab'), ' to it and ', kbd('↑'), kbd('↓')],
+ };
+};