Skip to content
This repository
Browse code

Add a statement to assume x != 0 for simplifying rational expressions

fix #42324

Test plan: load each exercise locally and make sure it displays properly

Auditors: peter, cbhl
  • Loading branch information...
commit 44691243d32b442f0c384c060acedec827db3053 1 parent 36051ed
Ben Eater authored
5  exercises/simplifying_rational_expressions_1.html
@@ -81,11 +81,12 @@
81 81
                 <var id="SOLUTION">getSolution(COEFFICIENT1, COEFFICIENT2, DEGREE1, DEGREE2, X)</var>
82 82
             </div>
83 83
 
84  
-            <p class="problem">Simplify the expression.</p>
85  
-            <p class="question">
  84
+            <p class="question">Simplify the following expression:</p>
  85
+            <p>
86 86
                 <code><var>Y</var> = \dfrac{<var>NUMERATORCOEFFICIENT</var><var>POWER1</var>}
87 87
                      {<var>DENOMINATORCOEFFICIENT</var><var>POWER2</var>}</code>
88 88
             </p>
  89
+            <p>You can assume <code><var>X</var> \neq 0</code>.</p>
89 90
 
90 91
             <div class="solution" data-type="set">
91 92
                 <div class="set-sol" data-type="multiple">
9  exercises/simplifying_rational_expressions_2.html
@@ -75,7 +75,7 @@
75 75
                     <div data-ensure="COEFFICIENT1 !== 0 || COEFFICIENT2 !== 0">
76 76
                         <var id="COEFFICIENT2">randRangeWeighted(-10, 10, 0, 0.15)</var>
77 77
                     </div>
78  
-        
  78
+
79 79
                     <var id="CONSTANT2">(function() {
80 80
                         if (getGCD(COEFFICIENT1, CONSTANT1) !== 1 && getGCD(COEFFICIENT2, CONSTANT1) !== 1) {
81 81
                             // Ensure there are no common factors
@@ -104,8 +104,9 @@
104 104
                     <var id="NEGATIVEDENOMINATOR">getExpressionRegex(-COEFFICIENT2, X, -CONSTANT2)</var>
105 105
                 </div>
106 106
 
107  
-                <p class="problem">Simplify the following expression:</p>
108  
-                <p class="question"><code><var>Y</var> = \dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
  107
+                <p class="question">Simplify the following expression:</p>
  108
+                <p><code><var>Y</var> = \dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
  109
+                <p>You can assume <code><var>X</var> \neq 0</code>.</p>
109 110
 
110 111
                 <div class="solution" data-type="set">
111 112
                     <div class="set-sol" data-type="multiple">
@@ -183,4 +184,4 @@
183 184
         </div>
184 185
     </div>
185 186
 </body>
186  
-</html>
  187
+</html>
7  exercises/simplifying_rational_expressions_3.html
@@ -75,8 +75,9 @@
75 75
             </div>
76 76
         </div>
77 77
 
78  
-        <p class="problem">Simplify the following expression:</p>
79  
-        <p class="question"><code><var>Y</var> = \dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
  78
+        <p class="question">Simplify the following expression:</p>
  79
+        <p><code><var>Y</var> = \dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
  80
+        <p>You can assume <code><var>X</var> \neq 0</code>.</p>
80 81
 
81 82
         <div class="solution" data-type="set">
82 83
             <div class="set-sol" data-type="multiple">
@@ -142,4 +143,4 @@
142 143
         </div>
143 144
     </div>
144 145
 </body>
145  
-</html>
  146
+</html>

3 notes on commit 4469124

Peter Collingridge
Collaborator

Thanks for that. For some of the exercises you divide by (x - 3) so there are some other exceptions, but if you say what they are that will make the answer more obvious.

Ben Eater
Owner

Oh hrm.. I didn't think of that. If you wanna take a stab at a better fix, feel free.

Peter Collingridge
Collaborator

I guess the ideal solution would be to ask them to include the domain of the new expression, which would be possible, but would require a bit of work.

Please sign in to comment.
Something went wrong with that request. Please try again.