This commit is contained in:
jverzani committed 2022-07-24 19:03:28 -04:00
1 parent ac87e089ca
commit 5ee2963688
636 files changed
+18 -719782

No files matched your search

@@ -1,15 +0,0 @@
{
"hash": "c0fd122da7ffa41ecdf913625bd88e60",
"result": {
"markdown": "# The first and second derivatives\n\n\n\nThis section uses these add-on packages:\n\n``` {.julia .cell-code}\nusing CalculusWithJulia\nusing Plots\nusing SymPy\nusing Roots\n```\n\n\n::: {.cell results='hidden' execution_count=3}\n\n::: {.cell-output .cell-output-stderr}\n```\nWARNING: redefinition of constant frontmatter. This may fail, cause incorrect answers, or produce other errors.\n```\n:::\n:::\n\n\n---\n\n\nThis section explores properties of a function, $f(x)$, that are described by properties of its first and second derivatives, $f'(x)$ and $f''(x)$. As part of the conversation two tests are discussed that characterize when a critical point is a relative maximum or minimum. (We know that any relative maximum or minimum occurs at a critical point, but it is not true that *any* critical point will be a relative maximum or minimum.)\n\n\n## Positive or increasing on an interval\n\n\nWe start with some vocabulary:\n\n\n> A function $f$ is **positive** on an interval $I$ if for any $a$ in $I$ it must be that $f(a) > 0$.\n\n\n\nOf course, we define *negative* in a parallel manner. The intermediate value theorem says a continuous function can not change from positive to negative without crossing $0$. This is not the case for functions with jumps, of course.\n\n\nNext,\n\n\n> A function, $f$, is (strictly) **increasing** on an interval $I$ if for any $a < b$ it must be that $f(a) < f(b)$.\n\n\n\nThe word strictly is related to the inclusion of the $<$ precluding the possibility of a function being flat over an interval that the $\\leq$ inequality would allow.\n\n\nA parallel definition with $a < b$ implying $f(a) > f(b)$ would be used for a *strictly decreasing* function.\n\n\nWe can try and prove these properties for a function algebraically – we'll see both are related to the zeros of some function. However, before proceeding to that it is usually helpful to get an idea of where the answer is using exploratory graphs.\n\n\nWe will use a helper function, `plotif(f, g, a, b)` that plots the function `f` over `[a,b]` coloring it red when `g` is positive (and blue otherwise). Such a function is defined for us in the accompanying `CalculusWithJulia` package, which has been previously been loaded.\n\n\nTo see where a function is positive, we simply pass the function object in for *both* `f` and `g` above. For example, let's look at where $f(x) = \\sin(x)$ is positive:\n\n::: {.cell hold='true' execution_count=4}\n``` {.julia .cell-code}\nf(x) = sin(x)\nplotif(f, f, -2pi, 2pi)\n```\n\n::: {.cell-output .cell-output-display execution_count=67}\n![](first_second_derivatives_files/figure-html/cell-5-output-1.svg){}\n:::\n:::\n\n\nLet's graph with `cos` in the masking spot and see what happens:\n\n::: {.cell execution_count=5}\n``` {.julia .cell-code}\nplotif(sin, cos, -2pi, 2pi)\n```\n\n::: {.cell-output .cell-output-display execution_count=68}\n![](first_second_derivatives_files/figure-html/cell-6-output-1.svg){}\n:::\n:::\n\n\nMaybe surprisingly, we see that the increasing parts of the sine curve are now highlighted. Of course, the cosine is the derivative of the sine function, now we discuss that this is no coincidence.\n\n\nFor the sequel, we will use `f'` notation to find numeric derivatives, with the notation being defined in the `CalculusWithJulia` package using the `ForwardDiff` package.\n\n\n## The relationship of the derivative and increasing\n\n\nThe derivative, $f'(x)$, computes the slope of the tangent line to the graph of $f(x)$ at the point $(x,f(x))$. If the derivative is positive, the tangent line will have an increasing slope. Clearly if we see an increasing function and mentally layer on a tangent line, it will have a positive slope. Intuitively then, increasing functions and positive derivatives are related concepts. But there are some technicalities.\n\n\nSuppose $f(x)$ has a derivative on $I$ . Then\n\n\n> If $f'(x)$ is positive on an interval $I=(a,b)$, then $f(x)$ is strictly increasing on $I$.\n\n\n\nMeanwhile,\n\n\n> If a function $f(x)$ is increasing on $I$, then $f'(x) \\geq 0$.\n\n\n\nThe technicality being the equality parts. In the second statement, we have the derivative is non-negative, as we can't guarantee it is positive, even if we considered just strictly increasing functions.\n\n\nWe can see by the example of $f(x) = x^3$ that strictly increasing functions can have a zero derivative, at a point.\n\n\nThe mean value theorem provides the reasoning behind the first statement: on $I$, the slope of any secant line between $d < e$ (both in $I$) is matched by the slope of some tangent line, which by assumption will always be positive. If the secant line slope is written as $(f(e) - f(d))/(e - d)$ with $d < e$, then it is clear then that $f(e) - f(d) > 0$, or $d < e$ implies $f(d) < f(e)$.\n\n\nThe second part, follows from the secant line equation. The derivative can be written as a limit of secant-line slopes, each of which is positive. The limit of positive tLine truncated
"supporting": [
"first_second_derivatives_files"
],
"filters": [],
"includes": {
"include-in-header": [
"<script src=\"https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js\" integrity=\"sha512-c3Nl8+7g4LMSTdrm621y7kf9v3SDPnhxLNhcjFJbKECVnmZHTdo+IRO05sNLTH/D3vA6u1X32ehoLC7WFVdheg==\" crossorigin=\"anonymous\"></script>\n<script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js\" integrity=\"sha512-bLT0Qm9VnAYZDflyKcBaQ2gg0hSYNQrJ8RilYldYQ1FxQYoCLtUjuuRuZo+fjqhx/qtq/1itJ0C2ejDxltZVFg==\" crossorigin=\"anonymous\"></script>\n<script type=\"application/javascript\">define('jquery', [],function() {return window.jQuery;})</script>\n"
]
}
}
}