# Khan/khan-exercises

### Subversion checkout URL

You can clone with
or
.
Older
100644 241 lines (228 sloc) 8.439 kB
 d4e52bd I got something to draw! A chart is showing up now, rendering content… jeresig authored May 17, 2011 1 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 2 d4e52bd I got something to draw! A chart is showing up now, rendering content… jeresig authored May 17, 2011 3 4 Limits 1 5 6 190610b Retool framework, move Math and Graph logic out of khan-exercise.js a… jeresig authored May 18, 2011 7 8
9
0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 10
adcc771 Implement problem-specific var blocks. Fixes #3. jeresig authored May 19, 2011 11
3601211 Rename nonzero random range function osnr authored May 23, 2011 12 randRangeNonZero(-3, 3) adcc771 Implement problem-specific var blocks. Fixes #3. jeresig authored May 19, 2011 13 floor(sqrt(abs(10 / q_lcoef))) 3601211 Rename nonzero random range function osnr authored May 23, 2011 14 randRangeNonZero(-1 * edge, edge) adcc771 Implement problem-specific var blocks. Fixes #3. jeresig authored May 19, 2011 15 q_lcoef + 'x^2' 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 16 cleanMath('(x + ' + l_cons + ')') adcc771 Implement problem-specific var blocks. Fixes #3. jeresig authored May 19, 2011 17 function(x) { 18 return truncate_to_max(q_lcoef * Math.pow(x, 2), 4); 19 } 20 -1 * l_cons 21 curFunc(a) 22 limtoa 23 limtoa 24
cf02179 Strip trailing whitespace spicyj authored Jun 1, 2011 25 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 26

27
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 Refine the definition of graphs, implement a basic API. Fixes #5. jeresig authored May 18, 2011 44
190610b Retool framework, move Math and Graph logic out of khan-exercise.js a… jeresig authored May 18, 2011 45

limtoa

46
47
• 0
• 3601211 Rename nonzero random range function osnr authored May 23, 2011 48
• randRangeNonZero(-3, 3)
• 49
• randRangeNonZero(-3, 3)
• 190610b Retool framework, move Math and Graph logic out of khan-exercise.js a… jeresig authored May 18, 2011 50
• q_lcoef
• 51
• l_cons
• 52
• curFunc(0)
• 53
• Does not exist.
• 54
d4e52bd I got something to draw! A chart is showing up now, rendering content… jeresig authored May 17, 2011 55
0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 56
57
3601211 Rename nonzero random range function osnr authored May 23, 2011 58 randRangeNonZero(-5, 5) 59 randRangeNonZero(-7, 7) 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 60 function(x) { 61 return x + abs_cons > 0 ? 62 abs_coef : 63 abs_coef * -1; 64 } 65 abs_cons * -1 66 curFunc(a) 67 abs_coef * -1 68 abs_coef 69
cf02179 Strip trailing whitespace spicyj authored Jun 2, 2011 70 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 71

3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 72
73 graphInit({ 74 range: 10, 75 scale: 20, 76 tickStep: 1, 77 axisArrows: "->" 78 }); 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 79 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 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 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 89
90

Does not exist.

91
92
• 0
• 93
• a
• 94
• abs_cons
• 95
• abs_coef
• 96
• abs_coef * -1
• 97
• abs_coef * abs_coef
• 98
• abs_coef * abs_coef * -1
• 3601211 Rename nonzero random range function osnr authored May 23, 2011 99
• randRangeNonZero(-3, 3)
• 100
• randRangeNonZero(-3, 3)
• 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 101
f4cce3f fix exercises to use new templating jochu authored Jun 1, 2011 102
3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 103

The limit as we approach from the left doesn't match the limit as we approach from the right, so f(x) has no limit as x \to a.

0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 104
105
106
107
3601211 Rename nonzero random range function osnr authored May 23, 2011 108 randRangeNonZero(-3, 3) 109 randRangeNonZero(-4, 4) 110 randRangeNonZero(-7, 7) 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 111 cleanMath(l_coef + 'x + ' + l_cons) 112 function(x) { 113 return l_coef * x + l_cons; 114 } 115 ceil((-10 - l_cons)/l_coef) 116 floor((10 - l_cons)/l_coef) 3601211 Rename nonzero random range function osnr authored May 23, 2011 117 l_coef > 0 ? randRangeNonZero(a0, a1) : randRangeNonZero(a1, a0) 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 118 curFunc(a) 119 limtoa 120 limtoa 121
cf02179 Strip trailing whitespace spicyj authored Jun 2, 2011 122 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 123

\begin{align*} e7642f8 HTML5 ampersands are fine as long as they are not ambiguous spicyj authored Jun 24, 2011 124 \lim_{x\toa} f(x) & \\ 125 \text{where} \quad f(x) & = \left \{ 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 126 \begin{array}{1 1} bd44359 Fix a bunch of missing variables, like in equation of a line spicyj authored Jun 28, 2011 127 d_line &\quad \text{if} \quad x \neq a\\ 128 d_cons &\quad \text{if} \quad x = a\\ 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 129 \end{array} \right. 130 \end{align*}

3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 131
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 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 149
150

limtoa

151
152
• 0
• 153
• a
• 154
• d_cons
• 155
• l_coef
• 7149ebc replaced previous invocations of fraction with fractionReduce now tha… jruberg authored Jun 10, 2011 156
• fractionReduce(l_cons * -1, l_coef)
• 3601211 Rename nonzero random range function osnr authored May 23, 2011 157
• randRangeNonZero(-3, 3)
• 158
• randRangeNonZero(-3, 3)
• 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 159
• Does not exist.
• 160
161
162
163
3601211 Rename nonzero random range function osnr authored May 23, 2011 164 randRangeNonZero(-3, 3) 165 randRangeNonZero(-3, 3) 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 166 floor(sqrt(abs((10 - q_cons) / q_lcoef))) 3601211 Rename nonzero random range function osnr authored May 23, 2011 167 randRangeNonZero(-1 * edge, edge) 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 168 function(x) { 169 return q_lcoef * Math.pow(x, 2) + q_cons; 170 } 171 curFunc(a) 172 limtoa 173 limtoa 174
175 176

3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 177
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 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 192
193

limtoa

194
195
• 0
• 196
• curFunc(0)
• 3601211 Rename nonzero random range function osnr authored May 23, 2011 197
• randRangeNonZero(-3, 3)
• 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 198
• q_cons
• 199
• q_cons * -1
• 200
• Does not exist.
• 201
202
d4e52bd I got something to draw! A chart is showing up now, rendering content… jeresig authored May 17, 2011 203
cf02179 Strip trailing whitespace spicyj authored Jun 2, 2011 204 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 205
206
207

What happens as we approach x = a from the left?

3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 208
209 line( [a - 2, 0], [a, 0], { 210 stroke: "#ff00af", 211 arrows: "->" 212 }); 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 213
214
215
216 217
xa - 0.1a - 0.01a - 0.001
f(x)curFunc(a - 0.1).toFixed(4)curFunc(a - 0.01).toFixed(4)curFunc(a - 0.001).toFixed(4)
218 219 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 220 It looks like f(x) is approaching l_limtoa from the left. 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 221 222
223

When we approach x = a from the right, we get:

224 225
xa + 0.1a + 0.01a + 0.001
f(x)curFunc(a + 0.1).toFixed(4)curFunc(a + 0.01).toFixed(4)curFunc(a + 0.001).toFixed(4)
226 227 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 228 It looks like f(x) is approaching r_limtoa from the right. 229
230 line( [a + 2, 0], [a, 0], { 231 stroke: "#ff00af", 232 arrows: "->" 233 }); 0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 234
235 3cd4d79 graphie for limits_1 spicyj authored Jul 14, 2011 236

So the limit is limtoa.

0ac33f7 Finish implementing the Limits 1 exercise. Add some table formatting … jeresig authored May 19, 2011 237 d4e52bd I got something to draw! A chart is showing up now, rendering content… jeresig authored May 17, 2011 238 239 4627f1f Move graph style stuff to the data-style attribute, so browsers don't… osnr authored May 25, 2011 240
Something went wrong with that request. Please try again.