Interpolation: Neville's algorithm: Difference between revisions

From JSXGraph Wiki
No edit summary
Line 6: Line 6:
<div id="box" class="jxgbox" style="width:600px; height:400px;"></div>
<div id="box" class="jxgbox" style="width:600px; height:400px;"></div>
<script language="JavaScript">
<script language="JavaScript">
     board = JXG.JSXGraph.initBoard('box', {axis:true, originX: 250, originY: 250, unitX: 50, unitY: 25});
     board = JXG.JSXGraph.initBoard('box', {axis:true, originX: 250, originY: 250, unitX: 50, unitY: 50});
     var p = [];
     var p = [];
     p[0] = board.createElement('point', [-1,2], {style:6});
     p[0] = board.createElement('point', [-1,2], {style:6});
Line 35: Line 35:


<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, originX: 250, originY: 250, unitX: 50, unitY: 50});
     var p = [];
     var p = [];
     p[0] = board.createElement('point', [-1,2], {style:6});
     p[0] = board.createElement('point', [-1,2], {style:6});

Revision as of 14:46, 10 March 2009

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