Continuous function II: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<jsxgraph width="600" height="500" box="box"> | <jsxgraph width="600" height="500" box="box"> | ||
var board = JXG.JSXGraph.initBoard('box', { | var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-1, 10, 11, -2], axis: true}); | ||
var f = function(x) { return 1.0/x; }; | var f = function(x) { return 1.0/x; }; | ||
Line 9: | Line 7: | ||
var s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'ε'}); | var s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'ε'}); | ||
var y1 = board.create('glider', [0,3, | var y1 = board.create('glider', [0,3,board.defaultAxes.y],{name:'f(a)'}); | ||
board.suspendUpdate(); | board.suspendUpdate(); | ||
var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{ | var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{size:2,face:'[]',name:' '}); | ||
var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{ | var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{size:2,face:'[]',name:' '}); | ||
var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{ | var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{size:2,face:'[]',name:'f(a)'}); | ||
var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{ | var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{size:2,face:'[]',name:' '}); | ||
var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{ | var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{size:2,face:'[]',name:' '}); | ||
var v1 = board.create(' | var v1 = board.create('segment', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1}); | ||
var v2 = board.create('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1}); | 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 v3 = board.create('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1}); | ||
Line 35: | Line 33: | ||
<source lang="javascript"> | <source lang="javascript"> | ||
var board = JXG.JSXGraph.initBoard('box', { | var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-1, 10, 11, -2], axis: true}); | ||
var f = function(x) { return 1.0/x; }; | var f = function(x) { return 1.0/x; }; | ||
Line 44: | Line 40: | ||
var s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'ε'}); | var s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'ε'}); | ||
var y1 = board.create('glider', [0,3, | var y1 = board.create('glider', [0,3,board.defaultAxes.y],{name:'f(a)'}); | ||
board.suspendUpdate(); | board.suspendUpdate(); | ||
var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{ | var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{size:2,face:'[]',name:' '}); | ||
var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{ | var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{size:2,face:'[]',name:' '}); | ||
var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{ | var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{size:2,face:'[]',name:'f(a)'}); | ||
var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{ | var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{size:2,face:'[]',name:' '}); | ||
var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{ | var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{size:2,face:'[]',name:' '}); | ||
var v1 = board.create(' | var v1 = board.create('segment', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1}); | ||
var v2 = board.create('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1}); | 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 v3 = board.create('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1}); |
Revision as of 13:02, 7 June 2011
References
The underlying JavaScript code
var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-1, 10, 11, -2], axis: true});
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,board.defaultAxes.y],{name:'f(a)'});
board.suspendUpdate();
var y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{size:2,face:'[]',name:' '});
var y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{size:2,face:'[]',name:' '});
var z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{size:2,face:'[]',name:'f(a)'});
var z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{size:2,face:'[]',name:' '});
var z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{size:2,face:'[]',name:' '});
var v1 = board.create('segment', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1});
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();