JSXGraph logo
JSXGraph
JSXGraph share

Share

Parabola
QR code
<iframe 
    src="https://www.jsxgraph.org/share/iframe/parabola" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Parabola" 
    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.slider.snapValues = [-5, -2, -1, 0, 1, 2, 5];
    JXG.Options.slider.snapValueDistance = 0.2;
    
    const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-10, 10, 10, -10], axis: true });
    
    var a = board.create('slider', [[2, -5], [7, -5], [-5, 1, 5]], { name: 'a' });
    var b = board.create('slider', [[2, -6], [7, -6], [-5, 0, 5]], { name: 'b' });
    var c = board.create('slider', [[2, -7], [7, -7], [-5, 0, 5]], { name: 'c' });
    
    var f = board.create('functiongraph', [(x) => a.Value() * x * x + b.Value() * x + c.Value()]);
    
    var txt = board.create('text', [-9, -5,
           () => JXG.Math.Numerics.generatePolynomialTerm([c.Value(), b.Value(), a.Value()], 2, 'x', 2)
    ], { fontSize: 18 });
 </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.slider.snapValues = [-5, -2, -1, 0, 1, 2, 5];
JXG.Options.slider.snapValueDistance = 0.2;

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

var a = board.create('slider', [[2, -5], [7, -5], [-5, 1, 5]], { name: 'a' });
var b = board.create('slider', [[2, -6], [7, -6], [-5, 0, 5]], { name: 'b' });
var c = board.create('slider', [[2, -7], [7, -7], [-5, 0, 5]], { name: 'c' });

var f = board.create('functiongraph', [(x) => a.Value() * x * x + b.Value() * x + c.Value()]);

var txt = board.create('text', [-9, -5,
       () => JXG.Math.Numerics.generatePolynomialTerm([c.Value(), b.Value(), a.Value()], 2, 'x', 2)
], { fontSize: 18 });
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Parabola" 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.slider.snapValues = [-5, -2, -1, 0, 1, 2, 5];
   JXG.Options.slider.snapValueDistance = 0.2;
   
   const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-10, 10, 10, -10], axis: true });
   
   var a = board.create('slider', [[2, -5], [7, -5], [-5, 1, 5]], { name: 'a' });
   var b = board.create('slider', [[2, -6], [7, -6], [-5, 0, 5]], { name: 'b' });
   var c = board.create('slider', [[2, -7], [7, -7], [-5, 0, 5]], { name: 'c' });
   
   var f = board.create('functiongraph', [(x) => a.Value() * x * x + b.Value() * x + c.Value()]);
   
   var txt = board.create('text', [-9, -5,
          () => JXG.Math.Numerics.generatePolynomialTerm([c.Value(), b.Value(), a.Value()], 2, 'x', 2)
   ], { fontSize: 18 });
</jsxgraph>

Parabola

This is a popular example in calculus to introduce the notion of a parabola function \[ x \mapsto a\cdot x^2 + b\cdot x + x \] in schools. The parameters $a$, $b$ , and $c$ can be changed by dragging the sliders.
// Define the id of your board in BOARDID

JXG.Options.slider.snapValues = [-5, -2, -1, 0, 1, 2, 5];
JXG.Options.slider.snapValueDistance = 0.2;

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

var a = board.create('slider', [[2, -5], [7, -5], [-5, 1, 5]], { name: 'a' });
var b = board.create('slider', [[2, -6], [7, -6], [-5, 0, 5]], { name: 'b' });
var c = board.create('slider', [[2, -7], [7, -7], [-5, 0, 5]], { name: 'c' });

var f = board.create('functiongraph', [(x) => a.Value() * x * x + b.Value() * x + c.Value()]);

var txt = board.create('text', [-9, -5,
       () => JXG.Math.Numerics.generatePolynomialTerm([c.Value(), b.Value(), a.Value()], 2, 'x', 2)
], { fontSize: 18 });

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.