Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

122 lines (104 sloc) 5.732 kB
<!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 src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="LOWER_BOUND">-2</var>
<var id="UPPER_BOUND">2</var>
<var id="LOWER_VALUE">LOWER_BOUND</var>
<var id="UPPER_VALUE">UPPER_BOUND</var>
<var id="SOLUTION">roundTo(1, randRangeNonZero(-19, 19) / 10)</var>
<var id="SOLUTION_DECIMAL">roundTo(1, SOLUTION % 1)</var>
<var id="SOLUTION_WHOLE">parseInt( ( SOLUTION ).toString(), 10 )</var>
</div>
<div class="problems">
<div>
<div class="question">
<p>Move the <strong><code>\color{orange}{\text{orange dot}}</code></strong> to <strong><code>\color{orange}{<var>SOLUTION</var>}</code></strong> on the number line. The distance between adjacent tick marks is 0.5.</p>
<div class="graphie" id="number-line">
init({
range: [ [LOWER_BOUND - 0.3, UPPER_BOUND + 0.3], [-1, 1] ],
scale: [108, 40]
});
style({arrows: "&gt;"});
line( [ 0, 0 ], [ UPPER_BOUND + 0.25, 0 ] );
style({arrows: "-&gt;"});
line( [ 0, 0 ], [ LOWER_BOUND - 0.25, 0 ] );
style({arrows: ""});
for ( var x = LOWER_BOUND; x &lt;= UPPER_BOUND; x+=0.5 ) {
var markLength;
x % 1 === 0 ? markLength = 0.2 : markLength = 0.1
line( [ x, -markLength ], [ x, markLength ] );
}
style({ stroke: GREEN, strokeWidth: 3.5 });
line( [ LOWER_BOUND, -0.2], [LOWER_BOUND, 0.2]);
label( [ LOWER_BOUND, -0.53 ], LOWER_BOUND, "center", { color: GREEN });
line( [ UPPER_BOUND, -0.2], [UPPER_BOUND, 0.2]);
label( [ UPPER_BOUND, -0.53 ], UPPER_BOUND, "center", { color: GREEN });
line( [ 0, -0.2], [0, 0.2]);
label( [ 0, -0.53 ], "0", "center", { color: GREEN });
addMouseLayer();
graph.movablePoint = addMovablePoint({ constraints: { constrainY: true }, snapX: 0.1 });
graph.movablePoint.onMove = function( x, y ) {
return [ min( max( LOWER_BOUND, x ), UPPER_BOUND ), y ];
};
</div>
</div>
<div class="solution" data-type="custom">
<span class="instruction"> Move the orange dot to select your answer. </span>
<div class="guess"> graph.movablePoint.coord[0] </div>
<div class="validator-function">
if ( guess === 0 ) {
return "";
}
return abs( SOLUTION - guess ) &lt; 0.001;
</div>
<div class="show-guess">
graph.movablePoint.setCoord( [ guess, 0 ] );
</div>
</div>
<div class="hints">
<p> Because <code>\color{orange}{<var>SOLUTION</var>}</code> is <span data-if="SOLUTION > 0">positive</span>
<span data-else>negative</span> the orange dot will be to the <span data-if="SOLUTION > 0">right</span>
<span data-else>left</span> of 0.</p>
<div data-if="abs(SOLUTION) > 1">
<p>Separate the decimal from the whole number:</p>
<p><code>\color{orange}{<var>SOLUTION</var>}</code> =
<code>\color{blue}{<var>SOLUTION_WHOLE</var>}</code> + <code>\color{blue}{<var>SOLUTION_DECIMAL</var>}</code>
</div>
<div>
<p>Therefore, we know <code>\color{orange}{<var>SOLUTION</var>}</code> lies between
<code>\color{orange}{<var>SOLUTION_WHOLE</var>}</code> and
<code>\color{orange}{<var>SOLUTION_WHOLE + (SOLUTION > 0 ? 1 : -1)</var>}</code> on the number line.</p>
<div class="graphie" data-update="number-line">
style({ stroke: "#FFA500", strokeWidth: 3.5 });
line( [SOLUTION_WHOLE, -0.2], [SOLUTION_WHOLE, 0.2]);
line( [SOLUTION_WHOLE + (SOLUTION > 0 ? 1 : -1), -0.2], [SOLUTION_WHOLE + (SOLUTION > 0 ? 1 : -1), 0.2]);
</div>
</div>
<div>
<div class="graphie" data-update="number-line">
style({ stroke: GREEN, fill: "#6495ED", strokeWidth: 3.5, arrows: "-&gt;" });
line( [ 0, 0 ], [ SOLUTION, 0 ] );
graph.movablePoint.visibleShape.toFront();
</div>
<p>The orange dot should be shifted to the position <code>\color{orange}{<var>SOLUTION</var>}</code> right of 0.</p>
</div>
<div>
<div class="graphie" data-update="number-line">
label( [ SOLUTION, -0.53 ], SOLUTION, "center", { color: "#FFA500" });
graph.movablePoint.moveTo( SOLUTION, 0 );
</div>
<p>The orange number shows where <code>\color{orange}{<var>SOLUTION</var>}</code> is on the number line.</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.