@@ -9,13 +9,14 @@ quarto publish gh-pages --no-render
|
||||
```
|
||||
|
||||
|
||||
But better to
|
||||
But better to
|
||||
|
||||
```
|
||||
quarto render
|
||||
# commit changes and push
|
||||
# fix typos
|
||||
quarto render
|
||||
julia adjust_plotly.jl
|
||||
quarto publish gh-pages --no-render
|
||||
```
|
||||
|
||||
|
||||
@@ -886,7 +886,7 @@ end
|
||||
|
||||
To plot the equation $F(x,y,z)=0$, for $F$ a scalar-valued function, again the implicit function theorem says that, under conditions, near any solution $(x,y,z)$, $z$ can be represented as a function of $x$ and $y$, so the graph will look like surfaces stitched together.
|
||||
|
||||
With `Makie`, many implicitly defined surfaces can be adequately represented using `countour` with the attribute `levels=[0]`. We will illustrate this technique.
|
||||
With `Makie`, many implicitly defined surfaces can be adequately represented using `contour` with the attribute `levels=[0]`. We will illustrate this technique.
|
||||
|
||||
The `Implicit3DPlotting` package takes an approach like `ImplicitPlots` to represent these surfaces. It replaces the `Contour` package computation with a $3$-dimensional alternative provided through the `Meshing` and `GeometryBasics` packages. This package has a `plot_implicit_surface` function that does something similar to below. We don't illustrate it, as it *currently* doesn't work with the latest version of `Makie`.
|
||||
|
||||
|
||||
@@ -923,6 +923,73 @@ $$
|
||||
y(x^2 + a^2) = a^3.
|
||||
$$
|
||||
|
||||
::: {#fig-witch-agnesi}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
gr()
|
||||
let
|
||||
|
||||
function ABP(θ,a=1)
|
||||
# y/x = 2a/x = tan(θ)
|
||||
A = (2a/tan(θ), a)
|
||||
# x = y/tan(theta); x^2 + (y-a)^2 = a^2
|
||||
# y^2/t^2 + y^2 - 2ya + a^2 = a^2
|
||||
# y/t^2 + y - 2a = 0
|
||||
# y = 2a/(1 + 1/t^2)
|
||||
y = 2a/(1 + 1/tan(θ)^2) # = 2a sin(θ)^2
|
||||
x = y/tan(θ)
|
||||
B = (x, y-a)
|
||||
P = (A[1],B[2])
|
||||
(;A,B,P)
|
||||
end
|
||||
|
||||
|
||||
a = 1
|
||||
|
||||
ts = range(0, 2pi, 200)
|
||||
plot(;empty_style..., aspect_ratio=:equal)
|
||||
|
||||
plot!(a*cos.(ts), a*sin.(ts); line=(:black, 1))
|
||||
Δ = 1.5
|
||||
plot!(Δ*[-1,1],[-1,-1], line=(:gray, 1))
|
||||
plot!(Δ*[-1,1],[1,1], line=(:gray, 1))
|
||||
plot!([(0,0), (0,a)]; line=(:gray, 1, :dash))
|
||||
|
||||
witch(θ,a=1) = ABP(θ,a).P
|
||||
|
||||
θs = range(pi/4,pi/2, 100)
|
||||
plot!(witch.(θs); line=(:black, 3))
|
||||
|
||||
# fix a specific angle
|
||||
θ = pi/3
|
||||
A,B,P = ABP(θ)
|
||||
O = (0, -a)
|
||||
|
||||
plot!([O,A]; line=(:black,1))
|
||||
plot!([B,P,A]; line=(:gray,1, :dash))
|
||||
scatter!([A,B,P,(0,0)])
|
||||
|
||||
ts = (range(0, θ, 100))
|
||||
λ = a/5
|
||||
plot!([(λ*cos(t),λ*sin(t)-a) for t in ts]; line=(:gray,1, 0.75),arrow=true)
|
||||
|
||||
annotate!([(A..., text(L"A",:bottom)),
|
||||
(B..., text(L"B", :right)),
|
||||
(P..., text(L"P", :top)),
|
||||
(0,0,text(L"O", :right)),
|
||||
(0,1/2, text(L"a",:right)),
|
||||
(a/4*cos(θ/2), a/4*sin(θ/2)-a, text(L"\theta",:left))])
|
||||
end
|
||||
```
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plotly()
|
||||
nothing
|
||||
```
|
||||
|
||||
The Witch of Agnesi can be expressed implicitly or parametrically in terms of $\theta$.
|
||||
:::
|
||||
|
||||
If $a=1$, numerically find a value of $y$ when $x=2$.
|
||||
|
||||
|
||||
@@ -950,6 +1017,30 @@ answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
In @fig-witch-agnesi for a given $\theta$ the point $P = (x,y)$ where $x$ is the $x$ value of the intersection of the drawn line with the line $y=a$ and $y$ is the $y$ value of the intersection of the drawn line with the circle $x^2 + y^2 = a^2$.
|
||||
|
||||
Suppose $O=(0,0)$ and $A=(u,v)$. Which of these formulas is true:
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
choices = [
|
||||
L"(v+a)/u = 2a/u = \tan(\theta)",
|
||||
L"v/u = a/u = \tan(\theta)"
|
||||
],
|
||||
radioq(choices, 1)
|
||||
```
|
||||
|
||||
Suppose $B=(u,v)$. Which of these is true:
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
choices = [
|
||||
L"$(v+a)/u = \tan(\theta)$ and $u^2 + v^2 = a^2$",
|
||||
L"$v/u = \tan(\theta)$ and $u^2 + v^2 = a^2$"
|
||||
]
|
||||
radioq(choices, 1)
|
||||
```
|
||||
|
||||
###### Question
|
||||
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ R = solve((n1, n2), (x, y))
|
||||
```
|
||||
|
||||
|
||||
Taking limits of each term as $h$ goes to zero we have after some notation-simplfying substitution:
|
||||
Taking limits of each term as $h$ goes to zero we have after some notation-simplifying substitution:
|
||||
|
||||
```{julia}
|
||||
R = Dict(k => limit(R[k], ℎ=>0) for k in (x,y))
|
||||
|
||||
@@ -275,7 +275,7 @@ end
|
||||
p
|
||||
```
|
||||
|
||||
There is no hidden line calculuation, in place we give the contour lines a transparency through the argument `alpha=0.5`.
|
||||
There is no hidden line calculation, in place we give the contour lines a transparency through the argument `alpha=0.5`.
|
||||
|
||||
|
||||
### Gradient and surface plots
|
||||
|
||||
@@ -1828,6 +1828,43 @@ answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
|
||||
[Durer](https://mathshistory.st-andrews.ac.uk/Curves/Durers/)'s curves are parameterized by $a$ and $b$ and given by:
|
||||
|
||||
```{julia}
|
||||
durer(a=1, b=1) = (x,y) ->(x^2 + x*y + a*x - b^2)^2 - (b^2 - x^2)*(x-y+a)^2
|
||||
```
|
||||
|
||||
They can be visualized with a contour plot as follows (a plot of an implicit function)
|
||||
|
||||
```{julia}
|
||||
xs = ys = range(-5, 5, 500)
|
||||
b = 4; a = b/4
|
||||
contour(xs, ys, durer(a,b); levels=[0])
|
||||
```
|
||||
|
||||
The definition of `durer` above creates a closure. Take the values of $b=4$ and $a=b/2$. Is the point $(-2a, -a)$ on the curve?
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
b = 4
|
||||
a = b/2
|
||||
yesnoq(durer(a,b)(-2a, -a) == 0)
|
||||
```
|
||||
|
||||
What about the point $(-2a, a)$?
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
b = 4
|
||||
a = b/2
|
||||
yesnoq(durer(a,b)(-2a, a) == 0)
|
||||
```
|
||||
|
||||
(One is the cusp which is a loop if `a=b/4` and smooths out if `a=b/(3/2)`, say.
|
||||
|
||||
|
||||
###### Question
|
||||
|
||||
|
||||
|
||||
@@ -1038,8 +1038,7 @@ $$
|
||||
---
|
||||
|
||||
|
||||
Kepler's second law can also be derived from vector calculus. This derivation follows that given at [MIT OpenCourseWare](https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/1.-vectors-and-matrices/part-c-parametric-equations-for-curves/session-21-keplers-second-law/MIT18_02SC_MNotes_k.pdf) and [OpenCourseWare](https://ocw.mit.edu/courses/mathematics/18-02sc-multivariable-calculus-fall-2010/index.htm).
|
||||
|
||||
Kepler's second law can also be derived from vector calculus. This derivation follows that given at MIT OpenCourseWare (link defunct); a succinct approach is given by [Strang](https://ocw.mit.edu/courses/res-18-001-calculus-fall-2023/mitres_18_001_f17_ch12.pdf).
|
||||
|
||||
The second law states that the area being swept out during a time duration only depends on the duration of time, not the time. Let $\Delta t$ be this duration. Then if $\vec{x}(t)$ is the position vector, as above, we have the area swept out between $t$ and $t + \Delta t$ is visualized along the lines of:
|
||||
|
||||
|
||||
@@ -596,7 +596,7 @@ plot!([0, 1], [0, 0], linewidth=3)
|
||||
plot!([cos(pi/4), cos(pi/4)], [0, sin(pi/4)], linewidth=3)
|
||||
```
|
||||
|
||||
Over this wedge the height is given by the cylinder along the $y$ axis, $x^2 + z^2 = r^2$. We *could* break this wedge into a triangle and a semicircle to integrate piece by piece. However, from the figure we can integrate in the $y$ direction on the outside, and use only one intergral:
|
||||
Over this wedge the height is given by the cylinder along the $y$ axis, $x^2 + z^2 = r^2$. We *could* break this wedge into a triangle and a semicircle to integrate piece by piece. However, from the figure we can integrate in the $y$ direction on the outside, and use only one integral:
|
||||
|
||||
|
||||
```{julia}
|
||||
|
||||
@@ -302,7 +302,7 @@ The main point above is that *if* the vector field is the gradient of a scalar f
|
||||
::: {.callout-note icon=false}
|
||||
## Conservative vector field
|
||||
|
||||
If $F$ is a vector field defined in an *open* region $R$; $A$ and $B$ are points in $R$ and *if* for *any* curve $C$ in $R$ connecting $A$ to $B$, the line integral of $F \cdot \vec{T}$ over $C$ depends *only* on the endpoint $A$ and $B$ and not the path, then the line integral is called *path indenpendent* and the field is called a *conservative field*.
|
||||
If $F$ is a vector field defined in an *open* region $R$; $A$ and $B$ are points in $R$ and *if* for *any* curve $C$ in $R$ connecting $A$ to $B$, the line integral of $F \cdot \vec{T}$ over $C$ depends *only* on the endpoint $A$ and $B$ and not the path, then the line integral is called *path independent* and the field is called a *conservative field*.
|
||||
:::
|
||||
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ Some names used for the characterizing constants are:
|
||||
|
||||
|
||||
|
||||
### Three-term reccurence
|
||||
### Three-term recurrence
|
||||
|
||||
Orthogonal polynomials, as defined above through a weight function, satisfy a *three-term recurrence*:
|
||||
|
||||
|
||||
@@ -868,7 +868,7 @@ plotly()
|
||||
nothing
|
||||
```
|
||||
|
||||
Illustration of Cavalieri's first principle. The discs from the left are moved around to form the left volume, but as the volumes of each cross-sectional disc remains the same, the two valumes are equally approximated. (This figure ported from @Angenent.)
|
||||
Illustration of Cavalieri's first principle. The discs from the left are moved around to form the left volume, but as the volumes of each cross-sectional disc remains the same, the two volumes are equally approximated. (This figure ported from @Angenent.)
|
||||
|
||||
:::
|
||||
|
||||
|
||||
@@ -258,6 +258,48 @@ This is a bit fussier than need be. As the left and right pieces (say, $f_l$ and
|
||||
solve(ex1(x=>0) ~ ex2(x=>0), c)
|
||||
```
|
||||
|
||||
##### Example
|
||||
|
||||
Identifying from its graph that a function is discontinuous or not can be complicated by the graphing algorithm which simply connects adjacent points with a line segment allowing the eye to fill in the dot-to-dot graphic as a curve. The default plot of the `floor` function shows a potential issue:
|
||||
|
||||
```{julia}
|
||||
plot(floor, -5/2, 5/2; label=false)
|
||||
```
|
||||
|
||||
The "risers" on the steps are an artifact of the basic dot-to-dot algorithm, which assumes continuity between adjacent points (we were more careful in our earlier plot of this function).
|
||||
|
||||
The following simple function just plots a bunch of points, leaving the eye to fill in the line, though so many points are chosen this doesn't require much effort for simple cases. This function also plots a point on the $x$- and $y$-axes (emphasized by the argument `framestyle=:origin`) for each point graphed to emphasize the range of $y$ values for the specified $x$ values.
|
||||
|
||||
```{julia}
|
||||
function pixel_plot(f, a, b; kwargs...)
|
||||
|
||||
xs = range(a, b, 801) # lots of points
|
||||
ys = f.(xs)
|
||||
zs = zero.(xs)
|
||||
|
||||
p = plot(;framestyle=:origin, legend=false, kwargs...)
|
||||
|
||||
scatter!(p, xs, ys; marker=(:square, :black, 1)) # f(x)
|
||||
scatter!(p, xs, zs; marker=(:square, :blue, 2, 0.03)) # domain, [a,b]
|
||||
scatter!(p, zs, ys; marker=(:square, :red, 3, 0.25)) # range
|
||||
|
||||
p
|
||||
end
|
||||
|
||||
pixel_plot(floor, -5/2, 5/2)
|
||||
```
|
||||
|
||||
The broken up range suggests a fundamentally discontinuous function. In the next section we will see this differently---that a continuous function will have an unbroken range when restricted to some interval $[a,b]$.
|
||||
|
||||
For one more example, here we see the difference between `sin` and `sign`, as functions:
|
||||
|
||||
```{julia}
|
||||
p1 = pixel_plot(sin, -pi, pi; title="sin")
|
||||
p2 = pixel_plot(sign, -pi, pi; title="sign")
|
||||
plot(p1, p2)
|
||||
```
|
||||
|
||||
The continuous `sin` function has an unbroken range, $[-1,1]$; the discountinous `sign` function has a broken range consisting of ${-1, 0, 1}$.
|
||||
|
||||
## Rules for continuity
|
||||
|
||||
@@ -265,13 +307,13 @@ solve(ex1(x=>0) ~ ex2(x=>0), c)
|
||||
As we've seen, functions can be combined in several ways. How do these relate with continuity?
|
||||
|
||||
|
||||
Suppose $f(x)$ and $g(x)$ are both continuous on $I$. Then
|
||||
Suppose $f(x)$ and $g(x)$ are both continuous on $I$. Then:
|
||||
|
||||
|
||||
* The function $h(x) = a f(x) + b g(x)$ is continuous on $I$ for any real numbers $a$ and $b$;
|
||||
* The function $h(x) = f(x) \cdot g(x)$ is continuous on $I$; and
|
||||
* The function $h(x) = f(x) / g(x)$ is continuous at all points $c$ in $I$ **where** $g(c) \neq 0$.
|
||||
* The function $h(x) = f(g(x))$ is continuous at $x=c$ *if* $g(x)$ is continuous at $c$ *and* $f(x)$ is continuous at $g(c)$.
|
||||
* The linear combination $h(x) = a f(x) + b g(x)$ is continuous on $I$ for any real numbers $a$ and $b$;
|
||||
* The product $h(x) = f(x) \cdot g(x)$ is continuous on $I$; and
|
||||
* The quotient $h(x) = f(x) / g(x)$ is continuous at all points $c$ in $I$ **where** $g(c) \neq 0$.
|
||||
* The composition $h(x) = f(g(x))$ is continuous at $x=c$ *if* $g(x)$ is continuous at $c$ *and* $f(x)$ is continuous at $g(c)$.
|
||||
|
||||
|
||||
So, continuity is preserved for all of the basic operations except when dividing by $0$.
|
||||
@@ -284,7 +326,7 @@ So, continuity is preserved for all of the basic operations except when dividing
|
||||
* Since both $f(x) = e^x$ and $g(x)=\sin(x)$ are continuous everywhere, so will be $h(x) = e^x \cdot \sin(x)$.
|
||||
* Since $f(x) = e^x$ is continuous everywhere and $g(x) = -x$ is continuous everywhere, the composition $h(x) = e^{-x}$ will be continuous everywhere.
|
||||
* Since $f(x) = x$ is continuous everywhere, the function $h(x) = 1/x$ - a ratio of continuous functions - will be continuous everywhere *except* possibly at $x=0$ (where it is not continuous).
|
||||
* The function $h(x) = e^{x\log(x)}$ will be continuous on $(0,\infty)$, the same domain that $g(x) = x\log(x)$ is continuous. This function (also written as $x^x$) has a right limit at $0$ (of $1$), but is not right continuous, as $h(0)$ is not defined.
|
||||
* The function $h(x) = e^{x\ln(x)}$ will be continuous on $(0,\infty)$, the same domain that $g(x) = x\ln(x)$ is continuous. This function (which simplifies to $x^x$ when $x>0$) has a right limit at $0$ (of $1$), but is not right continuous, as $h(0)$ is not defined. (The function `h(x) = exp(x*log(x))` is not defined at `0` **but** the function `h(x) = x^x` is defined at `0.0` to be `1.0`.)
|
||||
|
||||
|
||||
## Questions
|
||||
|
||||
@@ -1919,7 +1919,7 @@ Archimedes, in finding bounds on the value of $\pi$ used $n$-gons with sides $12
|
||||
```{julia}
|
||||
#| hold: true
|
||||
x = r * tan(theta/2)
|
||||
n = 2PI/theta # using PI to avoid floaing point roundoff in 2pi
|
||||
n = 2PI/theta # using PI to avoid floating point roundoff in 2pi
|
||||
# C < n * 2x
|
||||
upper = n*2x
|
||||
```
|
||||
|
||||
@@ -254,8 +254,8 @@ p_n &= \sum_{k=0}^n \frac{1}{k!}b_{n,l}\\
|
||||
&> \sum_{k=0}^n \frac{1}{k!} \cdot \left(1 - \frac{(k-1)k}{2n}\right)\\
|
||||
&= s_n - \sum_{k=0}^n \frac{1}{k!}\frac{(k-1)k}{2n}\\
|
||||
&= s_n - \frac{1}{2n} \sum_{k=2}^n \frac{1}{(k-2)!}\\
|
||||
&= s_n - \frac{1}{2n} s_{n-2}
|
||||
$> s_n - \frac{3}{2n}
|
||||
&= s_n - \frac{1}{2n} s_{n-2}\\
|
||||
&> s_n - \frac{3}{2n}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
|
||||
@@ -1004,7 +1004,7 @@ Now consider the case $p_0 > 0$. There are two possibilities either `pos(p)` is
|
||||
So there is parity between `var(p)` and `pos(p)`: if $p$ is monic and $p_0 < 0$ then both `var(p)` and `pos(p)` are both odd; and if $p_0 > 0$ both `var(p)` and `pos(p)` are both even.
|
||||
|
||||
|
||||
Descartes' rule of signs will be established if it can be shown that `var(p)` is at least as big as `pos(p)`. Supppose $r$ is a positive real root of $p$ with $p = (x-r)q$. We show that `var(p) > var(q)` which can be repeatedly applied to show that if $p=(x-r_1)\cdot(x-r_2)\cdot \cdots \cdot (x-r_l) q$, where the $r_i$s are the positive real roots, then `var(p) >= l + var(q) >= l = pos(p)`.
|
||||
Descartes' rule of signs will be established if it can be shown that `var(p)` is at least as big as `pos(p)`. Suppose $r$ is a positive real root of $p$ with $p = (x-r)q$. We show that `var(p) > var(q)` which can be repeatedly applied to show that if $p=(x-r_1)\cdot(x-r_2)\cdot \cdots \cdot (x-r_l) q$, where the $r_i$s are the positive real roots, then `var(p) >= l + var(q) >= l = pos(p)`.
|
||||
|
||||
|
||||
As $p = (x-c)q$ we must have the leading term is $p_nx^n = x \cdot q_{n-1} x^{n-1}$ so $q_{n-1}$ will also be `+` under our monic assumption. Looking at a possible pattern for the signs of $q$, we might see the following unfinished synthetic division table for a specific $q$:
|
||||
|
||||
Reference in New Issue
Block a user