Permalink
Browse files

add basic polynomial intuition exercise

  • Loading branch information...
jeffdyer committed Jan 18, 2012
1 parent b5c2b40 commit 906de7f54148444c4d7a17f2898fb2b7fe719d13
Showing with 70 additions and 19 deletions.
  1. +58 −0 exercises/polynomial_intuition_0.html
  2. +1 −1 utils/ast.js
  3. +11 −18 utils/math-model.js
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html data-require="math graphie ast math-model">
+ <head>
+ <meta charset="UTF-8" />
+ <title>Polynomial Intuition</title>
+ <script src="../khan-exercise.js"></script>
+ </head>
+ <body>
+ <div class="exercise">
+ <div class="problems">
+ <div>
+ <div class="vars">
+ <var id="MATH">MathModel.init()</var>
+ <var id="DEGREE">randRange(0, 4)</var>
+ <var id="SIGN">randRangeNonZero(-1, 1)</var>
+ <var id="P">MATH.parse(SIGN+"*x^"+DEGREE)</var>
+ </div>
+ <div>
+ <p class="question">
+ What is the degree of the polynomial function graphed below?
+ </p>
+ <div class="graphie" id="poly">
+ MATH.graph(P, BLUE, 17)
+ </div>
+ </div>
+ <div class="solution" data-type="text">
+ <var>DEGREE</var>
+ </div>
+ <div class="hints">
+ <p>
+ The degree of a polynomial determines the rate at which its value increases as a function
+ of its variable.
+ </p>
+ <div>
+ <p>
+ One way to determine the degree of polynomial function is by experimenting with different values
+ for its variable. In the graph above, we see that:
+ </p>
+ <p>
+ <code>f(-2)=<var>MATH.eval(P, {x:-2})</var></code><br>
+ <code>f(-1)=<var>MATH.eval(P, {x:-1})</var></code><br>
+ <code>f(0)=<var>MATH.eval(P, {x:0})</var></code><br>
+ <code>f(1)=<var>MATH.eval(P, {x:1})</var></code><br>
+ <code>f(2)=<var>MATH.eval(P, {x:2})</var></code><br>
+ </p>
+ </div>
+ <p>
+ The value of the function is changing at a rate of <code><var>MATH.format("x^"+DEGREE)</var></code>.
+ </p>
+ <p>
+ Therefore we know that the polynomial function is of degree <code><var>MATH.format(DEGREE)</var></code>.
+ </p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
View
@@ -19,7 +19,7 @@
jQuery.extend ( KhanUtil, {
- ASSERT: true,
+ ASSERT: false,
assert: function (val, str) {
if ( !this.ASSERT ) {
View
@@ -82,19 +82,7 @@ jQuery.extend ( KhanUtil, {
// private implementation
- function graphInit() {
- var graph = KhanUtil.currentGraph;
-
- graph.graphInit({
- range: 11,
- scale: 20,
- axisArrows: "&lt;-&gt;",
- tickStep: 1,
- labelStep: 1
- });
- }
-
- function graph(n, color) {
+ function graph(n, color, range) {
var graph = KhanUtil.currentGraph;
function g(x) {
@@ -104,6 +92,11 @@ jQuery.extend ( KhanUtil, {
return val;
}
+ if (!range) {
+ range = 10;
+ }
+
+
if (graph.last) {
jQuery(graph).remove();
graph.last.remove();
@@ -112,15 +105,15 @@ jQuery.extend ( KhanUtil, {
stroke: color,
strokeWidth: 3,
fill: "none",
- clipRect:[ [-10, -10], [20, 20] ],
+ clipRect:[ [-range, -range], [2*range, 2*range] ],
arrows: null
});
graph.last = graph.plot( g, [-10, 10] );
}
else {
graph.graphInit({
- range: 11,
+ range: range+1,
scale: 20,
axisArrows: "&lt;-&gt;",
tickStep: 1,
@@ -130,12 +123,12 @@ jQuery.extend ( KhanUtil, {
stroke: color,
strokeWidth: 3,
fill: "none",
- clipRect:[ [-10, -10], [20, 20] ],
+ clipRect:[ [-range, -range], [2*range, 2*range] ],
arrows: null
});
- graph.plot( g, [-10, 10] );
- graph.last = graph.plot( g, [-10, 10] );
+ graph.plot( g, [-range, range] );
+ graph.last = graph.plot( g, [-range, range] );
}
}

0 comments on commit 906de7f

Please sign in to comment.