Difference between revisions of "Arc length"

From JSXGraph Wiki
Jump to navigationJump to search
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 14:44, 7 June 2009

The underlying JavaScript code