# Khan/khan-exercises

Removed the use of word-problems.

Used grpahie-helper to align and show the movement of decimal point.
1 parent 652c889 commit c95dba69d8be40f674f1bdca7d7e0c4fece7f0a8 praveenRamalingam committed with beneater Nov 29, 2011
Showing with 73 additions and 12 deletions.
1. +73 −12 exercises/understanding_moving_the_decimal.html
 @@ -1,5 +1,5 @@ - + Understanding moving the decimal @@ -25,28 +25,89 @@
-

person(1) needs to OPERATOR A_FLOAT.toFixed( A_DECIMAL ) by 10 ? times to get B_FLOAT.toFixed( B_DECIMAL )

+

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

- +

POW_DIFF

+
-

Moving the decimal one position to the right is the same as person(1) multiplying the number by 10. - Moving the decimal one position to the left is the same as person(1) dividing the number by 10.

+

Moving the decimal one position to the right is the same as multiplying by 10 once. + Moving the decimal one position to the left is the same as dividing by 10 once.

+
+ +
+ init({ + range: [ [ -1, 11 ], [ -1, 3 ] ], + scale: [30, 45] + }); + + var digitsA = KhanUtil.digits( A ); + + //Pad zeroes if need be for the decimal point + while ( digitsA.length < A_DECIMAL + 1) { + digitsA.push( 0 ); + } + + var digitsB = digitsA.slice(); + + //For the leading zero 0.# only occurs with division + if ( digitsA.length < B_DECIMAL + 1) { + digitsA.push( ' ' ); + digitsB.push( 0 ); + } + + drawDigits( digitsA.reverse(), 0, 1); + drawDigits( digitsB.reverse(), 0, 0); + //translate(cx,cy) scale(-1,1) translate(-cx,-cy) + + for ( var i = 0; i < POW_DIFF; i++) { + if ( PM === 1 ) { + arc( [ digitsA.length - A_DECIMAL + i, 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); + label( [ digitsA.length - A_DECIMAL + i, 2 ], i+1, "above" ); + + if ( i === POW_DIFF - 1 ) { + //hack for the final arrow...is there a better way? + line( [ digitsA.length - A_DECIMAL + i + 0.5, 1.5 ], [ digitsA.length - A_DECIMAL + i + 0.5, 1.46 ], { stroke: "blue", arrows: "->" } ); + } + } + else { + //to draw the final arrow + if ( i === POW_DIFF - 1 ) { + style({ arrows: "->" }); + } + + arc( [ digitsA.length - A_DECIMAL - (i + 1), 1.5 ], 0.5, 0, 180, { stroke: "blue" } ); + label( [ digitsA.length - A_DECIMAL - (i + 1), 2 ], i+1, "above" ); + } + } + + //draw a black ellipse to be used as a decimal point + style({ fill: "#000" }); + ellipse( [ digitsA.length - A_DECIMAL - 0.5, 0.8 ], [ 0.09, 0.09 ] ); + ellipse( [ digitsB.length - B_DECIMAL - 0.5, -0.2 ], [ 0.09, 0.09 ] ); + + var labelstr = "\\text{The decimal point needs to be moved " + POW_DIFF + " time" + ( POW_DIFF !== 1 ? "s.}" : ".}"); + label ([ digitsA.length + 0.5, 0.5 ], labelstr, "right", 1);
-
-

Moving the decimal right POW_DIFF is the same as multiplying the number by 10 POW_DIFF times.

-

This is the same as multiplying the number by pow( 10, POW_DIFF ):

-

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

-
-

Moving the decimal left POW_DIFF is the same as dividing the number by 10 POW_DIFF times.

-

This is the same as dividing the number by pow( 10, POW_DIFF ):

+
+

Thus, moving the decimal right POW_DIFF times is the same as multiplying by 10 POW_DIFF times. +
This is the same as multiplying by pow( 10, POW_DIFF ):
+
{A_FLOAT.toFixed( A_DECIMAL )} * {pow( 10, POW_DIFF )} = {B_FLOAT.toFixed( B_DECIMAL )}

+
+

Moving the decimal left POW_DIFF is the same as dividing by 10 POW_DIFF times.

+

This is the same as dividing by pow( 10, POW_DIFF ):

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

+ +
+

You need to OPERATOR by 10 POW_DIFF times.

+
+