Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 241 lines (228 sloc) 8.439 kB
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
1 <!DOCTYPE html>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
2 <html data-require="math graphie math-format">
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
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
71 <p><code>\lim_{x\to<var>a</var>} \dfrac{<var>abs_coef</var>|x + <var>abs_cons</var>|}{x + <var>abs_cons</var>} \quad\quad = ?</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>
107 <div class="vars">
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>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
111 <var id="d_line">cleanMath(l_coef + 'x + ' + l_cons)</var>
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>
3601211 @osnr Rename nonzero random range function
osnr authored
117 <var id="a">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
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
123 <p><code>\begin{align*}
e7642f8 @spicyj HTML5 ampersands are fine as long as they are not ambiguous
spicyj authored
124 \lim_{x\to<var>a</var>} f(x) & \\
125 \text{where} \quad f(x) & = \left \{
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
126 \begin{array}{1 1}
bd44359 @spicyj Fix a bunch of missing variables, like in equation of a line
spicyj authored
127 <var>d_line</var> &\quad \text{if} \quad x \neq <var>a</var>\\
128 <var>d_cons</var> &\quad \text{if} \quad x = <var>a</var>\\
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
129 \end{array} \right.
130 \end{align*}</code></p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
131 <div class="graphie" id="graph">
132 graphInit({
133 range: 10,
134 scale: 20,
135 tickStep: 1,
136 axisArrows: "->"
137 });
138
139 style({
140 stroke: "#6495ed"
141 }, function() {
142 plot( function(x) {
143 return l_coef * x + l_cons;
144 }, [-10, 10] );
145
146 circle( [a, limtoa], 4 / 20, { fill: "white" } )
147 circle( [a, d_cons], 4 / 20, { fill: "#6495ed", stroke: "none" } )
148 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
149 </div>
150 <p class="solution"><code><var>limtoa</var></code></p>
151 <ul class="choices" data-show="5" data-none="true">
152 <li><code>0</code></li>
153 <li><code><var>a</var></code></li>
154 <li><code><var>d_cons</var></code></li>
155 <li><code><var>l_coef</var></code></li>
7149ebc @jruberg replaced previous invocations of fraction with fractionReduce now tha…
jruberg authored
156 <li><code><var>fractionReduce(l_cons * -1, l_coef)</var></code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
157 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
158 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
159 <li>Does not exist.</li>
160 </ul>
161 </div>
162 <div>
163 <div class="vars">
3601211 @osnr Rename nonzero random range function
osnr authored
164 <var id="q_lcoef">randRangeNonZero(-3, 3)</var>
165 <var id="q_cons">randRangeNonZero(-3, 3)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
166 <var id="edge">floor(sqrt(abs((10 - q_cons) / q_lcoef)))</var>
3601211 @osnr Rename nonzero random range function
osnr authored
167 <var id="a">randRangeNonZero(-1 * edge, edge)</var>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
168 <var id="curFunc">function(x) {
169 return q_lcoef * Math.pow(x, 2) + q_cons;
170 }</var>
171 <var id="limtoa">curFunc(a)</var>
172 <var id="l_limtoa">limtoa</var>
173 <var id="r_limtoa">limtoa</var>
174 </div>
175
176 <p><code>\lim_{x\to<var>a</var>} <var>q_lcoef</var>x^2 + <var>q_cons</var> \quad\quad = ?</code></p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
177 <div class="graphie" id="graph">
178 graphInit({
179 range: 10,
180 scale: 20,
181 tickStep: 1,
182 axisArrows: "->"
183 });
184
185 style({
186 stroke: "#6495ed"
187 }, function() {
188 plot( function(x) {
189 return q_lcoef * x * x + q_cons;
190 }, [-10, 10] );
191 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
192 </div>
193 <p class="solution"><code><var>limtoa</var></code></p>
194 <ul class="choices" data-show="5" data-none="true">
195 <li><code>0</code></li>
196 <li><code><var>curFunc(0)</var></code></li>
3601211 @osnr Rename nonzero random range function
osnr authored
197 <li><code><var>randRangeNonZero(-3, 3)</var></code></li>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
198 <li><code><var>q_cons</var></code></li>
199 <li><code><var>q_cons * -1</var></code></li>
200 <li>Does not exist.</li>
201 </ul>
202 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
203 </div>
cf02179 @spicyj Strip trailing whitespace
spicyj authored
204
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
205 <div class="hints">
206 <div>
207 <p>What happens as we approach <code>x = <var>a</var></code> from the left?</p>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
208 <div class="graphie" data-update="graph" data-style="stroke: orange; marker: arrow;">
209 line( [a - 2, 0], [a, 0], {
210 stroke: "#ff00af",
211 arrows: "->"
212 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
213 </div>
214 </div>
215 <div>
216 <table class="limit">
217 <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>
218 <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>
219 </table>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
220 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
221 </div>
222 <div>
223 <p>When we approach <code>x = <var>a</var></code> from the right, we get:</p>
224 <table class="limit">
225 <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>
226 <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>
227 </table>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
228 It looks like <code>f(x)</code> is approaching <code><var>r_limtoa</var></code> from the right.
229 <div class="graphie" data-update="graph" data-style="stroke: orange; marker: arrow;">
230 line( [a + 2, 0], [a, 0], {
231 stroke: "#ff00af",
232 arrows: "->"
233 });
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
234 </div>
235 </div>
3cd4d79 @spicyj graphie for limits_1
spicyj authored
236 <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
237 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
238 </div>
239 </body>
4627f1f @osnr Move graph style stuff to the data-style attribute, so browsers don't…
osnr authored
240 </html>
Something went wrong with that request. Please try again.