Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rewrite absolute_value_equations to not use multiple choice

Summary: CCing Emily since you might appreciate the interesting answer type hack

Test Plan: Tested locally

Reviewers: stephanie

Reviewed By: stephanie

CC: emily

Differential Revision: http://phabricator.khanacademy.org/D958
  • Loading branch information...
commit 3a9c2f13cd1b88e03cc3bbfe439367d0ea77c7ae 1 parent 103deac
@beneater beneater authored
Showing with 431 additions and 236 deletions.
  1. +431 −236 exercises/absolute_value_equations.html
View
667 exercises/absolute_value_equations.html
@@ -4,90 +4,41 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Absolute value equations</title>
<script src="../khan-exercise.js"></script>
+ <style>
+ #answer_area .short input[type=text] {
+ width: 40px;
+ }
+ </style>
</head>
<body>
<div class="exercise">
- <div class="vars">
- <var id="A">randRange(2, 8)</var>
- <var id="B">randRangeNonZero(-10, 10)</var>
- <var id="C" data-ensure="C !== A">randRangeNonZero(-6, 6)</var>
- <var id="D" data-ensure="D !== B">randRange(2, 10)</var>
- <var id="E">randRangeNonZero(-10, 10)</var>
- <var id="ABS_A_MINUS_C">abs(A-C)</var>
- <var id="SIMPLIFIED">fractionReduce(D-B, A-C)</var>
- <var id="HAS_SOLUTION">(D-B)/(A-C) > 0</var>
- <var id="SIMPLIFIED_DENOM">abs((A-C)/getGCD(D-B, A-C))</var>
- <var id="POS_RESULT">
- (function() {
- if ((D-B)/(A-C) > 0) {
- return fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C));
- } else {
- return "No solution";
- }
- })()
- </var>
- <var id="NEG_RESULT">
- (function() {
- if ((D-B)/(A-C) > 0) {
- return fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C));
- } else {
- return "No solution";
- }
- })()
- </var>
- <var id="SOLUTION">
- (function() {
- if ((D-B)/(A-C) > 0) {
- return "&lt;code&gt;"
- +"x = "
- +fractionReduce(-1*abs(D-B)-E*abs(A-C), abs(A-C))
- +"\\text{ or }"
- +"x = "
- +fractionReduce(abs(D-B)-E*abs(A-C), abs(A-C))
- +"&lt;/code&gt;";
- } else {
- return "No solution";
- }
- })()
- </var>
- <var id="CHOICES">
- (function() {
- var choices = [];
-
- for (var i = 0; i &lt; 4; i++) {
- var choice = "&lt;code&gt;";
- var nOffset = randRange(1, 10);
- var dOffset = randRangeExclude(1, 10, [ C-A ]);
- var tOffset = randRange(1, 10);
- if (D-B+nOffset === 0 &amp;&amp; E+tOffset === 0) {
- choice += "x = 0";
- } else {
- choice += "x = "
- +fractionReduce(-1*abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset))
- +"\\text{ or }"
- +"x = "
- +fractionReduce(abs(D-B+nOffset)-(E+tOffset)*abs(A-C+dOffset), abs(A-C+dOffset));
- }
- choice += "&lt;/code&gt;";
- choices.unshift(choice);
- }
-
- if ((D-B)/(A-C) > 0) {
- choices.shift();
- choices.unshift(SOLUTION);
- choices = shuffle(choices);
- choices.push("No solution");
- } else {
- choices = shuffle(choices);
- choices.push(SOLUTION);
- }
-
- return choices;
- })()</var>
- </div>
-
<div class="problems">
- <div>
+ <div id="0">
+ <div class="vars">
+ <var id="A">randRange(2, 8)</var>
+ <var id="B">randRangeNonZero(-10, 10)</var>
+ <var id="C" data-ensure="C !== A">
+ randRangeNonZero(-6, 6)
+ </var>
+ <var id="D" data-ensure="D !== B">randRange(2, 10)</var>
+ <var id="E">randRangeNonZero(-10, 10)</var>
+ <var id="NO_SOLUTION">(D - B) / (A - C) &lt;= 0</var>
+ <var id="POS_SOLUTION">
+ [abs(D - B) - E * abs(A - C), abs(A - C)]
+ </var>
+ <var id="NEG_SOLUTION">
+ [-1 * abs(D - B) - E * abs(A - C), abs(A - C)]
+ </var>
+ <var id="SOLUTIONS">NO_SOLUTION ? [] : [
+ POS_SOLUTION[0] / POS_SOLUTION[1],
+ NEG_SOLUTION[0] / NEG_SOLUTION[1]
+ ]</var>
+ <var id="SIMPLIFIED">fractionReduce(D - B, A - C)</var>
+ <var id="SIMPLIFIED_DENOM">
+ abs((A - C) / getGCD(D - B, A - C))
+ </var>
+ </div>
+
<p class="question">
Solve for <code>x</code>:
<br><br>
@@ -97,171 +48,415 @@
</code>
</p>
- <p class="solution"><var>SOLUTION</var></p>
-
- <ul class="choices" data-category="true">
- <li data-each="CHOICES as choice"><var>choice</var></li>
- </ul>
- </div>
- </div>
-
- <div class="hints">
- <div data-if="A > C" data-unwrap>
- <div>
- <p><var>C > 0 ? "Subtract" : "Add"</var> <code><var>abs(C)</var>|x + <var>E</var>|</code> <var>C > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>
- (<var>A</var>|x + <var>E</var>| + <var>B</var>) - <var>C</var>|x + <var>E</var>| =
- (<var>C</var>|x + <var>E</var>| + <var>D</var>) - <var>C</var>|x + <var>E</var>|
- </code></p>
- <p><code>
- <var>A - C</var>|x + <var>E</var>| + <var>B</var> = <var>D</var>
- </code></p>
- </div>
- <div>
- <p><var>B > 0 ? "Subtract" : "Add"</var> <code><var>abs(B)</var></code> <var>B > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>
- (<var>A - C</var>|x + <var>E</var>| + <var>B</var>) - <var>B</var> =
- <var>D</var> - <var>B</var>
- </code></p>
- <p><code>
- <var>A - C</var>|x + <var>E</var>| = <var>D - B</var>
- </code></p>
- </div>
- <div data-if="ABS_A_MINUS_C !== 1">
- <p>Divide both sides by <code><var>A - C</var></code>.</p>
- <p><code>
- \dfrac{<var>A - C</var>|x + <var>E</var>|}{<var>A - C</var>} =
- <var>fraction(D-B, A-C)</var>
- </code></p>
- </div>
- <div>
- <p>Simplify.</p>
- <p><code>|x + <var>E</var>| = <var>SIMPLIFIED</var></code></p>
- </div>
- <div data-if="HAS_SOLUTION" data-unwrap>
- <div>
- <p>Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:</p>
- <p><code>x + <var>E</var> = - <var>SIMPLIFIED</var></code></p>
- <p>or</p>
- <p><code>x + <var>E</var> = <var>SIMPLIFIED</var></code></p>
- </div>
- <div>
- <p>Calculate the solution where <code>x + <var>E</var></code> is negative.</p>
- <p><code>x + <var>E</var> = - <var>SIMPLIFIED</var></code></p>
- </div>
- <div>
- <p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>x + <var>E</var> - <var>E</var> = - <var>SIMPLIFIED</var> - <var>E</var></code></p>
- <p><code>x = - <var>SIMPLIFIED</var> - <var>E</var></code></p>
- </div>
- <div data-if="SIMPLIFIED_DENOM !== 1">
- <p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
- <p><code>x = - <var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
- <p><code>x = - <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
- </div>
- <div>
- <p><code>x = <var>NEG_RESULT</var></code></p>
+ <div class="solution" data-type="multiple">
+ <div class="sol" data-type="set">
+ <div class="set-sol" data-each="SOLUTIONS as SOLUTION">
+ <var>SOLUTION</var>
+ </div>
+ <p class="input-format">
+ <code>x = </code> <span class="entry short"></span>
+ &nbsp; or
+ <code>x = </code> <span class="entry short"></span>
+ </p>
</div>
+ <p></p>
<div>
- <p>Then calculate the solution where <code>x + <var>E</var></code> is positive.</p>
- <p><code>x + <var>E</var> = <var>SIMPLIFIED</var></code></p>
+ <label>
+ <span class="sol" data-type="checkbox">
+ <var>NO_SOLUTION</var>
+ </span>
+ No solution
+ </label>
</div>
- <div>
- <p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>x + <var>E</var> - <var>E</var> = <var>SIMPLIFIED</var> - <var>E</var></code></p>
- <p><code>x = <var>SIMPLIFIED</var> - <var>E</var></code></p>
- </div>
- <div data-if="SIMPLIFIED_DENOM !== 1">
- <p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
- <p><code>x = <var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
- <p><code>x = <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var></code></p>
- </div>
- <div>
- <p><code>x = <var>POS_RESULT</var></code></p>
+ <!--
+ Hack to not grade an unanswered question.
+ Note that this custom answer is required. It checks to
+ see if both textboxes are empty and the checkbox isn't
+ checked. In that case, the custom validator returns "".
+ Since it's required, this will cause the entire answer
+ to not be graded. Otherwise it returns true an the
+ rest of the multiple answer will be checked normally.
+ -->
+ <div class="sol" data-type="custom" required>
+ <div class="guess">
+ $("#solutionarea input").eq(0).val() === ""
+ &amp;&amp;
+ $("#solutionarea input").eq(1).val() === ""
+ &amp;&amp;
+ !$("#solutionarea input").eq(2).is(":checked")
+ </div>
+ <div class="validator-function">
+ return guess ? "" : true;
+ </div>
</div>
+ <span class="example">
+ one or two integers, like <code>6</code>
+ </span>
+ <span class="example">
+ one or two <em>simplified proper</em> fractions, like
+ <code>3/5</code>
+ </span>
+ <span class="example">
+ one or two <em>simplified improper</em> fractions, like
+ <code>7/4</code>
+ </span>
+ <span class="example">
+ one or two <em>exact</em> decimals, like
+ <code>0.75</code>
+ </span>
+ <span class="example">
+ if there is no solution for <code>x</code>, leave the
+ boxes blank and check "<b>No solution</b>"
+ </span>
</div>
- </div>
- <div data-else data-unwrap>
- <div>
- <p><var>A > 0 ? "Subtract" : "Add"</var> <code><var>A</var>|x + <var>E</var>|</code> <var>A > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>
- (<var>A</var>|x + <var>E</var>| + <var>B</var>) - <var>A</var>|x + <var>E</var>| =
- (<var>C</var>|x + <var>E</var>| + <var>D</var>) - <var>A</var>|x + <var>E</var>|
- </code></p>
- <p><code>
- <var>B</var> = <var>C - A</var>|x + <var>E</var>| + <var>D</var>
- </code></p>
- </div>
- <div>
- <p><var>D > 0 ? "Subtract" : "Add"</var> <code><var>abs(D)</var></code> <var>D > 0 ? "from" : "to"</var> both sides:</p>
- <p><code>
- <var>B</var> - <var>D</var> =
- (<var>C - A</var>|x + <var>E</var>| + <var>D</var>) - <var>D</var>
- </code></p>
- <p><code>
- <var>B - D</var> = <var>C - A</var>|x + <var>E</var>|
- </code></p>
- </div>
- <div data-if="ABS_A_MINUS_C !== 1">
- <p>Divide both sides by <code><var>C - A</var></code>.</p>
- <p><code>
- <var>fraction(B-D, C-A)</var> =
- \dfrac{<var>C - A</var>|x + <var>E</var>|}{<var>C - A</var>}
- </code></p>
- </div>
- <div>
- <p>Simplify.</p>
- <p><code><var>SIMPLIFIED</var> = |x + <var>E</var>|</code></p>
- </div>
- <div data-if="HAS_SOLUTION" data-unwrap>
- <div>
- <p>Because the absolute value of an expression is its distance from zero, it has two solutions, one negative and one positive:</p>
- <p><code>- <var>SIMPLIFIED</var> = x + <var>E</var></code></p>
- <p>or</p>
- <p><code><var>SIMPLIFIED</var> = x + <var>E</var></code></p>
- </div>
- <div>
- <p>Calculate the solution where <code>x + <var>E</var></code> is negative.</p>
- <p><code> - <var>SIMPLIFIED</var> = x + <var>E</var></code></p>
- </div>
- <div>
- <p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
- <p><code> - <var>SIMPLIFIED</var> - <var>E</var> = x + <var>E</var> - <var>E</var></code></p>
- <p><code> - <var>SIMPLIFIED</var> - <var>E</var> = x</code></p>
- </div>
- <div data-if="SIMPLIFIED_DENOM !== 1">
- <p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
- <p><code>- <var>SIMPLIFIED</var> - <var>E</var>\cdot<var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
- <p><code>- <var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
- </div>
- <div>
- <p><code><var>NEG_RESULT</var> = x</code></p>
- </div>
- <div>
- <p>Then calculate the solution where <code>x + <var>E</var></code> is positive.</p>
- <p><code><var>SIMPLIFIED</var> = x + <var>E</var></code></p>
- </div>
- <div>
- <p><var>E > 0 ? "Subtract" : "Add"</var> <code><var>abs(E)</var></code> <var>E > 0 ? "from" : "to"</var> both sides:</p>
- <p><code><var>SIMPLIFIED</var> - <var>E</var> = x + <var>E</var> - <var>E</var></code></p>
- <p><code><var>SIMPLIFIED</var> - <var>E</var> = x</code></p>
- </div>
- <div data-if="SIMPLIFIED_DENOM !== 1">
- <p>Change the term to an equivalent fraction with a denominator of <code><var>SIMPLIFIED_DENOM</var></code>.</p>
- <p><code><var>SIMPLIFIED</var> - <var>E</var>\cdot <var>fraction(SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
- <p><code><var>SIMPLIFIED</var><var>E > 0 ? "-" : "+"</var> <var>fraction(abs(E)*SIMPLIFIED_DENOM,SIMPLIFIED_DENOM)</var> = x</code></p>
+
+ <div class="hints">
+ <div data-if="A > C" data-unwrap>
+ <div>
+ <p>
+ <var>C &gt; 0 ? "Subtract" : "Add"</var>
+ <code>
+ \red{<var>abs(C)</var>|x + <var>E</var>|}
+ </code>
+ <var>C &gt; 0 ? "from" : "to"</var> both sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ <var>A</var>|x + <var>E</var>| + <var>B</var>
+ &amp;=&amp;
+ <var>C</var>|x + <var>E</var>| + <var>D</var>
+ \\ \\
+ \red{ - <var>C</var>|x + <var>E</var>|}
+ &amp;&amp;
+ \red{ - <var>C</var>|x + <var>E</var>|} \\ \\
+ <var>A - C</var>|x + <var>E</var>| +
+ <var>B</var>
+ &amp;=&amp; <var>D</var>
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div>
+ <p>
+ <var>B &gt; 0 ? "Subtract" : "Add"</var>
+ <code>\red{<var>abs(B)</var>}</code>
+ <var>B &gt; 0 ? "from" : "to"</var> both sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ <var>A - C</var>|x + <var>E</var>| +
+ <var>B</var> &amp;=&amp; <var>D</var> \\ \\
+ \red{ - <var>B</var>} &amp;=&amp;
+ \red{ - <var>B</var>} \\ \\
+ <var>A - C</var>|x + <var>E</var>| &amp;=&amp;
+ <var>D - B</var>
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="abs(A - C) !== 1">
+ <p>
+ Divide both sides by
+ <code>\red{<var>A - C</var>}</code>:
+ </p>
+ <p><code>\qquad
+ \dfrac{<var>A - C</var>|x + <var>E</var>|}
+ {\red{<var>A - C</var>}} =
+ \dfrac{<var>D - B</var>}
+ {\red{<var>A - C</var>}}
+ </code></p>
+ </div>
+ <div>
+ <p>Simplify:</p>
+ <p>
+ <code>\qquad |x + <var>E</var>| =
+ <var>SIMPLIFIED</var></code>
+ </p>
+ </div>
+ <div data-if="!NO_SOLUTION" data-unwrap>
+ <div>
+ <p>
+ Because the absolute value of an expression
+ is its distance from zero, it has two
+ solutions, one negative and one positive:
+ </p>
+ <p><code>\qquad
+ x + <var>E</var> = -<var>SIMPLIFIED</var>
+ </code></p>
+ <p>or</p>
+ <p><code>\qquad
+ x + <var>E</var> = <var>SIMPLIFIED</var>
+ </code></p>
+ </div>
+ <div>
+ <p>
+ Solve for the solution where
+ <code>x + <var>E</var></code> is negative:
+ </p>
+ <p><code>\qquad
+ x + <var>E</var> = -<var>SIMPLIFIED</var>
+ </code></p>
+ </div>
+ <div>
+ <p>
+ <var>E &gt; 0 ? "Subtract" : "Add"</var>
+ <code>\red{<var>abs(E)</var>}</code>
+ <var>E &gt; 0 ? "from" : "to"</var> both
+ sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ x + <var>E</var> &amp;=&amp;
+ -<var>SIMPLIFIED</var> \\ \\
+ \red{- <var>E</var>} &amp;&amp;
+ \red{- <var>E</var>} \\ \\
+ x &amp;=&amp; -<var>SIMPLIFIED</var> -
+ <var>E</var>
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="SIMPLIFIED_DENOM !== 1">
+ <p>
+ Change the
+ <code>\red{{} - <var>E</var>}</code>
+ to an equivalent fraction with a
+ denominator of
+ <code><var>SIMPLIFIED_DENOM</var></code>:
+ </p>
+ <p><code>\qquad
+ x = - <var>SIMPLIFIED</var>
+ \red{<var>E &gt; 0 ? "-" : "+"</var>
+ <var>fraction(abs(E) * SIMPLIFIED_DENOM,
+ SIMPLIFIED_DENOM)</var>}
+ </code></p>
+ </div>
+ <p><code>\qquad
+ x = <var>fractionReduce.apply(null,
+ NEG_SOLUTION)</var>
+ </code></p>
+ <div>
+ <p>
+ Then calculate the solution where
+ <code>x + <var>E</var></code> is positive:
+ </p>
+ <p><code>\qquad
+ x + <var>E</var> = <var>SIMPLIFIED</var>
+ </code></p>
+ </div>
+ <div>
+ <p>
+ <var>E &gt; 0 ? "Subtract" : "Add"</var>
+ <code>\red{<var>abs(E)</var>}</code>
+ <var>E &gt; 0 ? "from" : "to"</var> both
+ sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ x + <var>E</var> &amp;=&amp;
+ <var>SIMPLIFIED</var> \\ \\
+ \red{- <var>E</var>} &amp;&amp;
+ \red{- <var>E</var>} \\ \\
+ x &amp;=&amp; <var>SIMPLIFIED</var> -
+ <var>E</var>
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="SIMPLIFIED_DENOM !== 1">
+ <p>
+ Change the
+ <code>\red{{} - <var>E</var>}</code>
+ to an equivalent fraction with a
+ denominator of
+ <code><var>SIMPLIFIED_DENOM</var></code>:
+ </p>
+ <p><code>\qquad
+ x = <var>SIMPLIFIED</var>
+ \red{<var>E &gt; 0 ? "-" : "+"</var>
+ <var>fraction(abs(E) * SIMPLIFIED_DENOM,
+ SIMPLIFIED_DENOM)</var>}
+ </code></p>
+ </div>
+ <p><code>\qquad
+ x = <var>fractionReduce.apply(null,
+ POS_SOLUTION)</var>
+ </code></p>
+ </div>
</div>
- <div>
- <p><code><var>POS_RESULT</var> = x</code></p>
+ <div data-else data-unwrap>
+ <div>
+ <p>
+ <var>A &gt; 0 ? "Subtract" : "Add"</var>
+ <code>
+ \red{<var>A</var>|x + <var>E</var>|}
+ </code>
+ <var>A &gt; 0 ? "from" : "to"</var> both sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ <var>A</var>|x + <var>E</var>| + <var>B</var>
+ &amp;=&amp;
+ <var>C</var>|x + <var>E</var>| + <var>D</var>
+ \\ \\ \red{- <var>A</var>|x + <var>E</var>|}
+ &amp;&amp;
+ \red{- <var>A</var>|x + <var>E</var>|} \\ \\
+ <var>B</var> &amp;=&amp;
+ <var>C - A</var>|x + <var>E</var>| +
+ <var>D</var>
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div>
+ <p>
+ <var>D &gt; 0 ? "Subtract" : "Add"</var>
+ <code><var>abs(D)</var></code>
+ <var>D &gt; 0 ? "from" : "to"</var> both sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ <var>B</var> &amp;=&amp;
+ <var>C - A</var>|x + <var>E</var>| +
+ <var>D</var> \\ \\
+ \red{- <var>D</var>} &amp;&amp;
+ \red{- <var>D</var>} \\ \\
+ <var>B - D</var> &amp;=&amp;
+ <var>C - A</var>|x + <var>E</var>|
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="abs(A - C) !== 1">
+ <p>
+ Divide both sides by
+ <code>\red{<var>C - A</var>}</code>.
+ </p>
+ <p><code>\qquad
+ \dfrac{<var>B - D</var>}
+ {\red{<var>C - A</var>}} =
+ \dfrac{<var>C - A</var>|x + <var>E</var>|}
+ {\red{<var>C - A</var>}}
+ </code></p>
+ </div>
+ <div>
+ <p>Simplify:</p>
+ <p><code>\qquad
+ <var>SIMPLIFIED</var> = |x + <var>E</var>|
+ </code></p>
+ </div>
+ <div data-if="!NO_SOLUTION" data-unwrap>
+ <div>
+ <p>
+ Because the absolute value of an expression
+ is its distance from zero, it has two
+ solutions, one negative and one positive:
+ </p>
+ <p><code>\qquad
+ -<var>SIMPLIFIED</var> = x + <var>E</var>
+ </code></p>
+ <p>or</p>
+ <p><code>\qquad
+ <var>SIMPLIFIED</var> = x + <var>E</var>
+ </code></p>
+ </div>
+ <div>
+ <p>
+ Solve for the solution where
+ <code>x + <var>E</var></code> is negative:
+ </p>
+ <p>
+ <code>\qquad - <var>SIMPLIFIED</var> = x +
+ <var>E</var></code>
+ </p>
+ </div>
+ <div>
+ <p>
+ <var>E &gt; 0 ? "Subtract" : "Add"</var>
+ <code>\red{<var>abs(E)</var>}</code>
+ <var>E &gt; 0 ? "from" : "to"</var> both
+ sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ - <var>SIMPLIFIED</var> &amp;=&amp;
+ x + <var>E</var> \\ \\
+ \red{- <var>E</var>} &amp;&amp;
+ \red{- <var>E</var>} \\ \\
+ -<var>SIMPLIFIED</var> - <var>E</var>
+ &amp;=&amp; x
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="SIMPLIFIED_DENOM !== 1">
+ <p>
+ Change the
+ <code>\red{{} - <var>E</var>}</code>
+ to an equivalent fraction with a
+ denominator of
+ <code><var>SIMPLIFIED_DENOM</var></code>.
+ </p>
+ <p><code>\qquad
+ - <var>SIMPLIFIED</var>
+ \red{<var>E &gt; 0 ? "-" : "+"</var>
+ <var>fraction(abs(E) * SIMPLIFIED_DENOM,
+ SIMPLIFIED_DENOM)</var>} = x
+ </code></p>
+ </div>
+ <p><code>\qquad
+ <var>fractionReduce.apply(null,
+ NEG_SOLUTION)</var> = x
+ </code></p>
+ <div>
+ <p>
+ Then calculate the solution where
+ <code>x + <var>E</var></code> is positive:
+ </p>
+ <p><code>\qquad
+ <var>SIMPLIFIED</var> = x + <var>E</var>
+ </code></p>
+ </div>
+ <div>
+ <p>
+ <var>E &gt; 0 ? "Subtract" : "Add"</var>
+ <code>\red{<var>abs(E)</var>}</code>
+ <var>E &gt; 0 ? "from" : "to"</var> both
+ sides:
+ </p>
+ <p><code>\qquad\begin{eqnarray}
+ <var>SIMPLIFIED</var> &amp;=&amp;
+ x + <var>E</var> \\ \\
+ \red{- <var>E</var>} &amp;&amp;
+ \red{- <var>E</var>} \\ \\
+ <var>SIMPLIFIED</var> - <var>E</var>
+ &amp;=&amp; x
+ \end{eqnarray}
+ </code></p>
+ </div>
+ <div data-if="SIMPLIFIED_DENOM !== 1">
+ <p>
+ Change the
+ <code>\red{{} - <var>E</var>}</code>
+ to an equivalent fraction with a
+ denominator of
+ <code><var>SIMPLIFIED_DENOM</var></code>.
+ </p>
+ <p><code>\qquad
+ <var>SIMPLIFIED</var>
+ \red{<var>E &gt; 0 ? "-" : "+"</var>
+ <var>fraction(abs(E) * SIMPLIFIED_DENOM,
+ SIMPLIFIED_DENOM)</var>} = x
+ </code></p>
+ </div>
+ <p><code>\qquad
+ <var>fractionReduce.apply(null,
+ POS_SOLUTION)</var> = x
+ </code></p>
+ </div>
</div>
+ <p data-if="!NO_SOLUTION">
+ Thus, the correct answer is
+ <code>x =
+ <var>fractionReduce.apply(null, NEG_SOLUTION)</var>
+ </code>
+ or
+ <code>x =
+ <var>fractionReduce.apply(null, POS_SOLUTION)</var>
+ </code>.
+ </p>
+ <p data-else>
+ The absolute value cannot be negative. Therefore, there
+ is no solution.
+ </p>
</div>
</div>
- <p class="final_answer" data-if="HAS_SOLUTION">
- Thus, the correct answer is <var>SOLUTION</var>.
- </p>
- <p class="final_answer" data-else>
- The absolute value cannot be negative. Therefore, there is no solution.
- </p>
</div>
</div>
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.