# Khan/khan-exercises

### Subversion checkout URL

You can clone with
or
.
Older
100644 110 lines (89 sloc) 5.06 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 4e4cb9b lint: tabs->spaces and jQuery->\$ for exercises beneater authored Apr 10, 2012 4 5 Understanding moving the decimal 6 652c889 Added new exercise Understanding moving the decimal praveenRamalingam authored Nov 23, 2011 7 8 4e4cb9b lint: tabs->spaces and jQuery->\$ for exercises beneater authored Apr 10, 2012 9
10
11 randRangeNonZero( -1, 1 ) 12 ( PM === 1 ? "multiply" : "divide" ) 13 randRange( 0, 99999 ) 14 15
16 randRange( 1, 5 ) 17 randRange( 1, 5 ) 18
19 20 A / pow( 10, A_DECIMAL ) 21 A / pow( 10, B_DECIMAL ) 22 ( PM === 1 ? ( A_DECIMAL - B_DECIMAL ) : ( B_DECIMAL - A_DECIMAL ) ) 23
24 25
26
27
28

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

29
30 31

POW_DIFF

32 33
34
35 36
37
38 init({ 39 range: [ [ -1, 11 ], [ -1, 3 ] ], 064281e Fix up exercises that are too wide for tutorials beneater authored Sep 19, 2012 40 scale: [20, 40] 4e4cb9b lint: tabs->spaces and jQuery->\$ for exercises beneater authored Apr 10, 2012 41 }); 42 43 var digitsA = KhanUtil.digits( A ); 44 45 //Pad zeroes if need be for the decimal point 46 while ( digitsA.length < A_DECIMAL + 1) { 47 digitsA.push( 0 ); 48 } 49 50 var digitsB = digitsA.slice(); 51 52 //For the leading zero 0.# only occurs with division 53 if ( digitsA.length < B_DECIMAL + 1) { 54 digitsA.push( ' ' ); 55 digitsB.push( 0 ); 56 } 57 58 drawDigits( digitsA.reverse(), 0, 1); 59 drawDigits( digitsB.reverse(), 0, 0); 60 61 for ( var i = 0; i < POW_DIFF; i++) { 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" ); 65 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 } 76 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" }); 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 064281e Fix up exercises that are too wide for tutorials beneater authored Sep 19, 2012 87 var labelstr = "The decimal point needs to be moved " + POW_DIFF + " time" + ( POW_DIFF !== 1 ? "s." : "."); 88 label ([ digitsA.length + 0.5, 0.5 ], labelstr, "right", false); 4e4cb9b lint: tabs->spaces and jQuery->\$ for exercises beneater authored Apr 10, 2012 89
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 93
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 ):

95

{A_FLOAT.toFixed( A_DECIMAL )} * {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

96
97
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 ):

99

{A_FLOAT.toFixed( A_DECIMAL )} \div {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

100
101 102
103

You need to OPERATOR by ten POW_DIFF times.

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