Permalink
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (73 sloc) 3.39 KB
<!DOCTYPE html>
<html data-require="math math-format exponents">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Positive and negative exponents</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
/* Find a rational base and an integer exponent such that the calculation is
* reasonable. */
function pickRationalBaseIntegerExponent() {
var base_neg_prob = .5;
var exp_neg_prob = .75;
var base_rat_prob = .75;
var base_neg = KhanUtil.random() < base_neg_prob;
var base_n = KhanUtil.randRange( 1, 10 );
var base_d;
while ( base_d === undefined || base_n === base_d ) {
base_d = KhanUtil.randRangeWeighted( 1, 10, 1, 1 - base_rat_prob );
}
var exp_neg = KhanUtil.random() < exp_neg_prob;
var max_exp = Math.min( KhanUtil.maxReasonableExp( base_n ),
KhanUtil.maxReasonableExp( base_d ) );
var min_exp = exp_neg ? 1 : 2;
var exp = KhanUtil.randRange( min_exp, max_exp );
var sol_n = Math.round( Math.pow( exp_neg ? base_d : base_n, exp ) );
var sol_d = Math.round( Math.pow( exp_neg ? base_n : base_d, exp ) );
return {
base_n: base_n,
base_d: base_d,
exp: exp * ( exp_neg ? -1 : 1 ),
sol_n: sol_n,
sol_d: sol_d
};
}
</script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="VALS">pickRationalBaseIntegerExponent()</var>
<var id="BASE_N">VALS.base_n</var>
<var id="BASE_D">VALS.base_d</var>
<var id="EXP_NEG">VALS.exp &lt; 0</var>
<var id="EXP_SIGN">EXP_NEG ? "-" : ""</var>
<var id="EXP">abs( VALS.exp )</var>
<var id="BASEF_N">EXP_NEG ? BASE_D : BASE_N</var>
<var id="BASEF_D">EXP_NEG ? BASE_N : BASE_D</var>
<var id="SOL_N">VALS.sol_n</var>
<var id="SOL_D">VALS.sol_d</var>
</div>
<p class="question"><code>\Large{<var>fracParens( BASE_N, BASE_D )</var>^{<var>EXP_SIGN+EXP</var>} = {?}}</code></p>
<p class="solution"><var>SOL_N / SOL_D</var></p>
<div class="hints">
<p data-if="EXP_NEG"><code>
<var>fracParens(BASE_N, BASE_D)</var>^{<var>-EXP</var>} =
<var>fracParens(BASE_D, BASE_N)</var>^{<var>EXP</var>}
</code></p>
<div data-if="EXP > 1" data-unwrap="">
<div data-each="expandFractionExponent( BASEF_N, BASEF_D, EXP ) as v" data-unwrap="">
<p><code>\phantom{<var>fracParens(BASE_N, BASE_D)</var>^{<var>-EXP</var>}} = <var>v</var></code></p>
</div>
</div>
<p data-else="">
<code>\phantom{<var>fracParens(BASE_N, BASE_D)</var>^{<var>-EXP</var>}} = <var>frac(SOL_N, SOL_D)</var></code>
</p>
</div>
</div>
</div>
</div>
</body>
</html>