Power series - pointwise: Difference between revisions

From JSXGraph Wiki
(Created page with "<jsxgraph width="600" height="600"> var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-8,8,8,-8], axis:true}); var f, curve; // global objects var p = board.create('...")
 
No edit summary
Line 1: Line 1:
nth-coefficient: <input type="text" id="input" value="1 / factorial(n)">
<input type="button" value="clear all" onClick="clearAll()">
<jsxgraph width="600" height="600">
<jsxgraph width="600" height="600">
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-8,8,8,-8], axis:true});
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox:[-8,8,8,-8], axis:true});
var f, curve; // global objects


var p = board.create('glider', [1, 0, board.defaultAxes.x]);
var p = board.create('glider', [0, 0, board.defaultAxes.x] , {name: 'x'});
var q = board.create('point', [0, 0], {name: '', color: 'blue', trace: true});
p.on('up', function(evt) {
 
  var x, n, m = 50;
  var txtraw = document.getElementById('input').value;
  var a_n = board.jc.snippet(txtraw, true, 'n', true);
 
  var s = 0;
  x = p.X();
  for (n = 0; n < m; n++) {
    s += a_n(n) * Math.pow(x, n);
  }
  q.moveTo([x, s], 0);
});
 
</jsxgraph>
</jsxgraph>

Revision as of 08:08, 7 January 2019

nth-coefficient: <input type="text" id="input" value="1 / factorial(n)"> <input type="button" value="clear all" onClick="clearAll()">