# Khan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Add alternative hints to some exercises for A/B testing

beneater authored
289 exercises/test/counting_1_alternative.html
 @@ -0,0 +1,289 @@ + + + + + Counting 1 + + + +
+
+
+
+ randRange( 20, 50 ) + randRange( 20, 40 ) + START + ANSWER - 1 + spin( "{do,did,done,problem|read,read,read,{page|paper|article}}" ).split( "," ) + plural( PROBLEM ) +
+

+ person( 1 ) {had to DO|was assigned} PROBLEMS START through + END for homework {{last {week|night}}|tonight}. +

+

+ If person( 1 ) DID all of the PROBLEMS he( 1 ) was assigned, how + many PROBLEMS did he( 1 ) DO? +

+ +
+

+
+ +
+

+ Instead of counting PROBLEMS START through + END, we can subtract + START - 1 from each number so we can count the + PROBLEMS starting from 1. +

+ +
+

+

+

+ \qquad \array{ + \hspace{40px} & + \hspace{40px} & + \hspace{40px} & + \hspace{40px} & \\ + + \color{GREEN}{START} & + \color{GREEN}{START + 1} & + \color{GREEN}{START + 2} & & + \color{GREEN}{END} \\ + + \color{BLUE}{\downarrow} & + \color{BLUE}{\downarrow} & + \color{BLUE}{\downarrow} & & + \color{BLUE}{\downarrow} \\ + + \color{BLUE}{\llap{-}START-1} & + \color{BLUE}{\llap{-}START-1} & + \color{BLUE}{\llap{-}START-1} & \cdots\hphantom{-} & + \color{BLUE}{\llap{-}START-1} \\ + + \color{BLUE}{\downarrow} & + \color{BLUE}{\downarrow} & + \color{BLUE}{\downarrow} & & + \color{BLUE}{\downarrow} \\ + + \color{PINK}{1} & + \color{PINK}{2} & + \color{PINK}{3} & & + \color{PINK}{ANSWER} \\ + } +

+
+ +

+ Now instead of thinking about PROBLEMS START + through END, we can think about how many PROBLEMS + person( 1 ) would have DONE if he( 1 ) were assigned + PROBLEMS 1 though ANSWER. +

+ +

+ When we think about it this way, we can see that person( 1 ) would have DONE + ANSWER PROBLEMS. Hopefully it also makes sense why we can't just subtract + the first problem number from the last problem number, since if person( 1 ) were + assigned PROBLEMS 1 through ANSWER, he( 1 ) was assigned ANSWER + PROBLEMS, not ANSWER-1. +

+ +

person( 1 ) DID ANSWER PROBLEMS.

+
+
+ +
+
+ randRange( 5, 15 ) +
+

A baker has a whole {baguette|loaf of bread}.

+

How many cuts must {he|she} make to have exactly NUM even slices?

+
+

NUM -1 cuts

+
+
+
+
+ init({ + range: [ [ -1.5, 18.5 ], [ -4, -0.5 ] ], + scale: [ 30, 50 ] + }); + + graph.loaf = raphael.set(); + graph.labels = []; + + graph.drawLoaf = function( slices ) { + var width = 10 + ( slices - 1 ) * 0.5; + + graph.loaf.remove(); + jQuery.each( graph.labels, function() { + this.remove(); + }); + + style({ stroke: "black", fill: ORANGE, opacity: 0.3 }, function() { + graph.loaf.push( arc([ 0.6, -2 ], 1, 90, 270, false ) ); + graph.loaf.push( arc([ width - 0.6, -2 ], 1, 270, 90, false ) ); + for ( var slice = 0; slice < slices; slice++ ) { + if ( slice === 0 ) { + graph.loaf.push( path([ [ 0.6, -1 ], + [ 10 * ( slice + 1 ) / slices + slice * 0.5, -1 ], + [ 10 * ( slice + 1 ) / slices + slice * 0.5, -3 ], + [ 0.6, -3 ] ]) ); + } else if ( slice === slices - 1 ) { + graph.loaf.push( path([ + [ 10 * ( slice + 1 ) / slices + slice * 0.5 - 0.6, -3 ], + [ 10 * slice / slices + slice * 0.5, -3 ], + [ 10 * slice / slices + slice * 0.5, -1 ], + [ 10 * ( slice + 1 ) / slices + slice * 0.5 - 0.6, -1 ] ]) ); + } else { + graph.loaf.push( path([ [ 10 * slice / slices + slice * 0.5, -1 ], + [ 10 * ( slice + 1 ) / slices + slice * 0.5, -1 ], + [ 10 * ( slice + 1 ) / slices + slice * 0.5, -3 ], + [ 10 * slice / slices + slice * 0.5, -3 ], + [ 10 * slice / slices + slice * 0.5, -1 ] ]) ); + } + graph.labels.push( + label( [ 10 * ( slice + 0.5 ) / slices + slice * 0.5, -2 ], slice+1, "", false ) + .css({ fontWeight: "bold", opacity: 1 }) + ); + if ( slice !== 0 ) { + graph.labels.push( + label( [ 10 * slice / slices + slice * 0.5 - 0.2, -3 ], slice, "below", false ) + .addClass( "hint_blue" ).css({ fontWeight: "bold", opacity: 1 }) + ); + } + } + }); + + return loaf; + }; + + graph.drawLoaf( 2 ); + +
+

One cut will make two slices.

+
+ +
+
+ graph.drawLoaf( 3 ); +
+

Two cuts will make three slices, and so on.

+
+ +
+
+ graph.drawLoaf( NUM ); +
+

+ Therefore, we need NUM - 1 cuts to make NUM slices. +

+
+
+
+ +
+
+ randRange( 10, 20 ) +
+

person( 1 ) is building a straight fence, with posts one meter apart.

+

+ If the fence is LENGTH meters long, how many fence posts does he( 1 ) need? +

+
+

LENGTH + 1 fence posts

+
+
+
+
+ init({ + range: [ [ -1, LENGTH + 1 ], [ -2, 3.5 ] ], + scale: [ 600 / ( LENGTH + 2 ), 20 ] + }); + + style({ stroke: null, fill: BLUE, opacity: 0.3 }, function() { + path([ [ 0, 0 ], [ 0, 1.8 ], [ 1, 1.8 ], [ 1, 0 ], [ 0, 0 ] ]); + }); + + style({ stroke: GREEN, strokeWidth: 3 }, function() { + line( [ 0, 0 ], [ 0, 2 ] ); + line( [ 1, 0 ], [ 1, 2 ] ); + }); + label( [ 0, 1.8 ], "1", "above", false ).css({ color: GREEN }); + label( [ 1, 1.8 ], "2", "above", false ).css({ color: GREEN }); + + style({ stroke: BLUE, strokeWidth: 2 }, function() { + graph.brace = path([ [ 0, -0.2 ], [ 0, -0.4 ], [ 0.5, -0.4 ], [ 0.5, -0.6 ], [ 0.5, -0.4 ], + [ 1, -0.4 ], [ 1, -0.2 ] ]); + }); + graph.length = label( [ 0.5, -0.4 ], "1 meter", "below", false ).css({ color: BLUE }); + +
+

+ If the fence is one meter long, he( 1 ) needs + two posts (one for each end). +

+
+ +
+
+ style({ stroke: null, fill: BLUE, opacity: 0.3 }, function() { + path([ [ 1, 0 ], [ 1, 1.8 ], [ 2, 1.8 ], [ 2, 0 ], [ 1, 0 ] ]); + }); + + style({ stroke: GREEN, strokeWidth: 3 }, function() { + line( [ 1, 0 ], [ 1, 2 ] ); + line( [ 2, 0 ], [ 2, 2 ] ); + }); + label( [ 2, 1.8 ], "3", "above", false ).css({ color: GREEN }); + + graph.brace.remove(); + graph.length.remove(); + style({ stroke: BLUE, strokeWidth: 2 }, function() { + graph.brace = path([ [ 0, -0.2 ], [ 0, -0.4 ], [ 1, -0.4 ], [ 1, -0.6 ], [ 1, -0.4 ], + [ 2, -0.4 ], [ 2, -0.2 ] ]); + }); + graph.length = label( [ 1, -0.4 ], "2 meters", "below", false ).css({ color: BLUE }); +
+

+ If the fence is two meters long, then he( 1 ) needs + three posts, and so on. +

+
+ +
+
+ for ( var x = 2; x < LENGTH; x++ ) { + style({ stroke: null, fill: BLUE, opacity: 0.3 }, function() { + path([ [ x, 0 ], [ x, 1.8 ], [ x + 1, 1.8 ], [ x + 1, 0 ], [ x, 0 ] ]); + }); + + style({ stroke: GREEN, strokeWidth: 3 }, function() { + line( [ x, 0 ], [ x, 2 ] ); + line( [ x + 1, 0 ], [ x + 1, 2 ] ); + }); + label( [ x + 1, 1.8 ], x + 2, "above", false ).css({ color: GREEN }); + } + + graph.brace.remove(); + graph.length.remove(); + style({ stroke: BLUE, strokeWidth: 2 }, function() { + graph.brace = path([ [ 0, -0.2 ], [ 0, -0.4 ], [ LENGTH/2, -0.4 ], [ LENGTH/2, -0.6 ], + [ LENGTH/2, -0.4 ], [ LENGTH, -0.4 ], [ LENGTH, -0.2 ] ]); + }); + graph.length = label( [ LENGTH / 2, -0.4 ], LENGTH + " meters", "below", false ).css({ color: BLUE }); +
+

+ Therefore, for his( 1 ) LENGTH meter fence, + person( 1 ) needs LENGTH + 1 posts. +

+
+
+
+ +
+
+ +
1,026 exercises/test/dividing_fractions_alternative.html
 @@ -0,0 +1,1026 @@ + + + + + + + + + khan-exercises/exercises/dividing_fractions.html at c9e71ee19fd9729fcd5bf08dc0c696787b9f3d83 · Khan/khan-exercises · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+ +
+
+ + + +
+ +

+ public + + / + khan-exercises +

+
+ + + + + +
name
+ + + + + + + + + + + +
+ + + + + + +
+ +
+ + +
+ +
Switch branches/tags
+
+
+ +
+
+ +
+
Nothing to show
+
+ +

+ accuracy-model +

+
+
+ +

+ chemistry +

+
+
+ +

+ colorpicker +

+
+
+ +

+ hint-quality +

+
+
+ +

+ lint +

+
+
+ +

+ master +

+
+
+ +

+ meatglue +

+
+
+ +

+
+
+ +

+ refactor +

+
+
+ +

+ serial-requests +

+
+
+ +

+ software-keyboard +

+
+
+ +

+ tests +

+
+
+ + +
+
+
+
+ + + +
+ + + + + + + + + + +
+ + + + + + + +
+ + + + +
+ + + + + +
+

7 contributors

+ + + + + + + + + +
+ +
+ + +
+
+ +
+
+
+
+ + file + 118 lines (104 sloc) + 5.139 kb +
+
+
+
+ +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+
+
+
<!DOCTYPE html>
<html data-require="math math-format">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Dividing fractions</title>
<script src="../khan-exercise.js"></script>
<body>
<div class="exercise">
<div class="vars" data-ensure="getGCD(N1, D1) === 1 && getGCD(N2, D2) === 1">
<var id="NEG1">randFromArray([1, -1])</var>
<var id="NEG1S">NEG1 === -1 ? "-" : ""</var>
<var id="N1">randRange(1, 9)</var>
<var id="D1">randRange(2, 9)</var>

<var id="NEG2">randFromArray([1, -1])</var>
<var id="NEG2S">NEG2 === -1 ? "-" : ""</var>
<var id="N2">randRange(1, 9)</var>
<var id="D2">randRange(2, 9)</var>

<var id="GCD1">getGCD( N1, N2 )</var>
<var id="SIMP_N1">N1 / GCD1</var>
<var id="SIMP_N2">N2 / GCD1</var>

<var id="GCD2">getGCD( D1, D2 )</var>
<var id="SIMP_D1">D1 / GCD2</var>
<var id="SIMP_D2">D2 / GCD2</var>

</div>

<div class="problems">
<div>
<div class="problem">Reduce to lowest terms:</div>
<div class="question">
<p><code><var>NEG1S</var> \dfrac{<var>N1</var>}{<var>D1</var>} \div <var>NEG2S</var> \dfrac{<var>N2</var>}{<var>D2</var>} = {?}</code></p>
</div>
<div class="solution" data-type="rational"><var>(NEG1 * N1 * NEG2 * D2) / (D1 * N2)</var></div>
</div>
</div>

<div class="hints">
<p>Dividing by a fraction is the same as multiplying by the reciprocal.</p>
<p>The reciprocal of <code class="hint_green"><var>NEG2S</var> \dfrac{<var>N2</var>}{<var>D2</var>}</code> is <code class="hint_blue"><var>NEG2S</var> \dfrac{<var>D2</var>}{<var>N2</var>}</code>. We just flipped the numerator and denominator.

<div>
<p>
Since multiplying by the reciprocal is the same as dividing, lets use the reciprocal to change the problem into a multiplication problem:
</p>
<p><code>
\begin{eqnarray}
<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \color{<var>GREEN</var>}{\div <var>NEG2S</var> \frac{<var>N2</var>}{<var>D2</var>}}
<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \color{<var>BLUE</var>}{\times <var>NEG2S</var> \frac{<var>D2</var>}{<var>N2</var>}}
\end{eqnarray}
</code></p>
</div>

<div>
<p>
Because we're now multiplying fractions instead of dividing them, all we have to do is multiply the numerators and the denominators:
</p>
<p><code>
\begin{eqnarray}
\hphantom{<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \div \color{<var>GREEN</var>}{<var>NEG2S</var> \frac{<var>N2</var>}{<var>D2</var>}}}
\dfrac{<var>NEG1S</var> <var>N1</var> \times \color{<var>BLUE</var>}{<var>NEG2S</var> <var>D2</var>}}{<var>D1</var> \times \color{<var>BLUE</var>}{<var>N2</var>}}
\end{eqnarray}
</code></p>
</div>

<div data-if="GCD1 !== 1 || GCD2 !== 1" data-unwrap>
<p>
We could just multiply everything to get <code>\frac{<var>NEG1 * NEG2 * N1 * D2</var>}{<var>N2 * D1</var>}</code>
and then try to reduce that to get the final answer, but it's easier if we can find and reduce some common factors before we multiply.
</p>
<div>
<p>In this case, we can <span class="hint_pink">divide</span> the <code class="hint_blue"><var>NEG2 * D2</var></code> in the numerator and the <code><var>D1</var></code>
in the denominator <span class="hint_pink">by <code><var>GCD2</var></code></span>:</p>
<p><code>
\begin{eqnarray}
\hphantom{<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \div \color{<var>GREEN</var>}{<var>NEG2S</var> \frac{<var>N2</var>}{<var>D2</var>}}}
\dfrac{<var>NEG1S</var> <var>N1</var> \times \color{<var>PINK</var>}{\cancel{\color{<var>BLUE</var>}{<var>NEG2S</var> <var>D2</var>}}^{<var>NEG2S</var><var>SIMP_D2</var>}}}{\color{<var>PINK</var>}{\cancel{\color{black}{<var>D1</var>}}^{<var>SIMP_D1</var>}} \times \color{<var>BLUE</var>}{<var>N2</var>}} \\ \\
\dfrac{<var>NEG1S</var> <var>N1</var> \times \color{<var>PINK</var>}{<var>NEG2S</var><var>SIMP_D2</var>}}{\color{<var>PINK</var>}{<var>SIMP_D1</var>} \times \color{<var>BLUE</var>}{<var>N2</var>}}
\end{eqnarray}
</code></p>
</div>

<div>
<p class="final_answer">After reducing the common factors, it's easier to multiply and get the simplified answer:</p>
<p><code>
\begin{eqnarray}
\hphantom{\color{gray}{<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \div <var>NEG2S</var> \frac{<var>N2</var>}{<var>D2</var>}}}
<var>fractionReduce(NEG1 * N1 * NEG2 * D2, D1 * N2)</var>
\end{eqnarray}
</code></p>
</div>
</div>

<div data-else>
<p class="final_answer">Just multiply to get the final answer. Double-check that it's simplified:</p>
<p><code>
\begin{eqnarray}
\hphantom{\color{gray}{<var>NEG1S</var> \frac{<var>N1</var>}{<var>D1</var>} \div <var>NEG2S</var> \frac{<var>N2</var>}{<var>D2</var>}}}
<var>fractionReduce(NEG1 * N1 * NEG2 * D2, D1 * N2)</var>
\end{eqnarray}
</code></p>
</div>

</div>
</div>
</body>
</html>
+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+

Markdown Cheat Sheet

+ +
+ +
+
+

Format Text

+

+
+# This is an <h1> tag
+## This is an <h2> tag
+###### This is an <h6> tag
+

Text styles

+
+*This text will be italic*
+_This will also be italic_
+**This text will be bold**
+__This will also be bold__
+
+*You **can** combine them*
+
+
+
+

Lists

+

Unordered

+
+* Item 1
+* Item 2
+  * Item 2a
+  * Item 2b
+

Ordered

+
+1. Item 1
+2. Item 2
+3. Item 3
+   * Item 3a
+   * Item 3b
+
+
+

Miscellaneous

+

Images

+
+![GitHub Logo](/images/logo.png)
+Format: ![Alt Text](url)
+
+

+
+http://github.com - automatic!
+[GitHub](http://github.com)
+

Blockquotes

+
+As Kanye West said:
+
+> We're living the future so
+> the present is our past.
+
+
+
+
+ +

Code Examples in Markdown

+
+

Syntax highlighting with GFM

+
+javascript
+  if(arg) {
+    \$.facebox({div:'#foo'})
+  }
+}
+
+
+
+

Or, indent your code 4 spaces

+
+Here is a Python code example
+without syntax highlighting:
+
+    def foo:
+      if not bar:
+        return true
+
+
+

+
+I think you should use an
+<addr> element here instead.
+
+
+ +
+ + + +
+ + Something went wrong with that request. Please try again. + +
+ +
+

Looking for the GitHub logo?

+
+
+ + + + + + + +
1,107 exercises/test/exponents_2_alternative.html
 @@ -0,0 +1,1107 @@ + + + + + + + + + khan-exercises/exercises/exponents_2.html at 85580f5e16aa7a65d392c1cf6d227be952a73441 · Khan/khan-exercises · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
+ +
+
+ + + +
+ +

+ public + + / + khan-exercises +

+
+ + + + + +
name
+ + + + + + + + + + + +
+ + + + + + +
+ +
+ + +
+ +
Switch branches/tags
+
+
+ +
+
+ +
+
Nothing to show
+
+ +

+ accuracy-model +

+
+
+ +

+ chemistry +

+
+
+ +

+ colorpicker +

+
+
+ +

+ hint-quality +

+
+
+ +

+ lint +

+
+
+ +

+ master +

+
+
+ +

+ meatglue +

+
+
+ +

+
+
+ +

+ refactor +

+
+
+ +

+ serial-requests +

+
+
+ +

+ software-keyboard +

+
+
+ +

+ tests +

+
+
+ + +
+
+
+
+ + + +
+ + + + + + + + + + +
+ + + + + + + +
+ + + + +
+ + + + + +
+

5 contributors

+ + + + + + + +
+ +
+ + +
+
+ +
+
+
+
+ + file + 209 lines (190 sloc) + 8.562 kb +
+
+
+
+ +
+
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+