# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
106 lines (94 sloc) 4.94 KB
 Fractions on the number line 1
0 1 5 [ [1, 2], [1, 3], [2, 3], [1, 4], [2, 4], [3, 4], [1, 5], [2, 5], [3, 5], [4, 5], [1, 6], [2, 6], [3, 6], [4, 6], [5, 6] ] randFromArray(fractionArray) fractionToFind[1] fractionToFind[0] LOWER_BOUND * DENOMINATOR UPPER_BOUND * DENOMINATOR NUMERATOR / DENOMINATOR 4.5

Move the \color{orange}{\text{orange dot}} to \color{orange}{fraction(NUMERATOR, DENOMINATOR)} on the number line.

init({ range: [ [LOWER_BOUND - 0.1, UPPER_BOUND + 0.1], [-1, 1] ], scale: [80*SCALE, 40] }); // Draw Number Line style({arrows: ">"}); line( [ LOWER_BOUND, 0 ], [ UPPER_BOUND + 0.25 / SCALE, 0 ] ); style({arrows: ""}); // Draw Number Line Tick marks for ( var x = LOWER_BOUND; x <= UPPER_BOUND; x += 1 / DENOMINATOR ) { line( [ x, -0.2 ], [ x, 0.2 ] ); } // 0 and 1 tick marks style({ stroke: BLUE, strokeWidth: 3.5 }); line( [ LOWER_BOUND, -0.2], [LOWER_BOUND, 0.2]); label( [ LOWER_BOUND, -0.53 ], LOWER_BOUND, "center", { color: BLUE }); line( [ UPPER_BOUND, -0.2], [UPPER_BOUND, 0.2]); label( [ UPPER_BOUND, -0.53 ], UPPER_BOUND, "center", { color: BLUE }); addMouseLayer(); graph.movablePoint = addMovablePoint({ constraints: { constrainY: true }, snapX: 0.25 / DENOMINATOR }); graph.movablePoint.onMove = function( x, y ) { return [ min( max( LOWER_BOUND, x ), UPPER_BOUND ), y ]; };
graph.movablePoint.coord[0]
if ( guess === 0 ) { return ""; } return abs( SOLUTION - guess ) < 0.001;
graph.movablePoint.setCoord( [ guess, 0 ] );

Above we've drawn the number line from 0 to 1, divided into equal pieces.

The number line is divided into DENOMINATOR equal pieces, so each piece represents fraction(1, DENOMINATOR).

style({ stroke: "#6495ED", fill: "#6495ED", strokeWidth: 3.5, arrows: "->" }); line( [ 0, 0 ], [ SOLUTION, 0 ] ); graph.movablePoint.visibleShape.toFront();

The orange dot should be shifted NUMERATOR segmentplural(NUMERATOR) over, as fraction(NUMERATOR, DENOMINATOR) = NUMERATOR*fraction(1, DENOMINATOR)

label( [ SOLUTION, -0.83 ], fraction(NUMERATOR, DENOMINATOR), "center", { color: "#FFA500" }); graph.movablePoint.moveTo( SOLUTION, 0 );

The orange number shows where \color{orange}{fraction(NUMERATOR, DENOMINATOR)} is on the number line.

Something went wrong with that request. Please try again.