JSXGraph logo
JSXGraph
JSXGraph share

Share

Parabola as locus curve
QR code
<iframe 
    src="https://jsxgraph.org/share/iframe/parabola-ii" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Parabola as locus curve" 
    allowfullscreen
></iframe>
This code has to
<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    JXG.Options.text.fontSize = 16;
    JXG.Options.line.strokeWidth = 0.8;
    
    var board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-5, 5, 5, -5],
        keepaspectratio: true,
        axis: true
    });
    
    var f = board.create('glider', [1, 0, board.defaultAxes.x], { name: "focus" }); // focus point
    var c = board.create('glider', [-1, 0, board.defaultAxes.x], { name: "-c" });
    var l = board.create('parallel', [board.defaultAxes.y, c], {
        name: "directrix",
        withLabel: true,
        label: { position:  '60% right', anchorX: 'right', distance: 0.5}
    }); // directrix line
    
    var par = board.create('parabola', [f, l]);
    
    var P = board.create('glider', [2, 2, par], { name: 'p' });
    
    var s1 = board.create('segment', [f, P]);
    var q = board.create('point', [() => c.X(), () => P.Y()], { name: 'q' });
    var s2 = board.create('segment', [q, P]);
    
    var txt = board.create('text', [0.2, 4, () => "|pf| - |pq| = " + P.Dist(f).toFixed(2) + ' - ' + P.Dist(q).toFixed(2) +
        ' = ' + (P.Dist(f) - P.Dist(q)).toFixed(2)]);
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

JXG.Options.text.fontSize = 16;
JXG.Options.line.strokeWidth = 0.8;

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-5, 5, 5, -5],
    keepaspectratio: true,
    axis: true
});

var f = board.create('glider', [1, 0, board.defaultAxes.x], { name: "focus" }); // focus point
var c = board.create('glider', [-1, 0, board.defaultAxes.x], { name: "-c" });
var l = board.create('parallel', [board.defaultAxes.y, c], {
    name: "directrix",
    withLabel: true,
    label: { position:  '60% right', anchorX: 'right', distance: 0.5}
}); // directrix line

var par = board.create('parabola', [f, l]);

var P = board.create('glider', [2, 2, par], { name: 'p' });

var s1 = board.create('segment', [f, P]);
var q = board.create('point', [() => c.X(), () => P.Y()], { name: 'q' });
var s2 = board.create('segment', [q, P]);

var txt = board.create('text', [0.2, 4, () => "|pf| - |pq| = " + P.Dist(f).toFixed(2) + ' - ' + P.Dist(q).toFixed(2) +
    ' = ' + (P.Dist(f) - P.Dist(q)).toFixed(2)]);
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Parabola as locus curve" description="This construction was copied from JSXGraph examples database: BTW HERE SHOULD BE A GENERATED LINKuseGlobalJS="false">
   /*
   This example is licensed under a 
   Creative Commons Attribution ShareAlike 4.0 International License.
   https://creativecommons.org/licenses/by-sa/4.0/
   
   Please note you have to mention 
   The Center of Mobile Learning with Digital Technology
   in the credits.
   */
   
   JXG.Options.text.fontSize = 16;
   JXG.Options.line.strokeWidth = 0.8;
   
   var board = JXG.JSXGraph.initBoard(BOARDID, {
       boundingbox: [-5, 5, 5, -5],
       keepaspectratio: true,
       axis: true
   });
   
   var f = board.create('glider', [1, 0, board.defaultAxes.x], { name: "focus" }); // focus point
   var c = board.create('glider', [-1, 0, board.defaultAxes.x], { name: "-c" });
   var l = board.create('parallel', [board.defaultAxes.y, c], {
       name: "directrix",
       withLabel: true,
       label: { position:  '60% right', anchorX: 'right', distance: 0.5}
   }); // directrix line
   
   var par = board.create('parabola', [f, l]);
   
   var P = board.create('glider', [2, 2, par], { name: 'p' });
   
   var s1 = board.create('segment', [f, P]);
   var q = board.create('point', [() => c.X(), () => P.Y()], { name: 'q' });
   var s2 = board.create('segment', [q, P]);
   
   var txt = board.create('text', [0.2, 4, () => "|pf| - |pq| = " + P.Dist(f).toFixed(2) + ' - ' + P.Dist(q).toFixed(2) +
       ' = ' + (P.Dist(f) - P.Dist(q)).toFixed(2)]);
</jsxgraph>

Parabola as locus curve

This example visualizes a parabola with a focus and directrix. This example shows that the parabola consists of those points $p$ for which the distance to the focus point equals the distance to the directrix line.
// Define the id of your board in BOARDID

JXG.Options.text.fontSize = 16;
JXG.Options.line.strokeWidth = 0.8;

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-5, 5, 5, -5],
    keepaspectratio: true,
    axis: true
});

var f = board.create('glider', [1, 0, board.defaultAxes.x], { name: "focus" }); // focus point
var c = board.create('glider', [-1, 0, board.defaultAxes.x], { name: "-c" });
var l = board.create('parallel', [board.defaultAxes.y, c], {
    name: "directrix",
    withLabel: true,
    label: { position:  '60% right', anchorX: 'right', distance: 0.5}
}); // directrix line

var par = board.create('parabola', [f, l]);

var P = board.create('glider', [2, 2, par], { name: 'p' });

var s1 = board.create('segment', [f, P]);
var q = board.create('point', [() => c.X(), () => P.Y()], { name: 'q' });
var s2 = board.create('segment', [q, P]);

var txt = board.create('text', [0.2, 4, () => "|pf| - |pq| = " + P.Dist(f).toFixed(2) + ' - ' + P.Dist(q).toFixed(2) +
    ' = ' + (P.Dist(f) - P.Dist(q)).toFixed(2)]);

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.