randRange(1, 3)
SECTION_LENGTH * 10
randRange(0, 100 - SECTION_LENGTH) / 10
localeToFixed(LOWER_BOUND + SECTION_LENGTH / 10, 1)
0.01
randRange(1, NUM_TICKS - 1)
HUNDREDTHS / 10
localeToFixed(LOWER_BOUND + HUNDREDTHS * MARK_INCREMENT, 2)
Move the orange dot to \pink{SOLN_TXT}
on the number line.
init({
range: [[-0.2, SECTION_LENGTH + 0.2], [-1, 1]],
scale: [360 / SECTION_LENGTH, 40]
});
style({arrows: ">"});
line([0, 0], [SECTION_LENGTH * 1.06, 0] );
style({arrows: "->"});
line([0, 0], [-0.06 * SECTION_LENGTH, 0]);
style({arrows: ""});
for (var x = 1; x < NUM_TICKS; x++) {
if (x % 10 === 0) {
line([x / 10, -0.2], [x / 10, 0.2]);
} else {
line([x / 10, -0.12], [x / 10, 0.12]);
}
}
style({stroke: BLUE, strokeWidth: 3.5});
line([0, -0.2], [0, 0.2]);
label([0, -0.53], LOWER_BOUND, "center", {color: BLUE});
line([SECTION_LENGTH, -0.2], [SECTION_LENGTH, 0.2]);
label([SECTION_LENGTH, -0.53 ], UPPER_BOUND, "center", {color: BLUE});
addMouseLayer();
graph.movablePoint = addMovablePoint({ constraints: { constrainY: true }, snapX: 0.05 });
graph.movablePoint.onMove = function(x, y) {
return [min(max(0, x), SECTION_LENGTH), 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 \blue{LOWER_BOUND}
to \blue{UPPER_BOUND}
, divided into NUM_TICKS
equal pieces.
The line is divided into NUM_TICKS
pieces, which means:
Piece of line = \dfrac{UPPER_BOUND - LOWER_BOUND}{NUM_TICKS} =
\purple{MARK_INCREMENT}
if (SECTION_LENGTH === 1) {
for (var x = 1; x < 10; x++) {
label([x / 10, -0.53], localeToFixed(LOWER_BOUND + x * MARK_INCREMENT, 2), "center");
}
} else {
for (var x = 1; x < SECTION_LENGTH; x++) {
label([x, -0.53], localeToFixed(LOWER_BOUND + x * MARK_INCREMENT * 10, 2), "center");
}
}
\pink{SOLN_TXT} =
\blue{LOWER_BOUND} + \purple{MARK_INCREMENT} \times \green{HUNDREDTHS}
Therefore, moving the orange dot \green{HUNDREDTHS}
place will put it at the position \pink{SOLN_TXT}
.
Therefore, moving the orange dot \green{HUNDREDTHS}
places will put it at the position \pink{SOLN_TXT}
.
style({ stroke: BLUE, fill: BLUE, strokeWidth: 3.5, arrows: "->" });
line([0, 0], [SOLUTION, 0]);
graph.movablePoint.visibleShape.toFront();
label([HUNDREDTHS/10, 0.53 ], SOLN_TXT, "center", { color: PINK });
graph.movablePoint.moveTo( SOLUTION, 0 );
The highlighted number shows where \pink{SOLN_TXT}
is on the number line.