Secant and tangent: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 46: | Line 46: | ||
</script> | </script> | ||
</html> | </html> | ||
<html> | |||
<div id="box2" class="jxgbox" style="width:600px; height:400px;"></div> | |||
<script language="JavaScript"> | |||
board = JXG.JSXGraph.initBoard('box2', {originX: 250, originY: 250, unitX: 50, unitY: 25}); | |||
board.suspendUpdate(); | |||
// Axes | |||
b1axisx = board.createElement('axis', [[0,0], [1,0]], {}); | |||
b1axisy = board.createElement('axis', [[0,0], [0,1]], {}); | |||
var p = []; | |||
p[0] = board.createElement('point', [-1,0], {style:4}); | |||
p[1] = board.createElement('point', [-0.5,1], {style:4}); | |||
p[2] = board.createElement('point', [2,0.5], {style:4}); | |||
p[3] = board.createElement('point', [6,5], {style:4}); | |||
var f = function(x) { return (Math.abs(x)); }; | |||
graph = board.createElement('curve', ['x', f, 'x', -10, 10], {curveType:'graph'}); | |||
q = board.createElement('glider', [4.5,0,graph], {style:6}); | |||
s = board.createElement('slider', [0,-3,4,0.001,1,1],{name:' '}); | |||
q2 = board.createElement('point', [function(){ return q.X()+Math.max(s.X(),0.01);}, | |||
function(){ return f(q.X()+Math.max(s.X(),0.01));}], {style:7}); | |||
e = board.createElement('point', [function(){ return q2.X()-q.X();}, | |||
function(){ return (q2.Y()-q.Y())/(q2.X()-q.X());}], {style:7,name:'Sekantensteigung',trace:true}); | |||
line = board.createElement('line',[q,q2],{strokeColor:'#ff0000'}); | |||
board.unsuspendUpdate(); | |||
</script> | |||
</html> | |||
[[Category:Examples]] | [[Category:Examples]] |
Revision as of 12:57, 16 January 2009