use plotly; fix bitrot
This commit is contained in:
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
import Contour: contours, levels, level, lines, coordinates
|
||||
using LinearAlgebra
|
||||
using ForwardDiff
|
||||
@@ -393,7 +394,7 @@ $$
|
||||
where $t \in [0,1]$ This gives a vector-valued function
|
||||
|
||||
$$
|
||||
F(u, t) = t * (r(u) - V) + V, \quad \alpha \leq u \leq \beta, 0 \leq t \leq 1.
|
||||
F(u, t) = t \cdot (r(u) - V) + V, \quad \alpha \leq u \leq \beta, 0 \leq t \leq 1.
|
||||
$$
|
||||
|
||||
To illustrate, we have:
|
||||
|
||||
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
using SymPy
|
||||
using Roots
|
||||
using QuadGK
|
||||
@@ -29,6 +30,7 @@ Polar coordinates parameterize the plane though an angle $\theta$ made from the
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
gr()
|
||||
theta = pi/6
|
||||
rr = 1
|
||||
|
||||
@@ -48,7 +50,9 @@ annotate!([
|
||||
(cos(theta), sin(theta)+.05, L"(x,y)"),
|
||||
(cos(theta),-.05, L"x"),
|
||||
(-.05, sin(theta),L"y")
|
||||
])
|
||||
])
|
||||
plotly()
|
||||
p
|
||||
```
|
||||
|
||||
To recover the Cartesian coordinates from the pair $(r,\theta)$, we have these formulas from [right](http://en.wikipedia.org/wiki/Polar_coordinate_system#Converting_between_polar_and_Cartesian_coordinates) triangle geometry:
|
||||
|
||||
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
gr()
|
||||
using ForwardDiff
|
||||
using SymPy
|
||||
using Roots
|
||||
@@ -208,7 +209,7 @@ An alternate to `surface` is `wireframe` – which may not use shading in all ba
|
||||
```{julia}
|
||||
#| hold: true
|
||||
xs = ys = range(-2,2, length=10) # downsample to see the frame
|
||||
wireframe(xs, ys, 𝒇) # gr() or pyplot() wireplots render better than plotly()
|
||||
wireframe(xs, ys, 𝒇)
|
||||
```
|
||||
|
||||
##### Example
|
||||
|
||||
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
using SymPy
|
||||
using Roots
|
||||
```
|
||||
|
||||
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
using SymPy
|
||||
using ForwardDiff
|
||||
using LinearAlgebra
|
||||
|
||||
@@ -9,6 +9,7 @@ This section uses these add-on packages:
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
using SymPy
|
||||
using Roots
|
||||
using LinearAlgebra
|
||||
@@ -322,11 +323,13 @@ In 1935 [Marcel Duchamp](https://arthur.io/art/marcel-duchamp/rotorelief-no-10-c
|
||||
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
let
|
||||
# https://exploratorium.tumblr.com/post/33140874462/marcel-duchamp-rotoreliefs-duchamp-recognized
|
||||
|
||||
# coordinates and colors selected by gimp from
|
||||
# https://arthur.io/art/marcel-duchamp/rotorelief-no-10-cage-modele-depose-verso
|
||||
# https://arthur.io/art/marcel-duchamp/rotorelief-no-10-cage-modele-depose-verso
|
||||
gr()
|
||||
circs = [466 548 513 505 556 554 # x₁,y₁,x₂,y₂,x₂,y₃
|
||||
414 549 511 455 595 549
|
||||
365 545 507 408 635 548
|
||||
@@ -354,7 +357,7 @@ let
|
||||
function solve_i(i)
|
||||
eqs = [(p[1] - h)^2 + (p[2]-k)^2 ~ r^2 for
|
||||
p ∈ (circs[i,1:2], circs[i,3:4], circs[i,5:6])]
|
||||
d = solve(eqs)[1]
|
||||
d = solve(tuple(eqs...))[1]
|
||||
(x=float(d[h]), y=float(d[k]), r=float(d[r]))
|
||||
end
|
||||
c₀, cs... = solve_i.(16:-1:1) # c₀ is centered
|
||||
@@ -391,6 +394,9 @@ let
|
||||
|
||||
fname = tempname() * ".gif"
|
||||
gif(anim, fname, fps = 40)
|
||||
|
||||
plotly()
|
||||
ImageFile(fname, "Duchamp rotorelief")
|
||||
end
|
||||
```
|
||||
|
||||
@@ -1268,6 +1274,10 @@ For the torsion to be defined, the cross product $\vec{r}' \times \vec{r}''$ mus
|
||||
|
||||
##### Example: Tubular surface
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
gr();
|
||||
```
|
||||
|
||||
This last example comes from a collection of several [examples](https://github.com/empet/3D-Viz-with-PlotlyJS.jl/blob/main/5-Tubular-surface.ipynb) provided by Discourse user `@empet` to illustrate `plotlyjs`. We adopt it to `Plots` with some minor changes below.
|
||||
|
||||
@@ -1376,6 +1386,11 @@ ts = range(t_span..., length=1001)
|
||||
surface(unzip(r_0.(ts, θs'))...)
|
||||
```
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plotly();
|
||||
```
|
||||
|
||||
## Arc length
|
||||
|
||||
|
||||
@@ -1586,6 +1601,7 @@ Here, when $b$ gets large, the curve looks more and more "straight" and the tors
|
||||
```{julia}
|
||||
#| echo: false
|
||||
let
|
||||
gr()
|
||||
a = 1
|
||||
F(t) = [cos(pi/2 - t), 2sin(pi/2-t)]
|
||||
p = (a, F)
|
||||
@@ -1613,7 +1629,7 @@ using LaTeXStrings
|
||||
annotate!([(-.5,1.5,L"k"),
|
||||
(.775,1.55,L"\kappa"),
|
||||
(.85, 1.3, L"\alpha")])
|
||||
|
||||
plotly()
|
||||
plt
|
||||
end
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user