Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 188 lines (182 sloc) 8.063 kB
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
1 <!DOCTYPE html>
2 <html data-require="math graph">
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">
12 <var id="q_lcoef">nonZeroRandomInt(-3, 3)</var>
13 <var id="edge">floor(sqrt(abs(10 / q_lcoef)))</var>
14 <var id="l_cons">nonZeroRandomInt(-1 * edge, edge)</var>
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>
25
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
26 <p><code>\lim_{x\to<var>a</var>} \dfrac{<var>quadratic</var><var>LINE</var>}{<var>LINE</var>} \quad\quad = ?</code></p>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
27 <div class="graph" style="width: 400px; height: 400px; font-size: 15px; font-family: sans-serif; font-style: bold; stroke: blue;" data-graph-type="plane">
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
28 plot('(' + quadratic + LINE + ')/' + LINE);
9c227ad @jeresig Refine the definition of graphs, implement a basic API. Fixes #5.
jeresig authored
29 ASdot([a, limtoa], 4, "black", "white");
30 </div>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
31 <p class="solution"><code><var>limtoa</var></code></p>
32 <ul class="choices" data-show="5" data-none="true">
33 <li><code>0</code></li>
34 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
35 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
36 <li><code><var>q_lcoef</var></code></li>
37 <li><code><var>l_cons</var></code></li>
38 <li><code><var>curFunc(0)</var></code></li>
39 <li>Does not exist.</li>
40 </ul>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
41 </div>
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
42 <div>
43 <div class="vars">
44 <var id="abs_coef">nonZeroRandomInt(-5, 5)</var>
45 <var id="abs_cons">nonZeroRandomInt(-7, 7)</var>
46 <var id="curFunc">function(x) {
47 return x + abs_cons > 0 ?
48 abs_coef :
49 abs_coef * -1;
50 }</var>
51 <var id="a">abs_cons * -1</var>
52 <var id="limtoa">curFunc(a)</var>
53 <var id="l_limtoa">abs_coef * -1</var>
54 <var id="r_limtoa">abs_coef</var>
55 </div>
56
57 <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>
58 <div class="graph" style="width: 400px; height: 400px; font-size: 15px; font-family: sans-serif; font-style: bold; stroke: blue;" data-graph-type="plane">
59 line([-11, abs_coef * -1], [-1 * abs_cons, abs_coef * -1]);
60 line([-1 * abs_cons, abs_coef], [11, abs_coef]);
61
62 ASdot([-1 * abs_cons, -1 * abs_coef], 4, "black", "white");
63 ASdot([-1 * abs_cons, abs_coef], 4, "black", "white");
64 </div>
65 <p class="solution">Does not exist.</p>
66 <ul class="choices" data-show="5" data-none="true">
67 <li><code>0</code></li>
68 <li><code><var>a</var></code></li>
69 <li><code><var>abs_cons</var></code></li>
70 <li><code><var>abs_coef</var></code></li>
71 <li><code><var>abs_coef * -1</var></code></li>
72 <li><code><var>abs_coef * abs_coef</var></code></li>
73 <li><code><var>abs_coef * abs_coef * -1</var></code></li>
74 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
75 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
76 </ul>
77 <div class="hints">
78 <p class="final">The limit as we approach from the left doesn't match the limit as we approach from the right, so <code>\lim_{x\to<var>a</var>}</code> doesn't exist.</p>
79 </div>
80 </div>
81 <div>
82 <div class="vars">
83 <var id="l_coef">nonZeroRandomInt(-3, 3)</var>
84 <var id="l_cons">nonZeroRandomInt(-4, 4)</var>
85 <var id="d_cons">nonZeroRandomInt(-7, 7)</var>
86 <var id="d_line">cleanMath(l_coef + 'x + ' + l_cons)</var>
87 <var id="curFunc">function(x) {
88 return l_coef * x + l_cons;
89 }</var>
90 <var id="a0">ceil((-10 - l_cons)/l_coef)</var>
91 <var id="a1">floor((10 - l_cons)/l_coef)</var>
92 <var id="a">l_coef > 0 ? nonZeroRandomInt(a0, a1) : nonZeroRandomInt(a1, a0)</var>
93 <var id="limtoa">curFunc(a)</var>
94 <var id="l_limtoa">limtoa</var>
95 <var id="r_limtoa">limtoa</var>
96 </div>
97
98 <p><code>\begin{align*}
99 \lim_{x\to<var>a</var>} f(x) & \\
100 \text{where} \quad f(x) & = \left \{
101 \begin{array}{1 1}
102 <var>d_line</var> &\quad \text{if} \quad x \neq <var>a</var>\\
103 <var>d_cons</var> &\quad \text{if} \quad x = <var>a</var>\\
104 \end{array} \right.
105 \end{align*}</code></p>
106 <div class="graph" style="width: 400px; height: 400px; font-size: 15px; font-family: sans-serif; font-style: bold; stroke: blue;" data-graph-type="plane">
107 plot(d_line);
108 ASdot([a, limtoa], 4, "black", "white");
109 ASdot([a, d_cons], 4, "blue", "blue");
110 </div>
111 <p class="solution"><code><var>limtoa</var></code></p>
112 <ul class="choices" data-show="5" data-none="true">
113 <li><code>0</code></li>
114 <li><code><var>a</var></code></li>
115 <li><code><var>d_cons</var></code></li>
116 <li><code><var>l_coef</var></code></li>
117 <li><code><var>fraction(l_cons * -1, l_coef)</var></code></li>
118 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
119 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
120 <li>Does not exist.</li>
121 </ul>
122 </div>
123 <div>
124 <div class="vars">
125 <var id="q_coef">nonZeroRandomInt(-3, 3)</var>
126 <var id="q_cons">nonZeroRandomInt(-3, 3)</var>
127 <var id="edge">floor(sqrt(abs((10 - q_cons) / q_lcoef)))</var>
128 <var id="a">nonZeroRandomInt(-1 * edge, edge)</var>
129 <var id="curFunc">function(x) {
130 return q_lcoef * Math.pow(x, 2) + q_cons;
131 }</var>
132 <var id="limtoa">curFunc(a)</var>
133 <var id="l_limtoa">limtoa</var>
134 <var id="r_limtoa">limtoa</var>
135 </div>
136
137 <p><code>\lim_{x\to<var>a</var>} <var>q_lcoef</var>x^2 + <var>q_cons</var> \quad\quad = ?</code></p>
138 <div class="graph" style="width: 400px; height: 400px; font-size: 15px; font-family: sans-serif; font-style: bold; stroke: blue;" data-graph-type="plane">
139 plot(q_lcoef + 'x^2 + ' + q_cons);
140 </div>
141 <p class="solution"><code><var>limtoa</var></code></p>
142 <ul class="choices" data-show="5" data-none="true">
143 <li><code>0</code></li>
144 <li><code><var>curFunc(0)</var></code></li>
145 <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
146 <li><code><var>q_cons</var></code></li>
147 <li><code><var>q_cons * -1</var></code></li>
148 <li>Does not exist.</li>
149 </ul>
150 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
151 </div>
190610b @jeresig Retool framework, move Math and Graph logic out of khan-exercise.js a…
jeresig authored
152
0ac33f7 @jeresig Finish implementing the Limits 1 exercise. Add some table formatting …
jeresig authored
153 <div class="hints">
154 <div>
155 <p>What happens as we approach <code>x = <var>a</var></code> from the left?</p>
156 <div class="graph update" style="stroke: orange; marker: arrow;">
157 line([a > 0 ? 0 : a + a, 0], [a, 0]);
158 </div>
159 </div>
160 <div>
161 <table class="limit">
162 <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>
163 <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>
164 </table>
165 It looks like <code>f(x)</code> is approaching <var>l_limtoa</var> from the left.
166 <div class="graph update" style="stroke: purple;">
167 line([a, 0], [a, l_limtoa]);
168 </div>
169 </div>
170 <div>
171 <p>When we approach <code>x = <var>a</var></code> from the right, we get:</p>
172 <table class="limit">
173 <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>
174 <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>
175 </table>
176 It looks like <code>f(x)</code> is approaching <var>r_limtoa</var> from the right.
177 <div class="graph update" style="stroke: green; marker: arrow;">
178 line([a < 0 ? 0 : a + a, 0], [a, 0]);
179 </div>
180 <div class="graph update" style="stroke: purple;">
181 line([a, 0], [a, r_limtoa]);
182 </div>
183 </div>
184 <p class="final">So <code>\lim_{x\to<var>a</var>} = <var>limtoa</var></code></p>
185 </div>
d4e52bd @jeresig I got something to draw! A chart is showing up now, rendering content…
jeresig authored
186 </div>
187 </body>
188 </html>
Something went wrong with that request. Please try again.