Difference between revisions of "Interpolation: Neville's algorithm"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
|||
Line 1: | Line 1: | ||
<html> | <html> | ||
− | |||
− | |||
<form><input type="button" value="Add point" onClick="addPoint()"></form> | <form><input type="button" value="Add point" onClick="addPoint()"></form> | ||
− | < | + | </html> |
− | + | <jsxgraph box="box" width="600" height="400"> | |
− | board = JXG.JSXGraph.initBoard('box', {axis:true, | + | board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 7, -3]}); |
board.suspendUpdate(); | board.suspendUpdate(); | ||
var p = []; | var p = []; | ||
− | p[0] = board.create('point', [-1,2], { | + | p[0] = board.create('point', [-1,2], {size:4}); |
− | p[1] = board.create('point', [3,-1], { | + | p[1] = board.create('point', [3,-1], {size:4}); |
− | p[2] = board.create('point', [2,1], { | + | 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', board.neville(p),{strokeWidth:5,strokeOpacity:0.5}); | ||
g = board.create('glider', [graph], {name:'Glider'}); | g = board.create('glider', [graph], {name:'Glider'}); | ||
Line 17: | Line 15: | ||
function addPoint() { | function addPoint() { | ||
− | p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{ | + | p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size:4})); |
board.update(); | board.update(); | ||
} | } | ||
− | </ | + | </jsxgraph> |
− | + | ||
=== References === | === References === | ||
* [http://en.wikipedia.org/wiki/Neville%27s_algorithm http://en.wikipedia.org/wiki/Neville's_algorithm] | * [http://en.wikipedia.org/wiki/Neville%27s_algorithm http://en.wikipedia.org/wiki/Neville's_algorithm] | ||
=== The underlying JavaScript code === | === The underlying JavaScript code === | ||
− | |||
− | |||
− | |||
− | |||
− | |||
<source lang="javascript"> | <source lang="javascript"> | ||
− | + | 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', board.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(); | |
− | + | } | |
</source> | </source> | ||
Revision as of 09:52, 8 June 2011
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', board.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();
}