Permalink
Browse files

Run JSHint

... for questionable benefit.
  • Loading branch information...
1 parent 9ce709a commit fab2c19c08e0a95c1d1f9c3db6d67dbac3562d77 @spicyj spicyj committed Jan 14, 2012
Showing with 361 additions and 349 deletions.
  1. +29 −6 build/pack.rb
  2. +1 −1 exercises/absolute_value.html
  3. +1 −1 exercises/adding_decimals.html
  4. +2 −2 exercises/addition_4.html
  5. +30 −30 exercises/addition_rule_of_probability.html
  6. +1 −1 exercises/angle_bisector_theorem.html
  7. +2 −2 exercises/angles_1.html
  8. +7 −7 exercises/angles_2.html
  9. +2 −2 exercises/chain_rule_1.html
  10. +1 −1 exercises/changing_percents_to_fractions.html
  11. +1 −1 exercises/circumradius.html
  12. +1 −1 exercises/comparing_absolute_values.html
  13. +1 −1 exercises/compound_inequalities.html
  14. +2 −2 exercises/congruent_triangles_1.html
  15. +4 −4 exercises/congruent_triangles_2.html
  16. +1 −1 exercises/converting_repeating_decimals_to_fractions_1.html
  17. +1 −1 exercises/converting_repeating_decimals_to_fractions_2.html
  18. +2 −2 exercises/creating_bar_charts_1.html
  19. +3 −3 exercises/decimals_on_the_number_line.html
  20. +2 −2 exercises/dependent_probability.html
  21. +10 −10 exercises/derivative_intuition.html
  22. +24 −24 exercises/derivatives_1.html
  23. +3 −3 exercises/distance_formula.html
  24. +1 −1 exercises/distributive_property.html
  25. +8 −8 exercises/distributive_property_with_variables.html
  26. +2 −2 exercises/domain_and_range_0.5.html
  27. +2 −2 exercises/domain_of_a_function.html
  28. +3 −3 exercises/equation_of_a_hyperbola.html
  29. +6 −6 exercises/equation_of_a_line.html
  30. +2 −2 exercises/equation_of_a_parabola.html
  31. +2 −2 exercises/equation_of_an_ellipse.html
  32. +12 −10 exercises/estimation_with_decimals.html
  33. +1 −1 exercises/exponents_3.html
  34. +2 −2 exercises/exponents_4.html
  35. +2 −2 exercises/fractions_on_the_number_line.html
  36. +1 −1 exercises/functions_1.html
  37. +2 −2 exercises/functions_2.html
  38. +2 −2 exercises/graphing_inequalities.html
  39. +10 −10 exercises/graphing_inequalities_2.html
  40. +4 −4 exercises/graphing_systems_of_inequalities.html
  41. +20 −20 exercises/graphing_systems_of_inequalities_2.html
  42. +2 −2 exercises/graphs_of_sine_and_cosine.html
  43. +3 −3 exercises/inequalities_on_a_number_line.html
  44. +50 −50 exercises/kinematic_equations.html
  45. +3 −3 exercises/lhopitals_rule.html
  46. +1 −1 exercises/multiplying_and_dividing_negative_numbers.html
  47. +9 −23 exercises/multiplying_fractions_1.html
  48. +1 −1 exercises/multiplying_polynomials.html
  49. +1 −1 exercises/negative_number_word_problems.html
  50. +2 −2 exercises/new_definitions_1.html
  51. +3 −3 exercises/new_definitions_2.html
  52. +7 −7 exercises/ordering_numbers.html
  53. +3 −3 exercises/percentage_word_problems_1.html
  54. +3 −2 exercises/place_value.html
  55. +1 −1 exercises/power_rule.html
  56. +5 −5 exercises/probability_1.html
  57. +3 −3 exercises/quadratic_equation.html
  58. +4 −4 exercises/quadrilateral_angles.html
  59. +6 −8 exercises/rate_problems_2.html
  60. +1 −1 exercises/reading_bar_charts_2.html
  61. +4 −4 exercises/reading_bar_charts_3.html
  62. +3 −3 exercises/reading_pictographs_2.html
  63. +3 −3 exercises/reading_stem_and_leaf_plots.html
  64. +1 −1 exercises/rounding_whole_numbers.html
  65. +1 −1 exercises/scaling_vectors.html
  66. +2 −2 exercises/shifting_and_reflecting_functions.html
  67. +1 −1 exercises/signs_of_a_parabola.html
  68. +1 −1 exercises/simplifying_fractions.html
  69. +3 −1 exercises/solving_for_a_variable.html
  70. +2 −2 exercises/subtraction_4.html
  71. +6 −6 exercises/systems_of_equations.html
  72. +1 −1 exercises/telling_time_0.5.html
  73. +4 −4 exercises/trigonometry_1.html
  74. +5 −5 exercises/trigonometry_2.html
  75. +2 −2 exercises/units.html
  76. +1 −1 exercises/writing_proportions.html
View
35 build/pack.rb
@@ -1,17 +1,14 @@
begin
require 'rubygems'
require 'nokogiri'
+ require 'execjs'
require 'uglifier'
require 'fileutils'
rescue LoadError
puts
puts "-" * 78
puts "Oops! Some gems are missing; please run:"
puts " sudo gem install nokogiri uglifier therubyracer"
- puts
- puts "If you prefer another JS runtime (https://github.com/sstephenson/execjs),"
- puts "be aware that this script is much faster (around 50x speedup) using"
- puts "therubyracer, which is based on Chrome's V8 engine."
puts "-" * 78
puts
exit 1
@@ -24,15 +21,39 @@
puts "-" * 78
puts "Warning! You don't have therubyracer installed, packing might be slow. Try:"
puts " sudo gem install therubyracer"
+ puts
+ puts "If you prefer another JS runtime (https://github.com/sstephenson/execjs),"
+ puts "be aware that this script is much faster (around 50x speedup) using"
+ puts "therubyracer, which is based on Chrome's V8 engine."
puts "-" * 78
puts
end
+JSHINT_ENABLED = false
+JSHINT_OPTIONS = {
+ :laxbreak => true,
+ :eqeqeq => true,
+ :loopfunc => true,
+}
+
+def jshint(js)
+ return unless JSHINT_ENABLED
+ if !@jshint.call("JSHINT", js, JSHINT_OPTIONS)
+ @jshint.eval("JSHINT.errors").each do |err|
+ break if err["reason"] == "Expected ')' to match '(' from line 1 and instead saw ','."
+ # puts "-- #{js}"
+ puts "-- #{err["reason"]} (#{err["line"]}:#{err["character"]})"
+ puts "-- > #{(err["evidence"] || "").strip}"
+ puts "--"
+ end
+ end
+end
+
# All paths are relative to khan-exercises/ root
Dir.chdir(File.join(File.dirname(__FILE__), ".."))
-# Discard all comments
-@uglifier = Uglifier.new(:copyright => false)
+@uglifier = Uglifier.new(:copyright => false) # Discard all comments
+@jshint = ExecJS.compile(File.read("build/jshint.js"))
FileUtils.mkdir_p("exercises-packed")
@@ -53,6 +74,7 @@
next if var.content !~ /\S/ # only whitespace
+ jshint("return (#{var.content});")
exp = "(#{var.content})"
var.content = @uglifier.compile(exp)
end
@@ -83,6 +105,7 @@
%w[data-ensure data-if data-else-if].each do |data_attr|
doc.css("[#{data_attr}]").each do |el|
+ jshint("return (#{el[data_attr]});")
js = el[data_attr]
el[data_attr] = @uglifier.compile(js)
end
View
2 exercises/absolute_value.html
@@ -7,7 +7,7 @@
</head>
<body>
<div class="exercise">
- <div class="vars" data-ensure="SIGN == &quot;&quot; || INT != 0 || FRAC != 0">
+ <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>
View
2 exercises/adding_decimals.html
@@ -11,7 +11,7 @@
<var id="A">randRange( 100, 999 )</var>
<var id="B">randRange( 100, 999 )</var>
<div data-ensure="B_DECIMAL !== A_DECIMAL">
- <var id="A_DECIMAL">randRangeWeighted( 0, 3, 0, .1 )</var>
+ <var id="A_DECIMAL">randRangeWeighted( 0, 3, 0, 0.1 )</var>
<var id="B_DECIMAL">randRange( 1, 3 )</var>
</div>
<var id="NEW_A">A * ( B_DECIMAL &gt; A_DECIMAL ? pow( 10, B_DECIMAL - A_DECIMAL ) : 1)</var>
View
4 exercises/addition_4.html
@@ -8,11 +8,11 @@
<body>
<div class="exercise">
<div class="vars">
- <var id="A_1000">randRangeWeighted( 0, 9, 0, .25 )*1000</var>
+ <var id="A_1000">randRangeWeighted( 0, 9, 0, 0.25 )*1000</var>
<var id="A_100">randRange( 0, 9 )*100</var>
<var id="A_10">randRange( 0, 9 )*10</var>
<var id="A_1">randRange ( 0, 9 )*1</var>
- <var id="B_1000" data-ensure="B_1000<=A_1000">randRangeWeighted( 0, 9, 0, .25 )*1000</var>
+ <var id="B_1000" data-ensure="B_1000<=A_1000">randRangeWeighted( 0, 9, 0, 0.25 )*1000</var>
<var id="B_100">randRange( 0, 9 )*100</var>
<var id="B_10">randRange( 0, 9 )*10</var>
<var id="B_1">randRange ( 0, 9 )*1</var>
View
60 exercises/addition_rule_of_probability.html
@@ -6,10 +6,10 @@
<script src="../khan-exercise.js"></script>
<script type="text/javascript">
function enFunc(innerString, usePercentages) {
- if (usePercentages)
- return "<code>P(</code>" + innerString + "<code>)</code>";
+ if (usePercentages)
+ return "<code>P(</code>" + innerString + "<code>)</code>";
else
- return "<code>\\lvert</code>" + innerString + "<code>\\rvert</code>";
+ return "<code>\\lvert</code>" + innerString + "<code>\\rvert</code>";
}
</script>
</head>
@@ -35,39 +35,39 @@
["In a sample of patients, ", CHOOSE_ATTRIBUTES( ["male", "female"], ["colorblind", "overweight", "underweight", "over sixty", "healthy", "under eighteen", "healthy"] ), "What percentage of the patients are ", "?", true],
["Of the houses in a town, ", CHOOSE_ATTRIBUTES( ["white", "blue", "light green", "solar powered", "near a park"], ["air conditioned", "wooden", "stucco"] ), "What percentage of the houses are ", "?", true],
["A census was recently taken in a certain community, and the results include the following facts about the residents: ", CHOOSE_ATTRIBUTES( ["Hispanic", "Asian", "White", "Black"], ["male", "female", "under 18", "over 65"] ), "What percentage of the residents are ", "?", true],
- ["A car dealer advertises statistics desribing her inventory. Of the cars on her lot, the advertisement states ", CHOOSE_ATTRIBUTES( ["white", "blue", "light green", "red", "grey", "black"], ["trucks", "minivans", "SUVs", "sports cars", "sedans"] ), "What percentage of the cars are ", "?", true],
+ ["A car dealer advertises statistics desribing her inventory. Of the cars on her lot, the advertisement states ", CHOOSE_ATTRIBUTES( ["white", "blue", "light green", "red", "grey", "black"], ["trucks", "minivans", "SUVs", "sports cars", "sedans"] ), "What percentage of the cars are ", "?", true]
])
</var>
- <!-- Randomize the order the variables (X, Y, X_OR_Y, X_AND_Y) are written in the question -->
- <var id="ORDER">shuffle( [0, 1, 2, 3] )</var>
- <!-- Assign values to each variable, subject to constraints so all counts are > 1 and no counts are negative -->
- <var id="VARVALS">
- ( function( usePercentages ) {
- var rangemin = usePercentages ? 1 : 2;
- var rangemax = usePercentages ? 100 : 10;
- var vals = [0, 0, 0, 0];
- vals[VARINDX_X] = randRange( rangemin, rangemax );
- vals[VARINDX_Y] = randRange( rangemin, rangemax );
- vals[VARINDX_X_AND_Y] = randRange( max( rangemin, vals[VARINDX_X]+vals[VARINDX_Y]-100 ), min( vals[VARINDX_X], vals[VARINDX_Y] ) );
- vals[VARINDX_X_OR_Y] = vals[VARINDX_X] + vals[VARINDX_Y] - vals[VARINDX_X_AND_Y];
- return vals;
- } )( USEPERCENTAGES )
- </var>
- <var id="QUESTIONTEXT">
- ( function() {
+ <!-- Randomize the order the variables (X, Y, X_OR_Y, X_AND_Y) are written in the question -->
+ <var id="ORDER">shuffle( [0, 1, 2, 3] )</var>
+ <!-- Assign values to each variable, subject to constraints so all counts are > 1 and no counts are negative -->
+ <var id="VARVALS">
+ ( function( usePercentages ) {
+ var rangemin = usePercentages ? 1 : 2;
+ var rangemax = usePercentages ? 100 : 10;
+ var vals = [0, 0, 0, 0];
+ vals[VARINDX_X] = randRange( rangemin, rangemax );
+ vals[VARINDX_Y] = randRange( rangemin, rangemax );
+ vals[VARINDX_X_AND_Y] = randRange( max( rangemin, vals[VARINDX_X]+vals[VARINDX_Y]-100 ), min( vals[VARINDX_X], vals[VARINDX_Y] ) );
+ vals[VARINDX_X_OR_Y] = vals[VARINDX_X] + vals[VARINDX_Y] - vals[VARINDX_X_AND_Y];
+ return vals;
+ } )( USEPERCENTAGES )
+ </var>
+ <var id="QUESTIONTEXT">
+ ( function() {
var optionalPercentage = USEPERCENTAGES ? "% are " : " ";
- var qstn = INTRO;
- for (var i=0; i &lt; ORDER.length-1; i++) {
+ var qstn = INTRO;
+ for (var i=0; i &lt; ORDER.length-1; i++) {
qstn += (i===ORDER.length-2) ? " and " : "";
qstn += VARVALS[ORDER[i]] + optionalPercentage + VARDESC[ORDER[i]];
qstn += (i &lt; ORDER.length-2) ? ", " : ". ";
- }
- qstn += QSTNPRETEXT + VARDESC[ORDER[ORDER.length-1]] + QSTNPOSTTEXT;
- return qstn;
- } )()
- </var>
- <!-- this just passes the call to plain JS to avoid problems with unescaped HTML in the function body, while still giving access to vars -->
- <var id="ENFUNC"> function (innerString) { return enFunc(innerString, USEPERCENTAGES); } </var>
+ }
+ qstn += QSTNPRETEXT + VARDESC[ORDER[ORDER.length-1]] + QSTNPOSTTEXT;
+ return qstn;
+ } )()
+ </var>
+ <!-- this just passes the call to plain JS to avoid problems with unescaped HTML in the function body, while still giving access to vars -->
+ <var id="ENFUNC"> function (innerString) { return enFunc(innerString, USEPERCENTAGES); } </var>
</div>
<div class="question"><p><var>QUESTIONTEXT</var></p></div>
View
2 exercises/angle_bisector_theorem.html
@@ -8,7 +8,7 @@
<body>
<div class="exercise">
<div class="vars">
- <var id="ANGLES" data-ensure="ANGLES[ 0 ] % 2 == 0">randomTriangleAngles.triangle()</var>
+ <var id="ANGLES" data-ensure="ANGLES[ 0 ] % 2 === 0">randomTriangleAngles.triangle()</var>
<var id="SIDES_B">[ [ 0, 1 ], [] ]</var>
<var id="SIDES_C">[ [ 1 ], [ 2] ]</var>
<var id="TR_A">
View
4 exercises/angles_1.html
@@ -377,14 +377,14 @@
<ul>
<li><code>\overline{HI} \parallel \overline{JK}</code>,
lines HI and JK are parallel.</li>
- <li data-if="RAND3 == 0 || RAND3 == 1">
+ <li data-if="RAND3 === 0 || RAND3 === 1">
<code>\color{purple}{\angle{BAC}} = <var>Tri_X</var>&deg;</code>
</li>
<li data-else>
<code>\color{purple}{\angle{AKJ}} = <var>Tri_Y</var>&deg;</code>
</li>
- <li data-if="RAND3 == 0">
+ <li data-if="RAND3 === 0">
<code>\color{green}{\angle{AJK}} = <var>Tri_Z</var>&deg;</code>
</li>
<li data-else>
View
14 exercises/angles_2.html
@@ -278,19 +278,19 @@
label([0,2], "\\color{orange}{" + X + "&deg;}", "below left");
</span>
</p>
- <p data-if="RAND_COMBO == 20">
+ <p data-if="RAND_COMBO === 20">
<code>\color{blue}{\angle{GHD}} = \color{orange}{\angle{AGH}}</code>.
We know those 2 angles are equal because they are alternate interior angles
of 2 parallel lines.
</p>
- <p data-else-if="RAND_COMBO == 21 || RAND_COMBO == 1">
+ <p data-else-if="RAND_COMBO === 21 || RAND_COMBO === 1">
<code>\color{blue}{\angle{CHF}} = \color{orange}{\angle{AGH}}</code>.
We know those 2 angles are equal because they are corresponding angles
formed by parallel lines, and a single bisecting lines.
</p>
<p>
Therefore,
- <span data-if="RAND_SWITCH2 == 0">
+ <span data-if="RAND_SWITCH2 === 0">
<code>\angle{GHD} = <var>X</var>&deg;</code>
<span class="graphie" data-update="opposite-parallel">
LABEL.remove();
@@ -543,7 +543,7 @@
<div class="solution"><var>Tri2_X</var></div>
<div class="hints">
- <p data-if="RAND_SWITCH2==0">
+ <p data-if="RAND_SWITCH2 === 0">
<code>\color{purple}{\angle{DIJ}} = 180&deg; - \color{orange}{\angle{AIC}}</code>.
This is because angles along a line total 180&deg;.
<span class="graphie" data-update="star2">
@@ -564,7 +564,7 @@
</span>
</p>
- <p data-if="RAND_SWITCH2==0">
+ <p data-if="RAND_SWITCH2 === 0">
<code>\color{teal}{\angle{DJI}} = 180&deg; - \color{green}{\angle{BDC}} -
\color{purple}{\angle{DIJ}}</code>.
We know this because the sum of angles inside a triangle add up to 180&deg;.
@@ -588,7 +588,7 @@
</p>
- <p data-if="RAND_SWITCH2==0">
+ <p data-if="RAND_SWITCH2 === 0">
<code>\color{blue}{\angle{AJF}} = \color{teal}{\angle{DJI}}</code>.
We know they are equal because they are opposite angles.
</p>
@@ -599,7 +599,7 @@
<p>
Therefore,
- <span data-if="RAND_SWITCH2 == 0">
+ <span data-if="RAND_SWITCH2 === 0">
<code>\angle{AJF} = <var>Tri2_X</var>&deg;</code>
<span class="graphie" data-update="star2">
LABEL.remove();
View
4 exercises/chain_rule_1.html
@@ -13,7 +13,7 @@
<var id="PRE_SIMPLIFICATION">
( ( OUTER.f[0] === '^' &amp;&amp; OUTER.f[1] === 'e' &amp;&amp; INNER.f[0] === 'ln' )
- || ( OUTER.f[0] === 'ln' &amp;&amp; INNER.f[0] === '^' &amp;&amp; INNER.f[1] == 'e' ) )
+ || ( OUTER.f[0] === 'ln' &amp;&amp; INNER.f[0] === '^' &amp;&amp; INNER.f[1] === 'e' ) )
? 'x'
: null
</var>
@@ -32,7 +32,7 @@
<var id="DERIVATIVE_SIMPLIFICATIONS">
( ( OUTER.f[0] === '^' &amp;&amp; OUTER.f[1] === 'e' &amp;&amp; INNER.f[0] === 'ln' )
- || ( OUTER.f[0] === 'ln' &amp;&amp; INNER.f[0] === '^' &amp;&amp; INNER.f[1] == 'e' ) )
+ || ( OUTER.f[0] === 'ln' &amp;&amp; INNER.f[0] === '^' &amp;&amp; INNER.f[1] === 'e' ) )
? [['frac', 'x', 'x'], '1']
: []
</var>
View
2 exercises/changing_percents_to_fractions.html
@@ -31,7 +31,7 @@
<div class="hints">
<p><code><var>A</var>\%</code> literally means <code><var>A</var></code> per 100</p>
<p>Putting this in fraction form: <code><var>fraction( A , 100 )</var></code></p>
- <p data-if="( A * 10 ) % 10 != 0">Multiplying top and bottom by 10 to get rid of the decimal: <code><var>fraction( A * 10 , 1000 )</var></code></p>
+ <p data-if="( A * 10 ) % 10 !== 0">Multiplying top and bottom by 10 to get rid of the decimal: <code><var>fraction( A * 10 , 1000 )</var></code></p>
<p data-if="getGCD( A * 10 , 1000 ) > 1">Both numerator and denominator are divisible by <code><var>getGCD( A * 10 , 1000 )</var></code>.</p>
<p data-if="getGCD( A * 10 , 1000 ) > 1">Reducing to lowest terms, <code><var>fractionReduce( A * 10 , 1000 )</var></code>.</p>
<p data-if="A > 100">Optionally, the improper fraction <code><var>fractionReduce( A * 10 , 1000 )</var></code> can be converted to the mixed number <code><var>( A * 10 - A * 10 % 1000 ) / 1000 + fractionReduce( round ( A * 10 % 1000 ), 1000 )</var></code>.</p>
View
2 exercises/circumradius.html
@@ -13,7 +13,7 @@
<div class="problems">
<div id="equi">
<div class="vars">
- <var id="ANGLES" data-ensure="ANGLES[ 0 ] % 2 == 0">randomTriangleAngles.triangle()</var>
+ <var id="ANGLES" data-ensure="ANGLES[ 0 ] % 2 === 0">randomTriangleAngles.triangle()</var>
<var id="CIRCUMLENGTH"></var>
<var id="BD"></var>
<var id="AC"></var>
View
2 exercises/comparing_absolute_values.html
@@ -38,7 +38,7 @@
<div class="problems">
<div>
<div class="vars">
- <var id="ABS_1, ABS_2">randFromArray([[ "|", "|", ], [ "|", "", ], [ "", "|", ]])</var>
+ <var id="ABS_1, ABS_2">randFromArray([[ "|", "|" ], [ "|", "" ], [ "", "|" ]])</var>
<var id="NUM_1">randRange(-10, 10)</var>
<var id="NUM_2">( NUM_1 &lt; 0 ) ? randRange(0, 10) : randRange(-10, -1)</var>
<var id="NUM_1_VALUE">ABS_1 ? abs( NUM_1 ) : NUM_1</var>
View
2 exercises/compound_inequalities.html
@@ -62,7 +62,7 @@
<var id="OR">randFromArray([ "or", "and" ])</var>
<var id="IS_OR">OR === "or"</var>
<var id="FAKE_ANSWER">tabulate( function() {
- return randRange( 2, 9 ) * ( rand( 3 ) > 0 ? 1 : -1 )
+ return randRange( 2, 9 ) * ( rand( 3 ) > 0 ? 1 : -1 );
}, 2 )</var>
<var id="CONTAINS">(function() {
if ( LESS_THAN[0] && LESS_THAN[1] ) {
View
4 exercises/congruent_triangles_1.html
@@ -2,7 +2,7 @@
<html data-require="math graphie graphie-helpers graphie-geometry math-format">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Congruent Triangles 1</title>
+ <title>Congruent triangles 1</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
@@ -30,7 +30,7 @@
<var id="TR_B">
function(){
var t = new Triangle( [ 7, -6 ], B, B_SIZE, {} );
- t.labels = { "name": "B", "angles" : clearArray( t.niceAngles, B_ANGLES ), "sides" : clearArray( t.niceSideLengths, B_SIDES ) }
+ t.labels = { "name": "B", "angles" : clearArray( t.niceAngles, B_ANGLES ), "sides" : clearArray( t.niceSideLengths, B_SIDES ) };
return t;
}()
</var>
View
8 exercises/congruent_triangles_2.html
@@ -102,10 +102,10 @@
<var id="NEW_ANG">
function(){
var newAng = RAND_ANG;
- if ( RAND_ANG == 0 ){
+ if ( RAND_ANG === 0 ){
newAng = 1;
}
- else if ( RAND_ANG == 1 ){
+ else if ( RAND_ANG === 1 ){
newAng = 0;
}
return newAng;
@@ -116,10 +116,10 @@
<var id="ANG_LEFT">randRange( 0, 2 )</var>
<var id="SHOW_ANGLE">
function(){
- if ( ANG_LEFT == 1 ){
+ if ( ANG_LEFT === 1 ){
return 0;
}
- if ( ANG_LEFT == 0 ){
+ if ( ANG_LEFT === 0 ){
return 1;
}
return 2;
View
2 exercises/converting_repeating_decimals_to_fractions_1.html
@@ -38,7 +38,7 @@
<p>Subtracting the two equations, we have:</p>
<p><code>\large{<var>(MULT1 - MULT2)</var>x = <var>DIFF</var>}</code></p>
</div>
- <p><code>\large{x = <var>fraction( DIFF, MULT1 - MULT2 )</var>}\quad<span data-if="getGCD( DIFF, MULT1 - MULT2 ) == 1 && DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( DIFF, MULT1 - MULT2 )</var>}</span></code></p>
+ <p><code>\large{x = <var>fraction( DIFF, MULT1 - MULT2 )</var>}\quad<span data-if="getGCD( DIFF, MULT1 - MULT2 ) === 1 && DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( DIFF, MULT1 - MULT2 )</var>}</span></code></p>
<p data-if="getGCD( DIFF, MULT1 - MULT2 ) !== 1"><code>\large{x = <var>fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])</var>}\quad<span data-if="DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )</var>}</span></code></p>
</div>
</div>
View
2 exercises/converting_repeating_decimals_to_fractions_2.html
@@ -81,7 +81,7 @@
<p>Subtracting the two equations, we have:</p>
<p><code>\large{<var>(MULT1 - MULT2)</var>x = <var>DIFF</var>}</code></p>
</div>
- <p><code>\large{x = <var>fraction( DIFF, MULT1 - MULT2 )</var>}\quad<span data-if="getGCD( DIFF, MULT1 - MULT2 ) == 1 && DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( DIFF, MULT1 - MULT2 )</var>}</span></code></p>
+ <p><code>\large{x = <var>fraction( DIFF, MULT1 - MULT2 )</var>}\quad<span data-if="getGCD( DIFF, MULT1 - MULT2 ) === 1 && DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( DIFF, MULT1 - MULT2 )</var>}</span></code></p>
<p data-if="getGCD( DIFF, MULT1 - MULT2 ) !== 1"><code>\large{x = <var>fraction( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ])</var>}\quad<span data-if="DIFF > ( MULT1 - MULT2 )"> \text{or} \quad\large{<var>mixedFractionFromImproper( toFraction( N4 )[ 0 ], toFraction( N4 )[ 1 ] )</var>}</span></code></p>
</div>
</div>
View
4 exercises/creating_bar_charts_1.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html data-require="math math-format expressions graphie interactive word-problems">
+<html data-require="math math-format expressions graphie interactive word-problems stat">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Creating bar charts 1</title>
@@ -25,7 +25,7 @@
<var id="SUBJECT">randFromArray([ "animal", "color", "fruit", "course" ])</var>
<var id="CATEGORIES">jQuery.map( _.range(5), function( n ) { return ( KhanUtil[ SUBJECT ] )( n + 1 ); } )</var>
<var id="DATA">jQuery.map( _.range(5), function() { return randRange( 0, 10 ); } )</var>
- <var id="TOTAL">eval( DATA.join( "+" ) )</var>
+ <var id="TOTAL">sum( DATA )</var>
<var id="RESPONDENT">randFromArray([ "student", "teacher", "person" ])</var>
</div>
View
6 exercises/decimals_on_the_number_line.html
@@ -21,14 +21,14 @@
arr = [];
for ( i = 0; i &lt; pos; i++){
- arr.push( NUMBER - ((pos - i) * 0.47))
+ arr.push( NUMBER - ((pos - i) * 0.47));
}
arr.push( NUMBER );
for ( i = pos + 1; i &lt; 5; i++ ){
- arr.push( NUMBER + (( i - pos) * 0.47))
+ arr.push( NUMBER + (( i - pos) * 0.47));
}
return arr;
- })()</var>
+ })()</var>
<var id="POSS_ANSWER">[ "A", "B", "C", "D", "E" ]</var>
<var id="ANSWER" >POSS_ANSWER[ WRONGS.indexOf( NUMBER ) ] </var>
</div>
View
4 exercises/dependent_probability.html
@@ -50,7 +50,7 @@
<var id="DECIMAL_CHANCE_UNFAIR_HEADS">PERCENT_CHANCE_UNFAIR_HEADS / 100</var>
<var id="UNFAIR_HEADS_DECIMAL_FORMULA">
(function() {
- var uhdf = DECIMAL_CHANCE_UNFAIR_HEADS.toString()
+ var uhdf = DECIMAL_CHANCE_UNFAIR_HEADS.toString();
for (var i = 0; i &lt; NUM_FLIPS - 1; i++) {
uhdf += " \\times " + DECIMAL_CHANCE_UNFAIR_HEADS;
}
@@ -82,7 +82,7 @@
<var id="CHANCE_FAIR_PICKED">1 - CHANCE_UNFAIR_PICKED</var>
<var id="ANSWER">round(10000 * (CHANCE_UNFAIR_PICKED * pow((PERCENT_CHANCE_UNFAIR_HEADS / 100), NUM_FLIPS) +
- CHANCE_FAIR_PICKED * pow(.5,NUM_FLIPS))) / 100</var>
+ CHANCE_FAIR_PICKED * pow(0.5,NUM_FLIPS))) / 100</var>
</div>
View
20 exercises/derivative_intuition.html
@@ -91,38 +91,38 @@
{
text: "sin(x)",
ddxtext: "cos(x)",
- fnx: function(x) { return Math.sin(x) },
- ddx: function(x) { return Math.cos(x) },
+ fnx: function(x) { return Math.sin(x); },
+ ddx: function(x) { return Math.cos(x); },
xrange: [-1.25*Math.PI, 1.25*Math.PI],
yrange: [ -1.25, 1.25 ],
points: [ -1*Math.PI, -3*Math.PI/4, -Math.PI/2, -Math.PI/4, 0, Math.PI/4, Math.PI/2, 3*Math.PI/4, Math.PI ],
options: { xLabelFormat: piFraction }
}, {
text: "cos(x)",
ddxtext: "-sin(x)",
- fnx: function(x) { return Math.cos(x) },
- ddx: function(x) { return -Math.sin(x) },
+ fnx: function(x) { return Math.cos(x); },
+ ddx: function(x) { return -Math.sin(x); },
xrange: [-1.25*Math.PI, 1.25*Math.PI],
yrange: [ -1.25, 1.25 ],
points: [ -1*Math.PI, -3*Math.PI/4, -Math.PI/2, -Math.PI/4, 0, Math.PI/4, Math.PI/2, 3*Math.PI/4, Math.PI ],
options: { xLabelFormat: piFraction }
}, {
text: "e^x",
ddxtext: "e^x",
- fnx: function(x) { return Math.exp(x, Math.E) },
- ddx: function(x) { return Math.exp(x, Math.E) },
+ fnx: function(x) { return Math.exp(x, Math.E); },
+ ddx: function(x) { return Math.exp(x, Math.E); },
xrange: [-5, 5],
yrange: [ -5, 15 ],
points: [ -2, -1, 0, 1, 2 ],
options: {}
}, {
text: "ln(x)",
ddxtext: "\\frac{1}{x}",
- fnx: function(x) { return Math.log(x) },
- ddx: function(x) { return 1/x },
- xrange: [.001, 5],
+ fnx: function(x) { return Math.log(x); },
+ ddx: function(x) { return 1/x; },
+ xrange: [ 0.001, 5 ],
yrange: [ -5, 5 ],
- points: [ .25, .5, 1, 2, 3, 4 ],
+ points: [ 0.25, 0.5, 1, 2, 3, 4 ],
options: { range: [ [ -0.25, 4.75 ], [ -5, 5 ] ] }
}
])
View
48 exercises/derivatives_1.html
@@ -71,52 +71,52 @@
</div>
<p><code>\qquad = \displaystyle \lim_{<var>H</var> \to 0} \frac{(<var>expr(
["+", ["*", A, ["^", ["+", "x", H], 2]],
- ["*", B, ["+", "x", H]],
- C]
+ ["*", B, ["+", "x", H]],
+ C]
)</var>) - (<var>expr(
["+", ["*", A, ["^", "x", 2]],
- ["*", B, "x"],
- C]
+ ["*", B, "x"],
+ C]
)</var>)}{<var>H</var>}</code></p>
<p><code>\qquad = \displaystyle \lim_{<var>H</var> \to 0} \frac{(<var>expr(
["+", ["*", A, ["+", ["^", "x", 2],
- "2x " + H,
- ["^", H, 2]]],
- ["*", B, ["+", "x", H]],
- C]
+ "2x " + H,
+ ["^", H, 2]]],
+ ["*", B, ["+", "x", H]],
+ C]
)</var>) - (<var>expr(
["+", ["*", A, ["^", "x", 2]],
- ["*", B, "x"],
- C]
+ ["*", B, "x"],
+ C]
)</var>)}{<var>H</var>}</code></p>
<p><code>\qquad = \displaystyle \lim_{<var>H</var> \to 0} \frac{<var>expr(
["+", ["*", A, ["^", "x", 2]],
- ["*", 2 * A, "x " + H],
- ["*", A, ["^", H, 2]],
- ["*", B, "x"],
- ["*", B, H],
- C,
- ["*", -A, ["^", "x", 2]],
- ["*", -B, "x"],
- -C]
+ ["*", 2 * A, "x " + H],
+ ["*", A, ["^", H, 2]],
+ ["*", B, "x"],
+ ["*", B, H],
+ C,
+ ["*", -A, ["^", "x", 2]],
+ ["*", -B, "x"],
+ -C]
)</var>}{<var>H</var>}</code></p>
<p><code>\qquad = \displaystyle \lim_{<var>H</var> \to 0} \frac{<var>expr(
["+", ["*", 2 * A, "x " + H],
- ["*", A, ["^", H, 2]],
- ["*", B, H]]
+ ["*", A, ["^", H, 2]],
+ ["*", B, H]]
)</var>}{<var>H</var>}</code></p>
<p><code>\qquad = \displaystyle \lim_{<var>H</var> \to 0} <var>expr(
["+", ["*", 2 * A, "x"],
- ["*", A, H],
- B]
+ ["*", A, H],
+ B]
)</var></code></p>
<p><code>\qquad = \displaystyle <var>expr(
["+", ["*", 2 * A, "x"],
- B]
+ B]
)</var></code></p>
<p><code>\qquad = \displaystyle <var>expr(
["+", ["*", 2 * A, X],
- B]
+ B]
)</var></code></p>
<p><code>\qquad = <var>2 * A * X + B</var></code></p>
</div>
View
6 exercises/distance_formula.html
@@ -64,7 +64,7 @@
= <span style="color: #679B00"><var>X_DIST</var></span>
</p>
- <div data-if=" X2 - X1 != 0" class="graphie" data-update="graph">
+ <div data-if="X2 - X1 !== 0" class="graphie" data-update="graph">
style({
color: "#679b00",
stroke: "#679b00"
@@ -87,7 +87,7 @@
= <span style="color: #A66000"><var>Y_DIST</var></span>
</p>
- <div data-if="Y2-Y1 != 0" class="graphie" data-update="graph">
+ <div data-if="Y2-Y1 !== 0" class="graphie" data-update="graph">
style({
color: "#a66000",
stroke: "#a66000"
@@ -98,7 +98,7 @@
</div>
</div>
- <div data-if="Y2 - Y1 !== 0 && X1 - X2 !== 0 " >
+ <div data-if="Y2 - Y1 !== 0 && X1 - X2 !== 0">
<p>The distance is the <span style="color: #FF4900">length of the hypotenuse</span> of this right triangle.</p>
<div class="graphie" data-update="graph">
View
2 exercises/distributive_property.html
@@ -54,7 +54,7 @@
<var id="SYM_A, SYM_B, SYM_C">
(function() {
return jQuery.map( NUMS, function( el, i ) {
- if ( i == SWAP_INDEX ) {
+ if ( i === SWAP_INDEX ) {
return SYMBOL;
} else {
return el;
View
16 exercises/distributive_property_with_variables.html
@@ -97,13 +97,13 @@
<p class="solution"><code><var>plus( B+X, A+(B*C)+D )</var></code></p>
<ul class="choices" data-show="4" data-none="true">
- <li data-if="C != (A+D)"><code><var>X</var> - <var>A+(-1*C)+D</var></code></li>
- <li data-if="(A+C+D) != 0"><code><var>plus( B+X )</var> + <var>A+C+D</var></code></li>
- <li data-if="C != (A+D)"><code><var>X</var> + <var>A+(-1*C)+D</var></code></li>
- <li data-if="(A+C+D) != 0"><code><var>X</var> - <var>A+C+D</var></code></li>
- <li data-if="(A+C+D) != 0"><code><var>X</var> + <var>A+C+D</var></code></li>
- <li data-if="(C+D) != 0"><code><var>plus( A, B+X, C+D )</var></code></li>
- <li data-if="C != D"><code><var>plus( A, B+X, (-1*C)+D )</var></code></li>
+ <li data-if="C !== (A+D)"><code><var>X</var> - <var>A+(-1*C)+D</var></code></li>
+ <li data-if="(A+C+D) !== 0"><code><var>plus( B+X )</var> + <var>A+C+D</var></code></li>
+ <li data-if="C !== (A+D)"><code><var>X</var> + <var>A+(-1*C)+D</var></code></li>
+ <li data-if="(A+C+D) !== 0"><code><var>X</var> - <var>A+C+D</var></code></li>
+ <li data-if="(A+C+D) !== 0"><code><var>X</var> + <var>A+C+D</var></code></li>
+ <li data-if="(C+D) !== 0"><code><var>plus( A, B+X, C+D )</var></code></li>
+ <li data-if="C !== D"><code><var>plus( A, B+X, (-1*C)+D )</var></code></li>
</ul>
<div class="hints">
@@ -171,7 +171,7 @@
<p><code><var>plus( A+X, A*B )</var> + <var>plus( color( C, true )+color( PLUSPARENS( D, X ), false ) )</var></code></p>
</div>
<div data-if="C === -1">
- <p data-if="A != -1">A negative sign before an expression is the same as -1 times that expression.</p>
+ <p data-if="A !== -1">A negative sign before an expression is the same as -1 times that expression.</p>
<p><code><var>plus( A+X, A*B )</var> + \color{ blue }{ -1 }*<var>plus( color( PLUSPARENS( D, X ), false ) )</var></code></p>
</div>
<p><code><var>plus( A+X, A*B )</var> + <var>color( plus( C*D, C+X ) )</var></code></p>
View
4 exercises/domain_and_range_0.5.html
@@ -12,13 +12,13 @@
<var id="DOMAIN">[ randRange( -9, -1 ), randRange( 1, 9 ) ]</var>
<var id="FUNCTION_PATH">
(function() {
- var functionPath = new Array();
+ var functionPath = [];
var prev;
var push = function( val ) {
prev = val;
functionPath.push( prev );
- }
+ };
push([ DOMAIN[0], randRange( -5, 5 ) ]);
View
4 exercises/domain_of_a_function.html
@@ -95,7 +95,7 @@
<p class="problem"><code>f(x) = \sqrt{ x - <var>A</var> }</code></p>
- <p class="solution"><code><var>CHOICES["sqrt"]</var></code></p>
+ <p class="solution"><code><var>CHOICES.sqrt</var></code></p>
<ul class="choices" data-show="5" data-none="true">
<li data-each="filter( CHOICES, function( c ) { return c !== 'sqrt'; } ) as c"><code><var>c</var></code></li>
</ul>
@@ -104,7 +104,7 @@
<p><code>f(x)</code> is undefined when the radicand (the expression under the radical) is less than zero.</p>
<p>So the radicand, <code>x - <var>A</var></code>, must be greater than or equal to zero.</p>
<p>So <code>x - <var>A</var> \geq 0</code>; this means <code>x \geq <var>A</var></code>.</p>
- <p>Expressing this mathematically, the domain is <code><var>CHOICES["sqrt"]</var></code>.</p>
+ <p>Expressing this mathematically, the domain is <code><var>CHOICES.sqrt</var></code>.</p>
</div>
</div>
View
6 exercises/equation_of_a_hyperbola.html
@@ -22,8 +22,8 @@
<var id="WHICH_NEG">rand(2)</var>
- <var id="X_MINUS"> WHICH_NEG === 1 ? "+" : "+"</var>
- <var id="Y_MINUS"> WHICH_NEG === 1 ? "" : "-"</var>
+ <var id="X_MINUS">WHICH_NEG === 1 ? "+" : "+"</var>
+ <var id="Y_MINUS">WHICH_NEG === 1 ? "" : "-"</var>
<var id="X">H === 0 ? "x^2" : expr(["^", ["+", "x", -H], 2])</var>
<var id="Y">K === 0 ? "y^2" : expr(["^", ["+", "y", -K], 2])</var>
@@ -34,7 +34,7 @@
<div class="problems">
<div>
<div class="question">
- <p>The equation of hyperbola <code>H</code> is <code><var>WHICH_NEG == 1 ? expr(["-", Y2T, X2T]) : expr(["-", X2T, Y2T])</var> = 1</code>.</p>
+ <p>The equation of hyperbola <code>H</code> is <code><var>WHICH_NEG === 1 ? expr(["-", Y2T, X2T]) : expr(["-", X2T, Y2T])</var> = 1</code>.</p>
<p>What are the asymptotes?</p>
</div>
View
12 exercises/equation_of_a_line.html
@@ -99,8 +99,8 @@
<p><code>m = \dfrac{<var>Y2</var> - <var>negParens(Y1)</var>}{<var>X2</var> - <var>negParens(X1)</var>} = <var>fractionReduce( Y2 - Y1, X2 - X1 )</var></code></p>
</div>
<p>
- Writing the equation of the line, we have <code>y = <var>( M == -1 ? "-" : ( M == 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + b</code>
- <span data-if="abs( M ) == 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.
+ Writing the equation of the line, we have <code>y = <var>( M === -1 ? "-" : ( M === 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + b</code>
+ <span data-if="abs( M ) === 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.
</p>
<p>To find <code>b</code>, we can substitute in either of the two points into the above equation. Let's go through both cases:</p>
@@ -114,7 +114,7 @@
<p><code><var>Y2</var> = (<var>fractionReduce( Y2 - Y1, X2 - X1 )</var>)(<var>X2</var>) + b</code></p>
<p><code>b = <var>Y2</var> - <var>fractionReduce( X2 * ( Y2 - Y1 ), X2 - X1 )</var> = <var>fractionReduce( Y2 * (X2 - X1) - X2 * ( Y2 - Y1 ), X2 - X1 )</var></code></p>
</div>
- <p>In both cases, the equation of the line is <code>y = <var>( M == -1 ? "-" : ( M == 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + <var>fractionReduce( Y1 * (X2 - X1) - X1 * ( Y2 - Y1 ), X2 - X1 )</var></code><span data-if="abs( M ) == 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.</p>
+ <p>In both cases, the equation of the line is <code>y = <var>( M === -1 ? "-" : ( M === 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + <var>fractionReduce( Y1 * (X2 - X1) - X1 * ( Y2 - Y1 ), X2 - X1 )</var></code><span data-if="abs( M ) === 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.</p>
</div>
</div>
@@ -172,8 +172,8 @@
<p><code>m = \dfrac{<var>Y2</var> - <var>negParens(Y1)</var>}{<var>X2</var> - <var>negParens(X1)</var>} = <var>fractionReduce( Y2 - Y1, X2 - X1 )</var></code></p>
</div>
<p>
- Writing the equation of the line, we have <code>y = <var>( M == -1 ? "-" : ( M == 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + b</code>
- <span data-if="abs( M ) == 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.
+ Writing the equation of the line, we have <code>y = <var>( M === -1 ? "-" : ( M === 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + b</code>
+ <span data-if="abs( M ) === 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.
</p>
<p>To find <code>b</code>, we can substitute in either of the two points into the above equation. Let's go through both cases:</p>
@@ -187,7 +187,7 @@
<p><code><var>Y2</var> = (<var>fractionReduce( Y2 - Y1, X2 - X1 )</var>)(<var>X2</var>) + b</code></p>
<p><code>b = <var>Y2</var> - <var>fractionReduce( X2 * ( Y2 - Y1 ), X2 - X1 )</var> = <var>fractionReduce( Y2 * (X2 - X1) - X2 * ( Y2 - Y1 ), X2 - X1 )</var></code></p>
</div>
- <p>In both cases, the equation of the line is <code>y = <var>( M == -1 ? "-" : ( M == 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + <var>fractionReduce( Y1 * (X2 - X1) - X1 * ( Y2 - Y1 ), X2 - X1 )</var></code><span data-if="abs( M ) == 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.</p>
+ <p>In both cases, the equation of the line is <code>y = <var>( M === -1 ? "-" : ( M === 1 ? "" : fractionReduce( Y2 - Y1, X2 - X1 )))</var> x + <var>fractionReduce( Y1 * (X2 - X1) - X1 * ( Y2 - Y1 ), X2 - X1 )</var></code><span data-if="abs( M ) === 1"> (the value of <code>m</code> is equal to <code><var>M</var></code>)</span>.</p>
</div>
</div>
</div>
View
4 exercises/equation_of_a_parabola.html
@@ -12,11 +12,11 @@
</head>
<body>
<div class="exercise">
- <div class="vars" data-ensure="( A != 0 ) && -10 < C && C < 10 && B != 0 ">
+ <div class="vars" data-ensure="( A !== 0 ) && -10 < C && C < 10 && B !== 0 ">
<var id="A"> randRange( -5, 5 ) </var>
<var id="H"> randRange( -5, 5 )</var>
<var id="K"> randRange( -5, 5 )</var>
- // y = A*(x-H)^2 + K = A(x^2-2Hx+H^2) + K = Ax^2 -2AHx + A*H^2+K
+ <!-- y = A*(x-H)^2 + K = A(x^2-2Hx+H^2) + K = Ax^2 -2AHx + A*H^2+K -->
<var id="B">-2 * A * H</var>
<var id="C">A * H * H + K</var>
</div>
View
4 exercises/equation_of_an_ellipse.html
@@ -14,7 +14,7 @@
<div class="exercise">
<div class="vars">
<var id="A">randRange( 2, 9 )</var>
- <var id="B" data-ensure=" A !== B" >randRange( 2, 9 )</var>
+ <var id="B" data-ensure="A !== B">randRange( 2, 9 )</var>
<var id="H">randRange( -9, 9 )</var>
<var id="K">randRange( -9, 9 )</var>
@@ -29,7 +29,7 @@
<div class="problems">
<div>
<div class="question">
- <p>The equation of an ellipse <code>E</code> is <code><var>rand(2) == 1 ? expr(["+", Y2T, X2T]) : expr(["+", X2T, Y2T])</var> = 1</code>.</p>
+ <p>The equation of an ellipse <code>E</code> is <code><var>rand(2) === 1 ? expr(["+", Y2T, X2T]) : expr(["+", X2T, Y2T])</var> = 1</code>.</p>
<p>What are its center <code>(h, k)</code> and its major and minor radius?</p>
View
22 exercises/estimation_with_decimals.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<html data-require="math math-format word-problems">
+<html data-require="math math-format word-problems stat">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Estimation with decimals</title>
@@ -20,17 +20,19 @@
<div>
<div class="vars">
<var id="VALUES">$.map( randRange( 1000, 16000, randRange( 3, 7 ) ), function( n ){ return ( n / 1000 ).toFixed( randRange( 1, 2 ) ); } )</var>
- <var id="ANSWER">eval( $.map( VALUES, round ).join("+") )</var>
+ <var id="ANSWER">sum( $.map( VALUES, round ) )</var>
<var id="TYPES">randFromArray( [ [ "jogging", "ran", "mile" ], [ "riding a bicycle ", "traveled", "mile" ], [ "collecting mushrooms", "collected", "pound" ], [ "painting a roof", "painted", "square foot" ], [ "harvesting grain", "harvested", "tonne" ] ] )</var>
<var id="ACC">0</var>
- <var id="SIZE">$.map( VALUES, function( i ){
- if ( round( i ) &lt; i ) {
- return "smaller than";
- }
- else{
- return "bigger or equal to";
- }
- } ) </var>
+ <var id="SIZE">
+ $.map( VALUES, function( i ){
+ if ( round( i ) &lt; i ) {
+ return "smaller than";
+ }
+ else{
+ return "bigger or equal to";
+ }
+ } )
+ </var>
<var id="SUM">
(function() {
var sum = 0;
View
2 exercises/exponents_3.html
@@ -17,7 +17,7 @@
<var id="BASE_N">VALS.base_1</var>
<var id="BASE_D">VALS.base_2</var>
- <var id="EXP_NEG">random() &lt; .75</var>
+ <var id="EXP_NEG">random() &lt; 0.75</var>
<var id="EXP_D">VALS.root</var>
<!-- base, flipped if the exponent is negative. -->
View
4 exercises/exponents_4.html
@@ -15,10 +15,10 @@
<div class="vars">
<var id="VALS">twoBasesOneRoot()</var>
- <var id="EXP_NEG">random() &lt; .75</var>
+ <var id="EXP_NEG">random() &lt; 0.75</var>
<var id="EXP_D_ORIG">VALS.root</var>
- <var id="BASE_NEG">isOdd( EXP_D ) && ( random() &lt; .75 )</var>
+ <var id="BASE_NEG">isOdd( EXP_D ) && ( random() &lt; 0.75 )</var>
<var id="BASE_N">VALS.base_1</var>
<var id="BASE_D">VALS.base_2</var>
View
4 exercises/fractions_on_the_number_line.html
@@ -61,7 +61,7 @@
<div class="exercise">
<div class="vars" >
<var id="FOLLOW">follow()</var>
- <div data-ensure="NOMINATOR/DENOMINATOR < 3 && NOMINATOR/DENOMINATOR != round( NOMINATOR/DENOMINATOR )">
+ <div data-ensure="NOMINATOR/DENOMINATOR < 3 && NOMINATOR/DENOMINATOR !== round( NOMINATOR/DENOMINATOR )">
<var id="NOMINATOR">randRange( 0 , 15 )</var>
<var id="DENOMINATOR">randRange( 1 , 15 )</var>
</div>
@@ -99,7 +99,7 @@
<div class="hints">
<p data-if="reduces( NOMINATOR, DENOMINATOR )"><code><var>NICE_NUMBER</var></code> is equal to <code><var>REDUCED_NUMBER</var></code> </p>
<p> Because <code><var>REDUCED_NUMBER</var></code> is <span data-if="NUMBER > 0">positive</span><span data-else>negative</span> we go <span data-if="NUMBER > 0">right</span><span data-else>left</span> from 0</p>
- <p><code><var>REDUCED_NUMBER</var></code> is <code><var>fraction( parseInt( SIGN + ( NOMINATOR - ( DENOMINATOR * floor( abs( NUMBER) ) ) ) ) , DENOMINATOR, true, true )</var></code> away from <var>floor( abs( NUMBER ) ) * NUMBER/abs( NUMBER )</var></p>
+ <p><code><var>REDUCED_NUMBER</var></code> is <code><var>fraction( parseInt( SIGN + ( NOMINATOR - ( DENOMINATOR * floor( abs( NUMBER) ) ) ), 10 ) , DENOMINATOR, true, true )</var></code> away from <var>floor( abs( NUMBER ) ) * NUMBER/abs( NUMBER )</var></p>
<p>Therefore <code><var>REDUCED_NUMBER</var></code> is between <var>floor( NUMBER )</var> and <var>ceil( NUMBER )</var></p>
<div>
If we zoom in to that portion of the number line:
View
2 exercises/functions_1.html
@@ -10,7 +10,7 @@
<div class="vars">
<var id="FUNCTION_PATH">
(function() {
- var functionPath = new Array();
+ var functionPath = [];
functionPath.push([ -11, randRange( -5, 5 ) ]);
for( var i = -10; i &lt; 11; i++ ) {
View
4 exercises/functions_2.html
@@ -22,7 +22,7 @@
(function() {
var currentY = randRange( -5, 5 );
- var functionPath = new Array();
+ var functionPath = [];
functionPath.push([-11, currentY]);
for( var i = -10; i &lt; 11; i++ ) {
@@ -51,7 +51,7 @@
(function() {
var gY = randRange( 3, -7 );
- var gPath = new Array();
+ var gPath = [];
gPath.push([-11, gY]);
for( var i = -10; i &lt; 11; i++ ) {
View
4 exercises/graphing_inequalities.html
@@ -21,8 +21,8 @@
<var id="STD_FORM">randFromArray([ true, false ])</var>
<var id="COMP">randFromArray([ "&lt;", "&gt;", "&le;", "&ge;" ])</var>
<var id="STD_FORM_COMP">B &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP ] : COMP</var>
- <var id="LESS_THAN">COMP == "&lt;" || COMP == "&le;"</var>
- <var id="INCLUSIVE">COMP == "&ge;" || COMP == "&le;"</var>
+ <var id="LESS_THAN">COMP === "&lt;" || COMP === "&le;"</var>
+ <var id="INCLUSIVE">COMP === "&ge;" || COMP === "&le;"</var>
</div>
View
20 exercises/graphing_inequalities_2.html
@@ -21,22 +21,22 @@
<var id="STD_FORM">randFromArray([ true, false ])</var>
<var id="COMP">randFromArray([ "&lt;", "&gt;", "&le;", "&ge;" ])</var>
<var id="STD_FORM_COMP">B &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP ] : COMP</var>
- <var id="LESS_THAN">COMP == "&lt;" || COMP == "&le;"</var>
- <var id="INCLUSIVE">COMP == "&ge;" || COMP == "&le;"</var>
+ <var id="LESS_THAN">COMP === "&lt;" || COMP === "&le;"</var>
+ <var id="INCLUSIVE">COMP === "&ge;" || COMP === "&le;"</var>
<div data-ensure="sqrt( pow( POINT_1[0] - POINT_2[0], 2 ) + pow( POINT_1[1] - POINT_2[1], 2 ) ) > 4">
<var id="POINT_1">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
<var id="POINT_2">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
<var id="POINT_1_SOLUTION">
- (((COMP == "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE * POINT_1[0] + YINT ))
- || ((COMP == "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE * POINT_1[0] + YINT ))
- || ((COMP == "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE * POINT_1[0] + YINT ))
- || ((COMP == "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE * POINT_1[0] + YINT )))
+ (((COMP === "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE * POINT_1[0] + YINT ))
+ || ((COMP === "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE * POINT_1[0] + YINT ))
+ || ((COMP === "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE * POINT_1[0] + YINT ))
+ || ((COMP === "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE * POINT_1[0] + YINT )))
</var>
<var id="POINT_2_SOLUTION">
- (((COMP == "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE * POINT_2[0] + YINT ))
- || ((COMP == "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE * POINT_2[0] + YINT ))
- || ((COMP == "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE * POINT_2[0] + YINT ))
- || ((COMP == "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE * POINT_2[0] + YINT )))
+ (((COMP === "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE * POINT_2[0] + YINT ))
+ || ((COMP === "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE * POINT_2[0] + YINT ))
+ || ((COMP === "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE * POINT_2[0] + YINT ))
+ || ((COMP === "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE * POINT_2[0] + YINT )))
</var>
</div>
</div>
View
8 exercises/graphing_systems_of_inequalities.html
@@ -38,10 +38,10 @@
<var id="COMP_2">randFromArray([ "&lt;", "&gt;", "&le;", "&ge;" ])</var>
<var id="STD_FORM_COMP_1">B_1 &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP_1 ] : COMP_1</var>
<var id="STD_FORM_COMP_2">B_2 &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP_2 ] : COMP_2</var>
- <var id="LESS_THAN_1">COMP_1 == "&lt;" || COMP_1 == "&le;"</var>
- <var id="LESS_THAN_2">COMP_2 == "&lt;" || COMP_2 == "&le;"</var>
- <var id="INCLUSIVE_1">COMP_1 == "&ge;" || COMP_1 == "&le;"</var>
- <var id="INCLUSIVE_2">COMP_2 == "&ge;" || COMP_2 == "&le;"</var>
+ <var id="LESS_THAN_1">COMP_1 === "&lt;" || COMP_1 === "&le;"</var>
+ <var id="LESS_THAN_2">COMP_2 === "&lt;" || COMP_2 === "&le;"</var>
+ <var id="INCLUSIVE_1">COMP_1 === "&ge;" || COMP_1 === "&le;"</var>
+ <var id="INCLUSIVE_2">COMP_2 === "&ge;" || COMP_2 === "&le;"</var>
</div>
<p class="question">
View
40 exercises/graphing_systems_of_inequalities_2.html
@@ -38,34 +38,34 @@
<var id="COMP_2">randFromArray([ "&lt;", "&gt;", "&le;", "&ge;" ])</var>
<var id="STD_FORM_COMP_1">B_1 &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP_1 ] : COMP_1</var>
<var id="STD_FORM_COMP_2">B_2 &lt; 0 ? { "&lt;": "&gt;", "&gt;": "&lt;", "&le;": "&ge;", "&ge;": "&le;" }[ COMP_2 ] : COMP_2</var>
- <var id="LESS_THAN_1">COMP_1 == "&lt;" || COMP_1 == "&le;"</var>
- <var id="LESS_THAN_2">COMP_2 == "&lt;" || COMP_2 == "&le;"</var>
- <var id="INCLUSIVE_1">COMP_1 == "&ge;" || COMP_1 == "&le;"</var>
- <var id="INCLUSIVE_2">COMP_2 == "&ge;" || COMP_2 == "&le;"</var>
+ <var id="LESS_THAN_1">COMP_1 === "&lt;" || COMP_1 === "&le;"</var>
+ <var id="LESS_THAN_2">COMP_2 === "&lt;" || COMP_2 === "&le;"</var>
+ <var id="INCLUSIVE_1">COMP_1 === "&ge;" || COMP_1 === "&le;"</var>
+ <var id="INCLUSIVE_2">COMP_2 === "&ge;" || COMP_2 === "&le;"</var>
<div data-ensure="sqrt( pow( POINT_1[0] - POINT_2[0], 2 ) + pow( POINT_1[1] - POINT_2[1], 2 ) ) > 4">
<var id="POINT_1">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
<var id="POINT_2">[ randRangeExclude( -9, 9, [ -3, -2, -1, 0 ] ), randRangeExclude( -9, 9, [ -1, -2 ] ) ]</var>
<var id="POINT_1_SOLUTION">
- (((COMP_1 == "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE_1 * POINT_1[0] + YINT_1 ))
- || ((COMP_1 == "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE_1 * POINT_1[0] + YINT_1 ))
- || ((COMP_1 == "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE_1 * POINT_1[0] + YINT_1 ))
- || ((COMP_1 == "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE_1 * POINT_1[0] + YINT_1 )))
+ (((COMP_1 === "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE_1 * POINT_1[0] + YINT_1 ))
+ || ((COMP_1 === "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE_1 * POINT_1[0] + YINT_1 ))
+ || ((COMP_1 === "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE_1 * POINT_1[0] + YINT_1 ))
+ || ((COMP_1 === "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE_1 * POINT_1[0] + YINT_1 )))
&amp;&amp;
- (((COMP_2 == "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE_2 * POINT_1[0] + YINT_2 ))
- || ((COMP_2 == "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE_2 * POINT_1[0] + YINT_2 ))
- || ((COMP_2 == "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE_2 * POINT_1[0] + YINT_2 ))
- || ((COMP_2 == "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE_2 * POINT_1[0] + YINT_2 )))
+ (((COMP_2 === "&lt;") &amp;&amp; ( POINT_1[1] &lt; SLOPE_2 * POINT_1[0] + YINT_2 ))
+ || ((COMP_2 === "&le;") &amp;&amp; ( POINT_1[1] &lt;= SLOPE_2 * POINT_1[0] + YINT_2 ))
+ || ((COMP_2 === "&gt;") &amp;&amp; ( POINT_1[1] &gt; SLOPE_2 * POINT_1[0] + YINT_2 ))
+ || ((COMP_2 === "&ge;") &amp;&amp; ( POINT_1[1] &gt;= SLOPE_2 * POINT_1[0] + YINT_2 )))
</var>
<var id="POINT_2_SOLUTION">
- (((COMP_1 == "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE_1 * POINT_2[0] + YINT_1 ))
- || ((COMP_1 == "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE_1 * POINT_2[0] + YINT_1 ))
- || ((COMP_1 == "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE_1 * POINT_2[0] + YINT_1 ))
- || ((COMP_1 == "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE_1 * POINT_2[0] + YINT_1 )))
+ (((COMP_1 === "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE_1 * POINT_2[0] + YINT_1 ))
+ || ((COMP_1 === "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE_1 * POINT_2[0] + YINT_1 ))
+ || ((COMP_1 === "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE_1 * POINT_2[0] + YINT_1 ))
+ || ((COMP_1 === "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE_1 * POINT_2[0] + YINT_1 )))
&amp;&amp;
- (((COMP_2 == "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE_2 * POINT_2[0] + YINT_2 ))
- || ((COMP_2 == "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE_2 * POINT_2[0] + YINT_2 ))
- || ((COMP_2 == "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE_2 * POINT_2[0] + YINT_2 ))
- || ((COMP_2 == "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE_2 * POINT_2[0] + YINT_2 )))
+ (((COMP_2 === "&lt;") &amp;&amp; ( POINT_2[1] &lt; SLOPE_2 * POINT_2[0] + YINT_2 ))
+ || ((COMP_2 === "&le;") &amp;&amp; ( POINT_2[1] &lt;= SLOPE_2 * POINT_2[0] + YINT_2 ))
+ || ((COMP_2 === "&gt;") &amp;&amp; ( POINT_2[1] &gt; SLOPE_2 * POINT_2[0] + YINT_2 ))
+ || ((COMP_2 === "&ge;") &amp;&amp; ( POINT_2[1] &gt;= SLOPE_2 * POINT_2[0] + YINT_2 )))
</var>
</div>
</div>
View
4 exercises/graphs_of_sine_and_cosine.html
@@ -24,7 +24,7 @@
<var id="FN">randFromArray( [ "cos", "sin" ] )</var>
<var id="FNS">{ "cos": "cosine", "sin": "sine"}[FN]</var>
<var id="VSCALE">randRange( 1, 5 ) / 2</var>
- <var id="HSCALE">random() &lt; .5 ? randRange( 1, 4 ) : 1 / randRange( 1, 4 )</var>
+ <var id="HSCALE">random() &lt; 0.5 ? randRange( 1, 4 ) : 1 / randRange( 1, 4 )</var>
<var id="PERIOD">2 * PI * HSCALE</var>
<var id="VRANGE">3.5</var>
@@ -37,7 +37,7 @@
<!-- this is the distance between grid lines -->
<var id="HSTEP">HSCALE * PI / 4</var>
- <var id="VSTEP">.5</var>
+ <var id="VSTEP">0.5</var>
<!-- this is how many grid lines are between each tick mark -->
<var id="HTICKSTEP">2</var>
View
6 exercises/inequalities_on_a_number_line.html
@@ -100,15 +100,15 @@
<div class="exercise">
<div class="vars">
- <div data-ensure="INT != 0 || FRAC != 0">
+ <div data-ensure="INT !== 0 || FRAC !== 0">
<var id="INT">rand( 6 ) > 0 ? randRange( 1, 9 ) : 0</var>
<var id="FRAC">rand( 3 ) > 0 ? (randRange( 1, 9 ) / 10) : 0</var>
</div>
<var id="SIGN">(INT === 0 ? "" : randFromArray(["", "-"]))</var>
<var id="REL">randFromArray([ "&lt;", "&gt;", "&le;", "&ge;" ])</var>
- <var id="INCLUSIVE">REL == "&le;" || REL == "&ge;"</var>
- <var id="LESS_THAN">REL == "&lt;" || REL == "&le;"</var>
+ <var id="INCLUSIVE">REL === "&le;" || REL === "&ge;"</var>
+ <var id="LESS_THAN">REL === "&lt;" || REL === "&le;"</var>
<var id="VARIABLE_NAME">randVar()</var>
<var id="LINE_ERROR_TYPES">shuffle([ "direction", "inclusion", "positivity", "quantity", "none" ])</var>
<var id="CORRECT_LINE_INDEX">jQuery.inArray( "none", LINE_ERROR_TYPES )</var>
View
100 exercises/kinematic_equations.html
@@ -9,7 +9,7 @@
<div class="exercise">
<div class="problems">
<div id="accelerated" data-weight="3">
- <div class="vars" data-ensure="(OMITTED != UNKNOWN) && !NO_SOLUTION">
+ <div class="vars" data-ensure="(OMITTED !== UNKNOWN) && !NO_SOLUTION">
<var id="OMITTED">randFromArray(['a', 'd', 't', 'v_i', 'v_f'])</var>
<var id="UNKNOWN">randFromArray(['a', 'd', 't', 'v_i', 'v_f'])</var>
<var id="ACCEL">randRangeNonZero(-200, 200) / 10</var>
@@ -20,42 +20,42 @@
<var id="NO_SOLUTION">
/* negative under radical */
- (OMITTED=='v_i' && UNKNOWN == 't' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP &lt; 0.1)) ||
- (OMITTED=='v_f' && UNKNOWN == 't' && (V_INIT * V_INIT + 2 * ACCEL * DISP &lt; 0.1)) ||
- (OMITTED=='t' && UNKNOWN == 'v_i' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP &lt; 0.1)) ||
- (OMITTED=='t' && UNKNOWN == 'v_f' && (V_INIT * V_INIT + 2 * ACCEL * DISP &lt; 0.1)) ||
+ (OMITTED === 'v_i' && UNKNOWN === 't' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP &lt; 0.1)) ||
+ (OMITTED === 'v_f' && UNKNOWN === 't' && (V_INIT * V_INIT + 2 * ACCEL * DISP &lt; 0.1)) ||
+ (OMITTED === 't' && UNKNOWN === 'v_i' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP &lt; 0.1)) ||
+ (OMITTED === 't' && UNKNOWN === 'v_f' && (V_INIT * V_INIT + 2 * ACCEL * DISP &lt; 0.1)) ||
/* division by 0 */
- (OMITTED=='d' && UNKNOWN == 'a' && TIME == 0) ||
- (OMITTED=='d' && UNKNOWN == 't' && ACCEL == 0) ||
- (OMITTED=='v_i' && UNKNOWN == 'v_f' && TIME == 0) ||
- (OMITTED=='v_i' && UNKNOWN == 'a' && TIME == 0) ||
- (OMITTED=='v_i' && UNKNOWN == 't' && ACCEL == 0) ||
- (OMITTED=='v_f' && UNKNOWN == 'v_i' && TIME == 0) ||
- (OMITTED=='v_f' && UNKNOWN == 'a' && TIME == 0) ||
- (OMITTED=='v_f' && UNKNOWN == 't' && ACCEL == 0) ||
- (OMITTED=='a' && UNKNOWN == 'v_i' && TIME == 0) ||
- (OMITTED=='a' && UNKNOWN == 'v_f' && TIME == 0) ||
- (OMITTED=='a' && UNKNOWN == 't' && (-0.1 &lt; V_INIT + V_FINAL) && (V_INIT + V_FINAL &lt; 0.1)) ||
- (OMITTED=='t' && UNKNOWN == 'd' && ACCEL == 0) ||
- (OMITTED=='t' && UNKNOWN == 'a' && DISP == 0)
+ (OMITTED === 'd' && UNKNOWN === 'a' && TIME === 0) ||
+ (OMITTED === 'd' && UNKNOWN === 't' && ACCEL === 0) ||
+ (OMITTED === 'v_i' && UNKNOWN === 'v_f' && TIME === 0) ||
+ (OMITTED === 'v_i' && UNKNOWN === 'a' && TIME === 0) ||
+ (OMITTED === 'v_i' && UNKNOWN === 't' && ACCEL === 0) ||
+ (OMITTED === 'v_f' && UNKNOWN === 'v_i' && TIME === 0) ||
+ (OMITTED === 'v_f' && UNKNOWN === 'a' && TIME === 0) ||
+ (OMITTED === 'v_f' && UNKNOWN === 't' && ACCEL === 0) ||
+ (OMITTED === 'a' && UNKNOWN === 'v_i' && TIME === 0) ||
+ (OMITTED === 'a' && UNKNOWN === 'v_f' && TIME === 0) ||
+ (OMITTED === 'a' && UNKNOWN === 't' && (-0.1 &lt; V_INIT + V_FINAL) && (V_INIT + V_FINAL &lt; 0.1)) ||
+ (OMITTED === 't' && UNKNOWN === 'd' && ACCEL === 0) ||
+ (OMITTED === 't' && UNKNOWN === 'a' && DISP === 0)
</var>
<var id="PLUS_OR_MINUS_SOLUTION">
- (OMITTED == 't' && UNKNOWN == 'v_i') ||
- (OMITTED == 't' && UNKNOWN == 'v_f')
+ (OMITTED === 't' && UNKNOWN === 'v_i') ||
+ (OMITTED === 't' && UNKNOWN === 'v_f')
</var>
<var id="QUADRATIC_TWO_SOLUTION">
- (OMITTED == 'v_i' && UNKNOWN == 't' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP > 0.1)) ||
- (OMITTED == 'v_f' && UNKNOWN == 't' && (V_INIT * V_INIT + 2 * ACCEL * DISP > 0.1))
+ (OMITTED === 'v_i' && UNKNOWN === 't' && (V_FINAL * V_FINAL - 2 * ACCEL * DISP > 0.1)) ||
+ (OMITTED === 'v_f' && UNKNOWN === 't' && (V_INIT * V_INIT + 2 * ACCEL * DISP > 0.1))
</var>
</div>
<div class="problem">
- <p data-if="'d' != OMITTED && 'd' != UNKNOWN"><code>d = <var>DISP</var> \text{m}</code></p>
- <p data-if="'v_i' != OMITTED && 'v_i' != UNKNOWN"><code>v_i = <var>V_INIT</var> \frac{\text{m}}{\text{s}}</code></p>
- <p data-if="'v_f' != OMITTED && 'v_f' != UNKNOWN"><code>v_f = <var>V_FINAL</var> \frac{\text{m}}{\text{s}}</code></p>
- <p data-if="'a' != OMITTED && 'a' != UNKNOWN"><code>a = <var>ACCEL</var> \frac{\text{m}}{\text{s}^2}</code></p>
- <p data-if="'t' != OMITTED && 't' != UNKNOWN"><code>t = <var>TIME</var> \text{s}</code></p>
+ <p data-if="'d' !== OMITTED && 'd' !== UNKNOWN"><code>d = <var>DISP</var> \text{m}</code></p>
+ <p data-if="'v_i' !== OMITTED && 'v_i' !== UNKNOWN"><code>v_i = <var>V_INIT</var> \frac{\text{m}}{\text{s}}</code></p>
+ <p data-if="'v_f' !== OMITTED && 'v_f' !== UNKNOWN"><code>v_f = <var>V_FINAL</var> \frac{\text{m}}{\text{s}}</code></p>
+ <p data-if="'a' !== OMITTED && 'a' !== UNKNOWN"><code>a = <var>ACCEL</var> \frac{\text{m}}{\text{s}^2}</code></p>
+ <p data-if="'t' !== OMITTED && 't' !== UNKNOWN"><code>t = <var>TIME</var> \text{s}</code></p>
<p><code><var>OMITTED</var> = {?}</code></p>
<p><code><var>UNKNOWN</var> = {?}</code></p>
</div>
@@ -68,40 +68,40 @@
<div class="solution" data-type="set" data-show-unused="true">
<div class="set-sol" data-type="multiple" data-if="!QUADRATIC_TWO_SOLUTION">
<span class="sol" data-type="decimal" data-inexact data-max-error="0.1">
- <var data-if="UNKNOWN=='d'">roundTo(1, DISP)</var>
- <var data-if="UNKNOWN=='v_i'">roundTo(1, V_INIT)</var>
- <var data-if="UNKNOWN=='v_f'">roundTo(1, V_FINAL)</var>
- <var data-if="UNKNOWN=='a'">roundTo(1, ACCEL)</var>
- <var data-if="UNKNOWN=='t'">roundTo(1, TIME)</var>
+ <var data-if="UNKNOWN === 'd'">roundTo(1, DISP)</var>
+ <var data-if="UNKNOWN === 'v_i'">roundTo(1, V_INIT)</var>
+ <var data-if="UNKNOWN === 'v_f'">roundTo(1, V_FINAL)</var>
+ <var data-if="UNKNOWN === 'a'">roundTo(1, ACCEL)</var>
+ <var data-if="UNKNOWN === 't'">roundTo(1, TIME)</var>
</span>
<span class="sol" data-type="list" data-choices="['', 'm', 'm/s', 'm/s&sup2;', 's']">
- <span data-if="UNKNOWN=='d'">m</span>
- <span data-if="UNKNOWN=='v_i'">m/s</span>
- <span data-if="UNKNOWN=='v_f'">m/s</span>
- <span data-if="UNKNOWN=='a'">m/s&sup2;</span>
- <span data-if="UNKNOWN=='t'">s</span>
+ <span data-if="UNKNOWN === 'd'">m</span>
+ <span data-if="UNKNOWN === 'v_i'">m/s</span>
+ <span data-if="UNKNOWN === 'v_f'">m/s</span>
+ <span data-if="UNKNOWN === 'a'">m/s&sup2;</span>
+ <span data-if="UNKNOWN === 't'">s</span>
</span>
</div>
<div class="set-sol" data-type="multiple" data-if="PLUS_OR_MINUS_SOLUTION">
<span class="sol" data-type="decimal" data-inexact data-max-error="0.1">
- <var data-if="UNKNOWN=='v_i'">roundTo(1, -V_INIT)</var>
- <var data-if="UNKNOWN=='v_f'">roundTo(1, -V_FINAL)</var>
+ <var data-if="UNKNOWN === 'v_i'">roundTo(1, -V_INIT)</var>
+ <var data-if="UNKNOWN === 'v_f'">roundTo(1, -V_FINAL)</var>
</span>
<span class="sol" data-type="list" data-choices="['', 'm', 'm/s', 'm/s&sup2;', 's']">m/s</span>
</div>
<div class="set-sol" data-type="multiple" data-if="QUADRATIC_TWO_SOLUTION">
<span class="sol" data-type="decimal" data-inexact data-max-error="0.1">
- <var data-if="UNKNOWN=='t' && OMITTED=='v_i'">roundTo(1, ((-V_FINAL) + sqrt(V_FINAL * V_FINAL - 2 * ACCEL * DISP))/(-ACCEL))</var>
- <var data-if="UNKNOWN=='t' && OMITTED=='v_f'">roundTo(1, ((-V_INIT) + sqrt(V_INIT * V_INIT + 2 * ACCEL * DISP))/ACCEL)</var>
+ <var data-if="UNKNOWN === 't' && OMITTED === 'v_i'">roundTo(1, ((-V_FINAL) + sqrt(V_FINAL * V_FINAL - 2 * ACCEL * DISP))/(-ACCEL))</var>
+ <var data-if="UNKNOWN === 't' && OMITTED === 'v_f'">roundTo(1, ((-V_INIT) + sqrt(V_INIT * V_INIT + 2 * ACCEL * DISP))/ACCEL)</var>
</span>
<span class="sol" data-type="list" data-choices="['', 'm', 'm/s', 'm/s&sup2;', 's']">s</span>
</div>
<div class="set-sol" data-type="multiple" data-if="QUADRATIC_TWO_SOLUTION">
<span class="sol" data-type="decimal" data-inexact data-max-error="0.1">
- <var data-if="UNKNOWN=='t' && OMITTED=='v_i'">roundTo(1, ((-V_FINAL) - sqrt(V_FINAL * V_FINAL - 2 * ACCEL * DISP))/(-ACCEL))</var>
- <var data-if="UNKNOWN=='t' && OMITTED=='v_f'">roundTo(1, ((-V_INIT) - sqrt(V_INIT * V_INIT + 2 * ACCEL * DISP))/ACCEL)</var>
+ <var data-if="UNKNOWN === 't' && OMITTED === 'v_i'">roundTo(1, ((-V_FINAL) - sqrt(V_FINAL * V_FINAL - 2 * ACCEL * DISP))/(-ACCEL))</var>
+ <var data-if="UNKNOWN === 't' && OMITTED === 'v_f'">roundTo(1, ((-V_INIT) - sqrt(V_INIT * V_INIT + 2 * ACCEL * DISP))/ACCEL)</var>
</span>
<span class="sol" data-type="list" data-choices="['', 'm', 'm/s', 'm/s&sup2;', 's']">s</span>
</div>
@@ -131,7 +131,7 @@
<div id="constant" data-type="accelerated" data-weight="1">
- <div class="vars" data-ensure="!(OMITTED == 'd' && UNKNOWN == 't') && !(OMITTED == 't' && UNKNOWN == 'd')">
+ <div class="vars" data-ensure="!(OMITTED === 'd' && UNKNOWN === 't') && !(OMITTED === 't' && UNKNOWN === 'd')">
<var id="ACCEL">0</var>
<var id="V_INIT">randRange(5, 25)</var>
<var id="V_FINAL">V_INIT</var>
@@ -292,29 +292,29 @@
<div data-if="UNKNOWN === 'v_i'" data-unwrap>
<p><code>\pm\sqrt{v_f^2 - 2ad} = v_i</code></p>
<p><code>\pm\sqrt{(<var>V_FINAL</var> \frac{\text{m}}{\text{s}})^2 - 2(<var>ACCEL</var> \frac{\text{m}}{\text{s}^2})(<var>DISP</var> \text{m})} = v_i</code></p>
- <p data-if="ACCEL != 0">
+ <p data-if="ACCEL !== 0">
Without making any assumptions about <code>t</code>, either direction for <code>v_i</code> could be correct.
Imagine throwing an object upward at velocity <code>v</code> compared to throwing it downward at the same
speed (<code>-v</code>). In both cases it will reach the same final velocity <code>v_f</code> at the same
point in space; it will just take different amounts of time to get there.
</p>
<p><code>v_i = <var>roundTo(1, V_INIT)</var> \frac{\text{m}}{\text{s}} \text{ or } <var>roundTo(1, -V_INIT)</var> \frac{\text{m}}{\text{s}}</code></p>
- <p data-if="ACCEL == 0">However, we also know <code>a = 0 \frac{\text{m}}{\text{s}^2}</code></p>
- <p data-if="ACCEL == 0">We know intuitively that with zero acceleration <code>v_i</code> must equal <code>v_f</code>, so <code>v_i = <var>roundTo(1, V_INIT)</var> \frac{\text{m}}{\text{s}}</code></p>
+ <p data-if="ACCEL === 0">However, we also know <code>a = 0 \frac{\text{m}}{\text{s}^2}</code></p>
+ <p data-if="ACCEL === 0">We know intuitively that with zero acceleration <code>v_i</code> must equal <code>v_f</code>, so <code>v_i = <var>roundTo(1, V_INIT)</var> \frac{\text{m}}{\text{s}}</code></p>
</div>
<div data-if="UNKNOWN === 'v_f'" data-unwrap>
<p><code>v_f = \pm\sqrt{v_i^2 + 2ad}</code></p>
<p><code>v_f = \pm\sqrt{(<var>V_INIT</var> \frac{\text{m}}{\text{s}})^2 + 2(<var>ACCEL</var> \frac{\text{m}}{\text{s}^2})(<var>DISP</var> \text{m})}</code></p>
- <p data-if="ACCEL != 0">
+ <p data-if="ACCEL !== 0">
Without making any assumptions about <code>t</code>, either direction for <code>v_f</code> could be correct.
Imagine an object traveling upward at velocity <code>v_i</code>. It will reach a particular velocity
<code>v</code> on the way up, then reach the same speed in the opposite direction (<code>-v</code>) on the
way down at the same point in space; it will just take a different amount of time to get there.
</p>
<p><code>v_f = <var>roundTo(1, V_FINAL)</var> \frac{\text{m}}{\text{s}} \text{ or } <var>roundTo(1, -V_FINAL)</var> \frac{\text{m}}{\text{s}}</code></p>
- <p data-if="ACCEL == 0">However, we also know <code>a = 0 \frac{\text{m}}{\text{s}^2}</code></p>
- <p data-if="ACCEL == 0">We know intuitively that with zero acceleration <code>v_f</code> must equal <code>v_i</code>, so <code>v_f = <var>roundTo(1, V_FINAL)</var> \frac{\text{m}}{\text{s}}</code></p>
+ <p data-if="ACCEL === 0">However, we also know <code>a = 0 \frac{\text{m}}{\text{s}^2}</code></p>
+ <p data-if="ACCEL === 0">We know intuitively that with zero acceleration <code>v_f</code> must equal <code>v_i</code>, so <code>v_f = <var>roundTo(1, V_FINAL)</var> \frac{\text{m}}{\text{s}}</code></p>
</div>
<div data-if="UNKNOWN === 'a'" data-unwrap>
View
6 exercises/lhopitals_rule.html
@@ -11,8 +11,8 @@
<div id="polynomial">
<div class="vars">
<var id="APPROACHES">randFromArray([ 0, Infinity ])</var>
- <var id="APPROACHES_TEXT">{ 0: "0", Infinity: "\\infty" }[ APPROACHES ]</var>
- <var id="INDETERMINATE_FORM">"\\frac" + { 0: "{0}{0}", Infinity: "{\\infty}{\\infty}" }[ APPROACHES ]</var>
+ <var id="APPROACHES_TEXT">{ 0: "0", "Infinity": "\\infty" }[ APPROACHES ]</var>
+ <var id="INDETERMINATE_FORM">"\\frac" + { 0: "{0}{0}", "Infinity": "{\\infty}{\\infty}" }[ APPROACHES ]</var>
<!-- Generate polynomials suitable for an L'Hopital's rule
problem (has no plain numbers, requires taking no more
@@ -81,7 +81,7 @@
<!-- Show them the steps of L'Hopital's rule by deriving until the indeterminate form can be resolved -->
<div data-each="STEPS as N, STEP" data-unwrap>
- <div data-if="N != STEPS.length-1">
+ <div data-if="N !== STEPS.length-1">
<p data-if="N === 0">
Repeat this process until evaluating the limit will not result in an indeterminate form:
</p>
View
2 exercises/multiplying_and_dividing_negative_numbers.html
@@ -7,7 +7,7 @@
</head>
<body>
<div class="exercise">
- <div class="vars" data-ensure="(A < 0 || B < 0) && B != 0">
+ <div class="vars" data-ensure="(A < 0 || B < 0) && B !== 0">
<var id="A">rand( 18 ) - 9</var>
<var id="B">rand( 18 ) - 9</var>
<var id="C">A * B</var>
View
32 exercises/multiplying_fractions_1.html
@@ -108,11 +108,11 @@
function createVertTable( numerator, denominator, id, className ) {
var table = jQuery( "<table/>" );
- if ( id != null ) {
+ if ( id !== null ) {
table.attr( "id", id );
}
- if( className != null ) {
+ if( className !== null ) {
table.addClass( className );
} else {
table.addClass( "hint_diagram_table_small" );
@@ -145,18 +145,18 @@
function createHorizTable( numerator, denominator, id, className, boxClass ) {
var table = jQuery( "<table/>" );
- if ( id != null ) {
+ if ( id !== null ) {
table.attr( "id", id );
}
- if ( className != null ) {
+ if ( className !== null ) {
table.addClass( className );
} else {
table.addClass( "hint_diagram_table_small" );
}
var useBoxClass = "hint_box2_cell";
- if ( boxClass != null ) {
+ if ( boxClass !== null ) {
useBoxClass = boxClass;
}
@@ -242,7 +242,7 @@
var tablesSrc = "";
for ( var i = 0; i < number; i++ ) {
var idToUse = null;
- if( idPrefix != null ) {
+ if( idPrefix !== null ) {
idToUse = idPrefix + "-" + i;
}
@@ -261,7 +261,7 @@
var tablesSrc = "";
for ( var i = 0; i < number; i++ ) {
var idToUse = null;
- if( idPrefix != null ) {
+ if( idPrefix !== null ) {
idToUse = idPrefix + "-" + i;
}
@@ -279,7 +279,7 @@
var tablesSrc = "";
for ( var i = 0; i < number; i++ ) {
var idToUse = null;
- if( idPrefix != null ) {
+ if( idPrefix !== null ) {
idToUse = idPrefix + "-" + i;
}
@@ -358,14 +358,11 @@
<body>
<div class="exercise">
<div class="vars">
- <!-- Detect MS Internet explorer. So we can avoid serving CSS
- animations, and serve alternate text hints. -->
- <var id="IE">(navigator.userAgent.indexOf('MSIE') !=-1)</var>
</div>
<div class="problems">
<div id="fraction-with-fraction">
- <div class="vars" data-ensure="D1 != D2">
+ <div class="vars" data-ensure="D1 !== D2">
<div data-ensure="D1 !== D2">
<var id="N1">randRange(1, 4)</var>
<var id="D1">N1 + randRange(1, 4)</var>
@@ -415,17 +412,6 @@
<var>TABLE_1_HINT</var>
<var>TABLE_2_HINT</var>
</div>
- <!-- FIXME: animation -->
- <!-- <script type="text/javascript" data-if="!IE"> -->
- <!-- jQuery(document).ready(function(){ -->
- <!-- // Scroll the hint into view. -->
- <!-- scrollIntoView( "#problem1-hint2-div"); -->
-
- <!-- // animate the right box overlaying over the left one. -->
- <!-- jQuery("#box2").css("left", 300); -->
- <!-- jQuery("#box2").animate({left: "0"}, 50000); -->
- <!-- }); -->
- <!-- </script> -->
</div>
<div>
View
2 exercises/multiplying_polynomials.html
@@ -27,7 +27,7 @@
coefs[ i ] = value;
}
- return new Polynomial( 0, MAX_DEGREE, coefs, X )
+ return new Polynomial( 0, MAX_DEGREE, coefs, X );
}, 2 )</var>
<var id="LIKE_TERMS">function() {
var likeTerms = [];
View
2 exercises/negative_number_word_problems.html
@@ -80,7 +80,7 @@
<div class="vars">
<var id="X">randRange( 5, 20 )</var><!-- Below sea level -->
<var id="Y">randRange( 5, 10 )</var><!-- Above sea level -->
- <var id="Z">Y - -X</var><!-- Distance travelled -->
+ <var id="Z">Y + X</var><!-- Distance travelled -->
</div>
<p class="problem spin">A spinner dolphin jumped from <var>X</var> meters below sea level and flipped through the air at <var>Y</var> meters above sea level. {The jump itself took about 1.<var>randRange( 1, 9 )</var> seconds.|}</p>
View
4 exercises/new_definitions_1.html
@@ -35,8 +35,8 @@
<var id="SUBS">expr(FUN(X, Y))</var>
<var id="VALU">expr(FUN(X, Y), true)</var>
- <var id="XONLY">!isNaN(expr(FUN(0, Number.NaN), true))</var>
- <var id="YONLY">!isNaN(expr(FUN(Number.NaN, 0), true))</var>
+ <var id="XONLY">!isNaN(expr(FUN(0, NaN), true))</var>
+ <var id="YONLY">!isNaN(expr(FUN(NaN, 0), true))</var>
</div>
<div class="problems">
View
6 exercises/new_definitions_2.html
@@ -29,11 +29,11 @@
function(C, D, x, y) { return ["-", ["*", D, ["^", x, 2]], ["^", y, 2]]; },
function(C, D, x, y) { return ["-", ["*", D, x], C]; },
function(C, D, x, y) { return ["+", ["*", C, y], D]; },
- function(C, D, x, y) { return ["+", ["*", x, y], ["*", D, x], ["-", y]]; },
+ function(C, D, x, y) { return ["+", ["*", x, y], ["*", D, x], ["-", y]]; }
], 2)</var>
- <var id="FUN1_XONLY">!isNaN(expr(FUN1(A, B, 0, Number.NaN), true))</var>
- <var id="FUN1_YONLY">!isNaN(expr(FUN1(A, B, Number.NaN, 0), true))</var>
+ <var id="FUN1_XONLY">!isNaN(expr(FUN1(A, B, 0, NaN), true))</var>
+ <var id="FUN1_YONLY">!isNaN(expr(FUN1(A, B, NaN, 0), true))</var>
<var id="X">randRange(-6, 6)</var>
<var id="Y">randRange(-6, 6)</var>
View
14 exercises/ordering_numbers.html
@@ -14,11 +14,11 @@
var used = {};
while ( array.length &lt; 5 ) {
- var type = types[ array.length ];
+ var type = types[ array.length ], n, ns;
switch ( type ) {
case 1: // decimal
- var n = randRange( 100, 999 ) / 1000;
- var ns = n.toFixed( 3 );
+ n = randRange( 100, 999 ) / 1000;
+ ns = n.toFixed( 3 );
if ( !used[ ns ] ) {
array.push([ type, n, ns, "= " + ns ]);
@@ -28,8 +28,8 @@
break;
case 2: // percentage
- var n = randRange( 100, 999 ) / 1000;
- var ns = n.toFixed( 3 );
+ n = randRange( 100, 999 ) / 1000;
+ ns = n.toFixed( 3 );
if ( !used[ ns ] ) {
array.push([ type, n, (100 * n).toFixed( 1 ) + "\\%", "= " + ns ]);
@@ -40,8 +40,8 @@
case 3: // fraction
var d = 4 * randRange( 5, 15 );
- var n = randRange( 1, d - 1 );
- var ns = ( n / d ).toFixed( 3 );