This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 863
/
radical_equations.html
124 lines (118 loc) · 4.44 KB
/
radical_equations.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html data-require="math math-format">
<head>
<meta charset="UTF-8" />
<title>Radical equations</title>
<script src="../khan-exercise.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="A">randRange( 2, 10 )</var>
<var id="B">randRangeNonZero( -10, 10 )</var>
<var id="C" data-ensure="abs( C - A ) > 1">randRange( 2, 10 )</var>
<var id="D" data-ensure="D !== B">randRangeNonZero( 2, 10 )</var>
<var id="SIMPLIFIED">fractionReduce( D - B, A - C )</var>
<var id="SOLUTION">
(function() {
if ( ( D - B ) / ( A - C) > 0 ) {
return "<code>"
+ "x = "
+ fractionReduce( ( D - B ) * ( D - B), ( A - C ) * ( A - C) )
+ "</code>";
} else {
return "No solution";
}
})()</var>
<var id="CHOICES">
(function() {
var choices = [];
for ( var i = 0; i < 4; i++ ) {
var nOffset = randRange( 1, 10 );
var dOffset = randRangeExclude( 1, 10, [ C - A ] );
var choice = "<code>"
+ "x = "
+ fractionReduce( ( D - B + nOffset ) * ( D - B + nOffset ), ( A - C + dOffset ) * ( A - C + dOffset ) )
+ "</code>";
choices.unshift( choice );
}
if ( ( D - B ) / ( A - C ) > 0 ) {
choices.shift();
choices.unshift( SOLUTION );
}
choices = shuffle( choices );
choices.push( "No solution" );
return choices;
})()</var>
</div>
<div class="problems">
<div>
<p class="question">Solve for <code>x</code>:</p>
<div><code><var>A</var>\sqrt{x} + <var>B</var> = <var>C</var>\sqrt{x} + <var>D</var></code></div>
<p class="solution"><var>SOLUTION</var></p>
<ul class="choices" data-category="true">
<li data-each="CHOICES as choice"><var>choice</var></li>
</ul>
</div>
</div>
<div class="hints">
<div data-if="A > C" data-unwrap>
<div>
<p>Subtract <code><var>C</var>\sqrt{x}</code> from both sides:</p>
<p><code>(<var>A</var>\sqrt{x} + <var>B</var>) - <var>C</var>\sqrt{x} = (<var>C</var>\sqrt{x} + <var>D</var>) - <var>C</var>\sqrt{x}</code></p>
<p><code><var>A - C</var>\sqrt{x} + <var>B</var> = <var>D</var></code></p>
</div>
<div>
<p><var>B > 0 ? "Subtract" : "Add"</var> <code><var>abs(B)</var></code> <var>B > 0 ? "from" : "to"</var> both sides:</p>
<p><code>(<var>A - C</var>\sqrt{x} + <var>B</var>) + <var>-B</var> = <var>D</var> + <var>-B</var></code></p>
<p><code><var>A - C</var>\sqrt{x} = <var>D - B</var></code></p>
</div>
<div>
<p>Divide both sides by <code><var>A - C</var></code>.</p>
<p><code>\frac{<var>A - C</var>\sqrt{x}}{<var>A - C</var>} = \frac{<var>D - B</var>}{<var>A - C</var>}</code></p>
</div>
<div>
<p>Simplify.</p>
<p><code>\sqrt{x} = <var>SIMPLIFIED</var></code></p>
</div>
<div data-if="( D - B ) / ( A - C ) > 0">
<p>Square both sides.</p>
<p><code>\sqrt{x} \cdot \sqrt{x} = <var>SIMPLIFIED</var> \cdot <var>SIMPLIFIED</var></code></p>
<p><var>SOLUTION</var></p>
</div>
<p data-else>
The principal root of a number cannot be negative. So, there is no solution.
</p>
</div>
<div data-else data-unwrap>
<div>
<p>Subtract <code><var>A</var>\sqrt{x}</code> from both sides:</p>
<p><code>(<var>A</var>\sqrt{x} + <var>B</var>) - <var>A</var>\sqrt{x} = (<var>C</var>\sqrt{x} + <var>D</var>) - <var>A</var>\sqrt{x}</code></p>
<p><code><var>B</var> = <var>C - A</var>\sqrt{x} + <var>D</var></code></p>
</div>
<div>
<p><var>D > 0 ? "Subtract" : "Add"</var> <code><var>abs(D)</var></code> <var>D > 0 ? "from" : "to"</var> both sides:</p>
<p><code><var>B</var> + <var>-D</var> = (<var>C - A</var>\sqrt{x} + <var>D</var>) + <var>-D</var></code></p>
<p><code><var>B - D</var> = <var>C - A</var>\sqrt{x}</code></p>
</div>
<div>
<p>Divide both sides by <code><var>C - A</var></code>.</p>
<p><code>\frac{<var>B - D</var>}{<var>C - A</var>} = \frac{<var>C - A</var>\sqrt{x}}{<var>C - A</var>}</code></p>
</div>
<div>
<p>Simplify.</p>
<p><code><var>SIMPLIFIED</var> = \sqrt{x}</code></p>
</div>
<div data-if="( D - B ) / ( A - C ) > 0">
<p>Square both sides.</p>
<p><code><var>SIMPLIFIED</var> \cdot <var>SIMPLIFIED</var> = \sqrt{x} \cdot \sqrt{x}</code></p>
<p><var>SOLUTION</var></p>
</div>
<p data-else>
The principal root of a number cannot be negative. So, there is no solution.
</p>
</div>
</div>
</div>
</body>
</html>