Difference between revisions of "Rolle's Theorem"

From JSXGraph Wiki
Jump to navigationJump to search
Line 19: Line 19:
 
     var graph = board.createElement('functiongraph', [f, -10, 10]);
 
     var graph = board.createElement('functiongraph', [f, -10, 10]);
  
    var r = board.createElement('glider', [function() { return board.root(board.D(f),(p[0].X()+p[1].X())*0.5); },
+
var r = board.createElement('glider', [function() { return board.root(board.D(f),(p[0].X()+p[1].X())*0.5); },
 
                     function() { return f(board.root(board.D(f),(p[0].X()+p[1].X())*0.5)); },graph],  
 
                     function() { return f(board.root(board.D(f),(p[0].X()+p[1].X())*0.5)); },graph],  
 
         {name:' ',style:6});
 
         {name:' ',style:6});
  var r2 = board.createElement('tangent', [r]); //function(){ return r.X()+0.01;},
+
var t = board.createElement('tangent', [r], {strokeColor:'#ff0000'});
//      function(){ return f(r.X()+0.01);}], {style:7,visible:false});
 
 
 
 
 
//line = board.createElement('line',[r,r2],{strokeColor:'#ff0000'});
 
 
line = board.createElement('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
 
line = board.createElement('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
 
 
board.unsuspendUpdate();
 
board.unsuspendUpdate();
 
</script>
 
</script>
Line 49: Line 44:
 
     var graph = board.createElement('functiongraph', [f, -10, 10]);
 
     var graph = board.createElement('functiongraph', [f, -10, 10]);
  
    var r = board.createElement('point', [function() { return board.root(board.D(f),(p[0].X()+p[1].X())*0.5); },
+
var r = board.createElement('glider', [function() { return board.root(board.D(f),(p[0].X()+p[1].X())*0.5); },
                     function() { return f(board.root(board.D(f),(p[0].X()+p[1].X())*0.5)); }],  
+
                     function() { return f(board.root(board.D(f),(p[0].X()+p[1].X())*0.5)); },graph],  
 
         {name:' ',style:6});
 
         {name:' ',style:6});
  var r2 = board.createElement('point', [function(){ return r.X()+0.01;},
+
var t = board.createElement('tangent', [r], {strokeColor:'#ff0000'});
      function(){ return f(r.X()+0.01);}], {style:7,visible:false});
 
 
 
 
 
line = board.createElement('line',[r,r2],{strokeColor:'#ff0000'});
 
 
line = board.createElement('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
 
line = board.createElement('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
 
 
board.unsuspendUpdate();
 
board.unsuspendUpdate();
 
</source>
 
</source>
 
[[Category:Examples]]
 
[[Category:Examples]]
 
[[Category:Calculus]]
 
[[Category:Calculus]]

Revision as of 16:34, 10 March 2009

The underlying JavaScript code

        board = JXG.JSXGraph.initBoard('box', {originX: 250, originY: 250, unitX: 50, unitY: 25});
board.suspendUpdate();
        // Axes
        xax = board.createElement('axis', [[0,0], [1,0]], {});
        yax = board.createElement('axis', [[0,0], [0,1]], {});

        var p = [];
        p[0] = board.createElement('point', [-1,2], {style:1,fixed:true});
        p[1] = board.createElement('point', [6,2], {style:1,fixed:true});
        p[2] = board.createElement('point', [-0.5,1], {style:4});
        p[3] = board.createElement('point', [2,0.5], {style:4});
        var f = board.lagrangePolynomial(p);
    var graph = board.createElement('functiongraph', [f, -10, 10]);

var r = board.createElement('glider', [function() { return board.root(board.D(f),(p[0].X()+p[1].X())*0.5); },
                    function() { return f(board.root(board.D(f),(p[0].X()+p[1].X())*0.5)); },graph], 
         {name:' ',style:6});
var t = board.createElement('tangent', [r], {strokeColor:'#ff0000'});
line = board.createElement('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
board.unsuspendUpdate();