Approximation of e: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 4: Line 4:
  var board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-10, 3, 100, -1]});
  var board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-10, 3, 100, -1]});
  var line = board.create('line', [[-10, Math.E], [100, Math.E]], {strokeColor: 'green', strokeWidth: 1});
  var line = board.create('line', [[-10, Math.E], [100, Math.E]], {strokeColor: 'green', strokeWidth: 1});
  var seq = board.create('curve', [[0], [1]]);
  var seq = board.create('curve', [[0], [1]], {strokeColor: 'blue'});
   
   
  var seq_add = function() {
  var seq_add = function() {
     var n = seq.dataX.length,
     var n = seq.dataX.length,
         val = Math.pow(1 + 1/n, n);
         val = Math.pow(1 + 1/n, n);
    seq.dataX.push(n);
    seq.dataY.push(val);
};
var series = board.create('curve', [[0], [1]], {strokeColor: 'black'});
var series_add = function() {
    var n = series.dataX.length,
        val = series.dataY[n - 1] + 1 / JXG.Math.factorial(n);
     seq.dataX.push(n);
     seq.dataX.push(n);
     seq.dataY.push(val);
     seq.dataY.push(val);

Revision as of 21:57, 6 January 2019