# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
67 lines (64 sloc) 3.35 KB
 Measuring segments
sortNumbers( randRangeUnique( -5, 5, 4 ) ) [ BLUE, GREEN, RED, PURPLE ] randRangeUnique( 0, 3, 2 ) [ "A", "B", "C", "D" ][ IDX_1 ] [ "A", "B", "C", "D" ][ IDX_2 ] POINT_1 + POINT_2 abs( POINTS[ IDX_1 ] - POINTS[ IDX_2 ] )

What is the length of \overline{SEGMENT}?

init({ range: [ [ -6, 6 ], [ -1, 1 ] ] }); style({ stroke: "#999" }); line( [ -5, 0 ], [ 5, 0 ] ); for ( var x = -5; x <= 5; x++ ) { line( [ x, -0.2 ], [ x, 0.2 ] ); label( [ x, -0.53 ], String( x ).replace( /-(\d)/g, "\\llap{-}\$1" ), "center", { color: "#999" } ); } style({ strokeWidth: 3.5 }); line( [ 0, -0.2], [0, 0.2]); style({ stroke: COLORS[ 0 ], fill: COLORS[ 0 ] }); circle( [ POINTS[ 0 ], 0 ], 0.10 ); style({ stroke: COLORS[ 1 ], fill: COLORS[ 1 ] }); circle( [ POINTS[ 1 ], 0 ], 0.10 ); style({ stroke: COLORS[ 2 ], fill: COLORS[ 2 ] }); circle( [ POINTS[ 2 ], 0 ], 0.10 ); style({ stroke: COLORS[ 3 ], fill: COLORS[ 3 ] }); circle( [ POINTS[ 3 ], 0 ], 0.10 ); label( [ POINTS[ 0 ], 0 ], "A", "above", { color: COLORS[ 0 ] } ); label( [ POINTS[ 1 ], 0 ], "B", "above", { color: COLORS[ 1 ] } ); label( [ POINTS[ 2 ], 0 ], "C", "above", { color: COLORS[ 2 ] } ); label( [ POINTS[ 3 ], 0 ], "D", "above", { color: COLORS[ 3 ] } );
SOLUTION

SEGMENT means the distance from \color{COLORS[ IDX_1 ]}{POINT_1} to \color{COLORS[ IDX_2 ]}{POINT_2}.

SEGMENT = |\color{COLORS[ IDX_1 ]}{POINTS[ IDX_1 ]} - \color{COLORS[ IDX_2 ]}{POINTS[ IDX_2 ]}|

SEGMENT = |POINTS[ IDX_1 ] - POINTS[ IDX_2 ]|

SEGMENT = SOLUTION