Interpolation: Neville's algorithm: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
No edit summary |
||
(12 intermediate revisions by 2 users not shown) | |||
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(); | |||
var p = []; | var p = []; | ||
p[0] = board. | p[0] = board.create('point', [-1,2], {size:4}); | ||
p[1] = board. | p[1] = board.create('point', [3,-1], {size:4}); | ||
p[2] = board. | p[2] = board.create('point', [2,1], {size:4}); | ||
graph = board. | graph = board.create('curve', JXG.Math.Numerics.Neville(p),{strokeWidth:5,strokeOpacity:0.5}); | ||
g = board. | g = board.create('glider', [graph], {name:'Glider'}); | ||
t = board. | t = board.create('tangent', [g],{dash:1,strokeColor:'green'}); | ||
board.unsuspendUpdate(); | |||
function addPoint() { | function addPoint() { | ||
p.push(board. | 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/ | * [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', 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(); | |||
} | |||
</source> | </source> | ||
Line 53: | Line 48: | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Calculus]] | [[Category:Calculus]] | ||
[[Category:Curves]] | |||
[[Category:Interpolation]] |
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();
}