Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add pythagorean identity trig exercise

Summary:
Apologies in advance for the awful logic in convert-values... I considered doing something object-oriented but it
seems like it will be almost as ugly that way. Also there is some overlap in the problem types, but there is
actually significant difference in the hints for each, and since the hints are the meat of the exercise anyway,
it seemed ok to keep them as separate.

Reviewers: eater

Reviewed By: eater

CC: emily, eater

Differential Revision: http://phabricator.khanacademy.org/D601
  • Loading branch information...
commit b6b17379c1c91a9c874990f4772501f4dc3ff232 1 parent c069833
mwittels mwittels authored
Showing with 745 additions and 0 deletions.
  1. +560 −0 exercises/pythagorean_identities.html
  2. +185 −0 utils/convert-values.js
560 exercises/pythagorean_identities.html
View
@@ -0,0 +1,560 @@
+<!DOCTYPE html>
+<html data-require="math graphie subhints convert-values">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Pythagorean trig identities</title>
+ <script src="../khan-exercise.js"></script>
+</head>
+<body>
+ <div class="exercise">
+ <div class="problems">
+ <div id="sincos">
+ <div class="vars">
+ <var id="OPTIONS">
+ shuffle(["\\sin\\theta", "\\cos\\theta",
+ "\\tan\\theta", "\\sec\\theta", "\\csc\\theta",
+ "\\cot\\theta"]).slice(0,3)
+ </var>
+ <var id="FUNC">randFromArray(OPTIONS)</var>
+ <var id="MULT">random() &lt; 0.5</var>
+ </div>
+ <p class="question">
+ <div data-if="MULT">
+ <code>(\sin^2 \theta + \cos^2 \theta)(<var>FUNC</var>)
+ = \; ?</code>
+ </div>
+ <div data-else>
+ <code>\dfrac{<var>FUNC</var>}
+ {\sin^2 \theta + \cos^2 \theta} = \; ?</code>
+ </div>
+ </p>
+ <div class="solution"><code><var>FUNC</var></code></div>
+
+ <ul class="choices" data-show="3">
+ <li data-each="OPTIONS as op"><code><var>op</var></code></li>
+ </ul>
+ <div class="hints">
+ <div>
+ We can use the identity
+ <code>\blue{\sin^2 \theta} + \orange{\cos^2 \theta}
+ = 1</code>
+ to simplify this expression.
+ <div class="graphie">
+ init({
+ range: [[-1.2, 1.2], [-1.3, 1.3]],
+ scale: 130
+ });
+ with(KhanUtil.currentGraph) {
+ style({
+ stroke: "#ddd",
+ strokeWidth: 1,
+ arrows: "->"
+ });
+ circle([0, 0], 1);
+ line([-1.2, 0], [1.2, 0]);
+ line([0, -1.2], [0, 1.2]);
+ line([1.2, 0], [-1.2, 0]);
+ line([0, 1.2], [0, -1.2]);
+ style({
+ strokeWidth: 2.5,
+ arrows: ""
+ });
+ ang = 2*Math.PI/3;
+ line([0, 0], [cos(ang), sin(ang)],
+ {stroke: "black"});
+ label([cos(ang)/2, sin(ang)/2],
+ "1", "above right");
+ line([0, 0], [cos(ang), 0],
+ {stroke: ORANGE});
+ label([cos(ang), sin(ang)/2],
+ "\\blue{\\sin\\theta}", "left");
+ line([cos(ang), 0],
+ [cos(ang), sin(ang)],
+ {stroke: BLUE});
+ label([cos(ang)/2, 0],
+ "\\orange{\\cos\\theta}", "below");
+ arc([0,0], 0.2, 0, 120,
+ {stroke: "black", arrows: "->"});
+ label([0,0.1], "\\theta", "above right");
+ }
+ </div>
+ We can see why this is true by using the
+ Pythagorean Theorem.
+ </div>
+ <p data-if="MULT">
+ So, <code>(\sin^2 \theta + \cos^2 \theta)(<var>FUNC</var>)
+ = 1 \cdot <var>FUNC</var> = <var>FUNC</var></code>
+ </p>
+ <p data-else>
+ So, <code>\dfrac{<var>FUNC</var>}
+ {\sin^2 \theta + \cos^2 \theta} =
+ \dfrac{<var>FUNC</var>}{1} = <var>FUNC</var></code>
+ </p>
+ </div>
+ </div>
+ <div id="1MinusSinCos">
+ <div class="vars">
+ <var id="MULT">random() &lt; 0.5</var>
+ <var id="SIN">random() &lt; 0.5</var>
+ <var id="IDENT, EQUIV">
+ SIN ? ["1 - \\sin^2\\theta", "\\cos^2\\theta"]
+ : ["1 - \\cos^2\\theta", "\\sin^2\\theta"]
+ </var>
+ <var id="OPTIONS, FUNC, ANS">
+ trig.getOptionsResult(EQUIV, (MULT ? "*" : "/"))
+ </var>
+ <var id="FUNC_SIMP">
+ MULT ?
+ trig.showSimplified(FUNC) : trig.showSimplified(FUNC, true)
+ </var>
+ </div>
+
+ <p class="question">
+ <div data-if="MULT">
+ <code>(<var>IDENT</var>)(<var>FUNC</var>) = \; ?</code>
+ </div>
+ <div data-else>
+ <code>\dfrac{<var>IDENT</var>}{<var>FUNC</var>}
+ = \; ?</code>
+ </div>
+ </p>
+
+ <div class="solution"><code><var>ANS</var></code>
+ </div>
+
+ <ul class="choices" data-show="3">
+ <li data-each="OPTIONS as op"><code><var>op</var></code></li>
+ </ul>
+
+ <div class="hints">
+ <div>
+ We can use the identity
+ <code>\blue{\sin^2 \theta} + \orange{\cos^2 \theta}
+ = 1</code>
+ to simplify this expression.
+ <div class="graphie">
+ init({
+ range: [[-1.2, 1.2], [-1.3, 1.3]],
+ scale: 130
+ });
+ with(KhanUtil.currentGraph) {
+ style({
+ stroke: "#ddd",
+ strokeWidth: 1,
+ arrows: "->"
+ });
+ circle([0, 0], 1);
+ line([-1.2, 0], [1.2, 0]);
+ line([0, -1.2], [0, 1.2]);
+ line([1.2, 0], [-1.2, 0]);
+ line([0, 1.2], [0, -1.2]);
+ style({
+ strokeWidth: 2.5,
+ arrows: ""
+ });
+ ang = 2*Math.PI/3;
+ line([0, 0], [cos(ang), sin(ang)],
+ {stroke: "black"});
+ label([cos(ang)/2, sin(ang)/2],
+ "1", "above right");
+ line([0, 0], [cos(ang), 0],
+ {stroke: ORANGE});
+ label([cos(ang), sin(ang)/2],
+ "\\blue{\\sin\\theta}", "left");
+ line([cos(ang), 0],
+ [cos(ang), sin(ang)],
+ {stroke: BLUE});
+ label([cos(ang)/2, 0],
+ "\\orange{\\cos\\theta}", "below");
+ arc([0,0], 0.2, 0, 120,
+ {stroke: "black", arrows: "->"});
+ label([0,0.1], "\\theta", "above right");
+ }
+ </div>
+ We can see why this is true by using the
+ Pythagorean Theorem.
+ </br></br>
+ </div>
+ <div>
+ So, <code><var>IDENT</var> = <var>EQUIV</var></code>
+ </br></br>
+ </div>
+ <div>
+ Plugging into our expression, we get
+ <div data-if="MULT">
+ <p><code>\qquad (<var>EQUIV</var>)(<var>FUNC</var>)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad \dfrac{<var>EQUIV</var>}
+ {<var>FUNC</var>}</code></p>
+ </div>
+ </div>
+ <div data-if="FUNC !== '\\sin^2\\theta' &amp;&amp; FUNC !== '\\cos^2\\theta'">
+ To make simplifying easier, let's put everything
+ in terms of <code>\sin</code> and <code>\cos</code>.
+ <code><var>FUNC</var> = <var>FUNC_SIMP</var></code>
+ , so we can plug that in to get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad \dfrac{<var>EQUIV</var>}
+ {<var>FUNC_SIMP</var>}
+ </code></p>
+ </div>
+ </div>
+ <div>
+ This is <code><var>ANS</var></code>.
+ </div>
+ </div>
+ </div>
+ <div id="1PlusTan">
+ <div class="vars">
+ <var id="MULT">random() &lt; 0.5</var>
+ <var id="TAN">random() &lt; 0.5</var>
+ <var id="IDENT, EQUIV">
+ TAN ? ["1 + \\tan^2\\theta", "\\sec^2\\theta"]
+ : ["\\sec^2\\theta-1", "\\tan^2\\theta"]
+ </var>
+ <var id="OPTIONS, FUNC, ANS">
+ trig.getOptionsResult(EQUIV, (MULT ? "*" : "/"))
+ </var>
+ <var id="FUNC_SIMP, EQUIV_SIMP">
+ [trig.showSimplified(FUNC, !MULT),
+ trig.showSimplified(EQUIV, !MULT)]
+ </var>
+ <var id="ANS_SIMP">
+ trig.showSimplified(ANS)
+ </var>
+ </div>
+
+ <p class="question">
+ <div data-if="MULT">
+ <code>(<var>IDENT</var>)(<var>FUNC</var>) = \; ?</code>
+ </div>
+ <div data-else>
+ <code>\dfrac{<var>IDENT</var>}{<var>FUNC</var>}
+ = \; ?</code>
+ </div>
+ </p>
+
+ <div class="solution"><code><var>ANS</var></code>
+ </div>
+
+ <ul class="choices" data-show="3">
+ <li data-each="OPTIONS as op"><code><var>op</var></code></li>
+ </ul>
+
+ <div class="hints">
+ <div>
+ We can derive a useful identity from
+ <code>\blue{\sin^2 \theta} + \orange{\cos^2 \theta}
+ = 1</code>
+ to simplify this expression.
+ <div class="graphie">
+ init({
+ range: [[-1.2, 1.2], [-1.3, 1.3]],
+ scale: 130
+ });
+ with(KhanUtil.currentGraph) {
+ style({
+ stroke: "#ddd",
+ strokeWidth: 1,
+ arrows: "->"
+ });
+ circle([0, 0], 1);
+ line([-1.2, 0], [1.2, 0]);
+ line([0, -1.2], [0, 1.2]);
+ line([1.2, 0], [-1.2, 0]);
+ line([0, 1.2], [0, -1.2]);
+ style({
+ strokeWidth: 2.5,
+ arrows: ""
+ });
+ ang = 2*Math.PI/3;
+ line([0, 0], [cos(ang), sin(ang)],
+ {stroke: "black"});
+ label([cos(ang)/2, sin(ang)/2],
+ "1", "above right");
+ line([0, 0], [cos(ang), 0],
+ {stroke: ORANGE});
+ label([cos(ang), sin(ang)/2],
+ "\\blue{\\sin\\theta}", "left");
+ line([cos(ang), 0],
+ [cos(ang), sin(ang)],
+ {stroke: BLUE});
+ label([cos(ang)/2, 0],
+ "\\orange{\\cos\\theta}", "below");
+ arc([0,0], 0.2, 0, 120,
+ {stroke: "black", arrows: "->"});
+ label([0,0.1], "\\theta", "above right");
+ }
+ </div>
+ We can see why this identity is true by using the
+ Pythagorean Theorem.
+ </br></br>
+ </div>
+ <div>
+ Dividing both sides by <code>\cos^2\theta</code>, we get
+ <p><code>\qquad \dfrac{\sin^2\theta}{\cos^2\theta}
+ + \dfrac{\cos^2\theta}{\cos^2\theta}
+ = \dfrac{1}{\cos^2\theta}</code></p>
+ <div data-if="!TAN">
+ <code>\qquad 1 + \tan^2\theta = \sec^2\theta</code>
+ </div>
+ <p><code>\qquad <var>IDENT</var>
+ = <var>EQUIV</var></code></p>
+ </div>
+ <div>
+ Plugging into our expression, we get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV</var>}
+ {<var>FUNC</var>}
+ </code></p>
+ </div>
+ </div>
+ <div data-if="FUNC !== '\\sin^2\\theta' &amp;&amp; FUNC !== '\\cos^2\\theta'">
+ To make simplifying easier, let's put everything
+ in terms of <code>\sin</code> and <code>\cos</code>.
+ We know <code><var>EQUIV</var>
+ = <var>EQUIV_SIMP</var></code>
+ and <code><var>FUNC</var> = <var>FUNC_SIMP</var></code>
+ , so we can substitute to get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ <p><code>\qquad
+ \left(<var>EQUIV_SIMP</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad \dfrac{<var>EQUIV</var>}
+ {<var>FUNC_SIMP</var>}</code></p>
+ <p><code>\qquad \dfrac{<var>EQUIV_SIMP</var>}
+ {<var>FUNC_SIMP</var>}</code></p>
+ </div>
+ </div>
+ <div data-else>
+ To make simplifying easier, let's put everything
+ in terms of <code>\sin</code> and <code>\cos</code>.
+ We know <code><var>EQUIV</var>
+ = <var>EQUIV_SIMP</var></code>, so we can substitute
+ to get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ <p><code>\qquad
+ \left(<var>EQUIV_SIMP</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV</var>}
+ {<var>FUNC_SIMP</var>}
+ </code></p>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV_SIMP</var>}
+ {<var>FUNC_SIMP</var>}
+ </code></p>
+ </div>
+ </div>
+ <div data-if="ANS !== '\\sin^2\\theta' &amp;&amp; ANS !== '\\cos^2\\theta' &amp;&amp; ANS !== '1'">
+ This is <code><var>ANS_SIMP</var> = <var>ANS</var></code>.
+ </div>
+ <div data-else>
+ This is <code><var>ANS</var></code>.
+ </div>
+ </div>
+ </div>
+ <div id="1PlusCot">
+ <div class="vars">
+ <var id="MULT">random() &lt; 0.5</var>
+ <var id="COT">random() &lt; 0.5</var>
+ <var id="IDENT, EQUIV">
+ COT ? ["1 + \\cot^2\\theta", "\\csc^2\\theta"]
+ : ["\\csc^2\\theta-1", "\\cot^2\\theta"]
+ </var>
+ <var id="OPTIONS, FUNC, ANS">
+ trig.getOptionsResult(EQUIV, (MULT ? "*" : "/"))
+ </var>
+ <var id="FUNC_SIMP, EQUIV_SIMP">
+ [trig.showSimplified(FUNC, !MULT),
+ trig.showSimplified(EQUIV, !MULT)]
+ </var>
+ <var id="ANS_SIMP">
+ trig.showSimplified(ANS)
+ </var>
+ </div>
+
+ <p class="question">
+ <div data-if="MULT">
+ <code>(<var>IDENT</var>)(<var>FUNC</var>) = \; ?</code>
+ </div>
+ <div data-else>
+ <code>\dfrac{<var>IDENT</var>}{<var>FUNC</var>}
+ = \; ?</code>
+ </div>
+ </p>
+
+ <div class="solution"><code><var>ANS</var></code>
+ </div>
+
+ <ul class="choices" data-show="3">
+ <li data-each="OPTIONS as op"><code><var>op</var></code></li>
+ </ul>
+
+ <div class="hints">
+ <div>
+ We can derive a useful identity from
+ <code>\blue{\sin^2 \theta} + \orange{\cos^2 \theta}
+ = 1</code>
+ to simplify this expression.
+ <div class="graphie">
+ init({
+ range: [[-1.2, 1.2], [-1.3, 1.3]],
+ scale: 130
+ });
+ with(KhanUtil.currentGraph) {
+ style({
+ stroke: "#ddd",
+ strokeWidth: 1,
+ arrows: "->"
+ });
+ circle([0, 0], 1);
+ line([-1.2, 0], [1.2, 0]);
+ line([0, -1.2], [0, 1.2]);
+ line([1.2, 0], [-1.2, 0]);
+ line([0, 1.2], [0, -1.2]);
+ style({
+ strokeWidth: 2.5,
+ arrows: ""
+ });
+ ang = 2*Math.PI/3;
+ line([0, 0], [cos(ang), sin(ang)],
+ {stroke: "black"});
+ label([cos(ang)/2, sin(ang)/2],
+ "1", "above right");
+ line([0, 0], [cos(ang), 0],
+ {stroke: ORANGE});
+ label([cos(ang), sin(ang)/2],
+ "\\blue{\\sin\\theta}", "left");
+ line([cos(ang), 0],
+ [cos(ang), sin(ang)],
+ {stroke: BLUE});
+ label([cos(ang)/2, 0],
+ "\\orange{\\cos\\theta}", "below");
+ arc([0,0], 0.2, 0, 120,
+ {stroke: "black", arrows: "->"});
+ label([0,0.1], "\\theta", "above right");
+ }
+ </div>
+ We can see why this identity is true by using the
+ Pythagorean Theorem.
+ </br></br>
+ </div>
+ <div>
+ Dividing both sides by <code>\sin^2\theta</code>, we get
+ <p><code>\qquad \dfrac{\sin^2\theta}{\sin^2\theta}
+ + \dfrac{\cos^2\theta}{\sin^2\theta}
+ = \dfrac{1}{\sin^2\theta}</code></p>
+ <div data-if="!COT">
+ <code>\qquad 1 + \cot^2\theta = \csc^2\theta</code>
+ </div>
+ <p><code>\qquad <var>IDENT</var>
+ = <var>EQUIV</var></code></p>
+ </div>
+ <div>
+ Plugging into our expression, we get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV</var>}
+ {<var>FUNC</var>}
+ </code></p>
+ </div>
+ </div>
+ <div data-if="FUNC !== '\\sin^2\\theta' &amp;&amp; FUNC !== '\\cos^2\\theta'">
+ To make simplifying easier, let's put everything
+ in terms of <code>\sin</code> and <code>\cos</code>.
+ We know <code><var>EQUIV</var>
+ = <var>EQUIV_SIMP</var></code>
+ and <code><var>FUNC</var> = <var>FUNC_SIMP</var></code>
+ , so we can substitute to get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ <p><code>\qquad
+ \left(<var>EQUIV_SIMP</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad \dfrac{<var>EQUIV</var>}
+ {<var>FUNC_SIMP</var>}</code></p>
+ <p><code>\qquad \dfrac{<var>EQUIV_SIMP</var>}
+ {<var>FUNC_SIMP</var>}</code></p>
+ </div>
+ </div>
+ <div data-else>
+ To make simplifying easier, let's put everything
+ in terms of <code>\sin</code> and <code>\cos</code>.
+ We know <code><var>EQUIV</var>
+ = <var>EQUIV_SIMP</var></code>, so we can substitute
+ to get
+ <div data-if="MULT">
+ <p><code>\qquad
+ \left(<var>EQUIV</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ <p><code>\qquad
+ \left(<var>EQUIV_SIMP</var>\right)
+ \left(<var>FUNC_SIMP</var>\right)
+ </code></p>
+ </div>
+ <div data-else>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV</var>}
+ {<var>FUNC_SIMP</var>}
+ </code></p>
+ <p><code>\qquad
+ \dfrac{<var>EQUIV_SIMP</var>}
+ {<var>FUNC_SIMP</var>}
+ </code></p>
+ </div>
+ </div>
+ <div data-if="ANS !== '\\sin^2\\theta' &amp;&amp; ANS !== '\\cos^2\\theta' &amp;&amp; ANS !== '1'">
+ This is <code><var>ANS_SIMP</var> = <var>ANS</var></code>.
+ </div>
+ <div data-else>
+ This is <code><var>ANS</var></code>.
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</body>
+</html>
185 utils/convert-values.js
View
@@ -216,3 +216,188 @@ $.extend(KhanUtil, {
return toReturn;
}
});
+
+// I would love to hear a better way of doing this than this mess
+$.extend(KhanUtil, {
+ trig: {
+ // given the simplification of a trig identity and an operation,
+ // finds a pair (function, result) such that that simplification
+ // operation'd with function equals result, and result is not a
+ // horrible mess of trig functions with sin^4 everywhere and all that
+ getOptionsResult: function(firstPart, operation) {
+ var options;
+ var func;
+ if(firstPart === "\\cos^2\\theta") {
+ options = ["1", "\\cot^2\\theta",
+ "\\cos^2\\theta \\cdot \\sin^2\\theta"];
+ }
+ else if(firstPart === "\\sin^2\\theta") {
+ options = ["1", "\\tan^2\\theta",
+ "\\cos^2\\theta \\cdot \\sin^2\\theta"];
+ }
+ else if(firstPart === "\\tan^2\\theta") {
+ options = ["1", "\\sin^2\\theta",
+ "\\sec^2\\theta"];
+ }
+ else if(firstPart === "\\sec^2\\theta") {
+ options = ["1", "\\tan^2\\theta", "\\csc^2\\theta"];
+ }
+ else if(firstPart === "\\cot^2\\theta") {
+ options = ["1", "\\cos^2\\theta", "\\csc^2\\theta"];
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ options = ["1", "\\cot^2\\theta", "\\sec^2\\theta"];
+ }
+
+ var result = KhanUtil.randFromArray(options);
+ if(operation === "*") {
+ if(result === "1") {
+ if(firstPart === "\\cos^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ else if(firstPart === "\\sin^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ else if(firstPart === "\\tan^2\\theta") {
+ func = "\\cot^2\\theta";
+ }
+ else if(firstPart === "\\sec^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ else if(firstPart === "\\cot^2\\theta") {
+ func = "\\tan^2\\theta";
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ }
+ else if(result === "\\tan^2\\theta") {
+ if(firstPart === "\\sin^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ else if(firstPart === "\\sec^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ }
+ else if(result === "\\cot^2\\theta") {
+ if(firstPart === "\\cos^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ }
+ else if(result === "\\cos^2\\theta \\cdot \\sin^2\\theta") {
+ if(firstPart === "\\cos^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ else if(firstPart === "\\sin^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ }
+ else if(result === "\\sin^2\\theta") {
+ if(firstPart === "\\tan^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ }
+ else if(result === "\\cos^2\\theta") {
+ if(firstPart === "\\cot^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ }
+ else if(result === "\\sec^2\\theta") {
+ if(firstPart === "\\tan^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ func = "\\tan^2\\theta";
+ }
+ }
+ else if(result === "\\csc^2\\theta") {
+ if(firstPart === "\\sec^2\\theta") {
+ func = "\\cot^2\\theta";
+ }
+ else if(firstPart === "\\cot^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ }
+ }
+
+ else if(operation === "/") {
+ if(result === "1") {
+ func = firstPart;
+ }
+ else if(result === "\\tan^2\\theta") {
+ if(firstPart === "\\sin^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ else if(firstPart === "\\sec^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ }
+ else if(result === "\\cot^2\\theta") {
+ if(firstPart === "\\cos^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ }
+ else if (result === "\\cos^2\\theta \\cdot \\sin^2\\theta") {
+ if(firstPart === "\\cos^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ else if(firstPart === "\\sin^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ }
+ else if (result === "\\sin^2\\theta") {
+ if(firstPart === "\\tan^2\\theta") {
+ func = "\\sec^2\\theta";
+ }
+ }
+ else if(result === "\\cos^2\\theta") {
+ if(firstPart === "\\cot^2\\theta") {
+ func = "\\csc^2\\theta";
+ }
+ }
+ else if (result === "\\sec^2\\theta") {
+ if(firstPart === "\\tan^2\\theta") {
+ func = "\\sin^2\\theta";
+ }
+ else if(firstPart === "\\csc^2\\theta") {
+ func = "\\cot^2\\theta";
+ }
+ }
+ else if (result === "\\csc^2\\theta") {
+ if(firstPart === "\\sec^2\\theta") {
+ func = "\\tan^2\\theta";
+ }
+ else if(firstPart === "\\cot^2\\theta") {
+ func = "\\cos^2\\theta";
+ }
+ }
+ }
+ return [options, func, result];
+ },
+
+ // expresses the given trig^2 function in terms of sin and cosine
+ showSimplified: function(func, small) {
+ d = small ? "\\frac" : "\\dfrac";
+ switch(func) {
+ case "\\sin^2\\theta" :
+ return func;
+ case "\\cos^2\\theta" :
+ return func;
+ case "\\csc^2\\theta" :
+ return d+"{1}{\\sin^2\\theta}";
+ case "\\sec^2\\theta" :
+ return d+"{1}{\\cos^2\\theta}";
+ case "\\tan^2\\theta" :
+ return d+"{\\sin^2\\theta}{\\cos^2\\theta}";
+ case "\\cot^2\\theta" :
+ return d+"{\\cos^2\\theta}{\\sin^2\\theta}";
+ }
+ }
+ }
+});
Please sign in to comment.
Something went wrong with that request. Please try again.