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

@@ -86,12 +86,10 @@ continuity and *left* continuity at a point, where the limit in the
defintion is replaced by a right or left limit, as appropriate.
```julia; echo=false
alert("""
The limit in the definition of continuity is the basic limit and not an extended sense where
infinities are accounted for.
""")
```
!!! warning
The limit in the definition of continuity is the basic limit and not an extended sense where
infinities are accounted for.
##### Examples of continuity
Most familiar functions are continuous everywhere.
@@ -256,8 +254,8 @@ f+g,~ f-g,~ f\cdot g,~ f\circ g,~ f/g
```julia; hold=true; echo=false
choices = ["``f+g``", "``f-g``", "``f\\cdot g``", "``f\\circ g``", "``f/g``"]
ans = length(choices)
radioq(choices, ans)
answ = length(choices)
radioq(choices, answ)
```
###### Question
@@ -268,16 +266,16 @@ When will $f\circ g$ be continuous?
```julia; hold=true; echo=false
choices = [L"For all $x$", L"For all $x > 0$", L"For all $x$ where $\sin(x) > 0$"]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
When will $g \circ f$ be continuous?
```julia; hold=true; echo=false
choices = [L"For all $x$", L"For all $x > 0$", L"For all $x$ where $\sin(x) > 0$"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -290,8 +288,8 @@ L"The function $g$ is continuous everywhere",
L"The function $f$ is continuous everywhere",
L"The function $g$ is continuous everywhere and $f$ is continuous on the range of $g$",
L"The function $f$ is continuous everywhere and $g$ is continuous on the range of $f$"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -304,8 +302,8 @@ L"When $x > 2$",
L"When $x \geq 2$",
L"When $x \leq 2$",
L"For $x \geq 0$"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -375,8 +373,8 @@ Suppose $f(x)$, $g(x)$, and $h(x)$ are continuous functions on $(a,b)$. If $a <
choices = [L"No, as $g(c)$ may not be in the interval $(a,b)$",
"Yes, composition of continuous functions results in a continuous function, so the limit is just the function value."
]
ans=1
radioq(choices, ans)
answ=1
radioq(choices, answ)
```
###### Question
@@ -446,6 +444,6 @@ choices = ["Can't tell",
"``-1.0``",
"``0.0``"
]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```

View File

@@ -7,8 +7,6 @@ using CalculusWithJulia
using Plots
using Roots
using SymPy
import IntervalArithmetic
import IntervalRootFinding
```
```julia; echo=false; results="hidden"
@@ -20,7 +18,7 @@ const frontmatter = (
tags = ["CalculusWithJulia", "limits", "implications of continuity"],
);
const fig_size=(400, 400)
fig_size=(800, 600)
nothing
```
@@ -237,20 +235,16 @@ sin(c)
### The `find_zero` function.
The `Roots` package has a function `find_zero` that implements the
bisection method when called as `find_zero(f, a..b)` where $[a,b]$
bisection method when called as `find_zero(f, (a,b))` where $[a,b]$
is a bracket. Its use is similar to `simple_bisection` above. This package is loaded when `CalculusWithJulia` is. We illlustrate the usage of `find_zero`
in the following:
```julia;
xstar = find_zero(sin, 3..4)
```
```julia; echo=false
alert("""
Notice, the call `find_zero(sin, 3..4)` again fits the template `action(function, args...)` that we see repeatedly. The `find_zero` function can also be called through `fzero`. The use of `3..4` to specify the interval is not necessary. For example `(3,4)` or `[3,4]` would work equally as well. The `..` is an idiom in `Julia` for intervals, so used here, but is not part of the base language. It is imported from `EllipsisNotation` by the `CalculusWithJulia` package.
""")
xstar = find_zero(sin, (3, 4))
```
!!! warning
Notice, the call `find_zero(sin, (3, 4))` again fits the template `action(function, args...)` that we see repeatedly. The `find_zero` function can also be called through `fzero`. The use of `(3, 4)` to specify the interval is not necessary. For example `[3,4]` would work equally as well. (Anything where `extrema` is defined works.)
This function utilizes some facts about floating point values to
guarantee that the answer will be an *exact* zero or a value where there is a sign change between the next bigger floating point or the next smaller, which means the sign at the next and previous floating point values is different:
@@ -265,7 +259,7 @@ The polynomial $p(x) = x^5 - x + 1$ has a zero between $-2$ and $-1$. Find it.
```julia;
p(x) = x^5 - x + 1
c₀ = find_zero(p, -2 .. -1) # avoiding ..-1 which errors
c₀ = find_zero(p, (-2, -1))
(c₀, p(c₀))
```
@@ -289,7 +283,7 @@ plot(q, 5, 10)
Find the zero numerically. The plot shows $q(5) < 0 < q(10)$, so $[5,10]$ is a bracket. We thus have:
```julia;
find_zero(q, 5..10)
find_zero(q, (5, 10))
```
@@ -310,7 +304,7 @@ plot(x^3 - x + 1, -3, 3)
It appears (and a plot over $[0,1]$ verifies) that there is one zero between $-2$ and $-1$. It is found with:
```julia;
find_zero(x^3 - x + 1, -2 .. -1)
find_zero(x^3 - x + 1, (-2, -1))
```
@@ -333,7 +327,7 @@ We see from the graph that it is clearly between $0$ and $2$, so all we need is
```julia;
𝒉(x) = 𝒇(x) - 𝒈(x)
find_zero(𝒉, 0..2)
find_zero(𝒉, (0, 2))
```
#### Using parameterized functions (`f(x,p)`) with `find_zero`
@@ -342,7 +336,7 @@ Geometry will tell us that ``\cos(x) = x/p`` for *one* ``x`` in ``[0, \pi/2]`` w
```julia; hold=true;
f(x, p=1) = cos(x) - x/p
I = 0..pi/2
I = (0, pi/2)
find_zero(f, I), find_zero(f, I, p=2)
```
@@ -385,7 +379,7 @@ cheaper.
Let's get a numeric value, using a simple bracket and an anonymous function:
```julia;
find_zero(x -> plan1(x) - plan2(x), 10..20)
find_zero(x -> plan1(x) - plan2(x), (10, 20))
```
##### Example, the flight of an arrow
@@ -480,7 +474,7 @@ d(b)
From the graph, we can see the zero is around `b`. As `y(b)` is `-Inf` we can use the bracket `(b/2,b)`
```julia;
x1 = find_zero(d, (b/2)..b)
x1 = find_zero(d, (b/2, b))
```
The answer is approximately $140.7$
@@ -527,7 +521,7 @@ does the algorithm yield:
```julia;
fᵢ(x) = 1/x
x0 = find_zero(fᵢ, -1..1)
x0 = find_zero(fᵢ, (-1, 1))
```
@@ -559,31 +553,25 @@ interval.
Still, with some engineering, this can be a useful approach, save the
caveats. This idea is implemented in the `find_zeros` function of the `Roots` package. The function is
called via `find_zeros(f, a..b)` but here the interval
called via `find_zeros(f, (a, b))` but here the interval
$[a,b]$ is not necessarily a bracketing interval.
To see, we have:
```julia; hold=true;
f(x) = cos(10*pi*x)
find_zeros(f, 0..1)
find_zeros(f, (0, 1))
```
Or for a polynomial:
```julia; hold=true;
f(x) = x^5 - x^4 + x^3 - x^2 + 1
find_zeros(f, -10..10)
find_zeros(f, (-10, 10))
```
(Here $-10$ and $10$ were arbitrarily chosen. Cauchy's method could be used to be more systematic.)
```julia; echo=false
note("""
At the end of this section are details on how to use the `IntervalRootFinding` package to identify all zeros in a specified interval. This package offers a more robust algorithm for this task.
""")
```
##### Example: Solving f(x) = g(x)
Use `find_zeros` to find when $e^x = x^5$ in the interval $[-20, 20]$. Verify the answers.
@@ -593,7 +581,7 @@ The zeros are then found with:
```julia;
f₁(x) = exp(x) - x^5
zs = find_zeros(f₁, -20..20)
zs = find_zeros(f₁, (-20,20))
```
@@ -760,7 +748,7 @@ $f(x) = e^x - x^4$. Find its value numerically:
```julia; hold=true; echo=false
f(x) = exp(x) - x^4
val = find_zero(f, -10..0);
val = find_zero(f, (-10, 0));
numericq(val, 1e-3)
```
@@ -772,7 +760,7 @@ $f(x) = e^x - x^4$. Find its value numerically:
```julia; hold=true; echo=false
f(x) = exp(x) - x^4
val = find_zero(f, 0..5);
val = find_zero(f, (0, 5));
numericq(val, 1e-3)
```
@@ -786,7 +774,7 @@ zeros on the positive $x$ axis. You are asked to find the largest
```julia; hold=true; echo=false
b = 10
f(x) = x^2 - b * x * log(x)
val = find_zero(f, 10..500)
val = find_zero(f, (10, 500))
numericq(val, 1e-3)
```
@@ -805,7 +793,7 @@ plot(airyai, -10, 10) # `airyai` loaded in `SpecialFunctions` by `CalculusWith
The second largest root is:
```julia; hold=true; echo=false
val = find_zero(airyai, -5 .. -4);
val = find_zero(airyai, (-5, -4));
numericq(val, 1e-8)
```
@@ -816,7 +804,7 @@ numericq(val, 1e-8)
Certainly $x^3$ equals $3^x$ at $x=3$. Find the largest value for which $x^3 = 3x$.
```julia; hold=true; echo=false
val = maximum(find_zeros(x -> x^3 - 3^x, 0..20))
val = maximum(find_zeros(x -> x^3 - 3^x, (0, 20)))
numericq(val)
```
@@ -824,8 +812,8 @@ Compare $x^2$ and $2^x$. They meet at $2$, where do the meet again?
```julia; hold=true; echo=false
choices = ["Only before 2", "Only after 2", "Before and after 2"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
Just by graphing, find a number in $b$ with $2 < b < 3$ where for
@@ -837,8 +825,8 @@ choices=[
"``b \\approx 2.5``",
"``b \\approx 2.7``",
"``b \\approx 2.9``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -882,8 +870,8 @@ Let $v_0= 390$. The three times in question can be found from the zeros of `f` a
choices = ["``(0.0, 12.1875, 24.375)``",
"``(-4.9731, 0.0, 4.9731)``",
"``(0.0, 625.0, 1250.0)``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -915,13 +903,13 @@ ground.
```julia; hold=true; echo=false
t0 = 0.0
tf = find_zero(h, 10..20)
ta = find_zero(D(h), t0..tf)
tf = find_zero(h, (10, 20))
ta = find_zero(D(h), (t0, tf))
choices = ["``(0, 13.187, 30.0)``",
"``(0, 32.0, 390.0)``",
"``(0, 2.579, 13.187)``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question
@@ -932,7 +920,7 @@ Part of the proof of the intermediate value theorem rests on knowing what the li
choices = [L"It must be that $L > y$ as each $f(x)$ is.",
L"It must be that $L \geq y$",
L"It can happen that $L < y$, $L=y$, or $L>y$"]
ans = 2
answ = 2
radioq(choices, 2, keep_order=true)
```
@@ -949,8 +937,8 @@ choices = [
"``f(x) = \\sin(x),~ I=(-\\pi, \\pi)``",
"``f(x) = \\sin(x),~ I=(-\\pi/2, \\pi/2)``",
"None of the above"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
@@ -966,8 +954,8 @@ choices = [
"``f(x) = 1/x,~ I=[-2, -1]``",
"``f(x) = 1/x,~ I=[-1, 1]``",
"none of the above"]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
@@ -984,8 +972,8 @@ choices = [
"``f(x) = 1/x,~ I=[-4, -1]``",
"``f(x) = \\text{floor}(x),~ I=[-1/2, 1/2]``",
"none of the above"]
ans = 4
radioq(choices, ans, keep_order=true)
answ = 4
radioq(choices, answ, keep_order=true)
```
@@ -1024,8 +1012,8 @@ L"There is no value $c$ for which $f(c)$ is an absolute maximum over $I$.",
L"There is just one value of $c$ for which $f(c)$ is an absolute maximum over $I$.",
L"There are many values of $c$ for which $f(c)$ is an absolute maximum over $I$."
]
ans = 3
radioq(choices, ans, keep_order=true)
answ = 3
radioq(choices, answ, keep_order=true)
```
@@ -1039,8 +1027,8 @@ L"There is no value $M$ for which $M=f(c)$, $c$ in $I$ for which $M$ is an absol
L"There is just one value $M$ for which $M=f(c)$, $c$ in $I$ for which $M$ is an absolute maximum over $I$.",
L"There are many values $M$ for which $M=f(c)$, $c$ in $I$ for which $M$ is an absolute maximum over $I$."
]
ans = 2
radioq(choices, ans, keep_order=true)
answ = 2
radioq(choices, answ, keep_order=true)
```
@@ -1056,8 +1044,8 @@ choices = [
"``f(x) = \\sin(x),\\quad I=[-\\pi/2, \\pi/2]``",
"``f(x) = \\sin(x),\\quad I=[0, 2\\pi]``",
"``f(x) = \\sin(x),\\quad I=[-2\\pi, 2\\pi]``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
##### Question
@@ -1065,7 +1053,7 @@ radioq(choices, ans)
The zeros of the equation $\cos(x) \cdot \cosh(x) = 1$ are related to vibrations of rods. Using `find_zeros`, what is the largest zero in the interval $[0, 6\pi]$?
```julia; hold=true; echo=false
val = maximum(find_zeros(x -> cos(x) * cosh(x) - 1, 0..6pi))
val = maximum(find_zeros(x -> cos(x) * cosh(x) - 1, (0, 6pi)))
numericq(val)
```
@@ -1086,98 +1074,3 @@ a,b = 1, 2
k_x, k_y = 3, 4
plot(t -> a * cos(k_x *t), t-> b * sin(k_y * t), 0, 4pi)
```
----
## Using `IntervalRootFinding` to identify zeros
The `IntervalRootFinding` package provides a more *rigorous* alternative to `find_zeros`. This packages leverages the interval arithmetic features of `IntervalArithmetic`.
The `IntervalRootFinding` package provides a function `roots`, with usage similar to `find_zeros`. Intervals are specified with the notation `a..b`. In the following, we *qualify* `roots` to not conflict with the `roots` function from `SymPy`, which has already been loaded:
```julia
u(x) = sin(x) - 0.1*x^2 + 1
𝑱 = IntervalArithmetic.Interval(-10, 10) # cumbersome -10..10; needed here: .. means something in CalculusWithJulia
rts = IntervalRootFinding.roots(u, 𝑱)
```
The "zeros" are returned with an enclosing interval and a flag, which for the above indicates a unique zero in the interval.
The intervals with a unique answer can be filtered and refined with a construct like the following:
```julia
[find_zero(u, (IntervalArithmetic.interval(I).lo, IntervalArithmetic.interval(I).hi)) for I in rts if I.status == :unique]
```
The midpoint of the returned interval can be found by composing the `mid` function with the `interval` function of the package:
```julia
[(IntervalArithmetic.mid ∘ IntervalArithmetic.interval)(I) for I in rts if I.status == :unique]
```
For some problems, `find_zeros` is more direct, as with this one:
```julia
find_zeros(u, -10..10)
```
Which can be useful if there is some prior understanding of the zeros expected to be found.
However, `IntervalRootFinding` is more efficient computationally and *offers a guarantee* on the values found.
For functions where roots are not "unique" a different output may appear:
```julia; hold=true;
f(x) = x*(x-1)^2
rts = IntervalRootFinding.roots(f, 𝑱)
```
The interval labeled `:unknown` contains a `0`, but it can't be proved by `roots`.
Interval arithmetic finds **rigorous** **bounds** on the range of `f` values over a closed interval `a..b` (the range is `f(a..b)`). "Rigorous" means the bounds are truthful and account for possible floating point issues. "Bounds" means the answer lies within, but the bound need not be the answer.
This allows one -- for some functions -- to answer affirmatively questions like:
* Is the function *always* positive on `a..b`? Negative? This can be done by checking if `0` is in the bound given by `f(a..b)`. If it isn't then one of the two characterizations is true.
* Is the function *strictly increasing* on `a..b`? Strictly decreasing? These questions can be answered using the (upcoming) [derivative](../derivatives/derivatives.html). If the derivative is positive on `a..b` then `f` is strictly increasing, if negative on `a..b` then `f` is strictly decreasing. Finding the derivative can be done within the `IntervalArithmetic` framework using [automatic differentiation](../derivatives/numeric_derivatives.html), a blackbox operation denoted `f'` below.
Combined, for some functions and some intervals these two questions can be answered affirmatively:
* the interval does not contain a zero (`0 !in f(a..b)`)
* over the interval, the function crosses the `x` axis *once* (`f(a..a)` and `f(b..b)` are one positive and one negative *and* `f` is strictly monotone, or `0 !in f'(a..b)`)
This allows the following (simplified) bisection-like algorithm to be used:
* consider an interval `a..b`
* if the function is *always* positive or negative, it can be discarded as no zero can be in the interval
* if the function crosses the `x` axis *once* over this interval **then** there is a "unique" zero in the interval and the interval can be marked so and set aside
* if neither of the above *and* `a..b` is not too small already, then *sub-divide* the interval and repeat the above with *both* smaller intervals
* if `a..b` is too small, stop and mark it as "unknown"
When terminated there will be intervals with unique zeros flagged and smaller intervals with an unknown status.
Compared to the *bisection* algorithm -- which only knows for some intervals if that interval has one or more crossings -- this algorithm gives a more rigorous means to get all the zeros in `a..b`.
For a last example of the value of this package, this function, which appeared in our discussion on limits, is *positive* for **every** floating point number, but has two zeros snuck in at values within the floating point neighbors of $15/11$
```julia
t(x) = x^2 + 1 +log(abs( 11*x-15 ))/99
```
The `find_zeros` function will fail on identifying any potential zeros of this function. Even the basic call of `roots` will fail, due to it relying on some smoothness of `f`. However, explicitly asking for `Bisection` shows the *potential* for one or more zeros near $15/11$:
```julia
IntervalRootFinding.roots(t, 𝑱, IntervalRootFinding.Bisection)
```
(The basic algorithm above can be sped up using a variant of [Newton's](../derivatives/newton_method.html) method, this variant assumes some "smoothness" in the function `f`, whereas this `f` is not continuous at the point ``x=15/11``.)

View File

@@ -17,7 +17,7 @@ const frontmatter = (
description = "Calculus with Julia: Limits",
tags = ["CalculusWithJulia", "limits", "limits"],
);
const fig_size=(400, 300)
fig_size=(800, 600)
nothing
```
@@ -287,8 +287,9 @@ This progression can be seen to be increasing. Cauchy, in his treatise, can see
```math
\begin{align*}
(1 + \frac{1}{m})^n &= 1 + \frac{1}{1} + \frac{1}{1\cdot 2}(1 = \frac{1}{m}) + \\
& \frac{1}{1\cdot 2\cdot 3}(1 - \frac{1}{m})(1 - \frac{2}{m}) + \cdots +
& \frac{1}{1 \cdot 2 \cdot \cdots \cdot m}(1 - \frac{1}{m}) \cdot \cdots \cdot (1 - \frac{m-1}{m}).
& \frac{1}{1\cdot 2\cdot 3}(1 - \frac{1}{m})(1 - \frac{2}{m}) + \cdots \\
&+
\frac{1}{1 \cdot 2 \cdot \cdots \cdot m}(1 - \frac{1}{m}) \cdot \cdots \cdot (1 - \frac{m-1}{m}).
\end{align*}
```
@@ -1088,8 +1089,8 @@ plot(f, 0,2)
```julia; hold=true; echo=false
ans = 1/4
numericq(ans, 1e-1)
answ = 1/4
numericq(answ, 1e-1)
```
@@ -1158,36 +1159,38 @@ numericq(val, 1e-2)
Select the graph for which there is no limit at ``a``.
```julia; hold=true; echo=false
p1 = plot(;axis=nothing, legend=false)
title!(p1, "(a)")
plot!(p1, x -> x^2, 0, 2, color=:black)
plot!(p1, zero, linestyle=:dash)
annotate!(p1,[(1,0,"a")])
let
p1 = plot(;axis=nothing, legend=false)
title!(p1, "(a)")
plot!(p1, x -> x^2, 0, 2, color=:black)
plot!(p1, zero, linestyle=:dash)
annotate!(p1,[(1,0,"a")])
p2 = plot(;axis=nothing, legend=false)
title!(p2, "(b)")
plot!(p2, x -> 1/(1-x), 0, .95, color=:black)
plot!(p2, x-> -1/(1-x), 1.05, 2, color=:black)
plot!(p2, zero, linestyle=:dash)
annotate!(p2,[(1,0,"a")])
p2 = plot(;axis=nothing, legend=false)
title!(p2, "(b)")
plot!(p2, x -> 1/(1-x), 0, .95, color=:black)
plot!(p2, x-> -1/(1-x), 1.05, 2, color=:black)
plot!(p2, zero, linestyle=:dash)
annotate!(p2,[(1,0,"a")])
p3 = plot(;axis=nothing, legend=false)
title!(p3, "(c)")
plot!(p3, sinpi, 0, 2, color=:black)
plot!(p3, zero, linestyle=:dash)
annotate!(p3,[(1,0,"a")])
p3 = plot(;axis=nothing, legend=false)
title!(p3, "(c)")
plot!(p3, sinpi, 0, 2, color=:black)
plot!(p3, zero, linestyle=:dash)
annotate!(p3,[(1,0,"a")])
p4 = plot(;axis=nothing, legend=false)
title!(p4, "(d)")
plot!(p4, x -> x^x, 0, 2, color=:black)
plot!(p4, zero, linestyle=:dash)
annotate!(p4,[(1,0,"a")])
p4 = plot(;axis=nothing, legend=false)
title!(p4, "(d)")
plot!(p4, x -> x^x, 0, 2, color=:black)
plot!(p4, zero, linestyle=:dash)
annotate!(p4,[(1,0,"a")])
l = @layout[a b; c d]
p = plot(p1, p2, p3, p4, layout=l)
imgfile = tempname() * ".png"
savefig(p, imgfile)
hotspotq(imgfile, (1/2,1), (1/2,1))
l = @layout[a b; c d]
p = plot(p1, p2, p3, p4, layout=l)
imgfile = tempname() * ".png"
savefig(p, imgfile)
hotspotq(imgfile, (1/2,1), (1/2,1))
end
```
###### Question
@@ -1209,8 +1212,8 @@ What is $L$?
```julia; hold=true; echo=false
choices = ["``0``", "``1``", "``e^x``"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -1237,8 +1240,8 @@ Using the last result, what is the value of $L$?
```julia; hold=true; echo=false
choices = ["``\\cos(x)``", "``\\sin(x)``", "``1``", "``0``", "``\\sin(h)/h``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -1309,8 +1312,8 @@ the fact that $x$ is measured in radians. Try to find this limit:
```julia; hold=true; echo=false
choices = [q"0", q"1", q"pi/180", q"180/pi"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -1318,8 +1321,8 @@ What is the limit `limit(sinpi(x)/x, x => 0)`?
```julia; hold=true; echo=false
choices = [q"0", q"1", q"pi", q"1/pi"]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
###### Question: limit properties
@@ -1388,8 +1391,8 @@ choices = [
"Yes, the value is `-11.5123`",
"No, the value heads to negative infinity"
];
ans = 3;
radioq(choices, ans)
answ = 3;
radioq(choices, answ)
```
###### Question
@@ -1433,8 +1436,8 @@ What is `limit(ex, x => 0)`?
```julia; hold=true; echo=false
choices = ["``e^{km}``", "``e^{k/m}``", "``k/m``", "``m/k``", "``0``"]
answer = 1
radioq(choices, answer)
answwer = 1
radioq(choices, answwer)
```
###### Question
@@ -1511,8 +1514,8 @@ between both $g$ and $h$, so must to have a limit of $0$.
""",
L"The functions $g$ and $h$ squeeze each other as $g(x) > h(x)$",
L"The function $f$ has no limit - it oscillates too much near $0$"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
(The [Wikipedia](https://en.wikipedia.org/wiki/Squeeze_theorem) entry for the squeeze theorem has this unverified, but colorful detail:

View File

@@ -149,11 +149,9 @@ limit(f(x), x=>0, dir="+"), limit(f(x), x=>0, dir="-")
```
```julia; echo=false
alert("""
That means the mathematical limit need not exist when `SymPy`'s `limit` returns an answer, as `SymPy` is only carrying out a one sided limit. Explicitly passing `dir="+-"` or checking that both `limit(ex, x=>c)` and `limit(ex, x=>c, dir="-")` are equal would be needed to confirm a limit exists mathematically.
""")
```
!!! warning
That means the mathematical limit need not exist when `SymPy`'s `limit` returns an answer, as `SymPy` is only carrying out a one sided limit. Explicitly passing `dir="+-"` or checking that both `limit(ex, x=>c)` and `limit(ex, x=>c, dir="-")` are equal would be needed to confirm a limit exists mathematically.
The relation between the two concepts is that a function has a limit at $c$ if
an only if the left and right limits exist and are equal. This
@@ -623,7 +621,6 @@ The last equality follows, as the function ``x`` dominates the function ``\ln(x)
## Questions
###### Question
Select the graph for which the limit at ``a`` is infinite.
@@ -761,8 +758,8 @@ Find $\lim_{x \rightarrow 2+} (x-3)/(x-2)$.
```julia; hold=true; echo=false
choices=["``L=-\\infty``", "``L=-1``", "``L=0``", "``L=\\infty``"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
Find $\lim_{x \rightarrow -3-} (x-3)/(x+3)$.
@@ -771,8 +768,8 @@ Find $\lim_{x \rightarrow -3-} (x-3)/(x+3)$.
```julia; hold=true; echo=false
choices=["``L=-\\infty``", "``L=-1``", "``L=0``", "``L=\\infty``"]
ans = 4
radioq(choices, ans)
answ = 4
radioq(choices, answ)
```
###### Question
@@ -861,8 +858,8 @@ choices=["The limit does exist - it is any number from -1 to 1",
"Err, the limit does exists and is 1",
"The function oscillates too much and its y values do not get close to any one value",
"Any function that oscillates does not have a limit."]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```
@@ -883,8 +880,8 @@ Consider different values of $k$ to see if this limit depends on $k$ or not. Wha
```julia; hold=true; echo=false
choices = ["``1``", "``k``", "``\\log(k)``", "The limit does not exist"]
ans = 1
radioq(choices, ans)
answ = 1
radioq(choices, answ)
```
@@ -908,8 +905,8 @@ Consider different values of $k$ to see if the limit depends on $k$ or not. What
```julia; hold=true; echo=false
choices = ["``1``", "``k``", "``\\log(k)``", "The limit does not exist"]
ans = 2
radioq(choices, ans)
answ = 2
radioq(choices, answ)
```
###### Question
@@ -929,8 +926,8 @@ choices=[
"the first, second and third ones",
"the first, second, third, and fourth ones",
"all of them"]
ans = 5
radioq(choices, ans, keep_order=true)
answ = 5
radioq(choices, answ, keep_order=true)
```
@@ -947,8 +944,8 @@ L"We can talk about the limit at $\infty$ of $f(x) - mx$ being $b$",
L"We can say $f(x) - (mx+b)$ has a horizontal asymptote $y=0$",
L"We can say $f(x) - mx$ has a horizontal asymptote $y=b$",
"Any of the above"]
ans = 5
radioq(choices, ans, keep_order=true)
answ = 5
radioq(choices, answ, keep_order=true)
```
###### Question
@@ -976,6 +973,6 @@ choices = [L" $f(x)$ has a limit of $1$ as $x \rightarrow 0$",
L" $f(x)$ has a limit of $-1$ as $x \rightarrow 0$",
L" $f(x)$ does not have a limit as $x \rightarrow 0$"
]
ans = 3
radioq(choices, ans)
answ = 3
radioq(choices, answ)
```