Permalink
Browse files

I got something to draw! A chart is showing up now, rendering content…

… from an exercise. It's not, in any way, ready to be used in a more general sense.
  • Loading branch information...
1 parent f1b4c38 commit d4e52bd02c75f41541034985d624747ac9b8cc8e @jeresig jeresig committed May 17, 2011
Showing with 900 additions and 0 deletions.
  1. +58 −0 exercises/limits_1.html
  2. +830 −0 utils/graph.js
  3. +12 −0 utils/math.js
View
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html data-require="math graph">
+<head>
+ <title>Limits 1</title>
+ <script src="../khan-exercise.js"></script>
+</head>
+<body><div id="raphael_container"></div>
+ <div id="vars">
+ <var id="q_lcoef">nonZeroRandomInt(-3, 3)</var>
+ <var id="edge">floor(sqrt(abs(10 / q_lcoef)))</var>
+ <var id="l_cons">nonZeroRandomInt(-1 * edge, edge)</var>
+ <var id="quadratic">q_lcoef + 'x^2'</var>
+ <var id="line">cleanMath('(x + ' + l_cons + ')')</var>
+ <var id="curFunc">function(x) {
+ return truncate_to_max(q_lcoef * Math.pow(x, 2), 4);
+ }</var>
+ <var id="a">-1 * l_cons</var>
+ <var id="limtoa">curFunc(a)</var>
+ <var id="l_limtoa">limtoa</var>
+ <var id="r_limtoa">limtoa</var>
+ <var id="blah">(function(){
+ RaphaelWrapper.init(400, 400);
+ RaphaelWrapper.drawPlane( -10, 10, -10, 10 )
+
+ present.fontsize = "15";
+ present.fontfamily = "sans-serif";
+ present.fontstyle = "bold";
+
+ present.stroke = "blue";
+
+ present.plot('(' + quadratic + line + ')/' + line);
+ present.ASdot([a, limtoa], 4, "black", "white");
+ })()</var>
+ </div>
+
+ <div id="problems">
+ <div id="original" class="problem">
+ <div class="problem">
+
+ </div>
+ <p class="question"><code>\lim_{x\to<var>a</var>} \dfrac{<var>quadratic</var><var>line</var>}{<var>line</var>} = ?</code></p>
+ <p class="solution"><code><var>limtoa</var></code></p>
+ <ul class="choices" data-show="5" data-none="true">
+ <li><code>0</code></li>
+ <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
+ <li><code><var>nonZeroRandomInt(-3, 3)</var></code></li>
+ <li><code><var>q_lcoef</var></code></li>
+ <li><code><var>l_cons</var></code></li>
+ <li><code><var>curFunc(0)</var></code></li>
+ <li>Does not exist.</li>
+ </ul>
+ <div class="hint"></div>
+ </div>
+ </div>
+
+ <div id="hints"></div>
+</body>
+</html>
Oops, something went wrong.

0 comments on commit d4e52bd

Please sign in to comment.