Interpolation: Neville's algorithm: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 9: Line 9:
     p[1] = board.create('point', [3,-1], {size:4});
     p[1] = board.create('point', [3,-1], {size:4});
     p[2] = board.create('point', [2,1], {size:4});
     p[2] = board.create('point', [2,1], {size:4});
     graph = board.create('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
     graph = board.create('curve', JXG.Math.Numerics.Neville(p),{strokeWidth:5,strokeOpacity:0.5});
     g = board.create('glider', [graph], {name:'Glider'});
     g = board.create('glider', [graph], {name:'Glider'});
     t = board.create('tangent', [g],{dash:1,strokeColor:'green'});
     t = board.create('tangent', [g],{dash:1,strokeColor:'green'});
Line 33: Line 33:
p[1] = board.create('point', [3,-1], {size:4});
p[1] = board.create('point', [3,-1], {size:4});
p[2] = board.create('point', [2,1], {size:4});
p[2] = board.create('point', [2,1], {size:4});
var graph = board.create('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
 
var graph = board.create('curve', JXG.Math.Numerics.Neville(p),{strokeWidth:5,strokeOpacity:0.5});
g = board.create('glider', [graph]);
g = board.create('glider', [graph]);
t = board.create('tangent', [g],{dash:1,strokeColor:'green'});
t = board.create('tangent', [g],{dash:1,strokeColor:'green'});

Latest revision as of 20:39, 14 November 2020

References

The underlying JavaScript code

board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 7, -3]});
board.suspendUpdate();
var p = [];
p[0] = board.create('point', [-1,2], {size:4});
p[1] = board.create('point', [3,-1], {size:4});
p[2] = board.create('point', [2,1], {size:4});

var graph = board.create('curve', JXG.Math.Numerics.Neville(p),{strokeWidth:5,strokeOpacity:0.5});
g = board.create('glider', [graph]);
t = board.create('tangent', [g],{dash:1,strokeColor:'green'});
board.unsuspendUpdate();
      
function addPoint() {
    p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size:4}));
    board.update();
}