Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

lint: tabs->spaces and jQuery->$ for exercises

  • Loading branch information...
commit 4e4cb9b1c8e0fbd044851f51f4a8d6dda475655b 1 parent 8da1987
Ben Eater beneater authored
Showing with 9,760 additions and 9,760 deletions.
  1. +44 −44 exercises/absolute_value.html
  2. +116 −116 exercises/absolute_value_equations.html
  3. +90 −90 exercises/absolute_value_of_complex_numbers.html
  4. +81 −81 exercises/adding_and_subtracting_complex_numbers.html
  5. +229 −229 exercises/adding_and_subtracting_decimals_word_problems.html
  6. +41 −41 exercises/adding_and_subtracting_fractions.html
  7. +109 −109 exercises/adding_and_subtracting_negative_numbers.html
  8. +101 −101 exercises/adding_and_subtracting_polynomials.html
  9. +101 −101 exercises/adding_and_subtracting_radicals.html
  10. +51 −51 exercises/adding_decimals.html
  11. +49 −49 exercises/adding_decimals_0.5.html
  12. +49 −49 exercises/adding_decimals_3.html
  13. +43 −43 exercises/adding_fractions.html
  14. +46 −46 exercises/adding_fractions_with_common_denominators.html
  15. +60 −60 exercises/adding_negative_numbers.html
  16. +57 −57 exercises/adding_subtracting_mixed_numbers_0.5.html
  17. +65 −65 exercises/adding_subtracting_mixed_numbers_1.html
  18. +57 −57 exercises/adding_vectors.html
  19. +33 −33 exercises/addition_1.html
  20. +29 −29 exercises/addition_2.html
  21. +31 −31 exercises/addition_3.html
  22. +33 −33 exercises/addition_4.html
  23. +91 −91 exercises/addition_rule_of_probability.html
  24. +185 −185 exercises/age_word_problems.html
  25. +23 −23 exercises/algebra_challenge.html
  26. +48 −48 exercises/alternate_exterior_angles.html
  27. +83 −83 exercises/alternate_exterior_angles_2.html
  28. +48 −48 exercises/alternate_interior_angles.html
  29. +83 −83 exercises/alternate_interior_angles_2.html
  30. +129 −129 exercises/angle_bisector_theorem.html
  31. +97 −97 exercises/angle_types.html
  32. +721 −721 exercises/angles_1.html
  33. +618 −618 exercises/angles_2.html
  34. +84 −84 exercises/angles_of_a_polygon.html
  35. +8 −8 exercises/arithmetic_challenge.html
  36. +138 −138 exercises/arithmetic_word_problems.html
  37. +279 −279 exercises/arithmetic_word_problems_1.html
  38. +248 −248 exercises/arithmetic_word_problems_2.html
  39. +65 −65 exercises/average_word_problems.html
  40. +55 −55 exercises/axis_of_symmetry.html
  41. +103 −103 exercises/chain_rule_1.html
  42. +26 −26 exercises/changing_decimals_to_percents.html
  43. +30 −30 exercises/changing_fractions_to_decimals_1.html
  44. +48 −48 exercises/changing_fractions_to_percents.html
  45. +19 −19 exercises/changing_percents_to_decimals.html
  46. +33 −33 exercises/changing_percents_to_fractions.html
  47. +369 −369 exercises/circles_1.html
  48. +43 −43 exercises/circumradius.html
  49. +130 −130 exercises/combining_like_terms_1.html
  50. +130 −130 exercises/combining_like_terms_2.html
  51. +78 −78 exercises/comparing_absolute_values.html
  52. +107 −107 exercises/comparing_fractions_1.html
  53. +73 −73 exercises/comparing_fractions_2.html
  54. +148 −148 exercises/comparing_improper_fractions_and_mixed_numbers.html
  55. +5 −5 exercises/complementary_and_supplementary_angles.html
  56. +53 −53 exercises/complementary_angles.html
  57. +74 −74 exercises/completing_the_square_1.html
  58. +93 −93 exercises/completing_the_square_2.html
  59. +47 −47 exercises/complex_number_polar_form_intuition.html
  60. +26 −26 exercises/composite_numbers.html
  61. +177 −177 exercises/compound_inequalities.html
  62. +206 −206 exercises/congruency_postulates.html
  63. +77 −77 exercises/congruent_segments.html
  64. +126 −126 exercises/congruent_triangles_1.html
  65. +173 −173 exercises/congruent_triangles_2.html
  66. +8 −8 exercises/conic_sections.html
  67. +50 −50 exercises/converting_between_point_slope_and_slope_intercept.html
  68. +176 −176 exercises/converting_between_point_slope_and_standard_form.html
  69. +123 −123 exercises/converting_between_slope_intercept_and_standard_form.html
  70. +45 −45 exercises/converting_decimals_to_fractions_1.html
  71. +49 −49 exercises/converting_decimals_to_fractions_2.html
  72. +26 −26 exercises/converting_decimals_to_percents.html
  73. +32 −32 exercises/converting_fractions_to_decimals.html
  74. +103 −103 exercises/converting_mixed_numbers_and_improper_fractions.html
  75. +25 −25 exercises/converting_percents_to_decimals.html
  76. +35 −35 exercises/converting_repeating_decimals_to_fractions_1.html
  77. +78 −78 exercises/converting_repeating_decimals_to_fractions_2.html
  78. +39 −39 exercises/corresponding_angles.html
  79. +83 −83 exercises/corresponding_angles_2.html
  80. +59 −59 exercises/counting_1.html
  81. +68 −68 exercises/counting_2.html
  82. +121 −121 exercises/creating_bar_charts_1.html
  83. +229 −229 exercises/creating_box_and_whisker_plots.html
  84. +66 −66 exercises/decimals_on_the_number_line.html
  85. +103 −103 exercises/decimals_on_the_number_line_1.html
  86. +114 −114 exercises/decimals_on_the_number_line_2.html
  87. +37 −37 exercises/degrees_to_radians.html
  88. +135 −135 exercises/dependent_probability.html
  89. +126 −126 exercises/derivative_intuition.html
  90. +111 −111 exercises/derivatives_1.html
  91. +45 −45 exercises/determinants_1.html
  92. +164 −164 exercises/direct_and_inverse_variation.html
  93. +166 −166 exercises/discount_tax_and_tip_word_problems.html
  94. +219 −219 exercises/distance_between_point_and_line.html
  95. +120 −120 exercises/distance_formula.html
  96. +93 −93 exercises/distributive_property.html
Sorry, we could not display the entire diff because too many files (366) changed.
88 exercises/absolute_value.html
View
@@ -1,53 +1,53 @@
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Absolute value</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Absolute value</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars" data-ensure="SIGN === &quot;&quot; || INT !== 0 || FRAC !== 0">
- <var id="INT">rand(5) > 0 ? randRange( 1, 9 ) : 0</var>
- <var id="FRAC">rand(3) > 0 ? "." + randRange(1, 9) : ""</var>
- <var id="SIGN">randFromArray(["", "-"])</var>
- </div>
+ <div class="exercise">
+ <div class="vars" data-ensure="SIGN === &quot;&quot; || INT !== 0 || FRAC !== 0">
+ <var id="INT">rand(5) > 0 ? randRange( 1, 9 ) : 0</var>
+ <var id="FRAC">rand(3) > 0 ? "." + randRange(1, 9) : ""</var>
+ <var id="SIGN">randFromArray(["", "-"])</var>
+ </div>
- <div class="problems">
- <div>
- <div class="question">
- <p>What is <code>\lvert <var>SIGN + INT + FRAC</var> \rvert</code>?</p>
- </div>
- <div class="solution"><var>INT + FRAC</var></div>
- </div>
- </div>
+ <div class="problems">
+ <div>
+ <div class="question">
+ <p>What is <code>\lvert <var>SIGN + INT + FRAC</var> \rvert</code>?</p>
+ </div>
+ <div class="solution"><var>INT + FRAC</var></div>
+ </div>
+ </div>
- <div class="hints">
- <div class="graphie">
- init({
- range: [ [-1, 11], [-1, 1] ]
- });
- var start = 0;
- var end = 10;
- var originX = 0;
- var x = abs( INT ) + FRAC;
- if ( SIGN === "-" ) {
- start = -10;
- end = 0;
- originX = 10;
- x = 10 - x;
- }
- numberLine( start, end );
- style({ stroke: "#6495ED", fill: "#6495ED" });
- graph.pt = circle( [ x, 0 ], 0.15 );
- style({ stroke: "#FFA500", fill: "#FFA500", strokeWidth: 3.5, arrows: "->" });
- path( [ [ originX, 0 ], [ x, 0 ] ] );
- circle( [ originX, 0 ], 0.10 );
- graph.pt.toFront();
- </div>
- <p>The distance from <code>0</code> to <code><var>SIGN + INT + FRAC</var></code> is <code><var>INT + FRAC</var></code>, which equals the absolute value.</p>
- <p data-if="SIGN !== &quot;&quot;">In other words, <code><var>INT + FRAC</var></code> is the non-negative version of <code><var>SIGN + INT + FRAC</var></code>.</p>
- </div>
- </div>
+ <div class="hints">
+ <div class="graphie">
+ init({
+ range: [ [-1, 11], [-1, 1] ]
+ });
+ var start = 0;
+ var end = 10;
+ var originX = 0;
+ var x = abs( INT ) + FRAC;
+ if ( SIGN === "-" ) {
+ start = -10;
+ end = 0;
+ originX = 10;
+ x = 10 - x;
+ }
+ numberLine( start, end );
+ style({ stroke: "#6495ED", fill: "#6495ED" });
+ graph.pt = circle( [ x, 0 ], 0.15 );
+ style({ stroke: "#FFA500", fill: "#FFA500", strokeWidth: 3.5, arrows: "->" });
+ path( [ [ originX, 0 ], [ x, 0 ] ] );
+ circle( [ originX, 0 ], 0.10 );
+ graph.pt.toFront();
+ </div>
+ <p>The distance from <code>0</code> to <code><var>SIGN + INT + FRAC</var></code> is <code><var>INT + FRAC</var></code>, which equals the absolute value.</p>
+ <p data-if="SIGN !== &quot;&quot;">In other words, <code><var>INT + FRAC</var></code> is the non-negative version of <code><var>SIGN + INT + FRAC</var></code>.</p>
+ </div>
+ </div>
</body>
</html>
232 exercises/absolute_value_equations.html
View
@@ -1,130 +1,130 @@
<!DOCTYPE html>
<html data-require="math math-format">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Absolute value equations</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Absolute value equations</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="A">randRange( 2, 10 )</var>
- <var id="B">randRangeNonZero( -10, 10 )</var>
- <var id="C" data-ensure="C !== A">randRange( 2, 10 )</var>
- <var id="D" data-ensure="D !== B">randRangeNonZero( 2, 10 )</var>
- <var id="SIMPLIFIED">fractionReduce( D - B, A - C )</var>
- <var id="SOLUTION">
- <!-- Am I not supposed to use this function business? -->
- (function() {
- if ( ( D - B ) / ( A - C) > 0 ) {
- return "&lt;code&gt;"
- + "x = "
- + fractionReduce( -1 * abs( D - B ), abs( A - C ) )
- + "\\text{ or }"
- + "x = "
- + fractionReduce( abs( D - B ), abs( A - C ) )
- + "&lt;/code&gt;";
- } else {
- return "No solution";
- }
- })()
- </var>
- <var id="CHOICES">
- (function() {
- var choices = [];
+ <div class="exercise">
+ <div class="vars">
+ <var id="A">randRange( 2, 10 )</var>
+ <var id="B">randRangeNonZero( -10, 10 )</var>
+ <var id="C" data-ensure="C !== A">randRange( 2, 10 )</var>
+ <var id="D" data-ensure="D !== B">randRangeNonZero( 2, 10 )</var>
+ <var id="SIMPLIFIED">fractionReduce( D - B, A - C )</var>
+ <var id="SOLUTION">
+ <!-- Am I not supposed to use this function business? -->
+ (function() {
+ if ( ( D - B ) / ( A - C) > 0 ) {
+ return "&lt;code&gt;"
+ + "x = "
+ + fractionReduce( -1 * abs( D - B ), abs( A - C ) )
+ + "\\text{ or }"
+ + "x = "
+ + fractionReduce( abs( D - B ), 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 ] );
- if ( D - B + nOffset === 0 ) {
- choice += "x = 0";
- } else {
- choice += "x = "
- + fractionReduce( -1 * abs( D - B + nOffset ), abs( A - C + dOffset ) )
- + "\\text{ or }"
- + "x = "
- + fractionReduce( abs( D - B + nOffset ), abs( A - C + dOffset ) );
- }
- choice += "&lt;/code&gt;";
- choices.unshift( choice );
- }
+ 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 ] );
+ if ( D - B + nOffset === 0 ) {
+ choice += "x = 0";
+ } else {
+ choice += "x = "
+ + fractionReduce( -1 * abs( D - B + nOffset ), abs( A - C + dOffset ) )
+ + "\\text{ or }"
+ + "x = "
+ + fractionReduce( abs( D - B + nOffset ), 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 );
- }
+ 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>
+ return choices;
+ })()</var>
+ </div>
- <div class="problems">
- <div>
- <p class="question">Solve for <code>x</code>:</p>
- <div><code><var>A</var>|x| + <var>B</var> = <var>C</var>|x| + <var>D</var></code></div>
+ <div class="problems">
+ <div>
+ <p class="question">Solve for <code>x</code>:</p>
+ <div><code><var>A</var>|x| + <var>B</var> = <var>C</var>|x| + <var>D</var></code></div>
- <p class="solution"><var>SOLUTION</var></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>
+ <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>Subtract <code><var>C</var>|x|</code> from both sides:</p>
- <p><code>(<var>A</var>|x| + <var>B</var>) - <var>C</var>|x| = (<var>C</var>|x| + <var>D</var>) - <var>C</var>|x|</code></p>
- <p><code><var>A - C</var>|x| + <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>B</var>) + <var>-B</var> = <var>D</var> + <var>-B</var></code></p>
- <p><code><var>A - C</var>|x| = <var>D - B</var></code></p>
- </div>
- <div>
- <p>Divide both sides by <code><var>A - C</var></code>.</p>
- <p><code>\frac{<var>A - C</var>|x|}{<var>A - C</var>} = \frac{<var>D - B</var>}{<var>A - C</var>}</code></p>
- </div>
- <div>
- <p>Simplify.</p>
- <p><code>|x| = <var>SIMPLIFIED</var></code></p>
- </div>
- </div>
- <div data-else data-unwrap>
- <div>
- <p>Subtract <code><var>A</var>|x|</code> from both sides:</p>
- <p><code>(<var>A</var>|x| + <var>B</var>) - <var>A</var>|x| = (<var>C</var>|x| + <var>D</var>) - <var>A</var>|x|</code></p>
- <p><code><var>B</var> = <var>C - A</var>|x| + <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>D</var>) + <var>-D</var></code></p>
- <p><code><var>B - D</var> = <var>C - A</var>|x|</code></p>
- </div>
- <div>
- <p>Divide both sides by <code><var>C - A</var></code>.</p>
- <p><code>\frac{<var>B - D</var>}{<var>C - A</var>} = \frac{<var>C - A</var>|x|}{<var>C - A</var>}</code></p>
- </div>
- <div>
- <p>Simplify.</p>
- <p><code><var>SIMPLIFIED</var> = |x|</code></p>
- </div>
- </div>
- <p data-if="( D - B ) / ( A - C ) > 0">
- Thus, the correct answer is <var>SOLUTION</var>.
- </p>
- <p data-else>
- The absolute value cannot be negative. Therefore, there is no solution.
- </p>
- </div>
- </div>
+ <div class="hints">
+ <div data-if="A > C" data-unwrap>
+ <div>
+ <p>Subtract <code><var>C</var>|x|</code> from both sides:</p>
+ <p><code>(<var>A</var>|x| + <var>B</var>) - <var>C</var>|x| = (<var>C</var>|x| + <var>D</var>) - <var>C</var>|x|</code></p>
+ <p><code><var>A - C</var>|x| + <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>B</var>) + <var>-B</var> = <var>D</var> + <var>-B</var></code></p>
+ <p><code><var>A - C</var>|x| = <var>D - B</var></code></p>
+ </div>
+ <div>
+ <p>Divide both sides by <code><var>A - C</var></code>.</p>
+ <p><code>\frac{<var>A - C</var>|x|}{<var>A - C</var>} = \frac{<var>D - B</var>}{<var>A - C</var>}</code></p>
+ </div>
+ <div>
+ <p>Simplify.</p>
+ <p><code>|x| = <var>SIMPLIFIED</var></code></p>
+ </div>
+ </div>
+ <div data-else data-unwrap>
+ <div>
+ <p>Subtract <code><var>A</var>|x|</code> from both sides:</p>
+ <p><code>(<var>A</var>|x| + <var>B</var>) - <var>A</var>|x| = (<var>C</var>|x| + <var>D</var>) - <var>A</var>|x|</code></p>
+ <p><code><var>B</var> = <var>C - A</var>|x| + <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>D</var>) + <var>-D</var></code></p>
+ <p><code><var>B - D</var> = <var>C - A</var>|x|</code></p>
+ </div>
+ <div>
+ <p>Divide both sides by <code><var>C - A</var></code>.</p>
+ <p><code>\frac{<var>B - D</var>}{<var>C - A</var>} = \frac{<var>C - A</var>|x|}{<var>C - A</var>}</code></p>
+ </div>
+ <div>
+ <p>Simplify.</p>
+ <p><code><var>SIMPLIFIED</var> = |x|</code></p>
+ </div>
+ </div>
+ <p data-if="( D - B ) / ( A - C ) > 0">
+ Thus, the correct answer is <var>SOLUTION</var>.
+ </p>
+ <p data-else>
+ The absolute value cannot be negative. Therefore, there is no solution.
+ </p>
+ </div>
+ </div>
</body>
</html>
180 exercises/absolute_value_of_complex_numbers.html
View
@@ -1,98 +1,98 @@
<!DOCTYPE html>
<html data-require="math graphie math-format">
<head>
- <meta charset="UTF-8" />
- <title>Absolute value of complex numbers</title>
- <script src="../khan-exercise.js"></script>
+ <meta charset="UTF-8" />
+ <title>Absolute value of complex numbers</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="REAL">randRangeExclude( -8, 8, [ -1, 0, 1, 2 ] )</var>
- <var id="IMAG">randRangeExclude( -8, 8, [ -1, 0, 1, 2 ] )</var>
- <var id="ABS_SQUARE">REAL * REAL + IMAG * IMAG</var>
- <var id="REPRESENTATION">complexNumber( REAL, IMAG )</var>
- </div>
+ <div class="exercise">
+ <div class="vars">
+ <var id="REAL">randRangeExclude( -8, 8, [ -1, 0, 1, 2 ] )</var>
+ <var id="IMAG">randRangeExclude( -8, 8, [ -1, 0, 1, 2 ] )</var>
+ <var id="ABS_SQUARE">REAL * REAL + IMAG * IMAG</var>
+ <var id="REPRESENTATION">complexNumber( REAL, IMAG )</var>
+ </div>
- <div class="problems">
- <div>
- <p class="question">
- Determine the absolute value of the following complex number:
- </p>
- <p>
- <code><var>REPRESENTATION</var></code>
- </p>
- <div class="solution" data-type="radical">
- <var>ABS_SQUARE</var>
- </div>
- <div class="hints">
- <p>
- The absolute value of any number is its distance from zero.
- As complex numbers can be visualized as points on the complex plane, absolute values
- of complex numbers can be determined using the distance formula.
- </p>
- <div>
- <div class="graphie" id="graph">
- graphInit({
- range: [[-10, 10], [-10, 10]],
- scale: 20,
- tickStep: 1,
- labelStep: 1,
- });
- label( [10, 0.5], "Re", "left" );
- label( [0.5, 9], "Im", "right" );
- circle( [REAL, IMAG], 3 / 20, {
- fill: KhanUtil.BLUE,
- stroke: "none"
- });
- label( [REAL, IMAG], REPRESENTATION, "left", {
- color: KhanUtil.BLUE,
- labelDistance: 10
- } );
- </div>
- <p>
- <code><var>REPRESENTATION</var></code> is plotted as a <strong class="hint_blue">blue</strong> circle above.
- </p>
- </div>
- <div>
- <div class="graphie" data-update="graph">
- path([ [0,0], [REAL, IMAG]], {
- stroke: KhanUtil.ORANGE
- });
- </div>
- <p>
- The absolute value we need is the length of the <strong class="hint_orange">orange</strong> line segment.
- </p>
- </div>
- <div>
- <div class="graphie" data-update="graph">
- path([ [0,0], [REAL, 0], [REAL, IMAG]], {
- stroke: KhanUtil.BLUE
- });
- </div>
- <p>
- The <strong class="hint_orange">orange</strong> line segment is the hypotenuse of a right triangle.
- Its two legs (shown in <strong class="hint_blue">blue</strong>) have lengths <code><var>abs( REAL )</var></code> and <code><var>abs( IMAG )</var></code>, which corresponds
- to the absolute values of the real and imaginary parts of the complex number <code><var>REPRESENTATION</var></code>.
- </p>
- </div>
- <p>
- Substituting into the Pythagorean theorem:<br />
- <code>\qquad |<var>REPRESENTATION</var>|^2 = <var>abs( REAL )</var>^2 + <var>abs( IMAG )</var>^2</code>, so <br />
- <code>\qquad |<var>REPRESENTATION</var>| = \sqrt{<var>abs( REAL )</var>^2 + <var>abs( IMAG )</var>^2}</code>.
- </p>
- <p>
- <code>\qquad \sqrt{<var>abs(REAL)</var>^2 + <var>abs(IMAG)</var>^2} = \sqrt{<var>REAL * REAL</var> + <var>IMAG * IMAG</var>} = \sqrt{<var>ABS_SQUARE</var>}</code>
- </p>
- <p data-if="squareRootCanSimplify( ABS_SQUARE )">
- Simplifying the radical gives <code><var>formattedSquareRootOf( ABS_SQUARE )</var></code>. That is the absolute value of <code><var>REPRESENTATION</var></code>.
- </p>
- <p data-else>
- The radical cannot be simplified. The absolute value of <code><var>REPRESENTATION</var></code> is <code>\sqrt{<var>ABS_SQUARE</var>}</code>.
- </p>
- </div>
- </div>
- </div>
- </div>
+ <div class="problems">
+ <div>
+ <p class="question">
+ Determine the absolute value of the following complex number:
+ </p>
+ <p>
+ <code><var>REPRESENTATION</var></code>
+ </p>
+ <div class="solution" data-type="radical">
+ <var>ABS_SQUARE</var>
+ </div>
+ <div class="hints">
+ <p>
+ The absolute value of any number is its distance from zero.
+ As complex numbers can be visualized as points on the complex plane, absolute values
+ of complex numbers can be determined using the distance formula.
+ </p>
+ <div>
+ <div class="graphie" id="graph">
+ graphInit({
+ range: [[-10, 10], [-10, 10]],
+ scale: 20,
+ tickStep: 1,
+ labelStep: 1,
+ });
+ label( [10, 0.5], "Re", "left" );
+ label( [0.5, 9], "Im", "right" );
+ circle( [REAL, IMAG], 3 / 20, {
+ fill: KhanUtil.BLUE,
+ stroke: "none"
+ });
+ label( [REAL, IMAG], REPRESENTATION, "left", {
+ color: KhanUtil.BLUE,
+ labelDistance: 10
+ } );
+ </div>
+ <p>
+ <code><var>REPRESENTATION</var></code> is plotted as a <strong class="hint_blue">blue</strong> circle above.
+ </p>
+ </div>
+ <div>
+ <div class="graphie" data-update="graph">
+ path([ [0,0], [REAL, IMAG]], {
+ stroke: KhanUtil.ORANGE
+ });
+ </div>
+ <p>
+ The absolute value we need is the length of the <strong class="hint_orange">orange</strong> line segment.
+ </p>
+ </div>
+ <div>
+ <div class="graphie" data-update="graph">
+ path([ [0,0], [REAL, 0], [REAL, IMAG]], {
+ stroke: KhanUtil.BLUE
+ });
+ </div>
+ <p>
+ The <strong class="hint_orange">orange</strong> line segment is the hypotenuse of a right triangle.
+ Its two legs (shown in <strong class="hint_blue">blue</strong>) have lengths <code><var>abs( REAL )</var></code> and <code><var>abs( IMAG )</var></code>, which corresponds
+ to the absolute values of the real and imaginary parts of the complex number <code><var>REPRESENTATION</var></code>.
+ </p>
+ </div>
+ <p>
+ Substituting into the Pythagorean theorem:<br />
+ <code>\qquad |<var>REPRESENTATION</var>|^2 = <var>abs( REAL )</var>^2 + <var>abs( IMAG )</var>^2</code>, so <br />
+ <code>\qquad |<var>REPRESENTATION</var>| = \sqrt{<var>abs( REAL )</var>^2 + <var>abs( IMAG )</var>^2}</code>.
+ </p>
+ <p>
+ <code>\qquad \sqrt{<var>abs(REAL)</var>^2 + <var>abs(IMAG)</var>^2} = \sqrt{<var>REAL * REAL</var> + <var>IMAG * IMAG</var>} = \sqrt{<var>ABS_SQUARE</var>}</code>
+ </p>
+ <p data-if="squareRootCanSimplify( ABS_SQUARE )">
+ Simplifying the radical gives <code><var>formattedSquareRootOf( ABS_SQUARE )</var></code>. That is the absolute value of <code><var>REPRESENTATION</var></code>.
+ </p>
+ <p data-else>
+ The radical cannot be simplified. The absolute value of <code><var>REPRESENTATION</var></code> is <code>\sqrt{<var>ABS_SQUARE</var>}</code>.
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
162 exercises/adding_and_subtracting_complex_numbers.html
View
@@ -1,90 +1,90 @@
<!DOCTYPE html>
<html data-require="math math-format">
<head>
- <meta charset="UTF-8" />
- <title>Adding and subtracting complex numbers</title>
- <script src="../khan-exercise.js"></script>
+ <meta charset="UTF-8" />
+ <title>Adding and subtracting complex numbers</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="A_REAL">randRange( -5, 5 )</var>
- <var id="A_IMAG">randRange( -5, 5 )</var>
- <var id="B_REAL">randRange( -5, 5 )</var>
- <var id="B_IMAG">randRange( -5, 5 )</var>
- <var id="OPERATION">randFromArray( [ "add", "subtract" ] )</var>
- <var id="OPERATOR">( OPERATION === "add" ? "+" : "-" )</var>
- <var id="ANSWER_REAL">
- ( OPERATION === "add" ? ( A_REAL + B_REAL ) : ( A_REAL - B_REAL ) )
- </var>
- <var id="ANSWER_IMAG">
- ( OPERATION === "add" ? ( A_IMAG + B_IMAG ) : ( A_IMAG - B_IMAG ) )
- </var>
- <var id="A_REP">
- complexNumber( A_REAL, A_IMAG )
- </var>
- <var id="B_REP">
- complexNumber( B_REAL, B_IMAG )
- </var>
- <var id="A_REP_COLORED">
- "\\color{" + ORANGE + "}{" + A_REP + "}"
- </var>
- <var id="B_REP_COLORED">
- "\\color{" + BLUE + "}{" + B_REP + "}"
- </var>
- <var id="A_REAL_COLORED">
- "\\color{" + ORANGE + "}{" + A_REAL + "}"
- </var>
- <var id="A_IMAG_COLORED">
- "\\color{" + ORANGE + "}{" + A_IMAG + "}"
- </var>
- <var id="B_REAL_COLORED">
- "\\color{" + BLUE + "}{" + B_REAL + "}"
- </var>
- <var id="B_IMAG_COLORED">
- "\\color{" + BLUE + "}{" + B_IMAG + "}"
- </var>
- </div>
+ <div class="exercise">
+ <div class="vars">
+ <var id="A_REAL">randRange( -5, 5 )</var>
+ <var id="A_IMAG">randRange( -5, 5 )</var>
+ <var id="B_REAL">randRange( -5, 5 )</var>
+ <var id="B_IMAG">randRange( -5, 5 )</var>
+ <var id="OPERATION">randFromArray( [ "add", "subtract" ] )</var>
+ <var id="OPERATOR">( OPERATION === "add" ? "+" : "-" )</var>
+ <var id="ANSWER_REAL">
+ ( OPERATION === "add" ? ( A_REAL + B_REAL ) : ( A_REAL - B_REAL ) )
+ </var>
+ <var id="ANSWER_IMAG">
+ ( OPERATION === "add" ? ( A_IMAG + B_IMAG ) : ( A_IMAG - B_IMAG ) )
+ </var>
+ <var id="A_REP">
+ complexNumber( A_REAL, A_IMAG )
+ </var>
+ <var id="B_REP">
+ complexNumber( B_REAL, B_IMAG )
+ </var>
+ <var id="A_REP_COLORED">
+ "\\color{" + ORANGE + "}{" + A_REP + "}"
+ </var>
+ <var id="B_REP_COLORED">
+ "\\color{" + BLUE + "}{" + B_REP + "}"
+ </var>
+ <var id="A_REAL_COLORED">
+ "\\color{" + ORANGE + "}{" + A_REAL + "}"
+ </var>
+ <var id="A_IMAG_COLORED">
+ "\\color{" + ORANGE + "}{" + A_IMAG + "}"
+ </var>
+ <var id="B_REAL_COLORED">
+ "\\color{" + BLUE + "}{" + B_REAL + "}"
+ </var>
+ <var id="B_IMAG_COLORED">
+ "\\color{" + BLUE + "}{" + B_IMAG + "}"
+ </var>
+ </div>
- <div class="problems">
- <div>
- <p class="question"><var>OPERATION == "add" ? "Add" : "Subtract"</var> the following complex numbers:</p>
- <p>
- <code>
- (<var>A_REP_COLORED</var>) <var>OPERATOR</var> (<var>B_REP_COLORED</var>)
- </code>
- </p>
- <div class="solution" data-type="complexNumberSeparate">
- [ <var>ANSWER_REAL</var>, <var>ANSWER_IMAG</var> ]
- </div>
- <div class="hints">
- <p>
- Complex numbers can be <var>OPERATION</var>ed by separately <var>OPERATION</var>ing their real and imaginary components.
- </p>
- <p>
- The real components of the two complex numbers are <code class="hint_orange"><var>A_REAL</var></code> and <code class="hint_blue"><var>B_REAL</var></code>, respectively,
- so the real component of the result will be
- <code>
- <var>A_REAL_COLORED</var> <var>OPERATOR</var> \color{<var>BLUE</var>}{<var>negParens( B_REAL )</var>}
- </code>,
- which equals <code><var>ANSWER_REAL</var></code>.
- </p>
- <p>
- The imaginary components of the two complex numbers are <code class="hint_orange"><var>A_IMAG</var></code> and <code class="hint_blue"><var>B_IMAG</var></code>, respectively,
- so the imaginary component of the result will be
- <code>
- <var>A_IMAG_COLORED</var> <var>OPERATOR</var> \color{<var>BLUE</var>}{<var>negParens( B_IMAG )</var>}
- </code>,
- which equals <code><var>ANSWER_IMAG</var></code>.
- </p>
- <p>
- The result is <code><var>complexNumber( ANSWER_REAL, ANSWER_IMAG )</var></code>; its real component is <code><var>ANSWER_REAL</var></code>
- and its complex component is <code><var>ANSWER_IMAG</var></code>.
- </p>
- </div>
- </div>
- </div>
- </div>
+ <div class="problems">
+ <div>
+ <p class="question"><var>OPERATION == "add" ? "Add" : "Subtract"</var> the following complex numbers:</p>
+ <p>
+ <code>
+ (<var>A_REP_COLORED</var>) <var>OPERATOR</var> (<var>B_REP_COLORED</var>)
+ </code>
+ </p>
+ <div class="solution" data-type="complexNumberSeparate">
+ [ <var>ANSWER_REAL</var>, <var>ANSWER_IMAG</var> ]
+ </div>
+ <div class="hints">
+ <p>
+ Complex numbers can be <var>OPERATION</var>ed by separately <var>OPERATION</var>ing their real and imaginary components.
+ </p>
+ <p>
+ The real components of the two complex numbers are <code class="hint_orange"><var>A_REAL</var></code> and <code class="hint_blue"><var>B_REAL</var></code>, respectively,
+ so the real component of the result will be
+ <code>
+ <var>A_REAL_COLORED</var> <var>OPERATOR</var> \color{<var>BLUE</var>}{<var>negParens( B_REAL )</var>}
+ </code>,
+ which equals <code><var>ANSWER_REAL</var></code>.
+ </p>
+ <p>
+ The imaginary components of the two complex numbers are <code class="hint_orange"><var>A_IMAG</var></code> and <code class="hint_blue"><var>B_IMAG</var></code>, respectively,
+ so the imaginary component of the result will be
+ <code>
+ <var>A_IMAG_COLORED</var> <var>OPERATOR</var> \color{<var>BLUE</var>}{<var>negParens( B_IMAG )</var>}
+ </code>,
+ which equals <code><var>ANSWER_IMAG</var></code>.
+ </p>
+ <p>
+ The result is <code><var>complexNumber( ANSWER_REAL, ANSWER_IMAG )</var></code>; its real component is <code><var>ANSWER_REAL</var></code>
+ and its complex component is <code><var>ANSWER_IMAG</var></code>.
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
</html>
458 exercises/adding_and_subtracting_decimals_word_problems.html
View
@@ -1,266 +1,266 @@
<!DOCTYPE html>
<html data-require="math word-problems spin graphie graphie-helpers-arithmetic">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Adding and subtracting decimals word problems</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Adding and subtracting decimals word problems</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="problems">
- <div id="produceCost">
+ <div class="exercise">
+ <div class="problems">
+ <div id="produceCost">
- <div class="vars">
- <var id="A">randRange(5,9)*100</var>
- <var id="B">randRange(1,9)*10</var>
- <var id="C">randRange(1,9)*1</var>
- <var id="fruit_1_integer">A+B+C</var>
- <var id="fruit_1_decimal">(2)</var>
- <var id="fruit_1">truncate_to_max(fruit_1_integer*pow(10,-fruit_1_decimal), 2)</var>
- <var id="D">randRange(3,9)*100</var>
- <var id="E">randRange(1,9)*10</var>
- <var id="F" data-ensure="F+C !== 10">randRange(1,9)*1</var>
- <var id="fruit_2_integer">D+E+F</var>
- <var id="fruit_2_decimal">(2)</var>
- <var id="fruit_2">truncate_to_max(fruit_2_integer*pow(10,-fruit_2_decimal), 2)</var>
- <var id="solution">truncate_to_max((fruit_1+fruit_2),2)</var>
- <var id="DUMMY">[]</var>
- </div>
+ <div class="vars">
+ <var id="A">randRange(5,9)*100</var>
+ <var id="B">randRange(1,9)*10</var>
+ <var id="C">randRange(1,9)*1</var>
+ <var id="fruit_1_integer">A+B+C</var>
+ <var id="fruit_1_decimal">(2)</var>
+ <var id="fruit_1">truncate_to_max(fruit_1_integer*pow(10,-fruit_1_decimal), 2)</var>
+ <var id="D">randRange(3,9)*100</var>
+ <var id="E">randRange(1,9)*10</var>
+ <var id="F" data-ensure="F+C !== 10">randRange(1,9)*1</var>
+ <var id="fruit_2_integer">D+E+F</var>
+ <var id="fruit_2_decimal">(2)</var>
+ <var id="fruit_2">truncate_to_max(fruit_2_integer*pow(10,-fruit_2_decimal), 2)</var>
+ <var id="solution">truncate_to_max((fruit_1+fruit_2),2)</var>
+ <var id="DUMMY">[]</var>
+ </div>
- <div class="question spin">
- <p>{On a sunny morning|On a beautiful afternoon}, <var>person(1)</var> rode <var>his(1)</var> bicycle to a farm that sold bags of <var>plural(fruit(1))</var> for $<var>fruit_1</var> each and bags of <var>plural(fruit(2))</var> for $<var>fruit_2</var> each.</p>
- <p><var>person(1)</var> decided to buy a bag of <var>plural(fruit(1))</var> and a bag of <var>plural(fruit(2))</var> {before heading home|because those were <var>his(1)</var> favorite kinds of fruit|}.</p>
- <p class="question">How much did <var>person(1)</var> need to pay for <var>his(1)</var> produce?</p></div>
+ <div class="question spin">
+ <p>{On a sunny morning|On a beautiful afternoon}, <var>person(1)</var> rode <var>his(1)</var> bicycle to a farm that sold bags of <var>plural(fruit(1))</var> for $<var>fruit_1</var> each and bags of <var>plural(fruit(2))</var> for $<var>fruit_2</var> each.</p>
+ <p><var>person(1)</var> decided to buy a bag of <var>plural(fruit(1))</var> and a bag of <var>plural(fruit(2))</var> {before heading home|because those were <var>his(1)</var> favorite kinds of fruit|}.</p>
+ <p class="question">How much did <var>person(1)</var> need to pay for <var>his(1)</var> produce?</p></div>
- <div class="solution" data-forms="dollar"><var>fruit_1+fruit_2</var></div>
+ <div class="solution" data-forms="dollar"><var>fruit_1+fruit_2</var></div>
- <div class="hints">
- <p>To find the total amount <var>person(1)</var> needs to pay, we need to add the price of the <var>plural(fruit(1))</var> and the price of the <var>plural(fruit(2))</var>.</p>
- <p>Price of <var>plural(fruit(1))</var> + price of <var>plural(fruit(2))</var> = total price.</p>
- <div class="graphie" id="numbers">
- graph.adder = new DecimalAdder( fruit_1_integer, fruit_1_decimal, fruit_2_integer, fruit_2_decimal );
- graph.adder.show();
- graph.adder.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( fruit_1_integer, fruit_1_decimal, fruit_2_integer, fruit_2_decimal ) times">
- graph.adder.showHint();
- </div>
+ <div class="hints">
+ <p>To find the total amount <var>person(1)</var> needs to pay, we need to add the price of the <var>plural(fruit(1))</var> and the price of the <var>plural(fruit(2))</var>.</p>
+ <p>Price of <var>plural(fruit(1))</var> + price of <var>plural(fruit(2))</var> = total price.</p>
+ <div class="graphie" id="numbers">
+ graph.adder = new DecimalAdder( fruit_1_integer, fruit_1_decimal, fruit_2_integer, fruit_2_decimal );
+ graph.adder.show();
+ graph.adder.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( fruit_1_integer, fruit_1_decimal, fruit_2_integer, fruit_2_decimal ) times">
+ graph.adder.showHint();
+ </div>
- <p class="final_answer"><var>person(1)</var> needs to pay $<var>solution</var>.</p>
- </div>
- </div>
+ <p class="final_answer"><var>person(1)</var> needs to pay $<var>solution</var>.</p>
+ </div>
+ </div>
- <div id="racers">
+ <div id="racers">
- <div class="vars">
- <var id="meters">randRange(1, 3)*100</var>
- <var id="time_1_integer">randRange(2000,9999)</var>
- <var id="time_1_decimal">(2)</var>
- <var id="time_1">truncate_to_max(time_1_integer*pow(10,-time_1_decimal), 2)</var>
- <var id="time_2_integer" data-ensure="time_2_integer &lt; time_1_integer">randRange(2000,9999)</var>
- <var id="time_2_decimal">(2)</var>
- <var id="time_2">truncate_to_max(time_2_integer*pow(10,-time_2_decimal), 2)</var>
- <var id="time_3_integer">randRange(100,999)</var>
- <var id="time_3_decimal">(2)</var>
- <var id="time_3">truncate_to_max(time_3_integer*pow(10,-time_3_decimal), 2)</var>
- <var id="DUMMY">[]</var>
- <var id="solution">truncate_to_max((time_1-time_2),2)</var>
- </div>
+ <div class="vars">
+ <var id="meters">randRange(1, 3)*100</var>
+ <var id="time_1_integer">randRange(2000,9999)</var>
+ <var id="time_1_decimal">(2)</var>
+ <var id="time_1">truncate_to_max(time_1_integer*pow(10,-time_1_decimal), 2)</var>
+ <var id="time_2_integer" data-ensure="time_2_integer &lt; time_1_integer">randRange(2000,9999)</var>
+ <var id="time_2_decimal">(2)</var>
+ <var id="time_2">truncate_to_max(time_2_integer*pow(10,-time_2_decimal), 2)</var>
+ <var id="time_3_integer">randRange(100,999)</var>
+ <var id="time_3_decimal">(2)</var>
+ <var id="time_3">truncate_to_max(time_3_integer*pow(10,-time_3_decimal), 2)</var>
+ <var id="DUMMY">[]</var>
+ <var id="solution">truncate_to_max((time_1-time_2),2)</var>
+ </div>
- <div class="question spin">
- <p>{On Monday|Last week}, <var>person(1)</var> and <var>person(2)</var> decided to see how fast they could sprint <var>meters</var> meters. They asked their friend <var>person(3)</var> to time them with a stopwatch.</p>
- <p>{After <var>time_3</var> minutes, <var>person(3)</var> agreed to time the runners.|} <var>person(1)</var> sprinted first and ran <var>meters</var> meters in <var>time_1</var> seconds. When it was <var>person(2)</var>'s turn, <var>he(2)</var> sped off and completed the run in <var>time_2</var> seconds.</p>
- <p class="question">How much faster was <var>person(2)</var> than <var>person(1)</var>?</p>
- </div>
- <div class="solution" data-type="multiple">
- <p> <span class="sol"><var>time_1-time_2 </var></span> seconds</p>
- </div>
- <div class="hints">
- <p>To find how much faster <var>person(2)</var> was than <var>person(1)</var>, we need to find the difference between their times.
- <p><var>person(1)</var>'s time - <var>person(2)</var>'s time = difference in times.
- <div class="graphie" id="numbers">
- graph.subtractor = new DecimalSubtractor( time_1_integer, time_1_decimal, time_2_integer, time_2_decimal );
- graph.subtractor.show();
- graph.subtractor.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( time_1_integer, time_1_decimal, time_2_integer, time_2_decimal ) times">
- graph.subtractor.showHint();
- </div>
- <p class="final_answer"><var>person(2)</var> was <var>solution</var> seconds faster than <var>person(1)</var>.</p>
- </div>
- </div>
+ <div class="question spin">
+ <p>{On Monday|Last week}, <var>person(1)</var> and <var>person(2)</var> decided to see how fast they could sprint <var>meters</var> meters. They asked their friend <var>person(3)</var> to time them with a stopwatch.</p>
+ <p>{After <var>time_3</var> minutes, <var>person(3)</var> agreed to time the runners.|} <var>person(1)</var> sprinted first and ran <var>meters</var> meters in <var>time_1</var> seconds. When it was <var>person(2)</var>'s turn, <var>he(2)</var> sped off and completed the run in <var>time_2</var> seconds.</p>
+ <p class="question">How much faster was <var>person(2)</var> than <var>person(1)</var>?</p>
+ </div>
+ <div class="solution" data-type="multiple">
+ <p> <span class="sol"><var>time_1-time_2 </var></span> seconds</p>
+ </div>
+ <div class="hints">
+ <p>To find how much faster <var>person(2)</var> was than <var>person(1)</var>, we need to find the difference between their times.
+ <p><var>person(1)</var>'s time - <var>person(2)</var>'s time = difference in times.
+ <div class="graphie" id="numbers">
+ graph.subtractor = new DecimalSubtractor( time_1_integer, time_1_decimal, time_2_integer, time_2_decimal );
+ graph.subtractor.show();
+ graph.subtractor.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( time_1_integer, time_1_decimal, time_2_integer, time_2_decimal ) times">
+ graph.subtractor.showHint();
+ </div>
+ <p class="final_answer"><var>person(2)</var> was <var>solution</var> seconds faster than <var>person(1)</var>.</p>
+ </div>
+ </div>
- <div id="twinWeight">
+ <div id="twinWeight">
- <div class="vars">
- <var id="G">randRange(2,6)*100</var>
- <var id="H">randRange(1,9)*10</var>
- <var id="I">randRange(1,9)*1</var>
- <var id="weight_1_integer">G+H+I</var>
- <var id="weight_1_decimal">(2)</var>
- <var id="weight_1">truncate_to_max(weight_1_integer*pow(10,-weight_1_decimal), 2)</var>
- <var id="J">randRange(3,5)*100</var>
- <var id="K">randRange(1,9)*10</var>
- <var id="L">randRange(1,9)*1</var>
- <var id="weight_2_integer">J+K+L</var>
- <var id="weight_2_decimal">(2)</var>
- <var id="weight_2">truncate_to_max(weight_2_integer*pow(10,-weight_2_decimal), 2)</var>
- <var id="height_1">randRange(16.5,22.5)</var>
- <var id="height_2">randRange(16.5,22.5)</var>
- <var id="solution">truncate_to_max((weight_1+weight_2),2)</var>
- <var id="DUMMY">[]</var>
- </div>
+ <div class="vars">
+ <var id="G">randRange(2,6)*100</var>
+ <var id="H">randRange(1,9)*10</var>
+ <var id="I">randRange(1,9)*1</var>
+ <var id="weight_1_integer">G+H+I</var>
+ <var id="weight_1_decimal">(2)</var>
+ <var id="weight_1">truncate_to_max(weight_1_integer*pow(10,-weight_1_decimal), 2)</var>
+ <var id="J">randRange(3,5)*100</var>
+ <var id="K">randRange(1,9)*10</var>
+ <var id="L">randRange(1,9)*1</var>
+ <var id="weight_2_integer">J+K+L</var>
+ <var id="weight_2_decimal">(2)</var>
+ <var id="weight_2">truncate_to_max(weight_2_integer*pow(10,-weight_2_decimal), 2)</var>
+ <var id="height_1">randRange(16.5,22.5)</var>
+ <var id="height_2">randRange(16.5,22.5)</var>
+ <var id="solution">truncate_to_max((weight_1+weight_2),2)</var>
+ <var id="DUMMY">[]</var>
+ </div>
- <div class="question spin">
- <p>{Last Monday|On Saturday}, <var>person(1)</var>'s parents gave birth to twins and named them <var>person(2)</var> and <var>person(3)</var>. When they were first born, <var>person(2)</var> weighed <var>weight_1</var> pounds{ and was <var>height_1</var> inches tall|}, and <var>person(3)</var> weighed <var>weight_2</var> pounds {and was <var>height_2</var> inches tall|}.</p>
- <p class="question">How much did the babies weigh in total?</p>
+ <div class="question spin">
+ <p>{Last Monday|On Saturday}, <var>person(1)</var>'s parents gave birth to twins and named them <var>person(2)</var> and <var>person(3)</var>. When they were first born, <var>person(2)</var> weighed <var>weight_1</var> pounds{ and was <var>height_1</var> inches tall|}, and <var>person(3)</var> weighed <var>weight_2</var> pounds {and was <var>height_2</var> inches tall|}.</p>
+ <p class="question">How much did the babies weigh in total?</p>
- </div>
+ </div>
- <div class="solution" data-type="multiple">
- <p><span class="sol"><var> weight_1+weight_2 </var></span> pounds</p>
- </div>
+ <div class="solution" data-type="multiple">
+ <p><span class="sol"><var> weight_1+weight_2 </var></span> pounds</p>
+ </div>
- <div class="hints">
- <p>To find the weights of the 2 babies, we need to add their weights together.
- <p><var>person(2)</var>'s weight + <var>person(3)</var>'s weight = total weight.</p>
- <div class="graphie" id="numbers">
- graph.adder = new DecimalAdder( weight_1_integer, weight_1_decimal, weight_2_integer, weight_2_decimal );
- graph.adder.show();
- graph.adder.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( weight_1_integer, weight_1_decimal, weight_2_integer, weight_2_decimal ) times">
- graph.adder.showHint();
- </div>
+ <div class="hints">
+ <p>To find the weights of the 2 babies, we need to add their weights together.
+ <p><var>person(2)</var>'s weight + <var>person(3)</var>'s weight = total weight.</p>
+ <div class="graphie" id="numbers">
+ graph.adder = new DecimalAdder( weight_1_integer, weight_1_decimal, weight_2_integer, weight_2_decimal );
+ graph.adder.show();
+ graph.adder.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( weight_1_integer, weight_1_decimal, weight_2_integer, weight_2_decimal ) times">
+ graph.adder.showHint();
+ </div>
- <div class="graphie" data-update="numbers" data-each="DUMMY as dummy">
- graph.adder.showHint();
- </div>
- <p class="final_answer">Together, the babies weigh <var>solution</var> pounds.</p>
- </div>
- </div>
+ <div class="graphie" data-update="numbers" data-each="DUMMY as dummy">
+ graph.adder.showHint();
+ </div>
+ <p class="final_answer">Together, the babies weigh <var>solution</var> pounds.</p>
+ </div>
+ </div>
- <div id="change">
+ <div id="change">
- <div class="vars">
- <var id="M">randRange(1,9)</var>
- <var id="N">randRange(1,9)</var>
- <var id="O">randRange(2,9)</var>
- <var id="amount_paid_integer">M*100+N*10+O</var>
- <var id="amount_paid_decimal">(2)</var>
- <var id="amount_paid">truncate_to_max(amount_paid_integer*pow(10,-amount_paid_decimal), 2)</var>
- <var id="P">randRange(1,M)*100</var>
- <var id="Q">randRange(1,N)*10</var>
- <var id="R">randRange(1,O)*1</var>
- <var id="price_1_integer">P+Q+R</var>
- <var id="price_1_decimal">(2)</var>
- <var id="price_1">truncate_to_max(price_1_integer*pow(10,-price_1_decimal), 2)</var>
- <var id="time_1">randRange(3, 30)</var>
- <var id="solution">truncate_to_max((amount_paid-price_1),2)</var>
- <var id="DUMMY">[]</var>
- </div>
+ <div class="vars">
+ <var id="M">randRange(1,9)</var>
+ <var id="N">randRange(1,9)</var>
+ <var id="O">randRange(2,9)</var>
+ <var id="amount_paid_integer">M*100+N*10+O</var>
+ <var id="amount_paid_decimal">(2)</var>
+ <var id="amount_paid">truncate_to_max(amount_paid_integer*pow(10,-amount_paid_decimal), 2)</var>
+ <var id="P">randRange(1,M)*100</var>
+ <var id="Q">randRange(1,N)*10</var>
+ <var id="R">randRange(1,O)*1</var>
+ <var id="price_1_integer">P+Q+R</var>
+ <var id="price_1_decimal">(2)</var>
+ <var id="price_1">truncate_to_max(price_1_integer*pow(10,-price_1_decimal), 2)</var>
+ <var id="time_1">randRange(3, 30)</var>
+ <var id="solution">truncate_to_max((amount_paid-price_1),2)</var>
+ <var id="DUMMY">[]</var>
+ </div>
- <div class="question spin">
- <p>{On Tuesday,|Last Thursday,|} <var>person(1)</var> walked to <var>an(store(1))</var> store {<var>timeofday(1)</var>|} and{, after browsing for <var>time_1</var> minutes,|} decided to buy a <var>storeItem(1,1)</var> for $<var>price_1</var>. <var>person(1)</var> handed the salesperson $<var>amount_paid</var> for <var>his(1)</var> purchase.</p>
- <p class="question">How much change did <var>person(1)</var> receive?</p>
- </div>
- <div class="solution" data-forms="dollar"><var>amount_paid-price_1</var></div>
+ <div class="question spin">
+ <p>{On Tuesday,|Last Thursday,|} <var>person(1)</var> walked to <var>an(store(1))</var> store {<var>timeofday(1)</var>|} and{, after browsing for <var>time_1</var> minutes,|} decided to buy a <var>storeItem(1,1)</var> for $<var>price_1</var>. <var>person(1)</var> handed the salesperson $<var>amount_paid</var> for <var>his(1)</var> purchase.</p>
+ <p class="question">How much change did <var>person(1)</var> receive?</p>
+ </div>
+ <div class="solution" data-forms="dollar"><var>amount_paid-price_1</var></div>
- <div class="hints">
- <p>To find out how much change <var>person(1)</var> received, we can subtract the price of the <var>storeItem(1,1)</var> from the amount of money <var>he(1)</var> paid.
- <p>The amount <var>person(1)</var> paid - the price of the <var>storeItem(1,1)</var> = the amount of change <var>person(1)</var> received.</p>
- <div class="graphie" id="numbers">
- graph.subtractor = new DecimalSubtractor( amount_paid_integer, amount_paid_decimal, price_1_integer, price_1_decimal );
- graph.subtractor.show();
- graph.subtractor.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( amount_paid_integer, amount_paid_decimal, price_1_integer, price_1_decimal ) times">
- graph.subtractor.showHint();
- </div>
- <p class="final_answer"><var>person(1)</var> received $<var>solution</var> in change.</p>
- </div>
- </div>
+ <div class="hints">
+ <p>To find out how much change <var>person(1)</var> received, we can subtract the price of the <var>storeItem(1,1)</var> from the amount of money <var>he(1)</var> paid.
+ <p>The amount <var>person(1)</var> paid - the price of the <var>storeItem(1,1)</var> = the amount of change <var>person(1)</var> received.</p>
+ <div class="graphie" id="numbers">
+ graph.subtractor = new DecimalSubtractor( amount_paid_integer, amount_paid_decimal, price_1_integer, price_1_decimal );
+ graph.subtractor.show();
+ graph.subtractor.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( amount_paid_integer, amount_paid_decimal, price_1_integer, price_1_decimal ) times">
+ graph.subtractor.showHint();
+ </div>
+ <p class="final_answer"><var>person(1)</var> received $<var>solution</var> in change.</p>
+ </div>
+ </div>
- <div id="rainfall">
+ <div id="rainfall">
- <div class="vars">
- <var id="rain_1_integer">randRange(101,999)</var>
- <var id="rain_1_decimal">(2)</var>
- <var id="rain_1">truncate_to_max(rain_1_integer*pow(10,-rain_1_decimal), 2)</var>
- <var id="rain_2_integer">randRange(rain_1_integer+1,999)</var>
- <var id="rain_2_decimal">(2)</var>
- <var id="rain_2">truncate_to_max(rain_2_integer*pow(10,-rain_2_decimal), 2)</var>
- <var id="snow_1">randRange(2.1,15.89)</var>
- <var id="DUMMY">[]</var>
- <var id="solution">truncate_to_max((rain_2-rain_1),2)</var>
- </div>
+ <div class="vars">
+ <var id="rain_1_integer">randRange(101,999)</var>
+ <var id="rain_1_decimal">(2)</var>
+ <var id="rain_1">truncate_to_max(rain_1_integer*pow(10,-rain_1_decimal), 2)</var>
+ <var id="rain_2_integer">randRange(rain_1_integer+1,999)</var>
+ <var id="rain_2_decimal">(2)</var>
+ <var id="rain_2">truncate_to_max(rain_2_integer*pow(10,-rain_2_decimal), 2)</var>
+ <var id="snow_1">randRange(2.1,15.89)</var>
+ <var id="DUMMY">[]</var>
+ <var id="solution">truncate_to_max((rain_2-rain_1),2)</var>
+ </div>
- <div class="question spin">
- <p>During a recent rainstorm, <var>rain_1</var> inches of rain fell in <var>person(1)</var>'s hometown, and <var>rain_2</var> inches of rain fell in <var>person(2)</var>'s hometown. {During the same storm, <var>snow_1</var> inches of snow fell in <var>person(3)</var>'s hometown.|}</p>
- <p class="question">How much more rain fell in <var>person(2)</var>'s town than in <var>person(1)</var>'s town?</p>
- </div>
+ <div class="question spin">
+ <p>During a recent rainstorm, <var>rain_1</var> inches of rain fell in <var>person(1)</var>'s hometown, and <var>rain_2</var> inches of rain fell in <var>person(2)</var>'s hometown. {During the same storm, <var>snow_1</var> inches of snow fell in <var>person(3)</var>'s hometown.|}</p>
+ <p class="question">How much more rain fell in <var>person(2)</var>'s town than in <var>person(1)</var>'s town?</p>
+ </div>
- <div class="solution" data-type="multiple">
- <p> <span class="sol"><var>rain_2-rain_1 </var></span> inches</p>
- </div>
- <div class="hints">
- <p>To find the difference in rainfall, we can subtract the amount of rain in <var>person(1)</var>'s town from the amount of rain in <var>person(2)</var>'s town.
- <p>Rain in <var>person(2)</var>'s town - rain in <var>person(1)</var>'s town = the difference in rain between the two towns.</p>
- <div class="graphie" id="numbers">
- graph.subtractor = new DecimalSubtractor( rain_2_integer, rain_2_decimal, rain_1_integer, rain_1_decimal );
- graph.subtractor.show();
- graph.subtractor.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( rain_2_integer, rain_2_decimal, rain_1_integer, rain_1_decimal ) times">
- graph.subtractor.showHint();
- </div>
- <p class="final_answer"><var>person(2)</var>'s town received <var>solution</var> inches more rain than <var>person(1)</var>'s town.</p>
- </div>
- </div>
+ <div class="solution" data-type="multiple">
+ <p> <span class="sol"><var>rain_2-rain_1 </var></span> inches</p>
+ </div>
+ <div class="hints">
+ <p>To find the difference in rainfall, we can subtract the amount of rain in <var>person(1)</var>'s town from the amount of rain in <var>person(2)</var>'s town.
+ <p>Rain in <var>person(2)</var>'s town - rain in <var>person(1)</var>'s town = the difference in rain between the two towns.</p>
+ <div class="graphie" id="numbers">
+ graph.subtractor = new DecimalSubtractor( rain_2_integer, rain_2_decimal, rain_1_integer, rain_1_decimal );
+ graph.subtractor.show();
+ graph.subtractor.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( rain_2_integer, rain_2_decimal, rain_1_integer, rain_1_decimal ) times">
+ graph.subtractor.showHint();
+ </div>
+ <p class="final_answer"><var>person(2)</var>'s town received <var>solution</var> inches more rain than <var>person(1)</var>'s town.</p>
+ </div>
+ </div>
- <div id="travel">
+ <div id="travel">
- <div class="vars">
- <var id="distance_1_integer">randRange(100,2000)</var>
- <var id="distance_1_decimal">(2)</var>
- <var id="distance_1">truncate_to_max(distance_1_integer*pow(10,-distance_1_decimal), 2)</var>
- <var id="distance_2_integer">randRange(100,distance_1_integer-1)</var>
- <var id="distance_2_decimal">(2)</var>
- <var id="distance_2">truncate_to_max(distance_2_integer*pow(10,-distance_2_decimal), 2)</var>
- <var id="solution">truncate_to_max((distance_1+distance_2),2)</var>
- <var id="time_1">randRange(20.2,52.17)</var>
- <var id="DUMMY">[]</var>
- </div>
+ <div class="vars">
+ <var id="distance_1_integer">randRange(100,2000)</var>
+ <var id="distance_1_decimal">(2)</var>
+ <var id="distance_1">truncate_to_max(distance_1_integer*pow(10,-distance_1_decimal), 2)</var>
+ <var id="distance_2_integer">randRange(100,distance_1_integer-1)</var>
+ <var id="distance_2_decimal">(2)</var>
+ <var id="distance_2">truncate_to_max(distance_2_integer*pow(10,-distance_2_decimal), 2)</var>
+ <var id="solution">truncate_to_max((distance_1+distance_2),2)</var>
+ <var id="time_1">randRange(20.2,52.17)</var>
+ <var id="DUMMY">[]</var>
+ </div>
- <div class="question spin">
- <p>{To get to school each morning|To get to work each morning|To visit <var>his(1)</var> grandmother}, <var>person(1)</var> takes <var>an(vehicle(1))</var> <var>distance_1</var> <var>plural(distance(1))</var> and <var>an(vehicle(2))</var> <var>distance_2</var> <var>plural(distance(1))</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p>
- <p class="question">How many <var>plural(distance(1))</var> is <var>person(1)</var>'s journey in total?</p>
- </div>
+ <div class="question spin">
+ <p>{To get to school each morning|To get to work each morning|To visit <var>his(1)</var> grandmother}, <var>person(1)</var> takes <var>an(vehicle(1))</var> <var>distance_1</var> <var>plural(distance(1))</var> and <var>an(vehicle(2))</var> <var>distance_2</var> <var>plural(distance(1))</var>. {In total, the journey takes <var>time_1</var> minutes.|}</p>
+ <p class="question">How many <var>plural(distance(1))</var> is <var>person(1)</var>'s journey in total?</p>
+ </div>
- <div class="solution" data-type="multiple">
- <p> <span class="sol"><var>distance_1+distance_2</var></span> <var>plural(distance(1))</var></p>
- </div>
- <div class="hints">
- <p>To find the total distance <var>person(1)</var> travels, we need to add the two distances together.
- <p>Distance on <var>vehicle(1)</var> + distance on <var>vehicle(2)</var> = total distance.</p>
- <div class="graphie" id="numbers">
- graph.adder = new DecimalAdder( distance_1_integer, distance_1_decimal, distance_2_integer, distance_2_decimal );
- graph.adder.show();
- graph.adder.showDecimals();
- </div>
- <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( distance_1_integer, distance_1_decimal, distance_2_integer, distance_2_decimal ) times">
- graph.adder.showHint();
- </div>
+ <div class="solution" data-type="multiple">
+ <p> <span class="sol"><var>distance_1+distance_2</var></span> <var>plural(distance(1))</var></p>
+ </div>
+ <div class="hints">
+ <p>To find the total distance <var>person(1)</var> travels, we need to add the two distances together.
+ <p>Distance on <var>vehicle(1)</var> + distance on <var>vehicle(2)</var> = total distance.</p>
+ <div class="graphie" id="numbers">
+ graph.adder = new DecimalAdder( distance_1_integer, distance_1_decimal, distance_2_integer, distance_2_decimal );
+ graph.adder.show();
+ graph.adder.showDecimals();
+ </div>
+ <div class="graphie" data-update="numbers" data-each="DecimalAdder.numHintsFor( distance_1_integer, distance_1_decimal, distance_2_integer, distance_2_decimal ) times">
+ graph.adder.showHint();
+ </div>
- <div class="graphie" data-update="numbers" data-each="DUMMY as dummy">
- graph.adder.showHint();
- </div>
- <p class="final_answer"><var>person(1)</var> travels <var>solution</var> <var>plural(distance(1))</var> in total.</p>
- </div>
- </div>
- </div>
- </div>
+ <div class="graphie" data-update="numbers" data-each="DUMMY as dummy">
+ graph.adder.showHint();
+ </div>
+ <p class="final_answer"><var>person(1)</var> travels <var>solution</var> <var>plural(distance(1))</var> in total.</p>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
</html>
82 exercises/adding_and_subtracting_fractions.html
View
@@ -1,50 +1,50 @@
<!DOCTYPE html>
<html data-require="math math-format">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Adding and subtracting fractions</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Adding and subtracting fractions</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars" data-ensure="D1 !== D2">
- <var id="N1">randRangeNonZero( -9, 9 )</var>
- <var id="N2">randRangeNonZero( -9, 9 )</var>
- <var id="D1">randRangeExclude( 2, 9, [ N1, -N1 ] )</var>
- <var id="D2">randRangeExclude( 2, 9, [ N2, -N2 ] )</var>
- <var id="LCM">getLCM( D1, D2 )</var>
- <var id="F1">LCM / D1</var>
- <var id="F2">LCM / D2</var>
- </div>
+ <div class="exercise">
+ <div class="vars" data-ensure="D1 !== D2">
+ <var id="N1">randRangeNonZero( -9, 9 )</var>
+ <var id="N2">randRangeNonZero( -9, 9 )</var>
+ <var id="D1">randRangeExclude( 2, 9, [ N1, -N1 ] )</var>
+ <var id="D2">randRangeExclude( 2, 9, [ N2, -N2 ] )</var>
+ <var id="LCM">getLCM( D1, D2 )</var>
+ <var id="F1">LCM / D1</var>
+ <var id="F2">LCM / D2</var>
+ </div>
- <div class="problems">
- <div>
- <div class="question">
- <p><code><var>fraction( N1, D1 )</var> + <var>fraction( N2, D2 )</var> = {?}</code></p>
- </div>
- <div class="solution" data-type="rational"><var>N1 / D1 + N2 / D2</var></div>
- </div>
- </div>
+ <div class="problems">
+ <div>
+ <div class="question">
+ <p><code><var>fraction( N1, D1 )</var> + <var>fraction( N2, D2 )</var> = {?}</code></p>
+ </div>
+ <div class="solution" data-type="rational"><var>N1 / D1 + N2 / D2</var></div>
+ </div>
+ </div>
- <div class="hints">
- <p>First, we need to find a common denominator. The least common multiple of <code><var>D1</var></code> and <code><var>D2</var></code> is the smallest possible common denominator.</p>
- <p><code>\lcm(<var>D1</var>, <var>D2</var>) = <var>LCM</var></code></p>
- <p>Now, we need to change both fractions to have a denominator of <code><var>LCM</var></code>.</p>
- <p><code>\begin{align*}<var>fraction( N1, D1 )</var>\cdot <var>fraction( F1, F1 )</var> &= <var>fraction( N1 * F1, LCM )</var>\\
- <var>fraction( N2, D2 )</var>\cdot <var>fraction( F2, F2 )</var> &= <var>fraction( N2 * F2, LCM )</var>\end{align*}</code></p>
- <div>
- <p>So, the problem becomes:</p>
- <p><code><var>fraction( N1 * F1, LCM )</var> + <var>fraction( N2 * F2, LCM )</var> = {?}</code></p>
- </div>
- <div>
- <p><var>N2 &gt; 0 ? "Add" : "Subtract"</var> the numerators.</p>
- <p><code><var>fraction( F1 * N1 + F2 * N2, LCM)</var></code></p>
- </div>
- <div data-if="getGCD( F1 * N1 + F2 * N2, LCM ) !== 1">
- <p>Simplify.</p>
- <p><code><var>fractionReduce( F1 * N1 + F2 * N2, LCM )</var></code></p>
- </div>
- </div>
- </div>
+ <div class="hints">
+ <p>First, we need to find a common denominator. The least common multiple of <code><var>D1</var></code> and <code><var>D2</var></code> is the smallest possible common denominator.</p>
+ <p><code>\lcm(<var>D1</var>, <var>D2</var>) = <var>LCM</var></code></p>
+ <p>Now, we need to change both fractions to have a denominator of <code><var>LCM</var></code>.</p>
+ <p><code>\begin{align*}<var>fraction( N1, D1 )</var>\cdot <var>fraction( F1, F1 )</var> &= <var>fraction( N1 * F1, LCM )</var>\\
+ <var>fraction( N2, D2 )</var>\cdot <var>fraction( F2, F2 )</var> &= <var>fraction( N2 * F2, LCM )</var>\end{align*}</code></p>
+ <div>
+ <p>So, the problem becomes:</p>
+ <p><code><var>fraction( N1 * F1, LCM )</var> + <var>fraction( N2 * F2, LCM )</var> = {?}</code></p>
+ </div>
+ <div>
+ <p><var>N2 &gt; 0 ? "Add" : "Subtract"</var> the numerators.</p>
+ <p><code><var>fraction( F1 * N1 + F2 * N2, LCM)</var></code></p>
+ </div>
+ <div data-if="getGCD( F1 * N1 + F2 * N2, LCM ) !== 1">
+ <p>Simplify.</p>
+ <p><code><var>fractionReduce( F1 * N1 + F2 * N2, LCM )</var></code></p>
+ </div>
+ </div>
+ </div>
</body>
</html>
218 exercises/adding_and_subtracting_negative_numbers.html
View
@@ -1,119 +1,119 @@
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Adding and subtracting negative numbers</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Adding and subtracting negative numbers</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="A">randRange( -10, 10 )</var>
- <var id="B">randRange( -10, -1 )</var>
- </div>
+ <div class="exercise">
+ <div class="vars">
+ <var id="A">randRange( -10, 10 )</var>
+ <var id="B">randRange( -10, -1 )</var>
+ </div>
- <div class="problems">
- <div id="PLUS">
- <div class="vars">
- <var id="ANSWER">A + B</var>
- <var id="PADDING">ceil( ( 10 - ANSWER + A ) / 2)</var>
- <var id="START">A - PADDING</var>
- <var id="END">ANSWER + PADDING</var>
- <var id="REMOVE">[]</var>
- </div>
- <div class="question">
- <div class="graphie" id="numbers">
- init({
- range: [ [0, 13], [-3, 1] ]
- });
+ <div class="problems">
+ <div id="PLUS">
+ <div class="vars">
+ <var id="ANSWER">A + B</var>
+ <var id="PADDING">ceil( ( 10 - ANSWER + A ) / 2)</var>
+ <var id="START">A - PADDING</var>
+ <var id="END">ANSWER + PADDING</var>
+ <var id="REMOVE">[]</var>
+ </div>
+ <div class="question">
+ <div class="graphie" id="numbers">
+ init({
+ range: [ [0, 13], [-3, 1] ]
+ });
- label( [0, 0],
- "\\Huge{\\color{#6495ED}{" + A + "} + \\color{#28AE7B}{(" + B + ")} = {?}}",
- "right" );
- </div>
- </div>
- <div class="solution"><var>ANSWER</var></div>
- <div class="hints">
- <div class="graphie" data-update="numbers">
- REMOVE = label( [0, -1],
- "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = {?}}",
- "right" );
- </div>
- <div class="graphie" data-update="numbers">
- numberLine( START, END, 1, 1, -2 );
- circle( [ 1 + A - START, -2 ], 5/40, { stroke: "none", fill: "#6495ed" } );
- </div>
- <div class="graphie" data-update="numbers">
- style({
- stroke: "#28AE7B",
- arrows: "->"
- }, function(){
- path( [ [ 1 + A - START, -2 ], [ 1 + ANSWER - START, -2] ] );
- });
- </div>
- <div class="graphie" data-update="numbers">
- circle( [ 1 + ANSWER - START, -2 ], 5/40, { stroke: "none", fill: "#FF00AF" } );
- </div>
- <div class="graphie" data-update="numbers">
- REMOVE.remove();
- label( [0, -1],
- "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = "
- + "\\color{#FF00AF}{" + ANSWER + "}}",
- "right" );
- </div>
- </div>
- </div>
- <div id="MINUS">
- <div class="vars">
- <var id="ANSWER">A - B</var>
- <var id="PADDING">ceil( ( 10 - ANSWER + A ) / 2)</var>
- <var id="START">A - PADDING</var>
- <var id="END">ANSWER + PADDING</var>
- <var id="REMOVE">[]</var>
- </div>
- <div class="question">
- <div class="graphie" id="numbers">
- init({
- range: [ [0, 13], [-3, 1] ]
- });
+ label( [0, 0],
+ "\\Huge{\\color{#6495ED}{" + A + "} + \\color{#28AE7B}{(" + B + ")} = {?}}",
+ "right" );
+ </div>
+ </div>
+ <div class="solution"><var>ANSWER</var></div>
+ <div class="hints">
+ <div class="graphie" data-update="numbers">
+ REMOVE = label( [0, -1],
+ "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = {?}}",
+ "right" );
+ </div>
+ <div class="graphie" data-update="numbers">
+ numberLine( START, END, 1, 1, -2 );
+ circle( [ 1 + A - START, -2 ], 5/40, { stroke: "none", fill: "#6495ed" } );
+ </div>
+ <div class="graphie" data-update="numbers">
+ style({
+ stroke: "#28AE7B",
+ arrows: "->"
+ }, function(){
+ path( [ [ 1 + A - START, -2 ], [ 1 + ANSWER - START, -2] ] );
+ });
+ </div>
+ <div class="graphie" data-update="numbers">
+ circle( [ 1 + ANSWER - START, -2 ], 5/40, { stroke: "none", fill: "#FF00AF" } );
+ </div>
+ <div class="graphie" data-update="numbers">
+ REMOVE.remove();
+ label( [0, -1],
+ "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{" + B + "} = "
+ + "\\color{#FF00AF}{" + ANSWER + "}}",
+ "right" );
+ </div>
+ </div>
+ </div>
+ <div id="MINUS">
+ <div class="vars">
+ <var id="ANSWER">A - B</var>
+ <var id="PADDING">ceil( ( 10 - ANSWER + A ) / 2)</var>
+ <var id="START">A - PADDING</var>
+ <var id="END">ANSWER + PADDING</var>
+ <var id="REMOVE">[]</var>
+ </div>
+ <div class="question">
+ <div class="graphie" id="numbers">
+ init({
+ range: [ [0, 13], [-3, 1] ]
+ });
- label( [0, 0],
- "\\Huge{\\color{#6495ED}{" + A + "} - \\color{#28AE7B}{(" + B + ")} = {?}}",
- "right" );
- </div>
- </div>
- <div class="solution"><var>ANSWER</var></div>
- <div class="hints">
- <div class="graphie" data-update="numbers">
- REMOVE = label( [0, -1],
- "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{ +" + abs( B ) + "} = {?}}",
- "right" );
- </div>
- <div class="graphie" data-update="numbers">
- numberLine( START, END, 1, 1, -2 );
- circle( [ 1 + A - START, -2 ], 5/40, { stroke: "none", fill: "#6495ed" } );
- </div>
- <div class="graphie" data-update="numbers">
- style({
- stroke: "#28AE7B",
- arrows: "->"
- }, function(){
- path( [ [ 1 + A - START, -2 ], [ 1 + ANSWER - START, -2] ] );
- });
- </div>
- <div class="graphie" data-update="numbers">
- circle( [ 1 + ANSWER - START, -2 ], 5/40, { stroke: "none", fill: "#FF00AF" } );
- </div>
- <div class="graphie" data-update="numbers">
- REMOVE.remove();
- label( [0, -1],
- "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{ +" + abs( B ) + "} = "
- + "\\color{#FF00AF}{" + ANSWER + "}}",
- "right" );
- </div>
- </div>
- </div>
- </div>
- </div>
+ label( [0, 0],
+ "\\Huge{\\color{#6495ED}{" + A + "} - \\color{#28AE7B}{(" + B + ")} = {?}}",
+ "right" );
+ </div>
+ </div>
+ <div class="solution"><var>ANSWER</var></div>
+ <div class="hints">
+ <div class="graphie" data-update="numbers">
+ REMOVE = label( [0, -1],
+ "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{ +" + abs( B ) + "} = {?}}",
+ "right" );
+ </div>
+ <div class="graphie" data-update="numbers">
+ numberLine( START, END, 1, 1, -2 );
+ circle( [ 1 + A - START, -2 ], 5/40, { stroke: "none", fill: "#6495ed" } );
+ </div>
+ <div class="graphie" data-update="numbers">
+ style({
+ stroke: "#28AE7B",
+ arrows: "->"
+ }, function(){
+ path( [ [ 1 + A - START, -2 ], [ 1 + ANSWER - START, -2] ] );
+ });
+ </div>
+ <div class="graphie" data-update="numbers">
+ circle( [ 1 + ANSWER - START, -2 ], 5/40, { stroke: "none", fill: "#FF00AF" } );
+ </div>
+ <div class="graphie" data-update="numbers">
+ REMOVE.remove();
+ label( [0, -1],
+ "\\Huge{\\color{#6495ED}{" + A + "} \\color{#28AE7B}{ +" + abs( B ) + "} = "
+ + "\\color{#FF00AF}{" + ANSWER + "}}",
+ "right" );
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
</body>
</html>
202 exercises/adding_and_subtracting_polynomials.html
View
@@ -1,121 +1,121 @@
<!DOCTYPE html>
<html data-require="math math-format polynomials functional">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Adding and subtracting polynomials</title>
- <script src="../khan-exercise.js"></script>
- <script type="text/javascript">
- function getFakeAnswers( solution ) {
- var answers = [];
- for ( var i = 0; i < solution.getNumberOfTerms(); i++ ) {
- var coefs = [];
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Adding and subtracting polynomials</title>
+ <script src="../khan-exercise.js"></script>
+ <script type="text/javascript">
+ function getFakeAnswers( solution ) {
+ var answers = [];
+ for ( var i = 0; i < solution.getNumberOfTerms(); i++ ) {
+ var coefs = [];
- for ( var j = 0; j < solution.getNumberOfTerms(); j++ ) {
- var term = solution.getCoefAndDegreeForTerm( j );
+ for ( var j = 0; j < solution.getNumberOfTerms(); j++ ) {
+ var term = solution.getCoefAndDegreeForTerm( j );
- if ( i === j ) {
- coefs[ term.degree ] = KhanUtil.randRangeNonZero( -7, 7 );
- } else {
- coefs[ term.degree ] = term.coef;
- }
- }
+ if ( i === j ) {
+ coefs[ term.degree ] = KhanUtil.randRangeNonZero( -7, 7 );
+ } else {
+ coefs[ term.degree ] = term.coef;
+ }
+ }
- for ( var j = 0; j < coefs.length; j++ ) {
- if ( coefs[ j ] === undefined ) {
- coefs[ j ] = 0;
- }
- }
+ for ( var j = 0; j < coefs.length; j++ ) {
+ if ( coefs[ j ] === undefined ) {
+ coefs[ j ] = 0;
+ }
+ }
- answers.push( new KhanUtil.Polynomial(0, solution.maxDegree, coefs, solution.variable) );
- }
+ answers.push( new KhanUtil.Polynomial(0, solution.maxDegree, coefs, solution.variable) );
+ }
- return answers;
- }
- </script>
+ return answers;
+ }
+ </script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="X">randVar()</var>
- <var id="COLORS">[ BLUE, ORANGE, GREEN ]</var>
- <var id="MAX_DEGREE">7</var>
- <var id="NON_ZERO_INDICES">randRangeUniqueNonZero( 0, MAX_DEGREE, randRange(2, 3) ).sort().reverse()</var>
- <var id="POL_1, POL_2" data-ensure="POL_1.add( POL_2 ).getNumberOfTerms() >= 1 && POL_1.subtract( POL_2 ).getNumberOfTerms() >= 1">tabulate( function() {
- var coefs = [];
- for ( var i = 0; i &lt;= MAX_DEGREE; i++ ) {
- var value = 0;
- for ( var j = 0; j &lt; NON_ZERO_INDICES.length; j++ ) {
- if ( i === NON_ZERO_INDICES[ j ] ) {
- value = randRangeNonZero( -7, 7 );
- break;
- }
- }
- coefs[ i ] = value;
- }
+ <div class="exercise">
+ <div class="vars">
+ <var id="X">randVar()</var>
+ <var id="COLORS">[ BLUE, ORANGE, GREEN ]</var>
+ <var id="MAX_DEGREE">7</var>
+ <var id="NON_ZERO_INDICES">randRangeUniqueNonZero( 0, MAX_DEGREE, randRange(2, 3) ).sort().reverse()</var>
+ <var id="POL_1, POL_2" data-ensure="POL_1.add( POL_2 ).getNumberOfTerms() >= 1 && POL_1.subtract( POL_2 ).getNumberOfTerms() >= 1">tabulate( function() {
+ var coefs = [];
+ for ( var i = 0; i &lt;= MAX_DEGREE; i++ ) {
+ var value = 0;
+ for ( var j = 0; j &lt; NON_ZERO_INDICES.length; j++ ) {
+ if ( i === NON_ZERO_INDICES[ j ] ) {
+ value = randRangeNonZero( -7, 7 );
+ break;
+ }
+ }
+ coefs[ i ] = value;
+ }
- return new Polynomial( 0, MAX_DEGREE, coefs, X );
- }, 2 )</var>
- </div>
+ return new Polynomial( 0, MAX_DEGREE, coefs, X );
+ }, 2 )</var>
+ </div>
- <div class="problems">
- <div id="add">
- <div class="vars">
- <var id="SIGN">"+"</var>
- <var id="SOLUTION">POL_1.add( POL_2 )</var>
- <var id="FAKE_ANSWERS">getFakeAnswers( SOLUTION )</var>
- </div>
+ <div class="problems">
+ <div id="add">
+ <div class="vars">
+ <var id="SIGN">"+"</var>
+ <var id="SOLUTION">POL_1.add( POL_2 )</var>
+ <var id="FAKE_ANSWERS">getFakeAnswers( SOLUTION )</var>
+ </div>
- <p class="question">Simplify the expression.</p>
- <p class="problem"><code>(<var>POL_1</var>) <var>SIGN</var> (<var>POL_2</var>)</code></p>
- <p class="solution"><code><var>SOLUTION</var></code></p>
- <ul class="choices" data-none="true">
- <li><code><var>POL_1.subtract( POL_2 )</var></code></li>
- <li data-each="FAKE_ANSWERS as FAKE_ANSWER"><code><var>FAKE_ANSWER</var></code></li>
- </ul>
- </div>
+ <p class="question">Simplify the expression.</p>
+ <p class="problem"><code>(<var>POL_1</var>) <var>SIGN</var> (<var>POL_2</var>)</code></p>
+ <p class="solution"><code><var>SOLUTION</var></code></p>
+ <ul class="choices" data-none="true">
+ <li><code><var>POL_1.subtract( POL_2 )</var></code></li>
+ <li data-each="FAKE_ANSWERS as FAKE_ANSWER"><code><var>FAKE_ANSWER</var></code></li>
+ </ul>
+ </div>
- <div id="subtract" data-type="add">
- <div class="vars">
- <var id="SIGN">"-"</var>
- <var id="SOLUTION">POL_1.subtract( POL_2 )</var>
- <var id="FAKE_ANSWERS">getFakeAnswers( SOLUTION )</var>
- </div>
+ <div id="subtract" data-type="add">
+ <div class="vars">
+ <var id="SIGN">"-"</var>
+ <var id="SOLUTION">POL_1.subtract( POL_2 )</var>
+ <var id="FAKE_ANSWERS">getFakeAnswers( SOLUTION )</var>
+ </div>
- <ul class="choices" data-none="true">
- <li><code><var>POL_1.add( POL_2 )</var></code></li>
- <li data-each="FAKE_ANSWERS as FAKE_ANSWER"><code><var>FAKE_ANSWER</var></code></li>
- </ul>
+ <ul class="choices" data-none="true">
+ <li><code><var>POL_1.add( POL_2 )</var></code></li>
+ <li data-each="FAKE_ANSWERS as FAKE_ANSWER"><code><var>FAKE_ANSWER</var></code></li>
+ </ul>
- <div class="hints" data-apply="appendContents">
- <div id="paren">
- <p>Since this is subtraction, when removing the parenthesis we must distribute the minus sign to all terms in the second polynomial.</p>
- <var>POL_2 = POL_2.multiply( -1 ), null</var>
- <p><code><var>POL_1</var> + <var>POL_2</var></code></p>
- </div>
- </div>
- </div>
- </div>
+ <div class="hints" data-apply="appendContents">
+ <div id="paren">
+ <p>Since this is subtraction, when removing the parenthesis we must distribute the minus sign to all terms in the second polynomial.</p>
+ <var>POL_2 = POL_2.multiply( -1 ), null</var>
+ <p><code><var>POL_1</var> + <var>POL_2</var></code></p>
+ </div>
+ </div>
+ </div>
+ </div>
- <div class="hints">
- <div id="paren">
- <p>Since this is addition, we can remove the parenthesis without any extra steps.</p>
- <p><code><var>POL_1</var> + <var>POL_2</var></code></p>
- </div>
- <div>
- <p>Identify like terms.</p>
- <p><code><span data-each="[ POL_1, POL_2 ] as POL"><span data-each="NON_ZERO_INDICES as n, index" data-unwrap><var>( POL.coefs[ index ] &lt; 0 ) ? "-" : ( n === 0 && POL === POL_1 ) ? "" : "+"</var>\color{<var>COLORS[ n ]</var>}{<var>abs( POL.coefs[ index ] ) === 1 ? "" : abs( POL.coefs[ index ] )</var><var>X</var>^<var>index</var>}</span></span></code></p>
+ <div class="hints">
+ <div id="paren">
+ <p>Since this is addition, we can remove the parenthesis without any extra steps.</p>
+ <p><code><var>POL_1</var> + <var>POL_2</var></code></p>
+ </div>
+ <div>
+ <p>Identify like terms.</p>
+ <p><code><span data-each="[ POL_1, POL_2 ] as POL"><span data-each="NON_ZERO_INDICES as n, index" data-unwrap><var>( POL.coefs[ index ] &lt; 0 ) ? "-" : ( n === 0 && POL === POL_1 ) ? "" : "+"</var>\color{<var>COLORS[ n ]</var>}{<var>abs( POL.coefs[ index ] ) === 1 ? "" : abs( POL.coefs[ index ] )</var><var>X</var>^<var>index</var>}</span></span></code></p>
- </div>
- <div>
- <p>Combine like terms.</p>
- <p><code><span data-each="NON_ZERO_INDICES as n, index"><span data-if="n !== 0">+</span>\color{<var>COLORS[ n ]</var>}{(<var>POL_1.coefs[ index ]</var> + <var>POL_2.coefs[ index ]</var>)<var>X</var>^<var>index</var>}</span></code></p>
- </div>
- <div>
- <p>Add the coefficients.</p>
- <p><code><var>POL_1.add(POL_2).text()</var></code></p>
- <p>You're done!</p>
- </div>
- </div>
- </div>
+ </div>
+ <div>
+ <p>Combine like terms.</p>
+ <p><code><span data-each="NON_ZERO_INDICES as n, index"><span data-if="n !== 0">+</span>\color{<var>COLORS[ n ]</var>}{(<var>POL_1.coefs[ index ]</var> + <var>POL_2.coefs[ index ]</var>)<var>X</var>^<var>index</var>}</span></code></p>
+ </div>
+ <div>
+ <p>Add the coefficients.</p>
+ <p><code><var>POL_1.add(POL_2).text()</var></code></p>
+ <p>You're done!</p>
+ </div>
+ </div>
+ </div>
</body>
</html>
202 exercises/adding_and_subtracting_radicals.html
View
@@ -1,111 +1,111 @@
<!DOCTYPE html>
<html data-require="math math-format expressions">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Adding and subtracting radicals</title>
- <script src="../khan-exercise.js"></script>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Adding and subtracting radicals</title>
+ <script src="../khan-exercise.js"></script>
</head>
<body>
- <div class="exercise">
- <div class="vars">
- <var id="NUM">randFromArray([2, 3, 5, 6, 7, 10, 11, 13])</var>
- </div>
- <div class="problems">
- <div id="add">
- <div class="vars">
- <var id="A_COEFF, B_COEFF">randRangeUnique( 1, 5, 2 )</var>
- <var id="A">pow( A_COEFF, 2 ) * NUM</var>
- <var id="B">pow( B_COEFF, 2 ) * NUM</var>
- </div>
- <p class="question">Simplify the following expression:</p>
- <p><code>\sqrt{<var>A</var>} + \sqrt{<var>B</var>}</code></p>
- <div class="solution" data-type="radical"><var>pow( A_COEFF + B_COEFF, 2 ) * NUM</var></div>
- <div class="hints">
- <p>First, try to factor any perfect squares out of the radicals.</p>
- <div>
- <p><code>= \sqrt{<var>A</var>} + \sqrt{<var>B</var>}</code></p>
- <p><code>= \sqrt{<span data-if="A_COEFF !== 1"><var>pow( A_COEFF, 2 )</var> \cdot </span><var>NUM</var>} + \sqrt{<span data-if="B_COEFF !== 1"><var>pow( B_COEFF, 2 )</var> \cdot </span><var>NUM</var>}</code></p>
- </div>
- <p>Separate the radicals and simplify.</p>
- <div>
- <p><code>= <span data-if="A_COEFF !== 1">\sqrt{<var>pow( A_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>} + <span data-if="B_COEFF !== 1">\sqrt{<var>pow( B_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>}</code></p>
- <p><code>= <span data-if="A_COEFF !== 1"><var>A_COEFF</var></span>\sqrt{<var>NUM</var>} + <span data-if="B_COEFF !== 1"><var>B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
- </div>
- <p>Finally, simplify by combining the terms.</p>
- <p><code>= ( <var>A_COEFF</var> + <var>B_COEFF</var> )\sqrt{<var>NUM</var>} = <var>A_COEFF + B_COEFF</var>\sqrt{<var>NUM</var>}</code></p>
- </div>
- </div>
- <div id="subtract">
- <div class="vars">
- <var id="A_COEFF">randRange( 2, 5 )</var>
- <var id="B_COEFF">randRange( 1, A_COEFF - 1 )</var>
- <var id="A">pow( A_COEFF, 2 ) * NUM</var>
- <var id="B">pow( B_COEFF, 2 ) * NUM</var>
- </div>
- <p class="question">Simplify the following expression:</p>
- <p><code>\sqrt{<var>A</var>} - \sqrt{<var>B</var>}</code></p>
- <div class="solution" data-type="radical"><var>pow( A_COEFF - B_COEFF, 2 ) * NUM</var></div>
- <div class="hints">
- <p>First, try to factor any perfect squares out of the radicals.</p>
- <div>
- <p><code>= \sqrt{<var>A</var>} - \sqrt{<var>B</var>}</code></p>
- <p><code>= \sqrt{<var>pow( A_COEFF, 2 )</var> \cdot <var>NUM</var>} - \sqrt{<span data-if="B_COEFF !== 1"><var>pow( B_COEFF, 2 )</var> \cdot </span><var>NUM</var>}</code></p>
- </div>
- <p>Separate the radicals and simplify.</p>
- <div>
- <p><code>= \sqrt{<var>pow( A_COEFF, 2 )</var>} \cdot \sqrt{<var>NUM</var>} - <span data-if="B_COEFF !== 1">\sqrt{<var>pow( B_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>}</code></p>
- <p><code>= <var>A_COEFF</var>\sqrt{<var>NUM</var>} - <span data-if="B_COEFF !== 1"><var>B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
- </div>
- <p>Finally, simplify by combining the terms.</p>
- <p><code>= ( <var>A_COEFF</var> - <var>B_COEFF</var> )\sqrt{<var>NUM</var>} = <span data-if="A_COEFF - B_COEFF !== 1"><var>A_COEFF - B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
- </div>
- </div>
- <div id="three-radicals">
- <div class="vars">
- <var id="COEFFS">
- (function() {
- var coeffs = [1, 2, 3, 4, 5];
- var shuffled = shuffle( coeffs, 3 );
+ <div class="exercise">
+ <div class="vars">
+ <var id="NUM">randFromArray([2, 3, 5, 6, 7, 10, 11, 13])</var>
+ </div>
+ <div class="problems">
+ <div id="add">
+ <div class="vars">
+ <var id="A_COEFF, B_COEFF">randRangeUnique( 1, 5, 2 )</var>
+ <var id="A">pow( A_COEFF, 2 ) * NUM</var>
+ <var id="B">pow( B_COEFF, 2 ) * NUM</var>
+ </div>
+ <p class="question">Simplify the following expression:</p>
+ <p><code>\sqrt{<var>A</var>} + \sqrt{<var>B</var>}</code></p>
+ <div class="solution" data-type="radical"><var>pow( A_COEFF + B_COEFF, 2 ) * NUM</var></div>
+ <div class="hints">
+ <p>First, try to factor any perfect squares out of the radicals.</p>
+ <div>
+ <p><code>= \sqrt{<var>A</var>} + \sqrt{<var>B</var>}</code></p>
+ <p><code>= \sqrt{<span data-if="A_COEFF !== 1"><var>pow( A_COEFF, 2 )</var> \cdot </span><var>NUM</var>} + \sqrt{<span data-if="B_COEFF !== 1"><var>pow( B_COEFF, 2 )</var> \cdot </span><var>NUM</var>}</code></p>
+ </div>
+ <p>Separate the radicals and simplify.</p>
+ <div>
+ <p><code>= <span data-if="A_COEFF !== 1">\sqrt{<var>pow( A_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>} + <span data-if="B_COEFF !== 1">\sqrt{<var>pow( B_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>}</code></p>
+ <p><code>= <span data-if="A_COEFF !== 1"><var>A_COEFF</var></span>\sqrt{<var>NUM</var>} + <span data-if="B_COEFF !== 1"><var>B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
+ </div>
+ <p>Finally, simplify by combining the terms.</p>
+ <p><code>= ( <var>A_COEFF</var> + <var>B_COEFF</var> )\sqrt{<var>NUM</var>} = <var>A_COEFF + B_COEFF</var>\sqrt{<var>NUM</var>}</code></p>
+ </div>
+ </div>
+ <div id="subtract">
+ <div class="vars">
+ <var id="A_COEFF">randRange( 2, 5 )</var>
+ <var id="B_COEFF">randRange( 1, A_COEFF - 1 )</var>
+ <var id="A">pow( A_COEFF, 2 ) * NUM</var>
+ <var id="B">pow( B_COEFF, 2 ) * NUM</var>
+ </div>
+ <p class="question">Simplify the following expression:</p>
+ <p><code>\sqrt{<var>A</var>} - \sqrt{<var>B</var>}</code></p>
+ <div class="solution" data-type="radical"><var>pow( A_COEFF - B_COEFF, 2 ) * NUM</var></div>
+ <div class="hints">
+ <p>First, try to factor any perfect squares out of the radicals.</p>
+ <div>
+ <p><code>= \sqrt{<var>A</var>} - \sqrt{<var>B</var>}</code></p>
+ <p><code>= \sqrt{<var>pow( A_COEFF, 2 )</var> \cdot <var>NUM</var>} - \sqrt{<span data-if="B_COEFF !== 1"><var>pow( B_COEFF, 2 )</var> \cdot </span><var>NUM</var>}</code></p>
+ </div>
+ <p>Separate the radicals and simplify.</p>
+ <div>
+ <p><code>= \sqrt{<var>pow( A_COEFF, 2 )</var>} \cdot \sqrt{<var>NUM</var>} - <span data-if="B_COEFF !== 1">\sqrt{<var>pow( B_COEFF, 2 )</var>} \cdot </span>\sqrt{<var>NUM</var>}</code></p>
+ <p><code>= <var>A_COEFF</var>\sqrt{<var>NUM</var>} - <span data-if="B_COEFF !== 1"><var>B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
+ </div>
+ <p>Finally, simplify by combining the terms.</p>
+ <p><code>= ( <var>A_COEFF</var> - <var>B_COEFF</var> )\sqrt{<var>NUM</var>} = <span data-if="A_COEFF - B_COEFF !== 1"><var>A_COEFF - B_COEFF</var></span>\sqrt{<var>NUM</var>}</code></p>
+ </div>
+ </div>
+ <div id="three-radicals">
+ <div class="vars">
+ <var id="COEFFS">
+ (function() {
+ var coeffs = [1, 2, 3, 4, 5];
+ var shuffled = shuffle( coeffs, 3 );
- shuffled[1] *= randRangeNonZero( -1, 1 );
- shuffled[2] *= randRangeNonZero( -1, 1 );
- while ( shuffled[0] + shuffled[1] + shuffled[2] &lt;= 0 ) {
- shuffled[1] *= randRangeNonZero( -1, 1 );
- shuffled[2] *= randRangeNonZero( -1, 1 );
- }
+ shuffled[1] *= randRangeNonZero( -1, 1 );
+ shuffled[2] *= randRangeNonZero( -1, 1 );
+ while ( shuffled[0] + shuffled[1] + shuffled[2] &lt;= 0 ) {
+ shuffled[1] *= randRangeNonZero( -1, 1 );
+ shuffled[2] *= randRangeNonZero( -1, 1 );
+ }
- return shuffled;
+ return shuffled;
- })()
- </var>
- <var id="A_COEFF">COEFFS[0]</var>
- <var id="B_COEFF">COEFFS[1]</var>
- <var id="C_COEFF">COEFFS[2]</var>
- <var id="A">pow( A_COEFF, 2 ) * NUM</var>
- <var id="B">pow( B_COEFF, 2 ) * NUM</var>
- <var id="C">pow( C_COEFF, 2 ) * NUM</var>
- <var