Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
made exercise subtracting fractions nicer so it keeps the pies you we…
Browse files Browse the repository at this point in the history
…nt through re #267
  • Loading branch information
igorT committed Jul 27, 2011
1 parent 800e9f9 commit d77f1ac
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions exercises/subtracting_fractions_with_common_denominators.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

<div class="problems">
<div>
<p class="question"><code><var>fraction( N1, D )</var> - <var>fraction( N2, D )</var> = ?</code></p>
<div class="question">
<p><code><var>fraction( N1, D )</var> - <var>fraction( N2, D )</var> = ?</code></p>
(simplify your answer)
</div>
<div class="solution" data-type="improper"><var>( N1 - N2 ) / D</var></div>
</div>
</div>
Expand All @@ -25,25 +28,25 @@
PIECH = piechart( [ N1, D - 1 ], ["#e00", "#999"], 2 );
</div>
<div>
<span class="graphie" data-update="pie">
PIECH.remove();
PIECH = piechart( [ N1-N2,N2, D - 1 ], ["#e00","#122", "#999"], 2 );
</span>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
piechart( [ N1-N2,N2, D - 1 ], ["#e00","#122", "#999"], 2 );
</div>
<p>Subtract the numerators.</p>
</div>
<div>
<span class="graphie" data-update="pie">
PIECH.remove();
PIECH = piechart( [ N1 - N2, D - 1 ], ["#e00", "#999"], 2 );
</span>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
piechart( [ N1 - N2, D - 1 ], ["#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>
<span class="graphie" data-update="pie">
PIECH.remove();
PIECH = piechart( [ reduce(N1 - N2 , D)[0] , reduce(N1 - N2, D)[1] - 1 ], ["#e00", "#999"], 2 );
</span>
<div class="graphie">
init({ range: [ [-3, 3], [-3, 3] ], scale: 25 });
piechart( [ reduce(N1 - N2 , D)[0] , reduce(N1 - N2, D)[1] - 1 ], ["#e00", "#999"], 2 );
</div>
<p><code><var>fraction( N1 - N2, D )</var> = <var>fractionReduce( N1 - N2, D )</var></code></p>
</div>
</div>
Expand Down

0 comments on commit d77f1ac

Please sign in to comment.