Difference between revisions of "Interpolation: Neville's algorithm"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) (New page: <html> <link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" /> <script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/pro...) |
|||
(13 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}); |
− | graph = board. | + | p[2] = board.create('point', [2,1], {size:4}); |
− | g = board. | + | graph = board.create('curve', JXG.Math.Numerics.Neville(p),{strokeWidth:5,strokeOpacity:0.5}); |
− | t = board. | + | g = board.create('glider', [graph], {name:'Glider'}); |
− | + | 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 52: | Line 48: | ||
[[Category:Examples]] | [[Category:Examples]] | ||
[[Category:Calculus]] | [[Category:Calculus]] | ||
+ | [[Category:Curves]] | ||
+ | [[Category:Interpolation]] |
Latest revision as of 22: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();
}