Approximation of e: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 8: Line 8:
(function(){
(function(){


  var board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-0.5, 3, 50, 0.5]});
  var board = JXG.JSXGraph.initBoard('box', {axis:true, boundingbox: [-1, 3, 50, 0.5]});
  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]], {strokeColor: 'blue'});
  var seq = board.create('curve', [[0], [1]], {strokeColor: 'blue'});
Line 28: Line 28:
  };
  };


  var txt1 = board.create('text', [15, 1.5, function() { return 'n=' + (seq.dataX.length-1) + ': value = ' + seq.dataY[seq.dataY.length - 1]; }], {strokeColor: 'blue'});
  var txt1 = board.create('text', [15, 1.6, function() { return 'n=' + (seq.dataX.length-1) + ': value = ' + seq.dataY[seq.dataY.length - 1]; }], {strokeColor: 'blue'});
  var txt2 = board.create('text', [15, 2, function() { return 'n=' + (series.dataX.length-1) + ': value = ' + series.dataY[series.dataY.length - 1]; }], {strokeColor: 'black'});
  var txt2 = board.create('text', [15, 1.8, function() { return 'n=' + (series.dataX.length-1) + ': value = ' + series.dataY[series.dataY.length - 1]; }], {strokeColor: 'black'});





Revision as of 22:11, 6 January 2019

This little animation approximates [math]\displaystyle{ e }[/math] (displayed by the horizontal green line) by the sequence (blue line)

[math]\displaystyle{ (1+\frac{1}{n})^n }[/math]

and by the series (black line)

[math]\displaystyle{ \sum_{n=0}^\infty \frac{1}{n!} }[/math]