Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 114 lines (102 sloc) 6.98 kb
0e95f18 Marcia Lee Add new line for integration regex to grab header stuffs
marcia authored
1 <!DOCTYPE html>
2 <html data-require="math math-format graphie graphie-helpers word-problems slice-clone">
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
3 <head>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Fractions cut and copy 1</title>
6 <script src="../khan-exercise.js"></script>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
7 </head>
8 <body>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
9 <div class="exercise">
10 <div class="vars">
11 <!-- An integer will be a starting or ending quantity 1/3 of the time -->
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
12 <var id="D_PARENT">randRangeWeighted(3, 12, 1, 1 / 6)</var>
13 <var id="D_OFFSPRING">D_PARENT === 1 ? randRange(3, 12) : (rand(5) > 0 ? D_PARENT : 1)</var>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
14 <div data-ensure="getGCD( N_PARENT * ( D_PARENT === 1 ? D_OFFSPRING : 1 ), N_OFFSPRING * ( D_OFFSPRING === 1 ? D_PARENT : 1 ) ) === 1 && N_PARENT / D_PARENT > N_OFFSPRING / D_OFFSPRING">
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
15 <var id="N_PARENT">D_PARENT === 1 ? randRange(1, 4) : randRangeExclude(2, 2 * D_PARENT - 1, [D_PARENT])</var>
16 <var id="N_OFFSPRING">D_OFFSPRING === 1 ? randRange(1, 4) : randRangeExclude(2, 2 * D_OFFSPRING - 1, [D_OFFSPRING])</var>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
17 </div>
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
18 <var id="CODE_PARENT">D_PARENT === 1 ? N_PARENT : mixedOrImproper(N_PARENT, D_PARENT)</var>
19 <var id="CODE_OFFSPRING">D_OFFSPRING === 1 ? N_OFFSPRING : mixedOrImproper(N_OFFSPRING, D_OFFSPRING)</var>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
20 <var id="PARENT">N_PARENT / D_PARENT</var>
21 <var id="OFFSPRING">N_OFFSPRING / D_OFFSPRING</var>
22 <var id="ANSWER">OFFSPRING / PARENT</var>
23 <var id="D">D_PARENT === 1 ? D_OFFSPRING : D_PARENT</var>
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
24 <var id="N_PARENT_EXPANDED">N_PARENT * (D_PARENT === 1 ? D : 1)</var>
25 <var id="N_OFFSPRING_EXPANDED">N_OFFSPRING * (D_OFFSPRING === 1 ? D : 1)</var>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
26 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
27
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
28 <div class="problems">
29 <div>
30 <p class="question">The starting block below is <code><var>CODE_PARENT</var></code> units long. Use the tools to the right to convert the starting block into the goal block that is <code><var>CODE_OFFSPRING</var></code> units long. You can see your progress as the current block.</p>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
31
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
32 <p>Starting Block:</p>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
33
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
34 <div class="graphie" id="parent_block">
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
35 initSliceClone(["current_block"]);
064281e Ben Eater Fix up exercises that are too wide for tutorials
beneater authored
36 init({range: [[0, 1], [0, 1]], scale: [500, 25 ]});
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
37 rectchart([1, 0], ["#e00", "#999"]);
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
38 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
39
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
40 <p>Current Block:</p>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
41
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
42 <div class="graphie" id="current_block">
064281e Ben Eater Fix up exercises that are too wide for tutorials
beneater authored
43 init({ range: [[0, 1], [0, 1] ], scale: [500, 25]});
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
44 rectchart([1, 0], ["#e00", "#999"]);
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
45 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
46
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
47 <p>Goal Block:</p>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
48
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
49 <div class="graphie" id="goal_block">
064281e Ben Eater Fix up exercises that are too wide for tutorials
beneater authored
50 init({range: [[0, 1], [0, 1]], scale: [500 * ANSWER, 25]});
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
51 rectchart([1, 0], [BLUE, "#999"]);
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
52 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
53
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
54 <div class="solution" data-type="custom">
55 <div class="instruction">
56 <div style="margin-bottom: 10px;">
57 Cut into
58 <input type="button" value="-" class="simple-button" onclick="KhanUtil.changePieces(false)">
59 <span id="pieces" style="display: inline-block; width: 54px; text-align: center;">1 piece</span>
60 <input type="button" value="+" class="simple-button" onclick="KhanUtil.changePieces(true)">
61 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
62
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
63 <div style="margin-bottom: 10px;">
64 <span style="display:inline-block; width: 42px;">Copy</span>
65 <input type="button" value="-" class="simple-button" onclick="KhanUtil.changeTimes(false, 'current_block')" disabled="disabled">
66 <span id="current_block_times" style="display: inline-block; width: 54px; text-align: center;">1 time</span>
67 <input type="button" value="+" class="simple-button" onclick="KhanUtil.changeTimes(true, 'current_block')">
68 </div>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
69 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
70
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
71 <div class="guess">
72 [pieces, times['current_block']]
73 </div>
74 <div class="validator-function">
75 return roundTo(3, guess[1] / guess[0]) === roundTo(3, ANSWER);
76 </div>
77 <div class="show-guess">
78 pieces = guess[0];
79 times['current_block'] = guess[1];
80 updateGraphAndAnswer();
81 </div>
82 <div class="show-guess-solutionarea">
83 $('#pieces').text(plural(guess[0], 'piece'));
011af1e Joel Burget Stop using id's as globals (facepalm)
joelburget authored
84 $('#current_block_times').text(plural(guess[1], 'time'));
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
85 </div>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
86 </div>
2773cd9 Julian Pulgarin Hints for fractions_cut_and_copy_1
jpulgarin authored
87
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
88 <div class="hints">
4d6fd61 Joel Burget Port fractions cut and copy 1 to use a custom answer type
joelburget authored
89 <p data-if="CODE_PARENT !== fraction(N_PARENT, D)">The starting block of length <code><var>CODE_PARENT</var></code> units
90 can be rewritten as <code><var>fraction(N_PARENT_EXPANDED, D)</var></code>.</p>
91 <p data-if="CODE_OFFSPRING !== fraction(N_OFFSPRING, D)">The goal block of length <code><var>CODE_OFFSPRING</var></code> units
92 can be rewritten as <code><var>fraction(N_OFFSPRING_EXPANDED, D)</var></code>.</p>
4e4cb9b Ben Eater lint: tabs->spaces and jQuery->$ for exercises
beneater authored
93 <p>Cutting the starting block into <code>x</code> pieces is the same as dividing it by <code>x</code>.</p>
94 <div>
95 <p>Therefore cutting the starting block into <code><var>N_PARENT_EXPANDED</var></code> pieces is the same as:</p>
96 <p><code>\dfrac{<var>N_PARENT_EXPANDED</var>}{<var>D</var>} ÷ <var>N_PARENT_EXPANDED</var> =
97 \dfrac{<var>N_PARENT_EXPANDED</var>}{<var>D</var>} \cdot \dfrac{1}{<var>N_PARENT_EXPANDED</var>} = \dfrac{1}{<var>D</var>}</code></p>
98 </div>
99 <p>Copying the resulting block <code>y</code> times is the same as multiplying it by <code>y</code>.</p>
100 <div>
101 <p>Therefore copying the resulting block <code><var>N_OFFSPRING_EXPANDED</var></code> times is the same as:</p>
102 <p><code>\dfrac{1}{<var>D</var>} \cdot <var>N_OFFSPRING_EXPANDED</var> = \dfrac{<var>N_OFFSPRING_EXPANDED</var>}{<var>D</var>}</code></p>
103 </div>
104 <div>
105 <p>Notice that we end up with a block the same size as the goal block.</p>
106 <p><strong>Therefore the solution is to cut the starting block into <code><var>N_PARENT_EXPANDED</var></code> pieces and copy the resulting block <code><var>N_OFFSPRING_EXPANDED</var></code> times.</strong></p>
107 </div>
108 </div>
109 </div>
110 </div>
111 </div>
ebb3ac5 Julian Pulgarin Add fractions_cut_and_copy_1.html
jpulgarin authored
112 </body>
113 </html>
Something went wrong with that request. Please try again.