Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 87 lines (69 sloc) 4.456 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
<!DOCTYPE html>
<html data-require="math polynomials expressions">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Functions 3</title>
    <script src="../khan-exercise.js"></script>
</head>
<body>
    <div class="exercise">
        <div class="vars" data-ensure="INNER.name !== OUTER.name && INNER.minDegree <= INNER.maxDegree && OUTER.minDegree <= OUTER.maxDegree && abs( INNER_VALUE ) < 200 && abs( OUTER_VALUE ) < 500">
            <var id="FUNC_NAMES">shuffle(["f", "g", "h"])</var>
            <var id="FUNC_VARIABLES">["x", "n", "t"]</var>

            <var id="INNER">new Polynomial( randRange(0, 2), randRangeWeighted(1, 3, 3, 0.2), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[0] )</var>

            <var id="OUTER">new CompositePolynomial( randRange(0, 2), randRangeWeighted(1, 3, 3, 0.2), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[1], INNER )</var>
        </div>

        <div class="problems">
            <div>
                <div class="vars">
                    <var id="FUNCTIONS">shuffle([INNER, OUTER])</var>
                    <var id="SOLVE_FOR">shuffle([INNER, OUTER])</var>

                    <var id="VALUE">randRange(-10, 10)</var>
                    <var id="INNER_VALUE">SOLVE_FOR[1].evalOf(VALUE)</var>

                    <!-- Solution -->
                    <var id="OUTER_VALUE">SOLVE_FOR[0].evalOf(INNER_VALUE)</var>
                </div>

                <div class="problem">
                    <ul>
                        <li><code><var>FUNCTIONS[0].name</var>(<var>FUNCTIONS[0].variable</var>) = <var>FUNCTIONS[0].text()</var></code></li>
                        <li><code><var>FUNCTIONS[1].name</var>(<var>FUNCTIONS[1].variable</var>) = <var>FUNCTIONS[1].text()</var></code></li>
                    </ul>
                </div>

                <p class="question"><code>
                    <var>SOLVE_FOR[0].name</var>(<var>SOLVE_FOR[1].name</var>(<var>VALUE</var>)) = {?}
                </code></p>
                <p class="solution"><var>OUTER_VALUE</var></p>
            </div>

            <div>
                <div class="vars" data-ensure="OUTER2.name !== INNER.name && OUTER2.name !== OUTER.name && OUTER2.minDegree <= OUTER2.maxDegree">
                    <var id="OUTER2">new CompositePolynomial( randRange(0, 2), randRange(1, 3), null, randFromArray(FUNC_VARIABLES), FUNC_NAMES[2], randFromArray([INNER, OUTER]) )</var>

                    <var id="FUNCTIONS">shuffle([INNER, OUTER, OUTER2])</var>

                    <var id="SOLVE_FOR">shuffle([INNER, OUTER, OUTER2])</var>

                    <var id="VALUE">randRange(-10, 10)</var>
                    <var id="INNER_VALUE">SOLVE_FOR[1].evalOf(VALUE)</var>

                    <!-- Solution -->
                    <var id="OUTER_VALUE">SOLVE_FOR[0].evalOf(INNER_VALUE)</var>
                </div>

                <div class="problem">
                    <ul>
                        <li><code><var>FUNCTIONS[0].name</var>(<var>FUNCTIONS[0].variable</var>) = <var>FUNCTIONS[0].text()</var></code></li>
                        <li><code><var>FUNCTIONS[1].name</var>(<var>FUNCTIONS[1].variable</var>) = <var>FUNCTIONS[1].text()</var></code></li>
                        <li><code><var>FUNCTIONS[2].name</var>(<var>FUNCTIONS[2].variable</var>) = <var>FUNCTIONS[2].text()</var></code></li>
                    </ul>
                </div>

                <p class="question"><code>
                    <var>SOLVE_FOR[0].name</var>(<var>SOLVE_FOR[1].name</var>(<var>VALUE</var>)) = {?}
                </code></p>
                <p class="solution"><var>OUTER_VALUE</var></p>
            </div>
        </div>

        <div class="hints">
            <p>First, let's solve for the value of the inner function, <code><var>SOLVE_FOR[1].name</var>(<var>VALUE</var>)</code>. Then we'll know what to plug into the outer function.</p>
            <div data-each="SOLVE_FOR[1].hint(VALUE) as key, value"><var>value</var></div>

            <p>Now we know that <code><var>SOLVE_FOR[1].name</var>(<var>VALUE</var>) = <var>INNER_VALUE</var></code>.

            Let's solve for <code><var>SOLVE_FOR[0].name</var>(<var>SOLVE_FOR[1].name</var>(<var>VALUE</var>))</code>, which is <code><var>SOLVE_FOR[0].name</var>(<var>INNER_VALUE</var>)</code>.</p>

            <div data-each="SOLVE_FOR[0].hint(INNER_VALUE) as key, value"><var>value</var></div>
        </div>
    </div>
</body>
</html>
Something went wrong with that request. Please try again.