Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 107 lines (95 sloc) 4.855 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 95 96 97 98 99 100 101 102 103 104 105 106
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Parabola intuition 1</title>
    <script data-main="../local-only/main.js" src="../local-only/require.js"></script>
    <style>
        .info-box .mini-button {
            padding: 0px 5px;
            width: 20px;
        }
    </style>
</head>
<body>
    <div class="exercise">
        <div class="vars">
            <var id="A">randRangeNonZero( -3, 3 )</var>
            <var id="X1">randRangeNonZero( -5, 5 )</var>
            <var id="Y1">randRangeNonZero( -5, 5 )</var>
        </div>

        <div class="problems">
            <div>
                <p class="question">Adjust the leading coefficient and vertex coordinates to make the blue parabola match the orange parabola.</p>
                <p>How do these numbers affect the shape and position of a parabola?</p>

                <div class="graphie" id="grid">
                    graphInit({
                        range: 10,
                        scale: 20,
                        tickStep: 1,
                        axisArrows: "&lt;-&gt;"
                    });

                    // Plot the orange parabola
                    style({
                        stroke: "#FFA500",
                        fill: "none",
                        clipRect:[[-10, -10], [20, 20]],
                        arrows: null
                    });

                    plot(new Parabola(A, X1, Y1).graphieFunction, [-10, 10]);

                    style({
                        stroke: "#6495ED",
                        strokeWidth: 3,
                        fill: "none",
                        clipRect:[[-10, -10], [20, 20]],
                        arrows: null
                    });

                    graph.currParabola = new Parabola(1, 0, 0);
                    graph.currParabola.plot();

                </div>

                <div class="solution" data-type="custom">
                    <!--
There didn't seem to be an easy way to bind handlers normally after everything had loaded.
It would also be nice to press and hold.
-->
                    <div class="instruction">
                        <div id="plus-buttons">
                            <input class="simple-button mini-button" onclick="updateParabola(0, 0, -1)" style="margin-left: 20px;" type="button" value="+">
                            <input class="simple-button mini-button" onclick="updateParabola(1, 0, 0)" style="margin-left: 8px;" type="button" value="+">
                            <input class="simple-button mini-button" onclick="updateParabola(0, -1, 0)" style="margin-left: 20px;" type="button" value="+">
                        </div>

                        <p id="equation-label" style="margin: 8px 0px 2px 0px"><code>y - 0 = 1(x - 0)^{2}</code></p>

                        <div id="minus-buttons" style="padding-bottom: 15px">
                            <input class="simple-button mini-button" onclick="updateParabola(0, 0, 1)" style="margin-left: 20px;" type="button" value="-">
                            <input class="simple-button mini-button" onclick="updateParabola(-1, 0, 0)" style="margin-left: 8px;" type="button" value="-">
                            <input class="simple-button mini-button" onclick="updateParabola(0, 1, 0)" style="margin-left: 20px;" type="button" value="-">
                        </div>
                    </div>

                    <div class="guess">[A, X1, Y1]</div>
                    <div class="validator-function">
                        var parab = graph.currParabola;
                        return parab.getLeadingCoefficient() === A &amp;&amp;
                               parab.getVertexX() === X1 &amp;&amp;
                               parab.getVertexY() === Y1;
                    </div>
                    <div class="show-guess">
                        guess = guess.length ? guess : [1, 0, 0];
                        var parab = graph.currParabola;
                        parab.update.apply(parab, guess);
                        redrawParabola(false);
                    </div>
                    <div class="show-guess-solutionarea">
                        guess = guess.length ? guess : [1, 0, 0];
                        var a = guess[0],
                            x = guess[1],
                            y = guess[2];
                        var equation = "y - " + y + "=" + a + "(x - " + x + ")^{2}";
                        equation = cleanMath(equation);
                        $("#equation-label").html("&lt;code&gt;" + equation + "&lt;/code&gt;").tex();
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
Something went wrong with that request. Please try again.