Merge pull request #56 from fangliu-tju/patch-2

Update variables.qmd
This commit is contained in:
john verzani 2023-03-29 11:25:35 -04:00 committed by GitHub
commit 78d93e8d7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,7 @@ The `Pluto` interface for `Julia` is idiosyncratic, as variables are *reactive*.
::: :::
`Julia` is referred to as a "dynamic language" which means (in most cases) that a variable can be reassigned with a value of a different type, as we did with `x` where first it was assigned to a floating point value then to an integer value. (Though we meet some cases - generic functions - where `Julia` balks at reassigning a variable if the type if different.) `Julia` is referred to as a "dynamic language" which means (in most cases) that a variable can be reassigned with a value of a different type, as we did with `x` where first it was assigned to a floating point value then to an integer value. (Though we meet some cases - generic functions - where `Julia` balks at reassigning a variable if the type is different.)
More importantly than displaying a value, is the use of variables to build up more complicated expressions. For example, to compute More importantly than displaying a value, is the use of variables to build up more complicated expressions. For example, to compute
@ -115,7 +115,7 @@ By defining a new variable `a` to represent a value that is repeated a few times
A [grass swale](https://stormwater.pca.state.mn.us/index.php?title=Design_criteria_for_dry_swale_(grass_swale)) is a design to manage surface water flow resulting from a storm. Swales detain, filter, and infiltrate runoff limiting erosion in the process. A [grass swale](https://stormwater.pca.state.mn.us/index.php?title=Design_criteria_for_dry_swale_(grass_swale)) is a design to manage surface water flow resulting from a storm. Swales detain, filter, and infiltrate runoff limiting erosion in the process.
![Swale cross section](precalc/swale.png) ![Swale cross section](precalc/figures/swale.png)
There are a few mathematical formula that describe the characteristics of swale: There are a few mathematical formula that describe the characteristics of swale:
@ -140,14 +140,14 @@ $$
Finally, the *flow quantity* is given by *Manning's* formula: Finally, the *flow quantity* is given by *Manning's* formula:
$$ $$
Q = vA = \frac{R^{2/3} S^{1/2}}{n}, \quad R = \frac{A}{P}. Q = vA = \frac{R^{2/3} S^{1/2}}{n} A, \quad R = \frac{A}{P}.
$$ $$
With $n$ being Manning's coefficient, $v$ the velocity in feet per second, and $S$ being the slope. Velocity and slope are correlated. With $n$ being Manning's coefficient, $v$ the velocity in meters per second, and $S$ being the slope. Velocity and slope are correlated.
Manning's coefficient depends on the height of the vegetation in the grass swale. It is $0.025$ when the depth of flow is similar to the vegetation height. Manning's coefficient depends on the height of the vegetation in the grass swale. It is $0.025$ when the depth of flow is similar to the vegetation height.
Given all this, compute the flow quantity when $S = 2/90$, $n=0.025$ and $v=1/10$ for a swale with characteristics $b=1$, $\theta=\pi/4$, $d=1$. Given all this, compute the flow quantity when $S = 2/90$ and $n=0.025$ for a swale with characteristics $b=1$, $\theta=\pi/4$, $d=1$.
```{julia} ```{julia}
b, theta, d = 1, pi/4, 1 b, theta, d = 1, pi/4, 1
@ -155,7 +155,7 @@ n, S = 0.025, 2/90
A = (b + d/tan(theta)) * d A = (b + d/tan(theta)) * d
P = b + 2d/sin(theta) P = b + 2d/sin(theta)
R = A / P R = A / P
Q = R^(2/3) * S^(1/2) / n Q = R^(2/3) * S^(1/2) * A / n
``` ```
@ -287,7 +287,7 @@ There is even support for tab-completion of [emojis](https://github.com/JuliaLan
##### Example ##### Example
As mentioned the value of $e$ is bound to the Unicode value `\euler[tab]` and not the letter `e`, so Unicode entry is required to access this constant This isn't quite true. The `MathConstants` module defines `e`, as well as a few other values accessed via Unicode. When the `CalculusWithJulia` package is loaded, as will often be done in these notes, a value of `exp(1)` is assigned to `e`. As mentioned the value of $e$ is bound to the Unicode value `\euler[tab]` and not the letter `e`, so Unicode entry is required to access this constant. This isn't quite true. The `MathConstants` module defines `e`, as well as a few other values accessed via Unicode. When the `CalculusWithJulia` package is loaded, as will often be done in these notes, a value of `exp(1)` is assigned to `e`.
## Tuple assignment ## Tuple assignment