# Difference between revisions of "Extended mean value theorem"

The extended mean value theorem (also called Cauchy's mean value theorem) is: Let

$f, g: [a,b] \to \mathbb{R}$

be continuous functions that are differentiable on the open interval $(a,b)$. If $g'(x)\neq 0$ for all $x\in(a,b)$, then there exists a value $\xi \in (a,b)$ such that

$\frac{f'(\xi)}{g'(\xi)} = \frac{f(b)-f(a)}{g(b)-g(b)}.$

### The underlying JavaScript code

var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-5, 10, 7, -6], axis:true});
var p = [];

p = board.create('point', [0, -2], {size:2});
p = board.create('point', [-1.5, 5], {size:2});
p = board.create('point', [1, 4], {size:2});
p = board.create('point', [3, 3], {size:2});

// Curve
var fg = JXG.Math.Numerics.Neville(p);
var graph = board.create('curve', fg, {strokeWidth:3, strokeOpacity:0.5});

// Secant
line = board.create('line', [p, p], {strokeColor:'#ff0000', dash:1});

var df = JXG.Math.Numerics.D(fg);
var dg = JXG.Math.Numerics.D(fg);

// Usually, the extended mean value theorem is formulated as
// df(t) / dg(t) == (p.X() - p.X()) / (p.Y() - p.Y())
// We can avoid division by zero with that formulation:
var quot = function(t) {
return df(t) * (p.Y() - p.Y()) - dg(t) * (p.X() - p.X());
};

var r = board.create('glider', [
function() { return fg(JXG.Math.Numerics.root(quot, (fg() + fg) * 0.5)); },
function() { return fg(JXG.Math.Numerics.root(quot, (fg() + fg) * 0.5)); },
graph], {name: '', size: 4, fixed:true, color: 'blue'});

board.create('tangent', [r], {strokeColor:'#ff0000'});