randRangeExclude( -8, 10, [0, 1, 2] ) randRangeExclude( -10, 8, [-1, -2, -3, -4] ) randRangeExclude( -8, 8, [-1, 0] ) randRangeExclude( -8, 8, [-1, 0] ) abs( X2 - X1 ) abs( Y2 - Y1 ) X_DIST * X_DIST + Y_DIST * Y_DIST

Encuentra la distancia entre los puntos (X1, Y1) y (X2, Y2).

graphInit({range:11,scale:20,tickStep:1,labelStep:1,unityLabels:!1,labelFormat:function(e){return"\\small{"+e+"}"},axisArrows:"<->"}),label([X1,Y1],"("+X1+", "+Y1+")","left",{color:BLUE}),label([X2,Y2],"("+X2+", "+Y2+")","right",{color:GREEN}),circle([X1,Y1],.15,{stroke:"none",fill:BLUE}),circle([X2,Y2],.15,{stroke:"none",fill:GREEN})
HYP2

El cambio en x: X2 - negParens(X1) X1 - negParens(X2) = X_DIST

style({color:RED,stroke:RED},function(){line([X1,Y1],[X2,Y1]),label([(X1+X2)/2,Y1],X_DIST,"above")})

El cambio en y: Y2 - negParens(Y1) Y1 - negParens(Y2) = Y_DIST

style({color:PURPLE,stroke:PURPLE},function(){line([X2,Y1],[X2,Y2]),label([X2,(Y1+Y2)/2],Y_DIST,"left")})

La distancia es la longitud de la hipotenusa de este triángulo rectángulo.

style({stroke:PINK},function(){line([X1,Y1],[X2,Y2])})

Por el Teorema de Pitágoras, esa distancia es igual a:

\sqrt{X_DIST^2 + Y_DIST^2}

{}= \sqrt{Math.pow( X_DIST, 2 ) + pow( Y_DIST, 2 )}

{}= formattedSquareRootOf(HYP2)

La distancia es igual a la longitud del lado, que es X_DIST+Y_DIST