This commit is contained in:
jverzani
2024-05-22 07:55:20 -04:00
parent f710cded15
commit 771bb06aa3
50 changed files with 120 additions and 426 deletions

View File

@@ -157,7 +157,7 @@ find_zeros(A', 0, 10) # find_zeros in `Roots`,
:::{.callout-note}
## 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.
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 definition 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.
:::
@@ -1143,7 +1143,7 @@ numericq(Prim(val), 1e-3) ## a square!
###### Question
A running track is in the shape of two straight aways and two half circles. The total distance (perimeter) is 400 meters. Suppose $w$ is the width (twice the radius of the circles) and $h$ is the height. What dimensions minimize the sum $w + h$?
A running track is in the shape of two straightaways and two half circles. The total distance (perimeter) is 400 meters. Suppose $w$ is the width (twice the radius of the circles) and $h$ is the height. What dimensions minimize the sum $w + h$?
You have $P(w, h) = 2\pi \cdot (w/2) + 2\cdot(h-w)$.
@@ -1306,7 +1306,7 @@ Let $f(x) = (a/x)^x$ for $a,x > 0$. When is this maximized? The following might
```{julia}
#| hold: true
@syms x::positive a::postive
@syms x::positive a::positive
diff((a/x)^x, x)
```
@@ -1377,7 +1377,7 @@ Why is the following set of commands useful in this task:
#| eval: false
c2 = a^2*(1 + 1/p)^2 + b^2*(1+p)^2
c2p = diff(c2, p)
eq = numer(together(c2p))
eq = numerator(together(c2p))
solve(eq ~ 0, p)
```