Arc length: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 4: Line 4:
var f = function(x){ return 0.2*x*x+0.5*Math.sin(x); }
var f = function(x){ return 0.2*x*x+0.5*Math.sin(x); }
var plot = brd.createElement('functiongraph',[f]);
var plot = brd.createElement('functiongraph',[f]);
var sc = brd.createElement('curve',[[0],[0]]);
sc.updataDataArray = function() {
  var i;
  var m = n.Value();
  m = Math.round(m);
  var d = (5-0)/m;
  this.dataX = [];
  this.dataY = [];
  this.dataX[0] = 0.0; 
  this.dataY[0] = f(0.0); 
  for (i=1;i<m;i++) {
    this.dataX.append(0.0+i*d); 
    this.dataY.append(f(0.0+(i-1)*d)); 
    this.dataX.append(0.0+i*d); 
    this.dataY.append(f(0.0+i*d)); 
  } 
}





Revision as of 12:44, 7 June 2009

The underlying JavaScript code