1
$\begingroup$

I am confused on how to use the mean value theorem and then I don't know how to graph it. I hope that by graphing it I will have a better understanding.

$\endgroup$

migrated from mathematica.stackexchange.com Mar 13 '18 at 23:01

This question came from our site for users of Wolfram Mathematica.

4
$\begingroup$

The question sounds a bit confused. The Mean Value theorem does not graph anything. It just says that somewhere on the curve of a function the tangent equals the secant line between the two end points.

Mathematica's Plot can be used to illustrate this, but this is all I can think of in this context.

demonstrateMeanValueTheorem[f_] :=
 Module[{start = 0, finish = 4, slope, sol},
  slope = (f[finish] - f[start])/(finish - start);
  sol = x /. First@FindRoot[D[f[x], x] == slope, {x, (finish - start)/2}];
  Plot[
    {
      slope(x - start) + f[start], (* the secant line *)
      f[x],                        (* the function *)
      slope(x - sol) + f[sol]      (* the tangent *)
    }, 
    {x, start, finish}
  ]
]

demonstrateMeanValueTheorem /@ 
   {Sqrt, Sin, Function[{x}, (x - 2.1)^3], 1/(# + 1) &} // GraphicsRow

Mathematica graphics

$\endgroup$
3
$\begingroup$

Playing instead of doing my work: A calculus-free approach.

SeedRandom[0];
deg = 4;
f = RandomReal[2, deg + 1].ChebyshevT[Range[0, deg], x];
sec = ((f /. x -> 1) - (f /. x -> -1)) x/2;
p = First@Cases[Plot[f - sec, {x, -1, 1}], _Line, Infinity];
bounds = Polygon[Tuples[RegionBounds@p]~Part~{1, 3, 4, 2}];
Graphics[
 GeometricTransformation[
  {{LightBlue, EdgeForm[(*Darker@Blue*)], bounds},
   {Dashed, Line@
     Partition[Reverse[Tuples[{
           (FindPeaks[p[[1, All, 2]]]
            ~Join~
            -FindPeaks[-p[[1, All, 2]]])[[All, 2]], {-1, 1}}], 2],
      2]},
   Darker@Red, Thick, p},
  Last@FindGeometricTransform[
    {x, f} /. {{x -> -1}, {x -> 0}, {x -> 1}},
    {x, f - sec} /. {{x -> -1}, {x -> 0}, {x -> 1}}]
  ],
 Axes -> True, AspectRatio -> 0.6]

Mathematica graphics

(+1 if you can spot the double line. Admittedly, a calculus approach is probably less complicated. This approach can be adapted to any function, interval, or homework problem.)

$\endgroup$
  • $\begingroup$ This is admittedly a scenic route, but a nice one nevertheless. :) $\endgroup$ – J. M. is a poor mathematician Mar 13 '18 at 2:10
0
$\begingroup$

For illustrative purposes:

f[x_] := x^(1/2)
mvt[fun_, x_, a_, b_, l_, r_] := 
 Module[{m = (fun[b] - fun[a])/(b - a), s, ln, ep, tr, tg},
  s = {x, fun[x]} /. 
    First@NSolve[fun'[x] == m && Min[a, b] < x < Max[a, b], x];
  ep = Line[ln = {{a, fun[a]}, {b, fun[b]}}];
  tr = m s[[1]] + fun[a] - m a;
  tg = Line[({0, s[[2]] - tr} + # & /@ ln)];
  Plot[fun[x], {x, l, r}, 
   Epilog -> {PointSize[0.02], Green, Point[ln], Red, Point[s], 
     Dashed, ep, tg}]]
Manipulate[
 mvt[func, x, a, b, 0, 4], {func, {f, #^2 &, #^3 &}}, {a, 0, 3}, {b, 
  1, 4}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.