Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 237 lines (224 sloc) 8.485 kb
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
1 <!DOCTYPE html>
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
2 <html data-require="math graphie math-format expressions">
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
3 <head>
4 <title>Limits 1</title>
5 <script src="../khan-exercise.js"></script>
6 </head>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
7 <body>
8 <div class="exercise">
9 <div class="problems">
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
10 <div>
adcc771 @jeresig Implement problem-specific var blocks. Fixes #3.
jeresig authored
11 <div class="vars">
3601211 @osnr Rename nonzero random range function
osnr authored
12 <var id="q_lcoef">randRangeNonZero(-3, 3)</var>
adcc771 @jeresig Implement problem-specific var blocks. Fixes #3.
jeresig authored
13 <var id="edge">floor(sqrt(abs(10 / q_lcoef)))</var>
3601211 @osnr Rename nonzero random range function
osnr authored
14 <var id="l_cons">randRangeNonZero(-1 * edge, edge)</var>
adcc771 @jeresig Implement problem-specific var blocks. Fixes #3.
jeresig authored
15 <var id="quadratic">q_lcoef + 'x^2'</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
16 <var id="LINE">cleanMath('(x + ' + l_cons + ')')</var>
adcc771 @jeresig Implement problem-specific var blocks. Fixes #3.
jeresig authored
17 <var id="curFunc">function(x) {
18 return truncate_to_max(q_lcoef * Math.pow(x, 2), 4);
19 }</var>
20 <var id="a">-1 * l_cons</var>
21 <var id="limtoa">curFunc(a)</var>
22 <var id="l_limtoa">limtoa</var>
23 <var id="r_limtoa">limtoa</var>
24 </div>
cf02179 @spicyj Strip trailing whitespace
spicyj authored
25
3cd4d79 @spicyj graphie for limits_1
spicyj authored
26 <p><code>\displaystyle\lim_{x\to<var>a</var>} \dfrac{<var>quadratic</var><var>LINE</var>}{<var>LINE</var>} = {?}</code></p>
27 <div class="graphie" id="graph">
28 graphInit({
29 range: 10,
30 scale: 20,
31 tickStep: 1,
32 axisArrows: "->"
33 });
34
35 style({
36 stroke: "#6495ed"
37 }, function() {
38 plot( function(x) {
39 return q_lcoef * x * x;
40 }, [-10, 10] );
41
42 circle( [a, limtoa], 4 / 20, { fill: "white" } )
43 });
9c227ad @jeresig Refine the definition of graphs, implement a basic API. Fixes #5.
jeresig authored
44 </div>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
45 <p class="solution"><code><var>limtoa</var></code></p>
46 <ul class="choices" data-show="5" data-none="true">
47 <li><code>0</code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
48 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
49 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
50 <li><code><var>q_lcoef</var></code></li>
51 <li><code><var>l_cons</var></code></li>
52 <li><code><var>curFunc(0)</var></code></li>
53 <li>Does not exist.</li>
54 </ul>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
55 </div>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
56 <div>
57 <div class="vars">
3601211 @osnr Rename nonzero random range function
osnr authored
58 <var id="abs_coef">randRangeNonZero(-5, 5)</var>
59 <var id="abs_cons">randRangeNonZero(-7, 7)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
60 <var id="curFunc">function(x) {
61 return x + abs_cons > 0 ?
62 abs_coef :
63 abs_coef * -1;
64 }</var>
65 <var id="a">abs_cons * -1</var>
66 <var id="limtoa">curFunc(a)</var>
67 <var id="l_limtoa">abs_coef * -1</var>
68 <var id="r_limtoa">abs_coef</var>
69 </div>
cf02179 @spicyj Strip trailing whitespace
spicyj authored
70
d639176 @spicyj small display changes for limits_1
spicyj authored
71 <p><code>\displaystyle \lim_{x\to<var>a</var>} \dfrac{<var>abs_coef</var>|x + <var>abs_cons</var>|}{x + <var>abs_cons</var>} = {?}</code></p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
72 <div class="graphie" id="graph">
73 graphInit({
74 range: 10,
75 scale: 20,
76 tickStep: 1,
77 axisArrows: "->"
78 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
79
3cd4d79 @spicyj graphie for limits_1
spicyj authored
80 style({
81 stroke: "#6495ed"
82 }, function() {
83 line( [-11, abs_coef * -1], [-abs_cons, abs_coef * -1] );
84 line( [-abs_cons, abs_coef], [11, abs_coef] );
85
86 circle( [-abs_cons, -abs_coef], 4 / 20, { fill: "white" } )
87 circle( [-abs_cons, abs_coef], 4 / 20, { fill: "white" } )
88 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
89 </div>
90 <p class="solution">Does not exist.</p>
91 <ul class="choices" data-show="5" data-none="true">
92 <li><code>0</code></li>
93 <li><code><var>a</var></code></li>
94 <li><code><var>abs_cons</var></code></li>
95 <li><code><var>abs_coef</var></code></li>
96 <li><code><var>abs_coef * -1</var></code></li>
97 <li><code><var>abs_coef * abs_coef</var></code></li>
98 <li><code><var>abs_coef * abs_coef * -1</var></code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
99 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
100 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
101 </ul>
f4cce3f @jochu fix exercises to use new templating
jochu authored
102 <div class="hints" data-apply="appendContents">
3cd4d79 @spicyj graphie for limits_1
spicyj authored
103 <p id="final">The limit as we approach from the left doesn't match the limit as we approach from the right, so <code>f(x)</code> has no limit as <code>x \to <var>a</var></code>.</p>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
104 </div>
105 </div>
106 <div>
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
107 <div class="vars" data-ensure="abs( limtoa ) < 10">
3601211 @osnr Rename nonzero random range function
osnr authored
108 <var id="l_coef">randRangeNonZero(-3, 3)</var>
109 <var id="l_cons">randRangeNonZero(-4, 4)</var>
110 <var id="d_cons">randRangeNonZero(-7, 7)</var>
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
111 <var id="d_line">expr(["+", ["*", l_coef, "x"], l_cons])</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
112 <var id="curFunc">function(x) {
113 return l_coef * x + l_cons;
114 }</var>
115 <var id="a0">ceil((-10 - l_cons)/l_coef)</var>
116 <var id="a1">floor((10 - l_cons)/l_coef)</var>
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
117 <var id="a" data-ensure="abs( a ) < 10">l_coef > 0 ? randRangeNonZero(a0, a1) : randRangeNonZero(a1, a0)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
118 <var id="limtoa">curFunc(a)</var>
119 <var id="l_limtoa">limtoa</var>
120 <var id="r_limtoa">limtoa</var>
121 </div>
cf02179 @spicyj Strip trailing whitespace
spicyj authored
122
d639176 @spicyj small display changes for limits_1
spicyj authored
123 <p>If <code>f(x) = \begin{cases}
124 <var>d_cons</var> & \text{if $x = <var>a</var>$} \\
125 <var>d_line</var> & \text{otherwise}
126 \end{cases}</code>, find <code>\displaystyle \lim_{x \to <var>a</var>} f(x)</code>.</p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
127 <div class="graphie" id="graph">
128 graphInit({
129 range: 10,
130 scale: 20,
131 tickStep: 1,
132 axisArrows: "->"
133 });
134
135 style({
136 stroke: "#6495ed"
137 }, function() {
138 plot( function(x) {
139 return l_coef * x + l_cons;
140 }, [-10, 10] );
141
142 circle( [a, limtoa], 4 / 20, { fill: "white" } )
143 circle( [a, d_cons], 4 / 20, { fill: "#6495ed", stroke: "none" } )
144 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
145 </div>
146 <p class="solution"><code><var>limtoa</var></code></p>
147 <ul class="choices" data-show="5" data-none="true">
148 <li><code>0</code></li>
149 <li><code><var>a</var></code></li>
150 <li><code><var>d_cons</var></code></li>
151 <li><code><var>l_coef</var></code></li>
7149ebc @jruberg replaced previous invocations of fraction with fractionReduce now tha…
jruberg authored
152 <li><code><var>fractionReduce(l_cons * -1, l_coef)</var></code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
153 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
154 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
155 <li>Does not exist.</li>
156 </ul>
157 </div>
158 <div>
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
159 <div class="vars" data-ensure="abs( limtoa ) < 10">
3601211 @osnr Rename nonzero random range function
osnr authored
160 <var id="q_lcoef">randRangeNonZero(-3, 3)</var>
161 <var id="q_cons">randRangeNonZero(-3, 3)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
162 <var id="edge">floor(sqrt(abs((10 - q_cons) / q_lcoef)))</var>
3601211 @osnr Rename nonzero random range function
osnr authored
163 <var id="a">randRangeNonZero(-1 * edge, edge)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
164 <var id="curFunc">function(x) {
165 return q_lcoef * Math.pow(x, 2) + q_cons;
166 }</var>
167 <var id="limtoa">curFunc(a)</var>
168 <var id="l_limtoa">limtoa</var>
169 <var id="r_limtoa">limtoa</var>
170 </div>
171
6469103 @spicyj Limits 1 improvements, closes #258
spicyj authored
172 <p><code>\displaystyle \lim_{x\to<var>a</var>} <var>expr(["+", ["*", q_lcoef, ["^", "x", 2]], q_cons])</var> = {?}</code></p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
173 <div class="graphie" id="graph">
174 graphInit({
175 range: 10,
176 scale: 20,
177 tickStep: 1,
178 axisArrows: "->"
179 });
180
181 style({
182 stroke: "#6495ed"
183 }, function() {
184 plot( function(x) {
185 return q_lcoef * x * x + q_cons;
186 }, [-10, 10] );
187 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
188 </div>
189 <p class="solution"><code><var>limtoa</var></code></p>
190 <ul class="choices" data-show="5" data-none="true">
191 <li><code>0</code></li>
192 <li><code><var>curFunc(0)</var></code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
193 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
194 <li><code><var>q_cons</var></code></li>
195 <li><code><var>q_cons * -1</var></code></li>
196 <li>Does not exist.</li>
197 </ul>
198 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
199 </div>
cf02179 @spicyj Strip trailing whitespace
spicyj authored
200
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
201 <div class="hints">
202 <div>
203 <p>What happens as we approach <code>x = <var>a</var></code> from the left?</p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
204 <div class="graphie" data-update="graph" data-style="stroke: orange; marker: arrow;">
205 line( [a - 2, 0], [a, 0], {
206 stroke: "#ff00af",
207 arrows: "->"
208 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
209 </div>
210 </div>
211 <div>
212 <table class="limit">
213 <tr><th><code>x</code></th><th><var>a - 0.1</var></th><th><var>a - 0.01</var></th><th><var>a - 0.001</var></th></tr>
214 <tr><th><code>f(x)</code></th><td><var>curFunc(a - 0.1).toFixed(4)</var></td><td><var>curFunc(a - 0.01).toFixed(4)</var></td><td><var>curFunc(a - 0.001).toFixed(4)</var></td></tr>
215 </table>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
216 It looks like <code>f(x)</code> is approaching <code><var>l_limtoa</var></code> from the left.
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
217 </div>
218 <div>
219 <p>When we approach <code>x = <var>a</var></code> from the right, we get:</p>
220 <table class="limit">
221 <tr><th><code>x</code></th><th><var>a + 0.1</var></th><th><var>a + 0.01</var></th><th><var>a + 0.001</var></th></tr>
222 <tr><th><code>f(x)</code></th><td><var>curFunc(a + 0.1).toFixed(4)</var></td><td><var>curFunc(a + 0.01).toFixed(4)</var></td><td><var>curFunc(a + 0.001).toFixed(4)</var></td></tr>
223 </table>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
224 It looks like <code>f(x)</code> is approaching <code><var>r_limtoa</var></code> from the right.
225 <div class="graphie" data-update="graph" data-style="stroke: orange; marker: arrow;">
226 line( [a + 2, 0], [a, 0], {
227 stroke: "#ff00af",
228 arrows: "->"
229 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
230 </div>
231 </div>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
232 <p id="final">So the limit is <code><var>limtoa</var></code>.</p>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
233 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
234 </div>
235 </body>
4627f1f @osnr Move graph style stuff to the data-style attribute, so browsers don't…
osnr authored
236 </html>
Something went wrong with that request. Please try again.