// Define the id of your board in BOARDID
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
This example is licensed under a Creative Commons Attribution 4.0 International License.
Please note that you have to mention The Center of Mobile Learning with Digital Technology in the credits.
/*
This example is licensed under a
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const BOARDID = 'your_div_id'; // Insert your id here!
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
<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 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const BOARDID = 'board-0';
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
</script>
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Differentiability" description="This construction was copied from JSXGraph examples database: https://jsxgraph.org/share/" useGlobalJS="false">
/*
This example is licensed under a
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
</jsxgraph>
/*
This example is licensed under a
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const BOARDID = 'your_div_id'; // Insert your id here!
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
<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 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const BOARDID = 'board-0';
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
</script>
<jsxgraph width="100%" aspect-ratio="1 / 1" title="Differentiability" description="This construction was copied from JSXGraph examples database: https://jsxgraph.org/share/" useGlobalJS="false">
/*
This example is licensed under a
Creative Commons Attribution 4.0 International License.
https://creativecommons.org/licenses/by/4.0/
Please note that you have to mention
The Center of Mobile Learning with Digital Technology
in the credits.
*/
const board = JXG.JSXGraph.initBoard(BOARDID, {
boundingbox: [-5, 10, 7, -6],
axis: true,
showClearTraces: true,
showFullscreen: true});
// Blue points that define the function graph
var p = [];
p[0] = board.create('point', [-1,0], {withLabel: false, size:2, color:'blue'});
p[1] = board.create('point', [-0.5,3], {withLabel: false, size:2, color:'blue'});
p[2] = board.create('point', [2,0.5], {withLabel: false, size:2, color:'blue'});
p[3] = board.create('point', [6, 3], {withLabel: false, size:2, color:'blue'});
// Lagrange polynomial through blue points
var pol = JXG.Math.Numerics.lagrangePolynomial(p);
var graph = board.create('functiongraph', [pol, -10, 10], {strokeWidth: 2, name:"f", withLabel: true});
var x0 = board.create('glider', [1, 0, board.defaultAxes.x], {name: 'x_0', size:4, label: {fontSize:20}});
var x = board.create('glider', [5, 0, board.defaultAxes.x], {name: 'x', size:4, label: {fontSize:20}});
var fx0 = board.create('point', [function() { return x0.X(); }, function() { return pol(x0.X()); }], {name: '', color: 'grey', fixed: true, size:3});
var fx = board.create('point', [function() { return x.X(); }, function() { return pol(x.X()); }], {name: '', color: 'grey', fixed: true, size:3});
// Secant through fx0 and fx
var line = board.create('line', [fx0, fx],{strokeColor:'#ff0000', dash:2});
// Trace point visualizing f_1
var f1 = board.create('point', [
() => x.X(),
() => (fx.Y() - fx0.Y()) / (fx.X() - fx0.X() + 0.0000001)],
{size: 1, name: 'f_1', color: 'black', fixed: true, trace: true});
// Print function values of f_1
var txt = board.create('text', [0.5, 7,
() => '( ' +
fx.Y().toFixed(2) + ' - (' + fx0.Y().toFixed(2) +
') ) / ( ' +
fx.X().toFixed(2) + ' - (' + fx0.X().toFixed(2) +
') ) = ' + ((fx.Y() - fx0.Y()) / (fx.X() - fx0.X())).toFixed(3)
]);
// Plot derivative
board.create('functiongraph',[JXG.Math.Numerics.D(pol)], {dash: 2, name:"f'", withLabel: true});
</jsxgraph>