use quarto, not Pluto to render pages
This commit is contained in:
@@ -12,11 +12,11 @@ using SymPy
|
||||
```julia; echo=false; results="hidden"
|
||||
using CalculusWithJulia.WeaveSupport
|
||||
|
||||
fig_size = (400, 400)
|
||||
const frontmatter = (
|
||||
title = "Optimization",
|
||||
description = "Calculus with Julia: Optimization",
|
||||
tags = ["CalculusWithJulia", "derivatives", "optimization"],
|
||||
fig_size = (800, 600)
|
||||
frontmatter = (
|
||||
title = "Optimization",
|
||||
description = "Calculus with Julia: Optimization",
|
||||
tags = ["CalculusWithJulia", "derivatives", "optimization"],
|
||||
);
|
||||
|
||||
nothing
|
||||
@@ -173,13 +173,8 @@ find_zeros(A', 0, 10) # find_zeros in `Roots`,
|
||||
|
||||
|
||||
|
||||
```julia; echo=false
|
||||
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.
|
||||
|
||||
""")
|
||||
```
|
||||
!!! 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.
|
||||
|
||||
|
||||
#### Example: Norman windows
|
||||
@@ -582,7 +577,7 @@ both positive. What value $x$ in $[0,L]$ will minimize the total travel time?
|
||||
We approach this symbolically with `SymPy`:
|
||||
|
||||
```julia;
|
||||
@syms a::positive b::positive L::positive r0::positive r1::positive
|
||||
@syms x::positive a::positive b::positive L::positive r0::positive r1::positive
|
||||
|
||||
d0 = sqrt(x^2 + a^2)
|
||||
d1 = sqrt((L-x)^2 + b^2)
|
||||
@@ -913,8 +908,8 @@ choices = [
|
||||
"It is also 20",
|
||||
"``17.888``"
|
||||
]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1076,8 +1071,8 @@ Now if $Likhood(t) = \exp(-3t) \cdot \exp(-2t) \cdot \exp(-4t), \quad 0 \leq t \
|
||||
choices=["It does work and the answer is x = 2.27...",
|
||||
L" $Likhood(t)$ is not continuous on $0$ to $10$",
|
||||
L" $Likhood(t)$ takes its maximum at a boundary point - not a critical point"];
|
||||
ans = 3;
|
||||
radioq(choices, ans)
|
||||
answ = 3;
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
##### Question
|
||||
@@ -1103,8 +1098,8 @@ choices=[
|
||||
"The median, or middle number, of the values",
|
||||
L"The square roots of the values squared, $(x_1^2 + \cdots x_n^2)^2$"
|
||||
]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1241,8 +1236,8 @@ choices = ["exactly four times",
|
||||
L"exactly $\pi$ times",
|
||||
L"about $2.6$ times as big",
|
||||
"about the same"]
|
||||
ans = 1
|
||||
radioq(choices, ans)
|
||||
answ = 1
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1278,8 +1273,8 @@ choices = [
|
||||
"``e/a``",
|
||||
"``a \\cdot e``"
|
||||
]
|
||||
ans=2
|
||||
radioq(choices, ans)
|
||||
answ=2
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
|
||||
Reference in New Issue
Block a user