Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (61 sloc) 3.241 kB
<!DOCTYPE html>
<html data-require="math math-format graphie graphie-helpers">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding fractions with common denominators</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div id="add-fractions">
<div class="vars">
<var id="D">randFromArray([2, 3, 4, 5, 6, 8, 10, 12, 100])</var>
<var id="DIGITS">(D + "").length</var>
<var id="N1">randRange(1, 7 - DIGITS)</var>
<var id="N2">randRange(1, 7 - DIGITS)</var>
<var id="SUM">(function() {
var s = "\\dfrac{\\blue{" + N1 + "}}{" + D + "} + \\dfrac{\\green{" + N2 + "}}{" + D + "} = ";
s += _(N1).times(function() {return "\\dfrac{\\blue{1}}{" + D + "}"}).join("+");
s += "+";
s += _(N2).times(function() {return "\\dfrac{\\green{1}}{" + D + "}"}).join("+");
return s;
})()</var>
</div>
<div class="question">
<p><code><var>fraction(N1, D)</var> + <var>fraction(N2, D)</var> = {?}</code></p>
</div>
<div class="solution" data-simplify="optional" data-type="rational"><var>(N1 + N2) / D</var></div>
<div class="hints">
<div class="graphie">
init({ range: [[-1, 20], [-1, 3]], scale: 20 });
label([0, 0], SUM, "right");
var x = 2.5 + 0.8 * DIGITS;
var x2 = ((DIGITS * 9 + 20) * N1 - 16) / 20;
if (N1 &gt; 2) {
curlyBrace([x, 0.9], [x + x2, 0.9]);
label([x + x2 / 2, 1.1], "\\blue{" + N1 + "}", "above");
}
x += x2 + 0.9;
x2 = ((DIGITS * 9 + 20) * N2 - 16) / 20;
if (N2 &gt; 2) {
curlyBrace([x, 0.9], [x + x2, 0.9]);
label([x + x2 / 2, 1.1], "\\green{" + N2 + "}", "above");
}
</div>
<div class="graphie" data-if="N1 !== 1 || N2 !== 1">
init({ range: [[-1, 20], [-1, 3]], scale: 20 });
label([0, 0], SUM, "right");
var x = 2.5 + 0.8 * DIGITS;
var x2 = ((DIGITS * 9 + 20) * (N1 + N2) - 16) / 20;
curlyBrace([x, 0.9], [x + x2, 0.9]);
label([0.05 + x + x2 / 2, 1.1], "\\blue{" + N1 + "} + \\green{" + N2 + "}", "above");
</div>
<p><code>\qquad = \dfrac{\blue{<var>N1</var>} + \green{<var>N2</var>}}{<var>D</var>}</code></p>
<p><code>\qquad = \dfrac{<var>N1 + N2</var>}{<var>D</var>}</code></p>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.