# Khan/khan-exercises

Switch branches/tags
Nothing to show
Fetching contributors…
Cannot retrieve contributors at this time
185 lines (171 sloc) 9.62 KB
randRangeNonZero( -10, 10 ) randRangeNonZero( -10, 10 ) i18n._("Q") i18n._("QI") i18n._("QII") i18n._("QIII") i18n._("QIV") X > 0 ? (Y > 0 ? QI : QIV) : (Y > 0 ? QII : QIII)

Plot (X, Y) and select the quadrant in which the point lies.

graphInit({ range: 11, scale: 20, axisArrows: "<->", tickStep: 1, labelStep: 1, gridOpacity: 0.05, axisOpacity: 0.2, tickOpacity: 0.4, labelOpacity: 0.5 }); label( [ 0, 11 ], "y", "above" ); label( [ 11, 0 ], "x", "right" ); addMouseLayer(); graph.movablePoint = addMovablePoint({ coord: [ 0, 0 ], snapY: 1, snapX: 1 }); graph.movablePoint.onMove = function( x, y ) { return [ max( -10, min( x, 10 ) ), max( -10, min( y, 10 ) ) ]; }; graph.showCorrect = function() { graph.movablePoint.moveTo(X, Y); };

Graph the point then select the quadrant that contains it.
QUADRANT graph.movablePoint.coord if (guess[0] === 0 && guess[1] === 0) { // TODO: Replace this string with "" when clues are added return i18n._("Drag the orange point on the graph to the right position."); } return guess[0] === X && guess[1] === Y; graph.movablePoint.setCoord(guess);

Coordinates are listed as (\blue{x},\green{y}).

So, for ( \blue{X}, \green{Y} ) our x-coordinate is \blue{X} and our y-coordinate is \green{Y}.

The x-coordinate tells how far we move to the right from the origin and the y-coordinate tells us how far we move up from the origin.

Since our x-coordinate is positive, we move \blue{abs( X )} to the right.

Since our x-coordinate is negative, we move \blue{abs( X )} to the left.

style({ stroke: BLUE, strokeWidth: 3, arrows: "->" }, function() { line( [ 0, 0 ], [ X, 0 ]); }); graph.movablePoint.toFront();

Since our y-coordinate is positive, we move \green{abs( Y )} up.

Since our y-coordinate is negative, we move \green{abs( Y )} down.

style({ stroke: GREEN, strokeWidth: 3, arrows: "->" }, function() { line( [ X, 0 ], [ X, Y ] ); }); graph.movablePoint.toFront();

Move the point to ( \blue{X}, \green{Y} ) at the marked point above.

style({ stroke: PINK, strokeWidth: 3 }, function() { line( [ X - 0.3, Y - 0.3 ], [ X + 0.3, Y + 0.3 ] ); line( [ X + 0.3, Y - 0.3 ], [ X - 0.3, Y + 0.3 ] ); }); graph.movablePoint.toFront();

Now that we have our point plotted, we can figure out the quadrant.

By convention, quadrants are named with a capital \text{Q} and a roman numeral, starting in the upper right quadrant as \text{QI} and rotating counter-clockwise.

label( [ 5, 5] , " \\text{" + QI + "}", "center", { color: "purple" } ); label( [ -5, 5] , " \\text{" + QII + "}", "center", { color: "purple" } ); label( [ -5, -5] , " \\text{" + QIII + "}", "center", { color: "purple" } ); label( [ 5, -5] , " \\text{" + QIV + "}", "center", { color: "purple" } );

Since our point is in the upper right portion of the graph, the quadrant is \purple{\text{QUADRANT}}.

Since our point is in the lower right portion of the graph, the quadrant is \purple{\text{QUADRANT}}.

Since our point is in the upper left portion of the graph, the quadrant is \purple{\text{QUADRANT}}.

Since our point is in the lower left portion of the graph, the quadrant is \purple{\text{QUADRANT}}.