Difference between revisions of "Interpolation: Neville's algorithm"

From JSXGraph Wiki
Jump to navigationJump to search
Line 8: Line 8:
 
     board.suspendUpdate();
 
     board.suspendUpdate();
 
     var p = [];
 
     var p = [];
     p[0] = board.createElement('point', [-1,2], {style:6});
+
     p[0] = board.create('point', [-1,2], {style:6});
     p[1] = board.createElement('point', [3,-1], {style:6});
+
     p[1] = board.create('point', [3,-1], {style:6});
     p[2] = board.createElement('point', [2,1], {style:6});
+
     p[2] = board.create('point', [2,1], {style:6});
     graph = board.createElement('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
+
     graph = board.create('curve', board.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'});
 
     board.unsuspendUpdate();
 
     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],{style:6}));
 
       board.update();
 
       board.update();
 
     }
 
     }
Line 37: Line 37:
 
     board.suspendUpdate();
 
     board.suspendUpdate();
 
     var p = [];
 
     var p = [];
     p[0] = board.createElement('point', [-1,2], {style:6});
+
     p[0] = board.create('point', [-1,2], {style:6});
     p[1] = board.createElement('point', [3,-1], {style:6});
+
     p[1] = board.create('point', [3,-1], {style:6});
     p[2] = board.createElement('point', [2,1], {style:6});
+
     p[2] = board.create('point', [2,1], {style:6});
     graph = board.createElement('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
+
     graph = board.create('curve', board.neville(p),{strokeWidth:5,strokeOpacity:0.5});
     g = board.createElement('glider', [graph]);
+
     g = board.create('glider', [graph]);
     t = board.createElement('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.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],{style:6}));
 
       board.update();
 
       board.update();
 
     }
 
     }
Line 55: Line 55:
 
[[Category:Calculus]]
 
[[Category:Calculus]]
 
[[Category:Curves]]
 
[[Category:Curves]]
 +
[[Category:Interpolation]]

Revision as of 18:15, 29 July 2010

References

The underlying JavaScript code

<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>
    board = JXG.JSXGraph.initBoard('box', {axis:true, originX: 250, originY: 250, unitX: 50, unitY: 50});
    board.suspendUpdate();
    var p = [];
    p[0] = board.create('point', [-1,2], {style:6});
    p[1] = board.create('point', [3,-1], {style:6});
    p[2] = board.create('point', [2,1], {style:6});
    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],{style:6}));
      board.update();
    }