diff --git a/exercises/factoring_polynomials_to_solve_1.html b/exercises/factoring_polynomials_to_solve_1.html new file mode 100644 index 000000000..d45de680b --- /dev/null +++ b/exercises/factoring_polynomials_to_solve_1.html @@ -0,0 +1,96 @@ + + + + + Factoring Polynomials to Solve for the Unknown (A=1) + + + +
+
+
+
+ MathModel.init() + randRangeNonZero(-4, 4) + randRange(6, 19) + randRange(20, 29) + a_val+b_val + a_val*b_val + MATH.parse("x^2+"+B+"x+"+C+"=0") +
+
+

+ Solve for x given the following equation: +

+

+ MATH.format(PROBLEM, "large") +

+
+ +
+
-a_val
+
-b_val
+
+

x = \quad\quad \text{or} \quad x = \quad

+
+
+ + +
+

+ Recognize that the left hand side expression is of the form + MATH.format("x^2+Bx+C", "normalsize", KhanUtil.BLUE) + , which can be factored by grouping. +

+

+ Find the factors + MATH.format("a", "normalsize", KhanUtil.BLUE) and + MATH.format("b", "normalsize", KhanUtil.BLUE) of the value of + MATH.format("C="+C, "normalsize", KhanUtil.BLUE) whose sum is the value of + MATH.format("B="+B, "normalsize", KhanUtil.BLUE). +

+

+ MATH.format("a="+a_val, "normalsize", KhanUtil.BLUE)
+ MATH.format("b="+b_val, "normalsize", KhanUtil.BLUE) +

+

+ Rewrite the middle term of the original equation using these factors to form + two groups. +

+

+ MATH.format("x^2+"+a_val+"x+"+b_val+"x+"+C+"=0", "normalsize", KhanUtil.BLUE) +

+

+ Factor the first two terms terms and the second two terms. +

+

+ MATH.format("x(x+"+a_val+")+"+b_val+"(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE) +

+

+ Redistribute the common term to get the answer. +

+

+ MATH.format("(x+"+b_val+")(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE) +

+

+ Recall that for the left hand side to be equal to zero one or both of the terms being multiplied must be equal to zero. +

+

+ MATH.format("(x+"+b_val+")=0", "normalsize", KhanUtil.BLUE) + or + MATH.format("(x+"+a_val+")=0", "normalsize", KhanUtil.BLUE) +

+

+ Therefore the solutions are: +

+

+ MATH.format("x="+(-b_val), "large", KhanUtil.GREEN) + or + MATH.format("x="+(-a_val), "large", KhanUtil.GREEN) +

+
+
+
+
+ + diff --git a/exercises/factoring_polynomials_to_solve_2.html b/exercises/factoring_polynomials_to_solve_2.html new file mode 100644 index 000000000..d29e997f9 --- /dev/null +++ b/exercises/factoring_polynomials_to_solve_2.html @@ -0,0 +1,106 @@ + + + + + Factoring Polynomials to Solve for the Unknown (A!=1) + + + +
+
+
+
+ MathModel.init() + randRange(2, 9) + randFromArray([-1, 1]) + randFromArrayExclude([3, 5, 7, 9], [a]) + b_sign*b_abs + randFromArrayExclude(getFactors(a*b_abs), [1]) + a+b + a*b/A + getGCD(A, a) + b_sign*getGCD(b_abs, C) + MATH.parse(A+"x^2+"+B+"x+"+C+"=0") + MATH.parse("("+F1+"x+"+F2+")("+A/F1+"x+"+a/F1+")=0") + MATH.parse(F1+"x("+A/F1+"x+"+a/F1+")+"+F2+"("+b/F2+"x+"+C/F2+")=0") + MATH.parse("x=1/2") + (-F2)/F1 + (-a/F1)/(A/F1) +
+
+

+ Solve for x given the following equation: +

+

+ MATH.format(PROBLEM, "large") +

+
+ +
+
A1
+
A2
+
+

x = \quad + \quad \text{or} \quad x = \quad +

+
+
+ +
+

+ Recognize that the left hand side expression is of the form + MATH.format("Ax^2+Bx+C", "normalsize", KhanUtil.BLUE) + , which can be factored by grouping. +

+

+ Find the factors + MATH.format("a", "normalsize", KhanUtil.BLUE) and + MATH.format("b", "normalsize", KhanUtil.BLUE) of the value of + MATH.format("A*C="+(A*C), "normalsize", KhanUtil.BLUE) whose sum is the value of + MATH.format("B="+B, "normalsize", KhanUtil.BLUE). +

+

+ MATH.format("a="+a, "normalsize", KhanUtil.BLUE)
+ MATH.format("b="+b, "normalsize", KhanUtil.BLUE) +

+

+ Rewrite the middle term of the original equation using these factors to form + two groups. +

+

+ MATH.format(A+"x^2+"+a+"x+"+b+"x+"+C+"=0", "normalsize", KhanUtil.BLUE) +

+

+ Factor the first two terms terms and the second two terms. +

+

+ MATH.format(HINT1, "normalsize", KhanUtil.BLUE) +

+

+ Redistribute the common term to get the answer. +

+

+ MATH.format("("+F1+"x+"+F2+")("+A/F1+"x+"+a/F1+")=0", "normalsize", KhanUtil.BLUE) +

+

+ Recall that for the left hand side to be equal to zero one or both of the terms being multiplied must be equal to zero. + Therefore, if x satisfies either of the following equations it satisfies the original equation. +

+

+ MATH.format(F1+"x+"+F2+"=0", "normalsize", KhanUtil.BLUE)
+ MATH.format(A/F1 + "x+" + a/F1 + "=0", "normalsize", KhanUtil.BLUE) +

+

+ Solve for x in both equations. +

+

+ MATH.format("x="+"-"+F2+"/"+F1, "normalsize", KhanUtil.GREEN)\quad + or + \quadMATH.format("x="+"-"+a/F1+"/"+A/F1, "normalsize", KhanUtil.GREEN) +

+
+
+
+
+ + diff --git a/utils/math-model.js b/utils/math-model.js index 7e73fe0d0..4c144103d 100644 --- a/utils/math-model.js +++ b/utils/math-model.js @@ -102,7 +102,7 @@ jQuery.extend ( KhanUtil, { tokenToOperator[TK_PM] = OpStr.PM; tokenToOperator[TK_CARET] = OpStr.POW; tokenToOperator[TK_MUL] = OpStr.MUL; - tokenToOperator[TK_DIV] = OpStr.DIV; + tokenToOperator[TK_DIV] = OpStr.FRAC; tokenToOperator[TK_SIN] = OpStr.SIN; tokenToOperator[TK_COS] = OpStr.COS; tokenToOperator[TK_TAN] = OpStr.TAN; @@ -303,7 +303,7 @@ jQuery.extend ( KhanUtil, { if (expr2===1) { expr = expr; } - else if (expr === 1) { + else if (t===TK_MUL && expr===1) { expr = expr2; } else {