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
/
adding_and_subtracting_rational_expressions_2.html
93 lines (88 loc) · 4.78 KB
/
adding_and_subtracting_rational_expressions_2.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
<!DOCTYPE html>
<html data-require="math math-format expressions rational-expressions">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Adding and subtracting rational expressions 2</title>
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="SIGN">randFromArray(["+", "-"])</var>
<var id="X">randVar()</var>
<var id="Y" data-ensure="X !== Y">randVar()</var>
<div data-ensure="getGCD(NUMERATOR1, DENOMINATOR1) === 1">
<var id="NUMERATOR1">randRangeWeighted(1, 10, 1, 0.4)</var>
<var id="DENOMINATOR1">randRange(2, 10)</var>
</div>
<var id="DENOMINATOR2" data-ensure="DENOMINATOR1 !== DENOMINATOR2">randRange(2, 10)</var>
<var id="NUMERATOR2" data-ensure="getGCD(NUMERATOR2, DENOMINATOR2) === 1">randRangeWeighted(1, 10, 1, 0.4)</var>
<var id="DENOMINATORCOEFF">getLCM(DENOMINATOR1, DENOMINATOR2)</var>
<var id="F1">DENOMINATORCOEFF / DENOMINATOR1</var>
<var id="F2">DENOMINATORCOEFF / DENOMINATOR2</var>
<var id="NUMERATORCOEFF">SIGN === "+" ? NUMERATOR1 * F1 + NUMERATOR2 * F2 : NUMERATOR1 * F1 - NUMERATOR2 * F2</var>
<var id="FACTOR">getGCD(NUMERATORCOEFF, DENOMINATORCOEFF)</var>
</div>
<div class="problems">
<div id="variable-top">
<div class="vars">
<var id="N1">new Term(NUMERATOR1, X)</var>
<var id="N2">new Term(NUMERATOR2, X)</var>
<var id="D1">new Term(DENOMINATOR1)</var>
<var id="D2">new Term(DENOMINATOR2)</var>
<var id="NUMERATOR">new Term(NUMERATORCOEFF, X)</var>
<var id="DENOMINATOR">new Term(DENOMINATORCOEFF)</var>
<var id="NUMERSOL">NUMERATOR.divide(FACTOR)</var>
<var id="DENOMSOL">DENOMINATOR.divide(FACTOR)</var>
</div>
</div>
<div id="variable-bottom">
<div class="vars">
<var id="N1">new Term(NUMERATOR1)</var>
<var id="N2">new Term(NUMERATOR2)</var>
<var id="D1">new Term(DENOMINATOR1, X)</var>
<var id="D2">new Term(DENOMINATOR2, X)</var>
<var id="NUMERATOR">new Term(NUMERATORCOEFF)</var>
<var id="DENOMINATOR">new Term(DENOMINATORCOEFF, X)</var>
<var id="NUMERSOL">NUMERATOR.divide(FACTOR)</var>
<var id="DENOMSOL">DENOMINATOR.divide(FACTOR)</var>
</div>
</div>
</div>
<p class="problem">Simplify the following expression:</p>
<p class="question">
<code><var>Y</var> = \dfrac{<var>N1</var>}{<var>D1</var>}
<var>SIGN</var> \dfrac{<var>N2</var>}{<var>D2</var>}</code>
</p>
<div class="solution" data-type="multiple">
<span><code><var>Y</var> = </code></span>
<div class="sol" data-type="expression" data-simplify="">
(<var>NUMERSOL.toString()</var>)/(<var>DENOMSOL.toString()</var>)
</div>
</div>
<div class="hints">
<p>In order to <span data-if="SIGN === '+'">add</span><span data-else="">subtract</span> expressions,
they must have a common denominator.</p>
<p>The smallest common denominator is the least common multiple of <code><var>D1</var></code> and <code><var>D2</var></code>.</p>
<p><code>\lcm(<var>D1</var>, <var>D2</var>) = <var>DENOMINATOR</var></code></p>
<p><code>
<var>Y</var> = \dfrac{<var>F1</var>}{<var>F1</var>} \cdot \dfrac{<var>N1</var>}{<var>D1</var>}
<var>SIGN</var> \dfrac{<var>F2</var>}{<var>F2</var>} \cdot \dfrac{<var>N2</var>}{<var>D2</var>}
</code></p>
<p>
<code><var>Y</var> = \dfrac{<var>N1.multiply(F1)</var>}{<var>DENOMINATOR</var>}
<var>SIGN</var> \dfrac{<var>N2.multiply(F2)</var>}{<var>DENOMINATOR</var>}</code>
</p>
<p>
<code><var>Y</var> = \dfrac{<var>N1.multiply(F1)</var>
<var>SIGN</var><var>N2.multiply(F2)</var>}{<var>DENOMINATOR</var>}</code>
</p>
<p><code><var>Y</var> = \dfrac{<var>NUMERATOR</var>}{<var>DENOMINATOR</var>}</code></p>
<div data-if="FACTOR !== 1">
<div>Simplify the expression by dividing the numerator and denominator by <var>FACTOR</var>:</div>
<div><code><var>Y</var> = \dfrac{<var>NUMERSOL</var>}{<var>DENOMSOL</var>}</code></div>
</div>
</div>
</div>
</body>
</html>