# MatthewDaly/khan-exercises forked from Khan/khan-exercises

Merge branch 'master' of http://github.com/Khan/khan-exercises

2 parents a52dd64 + f4d02a2 commit fb37257532dac34ac4359ceab82415a244b23adf nsfmc committed
49 exercises/graphing_inequalities.html
 @@ -36,6 +36,26 @@ y COMP PRETTY_SLOPE x + YINT

+
+ + + +
graphInit({ range: 11, @@ -49,7 +69,7 @@ labelOpacity: 0.5 }); - label( [ 0, 11 ], "y", "above" ); + label( [ 0, -11 ], "y", "below" ); label( [ 11, 0 ], "x", "right" ); addMouseLayer(); @@ -128,29 +148,9 @@ graph.pointB.toFront();
-
- - - - -
+
Drag the two points to move the line into the correct position.
@@ -169,7 +169,7 @@
graph.pointA.setCoord( guess[0] ); graph.pointB.setCoord( guess[1] ); - graph.shadetop = graph.pointA.coord[0] < graph.pointB.coord[0] ? guess[2] : !guess[2]; + graph.shadetop = graph.pointA.coord[0] > graph.pointB.coord[0] ? guess[2] : !guess[2]; if ( guess[3] ) { graph.dasharray = ""; jQuery( "input[name=dashradio][value=solid]" ).attr( "checked", true ); @@ -179,6 +179,9 @@ } graph.update();
+
graph the inequality
+
make sure the correct side is shaded
+
make sure the line is correctly shown as solid or dashed
49 exercises/graphing_inequalities_2.html
 @@ -55,6 +55,26 @@ y COMP PRETTY_SLOPE x + YINT

+
+ + + +
graphInit({ range: 11, @@ -68,7 +88,7 @@ labelOpacity: 0.5 }); - label( [ 0, 11 ], "y", "above" ); + label( [ 0, -11 ], "y", "below" ); label( [ 11, 0 ], "x", "right" ); addMouseLayer(); @@ -147,30 +167,10 @@ graph.pointB.toFront();
-
- - - -
-
+
Drag the two points to move the line into the correct position.
@@ -189,7 +189,7 @@
graph.pointA.setCoord( guess[0] ); graph.pointB.setCoord( guess[1] ); - graph.shadetop = graph.pointA.coord[0] < graph.pointB.coord[0] ? guess[2] : !guess[2]; + graph.shadetop = graph.pointA.coord[0] > graph.pointB.coord[0] ? guess[2] : !guess[2]; if ( guess[3] ) { graph.dasharray = ""; jQuery( "input[name=dashradio][value=solid]" ).attr( "checked", true ); @@ -206,6 +206,9 @@

+
graph the inequality
+
make sure the correct side is shaded
+
make sure the line is correctly shown as solid or dashed
2 exercises/graphing_linear_equations.html
 @@ -86,7 +86,7 @@ -
+
Drag the two points to move the line into the correct position.
2 exercises/graphing_systems_of_equations.html
 @@ -143,7 +143,7 @@

x = X

y = Y

-
+
451 exercises/graphing_systems_of_inequalities.html
 @@ -0,0 +1,451 @@ + + + + + Graphing systems of inequalities + + + +
+
+
+
+
+ randRangeNonZero( -5, 5 ) + randRange( -5, 5 ) +
+ randRangeNonZero( -5, 5 ) + randRangeNonZero( -5, 5 ) +
+ (Y - YINT_1) / X + (Y - YINT_2) / X + toFraction( SLOPE_1, 0.001 ) + toFraction( SLOPE_2, 0.001 ) +
+ SLOPE_1 === 1 ? "" : ( SLOPE_1 === -1 ? "-" : fraction( SLOPE_FRAC_1[0], SLOPE_FRAC_1[1], true, true ) ) + SLOPE_2 === 1 ? "" : ( SLOPE_2 === -1 ? "-" : fraction( SLOPE_FRAC_2[0], SLOPE_FRAC_2[1], true, true ) ) + randRangeNonZero( -3, 3 ) + randRangeNonZero( -3, 3 ) + SLOPE_FRAC_1[0] * -MULT_1 + SLOPE_FRAC_2[0] * -MULT_2 + SLOPE_FRAC_1[1] * MULT_1 + SLOPE_FRAC_2[1] * MULT_2 + SLOPE_FRAC_1[1] * YINT_1 * MULT_1 + SLOPE_FRAC_2[1] * YINT_2 * MULT_2 + randFromArray([ true, false ]) + randFromArray([ true, false ]) + randFromArray([ "<", ">", "≤", "≥" ]) + randFromArray([ "<", ">", "≤", "≥" ]) + B_1 < 0 ? { "<": ">", ">": "<", "≤": "≥", "≥": "≤" }[ COMP_1 ] : COMP_1 + B_2 < 0 ? { "<": ">", ">": "<", "≤": "≥", "≥": "≤" }[ COMP_2 ] : COMP_2 + COMP_1 == "<" || COMP_1 == "≤" + COMP_2 == "<" || COMP_2 == "≤" + COMP_1 == "≥" || COMP_1 == "≤" + COMP_2 == "≥" || COMP_2 == "≤" +
+ +

+ Graph the following system of inequalities: +

+ +
+

+ expr([ "+", [ "*", A_1, "x" ], [ "*", B_1, "y" ] ]) STD_FORM_COMP_1 C_1 +

+

+ y COMP_1 PRETTY_SLOPE_1 x + YINT_1 +

+

+ expr([ "+", [ "*", A_2, "x" ], [ "*", B_2, "y" ] ]) STD_FORM_COMP_2 C_2 +

+

+ y COMP_2 PRETTY_SLOPE_2 x + YINT_2 +

+ +
+ Inequality 1: + + + +
+ Inequality 2: + + + + +
+ +
+
+
+
+ Drag the points to move both lines into the correct positions. +
+
[ graph.pointA.coord, graph.pointB.coord, + graph.pointA.coord[0] > graph.pointB.coord[0] ? graph.shadetop1 : !graph.shadetop1, + graph.dasharray1 === "- " ? false : true, + graph.pointC.coord, graph.pointD.coord, + graph.pointC.coord[0] > graph.pointD.coord[0] ? graph.shadetop2 : !graph.shadetop2, + graph.dasharray2 === "- " ? false : true ] +
+
+ var slope1 = ( guess[1][1] - guess[0][1] ) / ( guess[1][0] - guess[0][0] ); + var yint1 = slope1 * ( 0 - guess[0][0] ) + guess[0][1]; + var slope2 = ( guess[5][1] - guess[4][1] ) / ( guess[5][0] - guess[4][0] ); + var yint2 = slope2 * ( 0 - guess[4][0] ) + guess[4][1]; + return abs( SLOPE_1 - slope1 ) < 0.001 + && abs( YINT_1 - yint1 ) < 0.001 + && guess[2] === LESS_THAN_1 + && guess[3] === INCLUSIVE_1 + && abs( SLOPE_2 - slope2 ) < 0.001 + && abs( YINT_2 - yint2 ) < 0.001 + && guess[6] === LESS_THAN_2 + && guess[7] === INCLUSIVE_2; +
+
+ graph.pointA.setCoord( guess[0] ); + graph.pointB.setCoord( guess[1] ); + graph.pointC.setCoord( guess[4] ); + graph.pointD.setCoord( guess[5] ); + graph.shadetop1 = graph.pointA.coord[0] > graph.pointB.coord[0] ? guess[2] : !guess[2]; + graph.shadetop2 = graph.pointC.coord[0] > graph.pointD.coord[0] ? guess[6] : !guess[6]; + if ( guess[3] ) { + graph.dasharray1 = ""; + jQuery( "input[name=dashradio1][value=solid]" ).attr( "checked", true ); + } else { + graph.dasharray1 = "- "; + jQuery( "input[name=dashradio1][value=dashed]" ).attr( "checked", true ); + } + if ( guess[7] ) { + graph.dasharray2 = ""; + jQuery( "input[name=dashradio2][value=solid]" ).attr( "checked", true ); + } else { + graph.dasharray2 = "- "; + jQuery( "input[name=dashradio2][value=dashed]" ).attr( "checked", true ); + } + graph.update(); +
+
+ +
graph the inequalities
+
make sure the correct sides are shaded
+
make sure each line is correctly shown as solid or dashed
+
+
+
+
+
+

+ Convert the first inequality, expr([ "+", [ "*", A_1, "x" ], [ "*", B_1, "y" ] ]) STD_FORM_COMP_1 C_1, + to slope-intercept form by solving for y. +

+
+

+ A_1 < 0 ? "Add" : "Subtract" abs( A_1 )x A_1 < 0 ? "to" : "from" both sides: +

+ \qquad expr( [ "*", B_1, "y" ] ) STD_FORM_COMP_1 expr([ "+", [ "*", -A_1, "x" ], C_1 ]) +

+
+
+

+ Divide both sides by B_1. Since you're multiplying or dividing by a negative number, don't forget to flip the inequality sign: +

+ \qquad y COMP_1 expr([ "+", "\\dfrac{" + expr([ "*", -A_1, "x" ]) + "}{" + B_1 + "}", "\\dfrac{" + C_1 + "}{" + B_1 + "}" ]) +

+
+
+
+

+ \qquad y COMP_1 \color{purple}{PRETTY_SLOPE_1} x \color{gray}{+ YINT_1} +

+ The y-intercept is YINT_1 and the slope is decimalFraction( SLOPE_1, true, true ). + Since the y-intercept is YINT_1, the line must pass through the point (0, YINT_1). +

+
+
+

+ The slope is decimalFraction( SLOPE_1, true, true ). Remember that + the slope tells you rise over run. So in this case for every + abs( SLOPE_FRAC_1[0] ) + "position" + ( abs( SLOPE_FRAC_1[0] ) !== 1 ? "s" : "" ) + you move + down (because it's negative) + up + you must also move + SLOPE_FRAC_1[1] + "position" + ( abs( SLOPE_FRAC_1[1] ) !== 1 ? "s" : "" ) + to the right. So the line must also pass through (SLOPE_FRAC_1[1], YINT_1 + SLOPE_FRAC_1[0]) +

+
+

+ Since our inequality has a LESS_THAN_1 ? "less-than" : "greater-than"INCLUSIVE_1 ? " or equal to" : "" sign, that means that any point + LESS_THAN_1 ? "below" : "above" the line is a solution to the inequality, so the area LESS_THAN_1 ? "below" : "above" + the line should be shaded. +

+
+

+ Note that since the sign is LESS_THAN_1 ? "less-than" : "greater-than" or equal to, any point on the line is also a solution, so the + line should be solid. +

+

+ Note that since the sign is LESS_THAN_1 ? "less-than" : "greater-than" (and not equal to), any point on the line is not part of the solution, + so the line should be dashed to indicate this. +

+
+ + +
+

+ Convert the second inequality, expr([ "+", [ "*", A_2, "x" ], [ "*", B_2, "y" ] ]) STD_FORM_COMP_2 C_2, + to slope-intercept form by solving for y. +

+
+

+ A_2 < 0 ? "Add" : "Subtract" abs( A_2 )x A_2 < 0 ? "to" : "from" both sides: +

+ \qquad expr( [ "*", B_2, "y" ] ) STD_FORM_COMP_2 expr([ "+", [ "*", -A_2, "x" ], C_2 ]) +

+
+
+

+ Divide both sides by B_2. Since you're multiplying or dividing by a negative number, don't forget to flip the inequality sign: +

+ \qquad y COMP_2 expr([ "+", "\\dfrac{" + expr([ "*", -A_2, "x" ]) + "}{" + B_2 + "}", "\\dfrac{" + C_2 + "}{" + B_2 + "}" ]) +

+
+
+
+

+ \qquad y COMP_2 \color{purple}{PRETTY_SLOPE_2} x \color{gray}{+ YINT_2} +

+ The y-intercept is YINT_2 and the slope is decimalFraction( SLOPE_2, true, true ). + Since the y-intercept is YINT_2, the line must pass through the point (0, YINT_2). +

+
+
+

+ The slope is decimalFraction( SLOPE_2, true, true ). Remember that + the slope tells you rise over run. So in this case for every + abs( SLOPE_FRAC_2[0] ) + "position" + ( abs( SLOPE_FRAC_2[0] ) !== 1 ? "s" : "" ) + you move + down (because it's negative) + up + you must also move + SLOPE_FRAC_2[1] + "position" + ( abs( SLOPE_FRAC_2[1] ) !== 1 ? "s" : "" ) + to the right. So the line must also pass through (SLOPE_FRAC_2[1], YINT_2 + SLOPE_FRAC_2[0]) +

+
+

+ Since our inequality has a LESS_THAN_2 ? "less-than" : "greater-than"INCLUSIVE_2 ? " or equal to" : "" sign, that means that any point + LESS_THAN_2 ? "below" : "above" the line is a solution to the inequality, so the area LESS_THAN_2 ? "below" : "above" + the line should be shaded. +

+
+

+ Note that since the sign is LESS_THAN_2 ? "less-than" : "greater-than" or equal to, any point on the line is also a solution, so the + line should be solid. +

+

+ Note that since the sign is LESS_THAN_2 ? "less-than" : "greater-than" (and not equal to), any point on the line is not part of the solution, + so the line should be dashed to indicate this. +

+
+
+
+ +
3 exercises/line_relationships.html
 @@ -22,7 +22,7 @@ decimalFraction( M, "true", "true" ) decimalFraction( -1 / M, "true", "true" ) randRange( -5, 5 ) - randRange( 2, 8 ) * randRangeNonZero( -1, 1 ) + randRange( 2, 8 ) * randRangeNonZero( -1, 1 ) randRange( 2, 8 ) * randRangeNonZero( -1, 1 ) "perpendicular" @@ -86,6 +86,7 @@
"parallel" + randRange( 2, 8 ) * randRangeNonZero( -1, 1 ) randRange( 2, 8 ) * randRangeNonZero( -1, 1 )
6 exercises/multiplying_polynomials.html
 @@ -44,8 +44,8 @@ } if ( likeTerms[ i + j ] === undefined ) { - likeTerms[ i + j ] = false; - } else if ( !likeTerms[ i + j ] ) { + likeTerms[ i + j ] = ""; + } else if ( likeTerms[ i + j ] === "" ) { likeTerms[ i + j ] = COLORS[ counter++ ]; areLikeTerms = true; } @@ -75,7 +75,7 @@

Simplify the expression.

-

(POL)

+

(POL)

SOLUTION

• SOLUTION.multiply( -1 )
2 exercises/trig_identities_1.html
 @@ -40,7 +40,7 @@
-

Given that x is in first quadrant and \FUN_NAME x is FUN_VALUE what is \END_NAME x ?

+

Given that x is in the first quadrant and \FUN_NAME x is FUN_VALUE, what is \END_NAME x ?

SOLUTION

2 exercises/unit_circle.html
 @@ -1,5 +1,5 @@ - + Unit circle
BIN images/next-step.png
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN images/previous-step.png
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11,358 jquery-ui.js
11,358 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
96 khan-exercise.js
 @@ -1,123 +0,0 @@ -/* - * jQuery Color Animations - * Copyright 2007 John Resig - * Released under the MIT and GPL licenses. - */ - -(function(jQuery){ - - // We override the animation for all of these color styles - jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){ - jQuery.fx.step[attr] = function(fx){ - if ( fx.state == 0 ) { - fx.start = getColor( fx.elem, attr ); - fx.end = getRGB( fx.end ); - } - - fx.elem.style[attr] = "rgb(" + [ - Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0), - Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0), - Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0) - ].join(",") + ")"; - } - }); - - // Color Conversion functions from highlightFade - // By Blair Mitchelmore - // http://jquery.offput.ca/highlightFade/ - - // Parse strings looking for color tuples [255,255,255] - function getRGB(color) { - var result; - - // Check if we're already dealing with an array of colors - if ( color && color.constructor == Array && color.length == 3 ) - return color; - - // Look for rgb(num,num,num) - if (result = /rgb$$\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*$$/.exec(color)) - return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])]; - - // Look for rgb(num%,num%,num%) - if (result = /rgb$$\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*$$/.exec(color)) - return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55]; - - // Look for #a0b1c2 - if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)) - return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)]; - - // Look for #fff - if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)) - return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)]; - - // Otherwise, we're most likely dealing with a named color - return colors[jQuery.trim(color).toLowerCase()]; - } - - function getColor(elem, attr) { - var color; - - do { - color = jQuery.curCSS(elem, attr); - - // Keep going until we find an element that has color, or we hit the body - if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") ) - break; - - attr = "backgroundColor"; - } while ( elem = elem.parentNode ); - - return getRGB(color); - }; - - // Some named colors to work with - // From Interface by Stefan Petre - // http://interface.eyecon.ro/ - - var colors = { - aqua:[0,255,255], - azure:[240,255,255], - beige:[245,245,220], - black:[0,0,0], - blue:[0,0,255], - brown:[165,42,42], - cyan:[0,255,255], - darkblue:[0,0,139], - darkcyan:[0,139,139], - darkgrey:[169,169,169], - darkgreen:[0,100,0], - darkkhaki:[189,183,107], - darkmagenta:[139,0,139], - darkolivegreen:[85,107,47], - darkorange:[255,140,0], - darkorchid:[153,50,204], - darkred:[139,0,0], - darksalmon:[233,150,122], - darkviolet:[148,0,211], - fuchsia:[255,0,255], - gold:[255,215,0], - green:[0,128,0], - indigo:[75,0,130], - khaki:[240,230,140], - lightblue:[173,216,230], - lightcyan:[224,255,255], - lightgreen:[144,238,144], - lightgrey:[211,211,211], - lightpink:[255,182,193], - lightyellow:[255,255,224], - lime:[0,255,0], - magenta:[255,0,255], - maroon:[128,0,0], - navy:[0,0,128], - olive:[128,128,0], - orange:[255,165,0], - pink:[255,192,203], - purple:[128,0,128], - violet:[128,0,128], - red:[255,0,0], - silver:[192,192,192], - white:[255,255,255], - yellow:[255,255,0] - }; - -})(jQuery);