This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
decimals_on_the_number_line_2.html
132 lines (116 loc) · 5.85 KB
/
decimals_on_the_number_line_2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html data-require="math math-format graphie word-problems interactive">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Decimals on the number line 2</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div id="section">
<div class="vars">
<var id="SECTION_LENGTH">randRange(1, 3)</var>
<var id="NUM_TICKS">SECTION_LENGTH * 10</var>
<var id="LOWER_BOUND">randRange(0, 100 - SECTION_LENGTH) / 10</var>
<var id="UPPER_BOUND">localeToFixed(LOWER_BOUND + SECTION_LENGTH / 10, 1)</var>
<var id="MARK_INCREMENT">0.01</var>
<var id="HUNDREDTHS">randRange(1, NUM_TICKS - 1)</var>
<var id="SOLUTION">HUNDREDTHS / 10</var>
<var id="SOLN_TXT">localeToFixed(LOWER_BOUND + HUNDREDTHS * MARK_INCREMENT, 2)</var>
</div>
<div class="question">
<p>Move the orange dot to <code>\pink{<var>SOLN_TXT</var>}</code> on the number line.</p>
<div class="graphie" id="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];
};
</div>
</div>
<div class="solution" data-type="custom">
<span class="instruction"></span>
<div class="guess"> graph.movablePoint.coord[0] </div>
<div class="validator-function">
if (guess === 0) {
return "";
}
return abs(SOLUTION - guess) < 0.001;
</div>
<div class="show-guess">
graph.movablePoint.setCoord([guess, 0]);
</div>
</div>
<div class="hints">
<p>
Above we've drawn the number line from <code>\blue{<var>LOWER_BOUND</var>}</code>
to <code>\blue{<var>UPPER_BOUND</var>}</code>, divided into <code><var>NUM_TICKS</var></code> equal pieces.
</p>
<div>
<p>The line is divided into <code><var>NUM_TICKS</var></code> pieces, which means:</p>
<p>
Piece of line <code> = \dfrac{<var>UPPER_BOUND</var> - <var>LOWER_BOUND</var>}{<var>NUM_TICKS</var>} =
\purple{<var>MARK_INCREMENT</var>}</code>
</p>
</div>
<div class="graphie" data-update="number-line">
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");
}
}
</div>
<p><code>
\pink{<var>SOLN_TXT</var>} =
\blue{<var>LOWER_BOUND</var>} + \purple{<var>MARK_INCREMENT</var>} \times \green{<var>HUNDREDTHS</var>}
</code></p>
<p data-if="isSingular(HUNDREDTHS)">
Therefore, moving the orange dot <code>\green{<var>HUNDREDTHS</var>}</code>
place will put it at the position <code>\pink{<var>SOLN_TXT</var>}</code>.
</p>
<p data-else="">
Therefore, moving the orange dot <code>\green{<var>HUNDREDTHS</var>}</code>
places will put it at the position <code>\pink{<var>SOLN_TXT</var>}</code>.
</p>
<div>
<div class="graphie" data-update="number-line">
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 );
</div>
<p>The highlighted number shows where <code>\pink{<var>SOLN_TXT</var>}</code> is on the number line.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>