Interpolation: Neville's algorithm: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
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/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: 50});
     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], {style:6});
     p[0] = board.create('point', [-1,2], {size:4});
     p[1] = board.create('point', [3,-1], {style:6});
     p[1] = board.create('point', [3,-1], {size:4});
     p[2] = board.create('point', [2,1], {style:6});
     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],{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/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: 50});
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], {style:6});
p[0] = board.create('point', [-1,2], {size:4});
    p[1] = board.create('point', [3,-1], {style:6});
p[1] = board.create('point', [3,-1], {size:4});
    p[2] = board.create('point', [2,1], {style:6});
p[2] = board.create('point', [2,1], {size:4});
    graph = board.create('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
var graph = board.create('curve', board.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'});
    board.unsuspendUpdate();
board.unsuspendUpdate();
        
        
    function addPoint() {
function addPoint() {
      p.push(board.create('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>



Revision as of 07: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();
}