This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
exponents_1.html
105 lines (92 loc) · 4.38 KB
/
exponents_1.html
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
<!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>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>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>