make pdf file generation work
This commit is contained in:
@@ -72,13 +72,11 @@ $$
|
||||
The author's apply this model to flu statistics from Hong Kong where:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
S(0) &= 7,900,000\\
|
||||
I(0) &= 10\\
|
||||
R(0) &= 0\\
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
In `Julia` we define these, `N` to model the total population, and `u0` to be the proportions.
|
||||
|
||||
@@ -133,13 +131,11 @@ The plot shows steady decay, as there is no mixing of infected with others.
|
||||
Adding in the interaction requires a bit more work. We now have what is known as a *system* of equations:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\frac{ds}{dt} &= -b \cdot s(t) \cdot i(t)\\
|
||||
\frac{di}{dt} &= b \cdot s(t) \cdot i(t) - k \cdot i(t)\\
|
||||
\frac{dr}{dt} &= k \cdot i(t)\\
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
Systems of equations can be solved in a similar manner as a single ordinary differential equation, though adjustments are made to accommodate the multiple functions.
|
||||
|
||||
@@ -282,12 +278,10 @@ We now solve numerically the problem of a trajectory with a drag force from air
|
||||
The general model is:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
x''(t) &= - W(t,x(t), x'(t), y(t), y'(t)) \cdot x'(t)\\
|
||||
y''(t) &= -g - W(t,x(t), x'(t), y(t), y'(t)) \cdot y'(t)\\
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
with initial conditions: $x(0) = y(0) = 0$ and $x'(0) = v_0 \cos(\theta), y'(0) = v_0 \sin(\theta)$.
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ That is, if we stitched together pieces of the slope field, would we get a curve
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
#| cache: true
|
||||
## {{{euler_graph}}}
|
||||
function make_euler_graph(n)
|
||||
x, y = symbols("x, y")
|
||||
@@ -241,17 +240,7 @@ It is more work for the computer, but not for us, and clearly a much better appr
|
||||
|
||||
## The Euler method
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
imgfile ="figures/euler.png"
|
||||
caption = """
|
||||
Figure from first publication of Euler's method. From [Gander and Wanner](http://www.unige.ch/~gander/Preprints/Ritz.pdf).
|
||||
"""
|
||||
|
||||
ImageFile(:ODEs, imgfile, caption)
|
||||
```
|
||||
.](./figures/euler.png)
|
||||
|
||||
The name of our function reflects the [mathematician](https://en.wikipedia.org/wiki/Leonhard_Euler) associated with the iteration:
|
||||
|
||||
@@ -361,9 +350,13 @@ caption = """
|
||||
A child's bead game. What shape wire will produce the shortest time for a bed to slide from a top to the bottom?
|
||||
|
||||
"""
|
||||
ImageFile(:ODEs, imgfile, caption)
|
||||
#ImageFile(:ODEs, imgfile, caption)
|
||||
nothing
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
Restrict our attention to the $x$-$y$ plane, and consider a path, between the point $(0,A)$ and $(B,0)$. Let $y(x)$ be the distance from $A$, so $y(0)=0$ and at the end $y$ will be $A$.
|
||||
|
||||
|
||||
@@ -378,16 +371,22 @@ caption = """
|
||||
As early as 1638, Galileo showed that an object falling along `AC` and then `CB` will fall faster than one traveling along `AB`, where `C` is on the arc of a circle.
|
||||
From the [History of Math Archive](http://www-history.mcs.st-and.ac.uk/HistTopics/Brachistochrone.html).
|
||||
"""
|
||||
ImageFile(:ODEs, imgfile, caption)
|
||||
#ImageFile(:ODEs, imgfile, caption)
|
||||
nothing
|
||||
```
|
||||
|
||||
.
|
||||
](./figures/galileo.png)
|
||||
|
||||
This simulation also suggests that a curved path is better than the shorter straight one:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
#| cache: true
|
||||
##{{{brach_graph}}}
|
||||
|
||||
function brach(f, x0, vx0, y0, vy0, dt, n)
|
||||
@@ -603,13 +602,11 @@ $$
|
||||
We can try the Euler method here. A simple approach might be this iteration scheme:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
x_{n+1} &= x_n + h,\\
|
||||
u_{n+1} &= u_n + h v_n,\\
|
||||
v_{n+1} &= v_n - h \cdot g/l \cdot \sin(u_n).
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
Here we need *two* initial conditions: one for the initial value $u(t_0)$ and the initial value of $u'(t_0)$. We have seen if we start at an angle $a$ and release the bob from rest, so $u'(0)=0$ we get a sinusoidal answer to the linearized model. What happens here? We let $a=1$, $L=5$ and $g=9.8$:
|
||||
|
||||
|
||||
BIN
quarto/ODEs/figures/galileo.png
Normal file
BIN
quarto/ODEs/figures/galileo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
@@ -87,13 +87,11 @@ $$
|
||||
Again, we can integrate to get an answer for any value $t$:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
x(t) - x(t_0) &= \int_{t_0}^t \frac{dv}{dt} dt \\
|
||||
&= (v_0t + \frac{1}{2}a t^2 - at_0 t) |_{t_0}^t \\
|
||||
&= (v_0 - at_0)(t - t_0) + \frac{1}{2} a (t^2 - t_0^2).
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
There are three constants: the initial value for the independent variable, $t_0$, and the two initial values for the velocity and position, $v_0, x_0$. Assuming $t_0 = 0$, we can simplify the above to get a formula familiar from introductory physics:
|
||||
|
||||
@@ -339,12 +337,10 @@ Differential equations are classified according to their type. Different types h
|
||||
The first-order initial value equations we have seen can be described generally by
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
y'(x) &= F(y,x),\\
|
||||
y(x_0) &= x_0.
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
Special cases include:
|
||||
|
||||
@@ -615,9 +611,11 @@ imgfile = "figures/verrazano-narrows-bridge-anniversary-historic-photos-2.jpeg"
|
||||
caption = """
|
||||
The cables of an unloaded suspension bridge have a different shape than a loaded suspension bridge. As seen, the cables in this [figure](https://www.brownstoner.com/brooklyn-life/verrazano-narrows-bridge-anniversary-historic-photos/) would be modeled by a catenary.
|
||||
"""
|
||||
ImageFile(:ODEs, imgfile, caption)
|
||||
# ImageFile(:ODEs, imgfile, caption)
|
||||
nothing
|
||||
```
|
||||
|
||||
 would be modeled by a catenary.](./figures/verrazano-narrows-bridge-anniversary-historic-photos-2.jpeg)
|
||||
---
|
||||
|
||||
|
||||
@@ -668,13 +666,11 @@ Though `y` is messy, it can be seen that the answer is a quadratic polynomial in
|
||||
In a resistive medium, there are drag forces at play. If this force is proportional to the velocity, say, with proportion $\gamma$, then the equations become:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
x''(t) &= -\gamma x'(t), & \quad y''(t) &= -\gamma y'(t) -g, \\
|
||||
x(0) &= x_0, &\quad y(0) &= y_0,\\
|
||||
x'(0) &= v_0\cos(\alpha),&\quad y'(0) &= v_0 \sin(\alpha).
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
We now attempt to solve these.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user