Cubic spline interpolation: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 15: Line 15:
         var p = [];
         var p = [];
         p[0] = board.createElement('point', [-1,2], {style:6});
         p[0] = board.createElement('point', [-1,2], {style:6});
         p[1] = board.createElement('point', [3,-1], {style:6});
         p[1] = board.createElement('point', [0,-1], {style:6});
         p[2] = board.createElement('point', [5,0], {style:6});
         p[2] = board.createElement('point', [1,0], {style:6});
        p[3] = board.createElement('point', [2,1], {style:6});


         function computeSpline() {
         function computeSpline() {

Revision as of 17:50, 3 December 2008

Constructs a cubic spline through given points. Points can be added by clicking on "Add point".

        function addPoint() {
          p.push(board.createElement('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{style:6}));
          board.update();
        }