# Khan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Older
100644 110 lines (89 sloc) 4.198 kb
 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 22, 2011 1 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 2 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 3 4 5 Understanding moving the decimal 6 7 8 9
10
11 randRangeNonZero( -1, 1 ) 12 ( PM === 1 ? "multiply" : "divide" ) 13 randRange( 0, 99999 ) bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 14 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 15
16 randRange( 1, 5 ) 17 randRange( 1, 5 ) 18
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 19 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 20 A / pow( 10, A_DECIMAL ) 21 A / pow( 10, B_DECIMAL ) 22 ( PM === 1 ? ( A_DECIMAL - B_DECIMAL ) : ( B_DECIMAL - A_DECIMAL ) ) 23
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 24 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 25
26
27
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 28

How many times do you need to OPERATOR A_FLOAT.toFixed( A_DECIMAL ) by ten to get B_FLOAT.toFixed( B_DECIMAL )?

652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 29
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 30 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 31

POW_DIFF

bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 32 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 33
34
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 35 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 36
c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 37
38 init({ 39 range: [ [ -1, 11 ], [ -1, 3 ] ], 40 scale: [30, 45] 41 }); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 42 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 43 var digitsA = KhanUtil.digits( A ); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 44 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 45 //Pad zeroes if need be for the decimal point 982224f Copied smenks13 changes and removed an unnecessary comment. praveenRamalingam authored Nov 30, 2011 46 while ( digitsA.length < A_DECIMAL + 1) { c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 47 digitsA.push( 0 ); 48 } bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 49 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 50 var digitsB = digitsA.slice(); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 51 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 52 //For the leading zero 0.# only occurs with division 982224f Copied smenks13 changes and removed an unnecessary comment. praveenRamalingam authored Nov 30, 2011 53 if ( digitsA.length < B_DECIMAL + 1) { c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 54 digitsA.push( ' ' ); 55 digitsB.push( 0 ); 56 } bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 57 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 58 drawDigits( digitsA.reverse(), 0, 1); 59 drawDigits( digitsB.reverse(), 0, 0); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 60 982224f Copied smenks13 changes and removed an unnecessary comment. praveenRamalingam authored Nov 30, 2011 61 for ( var i = 0; i < POW_DIFF; i++) { c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 62 if ( PM === 1 ) { 63 arc( [ digitsA.length - A_DECIMAL + i, 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); 64 label( [ digitsA.length - A_DECIMAL + i, 2 ], i+1, "above" ); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 65 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 66 if ( i === POW_DIFF - 1 ) { 67 //hack for the final arrow...is there a better way? 68 line( [ digitsA.length - A_DECIMAL + i + 0.5, 1.5 ], [ digitsA.length - A_DECIMAL + i + 0.5, 1.46 ], { stroke: "blue", arrows: "->" } ); 69 } 70 } 71 else { 72 //to draw the final arrow 73 if ( i === POW_DIFF - 1 ) { 74 style({ arrows: "->" }); 75 } bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 76 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 77 arc( [ digitsA.length - A_DECIMAL - (i + 1), 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); 78 label( [ digitsA.length - A_DECIMAL - (i + 1), 2 ], i+1, "above" ); 79 } 80 } 81 82 //draw a black ellipse to be used as a decimal point 83 style({ fill: "#000" }); bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 84 ellipse( [ digitsA.length - A_DECIMAL - 0.5, 0.8 ], [ 0.09, 0.06 ] ); 85 ellipse( [ digitsB.length - B_DECIMAL - 0.5, -0.2 ], [ 0.09, 0.06 ] ); 86 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 87 var labelstr = "\\text{The decimal point needs to be moved " + POW_DIFF + " time" + ( POW_DIFF !== 1 ? "s.}" : ".}"); 88 label ([ digitsA.length + 0.5, 0.5 ], labelstr, "right", 1); 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 89
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 90 91

Moving the decimal one position to the PM === 1 ? "right" : "left" is the same as PM === 1 ? "multiplying" : "dividing" by ten once.

92 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 93
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 94

Thus, moving the decimal right POW_DIFF times is the same as multiplying by ten POW_DIFF times, or multiplying by pow( 10, POW_DIFF ):

982224f Copied smenks13 changes and removed an unnecessary comment. praveenRamalingam authored Nov 30, 2011 95 {A_FLOAT.toFixed( A_DECIMAL )} * {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

96
c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 97
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 98

Thus, moving the decimal left POW_DIFF times is the same as dividing by ten POW_DIFF times, or dividing by pow( 10, POW_DIFF ):

982224f Copied smenks13 changes and removed an unnecessary comment. praveenRamalingam authored Nov 30, 2011 99 {A_FLOAT.toFixed( A_DECIMAL )} \div {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 100
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 101 c95dba6 Removed the use of word-problems. praveenRamalingam authored Nov 29, 2011 102
bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 103

You need to OPERATOR by ten POW_DIFF times.

104
105 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 106
107
108 bf6a2d8 Make circle round; 10->ten; whitespace beneater authored Jan 7, 2012 109
Something went wrong with that request. Please try again.