# Difference between revisions of "Mean Value Theorem"

From JSXGraph Wiki

Line 29: | Line 29: | ||

board.suspendUpdate(); | board.suspendUpdate(); | ||

var p = []; | var p = []; | ||

− | p[0] = board.create('point', [-1,-2], { | + | p[0] = board.create('point', [-1,-2], {size:2}); |

− | p[1] = board.create('point', [6,5], { | + | p[1] = board.create('point', [6,5], {size:2}); |

− | p[2] = board.create('point', [-0.5,1], { | + | p[2] = board.create('point', [-0.5,1], {size:2}); |

− | p[3] = board.create('point', [3,3], { | + | p[3] = board.create('point', [3,3], {size:2}); |

var f = board.lagrangePolynomial(p); | var f = board.lagrangePolynomial(p); | ||

var graph = board.create('functiongraph', [f,-10, 10]); | var graph = board.create('functiongraph', [f,-10, 10]); |

## Revision as of 10:08, 8 June 2011

### The underlying JavaScript code

```
var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-5, 10, 7, -6], axis:true});
board.suspendUpdate();
var p = [];
p[0] = board.create('point', [-1,-2], {size:2});
p[1] = board.create('point', [6,5], {size:2});
p[2] = board.create('point', [-0.5,1], {size:2});
p[3] = board.create('point', [3,3], {size:2});
var f = board.lagrangePolynomial(p);
var graph = board.create('functiongraph', [f,-10, 10]);
var g = function(x) {
return board.D(f)(x)-(p[1].Y()-p[0].Y())/(p[1].X()-p[0].X());
};
var r = board.create('glider', [
function() { return board.root(g,(p[0].X()+p[1].X())*0.5); },
function() { return f(board.root(g,(p[0].X()+p[1].X())*0.5)); },
graph], {name:' ',style:6,fixed:true});
board.create('tangent', [r], {strokeColor:'#ff0000'});
line = board.create('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
board.unsuspendUpdate();
```