Skip to content
Newer
Older
100644 189 lines (183 sloc) 9.36 KB
54165fc @jpulgarin Added comparing_absolute_values.html
jpulgarin authored Aug 16, 2011
1 <!DOCTYPE html>
cde9e9f @jeresig Re-run the exercises through the updated cleaner.
jeresig authored Apr 24, 2013
2 <html data-require="math graphie graphie-helpers">
3 <head>
0f0c630 @cbhl Clean up the exercise files using the new cleaning utility. (II)
cbhl authored Apr 16, 2013
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
5 <title>Comparing absolute values</title>
ac1415e @spicyj Use requirejs for module loading
spicyj authored Mar 5, 2014
6 <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
7 <script type="text/javascript">
8 function drawNumberLine( NUM ) {
9 var graph = KhanUtil.currentGraph;
c2cb4db @spicyj Whitespace :)
spicyj authored Dec 8, 2011
10
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
11 graph.init({
12 range: [ [-1, 11], [-1, 1] ],
13 });
14 var start = 0;
15 var end = 10;
16 var originX = 0;
17 var x = Math.abs( NUM );
18 if ( NUM < 0 ) {
19 start = -10;
20 end = 0;
21 originX = 10;
22 x = 10 - x;
23 }
24 numberLine( start, end );
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
25 graph.style({ stroke: KhanUtil.BLUE, fill: KhanUtil.BLUE });
26 graph.pt = graph.circle( [ x, 0 ], 0.15 );
27 graph.style({ stroke: KhanUtil.GREEN, fill: KhanUtil.GREEN, strokeWidth: 3.5, arrows: "->" });
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
28 graph.path( [ [ originX, 0 ], [ x, 0 ] ] );
29 graph.circle( [ originX, 0 ], 0.10 );
30 }
31 </script>
54165fc @jpulgarin Added comparing_absolute_values.html
jpulgarin authored Aug 17, 2011
32 </head>
33 <body>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
34 <div class="exercise">
35 <div class="problems">
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
36 <div id="integer">
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
37 <div class="vars">
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
38 <var id="ABS_1, ABS_2">randFromArray([[1, 1], [1, 0], [0, 1]])</var>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
39 <var id="NUM_1">randRange(-10, 10)</var>
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
40 <var id="NUM_2">(NUM_1 &lt; 0) ? randRange(0, 10) : randRange(-10, -1)</var>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
41 <var id="NUM_1_ABS">ABS_1 ? "\\lvert" + NUM_1 + "\\rvert" : NUM_1</var>
42 <var id="NUM_2_ABS">ABS_2 ? "\\lvert" + NUM_2 + "\\rvert" : NUM_2</var>
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
43 <var id="NUM_1_VALUE">ABS_1 ? abs(NUM_1) : NUM_1</var>
44 <var id="NUM_2_VALUE">ABS_2 ? abs(NUM_2) : NUM_2</var>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
45 <var id="SOLUTION">(function() {
46 if ( NUM_1_VALUE === NUM_2_VALUE ) {
47 return "=";
48 }
49 return NUM_1_VALUE &lt; NUM_2_VALUE ? "&lt;" : "&gt;";
50 })()</var>
51 </div>
54165fc @jpulgarin Added comparing_absolute_values.html
jpulgarin authored Aug 17, 2011
52
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
53 <div class="problem">
54 <p>Fill in the blank.</p>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
55 <p><code><var>NUM_1_ABS</var></code> ____ <code><var>NUM_2_ABS</var></code></p>
56 </div>
57 <p class="solution"><code><var>SOLUTION</var></code></p>
58 <ul class="choices" data-category="true">
59 <li><code>&lt;</code></li>
60 <li><code>&gt;</code></li>
61 <li><code>=</code></li>
62 </ul>
63 </div>
64 <div id="decimal">
65 <div class="vars">
66 <var id="ABS_1, ABS_2">randFromArray([[1, 1], [1, 0], [0, 1]])</var>
67 <var id="NUM_1">randRange(-99, 99) / 10</var>
68 <var id="NUM_2">(NUM_1 &lt; 0) ? randRange(0, 99) / 10 : randRange(-99, -1) / 10</var>
69 <var id="NUM_1_ABS">ABS_1 ? "\\lvert" + NUM_1 + "\\rvert" : NUM_1</var>
70 <var id="NUM_2_ABS">ABS_2 ? "\\lvert" + NUM_2 + "\\rvert" : NUM_2</var>
71 <var id="NUM_1_VALUE">ABS_1 ? abs(NUM_1) : NUM_1</var>
72 <var id="NUM_2_VALUE">ABS_2 ? abs(NUM_2) : NUM_2</var>
73 <var id="SOLUTION">(function() {
74 if ( NUM_1_VALUE === NUM_2_VALUE ) {
75 return "=";
76 }
77 return NUM_1_VALUE &lt; NUM_2_VALUE ? "&lt;" : "&gt;";
78 })()</var>
79 </div>
80
81 <div class="problem">
82 <p>Fill in the blank.</p>
83 <p><code><var>NUM_1_ABS</var></code> ____ <code><var>NUM_2_ABS</var></code></p>
84 </div>
85 <p class="solution"><code><var>SOLUTION</var></code></p>
86 <ul class="choices" data-category="true">
87 <li><code>&lt;</code></li>
88 <li><code>&gt;</code></li>
89 <li><code>=</code></li>
90 </ul>
91 </div>
92 <div id="fraction">
93 <div class="vars">
94 <div data-ensure="abs(abs(NUMER_1) - abs(NUMER_2)) > 2">
95 <var id="NUMER_1">randRangeNonZero(-9, 9)</var>
96 <var id="NUMER_2">(NUM_1 &lt; 0) ? randRange(1, 9) : randRange(-9, -1)</var>
97 </div>
98 <var id="ABS_1, ABS_2">randFromArray([[1, 1], [1, 0], [0, 1]])</var>
99 <var id="DENOM">randFromArray(smallDenominators)</var>
100 <var id="NUM_1">NUMER_1 / DENOM</var>
101 <var id="NUM_2">NUMER_2 / DENOM</var>
102 <var id="NUM_1_STRING">fractionReduce(NUMER_1, DENOM)</var>
103 <var id="NUM_2_STRING">fractionReduce(NUMER_2, DENOM)</var>
104 <var id="NUM_1_ABS">ABS_1 ? "\\left\\lvert" + NUM_1_STRING + "\\right\\rvert" : NUM_1_STRING</var>
105 <var id="NUM_2_ABS">ABS_2 ? "\\left\\lvert" + NUM_2_STRING + "\\right\\rvert" : NUM_2_STRING</var>
106 <var id="NUM_1_VALUE">ABS_1 ? abs(NUMER_1) : NUMER_1</var>
107 <var id="NUM_2_VALUE">ABS_2 ? abs(NUMER_2) : NUMER_2</var>
108 <var id="NUM_1_VALUE_STRING">fractionReduce(NUM_1_VALUE, DENOM)</var>
109 <var id="NUM_2_VALUE_STRING">fractionReduce(NUM_2_VALUE, DENOM)</var>
110 <var id="SOLUTION">(function() {
111 if (NUM_1_VALUE === NUM_2_VALUE) {
112 return "=";
113 }
114 return NUM_1_VALUE &lt; NUM_2_VALUE ? "&lt;" : "&gt;";
115 })()</var>
116 </div>
117
118 <div class="problem">
119 <p>Fill in the blank.</p>
120 <p><code><var>NUM_1_ABS</var></code> ____ <code><var>NUM_2_ABS</var></code></p>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
121 </div>
122 <p class="solution"><code><var>SOLUTION</var></code></p>
0f0c630 @cbhl Clean up the exercise files using the new cleaning utility. (II)
cbhl authored Apr 16, 2013
123 <ul class="choices" data-category="true">
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
124 <li><code>&lt;</code></li>
125 <li><code>&gt;</code></li>
126 <li><code>=</code></li>
127 </ul>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
128
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
129 <div class="hints">
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
130 <div data-if="ABS_1">
131 <p>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
132 The absolute value of a number is its distance from zero.
133 The distance from <code>0</code> to <code><var>NUM_1_STRING</var></code>
134 is <code><var>NUM_1_VALUE_STRING</var></code> so:
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
135 </p>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
136 <p><code>\qquad<var>NUM_1_ABS</var> = <var>NUM_1_VALUE_STRING</var></code></p>
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
137 <div class="graphie">
138 drawNumberLine(NUM_1);
139 </div>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
140 </div>
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
141 <div data-if="ABS_2">
142 <p data-if="ABS_2">
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
143 The absolute value of a number is its distance from zero.
144 The distance from <code>0</code> to <code><var>NUM_2_STRING</var></code>
145 is <code><var>NUM_2_VALUE_STRING</var></code> so:
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
146 </p>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
147 <p><code>\qquad<var>NUM_2_ABS</var> = <var>NUM_1_VALUE_STRING</var></code></p>
2025730 @petercollingridge Use nicer pipes and tidy up the hints a bit
petercollingridge authored Jan 23, 2014
148 <div class="graphie">
149 drawNumberLine(NUM_2);
150 </div>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
151 </div>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
152 <p>
153 Is <code><var>NUM_1_VALUE_STRING</var></code> less than, greater than,
154 or equal to <code><var>NUM_2_VALUE_STRING</var></code>?
155 </p>
156 <p><code><var>NUM_1_VALUE_STRING</var> <var>SOLUTION</var> <var>NUM_2_VALUE_STRING</var></code></p>
157 <p>So, <code><var>NUM_1_ABS</var> <var>SOLUTION</var> <var>NUM_2_ABS</var></code>.</p>
158 </div>
159 </div>
160 </div>
161 <div class="hints">
162 <div data-if="ABS_1">
163 <p>
164 The absolute value of a number is its distance from zero.
165 The distance from <code>0</code> to <code><var>NUM_1</var></code> is <code><var>NUM_1_VALUE</var></code> so:
166 </p>
167 <p><code>\qquad<var>NUM_1_ABS</var> = <var>NUM_1_VALUE</var></code></p>
168 <div class="graphie">
169 drawNumberLine(NUM_1);
170 </div>
171 </div>
172 <div data-if="ABS_2">
173 <p data-if="ABS_2">
174 The absolute value of a number is its distance from zero.
175 The distance from <code>0</code> to <code><var>NUM_2</var></code> is <code><var>NUM_2_VALUE</var></code> so:
176 </p>
177 <p><code>\qquad<var>NUM_2_ABS</var> = <var>NUM_2_VALUE</var></code></p>
178 <div class="graphie">
179 drawNumberLine(NUM_2);
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
180 </div>
181 </div>
88517a5 @petercollingridge Add decimal and fraction questions to comparing absolute values
petercollingridge authored Jul 3, 2015
182 <p>Is <code><var>NUM_1_VALUE</var></code> less than, greater than, or equal to <code><var>NUM_2_VALUE</var></code>?</p>
183 <p><code><var>NUM_1_VALUE</var> <var>SOLUTION</var> <var>NUM_2_VALUE</var></code></p>
184 <p>So, <code><var>NUM_1_ABS</var> <var>SOLUTION</var> <var>NUM_2_ABS</var></code>.</p>
4e4cb9b @beneater lint: tabs->spaces and jQuery->$ for exercises
beneater authored Apr 10, 2012
185 </div>
186 </div>
cde9e9f @jeresig Re-run the exercises through the updated cleaner.
jeresig authored Apr 24, 2013
187 </body>
188 </html>
Something went wrong with that request. Please try again.