Permalink
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (54 sloc) 2.2 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>Subtracting 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="vars" data-ensure="D > N1 && D !== 100">
<var id="N1">randRange( 2, 10 )</var>
<var id="N2">randRange( 1, N1 - 1 )</var>
<var id="D">randFromArray(denominators)</var>
</div>
<div class="problems">
<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>
</div>
<div class="hints">
<div class="graphie" id="pie" style="float: left">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
PIECH = piechart([N1, D - N1], ["#e00", "#999"], 2);
</div>
<div>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
piechart([N1 - N2, N2, D - N1], ["#e00","#122", "#999"], 2);
</div>
<p>Subtract the numerators.</p>
</div>
<div>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
piechart([N1 - N2, D - N1 + N2], ["#e00", "#999"], 2);
</div>
<p><code><var>fraction( N1, D )</var> - <var>fraction( N2, D )</var> = <var>fraction( N1 - N2, D )</var></code></p>
</div>
<div data-if="getGCD( N1 - N2, D ) !== 1">
<p>Simplify.</p>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
var frac = reduce(N1 - N2 , D);
piechart([frac[0], frac[1] - frac[0]], ["#e00", "#999"], 2);
</div>
<p><code><var>fraction( N1 - N2, D )</var> = <var>fractionReduce( N1 - N2, D )</var></code></p>
</div>
</div>
</div>
</body>
</html>