Arc length: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) 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)); | |||
} | |||
} | |||