Secant and tangent: Difference between revisions

From JSXGraph Wiki
No edit summary
No edit summary
Line 56: Line 56:
         b1axisy = board.createElement('axis', [[0,0], [0,1]], {});
         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)); };
         var f = function(x) { return (Math.abs(x)); };
         graph = board.createElement('curve', ['x', f, 'x', -10, 10], {curveType:'graph'});
         graph = board.createElement('curve', ['x', f, 'x', -10, 10], {curveType:'graph'});


q = board.createElement('glider', [4.5,0,graph], {style:6});
        qf = board.createElement('glider', [4.5,0,graph], {style:6});
s = board.createElement('slider', [0,-3,4,0.001,1,1],{name:' '});
        sf = board.createElement('slider', [0,-3,4,-1,1,1],{name:' '});
q2 = board.createElement('point', [function(){ return q.X()+Math.max(s.X(),0.01);},
        qf2 = board.createElement('point', [function(){ return qf.X()+sf.X();},
      function(){ return f(q.X()+Math.max(s.X(),0.01));}], {style:7});
                            function(){ return f(qf.X()+sf.X());}], {style:7});
e = board.createElement('point', [function(){ return q2.X()-q.X();},
        ef = board.createElement('point', [function(){ return qf2.X()-qf.X();},
      function(){ return (q2.Y()-q.Y())/(q2.X()-q.X());}], {style:7,name:'Sekantensteigung',trace:true});
                      function(){ return (qf2.Y()-qf.Y())/(qf2.X()-qf.X());}], {style:7,name:'Sekantensteigung',trace:true});
line = board.createElement('line',[q,q2],{strokeColor:'#ff0000'});
        line = board.createElement('line',[qf,qf2],{strokeColor:'#ff0000'});
board.unsuspendUpdate();
board.unsuspendUpdate();
</script>
</script>

Revision as of 13:06, 16 January 2009