lots of cleanup

This commit is contained in:
jverzani
2026-08-11 17:17:08 -04:00
parent ae461659e0
commit 253295ff6e
91 changed files with 18284 additions and 7872 deletions

View File

@@ -1,4 +1,4 @@
# The mean value theorem for differentiable functions
# Implications of Differentiability
{{< include ../_common_code.qmd >}}
@@ -24,7 +24,21 @@ nothing
---
A function is *continuous* at $c$ if $f(c+h) - f(c) \rightarrow 0$ as $h$ goes to $0$. We can write that as $f(c+h) - f(c) = \epsilon_h$, with $\epsilon_h$ denoting a function going to $0$ as $h \rightarrow 0$. With this notion, differentiability could be written as $f(c+h) - f(c) - f'(c)h = \epsilon_h \cdot h$. This is clearly a more demanding requirement than mere continuity at $c$.
Supposed $\epsilon_h$ is some function going to $0$ as $h \rightarrow 0$ that may be different from line to line. Then we have two somewhat similar characterizations of continuity and differentiability:
A function is *continuous* at $c$ if
$$
f(c+h) - f(c) = \epsilon_h.
$$
A function is *differentiable* at $c$ if
$$
f(c+h) - f(c) - f'(c)h = \epsilon_h \cdot h.
$$
We defined a function to be *continuous* on an interval $I=(a,b)$ if it was continuous at each point $c$ in $I$. Similarly, we define a function to be *differentiable* on the interval $I$ if it is differentiable at each point $c$ in $I$.
@@ -33,67 +47,79 @@ We defined a function to be *continuous* on an interval $I=(a,b)$ if it was cont
This section looks at properties of differentiable functions. As there is a more stringent definition, perhaps more properties are a consequence of the definition.
## Differentiable is more restrictive than continuous.
## Differentiability implies continuity
Let $f$ be a differentiable function on $I=(a,b)$. We see that $f(c+h) - f(c) = f'(c)h + \epsilon_h\cdot h = h(f'(c) + \epsilon_h)$. The right hand side will clearly go to $0$ as $h\rightarrow 0$, so $f$ will be continuous. In short:
::: {.relationship title="Differentiable implies continuous"}
> A differentiable function on $I=(a,b)$ is continuous on $I$.
A differentiable function on $I=(a,b)$ is continuous on $I$.
:::
Is it possible that all continuous functions are differentiable?
The fact that the derivative is related to the tangent line's slope might give an indication that this won't be the case - we just need a function which is continuous but has a point with no tangent line. The usual suspect is $f(x) = \lvert x\rvert$ at $0$.
The fact that the derivative is related to the tangent line's slope might give an indication that this won't be the case - we just need a function which is continuous but has a point with no tangent line. The usual suspect is $f(x) = \lvert x\rvert$ at $0$, plotted around $0$ in @fig-plot-abs-over-minus1-1-not-diff-at-0.
::: {#fig-plot-abs-over-minus1-1-not-diff-at-0}
```{julia}
#| hold: true
#| echo: false
f(x) = abs(x)
plot(f, -1,1)
```
Plot of $f(x) = \lvert x \rvert$ over $[-1, 1]$. This function does not have a tangent line at $x=0$.
:::
We can see formally that the secant line expression will not have a limit when $c=0$ (the left limit is $-1$, the right limit $1$). But more insight is gained by looking at the shape of the graph. At the origin, the graph always is vee-shaped. There is no linear function that approximates this function well. The function is just not smooth enough, as it has a kink.
There are other functions that have kinks. These are often associated with powers. For example, at $x=0$ this function will not have a derivative:
There are other functions that have kinks. These are often associated with powers. For example, at $x=0$ the function $f(x) = x^{2/3}$ (@fig-plot-x-2-thirds-over-minus1-1) will not have a derivative at $x=0$.
::: {#fig-plot-x-2-thirds-over-minus1-1}
```{julia}
#| hold: true
#| echo: false
f(x) = (x^2)^(1/3)
plot(f, -1, 1)
```
Other functions have tangent lines that become vertical. The natural slope would be $\infty$, but this isn't a limiting answer (except in the extended sense we don't apply to the definition of derivatives). A candidate for this case is the cube root function:
Plot of $f(x) = x^{2/3}$ over $[-1, 1]$. This function does not have a tangent line at $x=0$.
:::
Other functions have tangent lines that become vertical. The natural slope would be $\infty$, but this isn't a limiting answer (except in the extended sense we don't apply to the definition of derivatives). A candidate for this case is the cube root function, shown in @fig-cbrt-over-minus1-1-not-tangent-line-at-0.
::: {#fig-cbrt-over-minus1-1-not-tangent-line-at-0}
```{julia}
#| echo: false
plot(cbrt, -1, 1)
```
Plot of `cbrt` over $[-1,1]$. The "tangent" line at $x=0$ is vertical; the function is not differentiable at $0$
:::
The derivative at $0$ would need to be $+\infty$ to match the graph. This is implied by the formula for the derivative from the power rule: $f'(x) = 1/3 \cdot x^{-2/3}$, which has a vertical asymptote at $x=0$.
:::{.callout-note}
## Note
The `cbrt` function is used above, instead of `f(x) = x^(1/3)`, as the latter is not defined for negative `x`. Though it can be for the exact power `1/3`, it can't be for an exact power like `1/2`. This means the value of the argument is important in determining the type of the output - and not just the type of the argument. Having type-stable functions is part of the magic to making `Julia` run fast, so `x^c` is not defined for negative `x` and most floating point exponents.
The `cbrt` function is used to plot @fig-cbrt-over-minus1-1-not-tangent-line-at-0}, instead of `f(x) = x^(1/3)`, as the latter is not defined for negative `x`. Though it can be for the exact power `1/3`, it can't be for an exact power like `1/2`. This means the value of the argument is important in determining the type of the output - and not just the type of the argument. Having type-stable functions is part of the magic to making `Julia` run fast, so `x^c` is not defined for negative `x` and most floating point exponents.
:::
Lest you think that continuous functions always have derivatives except perhaps at exceptional points, this isn't the case. The functions used to [model](http://tinyurl.com/cpdpheb) the stock market are continuous but have no points where they are differentiable.
Lest you think that continuous functions always have derivatives except perhaps at exceptional points, this isn't the case. The functions used to [model](http://tinyurl.com/cpdpheb) the stock market are continuous but have **no** points where they are differentiable.
## Derivatives and maxima.
## Fermat's theorem
We have defined an *absolute maximum* of $f(x)$ over an interval to be a value $f(c)$ for a point $c$ in the interval that is as large as any other value in the interval. Just specifying a function and an interval does not guarantee an absolute maximum, but specifying a *continuous* function and a *closed* interval does, by the extreme value theorem.
::: {.callout-note icon=false}
## A relative maximum
::: {.definition title="A relative maximum"}
We say $f(x)$ has a *relative maximum* at $c$ if there exists *some* interval $I=(a,b)$ with $a < c < b$ for which $f(c)$ is an absolute maximum for $f$ and $I$.
@@ -104,46 +130,36 @@ The difference is a bit subtle, for an absolute maximum the interval must also b
:::{.callout-note}
## Note
A hiker can appreciate the difference. A relative maximum would be the crest of any hill, but an absolute maximum would be the summit.
A hiker can appreciate the difference. A relative maximum would be the crest of any hill, but an absolute maximum would often be the summit.
:::
What does this have to do with derivatives?
A theorem attributed to [Fermat](https://digitalcommons.ursinus.edu/cgi/viewcontent.cgi?params=/context/triumphs_calculus/article/1011/&path_info=M05_Fermats_Method_for_Finding_Maxima_and_Minima_2022_05_17.pdf) says something about where a relative or absolute maximum (or minimum) can occur under assumptions:
[Fermat](http://science.larouchepac.com/fermat/fermat-maxmin.pdf), perhaps with insight from Kepler, was interested in maxima of polynomial functions. As a warm up, he considered a line segment $AC$ and a point $E$ with the task of choosing $E$ so that $(E-A) \times (C-E)$ being a maximum. We might recognize this as finding the maximum of $f(x) = (x-A)\cdot(C-x)$ for some $A < C$. Geometrically, we know this to be at the midpoint, as the equation is a parabola, but Fermat was interested in an algebraic solution that led to more generality.
::: {.theorem title="Fermat's theorem"}
If a differentiable function on $(a,b)$ has a maximum at $c$ with $a < c < b$ then $f'(c) = 0$
He takes $b=AC$ and $a=AE$. Then the product is $a \cdot (b-a) = ab - a^2$. He then perturbs this writing $AE=a+e$, then this new product is $(a+e) \cdot (b - a - e)$. Equating the two, and canceling like terms gives $be = 2ae + e^2$. He cancels the $e$ and basically comments that this must be true for all $e$ even as $e$ goes to $0$, so $b = 2a$ and the value is at the midpoint.
In a more modern approach, this would be the same as looking at this expression:
$$
\frac{f(x+e) - f(x)}{e} = 0.
$$
Working on the left hand side, for non-zero $e$ we can cancel the common $e$ terms, and then let $e$ become $0$. This becomes a problem in solving $f'(x)=0$. Fermat could compute the derivative for any polynomial by taking a limit, a task we would do now by the power rule and the sum and difference of function rules.
This insight holds for other types of functions:
> If $f(c)$ is a relative maximum then either $f'(c) = 0$ or the derivative at $c$ does not exist.
:::
When the derivative exists, this says the tangent line is flat. (If it had a slope, then the function would increase by moving left or right, as appropriate, a point we pursue later.)
Relaxing differentibility to continuity, we have
::: {.relationship title="The derivative at a relative maximum"}
If a continuous function on $(a,b)$ has a maximum at $c$ with $a < c < b$ then $f'(c) = 0$ or the derivative of $f$ at $c$ does not exist.
:::
For a continuous function $f(x)$, call a point $c$ in the domain of $f$ where either $f'(c)=0$ or the derivative does not exist a **critical** **point**.
We can combine Bolzano's extreme value theorem with Fermat's insight to get the following:
::: {.callout-note icon=false}
## Absolute maxima characterization
::: {.relationship title="Absolute maxima characterization"}
A continuous function on $[a,b]$ has an absolute maximum that occurs at a critical point $c$, $a < c < b$, or an endpoint, $a$ or $b$.
@@ -151,10 +167,9 @@ A similar statement holds for an absolute minimum.
:::
The above gives a restricted set of places to look for absolute maximum and minimum values - all the critical points and the endpoints.
The above gives a restricted set of places to look for absolute maximum and minimum values---all the critical points and the endpoints, but no where else.
It is also the case that all relative extrema occur at a critical point, *however* not all critical points correspond to relative extrema. We will see *derivative tests* that help characterize when that occurs.
It is the case that all relative extrema occur at a critical point, *however* it is *not* the case that all critical points correspond to relative extrema. We will see *derivative tests* that help characterize when a critical point corresponds to a relative extrema.
```{julia}
@@ -163,7 +178,7 @@ It is also the case that all relative extrema occur at a critical point, *howeve
### {{{lhopital_32}}}
imgfile = "figures/lhopital-32.png"
caption = L"""
Image number ``32`` from L'Hopitals calculus book (the first) showing that
Image number ``32`` from L'Hospitals calculus book (the first) showing that
at a relative minimum, the tangent line is parallel to the
$x$-axis. This of course is true when the tangent line is well defined
by Fermat's observation.
@@ -172,23 +187,15 @@ by Fermat's observation.
nothing
```
![Image number $32$ from L'Hopitals calculus book (the first) showing that
::: {#fig-lhospital-image-number-32}
![](./figures/lhopital-32.png){fig-alt="Image number 32 of L'Hospital's book"}
Image number $32$ from L'Hospitals calculus book (the first) showing that
at a relative minimum, the tangent line is parallel to the
$x$-axis. This of course is true when the tangent line is well defined
by Fermat's observation.](./figures/lhopital-32.png)
by Fermat's observation.
:::
### Numeric derivatives
The `ForwardDiff` package provides a means to numerically compute derivatives without approximations at a point. In `CalculusWithJulia` this is extended to find derivatives of functions and the `'` notation is overloaded for function objects. Hence these two give nearly identical answers, the difference being only the type of number used:
```{julia}
#| hold: true
f(x) = 3x^3 - 2x
fp(x) = 9x^2 - 2
f'(3), fp(3)
```
##### Example
@@ -196,7 +203,7 @@ f'(3), fp(3)
For the function $f(x) = x^2 \cdot e^{-x}$ find the absolute maximum over the interval $[0, 5]$.
We have that $f(x)$ is continuous on the closed interval of the question, and in fact differentiable on $(0,5)$, so any critical point will be a zero of the derivative. We can check for these with:
We have that $f(x)$ is continuous on the closed interval of the question, and in fact differentiable on $(0,5)$. By differentiability, any critical point will be a zero of the derivative. We can check for these using `f'` to compute the derivative automatically:
```{julia}
@@ -270,16 +277,16 @@ Here the maximum occurs at an endpoint. The critical point $c=0.67\dots$ does no
Let $f(x)$ be differentiable on $(a,b)$ and continuous on $[a,b]$. Then the absolute maximum occurs at an endpoint or where the derivative is $0$ (as the derivative is always defined). This gives rise to:
::: {.callout-note icon=false}
## [Rolle's](http://en.wikipedia.org/wiki/Rolle%27s_theorem) theorem
::: {.theorem title="Rolle's theorem"}
For $f$ differentiable on $(a,b)$ and continuous on $[a,b]$, if $f(a)=f(b)$, then there exists some $c$ in $(a,b)$ with $f'(c) = 0$.
[Rolle's](http://en.wikipedia.org/wiki/Rolle%27s_theorem) theorem states that
if $f$ differentiable on $(a,b)$ and continuous on $[a,b]$ and if $f(a)=f(b)$, then there exists some $c$ in $(a,b)$ with $f'(c) = 0$.
:::
::: {#fig-l-hospital-144}
![Figure from L'Hospital's calculus book](figures/lhopital-144.png)
![](figures/lhopital-144.png){ig-alt="Figure from L'Hospital's calculus book"}
Figure from L'Hospital's calculus book showing Rolle's theorem where $c=E$ in the labeling.
:::
@@ -287,7 +294,7 @@ Figure from L'Hospital's calculus book showing Rolle's theorem where $c=E$ in th
This modest observation opens the door to many relationships between a function and its derivative, as it ties the two together in one statement.
To see why Rolle's theorem is true, we assume that $f(a)=0$, otherwise consider $g(x)=f(x)-f(a)$. By the extreme value theorem, there must be an absolute maximum and minimum. If $f(x)$ is ever positive, then the absolute maximum occurs in $(a,b)$ - not at an endpoint - so at a critical point where the derivative is $0$. Similarly if $f(x)$ is ever negative. Finally, if $f(x)$ is just $0$, then take any $c$ in $(a,b)$.
To see why Rolle's theorem is true, we assume that $f(a)=0$, otherwise consider $g(x)=f(x)-f(a)$. By the extreme value theorem, there must be an absolute maximum and minimum. If $f(x)$ is ever positive, then the absolute maximum occurs in $(a,b)$---not at an endpoint---so at a critical point where the derivative is $0$. Similarly if $f(x)$ is ever negative. Finally, if $f(x)$ is just $0$, then take any $c$ in $(a,b)$.
The statement in Rolle's theorem speaks to existence. It doesn't give a recipe to find $c$. It just guarantees that there is *one* or *more* values in the interval $(a,b)$ where the derivative is $0$ if we assume differentiability on $(a,b)$ and continuity on $[a,b]$.
@@ -296,7 +303,8 @@ The statement in Rolle's theorem speaks to existence. It doesn't give a recipe t
##### Example
Let $j(x) = e^x \cdot x \cdot (x-1)$. We know $j(0)=0$ and $j(1)=0$, so on $[0,1]$. Rolle's theorem guarantees that we can find *at* *least* one answer (unless numeric issues arise):
Let $j(x) = e^x \cdot x \cdot (x-1)$. We know $j(0)=0$ and $j(1)=0$, so on $[0,1]$. Rolle's theorem guarantees that we can find *at* *least* one answer to $j'(x) = 0$ between $0$ and $1$. We see there is only the one numerically. @fig-plot-expx-times-x-times-x-minus-1-over-0-1 also illustrates graphically the lone value for $c$ in $[a,b]$ for this problem.
```{julia}
@@ -304,21 +312,29 @@ j(x) = exp(x) * x * (x-1)
find_zeros(j', 0, 1)
```
The following graph illustrates the lone value for $c$ in $[a,b]$ for
this problem:
::: {#fig-plot-expx-times-x-times-x-minus-1-over-0-1}
```{julia}
#| echo: false
x0 = find_zero(j', (0, 1))
j₀ = j(x0)
plot([j, x->j₀ + 0*(x-x0)], 0, 1; legend=false)
scatter!([0,x0,1], [j₀, j₀, j₀])
annotate!([(0,j₀,text("a", :bottom)),
(x0, j₀, text("c", :bottom)),
(1, j₀, text("b", :bottom))])
let
gr()
x0 = find_zero(j', (0, 1))
j₀ = j(x0)
plt = plot(; legend=false, framestyle=:origin)
plot!(plt, [j, x->j₀ + 0*(x-x0)], 0, 1)
scatter!(plt, [(x0, j₀)])
annotate!(plt, [
(0,0,text(L"a", :bottom, :left)),
(x0, j₀, text(L"(c, f(c))", :bottom, :left)),
(1, 0, text(L"b", :bottom))])
plotly()
plt
end
```
Plot of $f(x) = e^x \cdot x \cdot (x-1)$ over $[0,1]$ showing a single value $c$ satisfying Rolle's theorem
:::
## The mean value theorem
@@ -327,27 +343,25 @@ We are driving south and in one hour cover 70 miles. If the speed limit is 65 mi
The mean value theorem is a direct generalization of Rolle's theorem.
::: {.callout-note icon=false}
## Mean value theorem
::: {.theorem title="Mean value theorem"}
Let $f(x)$ be differentiable on $(a,b)$ and continuous on $[a,b]$. Then there exists a value $c$ in $(a,b)$ where
$$
f'(c) = (f(b) - f(a)) / (b - a).
f'(c) = \frac{f(b) - f(a)}{b - a}.
$$
:::
This says for any secant line between $a < b$ there will be a parallel tangent line at some $c$ with $a < c < b$ (all provided $f$ is differentiable on $(a,b)$ and continuous on $[a,b]$).
This theorem says appropriate functions the secant line between $a < b$ will have at least one parallel tangent line at a value $c$ with $a < c < b$.
@fig-mean-value-theorem illustrates the theorem. The secant line between $a$ and $b$ is dashed. For this function there are two values of $c$ where the slope of the tangent line is seen to be the same as the slope of this secant line. At least one is guaranteed by the theorem.
::: {#fig-mean-value-theorem}
```{julia}
#| hold: true
#| echo: false
#| label: fig-mean-value-theorem
let
# mean value theorem
gr()
@@ -397,6 +411,9 @@ plotly()
nothing
```
Figure illustrating the mean value theorem. The secant line from $(a,f(a))$ to $(b, f(b))$ is matched by two points $c$ in $(a,b)$ with parallel tangent lines
:::
Like Rolle's theorem this is a guarantee that something exists, not a recipe to find it. In fact, the mean value theorem is just Rolle's theorem applied to:
@@ -406,7 +423,7 @@ $$
That is the function $f(x)$, minus the secant line between $(a,f(a))$ and $(b, f(b))$.
::: {#fig-jsxgraph-mvt}
```{julia}
#| hold: true
#| echo: false
@@ -456,9 +473,28 @@ board.create('tangent', [r], {strokeColor:'#ff0000'});
line = board.create('line',[p[0],p[1]],{strokeColor:'#ff0000',dash:1});
```
This interactive example can also be found at [jsxgraph](http://jsxgraph.uni-bayreuth.de/wiki/index.php?title=Mean_Value_Theorem). It shows a cubic polynomial fit to the $4$ adjustable points labeled A through D. The secant line is drawn between points A and B with a dashed line. A tangent line with the same slope as the secant line is identified at a point $(\alpha, f(\alpha))$ where $\alpha$ is between the points A and B. That this can always be done is a consequence of the mean value theorem.
Interactive graphic showing a parallel tangent line to $f(x) at $a < c < b$ can always be found that has the same slope as the secant line between $(a, f(a))$ and $(b, f(b))$
:::
The interactive example of @fig-jsxgraph-mvt can also be found at [jsxgraph](http://jsxgraph.uni-bayreuth.de/wiki/index.php?title=Mean_Value_Theorem). It shows a cubic polynomial fit to the $4$ adjustable points labeled A through D. The secant line is drawn between points A and B with a dashed line. A tangent line---with the same slope as the secant line---is identified at a point $(\alpha, f(\alpha))$ where $\alpha$ is between the points A and B. That this can always be done is a consequence of the mean value theorem.
##### Example
The function $f(x) = e^{-x^2/2}$ is continuously differentiable on $[0,1]$. That means the mean value theorem applies. Find a value $c$ satisfying the theorem.
The pattern is the same, we use `Roots` to solve an equation as follows:
```{julia}
f(x) = exp(-x^2/2)
a, b = 0, 1
m = (f(b) - f(a)) / (b - a) # slope of secant line
h(x) = f'(x) - m # solving f'(x) = m
find_zeros(h, (a, b))
```
The call to `find_zeros` returns just one value for $c$.
##### Example
@@ -468,7 +504,9 @@ The mean value theorem is an extremely useful tool to relate properties of a fun
For example, suppose we have a function $f(x)$ and we know that the derivative is **always** $0$. What can we say about the function?
Well, constant functions have derivatives that are constantly $0$. But do others? We will see the answer is no: If a function has a zero derivative in $(a,b)$ it must be a constant. We can readily see that if $f$ is a polynomial function this is the case, as we can differentiate a polynomial function and this will be zero only if **all** its coefficients are $0$, which would mean there is no non-constant leading term in the polynomial. But polynomials are not representative of all functions, and so a proof requires a bit more effort.
Well, constant functions have derivatives that are constantly $0$. But do others? We will see the answer is no: If a function has a zero derivative in $(a,b)$ it must be a constant.
We can readily see that if $f$ is a polynomial function this is the case, as we can differentiate a polynomial function and this will be zero only if **all** its coefficients are $0$, which would mean there is no non-constant leading term in the polynomial. But polynomials are not representative of all functions, and so a proof requires a bit more effort.
Suppose it is known that $f'(x)=0$ on some interval $I$ and we take any $a < b$ in $I$. Since $f'(x)$ always exists, $f(x)$ is always differentiable, and hence always continuous. So on $[a,b]$ the conditions of the mean value theorem apply. That is, there is a $c$ in $(a,b)$ with $(f(b) - f(a)) / (b-a) = f'(c) = 0$. But this would imply $f(b) - f(a)=0$. That is $f(x)$ is a constant, as for any $a$ and $b$, we see $f(a)=f(b)$.
@@ -477,10 +515,9 @@ Suppose it is known that $f'(x)=0$ on some interval $I$ and we take any $a < b$
### The Cauchy mean value theorem
[Cauchy](http://en.wikipedia.org/wiki/Mean_value_theorem#Cauchy.27s_mean_value_theorem) offered an extension to the mean value theorem above.
[Cauchy](http://en.wikipedia.org/wiki/Mean_value_theorem#Cauchy.27s_mean_value_theorem) offered an extension to the mean value theorem.
::: {.callout-note icon=false}
## Cauchy mean value theorem
::: {.theorem title="Cauchy mean value theorem"}
Suppose both $f$ and $g$ satisfy the conditions of the mean value theorem on $[a,b]$ with $g(b)-g(a) \neq 0$, then there exists at least one $c$ with $a < c < b$ such that
@@ -513,12 +550,12 @@ For some $c$ in $[0,x]$. If $\lim_{x \rightarrow 0} f'(x)/g'(x) = L$, then the r
This could be used to prove the limit of $\sin(x)/x$ as $x$ goes to $0$ just by showing the limit of $\cos(x)/1$ is $1$, as is known by continuity.
### Visualizing the Cauchy mean value theorem
##### Example: visualizing the Cauchy mean value theorem
The Cauchy mean value theorem can be visualized in terms of a tangent line and a *parallel* secant line in a similar manner as the mean value theorem as long as a *parametric* graph is used. A parametric graph plots the points $(g(t), f(t))$ for some range of $t$. That is, it graphs *both* functions at the same time. The following illustrates the construction of such a graph:
::: {#fig-illustrate-cauchy-mean-value-theore}
```{julia}
#| hold: true
#| echo: false
@@ -540,15 +577,7 @@ function parametric_fns_graph(n)
val = @sprintf("% 0.2f", ts[end])
annotate!(plt, [(0, 1, L"t = %$val")])
end
caption = L"""
Illustration of parametric graph of $(g(t), f(t))$ for $-\pi/2 \leq t
\leq \pi/2$ with $g(x) = \sin(x)$ and $f(x) = x$. Each point on the
graph is from some value $t$ in the interval. We can see that the
graph goes through $(0,0)$ as that is when $t=0$. As well, it must go
through $(1, \pi/2)$ as that is when $t=\pi/2$
"""
caption = ""
n = 10
@@ -562,9 +591,17 @@ plotly()
ImageFile(imgfile, caption)
```
With $g(x) = \sin(x)$ and $f(x) = x$, we can take $I=[a,b] = [0, \pi/2]$. In the figure below, the *secant line* is drawn in red which connects $(g(a), f(a))$ with the point $(g(b), f(b))$, and hence has slope $\Delta f/\Delta g$. The parallel lines drawn show the *tangent* lines with slope $f'(c)/g'(c)$. Two exist for this problem, the mean value theorem guarantees at least one will.
Illustration of parametric graph of $(g(t), f(t))$ for $-\pi/2 \leq t
\leq \pi/2$ with $g(x) = \sin(x)$ and $f(x) = x$. Each point on the
graph is from some value $t$ in the interval. We can see that the
graph goes through $(0,0)$ as that is when $t=0$. As well, it must go
through $(1, \pi/2)$ as that is when $t=\pi/2$
:::
With $g(x) = \sin(x)$ and $f(x) = x$, we can take $I=[a,b] = [0, \pi/2]$. In the @fig-mvt-two-c-exists-for-sinx, the *secant line* is drawn in red which connects $(g(a), f(a))$ with the point $(g(b), f(b))$, and hence has slope $\Delta f/\Delta g$. The parallel lines drawn show the *tangent* lines with slope $f'(c)/g'(c)$. Two exist for this problem, the mean value theorem guarantees at least one will.
::: {#fig-mvt-two-c-exists-for-sinx}
```{julia}
#| hold: true
#| echo: false
@@ -587,6 +624,9 @@ end
p
```
Illustration of the Cauchy mean value theorem
:::
## Questions
@@ -659,6 +699,44 @@ numericq(float(val))
###### Question
Let $f(x) = 1/x$. For $0 < a < b$, find $c$ so that $f'(c) = (f(b) - f(a)) / (b-a)$.
```{julia}
#| hold: true
#| echo: false
choices = [
"``c = (a+b)/2``",
"``c = \\sqrt{ab}``",
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
answ = 2
radioq(choices, answ)
```
###### Question
Let $f(x) = x^2$. For $0 < a < b$, find $c$ so that $f'(c) = (f(b) - f(a)) / (b-a)$.
```{julia}
#| hold: true
#| echo: false
choices = [
"``c = (a+b)/2``",
"``c = \\sqrt{ab}``",
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
answ = 1
radioq(choices, answ)
```
###### Question
Will the function $f(x) = x + 1/x$ satisfy the conditions of the mean value theorem over $[-1/2, 1/2]$?
@@ -705,43 +783,6 @@ answ = 3
radioq(choices, answ)
```
###### Question
Let $f(x) = 1/x$. For $0 < a < b$, find $c$ so that $f'(c) = (f(b) - f(a)) / (b-a)$.
```{julia}
#| hold: true
#| echo: false
choices = [
"``c = (a+b)/2``",
"``c = \\sqrt{ab}``",
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
answ = 2
radioq(choices, answ)
```
###### Question
Let $f(x) = x^2$. For $0 < a < b$, find $c$ so that $f'(c) = (f(b) - f(a)) / (b-a)$.
```{julia}
#| hold: true
#| echo: false
choices = [
"``c = (a+b)/2``",
"``c = \\sqrt{ab}``",
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
answ = 1
radioq(choices, answ)
```
###### Question
@@ -774,3 +815,85 @@ L"The squeeze theorem applies, as $0 < g(x) < x$",
answ = 3
radioq(choices, answ)
```
##### Question
[Fermat](https://digitalcommons.ursinus.edu/cgi/viewcontent.cgi?params=/context/triumphs_calculus/article/1011/&path_info=M05_Fermats_Method_for_Finding_Maxima_and_Minima_2022_05_17.pdf) didn't exactly prove his theorem in the language of today. Rather, following Monks, we quote
> Let a be the desired unknown, whether it be a length, a plane region or a solid, depending
> on what the given magnitude equals, and let its maximum or minimum be found in terms of
> $a$, involving whatever degree. Replace this first quantity with $a + e$, and the maximum or
> minimum will be found in terms of $a$ and $e$, with coefficients of whatever degree. These two
> representations of the maximum or minimum are adequated, to use Diophantus term,
> and the common terms are subtracted. Having done this, all terms from either part (affected by
> $e$ or its powers) are divided each by $e$, or by a higher power of the same, until some term of
> one or the other of the expressions is altogether freed from being affected by $e$.
>
> All terms involving $e$ or one of its powers are then eliminated and the remaining terms
> are equated; or, should one of the expressions be left as nothing, then the positive terms
> are equated with the negatives, which reduces to the same thing. The solution to this last
> equation will yield the value of $a$, which will reveal knowledge of the maximum or minimum
Huh? As an example, he considered a line segment $AC$ and a point $E$ with the task of choosing $E$ so that $(E-A) \times (C-E)$ being a maximum.
::: {#fig-fermat-line-segment}
```{julia}
#| echo: false
let
gr()
A, E, C = (0,0), (1, 0), (3, 0)
plt = plot(; empty_style...)
plot!(plt, [A,C]; line=(1, :black))
tck = (0, 0.1)
for P ∈ (A, E, C)
plot!(plt, [P, P .+ tck], line=(1, :black))
end
annotate!(plt, [
(A..., text(L"A", :top)),
(E..., text(L"E", :top)),
(C..., text(L"C", :top))])
plotly()
plt
end
```
$AC$ is a line divided at $E$ so that $AE \times EC$ is maximum
::::
Set $b=AC$ and $a = AE$ then the product is $a \cdot (b-a)$. the point was at $a + e$, then the product would be $(a+e) \cdot (b - a - e)$. The term *adequated* means approximately equal gives what?
```{julia}
#| echo: false
choices = [L"a \cdot(b-a) - a \cdot (b-a) = 0",
L"a \cdot(b-a) - (a + e) \cdot (b- (a - e)) \approx 0"]
answer = 2
buttonq(choices, answer)
```
Next we divide by $e$---or a higher power of $e$---and simplify so that some term has not $e$ in it.
For this case, does this satisfy the above?
$$
\frac{(a \cdot (b-a) - (a + e)\cdot(b - (a + e))}{e} = 2a - b + e
$$
```{julia}
#| echo: false
choices = ["Yes", "No"]
answer = 1
buttonq(choices, answer)
```
The value $b - 2a = 0$ gives $a = $b/2$. Is this true: geometrically, we know this to be at the midpoint, as the equation is a parabola.
```{julia}
#| echo: false
choices = ["Yes", "No"]
answer = 1
buttonq(choices, answer)
```