Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve hints and answer format in combining like terms exercises

  • Loading branch information...
commit 9f95a3d8b3c4e927f4b949eca87dd3c8260a4bb0 1 parent 6f63bdf
Ben Eater beneater authored
Showing with 493 additions and 228 deletions.
  1. +185 −113 exercises/combining_like_terms_1.html
  2. +308 −115 exercises/combining_like_terms_2.html
298 exercises/combining_like_terms_1.html
View
@@ -1,140 +1,212 @@
<!DOCTYPE html>
-<html data-require="math math-format expressions">
+<html data-require="math expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Combining like terms 1</title>
<script src="../khan-exercise.js"></script>
- <script type="text/javascript">
- function color( str, blue ) {
- var pre = "";
-
- if ( typeof str === "number" && str < 0 ) {
- pre = "-";
- str = Math.abs( str );
- } else if ( typeof str === "string" ) {
- if ( str.indexOf( "-" ) === 0 ) {
- pre = "-";
- str = str.slice( 1 );
- }
- if ( str.charAt( 0 ) === "1" && str.length === 2 ) {
- str = str.slice( 1 );
- }
- }
-
- return pre + "\\color{" + ( blue === 0 ? "<var>BLUE</var>" : ( blue === 1 ? "<var>ORANGE</var>" : "#000" ) ) + "}{" + str + "}";
- }
- </script>
- <style type="text/css">
- #answer_area input[type=text] {
- width: 40px;
- }
- </style>
</head>
<body>
- <div class="exercise">
+<div class="exercise">
<div class="vars">
- <var id="LETTERS">"abkmnpvx"</var>
- <var id="X">LETTERS.charAt( randRange( 0, LETTERS.length - 1 ) )</var>
+ <var id="X">randFromArray("abkmnpvx")</var>
+ <var id="A">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="B" data-ensure="abs( A ) !== abs( B )">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="C">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 20))</var>
+ <var id="D" data-ensure="abs( C ) !== abs( D )">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="TERM_AX">
+ "(?:" + (A &lt; 0 ? "[-\\u2212]" : "") + abs(A)
+ + (A === 1 ? "|" : "" ) + (A === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_AX_BX">
+ "(?:" + ((A + B) &lt; 0 ? "[-\\u2212]" : "") + abs(A + B)
+ + (A + B === 1 ? "|" : "" ) + (A + B === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_C">(C &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(C)</var>
+ <var id="TERM_C_D">((C + D) &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(C + D)</var>
</div>
<div class="problems">
- <div id="none">
- <div class="vars" data-ensure="ANSWER1 !== 0 && ANSWER2 !== 0">
- <var id="INDEX">randRange( 0, 6 )</var>
- <var id="A">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="B" data-ensure="abs( A ) !== abs( B )">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="C">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="D" data-ensure="abs( C ) !== abs( D )">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="E" data-ensure="E !== 1">randRangeNonZero( -1, 1 ) * randRange( 1, randRange( 1, 10 ) )</var>
- <var id="F" data-ensure="F !== 1">randRangeNonZero( -1, 1 ) * randRange( 1, randRange( 1, 10 ) )</var>
- <var id="TERMS">[expr( ["+", ["*", A, X], ["*", B, X]] ), expr( ["+", ["*", A, X], ["*", B, X], C] ), expr( ["+", ["*", A, X], C, ["*", B, X]] ),
- expr( ["+", ["*", A, X], C, ["*", B, X], D] ), expr( ["+", ["*", A, X], C, D, ["*", B, X]] ), expr( ["+", ["*", A, X], C, D] ), expr( ["+", C, ["*", A, X], D] ),
- expr( ["+", ["*", A, X], ["*", F, ["+", ["*", B, X], D]]] ), expr( ["+", C, ["*", F, ["+", D, ["*", B, X]]]] ),
- expr( ["+", ["*", E, ["+", C, ["*", A, X]]], ["*", F, ["+", ["*", B, X], D]]] ), expr( ["+", ["*", E, ["+", ["*", A, X], C]], ["*", F, ["+", D, ["*", B, X]]]] )][INDEX]</var>
- <var id="DIST1">INDEX &gt; 8 ? 1 : 0</var>
- <var id="DIST2">INDEX &gt; 6 ? 1 : 0</var>
- <var id="COMBINE1">( INDEX === 5 || INDEX === 6 || INDEX === 8 ) ? 0 : 1</var>
- <var id="COMBINE2">( INDEX === 0 || INDEX === 1 || INDEX === 2 || INDEX === 7 ) ? 0 : 1</var>
- <var id="ANSWER1">INDEX &lt; 5 ? A + B : ( INDEX === 5 || INDEX === 6 ) ? A : INDEX === 7 ? A + F * B : INDEX === 8 ? F * B : E * A + F * B</var>
- <var id="ANSWER2">INDEX &lt; 3 ? C : ( INDEX &gt; 2 && INDEX &lt; 7 ) ? C + D : INDEX == 7 ? F * D : INDEX === 8 ? C + F * D : E * C + F * D</var>
+ <div id="ax_bx">
+ <div class="vars">
+ <var id="SOLUTIONS">[TERM_AX_BX]</span>
</div>
- <p class="question">Simplify the expression below.</p>
- <p><code>\large{<var>TERMS</var>}</code></p>
+ <p class="question">
+ Simplify the following expression:
+ </p>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], ["*", B, X]])</var>}</code>
+ </p>
<div class="solution" data-type="set">
- <div class="set-sol" data-type="multiple">
- <span class="sol" data-if="ANSWER1 === -1" data-type="regex">^\s*[-\u2212]1?\s*$</span>
- <span class="sol" data-else data-fallback="1"><var>ANSWER1</var></span>
- <span data-if="INDEX !== 0"><span class="sol"><var>ANSWER2</var></span></span>
+ <span data-each="SOLUTIONS as SOL" class="set-sol" data-type="regex">^\s*<var>SOL</var>\s*$</span>
+ <div class="input-format"><span class="entry"></span></div>
+ <span class="example">an expression, like <b>-2x + 4</b></span>
+ </div>
+
+ <div class="hints">
+ <div>
+ <p>Combine the <code><var>X</var></code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A, X])</var> + <var>expr(["*", B, X])</var>}</code>
+ </p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + B, X])</var>}</code>
+ </p>
</div>
- <div class="input-format">
- <p class="entry" data-type="multiple">
- <span class="sol"></span><code><var>X</var></code><span data-if="INDEX !== 0"><code>\space + \space</code><span class="sol"></span></span>
+ <p>The simplified expression is <code><var>expr(["*", A + B, X])</var></code>
+ </div>
+ </div>
+
+ <div id="ax_bx_c" data-type="ax_bx">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_AX_BX + (C &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C,
+ TERM_C + ((A + B) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX_BX
+ ]</var>
+ </div>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], ["*", B, X], C])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p>Combine the <code>\pink{<var>X</var>}</code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A, X])</var>} + \pink{<var>expr(["*", B, X])</var>} + <var>C</var></code>
+ </p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + B, X])</var>} + <var>C</var></code>
</p>
</div>
- <p class="example">enter integers for the coefficient and constant terms, such as -3 or 10</p>
+ <p>The simplified expression is <code><var>expr(["*", A + B, X])</var> + <var>C</var></code>
</div>
+ </div>
+
+ <div id="ax_c_bx" data-type="ax_bx_c">
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], C, ["*", B, X]])</var>}</code>
+ </p>
<div class="hints">
- <div data-if="DIST1">
- <p>Distribute over the first parenthesis.</p>
- <div data-if="INDEX === 9">
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["*", E, ["+", C, ["*", A, X]]] )</var>} + <var>expr( ["*", F, ["+", ["*", B, X], D]] )</var></code></p>
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["+", E * C, ["*", E * A, X]] )</var>} + <var>expr( ["*", F, ["+", ["*", B, X], D]] )</var></code></p>
- </div>
- <div data-if="INDEX === 10">
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["*", E, ["+", ["*", A, X], C]] )</var>} + <var>expr( ["*", F, ["+", D, ["*", B, X]]] )</var></code></p>
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["+", ["*", E * A, X], E * C] )</var>} + <var>expr( ["*", F, ["+", D, ["*", B, X]]] )</var></code></p>
- </div>
+ <div>
+ <p>Rewrite to group the <code>\pink{<var>X</var>}</code> terms together:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A, X])</var> + <var>expr(["*", B, X])</var>} + <var>C</var></code>
+ </p>
</div>
- <div data-if="DIST2">
- <p>Distribute over the <span data-if="DIST1">second </span>parenthesis.</p>
- <div data-if="INDEX === 7">
- <p><code><var>expr( ["*", A, X] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", ["*", B, X], D]] )</var>}</code></p>
- <p><code><var>expr( ["*", A, X] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * B ) < 0">-</span><span data-else>+</span><var>expr( ["+", ["*", abs( F * B ), X], F * D] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 8">
- <p><code><var>C</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", D, ["*", B, X]]] )</var>}</code></p>
- <p><code><var>C</var>\color{<var>ORANGE</var>}{<span data-if="( F * D ) < 0">-</span><span data-else>+</span><var>expr( ["+", abs( F * D ), ["*", F * B, X]] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 9">
- <p><code><var>expr( ["+", E * C, ["*", E * A, X]] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", ["*", B, X], D]] )</var>}</code></p>
- <p><code><var>expr( ["+", E * C, ["*", E * A, X]] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * B ) < 0">-</span><span data-else>+</span><var>expr( ["+", ["*", abs( F * B ), X], F * D] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 10">
- <p><code><var>expr( ["+", ["*", E * A, X], E * C] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", D, ["*", B, X]]] )</var>}</code></p>
- <p><code><var>expr( ["+", ["*", E * A, X], E * C] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * D ) < 0">-</span><span data-else>+</span><var>expr( ["+", abs( F * D ), ["*", F * B, X]] )</var>}</code></p>
- </div>
+ <div>
+ <p>Combine the <code>\pink{<var>X</var>}</code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + B, X])</var>} + <var>C</var></code>
+ </p>
</div>
- <div data-if="COMBINE1">
- <p>Combine the variable terms:</p>
- <p data-if="INDEX === 0"><code><var>color( A + X, 0 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var></code></p>
- <p data-if="INDEX === 1"><code><var>color( A + X, 0 )</var> + <var>color( B + X, 0 )</var> + <var>color( C, 2 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var></code></p>
- <p data-if="INDEX === 2"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var></code></p>
- <p data-if="INDEX === 3"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( B + X, 0 )</var> + <var>color( D, 2 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var></code></p>
- <p data-if="INDEX === 4"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var></code></p>
- <p data-if="INDEX === 7"><code><var>color( A + X, 0 )</var> + <var>color( ( F * B ) + X, 0 )</var> + <var>color( ( F * D ), 2 )</var> = <var>color( ( A + F * B ) + X, 0 )</var> + <var>color( ( F * D ), 2 )</var></code></p>
- <p data-if="INDEX === 9"><code><var>color( E * C, 2 )</var> + <var>color( ( E * A ) + X, 0 )</var> + <var>color( ( F * B ) + X, 0 )</var> + <var>color( F * D, 2 )</var> = <var>color( ( E * A + F * B ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var></code></p>
- <p data-if="INDEX === 10"><code><var>color( ( E * A ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var> + <var>color( ( F * B ) + X, 0 )</var> = <var>color( ( E * A + F * B ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var></code></p>
+ <p>The simplified expression is <code><var>expr(["*", A + B, X])</var> + <var>C</var></code>
+ </div>
+ </div>
+
+ <div id="ax_c_bx_d" data-type="ax_bx_c">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_AX_BX + ((C + D) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C_D,
+ TERM_C_D + ((A + B) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX_BX
+ ]</var>
+ </div>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], C, ["*", B, X], D])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p>
+ Rewrite the expression to group the
+ <code>\pink{<var>X</var>}</code> terms and
+ <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A, X])</var> +
+ <var>expr(["*", B, X])</var>} <var>C &lt; 0 ? "" : "+"</var>
+ \blue{<var>C</var> + <var>D</var>}</code>
+ </p>
</div>
- <div data-if="COMBINE2">
- <p>Combine the constant terms:</p>
- <p data-if="INDEX === 3 || INDEX === 4"><code><var>color( ( A + B ) + X, 2 )</var> + <var>color( C, 1 )</var> + <var>color( D, 1 )</var> = <var>color( ( A + B ) + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 5"><code><var>color( A + X, 2 )</var> + <var>color( C, 1 )</var> + <var>color( D, 1 )</var> = <var>color( A + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 6"><code><var>color( C, 1 )</var> + <var>color( A + X, 2 )</var> + <var>color( D, 1 )</var> = <var>color( A + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 8"><code><var>color( C, 1 )</var> + <var>color( F * D, 1 )</var> + <var>color( ( F * B ) + X, 2 )</var> = <var>color( ( F * B ) + X, 2 )</var> + <var>color( ( C + F * D ), 1 )</var></code></p>
- <p data-if="INDEX === 9"><code><var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C, 1 )</var> + <var>color( F * D, 1 )</var> = <var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C + F * D, 1 )</var></code></p>
- <p data-if="INDEX === 10"><code><var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C, 1 )</var> + <var>color( F * D, 1 )</var> = <var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C + F * D, 1 )</var></code></p>
+ <div>
+ <p>Combine the <code>\pink{<var>X</var>}</code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + B, X])</var>}
+ <var>C &lt; 0 ? "" : "+"</var>
+ \blue{<var>C</var> + <var>D</var>}</code>
+ </p>
</div>
- <div class="final_answer">
- <p data-if="INDEX === 0">The simplified expression is <code><var>expr( ["*", A + B, X] )</var></code>.</p>
- <p data-if="INDEX === 1 || INDEX === 2">The simplified expression is <code><var>expr( ["+", ["*", A + B, X], C] )</var></code>.</p>
- <p data-if="INDEX === 3 || INDEX === 4">The simplified expression is <code><var>expr( ["+", ["*", A + B, X], C + D] )</var></code>.</p>
- <p data-if="INDEX === 5 || INDEX === 6">The simplified expression is <code><var>expr( ["+", ["*", A, X], C + D] )</var></code>.</p>
- <p data-if="INDEX === 7">The simplified expression is <code><var>expr( ["+", ["*", A + F * B, X], F * D] )</var></code>.</p>
- <p data-if="INDEX === 8">The simplified expression is <code><var>expr( ["+", ["*", F * B, X], C + F * D] )</var></code>.</p>
- <p data-if="INDEX === 9 || INDEX === 10">The simplified expression is <code><var>expr( ["+", ["*", E * A + F * B, X], E * C + F * D] )</var></code>.</p>
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + B, X])</var>}
+ <var>(C + D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>C + D</var>}</code>
+ </p>
</div>
+ <p>The simplified expression is <code><var>expr(["+", ["*", A + B, X], C + D])</var></code>
</div>
</div>
+
+ <div id="ax_c_d_bx" data-type="ax_c_bx_d">
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], C, D, ["*", B, X]])</var>}</code>
+ </p>
+ </div>
+
+ <div id="ax_c_d" data-type="ax_bx">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_AX + ((C + D) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C_D,
+ TERM_C_D + (A &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX
+ ]</var>
+ </div>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], C, D])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>C &lt; 0 ? "" : "+"</var>
+ \blue{<var>C</var> + <var>D</var>}</code>
+ </p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>(C + D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>C + D</var>}</code>
+ </p>
+ </div>
+ <p>The simplified expression is <code><var>expr(["+", ["*", A, X], C + D])</var></code>
+ </div>
+ </div>
+
+ <div id="c_ax_d" data-type="ax_c_d">
+ <p class="problem">
+ <code>\large{<var>expr(["+", C, ["*", A, X], D])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p>
+ Rewrite the expression to group the
+ <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>C &lt; 0 ? "" : "+"</var>
+ \blue{<var>C</var> + <var>D</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>(C + D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>C + D</var>}</code>
+ </p>
+ </div>
+ <p>The simplified expression is <code><var>expr(["+", ["*", A, X], C + D])</var></code>
+ </div>
+ </div>
+
</div>
- </div>
+</div>
</body>
</html>
423 exercises/combining_like_terms_2.html
View
@@ -1,140 +1,333 @@
<!DOCTYPE html>
-<html data-require="math math-format expressions">
+<html data-require="math expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Combining like terms 2</title>
<script src="../khan-exercise.js"></script>
- <script type="text/javascript">
- function color( str, blue ) {
- var pre = "";
-
- if ( typeof str === "number" && str < 0 ) {
- pre = "-";
- str = Math.abs( str );
- } else if ( typeof str === "string" ) {
- if ( str.indexOf( "-" ) === 0 ) {
- pre = "-";
- str = str.slice( 1 );
- }
- if ( str.charAt( 0 ) === "1" && str.length === 2 ) {
- str = str.slice( 1 );
- }
- }
-
- return pre + "\\color{" + ( blue === 0 ? "<var>BLUE</var>" : ( blue === 1 ? "<var>ORANGE</var>" : "<var>BLACK</var>" ) ) + "}{" + str + "}";
- }
- </script>
- <style type="text/css">
- #answer_area input[type=text] {
- width: 40px;
- }
- </style>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="LETTERS">"abkmnpvx"</var>
- <var id="X">LETTERS.charAt( randRange( 0, LETTERS.length - 1 ) )</var>
+<!-- Mix in some combining_like_terms_1 problems occasionally -->
+<div class="exercise" data-weight="1" data-name="combining_like_terms_1"></div>
+
+<div class="exercise" data-weight="6">
+ <div class="vars" data-ensure="E * A + F * B !== 0 && E * C + F * D !== 0">
+ <var id="X">randFromArray("abkmnpvx")</var>
+ <var id="A">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="B" data-ensure="abs( A ) !== abs( B )">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="C">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 20))</var>
+ <var id="D" data-ensure="abs( C ) !== abs( D )">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 12))</var>
+ <var id="E" data-ensure="E !== 1">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 10))</var>
+ <var id="F" data-ensure="F !== 1">randRangeNonZero(-1, 1) * randRange(1, randRange(1, 10))</var>
+ <var id="TERM_AX">
+ "(?:" + (A &lt; 0 ? "[-\\u2212]" : "") + abs(A)
+ + (A === 1 ? "|" : "" ) + (A === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_FBX">
+ "(?:" + ((F * B) &lt; 0 ? "[-\\u2212]" : "") + abs(F * B)
+ + (F * B === 1 ? "|" : "" ) + (F * B === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_AX_BX">
+ "(?:" + ((A + B) &lt; 0 ? "[-\\u2212]" : "") + abs(A + B)
+ + (A + B === 1 ? "|" : "" ) + (A + B === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_AX_FBX">
+ "(?:" + ((A + F * B) &lt; 0 ? "[-\\u2212]" : "") + abs(A + F * B)
+ + (A + F * B === 1 ? "|" : "" ) + (A + F * B === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_EAX_FBX">
+ "(?:" + ((E * A + F * B) &lt; 0 ? "[-\\u2212]" : "") + abs(E * A + F * B)
+ + (E * A + F * B === 1 ? "|" : "" ) + (E * A + F * B === -1 ?
+ "|[-\\u2212]" : "") + ")\\s*" + X
+ </var>
+ <var id="TERM_C">(C &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(C)</var>
+ <var id="TERM_C_D">((C + D) &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(C + D)</var>
+ <var id="TERM_FD">((F * D) &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(F * D)</var>
+ <var id="TERM_C_FD">((C + F * D) &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(C + F * D)</var>
+ <var id="TERM_EC_FD">((E * C + F * D) &lt; 0 ? "[-\\u2212]\\s*" : "") + abs(E * C + F * D)</var>
+ </div>
+ <p class="question">
+ Simplify the following expression:
+ </p>
+ <div class="solution" data-type="set">
+ <span data-each="SOLUTIONS as SOL" class="set-sol" data-type="regex">^\s*<var>SOL</var>\s*$</span>
+ <div class="input-format"><span class="entry"></span></div>
+ <span class="example">an expression, like <b>-2x + 4</b></span>
</div>
+
<div class="problems">
- <div id="none">
- <div class="vars" data-ensure="ANSWER1 !== 0 && ANSWER2 !== 0">
- <var id="INDEX">randRange( randRangeWeighted( 0, 10, 7, .5 ), 10 )</var>
- <var id="A">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="B" data-ensure="abs( A ) !== abs( B )">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="C">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="D" data-ensure="abs( C ) !== abs( D )">randRangeNonZero( -1, 1 ) * randRange( 1, randRangeWeighted( 1, 20, 10, INDEX &gt; 6 ? 1 : 0 ) )</var>
- <var id="E" data-ensure="E !== 1">randRangeNonZero( -1, 1 ) * randRange( 1, randRange( 1, 10 ) )</var>
- <var id="F" data-ensure="F !== 1">randRangeNonZero( -1, 1 ) * randRange( 1, randRange( 1, 10 ) )</var>
- <var id="TERMS">[expr( ["+", ["*", A, X], ["*", B, X]] ), expr( ["+", ["*", A, X], ["*", B, X], C] ), expr( ["+", ["*", A, X], C, ["*", B, X]] ),
- expr( ["+", ["*", A, X], C, ["*", B, X], D] ), expr( ["+", ["*", A, X], C, D, ["*", B, X]] ), expr( ["+", ["*", A, X], C, D] ), expr( ["+", C, ["*", A, X], D] ),
- expr( ["+", ["*", A, X], ["*", F, ["+", ["*", B, X], D]]] ), expr( ["+", C, ["*", F, ["+", D, ["*", B, X]]]] ),
- expr( ["+", ["*", E, ["+", C, ["*", A, X]]], ["*", F, ["+", ["*", B, X], D]]] ), expr( ["+", ["*", E, ["+", ["*", A, X], C]], ["*", F, ["+", D, ["*", B, X]]]] )][INDEX]</var>
- <var id="DIST1">INDEX &gt; 8 ? 1 : 0</var>
- <var id="DIST2">INDEX &gt; 6 ? 1 : 0</var>
- <var id="COMBINE1">( INDEX === 5 || INDEX === 6 || INDEX === 8 ) ? 0 : 1</var>
- <var id="COMBINE2">( INDEX === 0 || INDEX === 1 || INDEX === 2 || INDEX === 7 ) ? 0 : 1</var>
- <var id="ANSWER1">INDEX &lt; 5 ? A + B : ( INDEX === 5 || INDEX === 6 ) ? A : INDEX === 7 ? A + F * B : INDEX === 8 ? F * B : E * A + F * B</var>
- <var id="ANSWER2">INDEX &lt; 3 ? C : ( INDEX &gt; 2 && INDEX &lt; 7 ) ? C + D : INDEX == 7 ? F * D : INDEX === 8 ? C + F * D : E * C + F * D</var>
+ <div id="ax_fbx_fd">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_AX_FBX + ((F * D) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_FD,
+ TERM_FD + ((A + F * B) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_AX_FBX
+ ]</var>
</div>
- <p class="question">Simplify the expression below.</p>
- <p><code>\large{<var>TERMS</var>}</code></p>
- <div class="solution" data-type="set">
- <div class="set-sol" data-type="multiple">
- <span class="sol" data-if="ANSWER1 === -1" data-type="regex">^\s*[-\u2212]1?\s*$</span>
- <span class="sol" data-else data-fallback="1"><var>ANSWER1</var></span>
- <span data-if="INDEX !== 0"><span class="sol"><var>ANSWER2</var></span></span>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", A, X], ["*", F, ["+", ["*", B, X], D]]])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p data-if="F === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the parentheses by
+ <code>\purple{<var>F</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>F</var>}</code> into the parentheses:
+ <p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>F &lt; 0 ? "" : "+"</var>
+ \purple{<var>F</var>(}\gray{<var>expr(["+", ["*", B, X], D])</var>}\purple{)}
+ </code>
+ </p>
+ <p>
+ <code>\qquad <var>expr(["*", A, X])</var>
+ <var>(F * B) &lt; 0 ? "" : "+"</var>
+ \purple{<var>expr(["+", ["*", F * B, X], F * D])</var>}
+ </code>
+ </p>
</div>
- <div class="input-format">
- <p class="entry" data-type="multiple">
- <span class="sol"></span><code><var>X</var></code><span data-if="INDEX !== 0"><code>\space + \space</code><span class="sol"></span></span>
+ <div>
+ <p>Combine the <code><var>X</var></code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A, X])</var> + <var>expr(["*", F * B, X])</var>} + <var>F * D</var></code>
+ </p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", A + (F * B), X])</var>} + <var>F * D</var></code>
</p>
</div>
- <p class="example">enter integers for the coefficient and constant terms, such as -3 or 10</p>
+ <p>The simplified expression is <code><var>expr(["+", ["*", A + (F * B), X], F * D])</var></code>
</div>
+ </div>
+
+ <div id="c_fd_fbx">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_FBX + ((C + F * D) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_C_FD,
+ TERM_C_FD + ((F * B) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_FBX
+ ]</var>
+ </div>
+ <p class="problem">
+ <code>\large{<var>expr(["+", C, ["*", F, ["+", ["*", B, X], D]]])</var>}</code>
+ </p>
<div class="hints">
- <div data-if="DIST1">
- <p>Distribute over the first parenthesis.</p>
- <div data-if="INDEX === 9">
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["*", E, ["+", C, ["*", A, X]]] )</var>} + <var>expr( ["*", F, ["+", ["*", B, X], D]] )</var></code></p>
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["+", E * C, ["*", E * A, X]] )</var>} + <var>expr( ["*", F, ["+", ["*", B, X], D]] )</var></code></p>
- </div>
- <div data-if="INDEX === 10">
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["*", E, ["+", ["*", A, X], C]] )</var>} + <var>expr( ["*", F, ["+", D, ["*", B, X]]] )</var></code></p>
- <p><code>\color{<var>BLUE</var>}{<var>expr( ["+", ["*", E * A, X], E * C] )</var>} + <var>expr( ["*", F, ["+", D, ["*", B, X]]] )</var></code></p>
- </div>
+ <div>
+ <p data-if="F === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the parentheses by
+ <code>\purple{<var>F</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>F</var>}</code> into the parentheses:
+ <p>
+ <p>
+ <code>\qquad <var>C</var>
+ <var>F &lt; 0 ? "" : "+"</var>
+ \purple{<var>F</var>(}\gray{<var>expr(["+", ["*", B, X], D])</var>}\purple{)}
+ </code>
+ </p>
+ <p>
+ <code>\qquad <var>C</var>
+ <var>(F * B) &lt; 0 ? "" : "+"</var>
+ \purple{<var>expr(["+", ["*", F * B, X], F * D])</var>}
+ </code>
+ </p>
</div>
- <div data-if="DIST2">
- <p>Distribute over the <span data-if="DIST1">second </span>parenthesis.</p>
- <div data-if="INDEX === 7">
- <p><code><var>expr( ["*", A, X] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", ["*", B, X], D]] )</var>}</code></p>
- <p><code><var>expr( ["*", A, X] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * B ) < 0">-</span><span data-else>+</span><var>expr( ["+", ["*", abs( F * B ), X], F * D] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 8">
- <p><code><var>C</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", D, ["*", B, X]]] )</var>}</code></p>
- <p><code><var>C</var>\color{<var>ORANGE</var>}{<span data-if="( F * D ) < 0">-</span><span data-else>+</span><var>expr( ["+", abs( F * D ), ["*", F * B, X]] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 9">
- <p><code><var>expr( ["+", E * C, ["*", E * A, X]] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", ["*", B, X], D]] )</var>}</code></p>
- <p><code><var>expr( ["+", E * C, ["*", E * A, X]] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * B ) < 0">-</span><span data-else>+</span><var>expr( ["+", ["*", abs( F * B ), X], F * D] )</var>}</code></p>
- </div>
- <div data-if="INDEX === 10">
- <p><code><var>expr( ["+", ["*", E * A, X], E * C] )</var>\color{<var>ORANGE</var>}{<span data-if="F < 0">-</span><span data-else>+</span><var>expr( ["*", abs( F ), ["+", D, ["*", B, X]]] )</var>}</code></p>
- <p><code><var>expr( ["+", ["*", E * A, X], E * C] )</var>\color{<var>ORANGE</var>}{<span data-if="( F * D ) < 0">-</span><span data-else>+</span><var>expr( ["+", abs( F * D ), ["*", F * B, X]] )</var>}</code></p>
- </div>
+ <div>
+ <p>
+ Rewrite the expression to group the
+ <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <p>
+ <code>\qquad <var>expr(["*", F * B, X])</var>
+ <var>C &lt; 0 ? "" : "+"</var>
+ \blue{<var>C</var> + <var>F * D</var>}</code>
+ </p>
</div>
- <div data-if="COMBINE1">
- <p>Combine the variable terms:</p>
- <p data-if="INDEX === 0"><code><var>color( A + X, 0 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var></code></p>
- <p data-if="INDEX === 1"><code><var>color( A + X, 0 )</var> + <var>color( B + X, 0 )</var> + <var>color( C, 2 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var></code></p>
- <p data-if="INDEX === 2"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var></code></p>
- <p data-if="INDEX === 3"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( B + X, 0 )</var> + <var>color( D, 2 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var></code></p>
- <p data-if="INDEX === 4"><code><var>color( A + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var> + <var>color( B + X, 0 )</var> = <var>color( ( A + B ) + X, 0 )</var> + <var>color( C, 2 )</var> + <var>color( D, 2 )</var></code></p>
- <p data-if="INDEX === 7"><code><var>color( A + X, 0 )</var> + <var>color( ( F * B ) + X, 0 )</var> + <var>color( ( F * D ), 2 )</var> = <var>color( ( A + F * B ) + X, 0 )</var> + <var>color( ( F * D ), 2 )</var></code></p>
- <p data-if="INDEX === 9"><code><var>color( E * C, 2 )</var> + <var>color( ( E * A ) + X, 0 )</var> + <var>color( ( F * B ) + X, 0 )</var> + <var>color( F * D, 2 )</var> = <var>color( ( E * A + F * B ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var></code></p>
- <p data-if="INDEX === 10"><code><var>color( ( E * A ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var> + <var>color( ( F * B ) + X, 0 )</var> = <var>color( ( E * A + F * B ) + X, 0 )</var> + <var>color( E * C, 2 )</var> + <var>color( F * D, 2 )</var></code></p>
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad <var>expr(["*", F * B, X])</var>
+ <var>(C + F * D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>C + F * D</var>}</code>
+ </p>
</div>
- <div data-if="COMBINE2">
- <p>Combine the constant terms:</p>
- <p data-if="INDEX === 3 || INDEX === 4"><code><var>color( ( A + B ) + X, 2 )</var> + <var>color( C, 1 )</var> + <var>color( D, 1 )</var> = <var>color( ( A + B ) + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 5"><code><var>color( A + X, 2 )</var> + <var>color( C, 1 )</var> + <var>color( D, 1 )</var> = <var>color( A + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 6"><code><var>color( C, 1 )</var> + <var>color( A + X, 2 )</var> + <var>color( D, 1 )</var> = <var>color( A + X, 2 )</var> + <var>color( ( C + D ), 1 )</var></code></p>
- <p data-if="INDEX === 8"><code><var>color( C, 1 )</var> + <var>color( F * D, 1 )</var> + <var>color( ( F * B ) + X, 2 )</var> = <var>color( ( F * B ) + X, 2 )</var> + <var>color( ( C + F * D ), 1 )</var></code></p>
- <p data-if="INDEX === 9"><code><var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C, 1 )</var> + <var>color( F * D, 1 )</var> = <var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C + F * D, 1 )</var></code></p>
- <p data-if="INDEX === 10"><code><var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C, 1 )</var> + <var>color( F * D, 1 )</var> = <var>color( ( E * A + F * B ) + X, 2 )</var> + <var>color( E * C + F * D, 1 )</var></code></p>
+ <p>The simplified expression is <code><var>expr(["+", ["*", F * B, X], C + F * D])</var></code>
+ </div>
+ </div>
+
+ <div id="ec_eax_fbx_fd">
+ <div class="vars">
+ <var id="SOLUTIONS">[
+ TERM_EAX_FBX + ((E * C + F * D) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_EC_FD,
+ TERM_EC_FD + ((E * A + F * B) &gt; 0 ? "\\s*\\+\\s*" : "\\s*") + TERM_EAX_FBX
+ ]</var>
+ </div>
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", E, ["+", C, ["*", A, X]]], ["*", F, ["+", ["*", B, X], D]]])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p data-if="E === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the first parentheses by
+ <code>\purple{<var>E</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>E</var>}</code> into the first set of parentheses:
+ <p>
+ <p>
+ <code>\qquad
+ \purple{<var>E</var>(}\gray{<var>expr(["+", C, ["*", A, X]])</var>}\purple{)}
+ + <var>expr(["*", F, ["+", ["*", B, X], D]])</var>
+ </code>
+ </p>
+ <p>
+ <code>\qquad
+ \purple{<var>expr(["+", E * C, ["*", E * A, X]])</var>}
+ + <var>expr(["*", F, ["+", ["*", B, X], D]])</var>
+ </code>
+ </p>
</div>
- <div class="final_answer">
- <p data-if="INDEX === 0">The simplified expression is <code><var>expr( ["*", A + B, X] )</var></code>.</p>
- <p data-if="INDEX === 1 || INDEX === 2">The simplified expression is <code><var>expr( ["+", ["*", A + B, X], C] )</var></code>.</p>
- <p data-if="INDEX === 3 || INDEX === 4">The simplified expression is <code><var>expr( ["+", ["*", A + B, X], C + D] )</var></code>.</p>
- <p data-if="INDEX === 5 || INDEX === 6">The simplified expression is <code><var>expr( ["+", ["*", A, X], C + D] )</var></code>.</p>
- <p data-if="INDEX === 7">The simplified expression is <code><var>expr( ["+", ["*", A + F * B, X], F * D] )</var></code>.</p>
- <p data-if="INDEX === 8">The simplified expression is <code><var>expr( ["+", ["*", F * B, X], C + F * D] )</var></code>.</p>
- <p data-if="INDEX === 9 || INDEX === 10">The simplified expression is <code><var>expr( ["+", ["*", E * A + F * B, X], E * C + F * D] )</var></code>.</p>
+ <div>
+ <p data-if="F === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the parentheses by
+ <code>\purple{<var>F</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>F</var>}</code> into the parentheses:
+ <p>
+ <p>
+ <code>\qquad <var>expr(["+", E * C, ["*", E * A, X]])</var>
+ <var>F &lt; 0 ? "" : "+"</var>
+ \purple{<var>F</var>(}\gray{<var>expr(["+", ["*", B, X], D])</var>}\purple{)}
+ </code>
+ </p>
+ <p>
+ <code>\qquad <var>expr(["+", E * C, ["*", E * A, X]])</var>
+ <var>(F * B) &lt; 0 ? "" : "+"</var>
+ \purple{<var>expr(["+", ["*", F * B, X], F * D])</var>}
+ </code>
+ </p>
+ </div>
+ <div>
+ <p>
+ Rewrite the expression to group the
+ <code>\pink{<var>X</var>}</code> terms and
+ <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A, X])</var> +
+ <var>expr(["*", F * B, X])</var>} <var>(E * C) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C</var> + <var>F * D</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>Combine the <code>\pink{<var>X</var>}</code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A + F * B, X])</var>}
+ <var>(E * C) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C</var> + <var>F * D</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A + F * B, X])</var>}
+ <var>(E * C + F * D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C + F * D</var>}</code>
+ </p>
</div>
+ <p>The simplified expression is <code><var>expr(["+", ["*", E * A + F * B, X], E * C + F * D])</var></code>
</div>
</div>
+
+ <div id="eax_ec_fd_fbx" data-type="ec_eax_fbx_fd">
+ <p class="problem">
+ <code>\large{<var>expr(["+", ["*", E, ["+", ["*", A, X], C]], ["*", F, ["+", D, ["*", B, X]]]])</var>}</code>
+ </p>
+ <div class="hints">
+ <div>
+ <p data-if="E === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the first parentheses by
+ <code>\purple{<var>E</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>E</var>}</code> into the first set of parentheses:
+ <p>
+ <p>
+ <code>\qquad
+ \purple{<var>E</var>(}\gray{<var>expr(["+", ["*", A, X], C])</var>}\purple{)}
+ + <var>expr(["*", F, ["+", D, ["*", B, X]]])</var>
+ </code>
+ </p>
+ <p>
+ <code>\qquad
+ \purple{<var>expr(["+", ["*", E * A, X], E * C])</var>}
+ + <var>expr(["*", F, ["+", D, ["*", B, X]]])</var>
+ </code>
+ </p>
+ </div>
+ <div>
+ <p data-if="F === -1">
+ The minus sign in front of the parentheses means we
+ multiply each term inside the parentheses by
+ <code>\purple{<var>F</var>}</code>:
+ </p>
+ <p data-else>
+ Distribute the <code>\purple{<var>F</var>}</code> into the parentheses:
+ <p>
+ <p>
+ <code>\qquad <var>expr(["+", ["*", E * A, X], E * C])</var>
+ <var>F &lt; 0 ? "" : "+"</var>
+ \purple{<var>F</var>(}\gray{<var>expr(["+", D, ["*", B, X]])</var>}\purple{)}
+ </code>
+ </p>
+ <p>
+ <code>\qquad <var>expr(["+", ["*", E * A, X], E * C])</var>
+ <var>(F * D) &lt; 0 ? "" : "+"</var>
+ \purple{<var>expr(["+", F * D, ["*", F * B, X]])</var>}
+ </code>
+ </p>
+ </div>
+ <div>
+ <p>
+ Rewrite the expression to group the
+ <code>\pink{<var>X</var>}</code> terms and
+ <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A, X])</var> +
+ <var>expr(["*", F * B, X])</var>} <var>(E * C) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C</var> + <var>F * D</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>Combine the <code>\pink{<var>X</var>}</code> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A + F * B, X])</var>}
+ <var>(E * C) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C</var> + <var>F * D</var>}</code>
+ </p>
+ </div>
+ <div>
+ <p>Combine the <span class="hint_blue">numeric</span> terms:</p>
+ <p>
+ <code>\qquad\pink{<var>expr(["*", E * A + F * B, X])</var>}
+ <var>(E * C + F * D) &lt; 0 ? "" : "+"</var>
+ \blue{<var>E * C + F * D</var>}</code>
+ </p>
+ </div>
+ <p>The simplified expression is <code><var>expr(["+", ["*", E * A + F * B, X], E * C + F * D])</var></code>
+ </div>
+ </div>
+
</div>
- </div>
+</div>
</body>
</html>
Please sign in to comment.
Something went wrong with that request. Please try again.