Difference between revisions of "Continuous function II"

From JSXGraph Wiki
Jump to navigationJump to search
 
Line 1: Line 1:
<html>
+
<jsxgraph width="600" height="500" box="box">
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
 
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
 
<div id="box" class="jxgbox" style="width:600px; height:500px;"></div>
 
<script language="JavaScript">
 
 
  board = JXG.JSXGraph.initBoard('box', {originX: 50, originY: 400, unitX: 50, unitY: 50});
 
  board = JXG.JSXGraph.initBoard('box', {originX: 50, originY: 400, unitX: 50, unitY: 50});
 
  board.suspendUpdate();
 
  board.suspendUpdate();
  b1axisx = board.createElement('axis', [[0,0], [1,0]], {});
+
  b1axisx = board.create('axis', [[0,0], [1,0]], {});
  b1axisy = board.createElement('axis', [[0,0], [0,1]], {});
+
  b1axisy = board.create('axis', [[0,0], [0,1]], {});
  
 
  var f = function(x) { return 1.0/x; };
 
  var f = function(x) { return 1.0/x; };
  graph = board.createElement('functiongraph', [f,0.00001, 15], {strokeColor:'#00ff00'});
+
  graph = board.create('functiongraph', [f,0.00001, 15], {strokeColor:'#00ff00'});
  
  s = board.createElement('slider', [[0,-1],[4,-1],[0,1,1]],{name:'&epsilon;'});
+
  s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'&epsilon;'});
  
  y1 = board.createElement('glider', [0,3,b1axisy],{name:'f(a)'});
+
  y1 = board.create('glider', [0,3,b1axisy],{name:'f(a)'});
  y2 = board.createElement('point', [0,function(){return y1.Y()-s.Value();}],{style:7,name:' '});
+
  y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{style:7,name:' '});
  y3 = board.createElement('point', [0,function(){return y1.Y()+s.Value();}],{style:7,name:' '});
+
  y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{style:7,name:' '});
  
  z1 = board.createElement('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{style:7,name:'f(a)'});
+
  z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{style:7,name:'f(a)'});
  z2 = board.createElement('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{style:7,name:' '});
+
  z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{style:7,name:' '});
  z3 = board.createElement('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{style:7,name:' '});
+
  z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{style:7,name:' '});
  
  v1 = board.createElement('line', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1,straightFirst:false,straightLast:false});
+
  v1 = board.create('line', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1,straightFirst:false,straightLast:false});
  v2 = board.createElement('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1});
+
  v2 = board.create('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1});
  v3 = board.createElement('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1});
+
  v3 = board.create('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1});
  
  h1 = board.createElement('curve', [function(t){return z1.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
+
  h1 = board.create('curve', [function(t){return z1.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
  h2 = board.createElement('curve', [function(t){return z2.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
+
  h2 = board.create('curve', [function(t){return z2.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
  h3 = board.createElement('curve', [function(t){return z3.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
+
  h3 = board.create('curve', [function(t){return z3.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 
  board.unsuspendUpdate();
 
  board.unsuspendUpdate();
 
+
</jsxgraph>
</script>
 
</html>
 
  
 
=== References ===
 
=== References ===
  
 
* [http://en.wikipedia.org/wiki/Continuous_function http://en.wikipedia.org/wiki/Continuous_function]
 
* [http://en.wikipedia.org/wiki/Continuous_function http://en.wikipedia.org/wiki/Continuous_function]
 +
 +
=== The underlying JavaScript code ===
 +
 +
<source lang="javascript">
 +
board = JXG.JSXGraph.initBoard('box', {originX: 50, originY: 400, unitX: 50, unitY: 50});
 +
board.suspendUpdate();
 +
b1axisx = board.create('axis', [[0,0], [1,0]], {});
 +
b1axisy = board.create('axis', [[0,0], [0,1]], {});
 +
 +
var f = function(x) { return 1.0/x; };
 +
graph = board.create('functiongraph', [f,0.00001, 15], {strokeColor:'#00ff00'});
 +
 +
s = board.create('slider', [[0,-1],[4,-1],[0,1,1]],{name:'&epsilon;'});
 +
 +
y1 = board.create('glider', [0,3,b1axisy],{name:'f(a)'});
 +
y2 = board.create('point', [0,function(){return y1.Y()-s.Value();}],{style:7,name:' '});
 +
y3 = board.create('point', [0,function(){return y1.Y()+s.Value();}],{style:7,name:' '});
 +
 +
z1 = board.create('point', [function(){return f(y1.Y());},function(){return y1.Y();}],{style:7,name:'f(a)'});
 +
z2 = board.create('point', [function(){return f(y2.Y());},function(){return y2.Y();}],{style:7,name:' '});
 +
z3 = board.create('point', [function(){return f(y3.Y());},function(){return y3.Y();}],{style:7,name:' '});
 +
 +
v1 = board.create('line', [z1,y1],{strokeColor:'gray',dash:2,strokeWidth:1,straightFirst:false,straightLast:false});
 +
v2 = board.create('line', [z2,y2],{strokeColor:'gray',dash:2,strokeWidth:1});
 +
v3 = board.create('line', [z3,y3],{strokeColor:'gray',dash:2,strokeWidth:1});
 +
 +
h1 = board.create('curve', [function(t){return z1.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 +
h2 = board.create('curve', [function(t){return z2.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 +
h3 = board.create('curve', [function(t){return z3.X();},function(t){return t},0,20], {strokeColor:'gray',dash:2,strokeWidth:1});
 +
board.unsuspendUpdate();
 +
</source>
  
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Calculus]]
 
[[Category:Calculus]]

Revision as of 12:28, 25 March 2011

References

The underlying JavaScript code

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

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

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

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

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

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

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