Skip to content

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

17.1 KB
Raw Blame
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Proportions — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.side .keys{font-size:19px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:22px}.screen .blanks .bline svg tspan{font-style:normal}</style></head><body>
<script src="../lib/engine.js"></script><script src="audio/en/timings.js"></script><script>
'use strict';
const CHAPTER={number:17,title:'Proportions',minutes:12,language:'en', next: '../ch18/' };
// Ch16 entrances; blue = output/concentrate, coral = input/water, amber = focus.
const prText=(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 prMath=(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 prTitle=(p,s,sub='')=>{prText(p,s,100,110,.1,43);if(sub)prText(p,sub,100,165,.15,27,COL.dim);};
function prCup(p,id,x,y,col){const g=G(p,{x,y});g.dataset.cupId=id;g.dataset.cups='1';path(g,'M-20 -25H20L15 25H-15Z',{fill:mix(COL.board,col,.35),stroke:col,'stroke-width':3});path(g,'M-18 -12H18',{stroke:col,'stroke-width':2});return g;}
function prRecipe(p,a=2,b=3,groups=1,y=300){return [0,1,2].map(i=>{const g=G(p,{x:400+i*380,y:i<groups?0:80,o:i<groups?1:0});g.dataset.batchId='batch-'+i;const top=Array.from({length:a},(_,j)=>prCup(g,'batch-'+i+'-top-'+j,(j-(a-1)/2)*60,y,COL.whole));const bottom=Array.from({length:b},(_,j)=>prCup(g,'batch-'+i+'-bottom-'+j,(j-(b-1)/2)*60,y+150,COL.nat));return {g,top,bottom};});}
function prUnits(p,a,b,top,bot,x,y,t=0){const g=G(p,{o:0});T(g,a+' '+top,{x,y:y-55,size:39,fill:COL.whole,anchor:'middle'});path(g,`M${x-235} ${y}H${x+235}`,{stroke:COL.chalk,'stroke-width':3});T(g,b+' '+bot,{x,y:y+70,size:39,fill:COL.nat,anchor:'middle'});show(g,t);return g;}
function prBars(p,a,b,top,bot,u=90){const x=200;const first=mk('rect',{x,y:280,width:a*u,height:70,fill:mix(COL.board,COL.whole,.3),stroke:COL.whole,'stroke-width':3},p),second=mk('rect',{x,y:490,width:b*u,height:70,fill:mix(COL.board,COL.nat,.3),stroke:COL.nat,'stroke-width':3},p);const firstLab=prText(p,a+' '+top,x,395,0,32,COL.whole),secondLab=prText(p,b+' '+bot,x,605,0,32,COL.nat),factor=prText(p,'scale × 1',1250,345,0,39,COL.task,'middle');return {first,second,firstLab,secondLab,factor,a,b,u,top,bot};}
function prScale(v,k,t){prog(q=>{const f=1+(k-1)*q;v.first.setAttribute('width',v.a*v.u*f);v.second.setAttribute('width',v.b*v.u*f);v.first.dataset.amount=String(v.a*f);v.second.dataset.amount=String(v.b*f);const e=q<1?0:1,g=1+(k-1)*e,fmt=n=>n===.75?'¾':String(+n.toFixed(3)),lab=(n,u)=>fmt(n)+' '+(n<=1?u.replace(/^cups /,'cup '):u);v.firstLab.textContent=lab(v.a*g,v.top);v.secondLab.textContent=lab(v.b*g,v.bot);v.factor.textContent='scale × '+fmt(g);},t,3,io);}
function prProduct(p,x,y,cols,rows,col){const g=G(p,{x,y});g.dataset.cols=String(cols);g.dataset.rows=String(rows);for(let r=0;r<rows;r++)for(let c=0;c<cols;c++)mk('rect',{x:c*22,y:r*22,width:22,height:22,fill:mix(COL.board,col,.3),stroke:col,'stroke-width':1.5},g);return g;}
const BEATS=[
['intro','Proportions',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 17',{x:800,y:200,size:28,fill:COL.dim,anchor:'middle'});T(g,'Proportions',{x:800,y:380,size:96,weight:600,anchor:'middle'});M(g,[F(2,3),' = ',F(6,9)],{x:800,y:575,size:76,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);prText(g,'Different batch size · same balance',800,745,m('sub'),37,COL.dim,'middle');hide(g,D-.8,.7);}],
['recipe','An ordered recipe',m=>{const p=panel(0);prTitle(p,'Two cups of syrup · three cups of water','Invented recipe · every drawn cup represents 1 cup of liquid');S.prRecipe=prRecipe(p);prText(p,'syrup',130,310,m('syrup'),34,COL.whole);prText(p,'water',130,460,m('water'),34,COL.nat);prUnits(p,2,3,'cups syrup','cups water',1130,370,m('ratio'));prText(p,'Keep syrup first, water second.',800,760,m('ratio',2),40,COL.task,'middle');}],
['copies','Three copies, same recipe',m=>{const p=panel(0);prTitle(p,'Copy the WHOLE recipe','Original batch stays; two new batches use the same amounts.');S.prRecipe=prRecipe(p);prText(p,'syrup',130,310,0,34,COL.whole);prText(p,'water',130,460,0,34,COL.nat);S.prRecipe.slice(1).forEach(s=>{show(s.g,m('copy'),.5);tw(s.g,{y:0},m('copy'),2,io);});[0,1,2].forEach(i=>prText(p,'batch '+(i+1),400+i*380,560,i?m('copy',2):0,29,COL.dim,'middle'));prText(p,'6 cups syrup / 9 cups water',800,665,m('total'),44,COL.chalk,'middle');prMath(p,[F(2,3),' = ',F(6,9)],800,785,m('same'),58,COL.task);}],
['scale','Both amounts share one factor',m=>{const p=panel(0);prTitle(p,'Scale both liquid amounts together','Both bars use the same cup scale.');S.prBars=prBars(p,2,3,'cups syrup','cups water');prScale(S.prBars,3,m('grow'));prMath(p,[F('2 × 3','3 × 3'),' = ',F(2,3)],800,740,m('cancel'),55,COL.task);prText(p,'Same nonzero factor · denominators ≠ 0',800,845,m('rule'),32,COL.dim,'middle');}],
['q1','Choose the equivalent batch',()=>{const p=panel(0);prTitle(p,'Keep 2 syrup cups for every 3 water cups','Select the batch that preserves the recipe. Each cup represents 1 cup.');S.prChoices=[[4,6],[4,3],[6,6]].map(([a,b],i)=>{const x=285+i*515,g=G(p);for(let j=0;j<a;j++)prCup(g,'q1-'+i+'-s-'+j,x+(j-(a-1)/2)*56,300,COL.whole);for(let j=0;j<b;j++)prCup(g,'q1-'+i+'-w-'+j,x+(j-(b-1)/2)*56,455,COL.nat);prText(g,a+' cups syrup',x,240,0,32,COL.whole,'middle');prText(g,b+' cups water',x,550,0,32,COL.nat,'middle');g.dataset.top=String(a);g.dataset.bottom=String(b);return {el:g,box:[x-220,205,440,380],label:a+' syrup cups and '+b+' water cups'};});},{ask:done=>quiz(BAND,[{id:'c-batch',prompt:'Which picture keeps syrup/water = 2/3?',build:pickEls(S.prChoices,0,'4/6 = 2/3: BOTH amounts doubled.',i=>i===1?'Only syrup doubled; water stayed at three. Double both amounts.':'Equal amounts give 1/1, not two syrup cups for every three water cups.')}],done)}],
['common','Where cross products come from',m=>{const p=panel(0);prTitle(p,'Make a common denominator','Multiplying by 9/9 or 3/3 multiplies by ONE.');prMath(p,[F(2,3)],400,310,0,84,COL.whole);prMath(p,[F(6,9)],1130,310,0,84,COL.nat);prMath(p,[F('2 × 9','3 × 9')],400,510,m('expand'),66,COL.whole);prMath(p,[F('6 × 3','9 × 3')],1130,510,m('expand',1),66,COL.nat);prMath(p,[F(18,27),' = ',F(18,27)],800,705,m('shared'),63,COL.task);prText(p,'Same denominator 27: compare 18 with 18.',800,840,m('compare'),33,COL.chalk,'middle');}],
['cross','The diagonal shortcut has a reason',m=>{const p=panel(0);prTitle(p,'Equal ratios ⇔ equal cross products','The common denominator is b × d; it must be nonzero.');prMath(p,[F(2,3)],580,340,0,93);prMath(p,[F(6,9)],1020,340,0,93);const diagonals=path(p,'M610 280L990 350 M610 350L990 280',{stroke:COL.task,'stroke-width':4},{d:0});draw(diagonals,m('diagonal'),1.2);prText(p,'2 × 9 = 18     6 × 3 = 18',800,520,m('diagonal',1.3),44,COL.task,'middle');prMath(p,[F('a','b'),' = ',F('c','d'),'    ⇔    a × d = c × b'],800,675,m('general'),51);prText(p,'b ≠ 0 and d ≠ 0',800,820,m('condition'),39,COL.dim,'middle');S.prDiagonals=diagonals;}],
['unequal','Unequal products, unequal ratios',m=>{const p=panel(0);prTitle(p,'Do 5/8 and 8/12 form a proportion?');prMath(p,[F(5,8),'     ',F(8,12)],800,350,0,85);prMath(p,'5 × 12 = 60',430,570,m('products'),52,COL.whole);prMath(p,'8 × 8 = 64',1160,570,m('products',2),52,COL.nat);prMath(p,'60 ≠ 64',800,710,m('different'),63,COL.task);prText(p,'Not a proportion: the ordered ratios differ.',800,835,m('check'),34,COL.chalk,'middle');}],
['q2','Choose the matching cross-product areas',()=>{const p=panel(0);prTitle(p,'Compare 2/4 with 6/12','Which picture shows the correct cross products? Each square = 1.');S.prChoices=[[[12,2],[6,4]],[[10,2],[6,4]],[[12,2],[5,4]]].map(([a,b],i)=>{const x=90+i*520,g=G(p);const top=prProduct(g,x+30,280,...a,COL.whole),bot=prProduct(g,x+30,455,...b,COL.nat);prText(g,a[1]+' × '+a[0],x+150,245,0,34,COL.whole,'middle');prText(g,b[0]+' × '+b[1],x+150,420,0,34,COL.nat,'middle');prText(g,String(a[0]*a[1]),x+355,315,0,38,COL.whole,'middle');prText(g,String(b[0]*b[1]),x+355,510,0,38,COL.nat,'middle');return {el:g,box:[x,210,440,370],label:a[1]+' times '+a[0]+' and '+b[0]+' times '+b[1],top,bot};});},{ask:done=>quiz(BAND,[{id:'c-products',prompt:'Choose 2 × 12 and 6 × 4. Do their areas match?',build:pickEls(S.prChoices,0,'Both actual rectangles contain 24 unit squares. Equal products give 2/4 = 6/12.',i=>i===1?'Use twelve, the second denominator, not ten. 2 × 12 = 24.':'Use six, the second numerator, not five. 6 × 4 = 24.')}],done)}],
['unknown','A letter names a missing amount',m=>{const p=panel(0);prTitle(p,'Same recipe · 3 concentrate cups for 4 water cups');prUnits(p,3,4,'cups concentrate','cups water',410,330);prMath(p,'=',795,340,0,56);S.prUnknown=prUnits(p,'x',12,'cups concentrate','cups water',1180,330,m('blank'));prText(p,'Matching ingredient units in matching positions',800,490,m('units'),31,COL.task,'middle');S.prRecipe=prRecipe(p,3,4,1,585);S.prRecipe.slice(1).forEach(s=>{show(s.g,m('groups'),.5);tw(s.g,{y:0},m('groups'),2,io);});prText(p,'concentrate',115,590,0,30,COL.whole);prText(p,'water',115,740,0,30,COL.nat);prText(p,'x = 9 cups of concentrate',800,825,m('answer'),40,COL.task,'middle');}],
['solve','Undo four copies by sharing',m=>{const p=panel(0);prTitle(p,'3/4 = x/12: find the missing number','The 36 counters are just a number, not recipe cups.');prMath(p,'3 × 12 = 4 × x',800,245,m('product'),48);S.prCounters=Array.from({length:36},(_,i)=>{const e=G(p,{x:250+i%12*90,y:345+Math.floor(i/12)*65});e.dataset.counterId='counter-'+i;mk('circle',{r:17,fill:mix(COL.board,COL.whole,.35),stroke:COL.whole,'stroke-width':2},e);const group=Math.floor(i/9),j=i%9;tw(e,{x:350+group*300+(j%3-1)*60,y:345+Math.floor(j/3)*65},m('share'),2,io);return e;});[0,1,2,3].forEach(i=>{const box=mk('rect',{x:250+i*300,y:295,width:200,height:225,rx:12,fill:'none',stroke:COL.task,'stroke-width':2},p);put(box,{o:0});show(box,m('share',2));prText(p,'9 in group '+(i+1),350+i*300,575,m('share',2),28,COL.task,'middle');});prMath(p,'36 ÷ 4 = 9',800,695,m('divide'),56,COL.task);prText(p,'Check: 3/4 = 9/12 · 4 × 9 = 3 × 12',800,825,m('verify'),34,COL.chalk,'middle');}],
['q3','Complete the recipe',()=>{const p=panel(0);prTitle(p,'Same recipe: 3 cups concentrate / 4 cups water','Use 12 cups water. Which completed picture has the right amount AND units?');S.prChoices=[[9,12,'concentrate','water'],[16,12,'concentrate','water'],[9,12,'water','concentrate']].map(([a,b,top,bot],i)=>{const x=285+i*515,g=G(p),topCol=top==='concentrate'?COL.whole:COL.nat,botCol=bot==='concentrate'?COL.whole:COL.nat;prText(g,a+' cups '+top,x,255,0,30,topCol,'middle');mk('rect',{x:x-150,y:300,width:a*18,height:65,fill:mix(COL.board,topCol,.3),stroke:topCol,'stroke-width':3},g);prText(g,b+' cups '+bot,x,455,0,30,botCol,'middle');mk('rect',{x:x-150,y:495,width:b*18,height:65,fill:mix(COL.board,botCol,.3),stroke:botCol,'stroke-width':3},g);Object.assign(g.dataset,{top:String(a),bottom:String(b),topUnit:top,bottomUnit:bot});return {el:g,box:[x-220,215,440,385],label:a+' cups '+top+' above '+b+' cups '+bot};});},{ask:done=>quiz(BAND,[{id:'c-missing',prompt:'Choose the completed concentrate/water ratio.',build:pickEls(S.prChoices,0,'9 cups concentrate / 12 cups water = 3/4. Water tripled, so concentrate tripled.',i=>i===1?'Multiply three concentrate cups by three, not four water cups by four.':'The ingredient units are reversed. Concentrate must be above water in BOTH ratios.')}],done)}],
['decimal','An exact missing decimal',m=>{const p=panel(0);prTitle(p,'Find y: exact fractions or exact decimals');prMath(p,[F(5,8),' = ',F('y',14)],800,330,0,83);prMath(p,'8 × y = 5 × 14 = 70',800,505,m('cross'),57);prMath(p,'y = 70 ÷ 8 = 8.75',800,660,m('divide'),58,COL.task);prText(p,'Check: 8 × 8.75 = 70 · 8.75 = 35/4 exactly',800,815,m('verify'),32,COL.chalk,'middle');}],
['travel','A proportion needs the same speed',m=>{const p=panel(0);prTitle(p,'Train: 84 km in 3 hours','We assume the train keeps the same speed.');S.prBars=prBars(p,84,3,'km','hours',4);S.prBars.second.setAttribute('width',3*112);S.prBars.factor.remove();
const eq1=prMath(p,[F(84,3),' = ',F('d',7)],1250,420,m('units',3.7),60);
prText(p,'Distance and time use separate, consistent scales.',800,210,m('assume'),27,COL.dim,'middle');prText(p,'km / hours in BOTH ratios',1250,560,m('units'),29,COL.task,'middle');prog(q=>{const f=1+4/3*q,a=84*f,b=3*f;S.prBars.first.setAttribute('width',a*4);S.prBars.second.setAttribute('width',b*112);S.prBars.first.dataset.amount=String(a);S.prBars.second.dataset.amount=String(b);const e=q<1?0:1,g=1+4/3*e;S.prBars.firstLab.textContent=+(84*g).toFixed(3)+' km';S.prBars.secondLab.textContent=+(3*g).toFixed(3)+' hours';},m('extend'),3,io);prText(p,'28 km/hour × 7 hours = 196 km',800,745,m('answer'),42,COL.task,'middle');hide(eq1,m('answer'),.3);prMath(p,[F(84,3),' = ',F(196,7)],1250,420,m('answer'),60,COL.task);prText(p,'84/3 = 196/7 · if the speed stays the same',800,840,m('answer',2),29,COL.dim,'middle');}],
['constant','The constant is a directed unit rate',m=>{const p=panel(0);prTitle(p,'Same recipe · concentrate per water','Both liquid bars use the same scale; both amounts divide by 4.');S.prBars=prBars(p,3,4,'cups concentrate','cups water',160);S.prBars.factor.remove();prScale(S.prBars,.25,m('normalize'));prText(p,'¾ cup concentrate',1250,420,m('rate'),30,COL.whole,'middle');prText(p,'per 1 cup water',1250,470,m('rate'),30,COL.nat,'middle');prText(p,'Reverse direction: 4/3 cups water per cup concentrate',800,735,m('reverse'),34,COL.chalk,'middle');prText(p,'For every 1 cup of water: ¾ cup of concentrate',800,840,m('reverse',2),31,COL.task,'middle');}],
['data','A table supports a model',m=>{const p=panel(0);prTitle(p,'Two observations from a pump','Both measurements give the same rate.');prText(p,'litres delivered',250,280,0,34,COL.whole);prText(p,'minutes',250,400,0,34,COL.nat);[0,1].forEach(i=>{prText(p,String([21,35][i]),790+i*340,280,0,49,COL.whole,'middle');prText(p,String([3,5][i]),790+i*340,400,0,49,COL.nat,'middle');prText(p,[21,35][i]+' ÷ '+[3,5][i]+' = 7 L/min',790+i*340,530,m('rates'),32,COL.task,'middle');});prText(p,'The pump gives 7 litres every minute',800,645,m('one'),38,COL.task,'middle');prText(p,'IF the pump stays steady: 8 minutes gives 56 litres.',800,755,m('assumption'),33,COL.chalk,'middle');prText(p,'Two measurements cannot promise the pump keeps going.',800,850,m('assumption',3),30,COL.dim,'middle');}],
['wrap','Equal ratios, meaningful units',m=>{const p=panel(0);prTitle(p,'Four habits for proportions');[['Equal ordered ratios; matching units; denominators ≠ 0.','w1'],['Scale BOTH quantities by the same nonzero factor.','w2'],['Common denominators explain cross products and missing numbers.','w3'],['A unit rate is "per 1"; predictions need the rate to stay the same.','w4']].forEach(([s,key],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:31});tw(g,{x:0,o:1},m(key),.6);});}],
['final1','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-proportions',prompt:'Do these ordered ratios form a proportion? Compare cross products.',build:grid([
{parts:[F(4,7),' and ',F(12,21)],ans:['yes'],why:'4 × 21 = 84 and 12 × 7 = 84. Equal products: yes.'},
{parts:[F(5,6),' and ',F(10,15)],ans:['no'],why:'5 × 15 = 75, but 10 × 6 = 60. Unequal products: no.'},
{parts:[F('1.2',3),' and ',F(2,5)],ans:['yes'],why:'1.2 × 5 = 6 and 2 × 3 = 6. Equal products: yes.'}
],[['yes','Yes'],['no','No']],{multi:false})}],done,'Chapter practice · set 1 of 3')}],
['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-missing',prompt:'Find each missing number. Use exact fractions or exact decimals.',build:blanks([
{parts:[F(8,12),' = ',F(14,'x'),',  x = ',{box:'21'}],why:'8 × x = 12 × 14 = 168; x = 168 ÷ 8 = 21.'},
{parts:[F(3,8),' = ',F('y',20),',  y = ',{box:'7.5'}],why:'8 × y = 3 × 20 = 60; y = 60 ÷ 8 = 7.5.'},
{parts:[F('z','2.5'),' = ',F(3,4),',  z = ',{box:'1.875'}],why:'4 × z = 2.5 × 3 = 7.5; z = 7.5 ÷ 4 = 1.875.'}
])}],done,'Chapter practice · set 2 of 3')}],
['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-context',prompt:'Use the stated same recipe, constant price or speed. Keep units in order.',build:blanks([
{parts:['Same paint: 3 blue cups / 5 white cups; 12 blue need ',{box:'20'},' white cups'],why:'Blue amount × 4 requires white amount × 4: 5 × 4 = 20 cups.'},
{parts:['Constant price, no fee: 4 tickets cost $6.40; 10 cost $',{box:'16'}],why:'$6.40 ÷ 4 = $1.60/ticket; 10 × $1.60 = $16.'},
{parts:['Same speed: 72 km in 2 hours; 5 hours gives ',{box:'180'},' km'],why:'72 ÷ 2 = 36 km/hour; 5 × 36 = 180 km.'},
{parts:['Table: 18 L in 3 min, 30 L in 5 min; unit rate ',{box:'6'},' L/min'],why:'Both observed ratios give 6 litres/minute; future predictions require steady flow.'}
])}],done,'Chapter practice · set 3 of 3')}],
['finish','Finished',()=>panel(0),{ask:finishCard}]
].map(([id,title,run,extra])=>({id,title,run,...extra}));
boot();
</script></body></html>