lots of cleanup
This commit is contained in:
@@ -30,6 +30,7 @@ We measure angles in radians, where $360$ degrees is $2\pi$ radians. By proporti
|
||||
|
||||
For a right triangle with angles $\theta$, $\pi/2 - \theta$, and $\pi/2$ ($0 < \theta < \pi/2$) we call the side opposite $\theta$ the "opposite" side, the shorter adjacent side the "adjacent" side and the longer adjacent side the hypotenuse.
|
||||
|
||||
::: {#fig-right-triangle-soh-cah-toa}
|
||||
|
||||
```{julia}
|
||||
#| hide: true
|
||||
@@ -67,10 +68,12 @@ plotly()
|
||||
nothing
|
||||
```
|
||||
|
||||
With these, the basic definitions for the primary trigonometric functions are
|
||||
Labeling of a right triangle lengths in relation to a designated angle, $\theta$.
|
||||
:::
|
||||
|
||||
::: {.callout-note icon=false}
|
||||
## Trigonometric definitions
|
||||
With the labelings in @fig-right-triangle-soh-cah-toa, the basic definitions for the primary trigonometric functions are
|
||||
|
||||
::: {.definition title="Trigonometric definitions from a right triangle"}
|
||||
$$
|
||||
\begin{align*}
|
||||
\sin(\theta) &= \frac{\text{opposite}}{\text{hypotenuse}} &\quad(\text{the sine function})\\
|
||||
@@ -78,20 +81,16 @@ $$
|
||||
\tan(\theta) &= \frac{\text{opposite}}{\text{adjacent}} &\quad(\text{the tangent function})
|
||||
\end{align*}
|
||||
$$
|
||||
:::
|
||||
|
||||
:::{.callout-note}
|
||||
## Note
|
||||
Many students remember these through [SOH-CAH-TOA](http://mathworld.wolfram.com/SOHCAHTOA.html).
|
||||
|
||||
:::
|
||||
|
||||
Some algebra shows that $\tan(\theta) = \sin(\theta)/\cos(\theta)$. There are also $3$ reciprocal functions, the cosecant, secant and cotangent.
|
||||
|
||||
|
||||
These definitions in terms of sides only apply for $0 \leq \theta \leq \pi/2$. More generally, if we relate any angle taken in the counter clockwise direction for the $x$-axis with a point $(x,y)$ on the *unit* circle, then we can extend these definitions - the point $(x,y)$ is also $(\cos(\theta), \sin(\theta))$.
|
||||
|
||||
These definitions in terms of sides only apply for $0 \leq \theta \leq \pi/2$. More generally, if we relate any angle taken in the counter clockwise direction for the $x$-axis with a point $(x,y)$ on the *unit* circle, then we can extend these definitions - the point $(x,y)$ is also $(\cos(\theta), \sin(\theta))$, cf. @fig-trig-values-along-unit-circle.
|
||||
|
||||
::: {#fig-trig-values-along-unit-circle}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
@@ -136,38 +135,46 @@ end
|
||||
|
||||
imgfile = tempname() * ".gif"
|
||||
gif(anim, imgfile, fps = 1)
|
||||
caption = "An angle in radian measure corresponds to a point on the unit circle, whose coordinates define the sine and cosine of the angle. That is ``(x,y) = (\\cos(\\theta), \\sin(\\theta))``."
|
||||
caption = ""
|
||||
|
||||
plotly()
|
||||
ImageFile(imgfile, caption)
|
||||
```
|
||||
|
||||
An angle in radian measure corresponds to a point on the unit circle, whose coordinates define the sine and cosine of the angle. That is $(x,y) = (\cos(\theta), \sin(\theta))$.
|
||||
:::
|
||||
|
||||
### The trigonometric functions in Julia
|
||||
|
||||
|
||||
Julia has the $6$ basic trigonometric functions defined through the functions `sin`, `cos`, `tan`, `csc`, `sec`, and `cot`.
|
||||
|
||||
|
||||
Two right triangles - the one with equal, $\pi/4$, angles; and the one with angles $\pi/6$ and $\pi/3$ can have the ratio of their sides computed from basic geometry. In particular, this leads to the following values, which are usually committed to memory:
|
||||
Two right triangles - the one with equal, $\pi/4$, angles; and the one with angles $\pi/6$ and $\pi/3$ can have the ratio of their sides computed from basic geometry. In particular, this leads to @tbl-basic-sin-cosine-values, values which are usually committed to memory:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\sin(0) &= 0, \quad \sin(\pi/6) = \frac{1}{2}, \quad \sin(\pi/4) = \frac{\sqrt{2}}{2}, \quad\sin(\pi/3) = \frac{\sqrt{3}}{2},\text{ and } \sin(\pi/2) = 1\\
|
||||
\cos(0) &= 1, \quad \cos(\pi/6) = \frac{\sqrt{3}}{2}, \quad \cos(\pi/4) = \frac{\sqrt{2}}{2}, \quad\cos(\pi/3) = \frac{1}{2},\text{ and } \cos(\pi/2) = 0.
|
||||
\end{align*}
|
||||
$$
|
||||
::: {#tbl-basic-sin-cosine-values .striped .hover}
|
||||
|
||||
| $\theta$ | $\sin(\theta)$ | $\cos(\theta)$ |
|
||||
|:---------:|:--------------:|:--------------:|
|
||||
| $0$ | $0$ | $1$ |
|
||||
| $\pi/6$ | $1/2$ | $\sqrt{3}/2$ |
|
||||
| $\pi/4$ | $\sqrt{2}/2$ | $\sqrt{2}/2$ |
|
||||
| $\pi/3$ | $\sqrt{3}/2$ | $1/2$ |
|
||||
| $\pi/2$ | $1$ | $0$ |
|
||||
|
||||
: Table of sine and cosine values that can be derived from different triangles
|
||||
:::
|
||||
|
||||
|
||||
Using the circle definition allows these basic values to inform us of values throughout the unit circle.
|
||||
|
||||
Using the circle definition allows these basic values to inform us of values throughout the unit circle:
|
||||
|
||||
These all follow from the definition involving the unit circle:
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then the angle $-\theta$ corresponds to $(x, -y)$. So $\sin(\theta) = - \sin(-\theta)$ (an odd function), but $\cos(\theta) = \cos(-\theta)$ (an even function).
|
||||
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then rotating by $\pi$ moves the points to $(-x, -y)$. So $x = \cos(\theta) = - \cos(\theta + \pi)$, and $y = \sin(\theta) = -\sin(\theta + \pi)$.
|
||||
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then the angle $-\theta$ corresponds to $(x, -y)$. So $\sin(\theta) = - \sin(-\theta)$ (an odd function), but $\cos(\theta) = \cos(-\theta)$ (an even function).
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then rotating by $\pi$ moves the points to $(-x, -y)$. So $\cos(\theta) = x = - \cos(\theta + \pi)$, and $\sin(\theta) = y = -\sin(\theta + \pi)$.
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then rotating by $\pi/2$ moves the points to $(-y, x)$. So $\cos(\theta) = x = \sin(\theta + \pi/2)$.
|
||||
* If the angle $\theta$ corresponds to a point $(x,y)$ on the unit circle, then rotating by $\pi/2$ moves the points to $(-y, x)$. So $x = \cos(\theta) = \sin(\theta + \pi/2)$.
|
||||
|
||||
|
||||
The fact that $x^2 + y^2 = 1$ for the unit circle leads to the "Pythagorean identity" for trigonometric functions:
|
||||
@@ -232,7 +239,7 @@ opposite = adjacent * tan(theta)
|
||||
Having some means to compute an angle and then a tangent of that angle handy is not a given, so the linked to article provides a few other methods taking advantage of similar triangles.
|
||||
|
||||
|
||||
You can also measure distance with your [thumb](http://www.vendian.org/mncharity/dir3/bodyruler_angle/) or fist. How? The fist takes up about $10$ degrees of view when held straight out. So, pacing off backwards until the fist completely occludes the tree will give the distance of the adjacent side of a right triangle. If that distance is $30$ paces what is the height of the tree? Well, we need some facts. Suppose your pace is $3$ feet. Then the adjacent length is $90$ feet. The multiplier is the tangent of $10$ degrees, or:
|
||||
You can also measure distance with your [thumb](http://www.vendian.org/mncharity/dir3/bodyruler_angle/) or fist. How? The fist takes up about $10$ degrees of view when held straight out. So, pacing off backwards until the fist completely occludes the tree can give the distance of the adjacent side of a right triangle. If that distance is $30$ paces what is the height of the tree? Well, we need some facts. Suppose your pace is $3$ feet. Then the adjacent length is $90$ feet. The multiplier is the tangent of $10$ degrees, or:
|
||||
|
||||
|
||||
```{julia}
|
||||
@@ -259,40 +266,52 @@ This could be reversed. If you know the height of something a distance away that
|
||||
### Basic properties
|
||||
|
||||
|
||||
The sine function is defined for all real $\theta$ and has a range of $[-1,1]$. Clearly as $\theta$ winds around the $x$-axis, the position of the $y$ coordinate begins to repeat itself. We say the sine function is *periodic* with period $2\pi$. A graph will illustrate:
|
||||
The sine function is defined for all real $\theta$ and has a range of $[-1,1]$. Clearly as $\theta$ winds around the $x$-axis, the position of the $y$ coordinate begins to repeat itself. We say the sine function is *periodic* with period $2\pi$. @fig-sin-over-0-4-pi illustrates. The graph shows two periods. The wavy aspect of the graph is why this function is used to model periodic motions, such as the amount of sunlight in a day, or the alternating current powering a computer.
|
||||
|
||||
|
||||
::: {#fig-sin-over-0-4-pi}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plot(sin, 0, 4pi)
|
||||
```
|
||||
|
||||
The graph shows two periods. The wavy aspect of the graph is why this function is used to model periodic motions, such as the amount of sunlight in a day, or the alternating current powering a computer.
|
||||
Graph of $f(x) = \sin(x)$ over $[0, 4\pi]$
|
||||
:::
|
||||
|
||||
|
||||
From this graph---or considering when the $y$ coordinate is $0$---we see that the sine function has zeros at any integer multiple of $\pi$, or $k\pi$, $k$ in $\dots,-2,-1, 0, 1, 2, \dots$.
|
||||
|
||||
From the graph of $\sin(x)$---or considering when the $y$ coordinate is $0$ on the unit circle---we see that the sine function has zeros at any integer multiple of $\pi$, or $k\pi$, $k$ in $\dots,-2,-1, 0, 1, 2, \dots$.
|
||||
|
||||
|
||||
The cosine function is similar, in that it has the same domain and range, but is "out of phase" with the sine curve. A graph of both shows the two are related:
|
||||
|
||||
The cosine function is similar, in that it has the same domain and range, but is "out of phase" with the sine curve. @fig-sin-cosine-graph illustrates.
|
||||
|
||||
::: {#fig-sin-cosine-graph}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plot(sin, 0, 4pi, label="sin")
|
||||
plot!(cos, 0, 4pi, label="cos")
|
||||
```
|
||||
|
||||
: Graph of $\sin(x)$ and $\cos(x)$ over $[0, 4\pi]$. The cosine graph lags the sine graph by $\pi/2$, or $\cos(x) = \sin(x + \pi/2)$.
|
||||
:::
|
||||
|
||||
The cosine function is just a shift of the sine function (or vice versa). We see that the zeros of the cosine function happen at points of the form $\pi/2 + k\pi$, $k$ in $\dots,-2,-1, 0, 1, 2, \dots.$
|
||||
|
||||
|
||||
The tangent function does not have all $\theta$ for its domain, rather those points where division by $0$ occurs are excluded. These occur when the cosine is $0$, or, again, at $\pi/2 + k\pi$, $k$ in $\dots,-2,-1, 0, 1, 2, \dots.$ The range of the tangent function will be all real $y$.
|
||||
The tangent function does not have all $\theta$ for its domain, rather those points where division by $0$ occurs are excluded; when the cosine is $0$, or, again, at $\pi/2 + k\pi$, $k$ in $\dots,-2,-1, 0, 1, 2, \dots.$ The range of the tangent function will be all real $y$.
|
||||
|
||||
|
||||
The tangent function is also periodic, but not with period $2\pi$, but rather just $\pi$. A graph will show this. Here we avoid the vertical asymptotes using `rangeclamp`:
|
||||
|
||||
The tangent function is also periodic, but not with period $2\pi$, but rather just $\pi$. @fig-graph-of-tangent-minus10-10 illustrates.
|
||||
|
||||
::: {#fig-graph-of-tangent-minus10-10}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plot(rangeclamp(tan), -10, 10, label="tan")
|
||||
```
|
||||
|
||||
Graph of $f(x) = \tan(x)$ over $[-10, 10]$ showing the periodic nature of the function. The vertical asymptotes were avoided by plotting `rangeclamp(tan)`.
|
||||
:::
|
||||
|
||||
##### Example sums of sines
|
||||
|
||||
|
||||
@@ -303,34 +322,43 @@ $$
|
||||
g(x) = a + b \sin((2\pi n)x)
|
||||
$$
|
||||
|
||||
That is a graph of $g$ will be the sine curve shifted up by $a$ units, scaled vertically by $b$ units and has a period of $1/n$. We see a simple plot here where we can verify the transformation:
|
||||
That is a graph of $g$ will be the sine curve shifted up by $a$ units, scaled vertically by $b$ units and has a period of $1/n$.
|
||||
|
||||
@fig-plot-of-2sin-2pi-n-x verifies the transformation:
|
||||
|
||||
::: {#fig-plot-of-2sin-2pi-n-x}
|
||||
|
||||
```{julia}
|
||||
g(x; b=1, n=1) = b*sin(2pi*n*x)
|
||||
g1(x) = 1 + g(x, b=2, n=3)
|
||||
plot(g1, 0, 1)
|
||||
plot(g1, 0, 1; xticks = (0:1/3:1, ["0", "1/3", "2/3", "1"]))
|
||||
```
|
||||
Plot of $g(x) = a + b \sin((2\pi n)x)$ with $n=1/3$ so the period of the sinusoical function is $1/3
|
||||
:::
|
||||
|
||||
We can consider the sum of such functions, for example
|
||||
@fig-sum-two-gs shows the sum of two such functions. Though still periodic, we can see with this simple example that sums of different sine functions can have somewhat complicated graphs.
|
||||
|
||||
|
||||
::: {#fig-sum-two-gs}
|
||||
|
||||
```{julia}
|
||||
g2(x) = 1 + g(x, b=2, n=3) + g(x, b=4, n=5)
|
||||
plot(g2, 0, 1)
|
||||
```
|
||||
|
||||
Though still periodic, we can see with this simple example that sums of different sine functions can have somewhat complicated graphs.
|
||||
Graph of sum of two sine functions, one with period $1/3$ one with period $1/5$. The resulting function has period $1$.
|
||||
:::
|
||||
|
||||
|
||||
|
||||
Sine functions can be viewed as the `x` position of a point traveling around a circle so `g(x, b=2, n=3)` is the `x` position of point traveling around a circle of radius $2$ that completes a circuit in $1/3$ units of time.
|
||||
|
||||
|
||||
The superposition of the two sine functions that `g2` represents could be viewed as the position of a circle moving around a point that is moving around another circle. The following graphic, with $b_1=1/3, n_1=3, b_2=1/4$, and $n_2=4$, shows an example that produces the related cosine sum (moving right along the $x$ axis), the sine sum (moving down along the $y$ axis, *and* the trace of the position of the point generating these two plots.
|
||||
The superposition of the two sine functions that `g2` represents could be viewed as the position of a circle moving around a point that is moving around another circle. @fig-superposition-of-sines-cosines, with $b_1=1/3, n_1=3, b_2=1/4$, and $n_2=4$, shows an example that produces the related cosine sum (moving right along the $x$ axis), the sine sum (moving down along the $y$ axis, *and* the trace of the position of the point generating these two plots.
|
||||
|
||||
::: {#fig-superposition-of-sines-cosines}
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
#| cache: true
|
||||
gr()
|
||||
@@ -390,11 +418,14 @@ end
|
||||
imgfile = tempname() * ".gif"
|
||||
gif(anim, imgfile, fps = 5)
|
||||
|
||||
caption = "Superposition of sines and cosines represented by an epicycle"
|
||||
caption = ""
|
||||
plotly()
|
||||
ImageFile(imgfile, caption)
|
||||
```
|
||||
|
||||
Superposition of sines and cosines represented by an epicycle.
|
||||
:::
|
||||
|
||||
As can be seen, even a somewhat simple combination can produce complicated graphs (a fact known to [Ptolemy](https://en.wikipedia.org/wiki/Deferent_and_epicycle)) . How complicated can such a graph get? This won't be answered here, but for fun enjoy this video produced by the same technique using more moving parts from the [`Javis.jl`](https://github.com/Wikunia/Javis.jl/blob/master/examples/fourier.jl) package:
|
||||
|
||||
|
||||
@@ -431,6 +462,7 @@ More generally, suppose we have two angles $\alpha$ and $\beta$, can we represen
|
||||
|
||||
Suppose both $\alpha$ and $\beta$ are positive with $\alpha + \beta \leq \pi/2$. Then using right triangle geometry we can associate the sine and cosine of $\alpha + \beta$ with distances in this figure:
|
||||
|
||||
::: {#fig-sin-cos-alpha-plus-beta-and-beta}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
gr()
|
||||
@@ -534,25 +566,25 @@ plot!(Shape([F,B]), fill=(:black, 0.35))
|
||||
annotate!(map(s ->getindex(txtpoints,s), collect(keys(txtpoints))))
|
||||
|
||||
|
||||
p1
|
||||
plot(p1, p2)
|
||||
```
|
||||
|
||||
Another right triangle with hypotenuse of length $1$ can be made by isolating the angle $\beta$, as below:
|
||||
The left figure labels the sides of a right triangle with angle $\alpha + \beta$, the right figure labels the sides of a right triangle with angle $\beta$.
|
||||
:::
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
p2
|
||||
```
|
||||
In @fig-cos-alpha-beta-sin-alpha-beta we make two more right triangles one with hypotenuse $\cos(\beta)$ and one with hypotenuse $\sin(\beta)$; each having an angle $\alpha$, the latter using some geometry, for which we can apply right-triangle trigonometry to find the length of their respective sides.
|
||||
|
||||
|
||||
We can make two more right triangles one with hypotenuse $\cos(\beta)$ and one with hypotenuse $\sin(\beta)$; each having an angle $\alpha$, the latter using some geometry, for which we can apply right-triangle trigonometry to find the length of their sides.
|
||||
::: {#fig-cos-alpha-beta-sin-alpha-beta}
|
||||
|
||||
```{julia}
|
||||
#| echo: false
|
||||
plot(p3, p4)
|
||||
```
|
||||
|
||||
From the left figure and the initial triangle, by comparing the lengths along the $x$ direction, we can see the decomposition:
|
||||
Two triangles with angle $\alpha$ and hypotenuses $\cos(\beta)$ and $\sin(\beta)$.
|
||||
:::
|
||||
|
||||
From the left side of #fig-cos-alpha-beta-sin-alpha-beta and the initial triangle, by comparing the lengths along the $x$ direction, we can see the decomposition:
|
||||
|
||||
$$
|
||||
\cos(\alpha)\cos(\beta) = \cos(\alpha + \beta) + \sin(\alpha)\sin(\beta)
|
||||
@@ -564,10 +596,9 @@ $$
|
||||
\sin(\alpha+\beta) = \sin(\alpha)\cos(\beta) + \cos(\alpha)\sin(\beta)
|
||||
$$
|
||||
|
||||
These lead to:
|
||||
All combined, these lead to:
|
||||
|
||||
::: {.callout-note icon=false}
|
||||
## The *sum* formulas for sine and cosine
|
||||
::: {.relationship title="The sum formulas for sine and cosine"}
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
@@ -575,12 +606,12 @@ $$
|
||||
\cos(\alpha + \beta) &= \cos(\alpha)\cos(\beta) - \sin(\alpha)\sin(\beta)
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
:::
|
||||
|
||||
Taking $\alpha = \beta$ we immediately get
|
||||
|
||||
::: {.callout-note icon=false}
|
||||
## The "double-angle" formulas
|
||||
::: {.relationship title="The double-angle formulas"}
|
||||
$$
|
||||
\begin{align*}
|
||||
\sin(2\alpha) &= 2\sin(\alpha)\cos(\alpha)\\
|
||||
@@ -589,17 +620,16 @@ $$
|
||||
$$
|
||||
:::
|
||||
|
||||
The latter looks like the Pythagorean identify, but has a minus sign. In fact, the Pythagorean identify is often used to rewrite this, for example $\cos(2\alpha) = 2\cos^2(\alpha) - 1$ or $1 - 2\sin^2(\alpha)$.
|
||||
The latter looks like the Pythagorean identify, but has a minus sign. In fact, the Pythagorean identify is often used to rewrite this formula, for example $\cos(2\alpha) = 2\cos^2(\alpha) - 1$ or $1 - 2\sin^2(\alpha)$.
|
||||
|
||||
|
||||
Applying the above with $\alpha = \beta/2$, we get that $\cos(\beta) = 2\cos^2(\beta/2) -1$. Similarly, using the Pythagorean identity a formula for sine can be done; when rearranged these yield the "half-angle" formulas:
|
||||
Applying the above with $\alpha = \beta/2$, we get that $\cos(\beta) = 2\cos^2(\beta/2) -1$. Similarly, using the Pythagorean identity a formula for sine can be identified; when rearranged these yield the "half-angle" formulas:
|
||||
|
||||
::: {.callout-note icon=false}
|
||||
## The "half-angle" formula
|
||||
::: {.relationship title="The half-angle formulas"}
|
||||
$$
|
||||
\begin{align*}
|
||||
\sin^2(\frac{\beta}{2}) &= \frac{1 - \cos(\beta)}{2}\\
|
||||
\cos^2(\frac{\beta}{2}) &= \frac{1 + \cos(\beta)}{2}
|
||||
\sin^2\left(\frac{\beta}{2}\right) &= \frac{1 - \cos(\beta)}{2}\\
|
||||
\cos^2\left(\frac{\beta}{2}\right) &= \frac{1 + \cos(\beta)}{2}
|
||||
\end{align*}
|
||||
$$
|
||||
:::
|
||||
@@ -633,6 +663,13 @@ $$
|
||||
|
||||
That is the angle for a multiple of $n+1$ can be expressed in terms of the angle with a multiple of $n$ and $n-1$. This can be used recursively to find expressions for $\cos(n\theta)$ in terms of polynomials in $\cos(\theta)$.
|
||||
|
||||
For example,
|
||||
|
||||
```{julia}
|
||||
@syms θ
|
||||
sympy.expand_trig(cos(5 * θ))
|
||||
```
|
||||
|
||||
|
||||
## Inverse trigonometric functions
|
||||
|
||||
@@ -640,29 +677,31 @@ That is the angle for a multiple of $n+1$ can be expressed in terms of the angle
|
||||
The trigonometric functions are all periodic. In particular they are not monotonic over their entire domain. This means there is no *inverse* function applicable. However, by restricting the domain to where the functions are monotonic, inverse functions can be defined:
|
||||
|
||||
|
||||
* For $\sin(x)$, the restricted domain of $[-\pi/2, \pi/2]$ allows for the arcsine function to be defined. In `Julia` this is implemented with `asin`.
|
||||
* For $\cos(x)$, the restricted domain of $[0,\pi]$ allows for the arccosine function to be defined. In `Julia` this is implemented with `acos`.
|
||||
* For $\tan(x)$, the restricted domain of $(-\pi/2, \pi/2)$ allows for the arctangent function to be defined. In `Julia` this is implemented with `atan`.
|
||||
|
||||
* For $\sin(x)$, the restricted domain of $[-\pi/2, \pi/2]$ allows for the arcsine function to be defined. In `Julia` this is implemented with `asin`.
|
||||
|
||||
* For $\cos(x)$, the restricted domain of $[0,\pi]$ allows for the arccosine function to be defined. In `Julia` this is implemented with `acos`.
|
||||
|
||||
* For $\tan(x)$, the restricted domain of $(-\pi/2, \pi/2)$ allows for the arctangent function to be defined. In `Julia` this is implemented with `atan`.
|
||||
|
||||
|
||||
|
||||
|
||||
For example, the arcsine function is defined for $-1 \leq x \leq 1$ and has a range of $-\pi/2$ to $\pi/2$:
|
||||
|
||||
|
||||
::: {#fig-arcsin-arctan}
|
||||
```{julia}
|
||||
plot(asin, -1, 1)
|
||||
#| echo: false
|
||||
p1 = plot(asin, -1, 1; legend=false, title="arcsin")
|
||||
p2 = plot(atan, -15, 15; legend=false, title="arctan")
|
||||
plot(p1, p2)
|
||||
```
|
||||
|
||||
The arctangent has domain of all real $x$. It has shape given by:
|
||||
The function $f(x) = \arcsin(x)$ has domain $[-1,1]$, whereas the function $f(x) = \arctan(x)$ has domain $(-\infty, \infty)$.
|
||||
:::
|
||||
|
||||
|
||||
```{julia}
|
||||
plot(atan, -10, 10)
|
||||
```
|
||||
|
||||
The horizontal asymptotes are $y=\pi/2$ and $y=-\pi/2$.
|
||||
|
||||
|
||||
### Implications of a restricted domain
|
||||
##### Example: Implications of a restricted domain
|
||||
|
||||
|
||||
Notice that $\sin(\arcsin(x)) = x$ for any $x$ in $[-1,1]$, but, of course, not for all $x$, as the output of the sine function can't be arbitrarily large.
|
||||
@@ -805,7 +844,7 @@ $$
|
||||
Both $\theta_0$ and $\theta_1$ are measured with respect to the coordinate system that looks like the $x-y$ plane. The red coordinate system is used to identify the angle of incidence for the second bending. Some right-triangle geometry relates the new angle $\theta'_1$ with $\theta_1$ through $\theta'_1 = \alpha - \theta_1$. With this new angle of incidence, the angle of refraction, $\theta'_2$, satisfies:
|
||||
|
||||
$$
|
||||
n1 \sin(\theta'_1) = n2 \sin(\theta'_2)
|
||||
n_1 \sin(\theta'_1) = n_2 \sin(\theta'_2)
|
||||
$$
|
||||
|
||||
Or
|
||||
@@ -868,9 +907,9 @@ $$
|
||||
d = \pi + 2i - 4 \arcsin(\frac{1}{n} \sin(i)).
|
||||
$$
|
||||
|
||||
Graphing this for incident angles between $0$ and $\pi/2$ we have:
|
||||
|
||||
@fig-plot-of-deflection-for-different-incident-angles shows the deflection for incident angles between $0$ and $\pi/2$
|
||||
|
||||
::: {#fig-plot-of-deflection-for-different-incident-angles}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
n = 4/3
|
||||
@@ -878,6 +917,9 @@ d(i) = pi + 2i - 4 * asin(sin(i)/n)
|
||||
plot(d, 0, pi/2)
|
||||
```
|
||||
|
||||
Plot of deflection for different incident angles
|
||||
:::
|
||||
|
||||
Descartes was interested in the minimum value of this graph, as it relates to where the light concentrates. This is roughly at $1$ radian or about $57$ degrees:
|
||||
|
||||
|
||||
@@ -915,9 +957,9 @@ A few things become clear from the above two representations:
|
||||
* Using the initial definition, we see that the zeros of $T_n(x)$ all occur within $[-1,1]$ and happen when $n\arccos(x) = k\pi + \pi/2$, or $x=\cos((2k+1)/n \cdot \pi/2)$ for $k=0, 1, \dots, n-1$.
|
||||
|
||||
|
||||
Other properties of this polynomial family are not at all obvious. One is that amongst all polynomials of degree $n$ with roots in $[-1,1]$, $T_n(x)$ will be the smallest in magnitude (after we divide by the leading coefficient to make all polynomials considered to be monic). We check this for one case. Take $n=4$, then we have: $T_4(x) = 8x^4 - 8x^2 + 1$. Compare this with $q(x) = (x+3/5)(x+1/5)(x-1/5)(x-3/5)$ (evenly spaced zeros):
|
||||
|
||||
Other properties of this polynomial family are not at all obvious. One is that amongst all polynomials of degree $n$ with roots in $[-1,1]$, $T_n(x)$ will be the smallest in magnitude (after we divide by the leading coefficient to make all polynomials considered to be monic). We check this for one case. Take $n=4$, then we have: $T_4(x) = 8x^4 - 8x^2 + 1$. We compare this polynomial with $q(x) = (x+3/5)(x+1/5)(x-1/5)(x-3/5)$ (evenly spaced zeros) in @fig-plot-T4-q-showing-chebyshev-minimal.
|
||||
|
||||
::: {#fig-plot-T4-q-showing-chebyshev-minimal}
|
||||
```{julia}
|
||||
T4(x) = (8x^4 - 8x^2 + 1) / 8
|
||||
q(x) = (x+3/5)*(x+1/5)*(x-1/5)*(x-3/5)
|
||||
@@ -925,14 +967,17 @@ plot(abs ∘ T4, -1,1, label="|T₄|")
|
||||
plot!(abs ∘ q, -1,1, label="|q|")
|
||||
```
|
||||
|
||||
We will return to this family of polynomials in the section on Orthogonal Polynomials.
|
||||
The monic Chebyshev polynomial is has the smallest maximum value of $[-1,1]$ of all monic polynomials of the same degree
|
||||
:::
|
||||
|
||||
We will return to this family of polynomials in the section on orthogonal polynomials.
|
||||
|
||||
## Hyperbolic trigonometric functions
|
||||
|
||||
|
||||
Related to the trigonometric functions are the hyperbolic trigonometric functions. Instead of associating a point $(x,y)$ on the unit circle with an angle $\theta,$ we associate a point $(x,y)$ on the unit *hyperbola* ($x^2 - y^2 = 1$). We define the hyperbolic sine ($\sinh$) and hyperbolic cosine ($\cosh$) through $(\cosh(\theta), \sinh(\theta)) = (x,y)$.
|
||||
|
||||
|
||||
::: {#fig-hyperbolic-trig-functions-from-unit-hyperbola}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
let
|
||||
@@ -940,7 +985,7 @@ let
|
||||
# y^2 = x^2 - 1
|
||||
top(x) = sqrt(x^2 - 1)
|
||||
|
||||
p = plot(; legend=false, aspect_ratio=:equal)
|
||||
p = plot(; legend=false, framestyle=:origin, aspect_ratio=:equal)
|
||||
|
||||
x₀ = 2
|
||||
xs = range(1, x₀, length=100)
|
||||
@@ -976,6 +1021,8 @@ let
|
||||
p
|
||||
end
|
||||
```
|
||||
Figure showing the definitions of $\cosh(x)$ and $\sinh(x)$ using the unit hyperbola $x^2 - y^2 = 1$
|
||||
:::
|
||||
|
||||
These values are more commonly expressed using the exponential function as:
|
||||
|
||||
@@ -1004,12 +1051,12 @@ What is bigger $\sin(1.23456)$ or $\cos(6.54321)$?
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
a = sin(1.23456) > cos(6.54321)
|
||||
choices = [raw"``\sin(1.23456)``", raw"``\cos(6.54321)``"]
|
||||
answ = a ? 1 : 2
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = a ? 1 : 2
|
||||
explanation = "Compare with `sin(1.23456) > cos(6.54321)`"
|
||||
buttonq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1019,13 +1066,13 @@ Let $x=\pi/4$. What is bigger $\cos(x)$ or $x$?
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
x = pi/4
|
||||
a = cos(x) > x
|
||||
choices = [raw"``\cos(x)``", "``x``"]
|
||||
answ = a ? 1 : 2
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = a ? 1 : 2
|
||||
explanation = "Compare with `cos(pi/4) > pi/4`"
|
||||
radioq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1041,8 +1088,8 @@ choices = [
|
||||
raw"``\cos(x) = \sin(x - \pi/2)``",
|
||||
raw"``\cos(x) = \sin(x + \pi/2)``",
|
||||
raw"``\cos(x) = \pi/2 \cdot \sin(x)``"]
|
||||
answ = 2
|
||||
radioq(choices, answ)
|
||||
answer = 2
|
||||
buttonq(choices, answer)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1058,8 +1105,9 @@ choices = [
|
||||
L"The values $k\pi$ for $k$ in $\dots, -2, -1, 0, 1, 2, \dots$",
|
||||
L"The values $\pi/2 + k\pi$ for $k$ in $\dots, -2, -1, 0, 1, 2, \dots$",
|
||||
L"The values $2k\pi$ for $k$ in $\dots, -2, -1, 0, 1, 2, \dots$"]
|
||||
answ = 2
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = 2
|
||||
explanation = "The secant is the reciprocal of the cosine function"
|
||||
buttonq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
###### Question
|
||||
@@ -1117,37 +1165,40 @@ numericq(val)
|
||||
The sine function is an *odd* function.
|
||||
|
||||
|
||||
* The hyperbolic sine is:
|
||||
* The hyperbolic sine is:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
choices = ["odd", "even", "neither"]
|
||||
answ = 1
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = 1
|
||||
explanation = "subsitute `-x` into the exponential formula to see"
|
||||
buttonq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
* The hyperbolic cosine is:
|
||||
* The hyperbolic cosine is:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
choices = ["odd", "even", "neither"]
|
||||
answ = 2
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = 2
|
||||
explanation = L"The value of $\cosh(-x)$ is the $y$ position of the point $(x,y)$ refelected through the $y$ axis, so is unchanged."
|
||||
buttonq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
* The hyperbolic tangent is:
|
||||
* The hyperbolic tangent is:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
choices = ["odd", "even", "neither"]
|
||||
answ = 1
|
||||
radioq(choices, answ, keep_order=true)
|
||||
answer = 1
|
||||
explanation = "A ratio of an odd function and an even function is *odd*"
|
||||
buttonq(choices, answer; explanation)
|
||||
```
|
||||
|
||||
###### Question
|
||||
|
||||
Reference in New Issue
Block a user