lots of cleanup
This commit is contained in:
@@ -8,18 +8,17 @@ This section uses these add-on packages:
|
||||
|
||||
```{julia}
|
||||
using CalculusWithJulia
|
||||
using Plots
|
||||
plotly()
|
||||
using Plots; plotly()
|
||||
using Roots
|
||||
using QuadGK
|
||||
using SymPy
|
||||
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
::: {#fig-seesaw-image-for-center-of-mass}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
@@ -37,15 +36,18 @@ distance, the balance will tip in favor of the heavier.
|
||||
nothing
|
||||
```
|
||||
|
||||

|
||||
|
||||
A silhouette of two children on a seesaw. The seesaw can be balanced
|
||||
only if the distance from the central point for each child reflects
|
||||
their relative weights, or masses, through the formula $d_1m_1 = d_2
|
||||
m_2$. This means if the two children weigh the same the balance will
|
||||
tip in favor of the child farther away, and if both are the same
|
||||
distance, the balance will tip in favor of the heavier.
|
||||
](./figures/seesaw.png)
|
||||
:::
|
||||
|
||||
The game of seesaw is one where children earn an early appreciation for the effects of distance and relative weight. For children with equal weights, the seesaw will balance if they sit an equal distance from the center (on opposite sides, of course). However, with unequal weights that isn't the case. If one child weighs twice as much, the other must sit twice as far.
|
||||
@fig-seesaw-image-for-center-of-mass shows the game of seesaw. One where children earn an early appreciation for the effects of distance and relative weight. For children with equal weights, the seesaw will balance if they sit an equal distance from the center (on opposite sides, of course). However, with unequal weights that isn't the case. If one child weighs twice as much, the other must sit twice as far.
|
||||
|
||||
|
||||
The key relationship is that $d_1 m_1 = d_2 m_2$. This come from physics, where the moment about a point is defined by the mass times the distance. This balance relationship says the overall moment balances out. When this is the case, then the *center of mass* is at the fulcrum point, so there is no impetus to move.
|
||||
@@ -58,7 +60,7 @@ In general, we use position of the mass, rather than use distance from some fixe
|
||||
|
||||
|
||||
$$
|
||||
\bar{\text{cm}} = \frac{m_1 x_1 + m_2 x_2 + \cdots + m_n x_n}{m_1 + m_2 + \cdots + m_n}.
|
||||
\overline{\text{cm}} = \frac{m_1 x_1 + m_2 x_2 + \cdots + m_n x_n}{m_1 + m_2 + \cdots + m_n}.
|
||||
$$
|
||||
|
||||
Writing $w_i = m_i / (m_1 + m_2 + \cdots + m_n)$, we get the center of mass is just a weighted sum: $w_1 x_1 + \cdots + w_n x_n$, where the $w_i$ are the relative weights.
|
||||
@@ -68,10 +70,10 @@ With some rearrangement, we can see that the center of mass satisfies the equati
|
||||
|
||||
|
||||
$$
|
||||
w_1 \cdot (x_1 - \bar{\text{cm}}) + w_2 \cdot (x_2 - \bar{\text{cm}}) + \cdots + w_n \cdot (x_n - \bar{\text{cm}}) = 0.
|
||||
w_1 \cdot (x_1 - \overline{\text{cm}}) + w_2 \cdot (x_2 - \overline{\text{cm}}) + \cdots + w_n \cdot (x_n - \overline{\text{cm}}) = 0.
|
||||
$$
|
||||
|
||||
The center of mass is a balance of the weighted signed distances. This property of the center of mass being a balancing point makes it of intrinsic interest and can be - in the case of sufficient symmetry - easy to find.
|
||||
The center of mass is a balance of the weighted signed distances. This property of the center of mass being a balancing point makes it of intrinsic interest and can be---in the case of sufficient symmetry---easy to find.
|
||||
|
||||
|
||||
##### Example
|
||||
@@ -80,7 +82,7 @@ The center of mass is a balance of the weighted signed distances. This property
|
||||
A set of weights sits on a dumbbell rack. They are spaced 1 foot apart starting with the 5, then the 10-, 15-, 25-, and 35-pound weights. Where is the center of mass?
|
||||
|
||||
|
||||
We begin by letting $m_1=5$, $m_2=10$, $m_3=15$, $m_4=25$ and $m_5=35$. Our positions will be labeled $x_i = i-1$, so the five-pound weight is at position $0$ and the $35$-pound one at $4$. The center of mass is then given by:
|
||||
We begin by letting $m_1=5$, $m_2=10$, $m_3=15$, $m_4=25$ and $m_5=35.$ Our positions will be labeled $x_i = i-1$, so the five-pound weight is at position $0$ and the $35$-pound one at $4$. The center of mass is then given by:
|
||||
|
||||
|
||||
$$
|
||||
@@ -106,17 +108,21 @@ The center of mass shifts slightly, but since the removed weight was already clo
|
||||
Consider now a more general problem, the center of mass of a solid figure. We will restrict our attention to figures that can be represented by functions in the $x-y$ plane which are two dimensional. For example, consider the region in the plane bounded by the $x$ axis and the function $1 - \lvert x \rvert$. This is triangle with vertices $(-1,0)$, $(0,1)$, and $(1,0)$.
|
||||
|
||||
|
||||
This graph shows that the figure is symmetric:
|
||||
|
||||
@fig-graph-1-absx-over-minus-3-over-2-to-3-over-2 shows that the graph is symmetric:
|
||||
|
||||
::: {#fig-graph-1-absx-over-minus-3-over-2-to-3-over-2}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
f(x) = 1 - abs(x)
|
||||
a, b = -1.5, 1.5
|
||||
plot(f, a, b)
|
||||
plot(f, a, b; legend=false)
|
||||
plot!(zero, a, b)
|
||||
```
|
||||
|
||||
Plot of symmetric function $1 - \lvert x \rvert$ over $[-3/2, 3/2]$
|
||||
:::
|
||||
|
||||
As the center of mass should be a balancing value, we would guess intuitively that the center of mass in the $x$ direction will be $x=0$.
|
||||
|
||||
|
||||
@@ -125,7 +131,7 @@ But what should the center of mass formula be?
|
||||
|
||||
As with many formulas that will end up involving a derived integral, we start with a sum approximation. If the region is described as the area under the graph of $f(x)$ between $a$ and $b$, then we can form a Riemann sum approximation, that is a choice of $a = x_0 < x_1 < x_2 \cdots < x_n = b$ and points $c_1$, $\dots$, $c_n$. If all the rectangles are made up of a material of uniform density, say $\rho$, then the mass of each rectangle will be the area times $\rho$, or $\rho f(c_i) \cdot (x_i - x_{i-1})$, for $i = 1, \dots , n$.
|
||||
|
||||
|
||||
::: {#fig-center-of-mass-of-1-minus-absx}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
@@ -152,34 +158,38 @@ plot!(p, [-1,1], [0,0])
|
||||
p
|
||||
```
|
||||
|
||||
The figure shows the approximating rectangles and circles representing their masses for $n=20$.
|
||||
Approximating rectangles with circles representing their masses for a equal sized partition of $[-3/2, 3/2$ with $n=20$
|
||||
:::
|
||||
|
||||
|
||||
Generalizing from this figure shows the center of mass for such an approximation will be:
|
||||
Generalizing from @fig-center-of-mass-of-1-minus-absx shows the center of mass for such an approximation will be:
|
||||
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
&\frac{\rho f(c_1) (x_1 - x_0) \cdot x_1 + \rho f(c_2) (x_2 - x_1) \cdot x_1 + \cdots + \rho f(c_n) (x_n- x_{n-1}) \cdot x_{n-1}}{\rho f(c_1) (x_1 - x_0) + \rho f(c_2) (x_2 - x_1) + \cdots + \rho f(c_n) (x_n- x_{n-1})} \\
|
||||
&=\\
|
||||
&\quad\frac{f(c_1) (x_1 - x_0) \cdot x_1 + f(c_2) (x_2 - x_1) \cdot x_1 + \cdots + f(c_n) (x_n- x_{n-1}) \cdot x_{n-1}}{f(c_1) (x_1 - x_0) + f(c_2) (x_2 - x_1) + \cdots + f(c_n) (x_n- x_{n-1})}.
|
||||
&=
|
||||
\frac{f(c_1) (x_1 - x_0) \cdot x_1 + f(c_2) (x_2 - x_1) \cdot x_1 + \cdots + f(c_n) (x_n- x_{n-1}) \cdot x_{n-1}}{f(c_1) (x_1 - x_0) + f(c_2) (x_2 - x_1) + \cdots + f(c_n) (x_n- x_{n-1})}.
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
|
||||
But the top part is an approximation to the integral $\int_a^b x f(x) dx$ and the bottom part the integral $\int_a^b f(x) dx$. The ratio of these defines the center of mass.
|
||||
|
||||
::: {.callout-note icon=false}
|
||||
## Center of Mass
|
||||
::: {.definition title="Center of mass"}
|
||||
|
||||
The center of mass (in the $x$ direction) of a region in the $x-y$ plane described by the area under a (positive) function $f(x)$ between $a$ and $b$ is given by
|
||||
|
||||
$$
|
||||
\text{Center of mass} =
|
||||
\text{cm}_x = \frac{\int_a^b xf(x) dx}{\int_a^b f(x) dx}.
|
||||
\overline{\text{cm}}_x = \frac{\int_a^b xf(x) dx}{\int_a^b f(x) dx}.
|
||||
$$
|
||||
|
||||
For regions described by a more complicated set of equations, the center of mass is found from the same formula where $f(x)$ is the total height in the $x$ direction for a given $x$.
|
||||
For a region bounded between $g(x) \le f(x)$ over $[a,b]$ the center of mass is given by:
|
||||
|
||||
$$
|
||||
\overline{\text{cm}}_x = \frac{\int_a^b x(f(x)-g(x)) dx}{\int_a^b (f(x)-g(x)) dx}.
|
||||
$$
|
||||
:::
|
||||
|
||||
|
||||
@@ -189,51 +199,63 @@ For the triangular shape, we have by the fact that $f(x) = 1 - \lvert x \rvert$
|
||||
##### Example
|
||||
|
||||
|
||||
What about the center of mass of the triangle formed by the line $x=-1$, the $x$ axis and $(1-x)/2$? This too is defined between $a=-1$ and $b=1$, but the center of mass will be negative, as a graph shows more mass to the left of $0$ than the right:
|
||||
|
||||
What about the center of mass of the triangle formed by the line $x=-1$, the $x$ axis and $(1-x)/2$? This too is defined between $a=-1$ and $b=1,$ but the center of mass will be negative, as a graph shows more mass to the left of $0$ than the right:
|
||||
|
||||
::: {#fig-plot-1-x-over-2-and-center-of-mass}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
f(x) = (1-x)/2
|
||||
plot(f, -1, 1)
|
||||
plot!(zero, -1, 1)
|
||||
plot(f, -1, 1; legend=false, line=(1, :black))
|
||||
plot!(zero; line=(1, :black))
|
||||
plot!([(-1,0), (-1, f(-1))]; line=(1, :black))
|
||||
```
|
||||
|
||||
Plot of $(1-x)/2$ over $[-1, 1]$
|
||||
:::
|
||||
|
||||
The formulas give:
|
||||
|
||||
|
||||
$$
|
||||
\int_{-1}^1 xf(x) dx = \int_{-1}^1 x\cdot (1-x)/2 = (\frac{x^2}{4} - \frac{x^3}{6})\big|_{-1}^1 = -\frac{1}{3}.
|
||||
\int_{-1}^1 xf(x) dx = \int_{-1}^1 x\cdot (1-x)/2 = \left(\frac{x^2}{4} - \frac{x^3}{6}\right)\Big|_{-1}^1 = -\frac{1}{3}.
|
||||
$$
|
||||
|
||||
The bottom integral is just the area (or total mass if the $\rho$ were not canceled) and by geometry is $1/2 (1)(2) = 1$. So $\text{cm}_x = -1/3$.
|
||||
The bottom integral is just the area (or total mass if the $\rho$ were not canceled) and by geometry is $1/2 (1)(2) = 1$. So $\overline{\text{cm}}_x = -1/3$.
|
||||
|
||||
|
||||
##### Example
|
||||
|
||||
|
||||
Find the center of mass formed by the intersection of the parabolas $y=1 - x^2$ and $y=(x-1)^2 - 2$.
|
||||
|
||||
|
||||
The center of mass (in the $x$ direction) can be seen to be close to $x=1/2$:
|
||||
Find the center of mass formed by the intersection of the parabolas $y=1 - x^2$ and $y=(x-1)^2 - 2$. @fig-center-of-mass-of-two-parabola-1-minus-xsquared-and-x-minus-1-sqared-minus-2 shows that for the $x$ direction, it is close to $1/2$.
|
||||
|
||||
|
||||
::: {#fig-center-of-mass-of-two-parabola-1-minus-xsquared-and-x-minus-1-sqared-minus-2}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
f1(x) = 1 - x^2
|
||||
f2(x) = (x-1)^2 -2
|
||||
plot(f1, -3, 3)
|
||||
plot!(f2, -3, 3)
|
||||
plot(f1, -3, 3; legend=false)
|
||||
plot!(f2)
|
||||
```
|
||||
|
||||
To find it, we need to find the intersection points, then integrate. We do so numerically.
|
||||
Plot of $1-x^2$ and $(x-1)^2-2$ used to find intersection points for a center of mass calculation
|
||||
:::
|
||||
|
||||
We first find the intersection points numerically, though where two quadratics can readily be solved algebraically:
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
h(x) = f1(x) - f2(x)
|
||||
a,b = find_zeros(h, -3, 3)
|
||||
top, err = quadgk(x -> x * h(x), a, b)
|
||||
bottom, err = quadgk(h, a, b)
|
||||
```
|
||||
|
||||
With these, the computation of the center of mass involves two integrations:
|
||||
|
||||
```{julia}
|
||||
top = first(quadgk(x -> x * h(x), a, b))
|
||||
bottom = first(quadgk(h, a, b))
|
||||
cm = top / bottom
|
||||
```
|
||||
|
||||
@@ -259,17 +281,17 @@ We need to compute $\int_{-\infty}^\infty xf(x) dx$, but in this case since $f$
|
||||
|
||||
|
||||
$$
|
||||
\mu = \int_0^\infty x e^{-x} dx = -(1+x) \cdot e^{-x} \big|_0^\infty = 1
|
||||
\mu = \int_0^\infty x e^{-x} dx = -(1+x) \cdot e^{-x} \Big|_0^\infty = 1
|
||||
$$
|
||||
|
||||
For fun, we compare this to the median, which is the value $M$ so that the total area is split in half. That is, the following formula is satisfied: $\int_0^M f(x) dx = 1/2$. To compute, we have:
|
||||
|
||||
|
||||
$$
|
||||
\int_0^M e^{-x} dx = -e^{-x} \big|_0^M = 1 - e^{-M}.
|
||||
\int_0^M e^{-x} dx = -e^{-x} \Big|_0^M = 1 - e^{-M}.
|
||||
$$
|
||||
|
||||
Solving $1/2 = 1 - e^{-M}$ gives $M=\log(2) = 0.69...$, The median is to the left of the mean in this example.
|
||||
Solving $1/2 = 1 - e^{-M}$ gives $M=\log(2) = 0.69\cdots$, The median is to the left of the mean in this example.
|
||||
|
||||
|
||||
:::{.callout-note}
|
||||
@@ -281,21 +303,29 @@ In this example, we used an infinite region, so the idea of "balancing" may be a
|
||||
##### Example
|
||||
|
||||
|
||||
A figure is formed by transformations of the function $\phi(u) = e^{2(k-1)} - e^{2(k-u)}$, for some fixed $k$, as follows:
|
||||
@fig-center-of-mass-between-two-shifted-exponentials shows a region formed by transformations of the function $\phi(u) = e^{2(k-1)} - e^{2(k-u)}$, for some fixed $k$ ($k=3$ in the figure) between $0$ and $3$. The region is basically the graph of $\phi(u)$ and the graph of its shifted value $\phi(u+1)$, only truncated on the top and bottom.
|
||||
|
||||
|
||||
|
||||
We have
|
||||
|
||||
```{julia}
|
||||
k = 3
|
||||
phi(u) = exp(2(k-1)) - exp(2(k-u))
|
||||
f(u) = max(0, phi(u))
|
||||
g(u) = min(f(u+1), f(k))
|
||||
|
||||
plot(f, 0, k, legend=false)
|
||||
plot!(g, 0, k)
|
||||
plot!(zero, 0, k)
|
||||
```
|
||||
|
||||
(This is basically the graph of $\phi(u)$ and the graph of its shifted value $\phi(u+1)$, only truncated on the top and bottom.)
|
||||
::: {#fig-center-of-mass-between-two-shifted-exponentials}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
k = 3
|
||||
plot(f, 0, k; legend=false, line=(1, :black))
|
||||
plot!(g; line=(1, :black))
|
||||
plot!(zero; line=(1, :black))
|
||||
```
|
||||
|
||||
Plot of shifts of $\phi(u) = e^{2(k-1)} - e^{2(k-u)}$ over $[0,k]$
|
||||
:::
|
||||
|
||||
|
||||
The center of mass of this figure is found with:
|
||||
@@ -308,9 +338,9 @@ bottom, _ = quadgk(h, 0, k)
|
||||
top/bottom
|
||||
```
|
||||
|
||||
This figure has constant slices of length $1$ for fixed values of $y$. If we were to approximate the values with blocks of height $1$, then the center of mass would be to the left of $1$ - for any $k$, but the top most block would have an overhang to the right of $1$ - out to a value of $k$. That is, this figure should balance:
|
||||
|
||||
This figure has constant slices of length $1$ for fixed values of $y$. If we were to approximate the values with blocks of height $1$, then the center of mass would be to the left of $1$---for any $k$, but the top most block would have an overhang to the right of $1$---out to a value of $k$. That is, the blocks in @fig-max-hangover-figure should balance.
|
||||
|
||||
::: {#fig-max-hangover-figure}
|
||||
```{julia}
|
||||
#| echo: false
|
||||
u(i) = 1/2*(2k - log(exp(2(k-1)) - i))
|
||||
@@ -324,6 +354,8 @@ plot!(p, f, 0, e, linewidth=5);
|
||||
plot!(p, g, 0, 3, linewidth=5)
|
||||
p
|
||||
```
|
||||
Figure of block arrangement that should be stable
|
||||
:::
|
||||
|
||||
See this [paper](https://math.dartmouth.edu/~pw/papers/maxover.pdf) and its references for some background on this example and its extensions.
|
||||
|
||||
@@ -331,56 +363,69 @@ See this [paper](https://math.dartmouth.edu/~pw/papers/maxover.pdf) and its refe
|
||||
### The $y$ direction.
|
||||
|
||||
|
||||
We can talk about the center of mass in the $y$ direction too. The approximating picture uses horizontal rectangles - not vertical ones - and if we describe them by $f(y)$, then the corresponding formulas would be
|
||||
We can talk about the center of mass in the $y$ direction too. Suppose our region is bounded by $g(x) \le f(x)$ over $[a,b]$. The center of mass can be computed different ways. If the region can be described by two functions in the $y$ direction, the same formulas as in the $x$ direction can be used.
|
||||
|
||||
However, with the region as described, we can use this form
|
||||
|
||||
|
||||
> $\text{center of mass} = \text{cm}_y = \frac{\int_a^b y f(y) dy}{\int_a^b f(y) dy}.$
|
||||
|
||||
|
||||
|
||||
For example, consider, again, the triangle bounded by the line $x=-1$, the $x$ axis, and the line $y=(1-x)/2$. In terms of describing this in $y$, the function $f(y)=2 -2y$ gives the total length of the horizontal slice (which comes from solving $y=(1-x)/2$for $x$, the general method to find an inverse function, and subtracting $-1$) and the interval is $y=0$ to $y=1$. Thus our center of mass in the $y$ direction will be
|
||||
::: {.definition title="Center of mass in y direction"}
|
||||
|
||||
For a region bounded between $g(x) \le f(x)$ over $[a,b]$, the center of mass in the $y$ direction can be computed by:
|
||||
|
||||
$$
|
||||
\text{cm}_y = \frac{\int_0^1 y (2 - 2y) dy}{\int_0^1 (2 - 2y) dy} = \frac{(2y^2/2 - 2y^3/3)\big|_0^1}{1} = \frac{1}{3}.
|
||||
$$
|
||||
|
||||
Here the center of mass is below $1/2$ as the bulk of the area is. (The bottom area is just $1$, as known from the area of a triangle.)
|
||||
|
||||
|
||||
As seen, the computation of the center of mass in the $y$ direction has an identical formula, though may be more involved if an inverse function must be computed.
|
||||
|
||||
|
||||
::: {.callout-note}
|
||||
#### An alternative formula
|
||||
|
||||
An alternative formula, which is easily derived once double integrals are introduced, to find the center of mass in the $y$ direction is
|
||||
|
||||
$$
|
||||
\text{cm}_y = \frac{\int_a^b \frac{1}{2}(f(x)^2 - g(x)^2) dx}{\int_a^b (f(x) -g(x)) dx}.
|
||||
\overline{\text{cm}}_y = \frac{\int_a^b \frac{1}{2}(f(x)^2 - g(x)^2) dx}{\int_a^b (f(x) -g(x)) dx}.
|
||||
$$
|
||||
|
||||
:::
|
||||
|
||||
This formula follows readily once two dimensional integrals are discussed.^[If $\rho(x,y)$ describes the density of a region $A$, then the center of mass in the $y$ direction is found by $\iint_A y \rho(x,y) dy dx / \iint_A \rho(x,y) dy dx$. With constant density, as assumed herein, and the region described by $g(x) \le f(x)$, the top integral becomes $\int_a^b \int_{g(x)}^{f(x)} y dy dx = \int_a^b (1/2)\left(f(x)^2 - g(x)^2\right) dx$. Similarly. for the $x$ direction, the top integral is $\iint x \rho(x,y) dy dx$ which becomes under these assumptions $\int_a^b \int_{g(x)}^{f(x)} x dy dx = \int_a^b x\left(f(x) - g(x)\right) dx$.]
|
||||
|
||||
|
||||
For example, consider, again, the triangle bounded by the line $x=-1$, the $x$ axis, and the line $y=(1-x)/2$. In terms of describing this in $y$, the function $u(y)=2 -2y$ gives the total length of the horizontal slice (which comes from solving $y=(1-x)/2$for $x$, the general method to find an inverse function, and subtracting $-1$) and the interval is $y=0$ to $y=1$. Thus our center of mass in the $y$ direction will be
|
||||
|
||||
|
||||
$$
|
||||
\overline{\text{cm}}_y = \frac{\int_0^1 y (2 - 2y) dy}{\int_0^1 (2 - 2y) dy} = \frac{(2y^2/2 - 2y^3/3)\Big|_0^1}{1} = \frac{1}{3}.
|
||||
$$
|
||||
|
||||
Here the center of mass is below $1/2$ as the bulk of the area is. (The bottom area is just $1$, as known from the area of a triangle.)
|
||||
|
||||
Using the other formula, where $f(x) = (1-x)/2$ and $g(x)=0$, we have
|
||||
|
||||
$$
|
||||
\begin{align*}
|
||||
\frac{1}{2} \int_{-1}^1 (f(x)^2 - g(x)^2) dx
|
||||
&= \frac{1}{2} \int_{-1}^1 \frac{(1-x)^2}{4} dx\\
|
||||
&= \frac{1}{2}\frac{1}{4} \left(-\frac{(1-x)^3}{3}\right) \big|_{-1}^1\\
|
||||
&= \frac{1}{24} \left((1-x)^3\right) \big|_1^{-1}\\
|
||||
&= \frac{8}{24} - 0 = \frac{1}{3}
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
The total area is
|
||||
|
||||
$$
|
||||
\int_{-1}^1 \frac{1-x}{2} dx = -\frac{(1-x)^2}{4}\big|_{-1}^1 = 0 - (-1) = 1
|
||||
$$
|
||||
|
||||
Leaving, $\overline{\text{cm}}_y = 1/3$, as before.
|
||||
|
||||
##### Example
|
||||
|
||||
|
||||
More generally, consider a right triangle with vertices $(0,0)$, $(0,a)$, and $(b,0)$. The center of mass of this can be computed with the help of the equation for the line that forms the hypotenuse: $x/b + y/a = 1$. We find the center of mass symbolically in the $y$ variable by solving for $x$ in terms of $y$, then integrating from $0$ to $a$:
|
||||
More generally, consider a right triangle with vertices $(0,0)$, $(0,a)$, and $(b,0)$. The center of mass of this can be computed with the help of the equation for the line that forms the hypotenuse: $x/b + y/a = 1$. We find the center of mass symbolically in the $y$ variable by writing $f(x) = a \cdot (1 - x)/b$ and $g(x) = 0$
|
||||
|
||||
|
||||
```{julia}
|
||||
@syms a b x y
|
||||
eqn = x/b + y/a - 1
|
||||
fy = solve(eqn, x)[1]
|
||||
integrate(y*fy, (y, 0, a)) / integrate(fy, (y, 0, a))
|
||||
fx = only(solve(x/b + y/a ~ 1, y))
|
||||
(1//2) * integrate(fx^2, (x, 0, b)) / integrate(fx, (x, 0, b))
|
||||
```
|
||||
|
||||
The answer involves $a$ linearly, but not $b$. If we find the center of mass in $x$, we *could* do something similar:
|
||||
The answer involves $a$ linearly, but not $b$. If we find the center of mass in $x,$ we *could* do something similar:
|
||||
|
||||
|
||||
```{julia}
|
||||
fx = solve(eqn, y)[1]
|
||||
integrate(x*fx, (x, 0, b)) / integrate(fx, (x, 0, b))
|
||||
```
|
||||
|
||||
@@ -389,7 +434,7 @@ But really, we should have just noted that simply by switching the labels $a$ an
|
||||
|
||||
:::{.callout-note}
|
||||
## Note
|
||||
The [centroid](http://en.wikipedia.org/wiki/Centroid) of a region in the plane is just $(\text{cm}_x, \text{cm}_y)$. This last fact says the centroid of the right triangle is just $(b/3, a/3)$. The centroid can be found by other geometric means. The link shows the plumb line method. For triangles, the centroid is also the intersection point of the medians, the lines that connect a vertex with its opposite midpoint.
|
||||
The [centroid](http://en.wikipedia.org/wiki/Centroid) of a region in the plane is just $(\overline{\text{cm}}_x, \overline{\text{cm}}_y)$. This last fact says the centroid of the right triangle is just $(b/3, a/3)$. The centroid can be found by other geometric means. The link shows the plumb line method. For triangles, the centroid is also the intersection point of the medians, the lines that connect a vertex with its opposite midpoint.
|
||||
|
||||
:::
|
||||
|
||||
@@ -398,29 +443,21 @@ The [centroid](http://en.wikipedia.org/wiki/Centroid) of a region in the plane i
|
||||
|
||||
Compute the $x$ and $y$ values of the center of mass of the half circle described by the area below the function $f(x) = \sqrt{1 - x^2}$ and above the $x$-axis.
|
||||
|
||||
|
||||
A plot shows the value of cm$_x$ will be $0$ by symmetry:
|
||||
As $f(x)$ is even, $x \cdot f(x)$ would be odd, so the center of mass in the $x$ direction is $0$.
|
||||
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
f(x) = sqrt(1 - x^2)
|
||||
plot(f, -1, 1)
|
||||
```
|
||||
|
||||
($f(x)$ is even, so $xf(x)$ will be odd.)
|
||||
|
||||
|
||||
However, the value for cm$_y$ will - like the last problem - be around $1/3$. The exact value is compute using slices in the $y$ direction. Solving for $x$ in $y=\sqrt{1-x^2}$, or $x = \pm \sqrt{1-y^2}$, if $f(y) = 2\sqrt{1 - y^2}$. The value is then:
|
||||
|
||||
The value for $\overline{\text{cm}}_y$ will certainly be less than $1/2$ as the circle narrows as $y$ increases to $1$. The exact value is given by:
|
||||
|
||||
$$
|
||||
\text{cm}_y = \frac{\int_{0}^1 y 2 \sqrt{1 - y^2}dy}{\int_{0}^1 2\sqrt{1-y^2}} =
|
||||
\frac{-2(1-y^2)^{3/2}/3\big|_0^1}{\pi/2} = \frac{4}{3\pi}.
|
||||
\begin{align*}
|
||||
\frac{1}{2}\frac{2}{\pi} \cdot \int_{-1}^1 (\sqrt{1 - x^2})^2 dx
|
||||
&= \frac{1}{\pi} \int_{-1}^1 ( 1 - x^2) dx\\
|
||||
&= \frac{1}{\pi} (x - \frac{x^3}{3})\big|_{-1}^1 = \frac{1}{\pi}\frac{4}{3}\\
|
||||
&= 0.424413\cdots.
|
||||
\end{align*}
|
||||
$$
|
||||
|
||||
The top calculation is done by $u$-substitution, the bottom by using the area formula for a half circle, $\pi r^2/2$.
|
||||
|
||||
The value $2/\pi$ comes from the area of the figure being the area of half the unit circle, which has area $\pi$.
|
||||
|
||||
##### Example
|
||||
|
||||
@@ -428,24 +465,34 @@ The top calculation is done by $u$-substitution, the bottom by using the area fo
|
||||
A disc of radius $2$ is centered at the origin, as a disc of radius $1$ is bored out between $y=0$ and $y=1$. Find the resulting center of mass.
|
||||
|
||||
|
||||
A picture shows that this could be complicated, especially for $y > 0$, as we need to describe the length of the red lines below for $-2 < y < 2$:
|
||||
|
||||
@fig-disc-radius-2-hole-bored-out shows that this could be complicated, especially for $y > 0$, as we need to describe the length of the red lines below for $-2 < y < 2$:
|
||||
|
||||
::: {#fig-disc-radius-2-hole-bored-out}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
a,b = 0, 2pi
|
||||
ts = range(a, stop=b, length=50)
|
||||
p = plot(t -> 2cos(t), t->2sin(t), a, b, legend=false, aspect_ratio=:equal);
|
||||
plot!(p, cos.(ts), 1 .+ sin.(ts), linetype=:polygon, color=:red);
|
||||
plot!(p, [-sqrt(3), sqrt(3)], [-1,-1], color=:orange);
|
||||
plot!(p, [-sqrt(3), -1], [1,1], color=:orange);
|
||||
plot!(p, [sqrt(3), 1], [1,1], color=:orange);
|
||||
p
|
||||
let
|
||||
gr()
|
||||
a,b = 0, 2pi
|
||||
ts = range(a, stop=b, length=50)
|
||||
p = plot(t -> 2cos(t), t->2sin(t), a, b; legend=false, line=(1, :black), aspect_ratio=:equal);
|
||||
plot!(p, cos.(ts), 1 .+ sin.(ts), linetype=:polygon, color=:red);
|
||||
plot!(p, [(-sqrt(3), -1), (sqrt(3), -1)], line=(1, :orange))
|
||||
plot!(p, [(-sqrt(3), 1), (-1, 1)]; line=(1, :orange))
|
||||
plot!(p, [( 1, 1), (sqrt(3), 1)]; line=(1, :orange))
|
||||
plotly()
|
||||
p
|
||||
end
|
||||
|
||||
```
|
||||
|
||||
We can see that cm$_x = 0$, by symmetry, but to compute cm$_y$ we need to find $f(y)$, which will depend on the value of $y$ between $-2$ and $2$. The outer circle is $x^2 + y^2 = 4$, the inner circle $x^2 + (y-1)^2 = 1$. When $y < 0$, $f(y)$ is the distance across the outer circle or, $2\sqrt{4 - y^2}$. When $y \geq 0$, $f(y)$ is *twice* the distance from the bigger circle to the smaller, of $2(\sqrt{4 - y^2} - \sqrt{1 - (y-1)^2})$.
|
||||
Disk of radius $2$ with a hole of radius $1$ bored out
|
||||
:::
|
||||
|
||||
|
||||
We can see that $\overline{\text{cm}}_x = 0$, by symmetry.
|
||||
|
||||
To compute $\overline{\text{cm}}_y$ we choose to find $f(y)$, which will depend on the value of $y$ between $-2$ and $2$. The outer circle is $x^2 + y^2 = 4$, the inner circle $x^2 + (y-1)^2 = 1$. When $y < 0$, $f(y)$ is the distance across the outer circle or, $2\sqrt{4 - y^2}$. When $y \geq 0$, $f(y)$ is *twice* the distance from the bigger circle to the smaller, of $2(\sqrt{4 - y^2} - \sqrt{1 - (y-1)^2})$.
|
||||
|
||||
|
||||
We use this to compute:
|
||||
@@ -453,13 +500,48 @@ We use this to compute:
|
||||
|
||||
```{julia}
|
||||
#| hold: true
|
||||
f(y) = y < 0 ? 2*sqrt(4 - y^2) : 2* (sqrt(4 - y^2)- sqrt(1 - (y-1)^2))
|
||||
top, _ = quadgk( y -> y * f(y), -2, 2)
|
||||
bottom, _ = quadgk( f, -2, 2)
|
||||
f(y) = y < 0 ? 2 * sqrt(4 - y^2) : 2 * (sqrt(4 - y^2)- sqrt(1 - (y-1)^2))
|
||||
top, _ = quadgk(y -> y * f(y), -2, 2)
|
||||
bottom, _ = quadgk(f, -2, 2)
|
||||
top/bottom
|
||||
```
|
||||
|
||||
The nice answer of $-1/3$ makes us think there may be a different way to visualize this. Were we to rearrange the top integral, we could write it as $\int_{-2}^2 y 2 \sqrt{4 -y^2}dy - \int_0^2 2y\sqrt{1 - (y-1)^2}dy$. Call this $A - B$. The left term, $A$, is part of the center of mass formula for the big circle (which is this value divided by $M=4\pi$), and the right term, $B$, is part of the center of mass formula for the (drilled out) smaller circle (which is this value divided by $m=\pi$. These values are weighted according to $(AM - Bm)/(M-m)$. In this case $A=0$, $B=1$ and $M=4m$, so the answer is $-1/3$.
|
||||
The nice answer of $-1/3$ makes us think there may be a different way to compute this quantity.
|
||||
|
||||
|
||||
Indeed, let $A$ be the big circle with the bite taken out, $B$ be the smaller circle, $C$ the big circle. Clearly, the center of mass of $C$ in the $y$ direction is $0$ and the center of mass of $B$ in the $y$ direction is $1$. The center of mass of $C$ is the *weighted average* of the center of mass of $A$ plus that of $B$:
|
||||
|
||||
$$
|
||||
\overline{\text{cm}_C} = \frac{4\pi - \pi}{4\pi} \overline{\text{cm}_A} + \frac{\pi}{4\pi}\overline{\text{cm}_B}
|
||||
$$
|
||||
|
||||
Or
|
||||
|
||||
$$
|
||||
0 = \frac{3}{4}\overline{\text{cm}_A} + \frac{1}{4}
|
||||
$$
|
||||
|
||||
which is solved by $\overline{\text{cm}_A}=-1/3$.
|
||||
|
||||
|
||||
This above works as:
|
||||
|
||||
::: {.relationship title="Center of mass of complex shapes"}
|
||||
If a complicated shape can be partitioned into simpler shapes for which the center of mass can be computed, then the resulting center of mass is the weighted sum of the centers of mass of the simpler shapes. The weights are given by the relative masses.^[Again, this follows readily from the center of mass formula in two dimensions. For example, if $A$ can be partitioned into $B$ and $C$ then we have in the $y$ direction:
|
||||
$$
|
||||
\begin{align*}
|
||||
\overline{\text{cm}}_A &=
|
||||
\frac{\iint_A y \rho da}{\iint_A \rho da}\\
|
||||
&= \frac{\iint_B y \rho da}{\iint_A \rho da} + \frac{\iint_C y \rho da}{\iint_A \rho da}\\
|
||||
&= \frac{\iint_B y \rho da}{\iint_B \rho da} \cdot \frac{\iint_B \rho da}{\iint_A \rho da} +
|
||||
\frac{\iint_C y \rho da}{\iint_C \rho da} \cdot \frac{\iint_C \rho da}{\iint_A \rho da}\\
|
||||
&= \overline{\text{cm}}_B \frac{\iint_B\rho da}{\iint_A \rho da} +
|
||||
\overline{\text{cm}}_C \frac{\iint_C \rho da}{\iint_A \rho da}
|
||||
\end{align*}
|
||||
$$
|
||||
]
|
||||
:::
|
||||
|
||||
|
||||
|
||||
## Questions
|
||||
@@ -613,37 +695,45 @@ numericq(val)
|
||||
###### Question
|
||||
|
||||
|
||||
A penny, nickel, dime and quarter are stacked so that their right most edges align and are centered so that the center of mass in the $y$ direction is $0$. Find the center of mass in the $x$ direction.
|
||||
|
||||
@fig-penny-nickel-dime-quarter visualizes a penny, nickel, dime and quarter that are stacked so that their right most edges align and are centered so that the center of mass in the $y$ direction is $0$. Find the center of mass in the $x$ direction.
|
||||
|
||||
::: {#fig-penny-nickel-dime-quarter}
|
||||
```{julia}
|
||||
#| hold: true
|
||||
#| echo: false
|
||||
ds = [0.75, 0.835, 0.705, 0.955]
|
||||
rs = ds/2
|
||||
xs = rs[4] .- rs
|
||||
ts = range(0,stop=2pi, length=50)
|
||||
p = plot(legend=false, aspect_ratio=:equal);
|
||||
for i in 1:4
|
||||
plot!(p, xs[i] .+ rs[i]*cos.(ts), rs[i]*sin.(ts));
|
||||
let
|
||||
ds = [0.75, 0.835, 0.705, 0.955]
|
||||
rs = ds/2
|
||||
xs = rs[4] .- rs
|
||||
ts = range(0,stop=2pi, length=50)
|
||||
p = plot(legend=false, aspect_ratio=:equal);
|
||||
for i in 1:4
|
||||
plot!(p, xs[i] .+ rs[i]*cos.(ts), rs[i]*sin.(ts); line=(1, :black));
|
||||
end
|
||||
|
||||
p
|
||||
end
|
||||
|
||||
p
|
||||
```
|
||||
|
||||
You will need some specifications, such as these from the [US Mint](http://www.usmint.gov/about_the_mint/?action=coin_specifications)
|
||||
Sketch of a dime, penny, nickel, and quarter stacked with an edge aligned
|
||||
:::
|
||||
|
||||
You will need some specifications, such as the one from the [US Mint](http://www.usmint.gov/about_the_mint/?action=coin_specifications) in @tbl-diameter-mass-coins.
|
||||
|
||||
|
||||
```{eval=false}
|
||||
diameter(in) weight(gms)
|
||||
penny 0.750 2.500
|
||||
nickel 0.835 5.000
|
||||
dime 0.705 2.268
|
||||
quarter 0.955 5.670
|
||||
::: {#tbl-diameter-mass-coins .striped .hover}
|
||||
|
||||
```
|
||||
| | diameter(in) | weight(gms) |
|
||||
|:---------:|:--------------:|:--------------:|
|
||||
| penny | 0.750 | 2.500 |
|
||||
| nickel | 0.835 | 5.000 |
|
||||
| dime | 0.705 | 2.268 |
|
||||
| quarter | 0.955 | 5.670 |
|
||||
|
||||
(Hint: Though this could be done with integration, it is easier to treat each coin as a single point (its centroid) with the given mass and then apply the formula for sums.)
|
||||
Size and weight of US coins
|
||||
:::
|
||||
|
||||
(Hint: Though this could be done with integration, it is easier to treat each coin as a single point (its centroid) with the given mass and then apply the center of mass formula for sums.)
|
||||
|
||||
|
||||
```{julia}
|
||||
|
||||
Reference in New Issue
Block a user