Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 138 lines (125 sloc) 6.496 kb
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
1 <!DOCTYPE html>
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
2 <html data-require="math math-format rational-expressions">
cde9e9f John Resig Re-run the exercises through the updated cleaner.
jeresig authored
3 <head>
0f0c630 Michael Chang Clean up the exercise files using the new cleaning utility. (II)
cbhl authored
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
5 <title>Simplifying rational expressions 2</title>
ac1415e Ben Alpert Use requirejs for module loading
spicyj authored
6 <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
7 <script type="text/javascript">
9622a5a Peter Collingridge Fix regex
petercollingridge authored
8 function getFactoredTerm(term) {
9 var expr = ""
10 if (term < 0) {
11 expr += " - ";
12 }
13 if (term !== 0) {
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
14 expr += "(" + KhanUtil.getPrimeFactorization(Math.abs(term)).join("\\cdot");
9622a5a Peter Collingridge Fix regex
petercollingridge authored
15 }
16 return expr;
17 };
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
18 function getFactoredExpression(factor, coefficient, vari, degree, constant) {
9622a5a Peter Collingridge Fix regex
petercollingridge authored
19 var expr = ""
20 var term1 = getFactoredTerm(factor * coefficient);
21 var term2 = getFactoredTerm(factor * constant);
22
23 if (term1 !== "") {
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
24 expr += term1;
25 for (var i=0; i<=degree; i++) {
26 expr += " \\cdot " + vari;
27 }
28 expr += ")";
9622a5a Peter Collingridge Fix regex
petercollingridge authored
29 if (term2 !== "") {
30 expr += " \+ ";
31 }
32 }
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
33
34 if (term2 !== "") {
35 expr += term2;
36 for (var i=0; i<degree; i++) {
37 expr += " \\cdot " + vari;
38 }
39 expr += ")";
40 }
41
9622a5a Peter Collingridge Fix regex
petercollingridge authored
42 return expr;
43 };
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
44 </script>
45 </head>
46 <body>
47 <div class="exercise">
48 <div class="problems">
49 <div>
57067cf maik ensure that NUMERATOR is not divisible by DENOMINATOR, fix #160476
mauk81 authored
50 <div class="vars" data-ensure="!NUMERATOR.divide(DENOMINATOR)">
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
51 <var id="X">randVar()</var>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
52 <div data-ensure="COEFFICIENT1 !== 0 || CONSTANT1 !== 0">
e56e60b Peter Collingridge Fix hints (nearly)
petercollingridge authored
53 <var id="COEFFICIENT1">randRangeWeighted(-10, 10, 0, 0.15)</var>
54 <var id="CONSTANT1">randRangeWeighted(-10, 10, 0, 0.15)</var>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
55 </div>
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
56 <var id="COEFFICIENT2" data-ensure="COEFFICIENT1 !== 0 || COEFFICIENT2 !== 0">randRangeWeighted(-10, 10, 0, 0.15)</var>
4469124 Ben Eater Add a statement to assume x != 0 for simplifying rational expressions
beneater authored
57
5721a0c Peter Collingridge Ensure terms in the answer do not have a common factor
petercollingridge authored
58 <var id="CONSTANT2">(function() {
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
59 if (getGCD(COEFFICIENT1, CONSTANT1) !== 1 &amp;&amp; getGCD(COEFFICIENT2, CONSTANT1) !== 1) {
5721a0c Peter Collingridge Ensure terms in the answer do not have a common factor
petercollingridge authored
60 // Ensure there are no common factors
61 return randFromArray([-13, -11, -1, 1, 11, 13]);
62 } else {
63 if (COEFFICIENT2 !== 0) {
64 return randRangeWeighted(-10, 10, 0, 0.15);
65 } else {
66 return randRangeExclude(-10, 10, [0]);
67 }
68 }
69 })()</var>
70
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
71 <var id="FACTOR">randRange(2, 12)</var>
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
72 <var id="DEGREE">randRangeWeighted(0, 2, 0, 0.5)</var>
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
73 <var id="FACTORDEGREE">(function() {
74 var d = {};
75 d[X] = DEGREE;
76 return new Term(FACTOR, d);
77426f4 Peter Collingridge No longer accept answers with a negative denominator
petercollingridge authored
77 })()
78 </var>
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
79 <var id="NUMERSOL">new RationalExpression([[COEFFICIENT1, X], CONSTANT1])</var>
80 <var id="DENOMSOL">new RationalExpression([[COEFFICIENT2, X], CONSTANT2])</var>
81 <var id="NUMERATOR">NUMERSOL.multiply(FACTORDEGREE)</var>
82 <var id="DENOMINATOR">DENOMSOL.multiply(FACTORDEGREE)</var>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
83 </div>
84
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
85 <p class="problem">Simplify the following expression:</p>
86 <p class="question"><code>\dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
87 <p><em>You can assume <code><var>X</var> \neq 0</code>.</em></p>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
88
cdb9df4 Ben Eater Convert lots of exercises that use regex to use expression entry
beneater authored
89 <div class="solution" data-type="multiple">
0bd6737 Peter Collingridge Allow expression answer type to take a set of answers
petercollingridge authored
90 <div class="sol" data-type="expression">
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
91 <div class="set-sol" data-same-form="">(<var>NUMERSOL.toString()</var>)/(<var>DENOMSOL.toString()</var>)</div>
92 <div class="set-sol" data-same-form="">(<var>NUMERSOL.toString()</var>)/(<var>DENOMSOL.toStringFactored()</var>)</div>
93 <div class="set-sol" data-same-form="">(<var>NUMERSOL.toStringFactored()</var>)/(<var>DENOMSOL.toString()</var>)</div>
94 <div class="set-sol" data-same-form="">(<var>NUMERSOL.toStringFactored()</var>)/(<var>DENOMSOL.toStringFactored()</var>)</div>
baf3e43 Peter Collingridge Simplifying simplifying exercises
petercollingridge authored
95 </div>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
96 </div>
97
98 <div class="hints">
e56e60b Peter Collingridge Fix hints (nearly)
petercollingridge authored
99 <p>Find the greatest common factor of the numerator and denominator.</p>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
100
9622a5a Peter Collingridge Fix regex
petercollingridge authored
101 <div>
45a9373 Peter Collingridge Improve hint layout
petercollingridge authored
102 <p>
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
103 </p><div>The numerator can be factored:</div>
ce13849 Peter Collingridge Additional hint
petercollingridge authored
104 <div><code><var>NUMERATOR</var> = <var>getFactoredExpression(FACTOR, COEFFICIENT1, X, DEGREE, CONSTANT1)</var></code></div>
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
105 <p></p>
45a9373 Peter Collingridge Improve hint layout
petercollingridge authored
106 <p>
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
107 </p><div>The denominator can be factored:</div>
ce13849 Peter Collingridge Additional hint
petercollingridge authored
108 <div><code><var>DENOMINATOR</var> = <var>getFactoredExpression(FACTOR, COEFFICIENT2, X, DEGREE, CONSTANT2)</var></code></div>
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
109 <p></p>
9622a5a Peter Collingridge Fix regex
petercollingridge authored
110 </div>
111
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
112 <p>The greatest common factor of all the terms is <code><var>FACTORDEGREE</var></code>.</p>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
113
114 <div>
ce13849 Peter Collingridge Additional hint
petercollingridge authored
115 <p>Factoring out <code><var>FACTORDEGREE</var></code> gives us:</p>
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
116 <div><code>
117 \qquad \dfrac{(<var>FACTORDEGREE</var>)(<var>NUMERSOL</var>)}
118 {(<var>FACTORDEGREE</var>)(<var>DENOMSOL</var>)}
119 </code></div>
ce13849 Peter Collingridge Additional hint
petercollingridge authored
120 </div>
121
122 <div>
1154d38 Peter Collingridge Expand questions to include factor with powers of a variable
petercollingridge authored
123 <p>Dividing both the numerator and denominator by <code><var>FACTORDEGREE</var></code> gives:</p>
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
124 <div data-if="DENOMSOL.toString() === '1'">
125 <code>\qquad \dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code> or more simply,
126 <code><var>NUMERSOL</var></code>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
127 </div>
e9807ff John Resig Clean up the exercise files using the new cleaning utility.
jeresig authored
128 <div data-else="">
e7728e1 Peter Collingridge Allow answers to ignore the denominator when it's 1
petercollingridge authored
129 <code>\qquad \dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code>
8443c79 Peter Collingridge Start simplifying rational expressions 2
petercollingridge authored
130 </div>
131 </div>
132 </div>
133 </div>
134 </div>
135 </div>
cde9e9f John Resig Re-run the exercises through the updated cleaner.
jeresig authored
136 </body>
137 </html>
Something went wrong with that request. Please try again.