use quarto, not Pluto to render pages

This commit is contained in:
jverzani
2022-07-24 16:38:24 -04:00
parent 93c993206a
commit 7b37ca828c
879 changed files with 793311 additions and 2678 deletions

View File

@@ -1,6 +1,8 @@
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
ImplicitPlots = "55ecb840-b828-11e9-1645-43f4a9f9ace7"
IntervalArithmetic = "d1acc4aa-44c8-5952-acd4-ba5d80a2a253"
IntervalConstraintProgramming = "138f1668-1576-5ad7-91b9-7425abbf3153"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"

View File

@@ -15,7 +15,7 @@ using Polynomials # some name clash with SymPy
```julia; echo=false; results="hidden"
using CalculusWithJulia.WeaveSupport
fig_size=(600, 400)
fig_size=(800, 600)
const frontmatter = (
title = "Curve Sketching",
description = "Calculus with Julia: Curve Sketching",
@@ -331,8 +331,8 @@ L"Just vertical asymptotes at $x=-1$ and $x=1$",
L"Vertical asymptotes at $x=-1$ and $x=1$ and a horizontal asymptote $y=1$",
L"Vertical asymptotes at $x=-1$ and $x=1$ and a slant asymptote"
]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
###### Question
@@ -474,8 +474,8 @@ choices = [
"The exponential growth model",
"The limit does not exist",
"The limit is ``P_0``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
##### Question
@@ -493,8 +493,8 @@ choices = [
"The function will have more curvature when the second derivative is large, so there needs to be more points to capture the shape",
"The function will be much larger (in absolute value) when the second derivative is large, so there needs to be more points to capture the shape",
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
##### Question
@@ -514,8 +514,8 @@ choices = [
"An informative graph only needs to show one or two periods, as others can be inferred.",
"An informative graph need only show a part of the period, as the rest can be inferred.",
L"An informative graph needs to show several periods, as that will allow proper computation for the $y$ axis range."]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
Why should asymptotics matter?
@@ -526,8 +526,8 @@ L"A vertical asymptote can distory the $y$ range, so it is important to avoid to
L"A horizontal asymptote must be plotted from $-\infty$ to $\infty$",
"A slant asymptote must be plotted over a very wide domain so that it can be identified."
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
Monotonicity means increasing or decreasing. This is important for what reason?
@@ -538,6 +538,6 @@ choices = [
"For monotonic regions, a function is basically a straight line",
"For monotonic regions, the function will have a vertical asymptote, so the region should not be plotted"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```

View File

@@ -19,7 +19,7 @@ const frontmatter = (
tags = ["CalculusWithJulia", "derivatives", "derivatives"],
);
fig_size=(600, 400)
fig_size=(800, 600)
nothing
```
@@ -1199,16 +1199,16 @@ At which of these points $c= 1/2, 1, 3/2$ is the derivative negative?
```julia; hold=true; echo=false
choices = ["``1/2``", "``1``", "``3/2``"]
ans = 1
radioq(choices, ans, keep_order=true)
answ = 1
radioq(choices, answ, keep_order=true)
```
Which value looks bigger from reading the graph:
```julia; hold=true; echo=false
choices = ["``f(1)``", "``f(3/2)``"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
At $0.708 \dots$ and $1.65\dots$ the derivative has a common value. What is it?
@@ -1229,8 +1229,8 @@ At $x = -2.5$ the derivative is postive or negative?
```julia; hold=true; echo=false
choices = ["positive", "negative"]
ans = 1
radioq(choices, ans, keep_order=true)
answ = 1
radioq(choices, answ, keep_order=true)
```
@@ -1238,16 +1238,16 @@ At $x=0$ the derivative is postive or negative?
```julia; hold=true; echo=false
choices = ["positive", "negative"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
At $x = 2.5$ the derivative is postive or negative?
```julia; hold=true; echo=false
choices = ["positive", "negative"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1256,8 +1256,8 @@ Compute the derivative of $e^x$ using `limit`. What do you get?
```julia; hold=true; echo=false
choices = ["``e^x``", "``x^e``", "``(e-1)x^e``", "``e x^{(e-1)}``", "something else"]
ans = 1
radioq(choices, ans, keep_order=true)
answ = 1
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1266,8 +1266,8 @@ Compute the derivative of $x^e$ using `limit`. What do you get?
```julia; hold=true; echo=false
choices = ["``e^x``", "``x^e``", "``(e-1)x^e``", "``e x^{(e-1)}``", "something else"]
ans = 5
radioq(choices, ans, keep_order=true)
answ = 5
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1276,8 +1276,8 @@ Compute the derivative of $e^{e\cdot x}$ using `limit`. What do you get?
```julia; hold=true; echo=false
choices = ["``e^x``", "``x^e``", "``(e-1)x^e``", "``e x^{(e-1)}``", "``e \\cdot e^{e\\cdot x}``", "something else"]
ans = 5
radioq(choices, ans, keep_order=true)
answ = 5
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1295,8 +1295,8 @@ choices = [
L" $1$, as this is clearly the analog of the limit of $\sin(h)/h$.",
L"Does not exist. The answer is $0/0$ which is undefined",
L" $0$, as this expression is the derivative of cosine at $0$. The answer follows, as cosine clearly has a tangent line with slope $0$ at $x=0$."]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -1310,8 +1310,8 @@ choices = [
"``f'(x) = f(x)``",
"``f'(x) = -f(x)``"
]
ans= 1
radioq(choices, ans)
answ= 1
radioq(choices, answ)
```
@@ -1326,8 +1326,8 @@ choices = [
"``f''(x) = -g(x)``",
"``f''(x) = f(x)``",
"``f''(x) = -f(x)``"]
ans= 3
radioq(choices, ans)
answ= 3
radioq(choices, answ)
```
@@ -1381,8 +1381,8 @@ L"If the graphs of $f$ and $g$ are translations up and down, the tangent line at
L"If the graphs of $f$ and $g$ are rescalings of each other through $g(x)=f(x/c)$, $c > 1$. Then the tangent line for corresponding points is the same.",
L"If the graphs of $f$ and $g$ are rescalings of each other through $g(x)=cf(x)$, $c > 1$. Then the tangent line for corresponding points is the same."
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -1409,8 +1409,8 @@ choices = [
"``f'(x) = -k^2 \\cdot f(x)``",
"``f''(x) = k^2 \\cdot f(x)``",
"``f''(x) = -k^2 \\cdot f(x)``"]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
###### Question
@@ -1424,8 +1424,8 @@ choices = [
"``f'(x) = -k^2 \\cdot f(x)``",
"``f''(x) = k^2 \\cdot f(x)``",
"``f''(x) = -k^2 \\cdot f(x)``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
##### Question

View File

@@ -416,17 +416,19 @@ g' + 0 - 0 - 0 + g'-sign
Consider the function $f(x) = x^2$. Over this function we draw some
secant lines for a few pairs of $x$ values:
```julia; hold=true; echo=false
f(x) = x^2
seca(f,a,b) = x -> f(a) + (f(b) - f(a)) / (b-a) * (x-a)
p = plot(f, -2, 3, legend=false, linewidth=5, xlim=(-2,3), ylim=(-2, 9))
plot!(p,seca(f, -1, 2))
a,b = -1, 2; xs = range(a, stop=b, length=50)
plot!(xs, seca(f, a, b).(xs), linewidth=5)
plot!(p,seca(f, 0, 3/2))
a,b = 0, 3/2; xs = range(a, stop=b, length=50)
plot!(xs, seca(f, a, b).(xs), linewidth=5)
p
```julia; echo=false
let
f(x) = x^2
seca(f,a,b) = x -> f(a) + (f(b) - f(a)) / (b-a) * (x-a)
p = plot(f, -2, 3, legend=false, linewidth=5, xlim=(-2,3), ylim=(-2, 9))
plot!(p,seca(f, -1, 2))
a,b = -1, 2; xs = range(a, stop=b, length=50)
plot!(xs, seca(f, a, b).(xs), linewidth=5)
plot!(p,seca(f, 0, 3/2))
a,b = 0, 3/2; xs = range(a, stop=b, length=50)
plot!(xs, seca(f, a, b).(xs), linewidth=5)
p
end
```
The graph attempts to illustrate that for this function the secant
@@ -573,11 +575,11 @@ One way to visualize the second derivative test is to *locally* overlay on a cri
```julia; hold=true;
f(x) = sin(x) + sin(2x) + sin(3x)
p = plot(f, 0, 2pi, legend=false, color=:blue, linewidth=3)
cps = fzeros(f', 0, 2pi)
h = 0.5
cps = find_zeros(f', (0, 2pi))
Δ = 0.5
for c in cps
parabola(x) = f(c) + (f''(c)/2) * (x-c)^2
plot!(parabola, c-h, c+h, color=:red, linewidth=5, alpha=0.6)
plot!(parabola, c - Δ, c + Δ, color=:red, linewidth=5, alpha=0.6)
end
p
```
@@ -637,16 +639,18 @@ find_zeros(k'', -3, 3)
A car travels from a stop for 1 mile in 2 minutes. A graph of its
position as a function of time might look like any of these graphs:
```julia; hold=true; echo=false
v(t) = 30/60*t
w(t) = t < 1/2 ? 0.0 : (t > 3/2 ? 1.0 : (t-1/2))
y(t) = 1 / (1 + exp(-t))
y1(t) = y(2(t-1))
y2(t) = y1(t) - y1(0)
y3(t) = 1/y2(2) * y2(t)
plot(v, 0, 2, label="f1")
plot!(w, label="f2")
plot!(y3, label="f3")
```julia; echo=false
let
v(t) = 30/60*t
w(t) = t < 1/2 ? 0.0 : (t > 3/2 ? 1.0 : (t-1/2))
y(t) = 1 / (1 + exp(-t))
y1(t) = y(2(t-1))
y2(t) = y1(t) - y1(0)
y3(t) = 1/y2(2) * y2(t)
plot(v, 0, 2, label="f1")
plot!(w, label="f2")
plot!(y3, label="f3")
end
```
All three graphs have the same *average* velocity which is just the
@@ -696,8 +700,8 @@ choices=[
"``(-5, -4.2)``",
"``(-5, -4.2)`` and ``(-2.5, 0)``",
"``(-4.2, -2.5)``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -718,8 +722,8 @@ choices=[
"``(-25.0, 0.0)``",
"``(-5.0, -4.0)`` and ``(-4, -3)``",
"``(-4.0, -3.0)``"]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
###### Question
@@ -740,8 +744,8 @@ choices=[
"``(-4.7, -3.0)``",
"``(-0.17, 0.17)``"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -763,8 +767,8 @@ choices=[
"``(-0.6, 0.6)``",
" ``(-3.0, -0.6)`` and ``(0.6, 3.0)``"
]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
@@ -786,8 +790,8 @@ choices = [
"That the critical point at ``0`` is a relative maximum",
"That the critical point at ``0`` is a relative minimum"
]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -801,8 +805,8 @@ choices = [
" ``f(x)`` is continuous and differentiable at ``2`` and has a critical point",
" ``f(x)`` is continuous and differentiable at ``2`` and has a critical point that is a relative minimum by the second derivative test"
]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
@@ -810,22 +814,26 @@ radioq(choices, ans, keep_order=true)
Find the smallest critical point of $f(x) = x^3 e^{-x}$.
```julia; hold=true; echo=false
f(x)= x^3*exp(-x)
cps = find_zeros(D(f), -5, 10)
val = minimum(cps)
numericq(val)
```julia; echo=false
let
f(x)= x^3*exp(-x)
cps = find_zeros(D(f), -5, 10)
val = minimum(cps)
numericq(val)
end
```
###### Question
How many critical points does $f(x) = x^5 - x + 1$ have?
```julia; hold=true; echo=false
f(x) = x^5 - x + 1
cps = find_zeros(D(f), -3, 3)
val = length(cps)
numericq(val)
```julia; echo=false
let
f(x) = x^5 - x + 1
cps = find_zeros(D(f), -3, 3)
val = length(cps)
numericq(val)
end
```
###### Question
@@ -833,11 +841,13 @@ numericq(val)
How many inflection points does $f(x) = x^5 - x + 1$ have?
```julia; hold=true; echo=false
f(x) = x^5 - x + 1
cps = find_zeros(D(f,2), -3, 3)
val = length(cps)
numericq(val)
```julia; echo=false
let
f(x) = x^5 - x + 1
cps = find_zeros(D(f,2), -3, 3)
val = length(cps)
numericq(val)
end
```
###### Question
@@ -850,8 +860,8 @@ choices = [
"No, the second derivative test is possibly inconclusive",
"Yes"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -865,15 +875,17 @@ choices = [
"No, the second derivative test is possibly inconclusive if ``c=0``, but otherwise yes",
"Yes"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
```julia; hold=true; echo=false
f(x) = exp(-x) * sin(pi*x)
plot(D(f), 0, 3)
```julia; echo=false
let
f(x) = exp(-x) * sin(pi*x)
plot(D(f), 0, 3)
end
```
The graph shows $f'(x)$. Is it possible that $f(x) = e^{-x} \sin(\pi x)$?
@@ -931,8 +943,8 @@ choices = [
"The critical points are at ``x=1`` (a relative minimum), ``x=2`` (not a relative extrema), and ``x=3`` (a relative minimum).",
"The critical points are at ``x=1`` (a relative minimum), ``x=2`` (a relative minimum), and ``x=3`` (a relative minimum).",
]
ans=1
radioq(choices, ans)
answ=1
radioq(choices, answ)
```
##### Question
@@ -945,8 +957,8 @@ choices = [
"The function is decreasing over ``(-\\infty, 1)`` and increasing over ``(1, \\infty)``",
"The function is negative over ``(-\\infty, 1)`` and positive over ``(1, \\infty)``",
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
##### Question
@@ -957,8 +969,8 @@ While driving we accelerate to get through a light before it turns red. However,
choices = ["A zero of the function",
"A critical point for the function",
"An inflection point for the function"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
###### Question

View File

@@ -237,17 +237,12 @@ Not quite what we expect, perhaps, but substituting in ``f(x)/g(x)`` for ``y`` g
\frac{dy}{dx} = \frac{f'(x) - \frac{f(x)}{g(x)} g'(x)}{g(x)} = \frac{f'(x) g(x) - f(x) g'(x)}{g(x)^2}.
```
```julia; echo=false
note("""
In this example we mix notations using ``g'(x)`` to
represent a derivative of ``g`` with respect to ``x`` and ``dy/dx`` to
represent the derivative of ``y`` with respect to ``x``. This is done to
emphasize the value that we are solving for. It is just a convention
though, we could just as well have used the "prime" notation for each.
""")
```
!!! note
In this example we mix notations using ``g'(x)`` to
represent a derivative of ``g`` with respect to ``x`` and ``dy/dx`` to
represent the derivative of ``y`` with respect to ``x``. This is done to
emphasize the value that we are solving for. It is just a convention
though, we could just as well have used the "prime" notation for each.
##### Example: Graphing a tangent line
@@ -399,17 +394,11 @@ Basically this includes all the same steps as if done "by hand." Some effort cou
values for the parameters been substituted initially, but not doing so
shows their dependence in the derivative.
```julia; echo=false
alert("The use of `lambdify(H)` is needed to turn the symbolic expression, `H`, into a function.")
```
!!! warning
The use of `lambdify(H)` is needed to turn the symbolic expression, `H`, into a function.
```julia; echo=false
note("""
While `SymPy` itself has the `plot_implicit` function for plotting implicit equations, this works only with `PyPlot`, not `Plots`, so we use the `ImplicitPlots` package in these examples.
""")
```
!!! note
While `SymPy` itself has the `plot_implicit` function for plotting implicit equations, this works only with `PyPlot`, not `Plots`, so we use the `ImplicitPlots` package in these examples.
## Higher order derivatives
@@ -818,8 +807,8 @@ choices = [
"``b \\cdot (1 - (x/a)^n)^{1/n}``",
"``-(x/a)^n / (y/b)^n``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -863,8 +852,8 @@ choices = [
"``2xy / (x^2 + a^2)``",
"``a^3/(x^2 + a^2)``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -885,8 +874,8 @@ Using Implicit differentiation, find when ``dy/dx = 0``.
```julia; hold=true; echo=false
choices = ["``y^2 = 3x/a``", "``y=3x^2/a``", "``y=a/(3x^2)``", "``y^2=a/(3x)``"]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
Substituting the correct value of ``y``, above, into the defining equation gives what value for ``x``:
@@ -898,8 +887,8 @@ choices=[
"``x=(1/2) a^3 3^{1/3}``",
"``x=(1/3) a^2 2^{1/2}``"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -924,8 +913,8 @@ If ``y>0`` is the sign positive or negative?
```julia; hold=true; echo=false
choices = ["positive", "negative", "Can be both"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
If ``x>0`` is the sign positive or negative?
@@ -933,16 +922,16 @@ If ``x>0`` is the sign positive or negative?
```julia; hold=true; echo=false
choices = ["positive", "negative", "Can be both"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
When ``x>0``, the graph of the equation is...
```julia; hold=true; echo=false
choices = ["concave up", "concave down", "both concave up and down"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```

View File

@@ -15,7 +15,7 @@ using SymPy
using CalculusWithJulia.WeaveSupport
using Roots
fig_size=(600, 400)
fig_size=(800, 600)
const frontmatter = (
title = "L'Hospital's Rule",
description = "Calculus with Julia: L'Hospital's Rule",
@@ -79,10 +79,10 @@ likely due to one of the Bernoulli brothers.
> ``\lim_{x \rightarrow c+}f(x)/g(x) = L``.
That is *if* the right limit of ``f(x)/g(x)`` is indeterminate of the form ``0/0``,
but the right limit of ``f'(x)/g'(x)`` is known, possibly by simple
continuity, then the right limit of ``f(x)/g(x)`` exists and is equal to that
of ``f'(x)/g'(x)``.
That is *if* the right limit of ``f(x)/g(x)`` is indeterminate of the
form ``0/0``, but the right limit of ``f'(x)/g'(x)`` is known,
possibly by simple continuity, then the right limit of ``f(x)/g(x)``
exists and is equal to that of ``f'(x)/g'(x)``.
The rule equally applies to *left limits* and *limits* at ``c``. Later it will see there are other generalizations.
@@ -102,12 +102,8 @@ this answer is as it is, but we don't need to think in terms of
\approx x``, as ``\cos(0)`` appears as the coefficient.
```julia; echo=false
note("""
In [Gruntz](http://www.cybertester.com/data/gruntz.pdf), in a reference attributed to Speiss, we learn that L'Hospital was a French Marquis who was taught in ``1692`` the calculus of Leibniz by Johann Bernoulli. They made a contract obliging Bernoulli to leave his mathematical inventions to L'Hospital in exchange for a regular compensation. This result was discovered in ``1694`` and appeared in L'Hospital's book of ``1696``.
"""; title="Bernoulli-de l'Hospital")
```
!!! note
In [Gruntz](http://www.cybertester.com/data/gruntz.pdf), in a reference attributed to Speiss, we learn that L'Hospital was a French Marquis who was taught in ``1692`` the calculus of Leibniz by Johann Bernoulli. They made a contract obliging Bernoulli to leave his mathematical inventions to L'Hospital in exchange for a regular compensation. This result was discovered in ``1694`` and appeared in L'Hospital's book of ``1696``.
##### Examples
@@ -121,10 +117,8 @@ In [Gruntz](http://www.cybertester.com/data/gruntz.pdf), in a reference attribut
= \lim_{x \rightarrow 0}\frac{a^x - 1}{x}.
```
```julia; echo=false
note("""Why rewrite in the "opposite" direction? Because the theorem's result -- ``L`` is the limit -- is only true if the related limit involving the derivative exists. We don't do this in the following, but did so here to emphasize the need for the limit of the ratio of the derivatives to exist.
""")
```
!!! note
Why rewrite in the "opposite" direction? Because the theorem's result -- ``L`` is the limit -- is only true if the related limit involving the derivative exists. We don't do this in the following, but did so here to emphasize the need for the limit of the ratio of the derivatives to exist.
- Consider this limit:
@@ -270,7 +264,8 @@ known.
----
```julia; hold=true; echo=false; cache=true
```julia; echo=false; cache=true
let
## {{{lhopitals_picture}}}
function lhopitals_picture_graph(n)
@@ -286,8 +281,8 @@ function lhopitals_picture_graph(n)
## get bounds
tl = (x) -> g(0) + m * (x - f(0))
lx = max(fzero(x -> tl(x) - (-0.05),-1000, 1000), -0.6)
rx = min(fzero(x -> tl(x) - (0.25),-1000, 1000), 0.2)
lx = max(find_zero(x -> tl(x) - (-0.05), (-1000, 1000)), -0.6)
rx = min(find_zero(x -> tl(x) - (0.25), (-1000, 1000)), 0.2)
xs = [lx, rx]
ys = map(tl, xs)
@@ -319,7 +314,8 @@ gif(anim, imgfile, fps = 1)
plotly()
ImageFile(imgfile, caption)
ImageFile(imgfile, caption)
end
```
## Generalizations
@@ -556,8 +552,8 @@ nothing
```
```julia; hold=true; echo=false
ans = 1
radioq(lh_choices, ans, keep_order=true)
answ = 1
radioq(lh_choices, answ, keep_order=true)
```
###### Question
@@ -565,8 +561,8 @@ radioq(lh_choices, ans, keep_order=true)
This function ``f(x) = \sin(x)^{\sin(x)}`` is *indeterminate* at ``x=0``. What type?
```julia; hold=true; echo=false
ans =3
radioq(lh_choices, ans, keep_order=true)
answ =3
radioq(lh_choices, answ, keep_order=true)
```
###### Question
@@ -574,8 +570,8 @@ radioq(lh_choices, ans, keep_order=true)
This function ``f(x) = (x-2)/(x^2 - 4)`` is *indeterminate* at ``x=2``. What type?
```julia; hold=true; echo=false
ans = 1
radioq(lh_choices, ans, keep_order=true)
answ = 1
radioq(lh_choices, answ, keep_order=true)
```
###### Question
@@ -583,8 +579,8 @@ radioq(lh_choices, ans, keep_order=true)
This function ``f(x) = (g(x+h) - g(x-h)) / (2h)`` (``g`` is continuous) is *indeterminate* at ``h=0``. What type?
```julia; hold=true; echo=false
ans = 1
radioq(lh_choices, ans, keep_order=true)
answ = 1
radioq(lh_choices, answ, keep_order=true)
```
###### Question
@@ -592,8 +588,8 @@ radioq(lh_choices, ans, keep_order=true)
This function ``f(x) = x \log(x)`` is *indeterminate* at ``x=0``. What type?
```julia; hold=true; echo=false
ans = 5
radioq(lh_choices, ans, keep_order=true)
answ = 5
radioq(lh_choices, answ, keep_order=true)
```
@@ -610,8 +606,8 @@ choices = [
"Yes. It is of the form ``0/0``",
"No. It is not indeterminate"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -769,6 +765,6 @@ choices = [
"``0``",
"It does not exist"
]
ans =1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```

View File

@@ -641,8 +641,8 @@ choices = [
"``1 + x^{1/2}``",
"``1 + (1/2) \\cdot x``",
"``1 - (1/2) \\cdot x``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -657,8 +657,8 @@ choices = [
"``1 + x^k``",
"``1 + k \\cdot x``",
"``1 - k \\cdot x``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -672,8 +672,8 @@ choices = [
"``x``",
"``1 - x^2/2``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -688,8 +688,8 @@ choices = [
"``1 + x``",
"``1 - x``"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
@@ -705,8 +705,8 @@ choices = [
"``1 + x``",
"``25``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -719,8 +719,8 @@ value of the tangent line at $(25, f(25))$ at $x=26$.
```julia; hold=true; echo=false
tgent(x) = 5 + x/10
ans = tgent(1) - sqrt(26)
numericq(ans)
answ = tgent(1) - sqrt(26)
numericq(answ)
```
###### Question
@@ -730,8 +730,8 @@ An estimate of some quantity was $12.34$ the actual value was $12$. What was the
```julia; hold=true; echo=false
est = 12.34
act = 12.0
ans = (est -act)/act * 100
numericq(ans)
answ = (est -act)/act * 100
numericq(answ)
```
@@ -744,8 +744,8 @@ tl(x) = x
x0 = 5 * pi/180
est = x0
act = sin(x0)
ans = (est -act)/act * 100
numericq(ans)
answ = (est -act)/act * 100
numericq(answ)
```
###### Question
@@ -754,8 +754,8 @@ The side length of a square is measured roughly to be $2.0$ cm. The actual lengt
```julia; hold=true; echo=false
tl(x) = 4 + 4x
ans = tl(.2) - 4
numericq(abs(ans))
answ = tl(.2) - 4
numericq(abs(answ))
```

View File

@@ -14,7 +14,7 @@ using CalculusWithJulia.WeaveSupport
using Printf
using SymPy
fig_size = (600, 400)
fig_size = (800, 600)
const frontmatter = (
title = "The mean value theorem for differentiable functions.",
@@ -84,19 +84,14 @@ power rule: $f'(x) = 1/3 \cdot x^{-2/3}$, which has a vertical
asymptote at $x=0$.
```julia; echo=false
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.
""")
```
!!! 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.
Lest you think that continuous functions always have derivatives
@@ -128,14 +123,9 @@ must also be specified, for a relative maximum there just needs to
exist some interval, possibly really small, though it must be bigger
than a point.
```julia; echo=false
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.
""")
```
!!! 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.
What does this have to do with derivatives?
@@ -286,19 +276,14 @@ Here the maximum occurs at an endpoint. The critical point $c=0.67\dots$
does not produce a maximum value. Rather $f(0.67\dots)$ is an absolute
minimum.
```julia; echo=false
note(L"""
**Absolute minimum** We haven't discussed the parallel problem of
!!! note
**Absolute minimum** We haven't discussed the parallel problem of
absolute minima over a closed interval. By considering the function
$h(x) = - f(x)$, we see that the any thing true for an absolute
maximum should hold in a related manner for an absolute minimum, in
particular an absolute minimum on a closed interval will only occur
at a critical point or an end point.
""")
```
## Rolle's theorem
Let $f(x)$ be differentiable on $(a,b)$ and continuous on
@@ -616,8 +601,8 @@ choices = [
"``h(x) = f(x) - g(x)``",
"``h(x) = f'(x) - g'(x)``"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -630,8 +615,8 @@ L"It isn't. The function $f(x) = x^2$ has two zeros and $f''(x) = 2 > 0$",
"By the Rolle's theorem, there is at least one, and perhaps more",
L"By the mean value theorem, we must have $f'(b) - f'(a) > 0$ when ever $b > a$. This means $f'(x)$ is increasing and can't double back to have more than one zero."
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -645,8 +630,8 @@ choices = [
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -660,8 +645,8 @@ choices = [
"``c = 1 / (1/a + 1/b)``",
"``c = a + (\\sqrt{5} - 1)/2 \\cdot (b-a)``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -678,8 +663,8 @@ Why is it known that $g(x)$ goes to $0$ as $x$ goes to zero (from the right)?
choices = [L"The squeeze theorem applies, as $0 < g(x) < x$.",
L"As $f(x)$ goes to zero by Rolle's theorem it must be that $g(x)$ goes to $0$.",
L"This follows by the extreme value theorem, as there must be some $c$ in $[0,x]$."]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
Since $g(x)$ goes to zero, why is it true that if $f(x)$ goes to $L$ as $x$ goes to zero that $f(g(x))$ must also have a limit $L$?
@@ -688,6 +673,6 @@ Since $g(x)$ goes to zero, why is it true that if $f(x)$ goes to $L$ as $x$ goes
choices = ["It isn't true. The limit must be 0",
L"The squeeze theorem applies, as $0 < g(x) < x$",
"This follows from the limit rules for composition of functions"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```

View File

@@ -498,8 +498,8 @@ choices = [
"The function oscillates too much to rely on the tangent line approximation far from the zero",
"We can find an answer"
]
ans = 4
radioq(choices, ans, keep_order=true)
answ = 4
radioq(choices, answ, keep_order=true)
```
@@ -525,6 +525,6 @@ choices = [
"The function oscillates too much to rely on the tangent line approximations far from the zero",
"We can find an answer"
]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```

View File

@@ -14,7 +14,7 @@ using Roots
using CalculusWithJulia.WeaveSupport
using ImplicitPlots
fig_size = (600, 400)
fig_size = (800, 600)
const frontmatter = (
title = "Newton's method",
description = "Calculus with Julia: Newton's method",
@@ -221,20 +221,15 @@ functions, convergence happens quickly.
```julia; echo=false
note("""
Newton looked at this same example in 1699 (B.T. Polyak, *Newton's
method and its use in optimization*, European Journal of Operational
Research. 02/2007; 181(3):1086-1096.) though his technique was
slightly different as he did not use the derivative, *per se*, but
rather an approximation based on the fact that his function was a
polynomial (though identical to the derivative). Raphson (1690)
proposed the general form, hence the usual name of the Newton-Raphson
method.
""")
```
!!! note
Newton looked at this same example in 1699 (B.T. Polyak, *Newton's
method and its use in optimization*, European Journal of Operational
Research. 02/2007; 181(3):1086-1096.) though his technique was
slightly different as he did not use the derivative, *per se*, but
rather an approximation based on the fact that his function was a
polynomial (though identical to the derivative). Raphson (1690)
proposed the general form, hence the usual name of the Newton-Raphson
method.
#### Examples
@@ -634,13 +629,10 @@ This convergence to ``\alpha`` will be quadratic *if*:
not necessarily a good approximation to the actual zero, $\alpha$.
```julia; echo=false
note("""
The basic tradeoff: methods like Newton's are faster than the
bisection method in terms of function calls, but are not guaranteed to
converge, as the bisection method is.
""")
```
!!! note
The basic tradeoff: methods like Newton's are faster than the
bisection method in terms of function calls, but are not guaranteed to
converge, as the bisection method is.
What can go wrong when one of these isn't the case is illustrated next:
@@ -802,8 +794,8 @@ If one step of Newton's method was used, what would be the value of $x_1$?
```julia; hold=true; echo=false
choices = ["``-2.224``", "``-2.80``", "``-0.020``", "``0.355``"]
ans = 1
radioq(choices, ans, keep_order=true)
answ = 1
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -827,8 +819,8 @@ L"It must be $x_1 > \alpha$",
L"It must be $x_1 < x_0$",
L"It must be $x_0 < x_1 < \alpha$"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
----
@@ -852,8 +844,8 @@ L"It must be $x_1 < \alpha$",
L"It must be $x_1 > x_0$",
L"It must be $\alpha < x_1 < x_0$"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
----
@@ -866,8 +858,8 @@ L"As $f''(\xi)/2 \cdot(x-c)^2$ is non-negative, we must have $f(x) - (f(c) + f'(
L"As $f''(\xi) < 0$ it must be that $f(x) - (f(c) + f'(c)\cdot(x-c)) \geq 0$.",
L"This isn't true. The function $f(x) = x^3$ at $x=0$ provides a counterexample"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
This question can be used to give a proof for the previous two questions, which can be answered by considering the graphs alone. Combined, they say that if a function is increasing and concave up and ``\alpha`` is a zero, then if ``x_0 < \alpha`` it will be ``x_1 > \alpha``, and for any ``x_i > \alpha``, ``\alpha <= x_{i+1} <= x_\alpha``, so the sequence in Newton's method is decreasing and bounded below; conditions for which it is guaranteed mathematically there will be convergence.
@@ -1050,8 +1042,8 @@ choices = [
"No. The initial guess is not close enough",
"No. The second derivative is too big",
L"No. The first derivative gets too close to $0$ for one of the $x_i$"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
@@ -1067,8 +1059,8 @@ choices = [
"No. The initial guess is not close enough",
"No. The second derivative is too big, or does not exist",
L"No. The first derivative gets too close to $0$ for one of the $x_i$"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1082,8 +1074,8 @@ choices = [
"No. The initial guess is not close enough",
"No. The second derivative is too big, or does not exist",
L"No. The first derivative gets too close to $0$ for one of the $x_i$"]
ans = 1
radioq(choices, ans, keep_order=true)
answ = 1
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1097,8 +1089,8 @@ choices = [
"No. The initial guess is not close enough",
"No. The second derivative is too big, or does not exist",
L"No. The first derivative gets too close to $0$ for one of the $x_i$"]
ans = 4
radioq(choices, ans, keep_order=true)
answ = 4
radioq(choices, answ, keep_order=true)
```
@@ -1114,8 +1106,8 @@ choices = [
"No. The initial guess is not close enough",
"No. The second derivative is too big, or does not exist",
L"No. The first derivative gets too close to $0$ for one of the $x_i$"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -1177,8 +1169,8 @@ L"It doesn't fail, it converges to $0$",
L"The tangent lines for $|x| > 0.25$ intersect at $x$ values with $|x| > 0.25$",
L"The first derivative is $0$ at $1$"
]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
@@ -1261,14 +1253,14 @@ So we have a means to find $y(x)$, but it is implicit.
Using `find_zero`, find the value $x$ which maximizes `y` by finding a zero of `y'`. Use this to find the point $(x,y)$ with largest $y$ value.
```julia; hold=true; echo=false
xstar = find_zero(yp, 0.5)
xstar = find_zero(findy', 0.5)
ystar = findy(xstar)
choices = ["``(-0.57735, 1.15470)``",
"``(0,0)``",
"``(0, -0.57735)``",
"``(0.57735, 0.57735)``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
(Using automatic derivatives works for values identified with `find_zero` *as long as* the initial point has its type the same as that of `x`.)

View File

@@ -210,13 +210,8 @@ fp = diff(f(x),x)
fp, fp(c), f'(c), (f(c+h) - f(c))/h
```
```julia;echo=false
note("""
The use of `'` to find derivatives provided by `CalculusWithJulia` is convenient, and used extensively in these notes, but it needs to be noted that it does **not conform** with the generic meaning of `'` within `Julia`'s wider package ecosystem and may cause issue with linear algebra operations; the symbol is meant for the adjoint of a matrix.
""")
```
!!! note
The use of `'` to find derivatives provided by `CalculusWithJulia` is convenient, and used extensively in these notes, but it needs to be noted that it does **not conform** with the generic meaning of `'` within `Julia`'s wider package ecosystem and may cause issue with linear algebra operations; the symbol is meant for the adjoint of a matrix.
## Questions

View File

@@ -12,11 +12,11 @@ using SymPy
```julia; echo=false; results="hidden"
using CalculusWithJulia.WeaveSupport
fig_size = (400, 400)
const frontmatter = (
title = "Optimization",
description = "Calculus with Julia: Optimization",
tags = ["CalculusWithJulia", "derivatives", "optimization"],
fig_size = (800, 600)
frontmatter = (
title = "Optimization",
description = "Calculus with Julia: Optimization",
tags = ["CalculusWithJulia", "derivatives", "optimization"],
);
nothing
@@ -173,13 +173,8 @@ find_zeros(A', 0, 10) # find_zeros in `Roots`,
```julia; echo=false
note("""
Look at the last definition of `A`. The function `A` appears on both sides, though on the left side with one argument and on the right with two. These are two "methods" of a *generic* function, `A`. `Julia` allows multiple definitions for the same name as long as the arguments (their number and type) can disambiguate which to use. In this instance, when one argument is passed in then the last defintion is used (`A(b,h(b))`), whereas if two are passed in, then the method that multiplies both arguments is used. The advantage of multiple dispatch is illustrated: the same concept - area - has one function name, though there may be different ways to compute the area, so there is more than one implementation.
""")
```
!!! note
Look at the last definition of `A`. The function `A` appears on both sides, though on the left side with one argument and on the right with two. These are two "methods" of a *generic* function, `A`. `Julia` allows multiple definitions for the same name as long as the arguments (their number and type) can disambiguate which to use. In this instance, when one argument is passed in then the last defintion is used (`A(b,h(b))`), whereas if two are passed in, then the method that multiplies both arguments is used. The advantage of multiple dispatch is illustrated: the same concept - area - has one function name, though there may be different ways to compute the area, so there is more than one implementation.
#### Example: Norman windows
@@ -582,7 +577,7 @@ both positive. What value $x$ in $[0,L]$ will minimize the total travel time?
We approach this symbolically with `SymPy`:
```julia;
@syms a::positive b::positive L::positive r0::positive r1::positive
@syms x::positive a::positive b::positive L::positive r0::positive r1::positive
d0 = sqrt(x^2 + a^2)
d1 = sqrt((L-x)^2 + b^2)
@@ -913,8 +908,8 @@ choices = [
"It is also 20",
"``17.888``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -1076,8 +1071,8 @@ Now if $Likhood(t) = \exp(-3t) \cdot \exp(-2t) \cdot \exp(-4t), \quad 0 \leq t \
choices=["It does work and the answer is x = 2.27...",
L" $Likhood(t)$ is not continuous on $0$ to $10$",
L" $Likhood(t)$ takes its maximum at a boundary point - not a critical point"];
ans = 3;
radioq(choices, ans)
answ = 3;
radioq(choices, answ)
```
##### Question
@@ -1103,8 +1098,8 @@ choices=[
"The median, or middle number, of the values",
L"The square roots of the values squared, $(x_1^2 + \cdots x_n^2)^2$"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -1241,8 +1236,8 @@ choices = ["exactly four times",
L"exactly $\pi$ times",
L"about $2.6$ times as big",
"about the same"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -1278,8 +1273,8 @@ choices = [
"``e/a``",
"``a \\cdot e``"
]
ans=2
radioq(choices, ans)
answ=2
radioq(choices, answ)
```
###### Question

View File

@@ -12,7 +12,7 @@ using SymPy
```julia; echo=false; results="hidden"
using CalculusWithJulia.WeaveSupport
fig_size=(600, 400)
fig_size=(800, 600)
const frontmatter = (
title = "Related rates",
description = "Calculus with Julia: Related rates",
@@ -610,8 +610,8 @@ choices = [
"The rate of change of price will increase",
"The rate of change of price will be positive and will depend on the rate of change of excess demand."
]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
(Theoretically, when demand exceeds supply, prices increase.)
@@ -625,8 +625,8 @@ choices = [
"If the rate of change of unemployment is negative, the rate of change of wages will be negative.",
"If the rate of change of unemployment is negative, the rate of change of wages will be positive."
]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
(Colloquially, "the rate of change of unemployment is negative" means the unemployment rate is going down, so there are fewer workers available to fill new jobs.)
@@ -643,8 +643,8 @@ L"The rate of change of pressure is always increasing by $c$",
"If volume is constant, the rate of change of pressure is proportional to the temperature",
"If volume is constant, the rate of change of pressure is proportional to the rate of change of temperature",
"If pressure is held constant, the rate of change of pressure is proportional to the rate of change of temperature"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -735,8 +735,8 @@ choices = [
"``f(x) = x``",
"``f(x) = x^2``"
]
ans = 4
radioq(choices, ans, keep_order=true)
answ = 4
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -763,8 +763,8 @@ choices = [
"``y = 1 - \\log(x)``",
"``y = x(2x - 1/x)``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
If $dx/dt = -1$, what is $dy/dt$?
@@ -776,6 +776,6 @@ choices = [
"``dy/dt = -2x - 1/x``",
"``dy/dt = 1``"
]
ans=1
radioq(choices, ans)
answ=1
radioq(choices, answ)
```

View File

@@ -14,7 +14,7 @@ using Unitful
using CalculusWithJulia.WeaveSupport
using Roots
fig_size = (600, 400)
fig_size = (800, 600)
const frontmatter = (
title = "Taylor Polynomials and other Approximating Polynomials",
description = "Calculus with Julia: Taylor Polynomials and other Approximating Polynomials",
@@ -564,14 +564,9 @@ output. `SymPy` provides the `removeO` method to strip this. (It is called as `o
```julia; echo=false
note("""
!!! note
A Taylor polynomial of degree ``n`` consists of ``n+1`` terms and an error term. The "Taylor series" is an *infinite* collection of terms, the first ``n+1`` matching the Taylor polynomial of degree ``n``. The fact that series are *infinite* means care must be taken when even talking about their existence, unlike a Tyalor polynomial, which is just a polynomial and exists as long as a sufficient number of derivatives are available.
A Taylor polynomial of degree ``n`` consists of ``n+1`` terms and an error term.
The "Taylor series" is an *infinite* collection of terms, the first ``n+1`` matching the Taylor polynomial of degree ``n``. The fact that series are *infinite* means care must be taken when even talking about their existence, unlike a Tyalor polynomial, which is just a polynomial and exists as long as a sufficient number of derivatives are available.
""")
```
We define a function to compute Taylor polynomials from a function. The following returns a function, not a symbolic object, using `D`, from `CalculusWithJulia`, which is based on `ForwardDiff.derivative`, to find higher-order derivatives:
@@ -965,8 +960,8 @@ choices = [
"``\\sum_{k=0}^{4} (-1)^k/(2k+1)! \\cdot x^{2k+1}``",
"``\\sum_{k=0}^{10} x^n/n!``"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -980,8 +975,8 @@ choices = [
"``\\sum_{k=0}^{4} (-1)^k/(2k+1)! \\cdot x^{2k+1}``",
"``\\sum_{k=0}^{10} x^n/n!``"
]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
@@ -997,8 +992,8 @@ choices = [
"``\\sum_{k=0}^{4} (-1)^k/(2k+1)! \\cdot x^{2k+1}``",
"``\\sum_{k=0}^{10} x^n/n!``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -1012,8 +1007,8 @@ choices = [
"``1/5!``",
"``2/15``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
###### Question
@@ -1028,8 +1023,8 @@ choices = [
"``x^2``",
"``x^2 \\cdot (x - x^3/3! + x^5/5!)``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -1048,8 +1043,8 @@ If this is true, then formally evaluating at $x=0$ gives $f(0) = a$, so $a$ is d
choices = ["``f''''(0) = e``",
"``f''''(0) = 4 \\cdot 3 \\cdot 2 e = 4! e``",
"``f''''(0) = 0``"]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -1069,8 +1064,8 @@ yesnoq(true)
```julia; hold=true; echo=false
choices =["It is increasing", "It is decreasing", "It both increases and decreases"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -1078,8 +1073,8 @@ radioq(choices, ans)
```julia; hold=true; echo=false
choices=["A critical point", "An end point"]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
* Which theorem tells you that for a *continuous* function over *closed* interval, a maximum value will exist?
@@ -1089,8 +1084,8 @@ choices = [
"The intermediate value theorem",
"The mean value theorem",
"The extreme value theorem"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
* What is the *largest* possible value of the error:
@@ -1099,8 +1094,8 @@ radioq(choices, ans)
choices = [
"``1/6!\\cdot e^1 \\cdot 1^6``",
"``1^6 \\cdot 1 \\cdot 1^6``"]
ans = 1
radioq(choices,ans)
answ = 1
radioq(choices,answ)
```
###### Question
@@ -1115,8 +1110,8 @@ L"The function $e^x$ is increasing, so takes on its largest value at the endpoin
L"The function has a critical point at $x=1/2$",
L"The function is monotonic in $k$, so achieves its maximum at $k+1$"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
Assuming the above is right, find the smallest value $k$ guaranteeing a error no more than $10^{-16}$.