randRange( -8, 8 ) randRange( -8, 8 ) randRange( -8, 8 ) randRange( -8, 8 ) Y1 - Y2 X1 - X2 RISE / RUN Y1 - X1 * M abs( RUN ) / getGCD( abs( RISE), abs( RUN ) )
Adjust the slope and y-intercept until it connects the two points. How do the slope and y-intercept values affect the line?
init({ range: [[-10, 10], [-10, 12]], scale: [30, 30] }); grid( [-10, 10], [-10, 10], { stroke: "#ccc" }); style({ stroke: "#888", strokeWidth: 2, arrows: "->" }); path( [ [-10, 0], [10, 0] ] ); path( [ [0, -10], [0, 10] ] ); style({ stroke: "#6495ED", fill: "#6495ED", arrows: null }); circle( [X1, Y1], 0.15 ); circle( [X2, Y2], 0.15 ); var graph = KhanUtil.currentGraph; style({ clipRect:[ [-10, -10], [20, 20] ] }, function() { var ell = function( x ) { return x; }; graph.plot = line( [ -10, ell( -10 ) ], [ 10, ell( 10 ) ] ); }); graph.labelHolder = label( [1, 11], "y = " + KhanUtil.fractionReduce( 1, 1 ) + "x +" + KhanUtil.fractionReduce( 1, 1 )); graph.MN = 1; graph.MD = 1; graph.BN = 1; graph.BD = 1; graph.INCR = INCR; updateEquation();
y = x + 1