Continuous function II

From JSXGraph Wiki
Revision as of 10:31, 25 March 2011 by A WASSERMANN (talk | contribs)

References

The underlying JavaScript code

 var board = JXG.JSXGraph.initBoard('box', {originX: 50, originY: 400, unitX: 50, unitY: 50});
 var b1axisx = board.create('axis', [[0,0], [1,0]], {});
 var b1axisy = board.create('axis', [[0,0], [0,1]], {});

 var f = function(x) { return 1.0/x; };
 var graph = board.create('functiongraph', [f,0.00001, 15], {strokeColor:'#00ff00'});

 var s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'ε'});

 var y1 = board.create('glider', [0,3,b1axisy],{name:'f(a)'});
 board.suspendUpdate();
 var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{style:7,name:' '});
 var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{style:7,name:' '});

 var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{style:7,name:'f(a)'});
 var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{style:7,name:' '});
 var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{style:7,name:' '});

 var v1 = board.create('line', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1,straightFirst:false,straightLast:false});
 var v2 = board.create('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1});
 var v3 = board.create('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1});

 var h1 = board.create('curve', [function(t){return z1.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 var h2 = board.create('curve', [function(t){return z2.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 var h3 = board.create('curve', [function(t){return z3.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 board.unsuspendUpdate();