This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 863
/
one_step_inequalities.html
120 lines (112 loc) · 5.9 KB
/
one_step_inequalities.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
<!DOCTYPE html>
<html data-require="math math-format graphie graphie-helpers">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>One-step inequalities</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<!--
Solving one-step inequalities with positive and negative coefficients.
-->
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="NUM, DEN" data-ensure="NUM > 2 || NUM < -2">reduce( randRange( -20, 20 ), rand( 3 ) > 0 ? 1 : randRange( 2, 20 ) )</var>
<var id="COEF">fractionReduce( NUM, DEN )</var>
<var id="ONE_OVER_COEF">fractionReduce( DEN, NUM )</var>
<var id="RIGHT_INT">randRangeNonZero( -20, 20 )</var>
<var id="COMP">randFromArray([ "<", ">", "≤", "≥" ])</var>
<var id="COMP_SOLUTION">(function() {
if ( NUM > 0 ) {
return COMP;
}
switch ( COMP ) {
case "<":
return ">";
case ">":
return "<";
case "≤":
return "≥";
case "≥":
return "≤";
}
})()</var>
<var id="SOLUTION_NOT_REDUCED">fraction( RIGHT_INT * DEN, NUM )</var>
<var id="SOLUTION">fractionReduce( RIGHT_INT * DEN, NUM )</var>
<var id="SOLUTION_REAL">RIGHT_INT * DEN / NUM</var>
</div>
<p class="question">Solve for <code>x</code>:</p>
<div><code><var>COEF</var>x <var>COMP</var> <var>RIGHT_INT</var></code></div>
<p class="solution" data-type="multiple">
<code>x</code>
<span class="sol" data-type="list" data-choices="[ '', '<', '>', '≤', '≥' ]">
<var>COMP_SOLUTION</var>
</span>
<span class="sol"><var>SOLUTION_REAL</var></span>
<span class="example">an integer, like <code>6</code></span>
<span class="example">a <em>proper</em> fraction, like <code>1/2</code> or <code>6/10</code></span>
<span class="example">an <em>improper</em> fraction, like <code>10/7</code> or <code>14/8</code></span>
<span class="example">a mixed number, like <code>1\ 3/4</code></span>
<span class="example">an <em>exact</em> decimal, like <code>0.75</code></span>
</p>
<div class="hints">
<p data-if ="NUM < 0">When multiplying or dividing both sides of an inequality by a negative number you have to flip the inequality. Therefore <code><var>COMP</var></code> becomes <code><var>COMP_SOLUTION</var></code>.</p>
<div>
<p>Multiply both sides by <code><var>ONE_OVER_COEF</var></code>.</p>
<p><code>(<var>ONE_OVER_COEF</var>) \cdot (<var>COEF</var>x) <var>COMP_SOLUTION</var> (<var>ONE_OVER_COEF</var>) \cdot (<var>RIGHT_INT</var>)</code></p>
</div>
<div>
<p>Simplify.</p>
<p><code>x <var>COMP_SOLUTION</var> <var>SOLUTION_NOT_REDUCED</var></code></p>
</div>
<div data-if="SOLUTION_NOT_REDUCED !== SOLUTION">
<p>Reduce.</p>
<p><code>x <var>COMP_SOLUTION</var> <var>SOLUTION</var></code></p>
</div>
<div>
<p>We can see that all values of <code>x <var>COMP_SOLUTION</var> <var>SOLUTION</var></code> satisfy the original inequality.</p>
<div class="graphie">
init({
range: [ [-1, 11], [-1, 1] ],
});
var start = SOLUTION_REAL - 4.5;
var end = SOLUTION_REAL + 4.5;
numberLine( start, end );
var offset;
var fill;
var startOffset = 0.12;
switch ( COMP_SOLUTION ) {
case ">":
fill = null;
offset = 5;
break;
case "≥":
fill = "#6495ED";
offset = 5;
break;
case "<":
fill = null;
offset = -5;
startOffset *= -1;
break;
case "≤":
fill = "#6495ED";
offset = -5;
startOffset *= -1;
break;
}
var x = SOLUTION_REAL - start;
style({ stroke: "#FFA500", fill: "#FFA500", strokeWidth: 3.5, arrows: "->" });
path([ [ x + startOffset, 0 ], [ x + offset, 0 ]]);
style({ stroke: "#6495ED", strokeWidth: 2.0, fill: fill });
circle([ x, 0 ], 0.15 );
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>