Permalink
Fetching contributors…
Cannot retrieve contributors at this time
138 lines (125 sloc) 6.34 KB
<!DOCTYPE html>
<html data-require="math math-format rational-expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simplifying rational expressions 2</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
function getFactoredTerm(term) {
var expr = ""
if (term < 0) {
expr += " - ";
}
if (term !== 0) {
expr += "(" + KhanUtil.getPrimeFactorization(Math.abs(term)).join("\\cdot");
}
return expr;
};
function getFactoredExpression(factor, coefficient, vari, degree, constant) {
var expr = ""
var term1 = getFactoredTerm(factor * coefficient);
var term2 = getFactoredTerm(factor * constant);
if (term1 !== "") {
expr += term1;
for (var i=0; i<=degree; i++) {
expr += " \\cdot " + vari;
}
expr += ")";
if (term2 !== "") {
expr += " \+ ";
}
}
if (term2 !== "") {
expr += term2;
for (var i=0; i<degree; i++) {
expr += " \\cdot " + vari;
}
expr += ")";
}
return expr;
};
</script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars" data-ensure="!NUMERATOR.divide(DENOMINATOR)">
<var id="X">randVar()</var>
<div data-ensure="COEFFICIENT1 !== 0 || CONSTANT1 !== 0">
<var id="COEFFICIENT1">randRangeWeighted(-10, 10, 0, 0.15)</var>
<var id="CONSTANT1">randRangeWeighted(-10, 10, 0, 0.15)</var>
</div>
<var id="COEFFICIENT2" data-ensure="COEFFICIENT1 !== 0 || COEFFICIENT2 !== 0">randRangeWeighted(-10, 10, 0, 0.15)</var>
<var id="CONSTANT2">(function() {
if (getGCD(COEFFICIENT1, CONSTANT1) !== 1 &amp;&amp; getGCD(COEFFICIENT2, CONSTANT1) !== 1) {
// Ensure there are no common factors
return randFromArray([-13, -11, -1, 1, 11, 13]);
} else {
if (COEFFICIENT2 !== 0) {
return randRangeWeighted(-10, 10, 0, 0.15);
} else {
return randRangeExclude(-10, 10, [0]);
}
}
})()</var>
<var id="FACTOR">randRange(2, 12)</var>
<var id="DEGREE">randRangeWeighted(0, 2, 0, 0.5)</var>
<var id="FACTORDEGREE">(function() {
var d = {};
d[X] = DEGREE;
return new Term(FACTOR, d);
})()
</var>
<var id="NUMERSOL">new RationalExpression([[COEFFICIENT1, X], CONSTANT1])</var>
<var id="DENOMSOL">new RationalExpression([[COEFFICIENT2, X], CONSTANT2])</var>
<var id="NUMERATOR">NUMERSOL.multiply(FACTORDEGREE)</var>
<var id="DENOMINATOR">DENOMSOL.multiply(FACTORDEGREE)</var>
</div>
<p class="problem">Simplify the following expression:</p>
<p class="question"><code>\dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
<p><em>You can assume <code><var>X</var> \neq 0</code>.</em></p>
<div class="solution" data-type="multiple">
<div class="sol" 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 class="hints">
<p>Find the greatest common factor of the numerator and denominator.</p>
<div>
<p>
</p><div>The numerator can be factored:</div>
<div><code><var>NUMERATOR</var> = <var>getFactoredExpression(FACTOR, COEFFICIENT1, X, DEGREE, CONSTANT1)</var></code></div>
<p></p>
<p>
</p><div>The denominator can be factored:</div>
<div><code><var>DENOMINATOR</var> = <var>getFactoredExpression(FACTOR, COEFFICIENT2, X, DEGREE, CONSTANT2)</var></code></div>
<p></p>
</div>
<p>The greatest common factor of all the terms is <code><var>FACTORDEGREE</var></code>.</p>
<div>
<p>Factoring out <code><var>FACTORDEGREE</var></code> gives us:</p>
<div><code>
\qquad \dfrac{(<var>FACTORDEGREE</var>)(<var>NUMERSOL</var>)}
{(<var>FACTORDEGREE</var>)(<var>DENOMSOL</var>)}
</code></div>
</div>
<div>
<p>Dividing both the numerator and denominator by <code><var>FACTORDEGREE</var></code> gives:</p>
<div data-if="DENOMSOL.toString() === '1'">
<code>\qquad \dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code> or more simply,
<code><var>NUMERSOL</var></code>
</div>
<div data-else="">
<code>\qquad \dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>