align fix; theorem style; condition number
This commit is contained in:
@@ -30,7 +30,7 @@ A scalar, univariate function, such as $f(x) = 1 - x^2/2$, can be thought of in
|
||||
|
||||
* It can be represented through a rule of what it does to $x$, as above. This is useful for computing numeric values.
|
||||
* it can be interpreted verbally, as in *square* $x$, take half then *subtract* from one. This can give clarity to what the function does.
|
||||
* It can be thought of in terms of its properties: a polynomial, continuous, $U$-shaped, an approximation for $\cos(x)$ near $0$, $\dots$
|
||||
* It can be thought of in terms of its properties: a polynomial, continuous, upside down $U$-shaped, an approximation for $\cos(x)$ near $0$, $\dots$
|
||||
* it can be visualized graphically. This is useful for seeing the qualitative behavior of a function.
|
||||
|
||||
|
||||
@@ -243,15 +243,15 @@ For instances where a *specific* set of $x$ values is desired to be used, the `r
|
||||
|
||||
|
||||
```{julia}
|
||||
𝒙s = range(0, 2pi, length=10)
|
||||
𝒚s = sin.(𝒙s)
|
||||
xs = range(0, 2pi, length=10)
|
||||
ys = sin.(xs)
|
||||
```
|
||||
|
||||
Finally, to plot the set of points and connect with lines, the $x$ and $y$ values are passed along as vectors:
|
||||
|
||||
|
||||
```{julia}
|
||||
plot(𝒙s, 𝒚s)
|
||||
plot(xs, ys)
|
||||
```
|
||||
|
||||
This plots the points as pairs and then connects them in order using straight lines. Basically, it creates a dot-to-dot graph. The above graph looks primitive, as it doesn't utilize enough points.
|
||||
@@ -490,7 +490,7 @@ For plotting points with `scatter`, or `scatter!` the markers can be adjusted vi
|
||||
* `scatter(..., marker=:square)`: change the marker (uses a symbol, not a string to specify)
|
||||
|
||||
|
||||
Of course, zero, one, or more of these can be used on any given call to `plot`, `plot!`, `scatter` or `scatter!`.
|
||||
Of course, zero, one, or more of these can be used on any given call to `plot`, `plot!`, `scatter`, or `scatter!`.
|
||||
|
||||
#### Example: Bresenham's algorithm
|
||||
|
||||
@@ -575,9 +575,9 @@ The most "famous" parametric graph is one that is likely already familiar, as it
|
||||
|
||||
|
||||
```{julia}
|
||||
𝒇(x) = cos(x); 𝒈(x) = sin(x)
|
||||
𝒕s = range(0, 2pi, length=100)
|
||||
plot(𝒇.(𝒕s), 𝒈.(𝒕s), aspect_ratio=:equal) # make equal axes
|
||||
f(x) = cos(x); g(x) = sin(x)
|
||||
ts = range(0, 2pi, length=100)
|
||||
plot(f.(ts), g.(ts), aspect_ratio=:equal) # make equal axes
|
||||
```
|
||||
|
||||
Any point $(a,b)$ on this graph is represented by $(\cos(t), \sin(t))$ for some value of $t$, and in fact multiple values of $t$, since $t + 2k\pi$ will produce the same $(a,b)$ value as $t$ will.
|
||||
@@ -599,8 +599,8 @@ DataFrame(θ=θs, x=cos.(θs), y=sin.(θs))
|
||||
```{julia}
|
||||
#| hold: true
|
||||
θs =[0, pi/6, pi/4, pi/3, pi/2, 2pi/3, 3pi/4, 5pi/6, pi]
|
||||
plot(𝒇.(θs), 𝒈.(θs), legend=false, aspect_ratio=:equal)
|
||||
scatter!(𝒇.(θs), 𝒈.(θs))
|
||||
plot(f.(θs), g.(θs), legend=false, aspect_ratio=:equal)
|
||||
scatter!(f.(θs), g.(θs))
|
||||
```
|
||||
|
||||
---
|
||||
@@ -610,7 +610,7 @@ As with the plot of a univariate function, there is a convenience interface for
|
||||
|
||||
|
||||
```{julia}
|
||||
plot(𝒇, 𝒈, 0, 2pi, aspect_ratio=:equal)
|
||||
plot(f, g, 0, 2pi, aspect_ratio=:equal)
|
||||
```
|
||||
|
||||
##### Example
|
||||
@@ -876,6 +876,24 @@ answ = 2
|
||||
radioq(choices, answ)
|
||||
```
|
||||
|
||||
###### Question
|
||||
|
||||
The `plot` function can have its data specified through a vector of points. Such data can be generated through a comprehension. Does this command plot the given expression avoiding the need to define a function?
|
||||
|
||||
```{julia}
|
||||
#| eval: false
|
||||
plot([(x, sin(x^2)-sin(x)) for x in range(-pi, pi, 100)])
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
explanation = """
|
||||
Yes, it does. Whether this is more convenient than say `plot(x -> sin(x^2) - sin(x), -pi, pi)` is a different question.
|
||||
"""
|
||||
buttonq(["Yes", "No"], 1; explanation)
|
||||
```
|
||||
|
||||
|
||||
###### Question
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user