Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 94 lines (75 sloc) 4.322 kb
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
<!DOCTYPE html>
<html data-require="math math-format graphie expressions">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Inverse trig functions</title>
    <script src="../khan-exercise.js"></script>
</head>
<body>
    <div class="exercise">
        <p class="summary">This exercise covers inverses of trig functions.</p>

        <div class="vars">

            <!-- whether we present the question as arcsin(x) = ? or sin^-1(x) = ? -->
            <var id="ARC">random() &lt; 0.5</var>

            <!-- whether we expect the answer in terms of degrees or radians -->
            <var id="DEG">random() &lt; 0.5</var>

            <var id="FN">randFromArray([ "sin", "cos", "tan" ])</var>
            <var id="FN_INV">"\\" + FN + "^{-1}"</var>
            <var id="FN_ARC">"\\arc" + FN</var>
            <var id="FN_TEX">function( x, arc ) {
                return ( ( typeof arc === "undefined" ? ARC : arc ) ? FN_ARC : FN_INV ) + "\\left(" + x + "\\right)";
            }</var>

            <var id="SIN_RANGE">[ 0, 1/2, sqrt(2)/2, sqrt(3)/2 ]</var>
            <var id="TAN_RANGE">[ 0, sqrt(3)/3, 1, sqrt(3) ]</var>

            <var id="X">( random() &lt; 0.5 ? -1 : 1 ) * {
                sin: randFromArray( SIN_RANGE ),
                cos: randFromArray( SIN_RANGE ),
                tan: randFromArray( TAN_RANGE )
            }[ FN ]</var>

            <var id="Y">{
                sin: asin,
                cos: acos,
                tan: atan
            }[ FN ]( X )</var>

            <var id="Y_DEGREES">round( Y * 180 / PI )</var>
            <var id="Y_RADIANS">KhanUtil.toFraction( Y / Math.PI, 0.001 )</var>

            <!-- 90deg, 90 deg, 90 degrees, 90 DEGREES, etc. -->
            <var id="Y_DEGREES_REGEX">( Y_DEGREES === 0 ? "^(\\s*0*\\s*)|" : "^" ) + Y_DEGREES + "\\s*[Dd][Ee][Gg]([Rr][Ee][Ee][Ss])?\\s*$"</var>

            <var id="PRETTY">function( n ) {

                var sign = n &lt; 0 ? "-" : "";
                n = abs( n );

                var o = {};
                o[ 1/2 ] = "\\frac{1}{2}";
                o[ sqrt(2)/2 ] = "\\frac{\\sqrt{2}}{2}";
                o[ sqrt(3)/2 ] = "\\frac{\\sqrt{3}}{2}";
                o[ sqrt(3)/3 ] = "\\frac{\\sqrt{3}}{3}";
                o[ sqrt(3) ] = "\\sqrt{3}";

                return sign + ( o[n] || n );

            }</var>

            <var id="DOMAIN">{
                sin: [ DEG ? "-90&deg;" : "-\\frac{\\pi}{2}", DEG ? "90&deg;" : "\\frac{\\pi}{2}" ],
                cos: [ "0", DEG ? "180&deg;" : "\\pi" ],
                tan: [ DEG ? "-90&deg;" : "-\\frac{\\pi}{2}", DEG ? "90&deg;" : "\\frac{\\pi}{2}" ]
            }[ FN ]</var>

        </div>

        <div class="problems">
            <div>
                <div class="question">
                    <p>What is the principal value of <code><var>FN_TEX( PRETTY( X ) )</var></code>?</p>
                    <p>Note: please answer in terms of <span data-if="DEG">degrees (ex: &quot;180 deg&quot; or &quot;180 degrees&quot;)</span><span data-else>radians (ex: &quot;3/4 pi&quot;)</span>.</p>
                </div>

                <div data-if="DEG"><p class="solution" data-type="regex"><var>Y_DEGREES_REGEX</var></p></div>
                <div data-else><p class="solution" data-forms="pi"><var>Y</var></p></div>
            </div>
        </div>

        <div class="hints">
            <p data-if="ARC"><code><var>FN_TEX( PRETTY( X ) )</var> = <var>FN_TEX( PRETTY( X ), false )</var></code></p>
            <p>If <code><var>FN_TEX( PRETTY( X ), false )</var> = \theta</code>, then...</p>
            <p><code><var>"\\" + FN</var>\left( \theta \right) = <var>PRETTY( X )</var></code></p>
            <p>The range of <code><var>FN_TEX( "x" )</var></code> is <code>[ <var>DOMAIN[0]</var>, <var>DOMAIN[1]</var> ]</code>, so we know <code><var>DOMAIN[0]</var> \leq \theta \leq <var>DOMAIN[1]</var></code>.</p>
            <p><code><var>"\\" + FN</var> \left( <var>( DEG ? Y_DEGREES + "&deg;" : fractionReduce( Y_RADIANS[0], Y_RADIANS[1], true ) + "\\pi" )</var> \right) = <var>PRETTY( X )</var></code></p>
            <p>So <code><var>FN_TEX( PRETTY( X ) )</var> = <var>DEG ? Y_DEGREES + "&deg;" : fractionReduce( Y_RADIANS[0], Y_RADIANS[1], true ) + "\\pi"</var></code>.</p>
        </div>
    </div>
</body>
</html>
Something went wrong with that request. Please try again.