Skip to content

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

feat(math): add ratios chapter

yzr4983b0063b5c
diff --git a/site/index.html b/site/index.html
index 1caf6df..4c030c7 100644
--- a/site/index.html
+++ b/site/index.html
@@ -23,8 +23,8 @@
<a class="book-hotspot algebra-book" data-book="elementary-algebra" href="elementary-algebra/" aria-label="Open Elementary Algebra, 68 narrated chapters">
<span class="book-caption"><strong>Elementary Algebra <span aria-hidden="true">↗</span></strong><small>68 narrated chapters</small></span>
</a>
- <a class="book-hotspot math-book" data-book="math-notebook" href="math-notebook/" aria-label="Open Elementary Mathematics, 14 narrated chapters">
- <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>14 narrated chapters</small></span>
+ <a class="book-hotspot math-book" data-book="math-notebook" href="math-notebook/" aria-label="Open Elementary Mathematics, 15 narrated chapters">
+ <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>15 narrated chapters</small></span>
</a>
<span class="physics-pending">Physics · Coming soon</span>
</section>
diff --git a/site/lib/bookshelf.js b/site/lib/bookshelf.js
index 53e4b45..18ff2fd 100644
--- a/site/lib/bookshelf.js
+++ b/site/lib/bookshelf.js
@@ -17,7 +17,7 @@
const books = [
{ id: 'elementary-algebra', key: 'progress', chapterBase: 'elementary-algebra/', chapters: 68 },
{ id: 'math-notebook', key: 'animebook:progress:' + new URL('math-notebook/', location.href).pathname,
- chapterBase: 'math-notebook/', chapters: 14 },
+ chapterBase: 'math-notebook/', chapters: 15 },
];
for (const book of books) {
const cover = document.querySelector(`[data-book="${book.id}"]`);
diff --git a/site/math-notebook/ch14/index.html b/site/math-notebook/ch14/index.html
index 93dcbe1..19fa226 100644
--- a/site/math-notebook/ch14/index.html
+++ b/site/math-notebook/ch14/index.html
@@ -2,7 +2,7 @@
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Inequalities — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.screen .grid .num{font-size:34px}.screen .blanks .math{font-size:32px}.side .keys{font-size:19px}.side .grid .row{grid-template-columns:65px minmax(0,1fr) 26px;gap:8px}.side .grid .why{padding-left:0;font-size:19px}.triplets .bline{gap:12px}.triplets .box{width:7ch!important}</style></head><body>
<script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>
'use strict';
-const CHAPTER={number:14,title:'Inequalities',minutes:10,language:'en'};
+const CHAPTER={number:14,title:'Inequalities',minutes:10,language:'en', next: '../ch15/' };
const iqColor=v=>v>0?POS:v<0?NEG:COL.chalk;
const iqText=(p,s,x,y,t=0,size=30,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};
const iqMath=(p,s,x,y,t=0,size=52,col=COL.chalk,anchor='middle')=>{const e=M(p,Array.isArray(s)?s:[s],{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};
diff --git a/site/math-notebook/ch15/audio/en/compare.mp3 b/site/math-notebook/ch15/audio/en/compare.mp3
new file mode 100644
index 0000000..8e932a6
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/compare.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/final1.mp3 b/site/math-notebook/ch15/audio/en/final1.mp3
new file mode 100644
index 0000000..dd9219f
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/final1.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/final2.mp3 b/site/math-notebook/ch15/audio/en/final2.mp3
new file mode 100644
index 0000000..0fe7f1c
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/final2.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/final3.mp3 b/site/math-notebook/ch15/audio/en/final3.mp3
new file mode 100644
index 0000000..0b9e9a7
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/final3.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/finish.mp3 b/site/math-notebook/ch15/audio/en/finish.mp3
new file mode 100644
index 0000000..9a74659
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/finish.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/group.mp3 b/site/math-notebook/ch15/audio/en/group.mp3
new file mode 100644
index 0000000..c7ae8db
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/group.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/intro.mp3 b/site/math-notebook/ch15/audio/en/intro.mp3
new file mode 100644
index 0000000..385c5e0
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/intro.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/mistake.mp3 b/site/math-notebook/ch15/audio/en/mistake.mp3
new file mode 100644
index 0000000..47d6e2c
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/mistake.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/notation.mp3 b/site/math-notebook/ch15/audio/en/notation.mp3
new file mode 100644
index 0000000..f6a0510
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/notation.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/order.mp3 b/site/math-notebook/ch15/audio/en/order.mp3
new file mode 100644
index 0000000..715eb99
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/order.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/q1.mp3 b/site/math-notebook/ch15/audio/en/q1.mp3
new file mode 100644
index 0000000..210244a
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/q1.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/q2.mp3 b/site/math-notebook/ch15/audio/en/q2.mp3
new file mode 100644
index 0000000..35bfa64
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/q2.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/q3.mp3 b/site/math-notebook/ch15/audio/en/q3.mp3
new file mode 100644
index 0000000..8b456d6
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/q3.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/scale.mp3 b/site/math-notebook/ch15/audio/en/scale.mp3
new file mode 100644
index 0000000..212544a
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/scale.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/simplify.mp3 b/site/math-notebook/ch15/audio/en/simplify.mp3
new file mode 100644
index 0000000..bb55d4e
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/simplify.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/timings.js b/site/math-notebook/ch15/audio/en/timings.js
new file mode 100644
index 0000000..4088f76
--- /dev/null
+++ b/site/math-notebook/ch15/audio/en/timings.js
@@ -0,0 +1,612 @@
+window.TIMINGS = {
+ "intro": {
+ "dur": 28.08,
+ "marks": {
+ "sub": 7.253
+ },
+ "cues": [
+ [
+ 0.104,
+ "Unit two: ratios, proportions, and percents."
+ ],
+ [
+ 4.779,
+ "Chapter fifteen."
+ ],
+ [
+ 6.133,
+ "Ratios."
+ ],
+ [
+ 7.253,
+ "A ratio compares two quantities in a chosen order."
+ ],
+ [
+ 11.25,
+ "We will use one bag of beads to compare a part with another part, and a part with the whole bag."
+ ],
+ [
+ 17.122,
+ "Then we will regroup the beads to see why simplifying a ratio keeps the comparison the same."
+ ],
+ [
+ 23.542,
+ "A map will give us one more kind of comparison, with two different units."
+ ]
+ ]
+ },
+ "compare": {
+ "dur": 32.04,
+ "marks": {
+ "separate": 4.948,
+ "counts": 8.62,
+ "ratio": 13.88
+ },
+ "cues": [
+ [
+ 0.13,
+ "Here is our bag of eighteen beads."
+ ],
+ [
+ 2.904,
+ "Nothing will be added or removed."
+ ],
+ [
+ 4.948,
+ "Separate the beads by colour so we can count them clearly."
+ ],
+ [
+ 8.62,
+ "There are six blue beads, nine coral beads, and three white beads."
+ ],
+ [
+ 13.88,
+ "The ratio of blue beads to coral beads is six to nine."
+ ],
+ [
+ 18.255,
+ "The first quantity is the blue count."
+ ],
+ [
+ 20.846,
+ "The second quantity is the coral count."
+ ],
+ [
+ 23.555,
+ "The white beads stay in the bag, but they are not part of this particular comparison."
+ ],
+ [
+ 28.398,
+ "A ratio names the quantities we choose to compare."
+ ]
+ ]
+ },
+ "order": {
+ "dur": 30.096,
+ "marks": {
+ "first": 1.302,
+ "swap": 7.409,
+ "reverse": 12.93
+ },
+ "cues": [
+ [
+ 0.104,
+ "Order matters."
+ ],
+ [
+ 1.302,
+ "Blue to coral means six to nine."
+ ],
+ [
+ 3.646,
+ "The words tell us which count goes first and which goes second."
+ ],
+ [
+ 7.409,
+ "Now exchange the two labelled counts."
+ ],
+ [
+ 9.896,
+ "The beads themselves do not change colour or number."
+ ],
+ [
+ 12.93,
+ "Coral to blue is nine to six."
+ ],
+ [
+ 15.547,
+ "That answers a different question."
+ ],
+ [
+ 17.539,
+ "If you read a ratio backward, you reverse the quantities being compared."
+ ],
+ [
+ 22.279,
+ "Before writing any numbers, say the two labels in order."
+ ],
+ [
+ 26.328,
+ "That small habit prevents a surprisingly common mix-up."
+ ]
+ ]
+ },
+ "notation": {
+ "dur": 33.888,
+ "marks": {
+ "colon": 3.633,
+ "words": 8.672,
+ "fraction": 11.185,
+ "roles": 17.721
+ },
+ "cues": [
+ [
+ 0.091,
+ "We can record one comparison in three ways."
+ ],
+ [
+ 3.633,
+ "Six colon nine."
+ ],
+ [
+ 4.974,
+ "The colon separates the first and second quantities."
+ ],
+ [
+ 8.672,
+ "Six to nine, written with the word to."
+ ],
+ [
+ 11.185,
+ "Or six over nine, written in fraction form."
+ ],
+ [
+ 14.427,
+ "All three name blue beads compared with coral beads."
+ ],
+ [
+ 17.721,
+ "In fraction notation, the numerator is the first quantity and the denominator is the second quantity."
+ ],
+ [
+ 24.401,
+ "Here the denominator counts coral beads."
+ ],
+ [
+ 27.214,
+ "It does not count all the beads."
+ ],
+ [
+ 29.232,
+ "A fraction can express a ratio without being a fraction of the whole bag."
+ ]
+ ]
+ },
+ "whole": {
+ "dur": 37.224,
+ "marks": {
+ "all": 5.911,
+ "whole": 12.604,
+ "difference": 20.951
+ },
+ "cues": [
+ [
+ 0.104,
+ "Let's change the question to blue beads compared with all beads."
+ ],
+ [
+ 3.932,
+ "Keep every original bead."
+ ],
+ [
+ 5.911,
+ "The frame now includes blue, coral, and white: six plus nine plus three makes eighteen."
+ ],
+ [
+ 12.604,
+ "Blue to all is six to eighteen."
+ ],
+ [
+ 14.948,
+ "In fraction form, six over eighteen really does describe the blue part of the whole bag."
+ ],
+ [
+ 20.951,
+ "Blue to coral is six over nine; blue to all is six over eighteen."
+ ],
+ [
+ 25.859,
+ "Their numerators match, but their denominators count different things."
+ ],
+ [
+ 30.339,
+ "Always name the second quantity."
+ ],
+ [
+ 32.734,
+ "Do not automatically add the counts unless the question asks for the total."
+ ]
+ ]
+ },
+ "q1": {
+ "dur": 7.776,
+ "marks": {
+ "ask": 1.107
+ },
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.107,
+ "For the ratio of blue beads to all beads, choose the group that supplies the denominator."
+ ]
+ ]
+ },
+ "group": {
+ "dur": 36.408,
+ "marks": {
+ "trays": 5.326,
+ "each": 10.69,
+ "same": 21.107
+ },
+ "cues": [
+ [
+ 0.104,
+ "Can we describe blue to coral with smaller numbers?"
+ ],
+ [
+ 3.568,
+ "Watch the original beads."
+ ],
+ [
+ 5.326,
+ "They move into three identical trays."
+ ],
+ [
+ 8.49,
+ "All eighteen beads are still here."
+ ],
+ [
+ 10.69,
+ "Each tray contains two blue beads, three coral beads, and one white bead."
+ ],
+ [
+ 16.68,
+ "So each tray has blue to coral in the ratio two to three."
+ ],
+ [
+ 21.107,
+ "Combining three copies gives six blue and nine coral."
+ ],
+ [
+ 25.299,
+ "The full bag and one tray share the same comparison."
+ ],
+ [
+ 28.893,
+ "Simplifying does not throw away beads."
+ ],
+ [
+ 31.992,
+ "It records the smaller repeated pattern that the beads already make."
+ ]
+ ]
+ },
+ "simplify": {
+ "dur": 37.536,
+ "marks": {
+ "divide": 3.034,
+ "reduced": 13.893,
+ "lowest": 21.185
+ },
+ "cues": [
+ [
+ 0.091,
+ "Our three trays explain the arithmetic."
+ ],
+ [
+ 3.034,
+ "Divide the blue count by three, and divide the coral count by that same three."
+ ],
+ [
+ 8.594,
+ "Six divided by three is two."
+ ],
+ [
+ 11.198,
+ "Nine divided by three is three."
+ ],
+ [
+ 13.893,
+ "Six to nine becomes two to three."
+ ],
+ [
+ 16.471,
+ "The first count still refers to blue; the second still refers to coral."
+ ],
+ [
+ 21.185,
+ "Three is the greatest common factor of six and nine, so this gives lowest terms."
+ ],
+ [
+ 26.927,
+ "Two and three have no common factor greater than one."
+ ],
+ [
+ 30.299,
+ "Just as with equivalent fractions, dividing both quantities by the same common factor preserves their comparison."
+ ]
+ ]
+ },
+ "mistake": {
+ "dur": 32.976,
+ "marks": {
+ "wrong": 3.294,
+ "both": 14.518,
+ "order": 18.906
+ },
+ "cues": [
+ [
+ 0.117,
+ "Here is a tempting shortcut that fails."
+ ],
+ [
+ 3.294,
+ "Divide six by three but leave nine alone."
+ ],
+ [
+ 6.38,
+ "Two to nine is not the same comparison as six to nine."
+ ],
+ [
+ 10.273,
+ "Now there would be only two blue beads for nine coral beads."
+ ],
+ [
+ 14.518,
+ "We must divide both counts by three, giving two to three."
+ ],
+ [
+ 18.906,
+ "And keep the labels in their original order."
+ ],
+ [
+ 21.185,
+ "Three to two would compare coral to blue."
+ ],
+ [
+ 23.672,
+ "When simplifying a ratio, check two things: the same divisor was used for both quantities, and the first and second roles stayed in place."
+ ]
+ ]
+ },
+ "q2": {
+ "dur": 8.52,
+ "marks": {
+ "ask": 1.146
+ },
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.146,
+ "Which small bead pattern preserves the bag's ratio of six blue beads to nine coral beads?"
+ ],
+ [
+ 7.37,
+ "Choose the picture."
+ ]
+ ]
+ },
+ "scale": {
+ "dur": 46.8,
+ "marks": {
+ "key": 5.091,
+ "pair": 16.276,
+ "units": 29.753
+ },
+ "cues": [
+ [
+ 0.104,
+ "Ratios also appear in maps."
+ ],
+ [
+ 2.539,
+ "This fictional map has a printed key."
+ ],
+ [
+ 5.091,
+ "One centimetre on the map represents four kilometres in the real world."
+ ],
+ [
+ 9.987,
+ "These labels describe distances; your screen is only an enlarged illustration."
+ ],
+ [
+ 16.276,
+ "Two equal map segments, each labelled one centimetre, correspond to two real-distance segments, each labelled four kilometres."
+ ],
+ [
+ 25.664,
+ "So two centimetres on the map represents eight kilometres."
+ ],
+ [
+ 29.753,
+ "The comparison is two centimetres to eight kilometres, or one centimetre to four kilometres."
+ ],
+ [
+ 36.875,
+ "Keep both units."
+ ],
+ [
+ 38.268,
+ "The two sides describe different quantities."
+ ],
+ [
+ 41.146,
+ "We will study scale drawings in detail later; for now, read what the ratio compares."
+ ]
+ ]
+ },
+ "q3": {
+ "dur": 10.248,
+ "marks": {
+ "ask": 1.107
+ },
+ "cues": [
+ [
+ 0.104,
+ "Quick check."
+ ],
+ [
+ 1.107,
+ "The key is one centimetre on the map to four kilometres in the real world."
+ ],
+ [
+ 6.328,
+ "Choose the matching picture for a three-centimetre map distance."
+ ]
+ ]
+ },
+ "wrap": {
+ "dur": 34.68,
+ "marks": {
+ "w1": 2.552,
+ "w2": 6.732,
+ "w3": 12.409,
+ "w4": 19.349
+ },
+ "cues": [
+ [
+ 0.143,
+ "Four habits make ratios clear."
+ ],
+ [
+ 2.552,
+ "Name the first quantity, then the second."
+ ],
+ [
+ 5.273,
+ "Their order matters."
+ ],
+ [
+ 6.732,
+ "A colon, the word to, and fraction notation can all record the same ratio."
+ ],
+ [
+ 12.409,
+ "Ask what the second quantity counts."
+ ],
+ [
+ 14.57,
+ "It may be another part, the whole, or a distance measured in a different unit."
+ ],
+ [
+ 19.349,
+ "Simplify both counts by the same common factor and retain their order."
+ ],
+ [
+ 23.932,
+ "A smaller pair describes the same repeated pattern."
+ ],
+ [
+ 27.331,
+ "Now practise writing and interpreting ratios, with the labels doing as much work as the numbers."
+ ]
+ ]
+ },
+ "final1": {
+ "dur": 10.728,
+ "marks": {
+ "ask": 2.175
+ },
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice, part one."
+ ],
+ [
+ 2.175,
+ "Write each ordered ratio in fraction notation, in lowest terms."
+ ],
+ [
+ 6.992,
+ "For the last row, compare red counters with all counters."
+ ]
+ ]
+ },
+ "final2": {
+ "dur": 13.104,
+ "marks": {
+ "ask": 2.096
+ },
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice, part two."
+ ],
+ [
+ 2.096,
+ "A supply box contains six pens, ten pencils, and four erasers."
+ ],
+ [
+ 7.734,
+ "Enter both counts of each ratio in lowest terms."
+ ],
+ [
+ 11.458,
+ "Read the labels carefully."
+ ]
+ ]
+ },
+ "final3": {
+ "dur": 10.32,
+ "marks": {
+ "ask": 2.422
+ },
+ "cues": [
+ [
+ 0.104,
+ "Chapter practice, part three."
+ ],
+ [
+ 2.422,
+ "Interpret two denominators, then choose the meaning of a map scale."
+ ],
+ [
+ 7.109,
+ "Keep the named quantities and their units together."
+ ]
+ ]
+ },
+ "finish": {
+ "dur": 18.744,
+ "marks": {},
+ "cues": [
+ [
+ 0.104,
+ "You have finished ratios."
+ ],
+ [
+ 2.135,
+ "Your first-try results are shown here."
+ ],
+ [
+ 4.583,
+ "A ratio is an ordered comparison, and its labels tell you what each number means."
+ ],
+ [
+ 9.948,
+ "Replay a picture if you want to see the beads regroup again."
+ ],
+ [
+ 13.112,
+ "In the next chapter, a unit rate will describe a comparison for one unit of the second quantity."
+ ]
+ ]
+ }
+};
diff --git a/site/math-notebook/ch15/audio/en/whole.mp3 b/site/math-notebook/ch15/audio/en/whole.mp3
new file mode 100644
index 0000000..04f4704
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/whole.mp3 differ
diff --git a/site/math-notebook/ch15/audio/en/wrap.mp3 b/site/math-notebook/ch15/audio/en/wrap.mp3
new file mode 100644
index 0000000..f8ee832
Binary files /dev/null and b/site/math-notebook/ch15/audio/en/wrap.mp3 differ
diff --git a/site/math-notebook/ch15/index.html b/site/math-notebook/ch15/index.html
new file mode 100644
index 0000000..f4e41d7
--- /dev/null
+++ b/site/math-notebook/ch15/index.html
@@ -0,0 +1,40 @@
+<!doctype html>
+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Ratios — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.ratio-inputs .bline{gap:12px}.ratio-inputs .rlabel{font-size:27px;min-width:310px}.ratio-inputs .box{width:6ch!important}.ratio-inputs .why{font-size:20px}.band .prompt{font-size:27px}.side .keys{font-size:19px}</style></head><body>
+<script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>
+'use strict';
+const CHAPTER={number:15,title:'Ratios',minutes:9,language:'en'};
+const rgC={blue:COL.whole,coral:COL.nat,white:COL.chalk};
+const rgText=(p,s,x,y,t=0,size=30,col=COL.chalk,anchor='start')=>{const e=T(p,s,{x,y,size,fill:col,anchor,o:0});show(e,t);return e;};
+const rgMath=(p,s,x,y,t=0,size=52,col=COL.chalk)=>{const e=M(p,Array.isArray(s)?s:[s],{x,y,size,fill:col,anchor:'middle',o:0});show(e,t);return e;};
+const rgTitle=(p,s,sub='')=>{rgText(p,s,100,110,.1,43);if(sub)rgText(p,sub,100,165,.15,27,COL.dim);};
+function rgBead(p,color,id,x,y){const g=G(p,{x,y});g.dataset.beadId=id;g.dataset.kind=color;mk('circle',{r:19,fill:rgC[color],stroke:COL.board,'stroke-width':2},g);mk('circle',{r:5,fill:COL.board},g);return g;}
+const rgData=[...Array(6).fill('blue'),...Array(9).fill('coral'),...Array(3).fill('white')];
+function rgBag(p,layout='rows'){return rgData.map((kind,i)=>{const n=kind==='blue'?i:kind==='coral'?i-6:i-15;const [x,y]=layout==='bag'?[490+i%6*95,290+Math.floor(i/6)*110]:[400+n*70,300+['blue','coral','white'].indexOf(kind)*135];return rgBead(p,kind,'bag-'+i,x,y);});}
+function rgRowLabels(p,t=0){[['blue',6],['coral',9],['white',3]].forEach(([kind,n],i)=>{rgText(p,kind+' beads',145,310+135*i,t,31,rgC[kind]);rgText(p,String(n),1080,310+135*i,t,43,rgC[kind]);});}
+function rgRegroup(p,t=0){const beads=rgBag(p);const trays=[];for(let j=0;j<3;j++){const x=330+j*450,g=G(p,{o:0});mk('rect',{x:x-135,y:255,width:270,height:290,rx:20,fill:'none',stroke:COL.dim,'stroke-width':2},g);T(g,'tray '+(j+1),{x,y:595,size:26,anchor:'middle',fill:COL.dim});show(g,t,.5);trays.push(g);}beads.forEach((b,i)=>{const kind=rgData[i],n=kind==='blue'?i:kind==='coral'?i-6:i-15,per=kind==='blue'?2:kind==='coral'?3:1,j=Math.floor(n/per),k=n%per;tw(b,{x:330+j*450+(k-(per-1)/2)*65,y:kind==='blue'?310:kind==='coral'?410:500},t,2,io);});return {beads,trays};}
+function rgPattern(p,x,y,b,c,id){const g=G(p);for(let i=0;i<b;i++)rgBead(g,'blue',id+'-b'+i,x+(i-(b-1)/2)*45,y);for(let i=0;i<c;i++)rgBead(g,'coral',id+'-c'+i,x+(i-(c-1)/2)*45,y+95);rgText(g,b+' blue : '+c+' coral',x,y+175,0,31,COL.chalk,'middle');return g;}
+function rgMap(p,x,y,n,key=4){const g=G(p),w=80;g.dataset.mapUnits=n;g.dataset.realUnits=n*key;for(let j=0;j<n;j++){mk('rect',{x:x+j*w,y,width:w,height:65,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':2},g);T(g,'1 cm',{x:x+(j+.5)*w,y:y+40,size:22,anchor:'middle',fill:COL.whole});mk('rect',{x:x+j*w,y:y+140,width:w,height:65,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':2},g);T(g,key+' km',{x:x+(j+.5)*w,y:y+180,size:22,anchor:'middle',fill:COL.nat});}rgText(g,'map',x+n*w/2,y-25,0,25,COL.whole,'middle');rgText(g,'real distance',x+n*w/2,y+250,0,25,COL.nat,'middle');return g;}
+// Format-aware exact grading: a fraction must be n/d; ratio counts must be positive integers.
+function rgInputOK(values,answers,kind){const re=kind==='fraction'?/^\s*(\d+)\s*\/\s*(\d+)\s*$/:/^\s*\d+\s*$/;let ns;if(kind==='fraction'){const q=String(values[0]).match(re);if(!q)return false;ns=[+q[1],+q[2]];}else{if(!values.every(v=>re.test(String(v))))return false;ns=values.map(Number);}if(!ns.every(n=>Number.isSafeInteger(n)&&n>0)||gcd(...ns)!==1)return false;return BigInt(ns[0])*BigInt(answers[1])===BigInt(answers[0])*BigInt(ns[1]);}
+const rgInputs=rows=>(body,api)=>{body.classList.add('blanks','ratio-inputs');const built=rows.map(it=>{const line=h('div','bline'),lab=h('span','rlabel',[it.label]),mark=h('span','mark'),why=h('div','why');line.append(lab);const boxes=(it.kind==='fraction'?[it.answers.join('/')]:it.answers.map(String)).map((ans,i)=>{if(i)line.append(mathEl([' : '],34));const b=h('input','box');Object.assign(b,{type:'text',inputMode:'text',autocomplete:'off',spellcheck:false});b.dataset.ans=ans;b.setAttribute('aria-label',it.label+(it.kind==='fraction'?' fraction':i?' second count':' first count'));line.append(b);return b;});line.append(mark);body.append(h('div','brow',[line,why]));return {it,boxes,mark,why};});const judge=r=>{const ok=rgInputOK(r.boxes.map(b=>b.value),r.it.answers,r.it.kind);r.boxes.forEach(b=>{b.classList.toggle('good',ok);b.classList.toggle('bad',!ok)});r.mark.className='mark '+(ok?'good':'bad');r.mark.textContent=ok?'✓':'✗';r.why.replaceChildren(ok?'':r.it.hint);return ok;};const all=built.flatMap(r=>r.boxes);requestAnimationFrame(()=>all[0]?.focus({preventScroll:true}));return {check(){const right=built.filter(judge).length;api.grade(right===built.length,right===built.length?'The order, quantities, and lowest terms are correct.':`${right} of ${built.length} right. Read the row hints.`,{right,total:built.length});},reveal(){built.forEach(r=>{r.boxes.forEach(b=>b.value=b.dataset.ans);judge(r);r.why.replaceChildren(r.it.why)});return 'The ratios in lowest terms are shown.';},lock(){all.forEach(b=>b.disabled=true)},hint:['type ',rows[0].kind==='fraction'?'a fraction like 2/5':'positive whole-number counts',', ',kbd('Tab'),' next box, ',kbd('Enter'),' check, ',kbd('Esc'),' leave box']};};
+const BEATS=[
+['intro','Ratios',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 15',{x:800,y:225,size:28,fill:COL.dim,anchor:'middle'});T(g,'Ratios',{x:800,y:370,size:90,weight:600,anchor:'middle'});M(g,['6 : 9'],{x:800,y:540,size:90,anchor:'middle',fill:COL.task});tw(g,{o:1,y:0},.2,1,out);rgText(g,'Compare two quantities · keep their order',800,700,m('sub'),36,COL.dim,'middle');hide(g,D-.8,.7);}],
+['compare','An ordered comparison',m=>{const p=panel(0);rgTitle(p,'One bag · eighteen beads');const beads=rgBag(p,'bag');beads.forEach((b,i)=>{const k=rgData[i],n=k==='blue'?i:k==='coral'?i-6:i-15;tw(b,{x:400+n*70,y:300+['blue','coral','white'].indexOf(k)*135},m('separate'),2,io);});rgRowLabels(p,m('counts'));rgMath(p,'blue : coral = 6 : 9',800,765,m('ratio'),57);rgText(p,'The white beads remain in the bag.',800,845,m('ratio',2),28,COL.dim,'middle');S.rgBag=beads;}],
+['order','Order names the quantities',m=>{const p=panel(0);rgTitle(p,'Blue to coral ≠ coral to blue');const a=G(p,{x:500,y:345}),b=G(p,{x:1100,y:345});M(a,['6'],{size:88,anchor:'middle',fill:rgC.blue});T(a,'blue beads',{y:80,size:34,anchor:'middle',fill:rgC.blue});M(b,['9'],{size:88,anchor:'middle',fill:rgC.coral});T(b,'coral beads',{y:80,size:34,anchor:'middle',fill:rgC.coral});rgMath(p,':',800,345,0,88);rgText(p,'first quantity',500,220,m('first'),29,COL.dim,'middle');rgText(p,'second quantity',1100,220,m('first'),29,COL.dim,'middle');tw(a,{y:285},m('swap'),.5);tw(b,{y:465},m('swap'),.5);tw(a,{x:1100},m('swap',.5),1.5);tw(b,{x:500},m('swap',.5),1.5);tw(a,{y:345},m('swap',2),.5);tw(b,{y:345},m('swap',2),.5);rgMath(p,'coral : blue = 9 : 6',800,705,m('reverse'),57);rgText(p,'Same bag · different ordered comparison',800,815,m('reverse',2),34,COL.dim,'middle');S.rgSwap={a,b};}],
+['notation','Three notations, one comparison',m=>{const p=panel(0);rgTitle(p,'Blue beads compared with coral beads');rgPattern(p,800,280,2,3,'notation');rgText(p,'Repeated pattern from the 6-blue, 9-coral bag',800,510,0,27,COL.dim,'middle');rgMath(p,'6 : 9',350,640,m('colon'),62);rgMath(p,'6 to 9',800,640,m('words'),62);rgMath(p,[F(6,9)],1250,640,m('fraction'),62);rgText(p,'first: blue count',1250,765,m('roles'),29,rgC.blue,'middle');rgText(p,'second: coral count',1250,815,m('roles',1),29,rgC.coral,'middle');rgText(p,'Denominator = coral count, not total',100,845,m('roles',3),33,COL.task);}],
+['whole','Part to part; part to whole',m=>{const p=panel(0);rgTitle(p,'Which second quantity?','Same beads · a different comparison');S.rgBag=rgBag(p);rgRowLabels(p);const frame=mk('rect',{x:330,y:245,width:850,height:380,rx:22,fill:'none',stroke:COL.task,'stroke-width':4},p);put(frame,{o:0});show(frame,m('all'));rgText(p,'ALL = 6 + 9 + 3 = 18',800,670,m('all'),29,COL.task,'middle');rgMath(p,[F(6,9)],400,755,m('difference'),48);rgText(p,'blue : coral',400,830,m('difference'),30,rgC.coral,'middle');rgMath(p,[F(6,18)],1200,755,m('whole'),48);rgText(p,'blue : all',1200,830,m('whole'),30,COL.task,'middle');}],
+['q1','Choose the denominator',()=>{const p=panel(0);rgTitle(p,'Blue beads : ALL beads','Choose the second quantity.');const beads=rgBag(p,'bag');beads.forEach(b=>put(b,{x:st(b).x-180,y:st(b).y}));[['6 blue beads',rgC.blue],['9 coral beads',rgC.coral],['18 ALL beads',COL.task]].forEach(([s,c],i)=>rgText(p,s,1050,300+i*130,0,38,c,'middle'));S.rgChoices=[0,1,2].map(i=>({el:p,box:[840,240+i*130,420,95],label:['6 blue beads','9 coral beads','all18 beads'][i]}));},{ask:done=>quiz(BAND,[{id:'c-denominator',prompt:'For blue : all, which group supplies the denominator?',build:pickEls(S.rgChoices,2,'All eighteen beads. The denominator is the second named quantity.',i=>i===0?'Blue is the first quantity: it belongs in the numerator.':'Nine counts only coral beads. The question names ALL beads as its second quantity.')}],done)}],
+['group','Find a repeated pattern',m=>{const p=panel(0);rgTitle(p,'Regroup the same eighteen beads','No beads added · no beads removed');S.rgGroups=rgRegroup(p,m('trays'));rgText(p,'Each tray: 2 blue + 3 coral + 1 white',800,680,m('each'),36,COL.chalk,'middle');rgMath(p,'blue : coral = 2 : 3',800,770,m('same'),57);rgText(p,'Three copies give the full bag: 6 blue : 9 coral.',800,845,m('same',2),29,COL.dim,'middle');}],
+['simplify','Divide both counts',m=>{const p=panel(0);rgTitle(p,'Same repeated pattern · smaller counts');S.rgGroups=rgRegroup(p,0);rgMath(p,'6 ÷ 3 : 9 ÷ 3',800,670,m('divide'),61);rgMath(p,'2 : 3',800,770,m('reduced'),65,COL.task);rgText(p,'GCF(6, 9) = 3 · 2 and 3 share only factor 1',800,855,m('lowest'),31,COL.dim,'middle');}],
+['mistake','One divisor for both quantities',m=>{const p=panel(0);rgTitle(p,'Simplify BOTH counts; keep their order');rgPattern(p,400,280,2,9,'wrong-pattern');rgPattern(p,1200,280,2,3,'correct-pattern');rgText(p,'6 ÷ 3 : 9 → 2 : 9',400,600,m('wrong'),40,COL.chalk,'middle');const cross=path(p,'M165 565L635 620 M165 620L635 565',{stroke:COL.bad,'stroke-width':4},{d:0});draw(cross,m('wrong'),.8);rgText(p,'6 ÷ 3 : 9 ÷ 3 → 2 : 3',1200,600,m('both'),35,COL.task,'middle');rgText(p,'blue stays first · coral stays second',800,790,m('order'),39,COL.chalk,'middle');}],
+['q2','Choose the same comparison',()=>{const p=panel(0);rgTitle(p,'Original bag: 6 blue beads : 9 coral beads','Choose the repeated pattern with the same ordered comparison.');S.rgChoices=[[2,3],[2,9],[3,2]].map(([b,c],i)=>{const x=300+i*500,g=rgPattern(p,x,300,b,c,'choice-'+i);return {el:g,box:[x-230,230,460,290],label:b+' blue beads to '+c+' coral beads'};});},{ask:done=>quiz(BAND,[{id:'c-pattern',prompt:'Which picture preserves blue : coral = 6 : 9?',build:pickEls(S.rgChoices,0,'Two blue to three coral. Three copies give six blue to nine coral.',i=>i===1?'Only the blue count was divided. Nine coral needs to be divided by three too.':'The counts were reversed. Blue comes first, so we need two blue to three coral.')}],done)}],
+['scale','A map compares labelled distances',m=>{const p=panel(0);rgTitle(p,'A fictional map key','Distance diagram enlarged on screen · screen pixels are not centimetres');const key=G(p);rgText(key,'MAP KEY: 1 cm on map represents 4 km in real world',800,265,m('key'),36,COL.task,'middle');const map=rgMap(p,600,380,2);put(map,{o:0});show(map,m('pair'));rgMath(p,'2 : 8 = 1 : 4',1130,475,m('units'),45);rgText(p,'cm : km',1130,555,m('units'),36,COL.task,'middle');rgText(p,'map distance : real distance',800,795,m('units',2),38,COL.chalk,'middle');S.rgMap=map;}],
+['q3','Read the map key',()=>{const p=panel(0);rgTitle(p,'Key: 1 cm on map represents 4 km in real world','Models use labelled distances; screen pixels are not physical units.');S.rgChoices=[4,3,1].map((key,i)=>{const x=230+i*500,g=rgMap(p,x,290,3,key);rgText(g,'3 cm : '+(3*key)+' km',x+120,595,0,35,COL.chalk,'middle');return {el:g,box:[x-40,230,320,410],label:'3 centimetres on map to '+(3*key)+' kilometres in real world'};});},{ask:done=>quiz(BAND,[{id:'c-map',prompt:'Choose the picture that matches a 3 cm map distance.',build:pickEls(S.rgChoices,0,'Three map segments each represent four kilometres: 3 cm : 12 km.',i=>i===1?'Each centimetre must represent FOUR kilometres. Three lots of four gives twelve.':'Equal numeric counts would ignore the map key. Each map centimetre represents four real kilometres.')}],done)}],
+['wrap','Ratios with clear meaning',m=>{const p=panel(0);rgTitle(p,'Let the labels lead');[['Name first quantity, then second; order matters.','w1'],['6 : 9, 6 to 9, and 6/9 express the same ratio.','w2'],['Second quantity: another part, the whole, or a labelled unit.','w3'],['Divide BOTH counts by the same factor; retain their order.','w4']].forEach(([s,k],i)=>{const g=G(p,{x:-16,y:285+i*145,o:0});mk('circle',{cx:130,cy:-10,r:26,fill:COL.task},g);T(g,String(i+1),{x:130,y:0,size:30,anchor:'middle',fill:COL.board});T(g,s,{x:195,size:32});tw(g,{x:0,o:1},m(k),.6);});}],
+['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-fractions',prompt:'Write each ratio as a fraction in LOWEST TERMS.',build:rgInputs([{label:'8 : 20',kind:'fraction',answers:[2,5],hint:'Write numerator/denominator. Divide BOTH 8 and 20 by 4.',why:'8/20=2/5: divide both counts by 4.'},{label:'27 to 18',kind:'fraction',answers:[3,2],hint:'Keep 27 first and 18 second; divide both by 9.',why:'27/18=3/2. A ratio need not be less than1.'},{label:'14 : 35',kind:'fraction',answers:[2,5],hint:'The common factor 7 gives 2/5.',why:'14/35=2/5.'},{label:'15 red : 40 total',kind:'fraction',answers:[3,8],hint:'Total is already 40. Divide 15 and 40 by 5.',why:'15/40=3/8; denominatorcounts all 40.'}])}],done,'Chapter practice 1 of 3')}],
+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-supplies',prompt:'6 pens, 10 pencils, 4 erasers. Enter each ratio in LOWEST TERMS.',build:rgInputs([{label:'pens : pencils',kind:'pair',answers:[3,5],hint:'6:10 reduces by 2 to 3:5; use whole-number counts.',why:'Pens:pencils=6:10=3:5.'},{label:'pencils : pens',kind:'pair',answers:[5,3],hint:'Pencils come first: 10:6 reduces to 5:3.',why:'Pencils:pens=10:6=5:3.'},{label:'pens : all items',kind:'pair',answers:[3,10],hint:'Total6+10+4=20, not16. Simplify6:20.',why:'Pens:all=6:20=3:10.'},{label:'erasers : all items',kind:'pair',answers:[1,5],hint:'Four erasers, twenty items: 4:20 reduces to 1:5.',why:'Erasers:all=4:20=1:5.'}])}],done,'Chapter practice 2 of 3')}],
+['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-denominator-part',prompt:['Blue : coral = ',$m(F(2,3)),'. What does the denominator describe?'],build:choice(['The coral count','All beads','The blue count'],0,'The second quantity is coral. This part-to-part ratio does not say that two thirds of ALL beads are blue.',['','The denominator is the second named quantity, coral. The bag also has white beads.','Blue is the first quantity, in the numerator.'])},{id:'p-denominator-whole',prompt:['Blue : all = ',$m(F(1,3)),'. What does the denominator describe?'],build:choice(['Only coral beads','All beads','Only white beads'],1,'All beads. This comparison DOES describe the blue fraction of the whole bag.',['The word ALL makes the second quantity the whole bag.','','The second quantity includes every colour.'])},{id:'p-map-units',prompt:'A map key says “2 cm on map represents 10 km in real world.” What does 2 cm : 10 km compare?',build:choice(['Map centimetres to real kilometres','Two real centimetres to ten real kilometres','Two screen pixels to ten kilometres'],0,'Map distance in centimetres compared with real distance in kilometres. Both units belong with their quantities.',['','The first distance is measured on the map.','The key labels physical map centimetres; screen pixels are only part of this enlarged illustration.'])}],done,'Chapter practice 3 of 3')}],
+['finish','Finished',()=>panel(0),{ask:finishCard}]
+].map(([id,title,run,extra])=>({id,title,run,...extra}));
+boot();
+</script></body></html>
diff --git a/site/math-notebook/index.html b/site/math-notebook/index.html
index 8557dea..62ae086 100644
--- a/site/math-notebook/index.html
+++ b/site/math-notebook/index.html
@@ -230,6 +230,7 @@ main#contents { padding-bottom: 80px; }
// Chapters are numbered in order through the units. Add a chapter here when its lesson is ready.
const UNITS = [ // [unit title, [[chapter title, minutes], ...]]; chapters are numbered in order. Add a chapter when its lesson is ready.
['The Number System', [['Types of Numbers and the Number Line', 9], ['Positive and Negative Numbers', 8], ['Absolute Value', 9], ['Factors and Greatest Common Factor', 11], ['Multiples and Least Common Multiple', 10], ['Fraction Basics: Types of Fractions and Adding and Subtracting Fractions', 13], ['Multiplying and Dividing Fractions', 12], ['Adding and Subtracting Decimals', 11], ['Multiplying Decimals', 12], ['Dividing Decimals', 10], ['Adding Positive and Negative Numbers', 12], ['Subtracting Positive and Negative Numbers', 13], ['Multiplying and Dividing Positive and Negative Numbers', 14], ['Inequalities', 10]]],
+ ['Ratios, Proportions, and Percents', [['Ratios', 9]]],
];
const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];
const id = n => 'ch' + String(n).padStart(2, '0');
diff --git a/site/math-notebook/unit-art.js b/site/math-notebook/unit-art.js
index b79cfaf..848111b 100644
--- a/site/math-notebook/unit-art.js
+++ b/site/math-notebook/unit-art.js
@@ -22,5 +22,13 @@
Tx(440, 98, '1 2 3', 20, '', 'middle') + Tx(546, 62, 'π', 26, 'a', 'middle') +
P('M240 150H580') + Array.from({ length: 7 }, (_, i) => P(`M${260 + i * 50} 143v14`, 'a')).join('') +
`<circle class="t hop" r="7" fill="currentColor" stroke="none" style="--k:${k++};offset-path:path('M260 140Q285 112 310 140Q335 112 360 140Q385 112 410 140')"/>`),
+ // 2 Ratios, Proportions, and Percents: one marked object to three others; one of four is 25%.
+ reset(C(275, 48, 10) + C(350, 48, 10, 'a') + C(385, 48, 10, 'a') + C(420, 48, 10, 'a') +
+ `<circle class="t" style="--k:${k++}" cx="275" cy="48" r="5" fill="currentColor" stroke="none"/>` +
+ Tx(347, 100, '1 : 3', 32, '', 'middle') + P('M258 119v9h180v-9', 'a') +
+ Tx(347, 163, '1 / 4', 28, 'a', 'middle') + C(522, 88, 48) +
+ `<path d="M522 88V40A48 48 0 0 1 570 88Z" fill="currentColor" stroke="none" opacity=".14"/>` +
+ `<path class="cut" d="M522 88V40A48 48 0 0 1 570 88Z" fill="currentColor" stroke="none"/>` +
+ P('M522 40V88H570', 'a') + Tx(522, 163, '25%', 26, '', 'middle')),
];
})();