# publicKhan/khan-exercises

### Subversion checkout URL

You can clone with HTTPS or Subversion.

Fetching contributors…

Cannot retrieve contributors at this time

file 107 lines (90 sloc) 7.061 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             Converting mixed numbers and improper fractions

randRange( 1, 10 )                randRange( 1, 30 )                randRange( 1, 30 )                M_NUM / getGCD( M_NUM, M_DENOM )                M_DENOM / getGCD( M_NUM, M_DENOM )                WHOLE * M_REDUCED_DENOM + M_REDUCED_NUM                M_REDUCED_DENOM

Convert fraction( I_NUM, I_DENOM, false, true ) to a mixed number.

I_NUM / I_DENOM

First, divide the numerator by the denominator.

I_NUM \div I_DENOM = \color{#28AE7B}{WHOLE}\ \text{ R } \color{purple}{M_REDUCED_NUM}

So the improper fraction has WHOLE wholes in it, which is equal to \color{#28AE7B}{WHOLE} \times \dfrac{I_DENOM}{I_DENOM} = \color{#28AE7B}{fraction( I_DENOM * WHOLE, I_DENOM, false, false )}.

init({ range: [ [0, 1], [0, WHOLE] ], scale: [250, 25] });                                for ( var y = 0; y < WHOLE; y++ ) {                                    rectchart( [M_REDUCED_DENOM, 0], ["#28AE7B", "#999"], y );                                }

This quotient WHOLE is the whole number part of the mixed number.

We also have a remainder of M_REDUCED_NUM, though. That represents the \dfrac{\color{purple}{M_REDUCED_NUM}}{I_DENOM} remaining from the improper fraction; it wasn't enough to be another whole number.

init({ range: [ [0, 1], [0, 1] ], scale: [250, 25] });                                rectchart( [M_REDUCED_NUM, M_REDUCED_DENOM - M_REDUCED_NUM], ["purple", "#999"] );

The converted mixed fraction is \color{#28AE7B}{WHOLE}\ \color{purple}{fraction( M_NUM, M_DENOM, false, true )}.

init({ range: [ [0, 1], [0, WHOLE + 1] ], scale: [250, 25] });                                for ( var y = 1; y <= WHOLE; y++ ) {                                    rectchart( [M_REDUCED_DENOM, 0], ["#28AE7B", "#999"], y );                                }                                rectchart( [M_REDUCED_NUM, M_REDUCED_DENOM - M_REDUCED_NUM], ["purple", "#999"] );

Note that if we add up the two pieces of our mixed fraction, \color{#28AE7B}{fraction( I_DENOM * WHOLE, I_DENOM, false, false )} + \color{purple}{fraction( M_NUM, M_DENOM, false, true )}, we get the original improper fraction fraction( I_NUM, I_DENOM, false, true ).

Convert WHOLE\ fraction( M_NUM, M_DENOM, false, true ) to an improper fraction.

I_NUM / I_DENOM

\color{#FFA500}{WHOLE}\ \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}

This mixed number is equivalent to \color{#FFA500}{WHOLE} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}.

First, convert the whole part of the mixed number to a fraction with the same denominator M_REDUCED_DENOM as the fractional part.

\color{#FFA500}{WHOLE} \times \dfrac{M_REDUCED_DENOM}{M_REDUCED_DENOM} = \color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}}

init({ range: [ [0, 1], [0, WHOLE] ], scale: [250, 25] });                                for ( var y = 0; y < WHOLE; y++ ) {                                    rectchart( [M_REDUCED_DENOM, 0], ["#FFA500", "#999"], y );                                }

So now we have our number in the form \color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )}.

init({ range: [ [0, 1], [0, WHOLE + 1] ], scale: [250, 25] });                                for ( var y = 1; y <= WHOLE; y++ ) {                                    rectchart( [M_REDUCED_DENOM, 0], ["#FFA500", "#999"], y );                                }                                rectchart( [M_REDUCED_NUM, M_REDUCED_DENOM - M_REDUCED_NUM], ["#6495ED", "#999"] );

Now, just add the two fractions and simplify!

\color{#FFA500}{\dfrac{WHOLE * M_REDUCED_DENOM}{M_REDUCED_DENOM}} + \color{#6495ED}{fraction( M_NUM, M_DENOM, false, true )} = fraction( I_NUM, I_DENOM, true, true )

Something went wrong with that request. Please try again.