Interpolation: Neville's algorithm: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<html>
<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/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<form><input type="button" value="Add point" onClick="addPoint()"></form>
<form><input type="button" value="Add point" onClick="addPoint()"></form>
<div id="box" class="jxgbox" style="width:600px; height:400px;"></div>
</html>
<script language="JavaScript">
<jsxgraph box="box" width="600" height="400">
     board = JXG.JSXGraph.initBoard('box', {axis:true, originX: 250, originY: 250, unitX: 50, unitY: 25});
     board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 7, -3]});
    board.suspendUpdate();
     var p = [];
     var p = [];
     p[0] = board.createElement('point', [-1,2], {style:6});
     p[0] = board.create('point', [-1,2], {size:4});
     p[1] = board.createElement('point', [3,-1], {style:6});
     p[1] = board.create('point', [3,-1], {size:4});
     p[2] = board.createElement('point', [2,1], {style:6});
     p[2] = board.create('point', [2,1], {size:4});
     graph = board.createElement('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.createElement('glider', [graph], {name:'Glider'});
     g = board.create('glider', [graph], {name:'Glider'});
     t = board.createElement('tangent', [g],{dash:1,strokeColor:'green'});
     t = board.create('tangent', [g],{dash:1,strokeColor:'green'});
     l = board.createElement('line', [p[0],p[5]],{dash:1,strokeColor:'green'});
     board.unsuspendUpdate();
        
        
     function addPoint() {
     function addPoint() {
       p.push(board.createElement('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{style:6}));
       p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size:4}));
       board.update();
       board.update();
     }
     }
            
            
</script>
</jsxgraph>
</html>
 
=== 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="html4strict">
<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/prototype.js"></script>
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<div id="box" class="jxgbox" style="width:600px; height:400px;"></div>
</source>


<source lang="javascript">
<source lang="javascript">
    board = JXG.JSXGraph.initBoard('box', {axis:true, originX: 250, originY: 250, unitX: 50, unitY: 25});
board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-5, 5, 7, -3]});
    var p = [];
board.suspendUpdate();
    p[0] = board.createElement('point', [-1,2], {style:6});
var p = [];
    p[1] = board.createElement('point', [3,-1], {style:6});
p[0] = board.create('point', [-1,2], {size:4});
    graph = board.createElement('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
p[1] = board.create('point', [3,-1], {size:4});
    g = board.createElement('glider', [graph]);
p[2] = board.create('point', [2,1], {size:4});
    t = board.createElement('tangent', [g],{dash:1,strokeColor:'green'});
 
    l = board.createElement('line', [p[0],p[5]],{dash:1,strokeColor:'green'});
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() {
function addPoint() {
      p.push(board.createElement('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{style:6}));
    p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size:4}));
      board.update();
    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();
}