Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allowing free input for diff of squares 3, fixing factoring_polynomia…

…ls_3, renaming factoring_simple_expresions into common_factors_of_a_polynamial
  • Loading branch information...
commit f6df2fbb902f8bc89655deeb51ed962abdf547d6 1 parent e8263c5
@mathiash mathiash authored
View
33 exercises/common_factors_of_a_polynomial_1.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html data-require="math graphie math-model factoring-expressions simplify subhints">
+<head>
+ <meta charset="UTF-8" />
+ <title>Common factors of a polynomial 1</title>
+ <script src="../khan-exercise.js"></script>
+</head>
+<body>
+ <div class="exercise">
+ <div class="vars">
+ <var id="X">{op:"var", args:["x"]}</var>
+ <var id="Y">{op:"var", args:["y"]}</var>
+ <var id="Z">{op:"var", args:["z"]}</var>
+ <var id="PROBLEM">genFactoringExercise([2, 3, 5, 7, X, Y, Z], 2, 3)</var>
+ <var id="SOLUTION">solveFactoringExercise(PROBLEM.question)</var>
+ </div>
+ <div class="problems">
+ <div>
+ <p class="problem">Factor the following expression by finding the common factors of its terms:</p>
+ <p class="question"><code><var>format(PROBLEM.question)</var></code></p>
+ <p class="solution"><code><var>format(SOLUTION.solution)</var></code></p>
+
+ <ul class="choices" data-none="true" data-show="5">
+ <li data-each="PROBLEM.choices as key, value"><code><var>format(value)</var></code></li>
+ </ul>
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
+</body>
+</html>
View
34 exercises/common_factors_of_a_polynomial_2.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html data-require="math graphie math-model factoring-expressions simplify">
+<head>
+ <meta charset="UTF-8" />
+ <title>Common factors of a polynomial 2</title>
+ <script src="../khan-exercise.js"></script>
+</head>
+<body>
+ <div class="exercise">
+ <div class="vars">
+ <var id="W">{op:"var", args:["w"]}</var>
+ <var id="X">{op:"var", args:["x"]}</var>
+ <var id="Y">{op:"var", args:["y"]}</var>
+ <var id="Z">{op:"var", args:["z"]}</var>
+ <var id="PROBLEM">genFactoringExercise([2, 3, 5, 7, W, X, Y, Z], 3, 4)</var>
+ <var id="SOLUTION">solveFactoringExercise(PROBLEM.question)</var>
+ </div>
+ <div class="problems">
+ <div>
+ <p class="problem">Factor the following expression by finding the common factors of its terms:</p>
+ <p class="question"><code><var>format(PROBLEM.question)</var></code></p>
+ <p class="solution"><code><var>format(SOLUTION.solution)</var></code></p>
+
+ <ul class="choices" data-none="true" data-show="5">
+ <li data-each="PROBLEM.choices as key, value"><code><var>format(value)</var></code></li>
+ </ul>
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
+</body>
+</html>
View
102 exercises/factoring_difference_of_squares_3.html
@@ -1,46 +1,68 @@
<!DOCTYPE html>
-<html data-require="math ast math-model factoring-expressions expr-helpers expr-normal-form simplify steps-helpers subhints">
+<html data-require="math math-model factoring-expressions simplify subhints">
<head>
- <meta charset="UTF-8" />
- <title>Factoring difference of squares 3</title>
- <script src="../khan-exercise.js"></script>
- <style type="text/css">
- #answer_area input[type=text] {
- width: 20px;
- }
- </style>
+ <meta charset="UTF-8" />
+ <title>Factoring difference of squares 3</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="problems">
- <div>
- <div class="vars" data-ensure="getGCD( A, B ) === 1">
- <var id="MATH">MathModel.init()</var>
- <var id="F">randFromArray([2,3,5])</var>
- <var id="A">randRange( 2, 6 )</var>
- <var id="B">randRange( 1, 6 )</var>
- <var id="SQUARE">F * A * A</var>
- <var id="CONSTANT">F * -B * B</var>
- <var id="PROBLEM">MATH.parse(SQUARE + "x^2" + CONSTANT)</var>
- <var id="SOLUTION">solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:true})</var>
- </div>
- <div>
- <p class="question">
- Factor the following expression:
- </p>
- <p>
- <code><var>MATH.format(PROBLEM)</var></code>
- </p>
- </div>
- <div class="solution" data-type="multiple">
- <p><span class="sol"><var>F</var></span>(<span class="sol"><var>A</var></span><code>x</code> - <span class="sol"><var>B</var></span>)(<span class="sol"><var>A</var></span><code>x</code> + <span class="sol"><var>B</var></span>)</p>
- <p class="example">enter a (possibly negative) integer for each input area.</p>
- </div>
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
+ <div class="exercise">
+ <div class="problems">
+ <div>
+ <div class="vars" data-ensure="getGCD( A, B ) === 1">
+ <var id="F">randFromArray([2,3,5])</var>
+ <var id="A">randRange(2, 6)</var>
+ <var id="B">randRange(1, 6)</var>
+ <var id="SQUARE">F * A * A</var>
+ <var id="CONSTANT">F * -B * B</var>
+ <var id="PROBLEM">parse(SQUARE + "x^2" + CONSTANT)</var>
+ <var id="SOLUTION">solveFactoringExercise(PROBLEM, {factorDiffOfSquares:true})</var>
+ <var id="a">SOLUTION.solution.args[1].args[0].args[0].args[0]</var>
+ <var id="b">SOLUTION.solution.args[1].args[1].args[1]</var>
+ <!-- isEqual doesn't have options to deal with this automatically yet -->
+ <var id="SOL1">parse(F + "(" + a + "x" + "-" + b + ")(" + a + "x" + "+" + b + ")")</var>
+ <var id="SOL2">parse(F + "(" + a + "x" + "+" + b + ")(" + a + "x" + "-" + b + ")")</var>
+ <var id="SOL3">parse(-F + "(" + -a + "x" + "+" + b + ")(" + a + "x" + "+" + b + ")")</var>
+ <var id="SOL4">parse(-F + "(" + a + "x" + "-" + b + ")(" + -a + "x" + "-" + b + ")")</var>
+ <var id="SOL5">parse(-F + "(" + a + "x" + "+" + b + ")(" + -a + "x" + "+" + b + ")")</var>
+ <var id="SOL6">parse(-F + "(" + -a + "x" + "-" + b + ")(" + a + "x" + "-" + b + ")")</var>
+ </div>
+ <div>
+ <p class="question">
+ Factor the following expression:
+ </p>
+ <p>
+ <code><var>format(PROBLEM)</var></code>
+ </p>
+ </div>
+ <div class="solution" data-type="custom">
+ <div class="instruction">
+ <input name="response" type="text">
+ </div>
+ <div class="guess">$( "div.instruction input" ).val()</div>
+ <div class="validator-function">
+ var exprGuess = simplify(parse(guess), simplifyOptions.checkInput);
+ return (isEqual(exprGuess, SOL1) || isEqual(exprGuess, SOL2) || isEqual(exprGuess, SOL3) ||
+ isEqual(exprGuess, SOL4) || isEqual(exprGuess, SOL5) || isEqual(exprGuess, SOL6));
+ </div>
+ <div class="show-guess">
+ </div>
+ <div class="show-guess-solutionarea">
+ $( "div.instruction input" ).val( guess );
+ </div>
+ <div class="example">a factored expression, like <b>(x+1)(x+3)</b></div>
+ </div>
+<!--
+ <div class="solution" data-type="multiple">
+ <p><span class="sol"><var>F</var></span>(<span class="sol"><var>A</var></span><code>x</code> - <span class="sol"><var>B</var></span>)(<span class="sol"><var>A</var></span><code>x</code> + <span class="sol"><var>B</var></span>)</p>
+ <p class="example">enter a (possibly negative) integer for each input area.</p>
+ </div>
+-->
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
</body>
</html>
View
102 exercises/factoring_difference_of_squares_4.html
@@ -1,61 +1,53 @@
<!DOCTYPE html>
-<html data-require="math ast math-model factoring-expressions expr-helpers expr-normal-form simplify steps-helpers subhints">
+<html data-require="math math-model factoring-expressions simplify subhints">
<head>
- <meta charset="UTF-8" />
- <title>Factoring difference of squares 4</title>
- <script src="../khan-exercise.js"></script>
- <style type="text/css">
- #answer_area input[type=text] {
- width: 20px;
- }
- </style>
+ <meta charset="UTF-8" />
+ <title>Factoring difference of squares 4</title>
+ <script src="../khan-exercise.js"></script>
+ <style type="text/css">
+ #answer_area input[type=text] {
+ width: 20px;
+ }
+ </style>
</head>
<body>
- <div class="exercise">
- <div class="problems">
- <div>
- <div class="vars" data-ensure="getGCD( A, B ) === 1">
- <var id="MATH">MathModel.init()</var>
- <var id="F">randFromArray([2,3,5])</var>
- <var id="A">randRange( 2, 6 )</var>
- <var id="B">randRange( 1, 6 )</var>
- <var id="P">randRange( 2, 3 )</var>
- <var id="SQUARE">F * A * A</var>
- <var id="CONSTANT">F * -B * B</var>
- <var id="PROBLEM">MATH.parse(SQUARE + "x^" + (2*P) + CONSTANT)</var>
- <var id="SOLUTION">solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:true})</var>
- <var id="ERRORS">[
- MATH.format(solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:false}).solution),
- MATH.format(solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:"a^2-b^2=(a-b)^2"}).solution),
- MATH.format(solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:"a^2-b^2=(a-b)(b-a)"}).solution),
- MATH.format(solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:"a^2-b^2 = (a^2-b^2)(a^2+b^2)"}).solution),
- MATH.format(solveFactoringExercise(MATH, PROBLEM, {factorDiffOfSquares:true, factorWithDiffOfSquares:"a(b^2-c^2)=(ab-ac)(a+c))"}).solution),
- ]</var>
- </div>
- <div>
- <p class="question">
- Factor the following expression:
- </p>
- <p>
- <code><var>MATH.format(PROBLEM)</var></code>
- </p>
- </div>
- <p class="solution"><code><var>MATH.format(SOLUTION.solution)</var></code></p>
-<!--
- <div class="solution" data-type="multiple">
- <p><span class="sol"><var>F</var></span>(<span class="sol"><var>A</var></span><code>x</code><span class="sol exp"><var>P</var></span> - <span class="sol"><var>B</var></span>)(<span class="sol"><var>A</var></span><code>x</code><span class="sol exp"><var>P</var></span> + <span class="sol"><var>B</var></span>)</p>
- <p class="example">enter a (possibly negative) integer for each input area.</p>
- </div>
--->
- <ul class="choices" data-none="true" data-show="5">
- <li data-each="ERRORS as key, value"><code><var>value</var></code></li>
- </ul>
-
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
+ <div class="exercise">
+ <div class="problems">
+ <div>
+ <div class="vars" data-ensure="getGCD( A, B ) === 1">
+ <var id="F">randFromArray([2,3,5])</var>
+ <var id="A">randRange( 2, 6 )</var>
+ <var id="B">randRange( 1, 6 )</var>
+ <var id="P">randRange( 2, 3 )</var>
+ <var id="SQUARE">F * A * A</var>
+ <var id="CONSTANT">F * -B * B</var>
+ <var id="PROBLEM">parse(SQUARE + "x^" + (2*P) + CONSTANT)</var>
+ <var id="SOLUTION">solveFactoringExercise(PROBLEM, {factorDiffOfSquares:true})</var>
+ <var id="ERRORS">[
+ format(solveFactoringExercise(PROBLEM, {factorDiffOfSquares:false}).solution),
+ format(solveFactoringExercise(PROBLEM, {factorDiffOfSquares:"a^2-b^2=(a-b)^2"}).solution),
+ format(solveFactoringExercise(PROBLEM, {factorDiffOfSquares:"a^2-b^2=(a-b)(b-a)"}).solution),
+ format(solveFactoringExercise(PROBLEM, {factorDiffOfSquares:"a^2-b^2 = (a^2-b^2)(a^2+b^2)"}).solution),
+ format(solveFactoringExercise(PROBLEM, {factorDiffOfSquares:true, factorWithDiffOfSquares:"a(b^2-c^2)=(ab-ac)(a+c))"}).solution),
+ ]</var>
+ </div>
+ <div>
+ <p class="question">
+ Factor the following expression:
+ </p>
+ <p>
+ <code><var>format(PROBLEM)</var></code>
+ </p>
+ </div>
+ <p class="solution"><code><var>format(SOLUTION.solution)</var></code></p>
+ <ul class="choices" data-none="true" data-show="5">
+ <li data-each="ERRORS as key, value"><code><var>value</var></code></li>
+ </ul>
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
</body>
</html>
View
189 exercises/factoring_polynomials_3.html
@@ -1,100 +1,103 @@
<!DOCTYPE html>
-<html data-require="math graphie ast math-model expr-helpers expr-normal-form steps-helpers simplify">
+<html data-require="math graphie math-model simplify">
<head>
- <meta charset="UTF-8" />
- <title>Factoring polynomials 3</title>
- <script src="../khan-exercise.js"></script>
+ <meta charset="UTF-8" />
+ <title>Factoring polynomials 3</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="problems">
- <div>
- <div class="vars">
- <var id="MATH">MathModel.init()</var>
- <var id="a">randRange( 2, 9 )</var>
- <var id="b_sign">randFromArray([ -1, 1 ])</var>
- <var id="b_abs">randFromArrayExclude( [ 3, 5, 7, 9 ], [ a ] )</var>
- <var id="b">b_sign*b_abs</var>
- <var id="A">randFromArrayExclude( getFactors( a * b_abs ), [ 1 ] )</var>
- <var id="B">a + b</var>
- <var id="C">a * b / A</var>
- <var id="F1">getGCD( A, a )</var>
- <var id="F2">b_sign * getGCD( b_abs, C )</var>
- <var id="PROBLEM">simplify(MATH.polynomial([A, B, C], "x"), simplifyOptions.basic)</var>
- <!-- use parse so that the ast matches the parsed user input -->
- <var id="SOLUTION">MATH.parse( "#{(" + F1 + "x+" + F2 + ")(" + A / F1 + "x+" + a / F1 + ")}", [ORANGE] )</var>
- <var id="HINT1">MATH.parse("#{" + F1 + "x(" + A / F1 + "x+" + a / F1 + ")+" + F2 + "(" + b / F2 + "x+" + C / F2 + ")}", [BLUE] )</var>
- <var id="GROUP1">[MATH.parse("#{ab &=& A*C}#{ &=& " + (A*C) + "}", [BLUE,BLUE]), MATH.parse("#{a+b &=& B}#{ &=& " + B + "}", [BLUE, BLUE])]</var>
+ <div class="exercise">
+ <div class="problems">
+ <div>
+ <div class="vars">
+ <var id="a">randRange(2, 9)</var>
+ <var id="b_sign">randFromArray([-1, 1])</var>
+ <var id="b_abs">randFromArrayExclude([3, 5, 7, 9], [a])</var>
+ <var id="b">b_sign*b_abs</var>
+ <var id="A">randFromArrayExclude(getFactors(a * b_abs), [1])</var>
+ <var id="B">a + b</var>
+ <var id="C">a * b / A</var>
+ <var id="F1">getGCD(A, a)</var>
+ <var id="F2">b_sign * getGCD(b_abs, C)</var>
+ <var id="PROBLEM">simplify(polynomial([A, B, C], "x"), simplifyOptions.basic)</var>
+ <!-- use parse so that the ast matches the parsed user input -->
+ <var id="SOLUTION">parse("(" + F1 + "x+" + F2 + ")(" + A / F1 + "x+" + a / F1 + ")")</var>
+ <var id="HINT1">parse(F1 + "x(" + A / F1 + "x+" + a / F1 + ")+" + F2 + "(" + b / F2 + "x+" + C / F2 + ")}")</var>
+ <var id="GROUP1">[parse("#{ab} &=& #{A}*#{C} &=& " + (A*C), [GREEN, BLUE, ORANGE]),
+ parse("#{a}+#{b} &=& #{B} &=& #{" + B, [GREEN, GREEN, PINK])]</var>
- </div>
- <div>
- <p class="question">
- Factor the following expression:
- </p>
- <p>
- <code><var>MATH.format( PROBLEM, "large" )</var></code>
- </p>
- </div>
- <div class="solution" data-type="custom">
- <div class="instruction">
- <input name="response" type="text">
- </div>
- <div class="guess">jQuery( "div.instruction input" ).val()</div>
- <div class="validator-function">
- return isEqual( MATH.parse( guess ), SOLUTION );
- </div>
- <div class="show-guess">
- </div>
- <div class="show-guess-solutionarea">
- jQuery( "div.instruction input" ).val( guess );
- </div>
- <div class="example">a factored expression, like <b>(x+1)(x+2)</b></div>
- </div>
- <div class="hints">
- <p>
- The expression is of the form
- <code><var>MATH.parseFormat("#{Ax^2+Bx+C}", [BLUE], false, "normalsize")</var></code>.
- You can factor this trinomial by grouping.
- </p>
- <div>
- <p>To do this, the first step is to find two values
- <code><var>MATH.parseFormat("#a", [BLUE])</var></code> and
- <code><var>MATH.parseFormat("#b", [BLUE])</var></code>, such that
- <code><var>MATH.parseFormat("#{ab = A*C}", [BLUE])</var></code>, and
- <code><var>MATH.parseFormat("#{a+b = B}", [BLUE])</var></code>. The next step is to rewrite the
- expression as <code><var>MATH.parseFormat("Ax^2 + ax + bx + C", [BLUE])</var></code> or
- <code><var>MATH.parseFormat("(Ax^2 + ax) + (bx + C)")</var></code>, and factor each term, to
- find a common factor.</p>
- </div>
- <div>
- <p>To apply the first step, you need to find
- <code><var>MATH.parseFormat("#a", [BLUE])</var></code> and
- <code><var>MATH.parseFormat("#b", [BLUE])</var></code> such that:</p>
- <p><code><var>MATH.formatGroup(GROUP1, [0,1])</var></code></p>
- </div>
- <div>
- <p>The following values can be used:</p>
- <p><code><var>MATH.parseFormat("#{a="+a+"}", [BLUE])</var></code><br>
- <code><var>MATH.parseFormat("#{b="+b+"}", [BLUE])</var></code></p>
- </div>
- <div>
- <p>For the second step, rewrite the expression as:</p>
- <p><code><var>MATH.parseFormat("#{" + A + "x^2+" + a + "x+" + b + "x+" + C + "}", [BLUE], false, "normalsize")</var></code></p>
- <p>or</p><p><code><var>MATH.parseFormat("#{(" + A + "x^2+" + a + "x)+(" + b + "x+" + C + ")}", [BLUE], false, "normalsize")</var></code></p>
- <p>The next step is to factor both terms of the above expression</p>
- </div>
- <p>
- <code><var>MATH.format(simplify(HINT1, {del1factors:true, evalBasicNumOps:true}))</var></code>
- </p>
- <p>
- Redistribute the common term to get the answer.
- </p>
- <p>
- <code><var>MATH.format(simplify(SOLUTION, simplifyOptions.basic), false, "large")</var></code>
- </p>
- </div>
- </div>
- </div>
- </div>
+ </div>
+ <div>
+ <p class="question">
+ Factor the following expression:
+ </p>
+ <p>
+ <code><var>format(PROBLEM, "large")</var></code>
+ </p>
+ </div>
+ <div class="solution" data-type="custom">
+ <div class="instruction">
+ <input name="response" type="text">
+ </div>
+ <div class="guess">jQuery("div.instruction input").val()</div>
+ <div class="validator-function">
+ return isEqual(parse(guess), SOLUTION);
+ </div>
+ <div class="show-guess">
+ </div>
+ <div class="show-guess-solutionarea">
+ jQuery("div.instruction input").val(guess);
+ </div>
+ <div class="example">a factored expression, like <b>(x+1)(x+2)</b></div>
+ </div>
+ <div class="hints">
+ <div>
+ <p>The expression is of the form
+ <code><var>parseFormat("#{A}x^2+#{B}x+#{C}}", [BLUE, PINK, ORANGE])</var></code>.
+ You can factor this trinomial by grouping. In this case,
+ <code>\blue{A}=\blue{<var>A</var>}</code>, <code>\green{B}=\green{<var>B</var>}</code>,
+ <code>\orange{C}=\orange{<var>C</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>To do this, the first step is to find two values
+ <code>\green{a}</code> and
+ <code>\green{b}</code>, such that:</p>
+ <p><code><var>parseFormat("#{ab} = #{A}*#{C}", [GREEN, BLUE, ORANGE])</var></code></p>
+ <p><code><var>parseFormat("#{a}+#{b} = #{B}", [GREEN, GREEN, PINK])</var></code></p>
+ <p>The next step is to rewrite the
+ expression as <code><var>parseFormat("#{A}x^2 + #{a}x + #{b}x + #{C}", [BLUE, GREEN, GREEN, ORANGE])</var></code> or
+ <code><var>parseFormat("(#{A}x^2 + #{a}x) + (#{b}x + #{C})", [BLUE, GREEN, GREEN, ORANGE])</var></code>, and factor each term, to
+ find a common factor.</p>
+ </div>
+ <div>
+ <p>To apply the first step, you need to find
+ <code>\green{a}</code> and <code>\green{b}</code> such that:</p>
+ <p><code><var>formatGroup(GROUP1, [0,1])</var></code></p>
+ </div>
+ <div>
+ <p>The following values can be used:</p>
+ <p><code><var>parseFormat("#{a}=#{" + a + "}", [GREEN, GREEN])</var></code><br>
+ <code><var>parseFormat("#{b}=#{" + b + "}", [GREEN, GREEN])</var></code></p>
+ </div>
+ <div>
+ <p>For the second step, rewrite the expression as:</p>
+ <p><code><var>parseFormat("#{" + A + "}x^2+#{" + a + "}x+#{" + b + "}x+#{" + C + "}}", [BLUE, GREEN, GREEN, ORANGE])</var></code></p>
+ <p>or</p><p><code><var>parseFormat("(#{" + A + "}x^2+#{" + a + "}x)+(#{" + b + "}x+#{" + C + "})", [BLUE, GREEN, GREEN, ORANGE])</var></code></p>
+ <p>The next step is to factor both terms of the above expression:</p>
+ </div>
+ <p>
+ <code><var>format(HINT1, {del1factors:true, evalBasicNumOps:true})</var></code>
+ </p>
+ <p>
+ Redistribute the common term to get the answer:
+ </p>
+ <p>
+ <code><var>format(SOLUTION, simplifyOptions.basic, false, "large")</var></code>
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
</html>
View
34 exercises/factoring_simple_expressions_1.html
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html data-require="math graphie ast math-model factoring-expressions expr-helpers expr-normal-form simplify steps-helpers subhints">
-<head>
- <meta charset="UTF-8" />
- <title>Factoring simple expressions 1</title>
- <script src="../khan-exercise.js"></script>
-</head>
-<body>
- <div class="exercise">
- <div class="vars">
- <var id="MATH">MathModel.init()</var>
- <var id="X">{op:"var", args:["x"]}</var>
- <var id="Y">{op:"var", args:["y"]}</var>
- <var id="Z">{op:"var", args:["z"]}</var>
- <var id="PROBLEM">genFactoringExercise(MATH, [2, 3, 5, 7, X, Y, Z], 2, 3)</var>
- <var id="SOLUTION">solveFactoringExercise(MATH, PROBLEM.question)</var>
- </div>
- <div class="problems">
- <div>
- <p class="problem">Factor the following expression by finding the common factors of its terms:</p>
- <p class="question"><code><var>MATH.format(PROBLEM.question)</var></code></p>
- <p class="solution"><code><var>MATH.format(SOLUTION.solution)</var></code></p>
-
- <ul class="choices" data-none="true" data-show="5">
- <li data-each="PROBLEM.choices as key, value"><code><var>MATH.format(value)</var></code></li>
- </ul>
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
-</body>
-</html>
View
35 exercises/factoring_simple_expressions_2.html
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<html data-require="math graphie ast math-model factoring-expressions expr-helpers expr-normal-form simplify steps-helpers">
-<head>
- <meta charset="UTF-8" />
- <title>Factoring simple expressions 2</title>
- <script src="../khan-exercise.js"></script>
-</head>
-<body>
- <div class="exercise">
- <div class="vars">
- <var id="MATH">MathModel.init()</var>
- <var id="W">{op:"var", args:["w"]}</var>
- <var id="X">{op:"var", args:["x"]}</var>
- <var id="Y">{op:"var", args:["y"]}</var>
- <var id="Z">{op:"var", args:["z"]}</var>
- <var id="PROBLEM">genFactoringExercise(MATH, [2, 3, 5, 7, W, X, Y, Z], 3, 4)</var>
- <var id="SOLUTION">solveFactoringExercise(MATH, PROBLEM.question)</var>
- </div>
- <div class="problems">
- <div>
- <p class="problem">Factor the following expression by finding the common factors of its terms:</p>
- <p class="question"><code><var>MATH.format(PROBLEM.question)</var></code></p>
- <p class="solution"><code><var>MATH.format(SOLUTION.solution)</var></code></p>
-
- <ul class="choices" data-none="true" data-show="5">
- <li data-each="PROBLEM.choices as key, value"><code><var>MATH.format(value)</var></code></li>
- </ul>
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
-</body>
-</html>
View
54 exercises/simplifying_rational_expressions_1.html
@@ -1,36 +1,34 @@
<!DOCTYPE html>
<html data-require="math graphie ast math-model simplifying-expressions expr-helpers expr-normal-form simplify steps-helpers factoring-expressions subhints">
<head>
- <meta charset="UTF-8" />
- <title>Simplifying rational expressions 1</title>
- <script src="../khan-exercise.js"></script>
+ <meta charset="UTF-8" />
+ <title>Simplifying rational expressions 1</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="MATH">MathModel.init()</var>
- <var id="W">{op:"var", args:["w"]}</var>
- <var id="X">{op:"var", args:["x"]}</var>
- <var id="Y">{op:"var", args:["y"]}</var>
- <var id="Z">{op:"var", args:["z"]}</var>
- <var id="PROBLEM">genSimplifyingExpressionsExercise(MATH, 4, 2, [2, 3, 5, 7], [X, Y], [0, 1, 2, 3])</var>
- <var id="SOLUTION">solveSimplifyingExpressionsExercise(MATH, PROBLEM)</var>-->
- </div>
- <div class="problems">
- <div>
- <p class="problem">Simplify the following expression:</p>
- <p class="question"><code><var>MATH.format(PROBLEM)</var></code></p>
- <p class="solution"><code><var>MATH.format(SOLUTION.solution)</var></code></p>
+ <div class="exercise">
+ <div class="vars">
+ <var id="W">{op:"var", args:["w"]}</var>
+ <var id="X">{op:"var", args:["x"]}</var>
+ <var id="Y">{op:"var", args:["y"]}</var>
+ <var id="Z">{op:"var", args:["z"]}</var>
+ <var id="PROBLEM">genSimplifyingExpressionsExercise(4, 2, [2, 3, 5, 7], [X, Y], [0, 1, 2, 3])</var>
+ <var id="SOLUTION">solveSimplifyingExpressionsExercise(PROBLEM)</var>-->
+ </div>
+ <div class="problems">
+ <div>
+ <p class="problem">Simplify the following expression:</p>
+ <p class="question"><code><var>format(PROBLEM)</var></code></p>
+ <p class="solution"><code><var>format(SOLUTION.solution)</var></code></p>
- <ul class="choices" data-none="true" data-show="5">
- <li data-each="SOLUTION.choices as key, value"><code><var>MATH.format(value)</var></code></li>
- </ul>
-
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
+ <ul class="choices" data-none="true" data-show="5">
+ <li data-each="SOLUTION.choices as key, value"><code><var>format(value)</var></code></li>
+ </ul>
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
</body>
</html>
View
56 exercises/simplifying_rational_expressions_2.html
@@ -1,36 +1,34 @@
<!DOCTYPE html>
-<html data-require="math graphie ast math-model simplifying-expressions expr-helpers expr-normal-form simplify steps-helpers factoring-expressions subhints">
+<html data-require="math graphie math-model simplifying-expressions simplify factoring-expressions subhints">
<head>
- <meta charset="UTF-8" />
- <title>Simplifying rational expressions 2</title>
- <script src="../khan-exercise.js"></script>
+ <meta charset="UTF-8" />
+ <title>Simplifying rational expressions 2</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="MATH">MathModel.init()</var>
- <var id="W">{op:"var", args:["w"]}</var>
- <var id="X">{op:"var", args:["x"]}</var>
- <var id="Y">{op:"var", args:["y"]}</var>
- <var id="Z">{op:"var", args:["z"]}</var>
- <var id="PROBLEM">genSimplifyingExpressionsExercise(MATH, 4, 2, [2, 3, 5, 7], [X, Y], [0, 1, 2, 3], true)</var>
- <var id="SOLUTION">solveSimplifyingExpressionsExercise(MATH, PROBLEM)</var>-->
- </div>
- <div class="problems">
- <div>
- <p class="problem">Simplify the following expression:</p>
- <p class="question"><code><var>MATH.format(PROBLEM)</var></code></p>
- <p class="solution"><code><var>MATH.format(SOLUTION.solution)</var></code></p>
+ <div class="exercise">
+ <div class="vars">
+ <var id="W">{op:"var", args:["w"]}</var>
+ <var id="X">{op:"var", args:["x"]}</var>
+ <var id="Y">{op:"var", args:["y"]}</var>
+ <var id="Z">{op:"var", args:["z"]}</var>
+ <var id="PROBLEM">genSimplifyingExpressionsExercise(4, 2, [2, 3, 5, 7], [X, Y], [0, 1, 2, 3], true)</var>
+ <var id="SOLUTION">solveSimplifyingExpressionsExercise(PROBLEM)</var>
+ </div>
+ <div class="problems">
+ <div>
+ <p class="problem">Simplify the following expression:</p>
+ <p class="question"><code><var>format(PROBLEM)</var></code></p>
+ <p class="solution"><code><var>format(SOLUTION.solution)</var></code></p>
- <ul class="choices" data-none="true" data-show="5">
- <li data-each="SOLUTION.choices as key, value"><code><var>MATH.format(value)</var></code></li>
- </ul>
-
- </div>
- </div>
- <div class="hints">
- <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
- </div>
- </div>
+ <ul class="choices" data-none="true" data-show="5">
+ <li data-each="SOLUTION.choices as key, value"><code><var>format(value)</var></code></li>
+ </ul>
+ </div>
+ </div>
+ <div class="hints">
+ <div data-each="SOLUTION.hints as key, value"><var>value</var></div>
+ </div>
+ </div>
</body>
</html>
View
56 utils/factoring-expressions.js
@@ -21,7 +21,7 @@
return 1;
};
- var factorDiffOfSquares = function(MATH, expr, options) {
+ var factorDiffOfSquares = function(expr, options) {
var terms = [];
for (var iArg = 0; iArg < 2; iArg++) {
var term = {factors: [], occFactors: []};
@@ -61,18 +61,18 @@
} else {
var coloredExpr = {op: "-", args: [KhanUtil.exprSetStyle(termA.initial, KhanUtil.PINK),
KhanUtil.exprSetStyle(termB.initial, KhanUtil.BLUE)]};
- var initialForm = MATH.parseFormat("#{a^2} - #{b^2}", [KhanUtil.PINK, KhanUtil.BLUE]);
- var factoredForm = MATH.parseFormat("(#a + #b)(#a - #b)", [KhanUtil.PINK, KhanUtil.BLUE, KhanUtil.PINK, KhanUtil.BLUE]);
- hints.push("<p><code>" + MATH.format(coloredExpr) + "</code></p><p>The expression is of the form <code>" + initialForm +
+ var initialForm = KhanUtil.parseFormat("#{a^2} - #{b^2}", [KhanUtil.PINK, KhanUtil.BLUE]);
+ var factoredForm = KhanUtil.parseFormat("(#a + #b)(#a - #b)", [KhanUtil.PINK, KhanUtil.BLUE, KhanUtil.PINK, KhanUtil.BLUE]);
+ hints.push("<p><code>" + KhanUtil.format(coloredExpr) + "</code></p><p>The expression is of the form <code>" + initialForm +
"</code> which is a difference of two squares so we can factor it as <code>" + factoredForm + "</code></p>");
- var strA = MATH.parseFormat("#a", [KhanUtil.PINK]);
- var strB = MATH.parseFormat("#b", [KhanUtil.BLUE]);
+ var strA = KhanUtil.parseFormat("#a", [KhanUtil.PINK]);
+ var strB = KhanUtil.parseFormat("#b", [KhanUtil.BLUE]);
hints.push("<p>What are the values of <code>" + strA + "</code> and <code>" + strB + "</code>?</p>");
var varA = {op: "var", args: ["a"]};
var varB = {op: "var", args: ["b"]};
var exprA = {op: "=", args: [varA, {op: "sqrt", args: [termA.initial]}, termA.sqrt], style: KhanUtil.PINK};
var exprB = {op: "=", args: [varB, {op: "sqrt", args: [termB.initial]}, termB.sqrt], style: KhanUtil.BLUE};
- hints.push("<p><code>" + MATH.format(exprA) + "</code><p><code>" + MATH.format(exprB) + "</code></p>");
+ hints.push("<p><code>" + KhanUtil.format(exprA) + "</code><p><code>" + KhanUtil.format(exprB) + "</code></p>");
hints.push("<p>Use the values we found for <code>" + strA + "</code> and <code>" + strB + "</code> to complete the factored expression, <code>" + factoredForm + "</code></p>");
var coloredFactored = KhanUtil.exprClone(solution);
for (var iArg1 = 0; iArg1 < 2; iArg1++) {
@@ -81,7 +81,7 @@
coloredFactored.args[iArg1].args[iArg2] = KhanUtil.exprSetStyle(coloredFactored.args[iArg1].args[iArg2], colors[iArg2]);
}
}
- hints.push("<p><b>So we can factor the expression as:</b><code>" + MATH.format(coloredFactored) + "</code>");
+ hints.push("<p><b>So we can factor the expression as:</b><code>" + KhanUtil.format(coloredFactored) + "</code>");
}
return {solution: solution, hints: hints};
};
@@ -291,7 +291,7 @@
return listFactors;
}
- var genHintListFactors = function(MATH, factors, occFactors) {
+ var genHintListFactors = function(factors, occFactors) {
var listFactors = genListFactors(factors, occFactors);
var strListFactors = "";
for (var iListedFactor = 0; iListedFactor < listFactors.length; iListedFactor++) {
@@ -302,17 +302,17 @@
strListFactors += ", ";
}
}
- strListFactors += "<code>" + MATH.format(KhanUtil.exprSetStyle(listFactors[iListedFactor], KhanUtil.BLUE)) + "</code>";
+ strListFactors += "<code>" + KhanUtil.format(KhanUtil.exprSetStyle(listFactors[iListedFactor], KhanUtil.BLUE)) + "</code>";
}
if (listFactors.length === 1) {
return "<p>The terms have one common factor: " + strListFactors + ".</p>";
} else {
- var gcf = MATH.format(KhanUtil.exprSetStyle(KhanUtil.genExprFromExpFactors(factors, occFactors), KhanUtil.BLUE));
+ var gcf = KhanUtil.format(KhanUtil.exprSetStyle(KhanUtil.genExprFromExpFactors(factors, occFactors), KhanUtil.BLUE));
return "<p>The terms have these common factors: " + strListFactors + ", so the greatest common factor is <code>" + gcf + "</code>.</p>";
}
};
- var genHintsDecomposeAllFactors = function(MATH, factors, sharedOccFactors, termsOccFactors) {
+ var genHintsDecomposeAllFactors = function(factors, sharedOccFactors, termsOccFactors) {
var colors = [KhanUtil.PINK, KhanUtil.ORANGE, KhanUtil.GREEN];
var nbTerms = termsOccFactors.length;
var hints = [];
@@ -322,16 +322,16 @@
}
expr = KhanUtil.simplify(expr, KhanUtil.simplifyOptions.checkInput);
- hints.push("<p><code>" + MATH.format(expr) + "</code></p><p>We start by decomposing each term into a product of its most simple factors.</p>");
+ hints.push("<p><code>" + KhanUtil.format(expr) + "</code></p><p>We start by decomposing each term into a product of its most simple factors.</p>");
for (var iTerm = 0; iTerm < nbTerms; iTerm++) {
var mergedOccFactors = mergeOccFactors(sharedOccFactors, termsOccFactors[iTerm]);
- hints.push("<p><code>" + MATH.format(KhanUtil.exprSetStyle(genDecomposition(factors, mergedOccFactors), {color: colors[iTerm]})) + "</code></p>");
+ hints.push("<p><code>" + KhanUtil.format(KhanUtil.exprSetStyle(genDecomposition(factors, mergedOccFactors), {color: colors[iTerm]})) + "</code></p>");
}
- hints.push(genHintListFactors(MATH, factors, sharedOccFactors));
+ hints.push(genHintListFactors(factors, sharedOccFactors));
- hints.push("<p>We can rewrite the expression as: <code>" + MATH.format({op: "+", args: genAllTermsMarkShared(factors, sharedOccFactors, termsOccFactors, colors)}) + "</code>.</p>");
- hints.push("<p>We now rewrite the expression as a product: <code>" + MATH.format(genFullExpr(factors, sharedOccFactors, termsOccFactors)) + "</code>.</p>");
+ hints.push("<p>We can rewrite the expression as: <code>" + KhanUtil.format({op: "+", args: genAllTermsMarkShared(factors, sharedOccFactors, termsOccFactors, colors)}) + "</code>.</p>");
+ hints.push("<p>We now rewrite the expression as a product: <code>" + KhanUtil.format(genFullExpr(factors, sharedOccFactors, termsOccFactors)) + "</code>.</p>");
return hints;
};
@@ -352,18 +352,18 @@
}
};
- var solveDiffOfSquaresExercise = function(MATH, expr, options) {
+ var solveDiffOfSquaresExercise = function(expr, options) {
if (KhanUtil.exprIsNumber(expr) || (expr.args.length != 2)) {
return undefined;
}
if (expr.op === "-") {
var sumExpr = {op: "+", args: [expr.args[0], {op: "-", args: [expr.args[1]]}]};
- return solveDiffOfSquaresExercise(MATH, sumExpr, options);
+ return solveDiffOfSquaresExercise(sumExpr, options);
}
- return factorDiffOfSquares(MATH, expr, options);
+ return factorDiffOfSquares(expr, options);
};
- var solveFactoringExercise = function(MATH, expr, options) {
+ var solveFactoringExercise = function(expr, options) {
if (options === undefined) {
options = {};
}
@@ -375,24 +375,24 @@
var hints = ["<p>To factor this expression, we start by looking at the different terms of the sum, and find all of their common factors. We can then rewrite the expression as a product between these common factors, and what's left of the different terms once we remove these factors.</p>"];
- var detailedHints = genHintsDecomposeAllFactors(MATH, factors, sharedOccFactors, termsOccFactors);
+ var detailedHints = genHintsDecomposeAllFactors(factors, sharedOccFactors, termsOccFactors);
var solution = genFullExpr(factors, sharedOccFactors, termsOccFactors);
if (options.factorDiffOfSquares) {
var hint = "<p>We obtain the following expression: " + KhanUtil.getSubHints("common-factors", "Show explanation", detailedHints);
- hint += "<p><code>" + MATH.format(solution) + "</code></p>";
+ hint += "<p><code>" + KhanUtil.format(solution) + "</code></p>";
hints.push(hint);
hints.push("<p>Can we factor this expression even more?</p>");
for (var iArg = 0; iArg < solution.args.length; iArg++) {
var arg = solution.args[iArg];
- var solvedArg = solveDiffOfSquaresExercise(MATH, arg, options);
+ var solvedArg = solveDiffOfSquaresExercise(arg, options);
if (solvedArg === undefined) {
continue;
}
- hints.push("<p>This part of the expression can be factored: <code>" + MATH.format(arg) + "</code></p>");
+ hints.push("<p>This part of the expression can be factored: <code>" + KhanUtil.format(arg) + "</code></p>");
var hint = "<p>We recognize and factor a difference of squares, and obtain the following expression: " + KhanUtil.getSubHints("diff-squares-" + iArg, "Show explanation", solvedArg.hints);
solution.args[iArg] = solvedArg.solution;
- hint += "<p><code>" + MATH.format(solution);
+ hint += "<p><code>" + KhanUtil.format(solution);
hints.push(hint);
}
} else {
@@ -409,7 +409,7 @@
} else if (options.factorWithDiffOfSquares === "(ab^2-cd^2)=a(b - d)(b + d)") {
}
- hints.push("<p>There is nothing left to factor using this approach. The answer is : <code>" + MATH.format(solution) + "</code></p>");
+ hints.push("<p>There is nothing left to factor using this approach. The answer is : <code>" + KhanUtil.format(solution) + "</code></p>");
return {hints: hints, solution: solution};
};
@@ -486,7 +486,7 @@
return choices;
};
- var genFactoringExercise = function(MATH, factors, nbTerms, factorsPerTerm) {
+ var genFactoringExercise = function(factors, nbTerms, factorsPerTerm) {
var sharedFactors = [];
var sharedOccFactors = KhanUtil.initOccArray(factors.length);
var numTotal = genSharedFactors(factors, sharedFactors, sharedOccFactors, factorsPerTerm);
View
34 utils/simplifying-expressions.js
@@ -79,7 +79,7 @@
return {op: "dfrac", args: newArgs};
};
- var addInitialSteps = function(MATH, steps) {
+ var addInitialSteps = function(steps) {
var aExpr = {op: "var", args: ["a"]};
var exampleFactors = [3, 5, aExpr, {op: "var", args: ["b"]}, {op: "var", args: ["c"]}];
var exampleOldOccs = [[1, 0, 2, 1, 0], [0, 1, 1, 0, 1]];
@@ -87,16 +87,16 @@
var exampleExprInit = getFractionFromOccFactors(exampleFactors, exampleOldOccs);
var exampleExprStep = getFractionFromOccFactors(exampleFactors, exampleNewOccs, exampleOldOccs);
var exampleExprEnd = getFractionFromOccFactors(exampleFactors, exampleNewOccs);
- var exampleGroup = [MATH.parse("#{\\dfrac{a^2}{a}} &= #{\\dfrac{#{a} \\cdot a}{#{a}}}", [KhanUtil.BLUE, KhanUtil.BLUE, {cancel: true}, {cancel: true}]),
- MATH.parse("&= #{\\dfrac{a}{1}}", [KhanUtil.BLUE]),
- MATH.parse("&= #{a}", [KhanUtil.BLUE])];
+ var exampleGroup = [KhanUtil.parse("#{\\dfrac{a^2}{a}} &= #{\\dfrac{#{a} \\cdot a}{#{a}}}", [KhanUtil.BLUE, KhanUtil.BLUE, {cancel: true}, {cancel: true}]),
+ KhanUtil.parse("&= #{\\dfrac{a}{1}}", [KhanUtil.BLUE]),
+ KhanUtil.parse("&= #{a}", [KhanUtil.BLUE])];
steps.add("<p>To simplify this type of expression, we need to look for factors that are shared by both the numerator and the denominator.</p>For each such factor, if it is present with the same exponent both at the numerator and the denominator, then we can remove that factor completely. If the exponent is different, then we remove the one with the lowest exponent, and substract it from the one with the higher exponent.</p>");
- var subHints = ["<p>Why can we simplify an expression this way? Let's look at the detailed steps that we imply when we write <code>" + MATH.format(exampleExprStep) + "</code> :</p><p><code>" + MATH.format(exampleExprInit) + "</code> can be rewritten as <code>" +
- MATH.parseFormat("\\dfrac{3}{5} \\cdot #{\\dfrac{a^2}{a}} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code></p><p><code>" +
- MATH.formatGroup(exampleGroup) + "</code></p><p>So we get <code>" +
- MATH.parseFormat("\\dfrac{3}{5} \\cdot #{a} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code>, or <code>" +
- MATH.parseFormat("\\dfrac{3ab}{5c}") + "</code>"];
- steps.add("<p>For example, if we had this expression: <code>" + MATH.format(exampleExprInit) + "</code>, we would see that the factor <code>" + MATH.format(aExpr) + "</code> is present in both the numerator and the denominator.</p><p>We would then simplify it like this: <code>" + MATH.format(exampleExprStep) + "</code> and obtain: <code>" + MATH.format(exampleExprEnd) + "</code> " + KhanUtil.getSubHints("factoring", "Show explanation", subHints) + "</p><p>Can you apply this technique to this exercise?</p>");
+ var subHints = ["<p>Why can we simplify an expression this way? Let's look at the detailed steps that we imply when we write <code>" + KhanUtil.format(exampleExprStep) + "</code> :</p><p><code>" + KhanUtil.format(exampleExprInit) + "</code> can be rewritten as <code>" +
+ KhanUtil.parseFormat("\\dfrac{3}{5} \\cdot #{\\dfrac{a^2}{a}} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code></p><p><code>" +
+ KhanUtil.formatGroup(exampleGroup) + "</code></p><p>So we get <code>" +
+ KhanUtil.parseFormat("\\dfrac{3}{5} \\cdot #{a} \\cdot b \\cdot \\dfrac{1}{c}", [KhanUtil.BLUE]) + "</code>, or <code>" +
+ KhanUtil.parseFormat("\\dfrac{3ab}{5c}") + "</code>"];
+ steps.add("<p>For example, if we had this expression: <code>" + KhanUtil.format(exampleExprInit) + "</code>, we would see that the factor <code>" + KhanUtil.format(aExpr) + "</code> is present in both the numerator and the denominator.</p><p>We would then simplify it like this: <code>" + KhanUtil.format(exampleExprStep) + "</code> and obtain: <code>" + KhanUtil.format(exampleExprEnd) + "</code> " + KhanUtil.getSubHints("factoring", "Show explanation", subHints) + "</p><p>Can you apply this technique to this exercise?</p>");
};
var factorNumeratorDenominator = function(expr, options, steps) {
@@ -129,11 +129,11 @@
}
return newExpr;
};
- var solveSimplifyingExpressionsExercise = function(MATH, expr) {
+ var solveSimplifyingExpressionsExercise = function(expr) {
var steps = new KhanUtil.StepsProblem([], expr, "simplify by factoring");
- addInitialSteps(MATH, steps);
+ addInitialSteps(steps);
var subSteps = new KhanUtil.StepsProblem([], expr, "factor numerator and denominator");
- var options = {evalBasicNumOps: true, simplifyMode: "factor"};
+ var options = KhanUtil.simplifyOptions.factor;
var newExpr = factorNumeratorDenominator(expr, options, subSteps);
if (KhanUtil.stepIsUsed(subSteps)) {
steps.add("The first step is to factor the numerator and denominator, if possible : " +
@@ -178,10 +178,10 @@
var hintExpr = getFractionFromOccFactors(factors, newOccFactors, argsOccFactors);
if (KhanUtil.exprIdentical(newExpr, solExpr)) {
- steps.add("<p>There are no factors that can be simplified in this expression, so the answer is: <code>" + MATH.format(solExpr) + "</code>");
+ steps.add("<p>There are no factors that can be simplified in this expression, so the answer is: <code>" + KhanUtil.format(solExpr) + "</code>");
} else {
- steps.add("<p>Applying the approach described above gives in this case:</p><p><code>" + MATH.format(hintExpr) + "</code></p>");
- steps.add("<p>We obtain the following expression:</p><p><code>" + MATH.format(solExpr) + "</code></p>");
+ steps.add("<p>Applying the approach described above gives in this case:</p><p><code>" + KhanUtil.format(hintExpr) + "</code></p>");
+ steps.add("<p>We obtain the following expression:</p><p><code>" + KhanUtil.format(solExpr) + "</code></p>");
}
var hints = KhanUtil.genHints(steps);
return {solution: solExpr, hints: hints, choices: choices};
@@ -206,7 +206,7 @@
return listIFactors;
};
- var genSimplifyingExpressionsExercise = function(MATH, nbTerms, maxPower, numFactors, variables, types, withInnerFactor) {
+ var genSimplifyingExpressionsExercise = function(nbTerms, maxPower, numFactors, variables, types, withInnerFactor) {
var factors = [];
for (var iTerm = 0; iTerm < nbTerms; iTerm++) {
var term;
Please sign in to comment.
Something went wrong with that request. Please try again.