Permalink
Fetching contributors…
Cannot retrieve contributors at this time
80 lines (73 sloc) 4.17 KB
<!DOCTYPE html>
<html data-require="math math-format expressions rational-expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 1</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars" data-ensure="!NUMERSOL.divide(DENOMSOL)">
<var id="SIGN">randFromArray(["-", "+"])</var>
<var id="X">randVar()</var>
<var id="DENOMCOEFF">randRangeWeighted(1, 8, 1, 0.25)</var>
<var id="DENOMCONST">randRangeWeighted(-12, 12, 0, 0.25)</var>
<var id="DENOMINATOR">new RationalExpression([[DENOMCOEFF, X], DENOMCONST])</var>
<var id="NUMERCONST" data-ensure="DENOMCONST !== 0 || NUMERCONST !== 0">randRange(-12, 12)</var>
<var id="NUMERCOEFF" data-ensure="NUMERCOEFF !== 0 || NUMERCONST !== 0">randRange(-8, 8)</var>
<var id="NUMERATORSUM">new RationalExpression([[NUMERCOEFF, X], NUMERCONST])</var>
<var id="FACTOR">DENOMINATOR.getGCD(NUMERATORSUM)</var>
<div data-ensure="COEFF1 !== 0 || CONST1 !== 0">
<var id="COEFF1">randRangeWeighted(-8, 8, 1, 0.25)</var>
<var id="CONST1">randRangeWeighted(-12, 12, 0, 0.25)</var>
</div>
<var id="NUMERATOR1">new RationalExpression([[COEFF1, X], CONST1])</var>
<var id="NUMERATOR2">
SIGN === "+" ? new RationalExpression([[NUMERCOEFF - COEFF1, X], NUMERCONST - CONST1]) :
new RationalExpression([[COEFF1 - NUMERCOEFF, X], CONST1 - NUMERCONST])
</var>
<var id="NUMERSOL">NUMERATORSUM.divide(FACTOR)</var>
<var id="DENOMSOL">DENOMINATOR.divide(FACTOR)</var>
</div>
<div class="problems">
<div>
<p class="problem">Simplify the following expression:</p>
<p class="question"><code>
\dfrac{<var>NUMERATOR1</var>}{<var>DENOMINATOR</var>}<var>SIGN</var>
\dfrac{<var>NUMERATOR2</var>}{<var>DENOMINATOR</var>}
</code></p>
<div class="solution" data-type="expression">
<div class="set-sol" data-same-form="">(<var>NUMERSOL.toString()</var>)/(<var>DENOMSOL.toString()</var>)</div>
<div class="set-sol" data-same-form="">(<var>NUMERSOL.toString()</var>)/(<var>DENOMSOL.toStringFactored()</var>)</div>
<div class="set-sol" data-same-form="">(<var>NUMERSOL.toStringFactored()</var>)/(<var>DENOMSOL.toString()</var>)</div>
<div class="set-sol" data-same-form="">(<var>NUMERSOL.toStringFactored()</var>)/(<var>DENOMSOL.toStringFactored()</var>)</div>
</div>
</div>
</div>
<div class="hints">
<div data-if="SIGN === '-'" data-unwrap="">
<div>
<p>Since the expressions have the same denominator we simply subtract the numerators:</p>
<p><code>\dfrac{<var>NUMERATOR1</var> - (<var>NUMERATOR2</var>)}{<var>DENOMINATOR</var>}</code></p>
</div>
<div>
<p>Distribute the negative sign:</p>
<p><code>\dfrac{<var>NUMERATOR1</var> + <var>NUMERATOR2.multiply(-1)</var>}{<var>DENOMINATOR</var>}</code></p>
</div>
</div>
<div data-if="SIGN === '+'">
<p>Since the expressions have the same denominator we simply combine the numerators:</p>
<p><code>\dfrac{<var>NUMERATOR1</var> + <var>NUMERATOR2</var>}{<var>DENOMINATOR</var>}</code></p>
</div>
<div>
<p>Combine like terms:</p>
<code>\dfrac{<var>NUMERATORSUM</var>}{<var>DENOMINATOR</var>}</code>
</div>
<div data-if="FACTOR.toString() !== '1'">
<p>Simplify by dividing numerator and denominator by <var>FACTOR</var>:</p>
<p><code>\dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code></p>
</div>
</div>
</div>
</body>
</html>