add videos in stereo.2
This commit is contained in:
parent
8fb3ddad8f
commit
94dee54cdb
@ -34,7 +34,7 @@ def bindfig(fig):
|
|||||||
|
|
||||||
class SympyAnimationWrapper:
|
class SympyAnimationWrapper:
|
||||||
"""
|
"""
|
||||||
Context manager for binding a figurebinfoinfoinfoinfoinfoinfo
|
Context manager for binding a figure for animation.
|
||||||
"""
|
"""
|
||||||
def __init__(self, filename: Path | str):
|
def __init__(self, filename: Path | str):
|
||||||
self._filename = filename if isinstance(filename, Path) else Path(filename)
|
self._filename = filename if isinstance(filename, Path) else Path(filename)
|
||||||
|
|||||||
@ -44,7 +44,7 @@ def generate_os(amt):
|
|||||||
yield ret
|
yield ret
|
||||||
ret = (ret * o).expand().cancel().simplify()
|
ret = (ret * o).expand().cancel().simplify()
|
||||||
|
|
||||||
os = list(generate_os(10))
|
os = list(generate_os(11))
|
||||||
cs = [sympy.re(i).simplify() for i in os]
|
cs = [sympy.re(i).simplify() for i in os]
|
||||||
ss = [sympy.im(i).simplify() for i in os]
|
ss = [sympy.im(i).simplify() for i in os]
|
||||||
```
|
```
|
||||||
@ -365,9 +365,7 @@ will plot a $p/1$ polar rose as t ranges over $(-\infty, \infty)$.
|
|||||||
|
|
||||||
```{python}
|
```{python}
|
||||||
#| echo: false
|
#| echo: false
|
||||||
#| fig-cap: |
|
#| output: false
|
||||||
#| p/1 polar roses as rational curves.
|
|
||||||
#| Since *t* never reaches infinity, a bite appears to be taken out of the graphs near (-1, 0).
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Rose:
|
class Rose:
|
||||||
@ -384,7 +382,7 @@ class Rose:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def animate_roses(filename: str, arguments: list[Rose], interval=200):
|
def animate_roses(filename: str, arguments: list[Rose], interval=500):
|
||||||
with SympyAnimationWrapper(filename) as animate:
|
with SympyAnimationWrapper(filename) as animate:
|
||||||
@animate(list(range(len(arguments))), interval=interval)
|
@animate(list(range(len(arguments))), interval=interval)
|
||||||
def ret(fr):
|
def ret(fr):
|
||||||
@ -408,6 +406,13 @@ animate_roses(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
::: {#fig-polar-roses-1}
|
||||||
|
{{< video "./polar_roses_1.mp4" >}}
|
||||||
|
|
||||||
|
p/1 polar roses as rational curves.
|
||||||
|
Since *t* never reaches infinity, a bite appears to be taken out of the graphs near (-1, 0)."
|
||||||
|
:::
|
||||||
|
|
||||||
$q = 1$ happens to match the subscript *c* term of *x* and *s* term of *y*, so one might wonder
|
$q = 1$ happens to match the subscript *c* term of *x* and *s* term of *y*, so one might wonder
|
||||||
whether the other polar curves can be obtained by allowing it to vary as well.
|
whether the other polar curves can be obtained by allowing it to vary as well.
|
||||||
And you'd be right.
|
And you'd be right.
|
||||||
@ -420,7 +425,7 @@ will plot a $p/q$ polar rose as t ranges over $(-\infty, \infty)$.
|
|||||||
|
|
||||||
```{python}
|
```{python}
|
||||||
#| echo: false
|
#| echo: false
|
||||||
#| fig-cap: p/q polar roses as rational curves
|
#| output: false
|
||||||
|
|
||||||
animate_roses(
|
animate_roses(
|
||||||
"polar_roses_2.mp4",
|
"polar_roses_2.mp4",
|
||||||
@ -431,6 +436,11 @@ animate_roses(
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
::: {#fig-polar-roses-2}
|
||||||
|
{{< video "./polar_roses_2.mp4" >}}
|
||||||
|
|
||||||
|
p/q polar roses as rational curves
|
||||||
|
:::
|
||||||
|
|
||||||
Just as with the prior calculus examples, doubling all subscripts of *c* and *s* will
|
Just as with the prior calculus examples, doubling all subscripts of *c* and *s* will
|
||||||
only require *t* to range over $(-1, 1)$, which removes the ugly bite mark.
|
only require *t* to range over $(-1, 1)$, which removes the ugly bite mark.
|
||||||
@ -700,7 +710,7 @@ Indeed, the sequence of curves with parametrization $R_n(t) = 2nt$ approximate t
|
|||||||
|
|
||||||
```{python}
|
```{python}
|
||||||
#| echo: false
|
#| echo: false
|
||||||
#| fig-cap: Approximations to the Archimedean spiral
|
#| output: false
|
||||||
|
|
||||||
with SympyAnimationWrapper("approximate_archimedes.mp4") as animate:
|
with SympyAnimationWrapper("approximate_archimedes.mp4") as animate:
|
||||||
@animate(list(range(10)), interval=500)
|
@animate(list(range(10)), interval=500)
|
||||||
@ -734,6 +744,13 @@ with SympyAnimationWrapper("approximate_archimedes.mp4") as animate:
|
|||||||
ret.save() # type: ignore
|
ret.save() # type: ignore
|
||||||
```
|
```
|
||||||
|
|
||||||
|
::: {#fig-approx-archimedes}
|
||||||
|
{{< video ./approximate_archimedes.mp4 >}}
|
||||||
|
|
||||||
|
Approximations to the Archimedean spiral
|
||||||
|
:::
|
||||||
|
|
||||||
|
|
||||||
Since R necessarily defines a rational curve, the curves will never be equal,
|
Since R necessarily defines a rational curve, the curves will never be equal,
|
||||||
just as any stretching of $c_n$ will never exactly become cosine.
|
just as any stretching of $c_n$ will never exactly become cosine.
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user