This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
exponents_1.html
105 lines (80 loc) · 3.11 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>Exponents 1</title>
<script src="../khan-exercise.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">
<p class="summary">This exercise covers exponential arithmetic with, in general, integer bases raised to nonnegative integer exponents. Handles three specific cases: integers raised to positive integers (this is the most common case); nonzero integers raised to 0; and -1, 0, and 1 raised to arbitrarily large positive integers. This exercise covers all the material presented in the Level 1 Exponents video.</p>
<div class="problems">
<div>
<div class="vars">
<var id="VALS">pickIntegerBasePositiveExponent()</var>
<var id="BASE">VALS.base</var>
<var id="EXP">VALS.exp</var>
<var id="NEG_ONE_HINT">BASE > 0 ? "" : ( isEven( EXP ) ? "even" : "odd" )</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-unwrap data-if="EXP === 0">
<p>Anything to the 0th power equals... ?</p>
<p>Anything to the 0th power equals <span class="hint_blue">1</span>.</p>
</div>
<div data-unwrap data-else-if="EXP === 1">
<p>Anything to the 1st power equals... ?</p>
<p><code>x^{1}=x</code>, no matter what <code>x</code> is.</p>
</div>
<div data-unwrap data-else-if="BASE === 0 || BASE === 1 || BASE === -1">
<p><var>Cardinal( BASE )</var> to any <var>NEG_ONE_HINT</var> power equals... ?</p>
<p><var>Cardinal( BASE )</var> to any <var>NEG_ONE_HINT</var> power equals <span class="hint_blue"><var>cardinal( round( pow( BASE, EXP ) ) )</var></span>.</p>
</div>
<div data-unwrap data-else>
<p data-each="expandExponent( BASE, EXP ) as v"><code>= <var>v</var></code></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>