Permalink
Fetching contributors…
Cannot retrieve contributors at this time
106 lines (92 sloc) 4.4 KB
<!DOCTYPE html>
<!-- TODO: underbrace to show what of the multiplication has been contracted. -->
<html data-require="math math-format exponents">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Positive and zero exponents</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<script type="text/javascript">
/* Find an integer base and a positive integer exponent such that the
* calculation is reasonable. */
function pickIntegerBasePositiveExponent() {
var base, exp;
var exp_zero_prob = .2;
var exp_unit_prob = .1;
var base_negunit_prob = .2;
var base_unit_prob = .05;
var base_zero_prob = .05;
var r = KhanUtil.random();
if ( r < exp_zero_prob + exp_unit_prob ) {
base = KhanUtil.randRangeNonZero( -500, 500 );
if ( r < exp_zero_prob) {
exp = 0;
} else {
exp = 1;
}
} else {
r = KhanUtil.random();
if ( r < base_negunit_prob ) {
base = -1;
} else if ( r < base_negunit_prob + base_unit_prob ) {
base = 1;
} else if ( r < base_negunit_prob + base_unit_prob + base_zero_prob ) {
base = 0;
} else {
base = KhanUtil.randRangeExclude( -10, 10, [ 0, 1, -1 ] );
}
exp = KhanUtil.randRange( 2, KhanUtil.maxReasonableExp( base ) );
}
return {
base: base,
exp: exp
};
}
</script>
</head>
<body>
<div class="exercise">
<div class="problems">
<div>
<div class="vars">
<var id="VALS">pickIntegerBasePositiveExponent()</var>
<var id="BASE">VALS.base</var>
<var id="EXP">VALS.exp</var>
</div>
<p class="question"><code>\Large{<var>negParens( BASE )</var>^{<var>EXP</var>} = {?}}</code></p>
<p class="solution" data-forms="integer"><var>round( pow( BASE, EXP ) )</var></p>
<div class="hints">
<div data-if="EXP === 0" data-unwrap="">
<p>Anything to the 0th power equals... ?</p>
<p>Anything to the 0th power equals one.</p>
<p><code><var>negParens(BASE)</var>^{0} = 1</code></p>
</div>
<div data-else-if="EXP === 1" data-unwrap="">
<p>Anything to the 1st power equals... ?</p>
<p><code>x^{1} = x</code>, no matter what <code>x</code> is.</p>
<p><code><var>negParens(BASE)</var>^{1} = <var>BASE</var></code></p>
</div>
<div data-else-if="BASE === -1" data-unwrap="">
<span data-if="isEven(EXP)" data-unwrap>
<p>Negative one to any even power equals... ?</p>
<p>Negative one to any even power equals one.</p>
<p><code><var>negParens(BASE)</var>^{<var>EXP</var>} = 1</code></p>
</span><span data-else data-unwrap>
<p>Negative one to any odd power equals... ?</p>
<p>Negative one to any odd power equals negative one.</p>
<p><code><var>negParens(BASE)</var>^{<var>EXP</var>} = -1</code></p>
</span>
</div>
<div data-else-if="BASE === 0 || BASE === 1" data-unwrap="">
<p><var>CardinalThrough20( BASE )</var> to any power equals... ?</p>
<p><var>CardinalThrough20( BASE )</var> to any power equals <var>cardinalThrough20(round(pow(BASE, EXP)))</var>.</p>
<p><code><var>negParens(BASE)</var>^{<var>EXP</var>} = <var>round(pow(BASE, EXP))</var></code></p>
</div>
<div data-else="" data-unwrap="">
<p data-each="expandExponent( BASE, EXP ) as v"><code>= <var>v</var></code></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>