Skill: fractions-multiply-divide
Fraction Area Model Lab
Multiply fractions on a grid: shade a/b of the width and c/d of the height — the overlap is the product.
Fraction area model lab
Shade a/b of the width and c/d of the height. The overlap — out of all the cells — is the product.
Try this
Model 2/3 × 3/4. Cancel the 3s on the grid: how many cells overlap out of how many total?
/* == PURE (tested by test_lab.js) == */
function lAreaGcd(a, b){ while (b){ var t = a % b; a = b; b = t; } return a; }
function lAreaGeom(n1, d1, n2, d2){
n1 = Math.round(n1); d1 = Math.round(d1); n2 = Math.round(n2); d2 = Math.round(d2);
if (d1 < 1 || d2 < 1 || n1 < 0 || n1 > d1 || n2 < 0 || n2 > d2) return { ok: false };
var cells = d1 * d2, overlap = n1 * n2;
var g = lAreaGcd(overlap, cells);
return { ok: true, cols: d1, rows: d2, shadeCols: n1, shadeRows: n2,
cells: cells, overlap: overlap, sn: overlap / g, sd: cells / g };
}
/* == /PURE == */
/* == PURE (tested by test_lab.js) == */ function lAreaGcd(a, b){ while (b){ var t = a % b; a = b; b = t; } return a; } function lAreaGeom(n1, d1, n2, d2){ n1 = Math.round(n1); d1 = Math.round(d1); n2 = Math.round(n2); d2 = Math.round(d2); if (d1 < 1 || d2 < 1 || n1 < 0 || n1 > d1 || n2 < 0 || n2 > d2) return { ok: false }; var cells = d1 * d2, overlap = n1 * n2; var g = lAreaGcd(overlap, cells); return { ok: true, cols: d1, rows: d2, shadeCols: n1, shadeRows: n2, cells: cells, overlap: overlap, sn: overlap / g, sd: cells / g }; } /* == /PURE == */
(function(){ 'use strict'; function $(id){ return document.getElementById(id); } function render(){ var n1 = parseInt($('inN1').value, 10), d1 = parseInt($('inD1').value, 10); var n2 = parseInt($('inN2').value, 10), d2 = parseInt($('inD2').value, 10); if (n1 > d1){ n1 = d1; $('inN1').value = d1; } if (n2 > d2){ n2 = d2; $('inN2').value = d2; } $('inN1Val').textContent = n1; $('inD1Val').textContent = d1; $('inN2Val').textContent = n2; $('inD2Val').textContent = d2; var r = lAreaGeom(n1, d1, n2, d2); var out = $('labOut'); if (!r.ok){ out.innerHTML = ''; return; } var W = 420, H = 320, cw = W / d1, ch = H / d2; var h = '
' + n1 + '/' + d1 + ' \u00d7 ' + n2 + '/' + d2 + ' = ' + r.overlap + '/' + r.cells + ' = ' + r.sn + '/' + r.sd + '
' + '
' + r.overlap + ' overlapping cells out of ' + r.cells + ' total.
'; } ['inN1', 'inD1', 'inN2', 'inD2'].forEach(function(id){ $(id).addEventListener('input', render); }); render(); })();