Khan/khan-exercises

Subversion checkout URL

You can clone with
or
.
Fetching contributors…

Cannot retrieve contributors at this time

90 lines (74 sloc) 3.678 kB
 Adding and subtracting mixed numbers with unlike denominators
randRangeNonZero( -1, 1 ) ( PM === 1 ? "+" : "-") randRange( 2, 19 ) ( PM === 1 ? randRange( 1, 19 ) : randRange( -W1 + 1, -1 ))
randRange( 3, 20 ) randRange( 3, 20 )
randRange( 1, D1 - 1 ) randRange( 1, D2 - 1 )
getGCD( N1, D1 ) N1 / GCD1 D1 / GCD1 getGCD( N2, D2 ) N2 / GCD2 D2 / GCD2 getLCM( SIMP_D1, SIMP_D2 ) getGCD( SIMP_N1 * LCM / SIMP_D1 + PM * SIMP_N2 * LCM / SIMP_D2 , LCM )

Express your answer as a mixed number simplified to lowest terms.

expr(["+", W1 + fraction( N1, D1 ), W2 + fraction( N2, D2 )]) = {?}

W1 + W2 + N1 / D1 + PM * N2 / D2

Separate the whole numbers from the fractional parts:

= \color{red}{W1} + \color{red}{fraction( N1, D1 )} SIGN \color{blue}{abs( W2 )} SIGN \color{blue}{fraction( N2, D2 )}

Bring the whole numbers together and the fractions together:

= \color{red}{W1} SIGN \color{blue}{abs( W2 )} + \color{red}{fraction( N1, D1 )} SIGN \color{blue}{fraction( N2, D2 )}

AddSubtract the whole numbers:

=W1 + W2 + \color{red}{fraction( N1, D1 )} SIGN \color{blue}{fraction( N2, D2 )}

Simplify each fraction:

= W1+W2 + \color{red}{fraction( SIMP_N1, SIMP_D1 )} SIGN \color{blue}{fraction( SIMP_N2, SIMP_D2 )}

Find a common denominator for the fractions:

= expr(["+", W1 + W2, fraction( SIMP_N1 * LCM / SIMP_D1, LCM ),fraction( PM * SIMP_N2 * LCM / SIMP_D2, LCM )])