An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
feat(math): add discounts and markups chapter
yzr6f65294839b5
diff --git a/site/index.html b/site/index.htmlindex bec0ca6..80ca145 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, 20 narrated chapters">- <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>20 narrated chapters</small></span>+ <a class="book-hotspot math-book" data-book="math-notebook" href="math-notebook/" aria-label="Open Elementary Mathematics, 22 narrated chapters">+ <span class="book-caption"><strong>Elementary Mathematics <span aria-hidden="true">↗</span></strong><small>22 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.jsindex 9074d1c..7440e7d 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: 20 },+ chapterBase: 'math-notebook/', chapters: 22 },];for (const book of books) {const cover = document.querySelector(`[data-book="${book.id}"]`);diff --git a/site/math-notebook/ch20/index.html b/site/math-notebook/ch20/index.htmlindex 4f6e6b3..a0c2afe 100644--- a/site/math-notebook/ch20/index.html+++ b/site/math-notebook/ch20/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>Percent Word Problems — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.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:20,title:'Percent Word Problems',minutes:13,language:'en'};+const CHAPTER={number:20,title:'Percent Word Problems',minutes:13,language:'en', next: '../ch21/' };// ch19 fixed-whole bars; blue = part, chalk = whole, amber = decimal rate/focus.const wwText=(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 wwMath=(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;};diff --git a/site/math-notebook/ch22/audio/en/discount.mp3 b/site/math-notebook/ch22/audio/en/discount.mp3new file mode 100644index 0000000..cef6ac1Binary files /dev/null and b/site/math-notebook/ch22/audio/en/discount.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/final1.mp3 b/site/math-notebook/ch22/audio/en/final1.mp3new file mode 100644index 0000000..18a201dBinary files /dev/null and b/site/math-notebook/ch22/audio/en/final1.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/final2.mp3 b/site/math-notebook/ch22/audio/en/final2.mp3new file mode 100644index 0000000..beaa843Binary files /dev/null and b/site/math-notebook/ch22/audio/en/final2.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/final3.mp3 b/site/math-notebook/ch22/audio/en/final3.mp3new file mode 100644index 0000000..2ecf0abBinary files /dev/null and b/site/math-notebook/ch22/audio/en/final3.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/finish.mp3 b/site/math-notebook/ch22/audio/en/finish.mp3new file mode 100644index 0000000..8ef8eddBinary files /dev/null and b/site/math-notebook/ch22/audio/en/finish.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/intro.mp3 b/site/math-notebook/ch22/audio/en/intro.mp3new file mode 100644index 0000000..5bbbc57Binary files /dev/null and b/site/math-notebook/ch22/audio/en/intro.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/markorig.mp3 b/site/math-notebook/ch22/audio/en/markorig.mp3new file mode 100644index 0000000..c15765cBinary files /dev/null and b/site/math-notebook/ch22/audio/en/markorig.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/markup.mp3 b/site/math-notebook/ch22/audio/en/markup.mp3new file mode 100644index 0000000..5bbadcdBinary files /dev/null and b/site/math-notebook/ch22/audio/en/markup.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/mistake.mp3 b/site/math-notebook/ch22/audio/en/mistake.mp3new file mode 100644index 0000000..3f67aa5Binary files /dev/null and b/site/math-notebook/ch22/audio/en/mistake.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/original.mp3 b/site/math-notebook/ch22/audio/en/original.mp3new file mode 100644index 0000000..7303e9bBinary files /dev/null and b/site/math-notebook/ch22/audio/en/original.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/pay.mp3 b/site/math-notebook/ch22/audio/en/pay.mp3new file mode 100644index 0000000..3581394Binary files /dev/null and b/site/math-notebook/ch22/audio/en/pay.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/percentoff.mp3 b/site/math-notebook/ch22/audio/en/percentoff.mp3new file mode 100644index 0000000..eef37b1Binary files /dev/null and b/site/math-notebook/ch22/audio/en/percentoff.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/q1.mp3 b/site/math-notebook/ch22/audio/en/q1.mp3new file mode 100644index 0000000..7928d1fBinary files /dev/null and b/site/math-notebook/ch22/audio/en/q1.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/q2.mp3 b/site/math-notebook/ch22/audio/en/q2.mp3new file mode 100644index 0000000..64674cdBinary files /dev/null and b/site/math-notebook/ch22/audio/en/q2.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/q3.mp3 b/site/math-notebook/ch22/audio/en/q3.mp3new file mode 100644index 0000000..08ac07dBinary files /dev/null and b/site/math-notebook/ch22/audio/en/q3.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/timings.js b/site/math-notebook/ch22/audio/en/timings.jsnew file mode 100644index 0000000..ef541d8--- /dev/null+++ b/site/math-notebook/ch22/audio/en/timings.js@@ -0,0 +1,570 @@+window.TIMINGS = {+ "intro": {+ "dur": 18.024,+ "marks": {+ "sub": 7.07+ },+ "cues": [+ [+ 0.104,+ "Chapter twenty-two."+ ],+ [+ 1.602,+ "Discounts and markups."+ ],+ [+ 3.724,+ "Last chapter, a percent added to a price."+ ],+ [+ 7.07,+ "This time the percent can take money off, as a sale, or put it on, as a store's profit."+ ],+ [+ 13.034,+ "We will find the amount, the new price, and work backward to the price before."+ ]+ ]+ },+ "discount": {+ "dur": 39.504,+ "marks": {+ "sign": 0.091,+ "bar": 14.336,+ "conv": 18.333,+ "mult": 22.917,+ "sub": 30.859,+ "new": 36.81+ },+ "cues": [+ [+ 0.091,+ "A store window says, all items twenty percent off."+ ],+ [+ 4.062,+ "A hat costs twelve dollars and fifty cents."+ ],+ [+ 7.435,+ "Words like sale, markdown, clearance and savings all mean the same thing: you subtract."+ ],+ [+ 14.336,+ "On the strip, the discount is the last fifth of the price."+ ],+ [+ 18.333,+ "Change twenty percent to the decimal zero point two zero."+ ],+ [+ 22.917,+ "Multiply by the price: zero point two zero times twelve fifty is two dollars fifty."+ ],+ [+ 29.583,+ "That is the discount."+ ],+ [+ 30.859,+ "Now subtract it from the original price: twelve fifty minus two fifty is ten dollars."+ ],+ [+ 36.81,+ "The new price of the hat is ten dollars."+ ]+ ]+ },+ "pay": {+ "dur": 24.384,+ "marks": {+ "split": 2.188,+ "pct": 6.836,+ "one": 11.68,+ "rule": 16.797+ },+ "cues": [+ [+ 0.117,+ "Here is the same hat, cut into what you save and what you pay."+ ],+ [+ 4.414,+ "The discount is twenty percent, so you still pay one hundred percent minus twenty percent, which is eighty percent."+ ],+ [+ 11.68,+ "One step: zero point eight times twelve fifty is ten dollars."+ ],+ [+ 16.797,+ "To find the sale price, multiply by one minus the discount rate."+ ],+ [+ 21.523,+ "Same answer, and one fewer subtraction."+ ]+ ]+ },+ "q1": {+ "dur": 5.712,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.146,+ "Which picture shows a sixty dollar jacket at twenty-five percent off?"+ ]+ ]+ },+ "twice": {+ "dur": 44.4,+ "marks": {+ "start": 0.104,+ "first": 11.914,+ "second": 19.857,+ "wrong": 29.805+ },+ "cues": [+ [+ 0.104,+ "What if you get a second discount on top of the first?"+ ],+ [+ 3.125,+ "A game store takes twenty-five percent off, and your membership card gives another fifteen percent."+ ],+ [+ 9.583,+ "The games cost one hundred dollars."+ ],+ [+ 11.914,+ "Take one discount at a time."+ ],+ [+ 13.659,+ "Twenty-five percent of one hundred is twenty-five, so the first price is seventy-five dollars."+ ],+ [+ 19.857,+ "The card takes fifteen percent off that new price."+ ],+ [+ 23.138,+ "Fifteen percent of seventy-five is eleven twenty-five, so you pay sixty-three seventy-five."+ ],+ [+ 29.805,+ "It is tempting to add the percents and take forty percent off, which would leave sixty dollars."+ ],+ [+ 36.107,+ "But the second discount is a percent of seventy-five, not of one hundred."+ ],+ [+ 41.432,+ "You actually saved thirty-six twenty-five."+ ]+ ]+ },+ "q2": {+ "dur": 5.4,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.133,+ "Two discounts, one after the other."+ ],+ [+ 3.711,+ "Take it one step at a time."+ ]+ ]+ },+ "original": {+ "dur": 40.488,+ "marks": {+ "start": 0.104,+ "pct": 8.75,+ "eq": 17.578,+ "divide": 27.344,+ "check": 34.206+ },+ "cues": [+ [+ 0.104,+ "Now work backward."+ ],+ [+ 1.406,+ "A video game is thirty percent off, and the sale price is forty-one ninety-nine."+ ],+ [+ 7.018,+ "What was the original price?"+ ],+ [+ 8.75,+ "The original price is one hundred percent."+ ],+ [+ 11.589,+ "Thirty percent is taken away, so the sale price is seventy percent of the original."+ ],+ [+ 17.578,+ "As a decimal, seventy percent is zero point seven."+ ],+ [+ 21.732,+ "So forty-one ninety-nine equals zero point seven times the original price."+ ],+ [+ 27.344,+ "Divide both sides by zero point seven."+ ],+ [+ 30.612,+ "The original price is about fifty-nine ninety-nine."+ ],+ [+ 34.206,+ "Check it forward: seventy percent of fifty-nine ninety-nine is about forty-one ninety-nine."+ ]+ ]+ },+ "mistake": {+ "dur": 24.768,+ "marks": {+ "start": 0.104,+ "wrong": 4.258,+ "why": 9.453,+ "test": 14.675,+ "right": 22.161+ },+ "cues": [+ [+ 0.104,+ "A tempting shortcut: add thirty percent of the sale price back on."+ ],+ [+ 4.258,+ "Forty-one ninety-nine plus thirty percent of it is about fifty-four fifty-nine."+ ],+ [+ 9.453,+ "But the thirty percent was taken from the original price, not from the sale price."+ ],+ [+ 14.675,+ "Test it: take thirty percent off fifty-four fifty-nine, and you get thirty-eight twenty-one, not forty-one ninety-nine."+ ],+ [+ 22.161,+ "Divide by seventy percent instead."+ ]+ ]+ },+ "percentoff": {+ "dur": 30.168,+ "marks": {+ "start": 0.104,+ "eq": 7.122,+ "paid": 15.078,+ "sub": 18.125,+ "done": 23.503+ },+ "cues": [+ [+ 0.104,+ "You can also find the percent discount."+ ],+ [+ 2.396,+ "Julie paid thirty-five dollars for a shirt that was fifty dollars."+ ],+ [+ 7.122,+ "Thirty-five equals some fraction times fifty."+ ],+ [+ 10.925,+ "Divide by fifty, and the fraction is zero point seven."+ ],+ [+ 15.078,+ "Julie paid seventy percent of the price."+ ],+ [+ 18.125,+ "So the discount is one minus zero point seven, which is zero point three."+ ],+ [+ 23.503,+ "That is thirty percent off."+ ],+ [+ 25.299,+ "Check: fifteen dollars saved, out of fifty, is three tenths."+ ]+ ]+ },+ "markup": {+ "dur": 31.848,+ "marks": {+ "start": 0.104,+ "bar": 10.521,+ "conv": 15.846,+ "mult": 19.049,+ "add": 23.802,+ "one": 28.385+ },+ "cues": [+ [+ 0.104,+ "Stores cannot sell everything on sale, or they would close."+ ],+ [+ 4.323,+ "A store pays for goods, and then raises the price to make a profit."+ ],+ [+ 8.516,+ "That increase is called a markup."+ ],+ [+ 10.521,+ "A game costs the store forty dollars, and it marks the game up twenty percent."+ ],+ [+ 15.846,+ "Twenty percent is zero point two zero."+ ],+ [+ 19.049,+ "Zero point two zero times forty is eight dollars, the markup."+ ],+ [+ 23.802,+ "Add it to the cost: forty plus eight is forty-eight dollars."+ ],+ [+ 28.385,+ "Or in one step, one point two times forty."+ ]+ ]+ },+ "markorig": {+ "dur": 34.584,+ "marks": {+ "start": 0.104,+ "pct": 9.753,+ "eq": 18.294,+ "divide": 24.818,+ "check": 29.271+ },+ "cues": [+ [+ 0.104,+ "Work backward from a markup."+ ],+ [+ 1.888,+ "A bakery charges five dollars and eight cents for a cake, after a seventy percent markup."+ ],+ [+ 7.878,+ "What did the cake cost the bakery?"+ ],+ [+ 9.753,+ "The cost is one hundred percent, and the markup is seventy percent more, so the price is one hundred seventy percent of the cost."+ ],+ [+ 18.294,+ "As a decimal, one point seven."+ ],+ [+ 20.781,+ "Five oh eight equals one point seven times the cost."+ ],+ [+ 24.818,+ "Divide by one point seven."+ ],+ [+ 26.849,+ "The cost is about two ninety-nine."+ ],+ [+ 29.271,+ "Check forward: one point seven times two ninety-nine is about five oh eight."+ ]+ ]+ },+ "updown": {+ "dur": 33.168,+ "marks": {+ "start": 0.091,+ "down": 7.839,+ "up": 13.151,+ "note": 21.341+ },+ "cues": [+ [+ 0.091,+ "Now a discount and a markup together."+ ],+ [+ 2.708,+ "A bed costs two hundred dollars."+ ],+ [+ 5.169,+ "First it is marked down thirty percent."+ ],+ [+ 7.839,+ "Thirty percent of two hundred is sixty, so the bed is one hundred forty."+ ],+ [+ 13.151,+ "Then it is marked up twenty percent."+ ],+ [+ 15.156,+ "Twenty percent of one hundred forty is twenty-eight, so the price is one sixty-eight."+ ],+ [+ 21.341,+ "Thirty down and twenty up does not leave ten percent off, which would be one eighty."+ ],+ [+ 27.057,+ "Each percent is taken from the price at that moment, and the second step started from a smaller price."+ ]+ ]+ },+ "q3": {+ "dur": 5.736,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Quick check."+ ],+ [+ 1.094,+ "Up twenty-five percent, then down twenty-five percent."+ ],+ [+ 4.792,+ "Where does it end?"+ ]+ ]+ },+ "wrap": {+ "dur": 27.936,+ "marks": {+ "w1": 1.276,+ "w2": 9.258,+ "w3": 16.849,+ "w4": 23.568+ },+ "cues": [+ [+ 0.13,+ "Four habits."+ ],+ [+ 1.276,+ "A discount is a percent of the original price, and you subtract it."+ ],+ [+ 5.729,+ "A markup is a percent of the cost, and you add it."+ ],+ [+ 9.258,+ "Sale price is one minus the rate times the price."+ ],+ [+ 13.125,+ "Marked-up price is one plus the rate times the cost."+ ],+ [+ 16.849,+ "To work back, divide by seventy percent, or one point seven, whichever you used going forward."+ ],+ [+ 23.568,+ "Two changes in a row?"+ ],+ [+ 24.948,+ "Do one at a time, each from the current price."+ ]+ ]+ },+ "final1": {+ "dur": 4.056,+ "marks": {},+ "cues": [+ [+ 0.117,+ "Chapter practice one."+ ],+ [+ 1.576,+ "Discounts and sale prices."+ ]+ ]+ },+ "final2": {+ "dur": 4.968,+ "marks": {},+ "cues": [+ [+ 0.091,+ "Chapter practice two."+ ],+ [+ 1.667,+ "Originals, a second discount, and percent off."+ ]+ ]+ },+ "final3": {+ "dur": 3.792,+ "marks": {},+ "cues": [+ [+ 0.104,+ "Chapter practice three."+ ],+ [+ 1.758,+ "Markups, and mixing up and down."+ ]+ ]+ },+ "finish": {+ "dur": 3.216,+ "marks": {},+ "cues": [+ [+ 0.104,+ "That is the end of the chapter on discounts and markups."+ ]+ ]+ }+};diff --git a/site/math-notebook/ch22/audio/en/twice.mp3 b/site/math-notebook/ch22/audio/en/twice.mp3new file mode 100644index 0000000..1b94043Binary files /dev/null and b/site/math-notebook/ch22/audio/en/twice.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/updown.mp3 b/site/math-notebook/ch22/audio/en/updown.mp3new file mode 100644index 0000000..539628fBinary files /dev/null and b/site/math-notebook/ch22/audio/en/updown.mp3 differdiff --git a/site/math-notebook/ch22/audio/en/wrap.mp3 b/site/math-notebook/ch22/audio/en/wrap.mp3new file mode 100644index 0000000..8912d22Binary files /dev/null and b/site/math-notebook/ch22/audio/en/wrap.mp3 differdiff --git a/site/math-notebook/ch22/index.html b/site/math-notebook/ch22/index.htmlnew file mode 100644index 0000000..92744ea--- /dev/null+++ b/site/math-notebook/ch22/index.html@@ -0,0 +1,52 @@+<!doctype html>+<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Discounts and Markups — Elementary Mathematics</title><link rel="stylesheet" href="../lib/engine.css"><link rel="expect" href="#bar" blocking="render"><style>.band .prompt{font-size:27px}.screen .blanks .bline{gap:12px}.screen .blanks .box{width:8ch!important}.screen .blanks .why{font-size:21px}.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:22,title:'Discounts and Markups',minutes:9,language:'en'};+// Colours: chalk = original price/cost, coral (nat) = discount, blue = pay / new price, pink (rat) = markup, amber = rate.+const DS=COL.nat,TOT=COL.whole,UP=COL.rat;+const dsText=(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 dsMath=(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 dsTitle=(p,s,sub='')=>{dsText(p,s,100,110,.1,43);if(sub)dsText(p,sub,100,165,.15,27,COL.dim);};+// strip of the original price at u px per unit: blue = what you pay, coral = discount taken from the right end+function dsBar(p,x,y,u,price,off,t=0,h=100){const g=G(p,{x,y,o:0});const pay=mk('rect',{width:(price-off)*u,height:h,fill:TOT,'fill-opacity':.4,stroke:TOT,'stroke-width':3},g);const d=mk('rect',{x:(price-off)*u,width:off*u,height:h,fill:DS,'fill-opacity':.7,stroke:DS,'stroke-width':3},g);show(g,t);return {g,pay,d,w:price*u};}+// strip of the cost with a pink markup added to the right+function dsUp(p,x,y,u,cost,extra,t=0,h=100){const g=G(p,{x,y,o:0});mk('rect',{width:cost*u,height:h,fill:COL.chalk,'fill-opacity':.14,stroke:COL.chalk,'stroke-width':3},g);const e=mk('rect',{x:cost*u,width:extra*u,height:h,fill:UP,'fill-opacity':.7,stroke:UP,'stroke-width':3},g);show(g,t);return {g,ex:e,w:(cost+extra)*u};}+function dsChoices(p,items,u){return items.map(([price,disc,pay],i)=>{const x=140+i*480,g=G(p),b=dsBar(g,x,360,u,price,disc,0,100);dsText(g,String.fromCharCode(65+i),x+(price*u)/2,270,0,34,COL.dim,'middle');dsText(g,'price $'+price,x,330,0,28);dsText(g,'discount $'+disc,x,500,0,29,DS);dsText(g,'pay $'+pay,x,550,0,31,TOT);return {el:g,box:[x-20,235,430,360],label:'Picture '+String.fromCharCode(65+i)+', price '+price+', discount '+disc+', pay '+pay,bar:b};});}+const BEATS=[+['intro','Discounts and Markups',(m,D)=>{const g=G(scene,{o:0,y:24});T(g,'Unit 2 · Ratios, Proportions, and Percents · Chapter 22',{x:800,y:195,size:28,fill:COL.dim,anchor:'middle'});T(g,'Discounts and Markups',{x:800,y:390,size:90,weight:600,anchor:'middle'});T(g,'price − discount · cost + markup',{x:800,y:560,size:50,fill:COL.task,anchor:'middle'});tw(g,{o:1,y:0},.2,1,out);dsText(g,'Take it off · put it on · work back',800,720,m('sub'),35,COL.dim,'middle');hide(g,D-.8,.7);}],+['discount','Discount: subtract it',m=>{const p=panel(0);dsTitle(p,'A $12.50 hat · all items 20% off','sale · markdown · clearance · savings: you subtract');const b=dsBar(p,160,250,64,12.5,2.5);dsText(p,'original price $12.50',160+320,385,m('sign'),32,COL.chalk,'middle');dsText(p,'discount',160+640+80,225,m('bar'),30,DS,'middle');dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 12.50 = 2.50',800,625,m('mult'),54,DS);dsMath(p,'12.50 − 2.50 = 10.00',800,730,m('sub'),54,TOT);dsText(p,'new price $10.00',800,820,m('new'),38,TOT,'middle');tw(b.d,{y:70,o:.3},m('sub'),.9,io);}],+['pay','You pay what is left',m=>{const p=panel(0);dsTitle(p,'Same hat · what you pay','Pay = 100% − 20% = 80% of the price');const b=dsBar(p,160,250,64,12.5,2.5);dsText(p,'pay 80%',160+320,235,m('pct'),32,TOT,'middle');dsText(p,'save 20%',160+640+80,235,m('split'),30,DS,'middle');dsText(p,'100% − 20% = 80% = 0.80',800,520,m('pct'),46,COL.task,'middle');dsMath(p,'0.80 × 12.50 = 10.00',800,630,m('one'),56,TOT);dsText(p,'sale price = (1 − rate) × price',800,740,m('rule'),42,COL.task,'middle');}],+['q1','Which picture?',()=>{const p=panel(0);dsTitle(p,'A $60 jacket · 25% off','All strips use the same scale: 5 px = $1');S.dsCh=dsChoices(p,[[60,15,45],[60,25,35],[60,45,15]],5);},{ask:done=>quiz(BAND,[{id:'c-sale',prompt:'Which picture shows the jacket with 25% off?',build:pickEls(S.dsCh,0,'0.25 × 60 = 15 discount, so you pay 60 − 15 = $45.',i=>i===1?'$25 treats 25% as 25 dollars. 25% of $60 is only $15.':'$45 would be 75% off. 25% of $60 is $15.')}],done)}],+['twice','Two discounts, one at a time',m=>{const p=panel(0);dsTitle(p,'$100 of games · 25% off, then 15% more','The second discount is taken from the new price');dsBar(p,160,230,6,100,25,0,70);dsText(p,'$100 · discount $25',160+225,335,m('first'),30,COL.chalk,'middle');dsBar(p,160,370,6,75,11.25,0,70);dsText(p,'$75 · discount $11.25',160+170,475,m('second'),30,COL.chalk,'middle');dsMath(p,'0.25 × 100 = 25 → $75',1180,270,m('first',.3),44,DS,'middle');dsMath(p,'0.15 × 75 = 11.25 → $63.75',1180,410,m('second',.3),44,TOT);dsText(p,'not 40% off · that would be $60',800,610,m('wrong'),38,COL.task,'middle');dsText(p,'15% is of $75, not of $100',800,680,m('wrong',3),34,COL.dim,'middle');dsText(p,'total saved $36.25',800,760,m('wrong',6),38,DS,'middle');}],+['q2','Two discounts',()=>{const p=panel(0);dsTitle(p,'An $80 jacket · 10% off, then 10% more','One discount at a time');dsBar(p,160,260,8,80,8,0,70);dsText(p,'$80 · 10% off = $8',160+320,365,0,30,COL.chalk,'middle');},{ask:done=>quiz(BAND,[{id:'c-two',prompt:'Find the price after each discount.',build:blanks([{parts:['after the first: $',{box:'72'},' final price: $',{box:'64.80'}],why:'0.90 × 80 = 72, then 0.90 × 72 = 64.80. Not 20% off, which would be $64.'}])}],done)}],+['original','Work back to the original',m=>{const p=panel(0);dsTitle(p,'Sale price $41.99 · 30% off','What was the original price?');const b=dsBar(p,160,255,8,100,30);dsText(p,'original price p = 100%',160+400,390,m('start'),32,COL.chalk,'middle');dsText(p,'30% off',160+560+120,230,m('pct'),30,DS,'middle');dsText(p,'sale $41.99 = 70%',160+280,230,m('pct',1),30,TOT,'middle');dsMath(p,'100% − 30% = 70% = 0.7',800,520,m('pct',1),46,COL.task);dsMath(p,'41.99 = 0.7 × p',800,625,m('eq'),56);dsMath(p,'p = 41.99 ÷ 0.7 ≈ 59.99',800,730,m('divide'),56);dsText(p,'check: 0.7 × 59.99 = 41.993 ≈ 41.99',800,825,m('check'),33,COL.dim,'middle');}],+['mistake','Percent of the original',m=>{const p=panel(0);dsTitle(p,'A tempting shortcut','Add 30% of the sale price back?');dsMath(p,'41.99 + 0.3 × 41.99 ≈ 54.59',800,330,m('wrong'),54);const x=path(p,'M270 360L1330 300',{stroke:COL.bad,'stroke-width':6},{d:0});draw(x,m('why'),.6);dsText(p,'The 30% came off the original price, not off the sale price.',800,470,m('why'),34,COL.task,'middle');dsText(p,'test: 30% off $54.59 gives $38.21, not $41.99',800,570,m('test'),34,COL.dim,'middle');dsMath(p,'p = 41.99 ÷ 0.7 ≈ 59.99',800,735,m('right'),58,TOT);}],+['percentoff','Find the percent off',m=>{const p=panel(0);dsTitle(p,'Julie paid $35 for a $50 shirt','What was the percent discount?');const b=dsBar(p,160,250,16,50,15);dsText(p,'paid $35',160+280,235,m('paid'),32,TOT,'middle');dsText(p,'saved $15',160+560+120,235,m('done'),30,DS,'middle');dsText(p,'original price $50',160+400,385,m('start'),32,COL.chalk,'middle');dsMath(p,'35 = x × 50 → x = 0.7',800,520,m('eq'),54);dsText(p,'Julie paid 70% of the price',800,605,m('paid'),36,TOT,'middle');dsMath(p,'1 − 0.7 = 0.3 = 30%',800,725,m('sub'),58,DS);dsText(p,'check: 15 ÷ 50 = 0.30',800,820,m('done',1),33,COL.dim,'middle');}],+['markup','Markup: add it',m=>{const p=panel(0);dsTitle(p,'A game costs the store $40 · 20% markup','markup = the increase that makes a profit');const b=dsUp(p,160,250,20,40,8);dsText(p,'store pays $40',160+400,385,m('bar'),32,COL.chalk,'middle');dsText(p,'markup',160+800+80,225,m('bar',1),30,UP,'middle');dsMath(p,'20% = 0.20',800,520,m('conv'),50,COL.task);dsMath(p,'0.20 × 40 = 8',800,625,m('mult'),54,UP);dsMath(p,'40 + 8 = 48',800,730,m('add'),56,TOT);dsText(p,'one step: (1 + rate) × cost = 1.2 × 40',800,820,m('one'),34,COL.dim,'middle');}],+['markorig','Work back to the cost',m=>{const p=panel(0);dsTitle(p,'Cake price $5.08 · 70% markup','What did the bakery pay?');const b=dsUp(p,160,255,5,100,70);dsText(p,'cost = 100%',160+250,390,m('start'),32,COL.chalk,'middle');dsText(p,'markup 70%',160+500+175,230,m('pct'),30,UP,'middle');dsMath(p,'100% + 70% = 170% = 1.7',800,520,m('pct',1),46,COL.task);dsMath(p,'5.08 = 1.7 × c',800,625,m('eq'),56);dsMath(p,'c = 5.08 ÷ 1.7 ≈ 2.99',800,730,m('divide'),56);dsText(p,'check: 1.7 × 2.99 = 5.083 ≈ 5.08',800,825,m('check'),33,COL.dim,'middle');}],+['updown','Down, then up',m=>{const p=panel(0);dsTitle(p,'A $200 bed · 30% off, then 20% markup','Each percent is of the price at that moment');dsBar(p,160,230,3,200,60,0,70);dsText(p,'$200 − $60 = $140',160+210,335,m('down'),30,COL.chalk,'middle');dsUp(p,160,380,3,140,28,0,70);dsText(p,'$140 + $28 = $168',160+210,485,m('up'),30,COL.chalk,'middle');dsMath(p,'0.30 × 200 = 60',1180,270,m('down'),44,DS,'middle');dsMath(p,'0.20 × 140 = 28',1180,425,m('up'),44,UP,'middle');dsText(p,'not 10% off ($180)',800,620,m('note'),40,COL.task,'middle');dsText(p,'The markup started from a smaller price.',800,700,m('note',5),34,COL.dim,'middle');dsText(p,'final price $168',800,790,m('note',8),42,TOT,'middle');}],+['q3','Up, then down',()=>{const p=panel(0);dsTitle(p,'$100 · marked up 25%, then marked down 25%','Does it come back to $100?');dsUp(p,160,230,6,100,25,0,70);dsText(p,'$100 + 25% = $125',160+375,335,0,30,COL.chalk,'middle');dsBar(p,160,370,6,125,31.25,0,70);dsText(p,'$125 − 25% of $125 = ?',160+375,475,0,30,COL.chalk,'middle');},{ask:done=>quiz(BAND,[{id:'c-updown',prompt:'Where does the price end?',build:choice(['$100','$93.75','$75'],1,'100 × 1.25 = 125, then 125 × 0.75 = 93.75. The 25% off is taken from the larger price.',['The two 25% steps are of different prices: $100 and then $125.','','That subtracts 25% from $100 but forgets the markup first.'])}],done)}],+['wrap','Four habits',m=>{const p=panel(0);dsTitle(p,'Discounts and markups · the same percent idea');[['Discount: a percent of the original price, subtracted. Markup: a percent of the cost, added.','w1'],['Sale price = (1 − rate) × price. Marked-up price = (1 + rate) × cost.','w2'],['To work back, divide by the same factor, such as 0.7 or 1.7.','w3'],['Two changes? Do one at a time, each from the current price.','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-disc',prompt:'Discounts. Type only the number of dollars.',build:blanks([+{parts:['$300 computer, 15% off: discount $',{box:'45'},' price $',{box:'255'}],why:'0.15 × 300 = 45, and 300 − 45 = 255.'},+{parts:['$48 pants, 20% off: discount $',{box:'9.60'},' price $',{box:'38.40'}],why:'0.20 × 48 = 9.60, and 48 − 9.60 = 38.40.'},+{parts:['Truck A: $14,500, 10% off. Price $',{box:'13050'}],why:'0.90 × 14,500 = 13,050.'},+{parts:['Truck B: $16,000, 14% off. Price $',{box:'13760'}],why:'0.86 × 16,000 = 13,760. Truck A is the better deal.'}+])}],done,'Chapter practice 1 of 3')}],+['final2','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-orig',prompt:'Work backward, or take two discounts. Type only the number.',build:blanks([+{parts:['Bike on sale for 45% off at $299.75. Original price $',{box:'545'}],why:'100% − 45% = 55%, and 299.75 ÷ 0.55 = 545.'},+{parts:['$30 shirt, 15% off, then 10% more. Final price $',{box:'22.95'}],why:'0.85 × 30 = 25.50, then 0.90 × 25.50 = 22.95.'},+{parts:['Paid $35 for a $50 shirt. Percent discount ',{box:'30'},' %'],why:'35 ÷ 50 = 0.7 is paid, so 1 − 0.7 = 0.3, which is 30%.'},+{parts:['Sale price $60, original price $80. Percent discount ',{box:'25'},' %'],why:'60 ÷ 80 = 0.75 is paid, so the discount is 0.25, which is 25%.'}+])}],done,'Chapter practice 2 of 3')}],+['final3','Chapter practice',()=>panel(0),{ask:done=>quiz(SCREEN,[{id:'p-mark',prompt:'Markups. Type only the number of dollars.',build:blanks([+{parts:['$50 shelf, 8% markup: markup $',{box:'4'},' new price $',{box:'54'}],why:'0.08 × 50 = 4, and 50 + 4 = 54.'},+{parts:['$350 bike, 15% markup: markup $',{box:'52.50'},' new price $',{box:'402.50'}],why:'0.15 × 350 = 52.50, and 350 + 52.50 = 402.50.'},+{parts:['Milk sells for $3.24 after a 35% markup. Cost $',{box:'2.40'}],why:'3.24 ÷ 1.35 = 2.40.'},+{parts:['Bed costs $200, marked down 30% then up 20%. Price $',{box:'168'}],why:'0.70 × 200 = 140, then 1.20 × 140 = 168.'}+])}],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.htmlindex 1dc0e1a..97e4e31 100644--- a/site/math-notebook/index.html+++ b/site/math-notebook/index.html@@ -230,7 +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], ['Unit Rate and Unit Price', 10], ['Proportions', 12], ['Converting Measurements', 13], ['Percent', 13], ['Percent Word Problems', 13]]],+ ['Ratios, Proportions, and Percents', [['Ratios', 9], ['Unit Rate and Unit Price', 10], ['Proportions', 12], ['Converting Measurements', 13], ['Percent', 13], ['Percent Word Problems', 13], ['Taxes and Fees', 9], ['Discounts and Markups', 11]]],];const HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];const id = n => 'ch' + String(n).padStart(2, '0');